diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 21 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/packets_struct.h | 16 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index ab1e88ffc..62b9a4ca9 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -21961,6 +21961,26 @@ static void clif_camera_change(struct map_session_data *sd, float range, float r #endif } +// show item preview in already opened preview window +static void clif_item_preview(struct map_session_data *sd, int n) +{ +#if PACKETVER_MAIN_NUM >= 20170726 || PACKETVER_RE_NUM >= 20170621 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + Assert_retv(n >= 0 && n < MAX_INVENTORY); + + struct PACKET_ZC_ITEM_PREVIEW p; + p.packetType = itemPreview; + p.index = n + 2; +#if PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 + p.isDamaged = (sd->status.inventory[n].attribute & ATTR_BROKEN) != 0 ? 1 : 0; +#endif + p.refiningLevel = sd->status.inventory[n].refine; + clif->addcards(&p.slot, &sd->status.inventory[n]); + clif->add_item_options(&p.option_data[0], &sd->status.inventory[n]); + clif->send(&p, sizeof(p), &sd->bl, SELF); +#endif +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -23127,6 +23147,7 @@ void clif_defaults(void) clif->camera_showWindow = clif_camera_showWindow; clif->camera_change = clif_camera_change; + clif->item_preview = clif_item_preview; // -- Pet Evolution clif->pPetEvolution = clif_parse_pet_evolution; diff --git a/src/map/clif.h b/src/map/clif.h index 13c34c77d..b76c5ed70 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1554,6 +1554,7 @@ struct clif_interface { void (*pMemorialDungeonCommand) (int fd, struct map_session_data *sd); void (*camera_showWindow) (struct map_session_data *sd); void (*camera_change) (struct map_session_data *sd, float range, float rotation, float latitude, enum send_target target); + void (*item_preview) (struct map_session_data *sd, int n); }; #ifdef HERCULES_CORE diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 6f3f3aeb1..c786e2457 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -451,6 +451,11 @@ enum packet_headers { #else guildLeave = 0x15a, #endif +#if PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 + itemPreview = 0xb13, +#else + itemPreview = 0xab9, +#endif }; #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute @@ -2872,6 +2877,17 @@ struct PACKET_ZC_CAMERA_INFO { float latitude; } __attribute__((packed)); +struct PACKET_ZC_ITEM_PREVIEW { + int16 packetType; + int16 index; +#if PACKETVER_MAIN_NUM >= 20181017 || PACKETVER_RE_NUM >= 20181017 + int8 isDamaged; +#endif + int16 refiningLevel; + struct EQUIPSLOTINFO slot; + struct ItemOptions option_data[MAX_ITEM_OPTIONS]; +} __attribute__((packed)); + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) |