diff options
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/clif.c | 60 | ||||
-rw-r--r-- | src/map/clif.h | 6 | ||||
-rw-r--r-- | src/map/packets_struct.h | 14 | ||||
-rw-r--r-- | src/map/pet.c | 2 | ||||
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/skill.c | 6 |
7 files changed, 70 insertions, 24 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 6522f3013..2538f797c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4297,7 +4297,7 @@ ACMD(repairall) if (count > 0) { clif->misceffect(&sd->bl, 3); - clif->equiplist(sd); + clif->equipList(sd); clif->message(fd, msg_fd(fd,107)); // All items have been repaired. } else { clif->message(fd, msg_fd(fd,108)); // No item need to be repaired. diff --git a/src/map/clif.c b/src/map/clif.c index 3b114cdca..f76a76efc 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2787,7 +2787,18 @@ static void clif_item_normal(short idx, struct NORMALITEM_INFO *p, struct item * #endif } -static void clif_inventorylist(struct map_session_data *sd) +static void clif_inventoryList(struct map_session_data *sd) +{ +#if PACKETVER_RE_NUM >= 20180912 + clif->inventoryStart(sd, INVTYPE_INVENTORY, ""); +#endif + clif->inventoryItems(sd, INVTYPE_INVENTORY); +#if PACKETVER_RE_NUM >= 20180912 + clif->inventoryEnd(sd, INVTYPE_INVENTORY); +#endif +} + +static void clif_inventoryItems(struct map_session_data *sd, enum inventory_type type) { int i, normal = 0, equip = 0; @@ -2802,9 +2813,12 @@ static void clif_inventorylist(struct map_session_data *sd) clif->item_normal(i+2,&itemlist_normal.list[normal++],&sd->status.inventory[i],sd->inventory_data[i]); } - if( normal ) { - itemlist_normal.PacketType = inventorylistnormalType; - itemlist_normal.PacketLength = 4 + (sizeof(struct NORMALITEM_INFO) * normal); + if (normal) { + itemlist_normal.PacketType = inventorylistnormalType; + itemlist_normal.PacketLength = (sizeof(itemlist_normal) - sizeof(itemlist_normal.list)) + (sizeof(struct NORMALITEM_INFO) * normal); +#if PACKETVER_RE_NUM >= 20180912 + itemlist_normal.invType = type; +#endif clif->send(&itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF); } @@ -2814,7 +2828,10 @@ static void clif_inventorylist(struct map_session_data *sd) if( equip ) { itemlist_equip.PacketType = inventorylistequipType; - itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 + itemlist_equip.invType = type; +#endif clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); } @@ -2830,8 +2847,20 @@ static void clif_inventorylist(struct map_session_data *sd) #endif } +static void clif_equipList(struct map_session_data *sd) +{ +#if PACKETVER_RE_NUM >= 20180912 + clif->inventoryStart(sd, INVTYPE_INVENTORY, ""); + clif->inventoryItems(sd, INVTYPE_INVENTORY); + clif->inventoryEnd(sd, INVTYPE_INVENTORY); +#else + // [4144] for old packet version it send only equipment. this is bug? + clif->equipItems(sd, INVTYPE_INVENTORY); +#endif +} + //Required when items break/get-repaired. Only sends equippable item list. -static void clif_equiplist(struct map_session_data *sd) +static void clif_equipItems(struct map_session_data *sd, enum inventory_type type) { int i, equip = 0; @@ -2844,9 +2873,12 @@ static void clif_equiplist(struct map_session_data *sd) clif->item_equip(i+2,&itemlist_equip.list[equip++],&sd->status.inventory[i],sd->inventory_data[i],pc->equippoint(sd,i)); } - if( equip ) { - itemlist_equip.PacketType = inventorylistequipType; - itemlist_equip.PacketLength = 4 + (sizeof(struct EQUIPITEM_INFO) * equip); + if (equip) { + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = (sizeof(itemlist_equip) - sizeof(itemlist_equip.list)) + (sizeof(struct EQUIPITEM_INFO) * equip); +#if PACKETVER_RE_NUM >= 20180912 + itemlist_equip.invType = type; +#endif clif->send(&itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF); } @@ -8905,7 +8937,7 @@ static void clif_refresh(struct map_session_data *sd) nullpo_retv(sd); clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); - clif->inventorylist(sd); + clif->inventoryList(sd); if(pc_iscarton(sd)) { clif->cartlist(sd); clif->updatestatus(sd,SP_CARTINFO); @@ -9939,7 +9971,7 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) // Send character inventory to the client. // call this before pc->checkitem() so that the client isn't called to delete a non-existent item. - clif->inventorylist(sd); + clif->inventoryList(sd); // Send the cart inventory, counts & weight to the client. if(pc_iscarton(sd)) { @@ -22252,8 +22284,10 @@ void clif_defaults(void) clif->combo_delay = clif_combo_delay; clif->status_change = clif_status_change; clif->insert_card = clif_insert_card; - clif->inventorylist = clif_inventorylist; - clif->equiplist = clif_equiplist; + clif->inventoryList = clif_inventoryList; + clif->inventoryItems = clif_inventoryItems; + clif->equipList = clif_equipList; + clif->equipItems = clif_equipItems; clif->cartlist = clif_cartlist; clif->favorite_item = clif_favorite_item; clif->clearcart = clif_clearcart; diff --git a/src/map/clif.h b/src/map/clif.h index 335fb42c5..a5d95172b 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -837,8 +837,10 @@ struct clif_interface { void (*combo_delay) (struct block_list *bl,int wait); void (*status_change) (struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3); void (*insert_card) (struct map_session_data *sd,int idx_equip,int idx_card,int flag); - void (*inventorylist) (struct map_session_data *sd); - void (*equiplist) (struct map_session_data *sd); + void (*inventoryList) (struct map_session_data *sd); + void (*inventoryItems) (struct map_session_data *sd, enum inventory_type type); + void (*equipList) (struct map_session_data *sd); + void (*equipItems) (struct map_session_data *sd, enum inventory_type type); void (*cartlist) (struct map_session_data *sd); void (*favorite_item) (struct map_session_data* sd, unsigned short index); void (*clearcart) (int fd); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f21d493c8..c94c140a1 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -198,7 +198,9 @@ enum packet_headers { #else dropflooritemType = 0x9e, #endif -#if PACKETVER >= 20120925 +#if PACKETVER_RE_NUM >= 20180912 + inventorylistnormalType = 0xb09, +#elif PACKETVER >= 20120925 inventorylistnormalType = 0x991, #elif PACKETVER >= 20080102 inventorylistnormalType = 0x2e8, @@ -207,7 +209,9 @@ enum packet_headers { #else inventorylistnormalType = 0xa3, #endif -#if PACKETVER >= 20150226 +#if PACKETVER_RE_NUM >= 20180912 + inventorylistequipType = 0xb0a, +#elif PACKETVER >= 20150226 inventorylistequipType = 0xa0d, #elif PACKETVER >= 20120925 inventorylistequipType = 0x992, @@ -1166,12 +1170,18 @@ struct packet_roulette_itemrecv_ack { struct packet_itemlist_normal { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif struct NORMALITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); struct packet_itemlist_equip { int16 PacketType; int16 PacketLength; +#if PACKETVER_RE_NUM >= 20180912 + uint8 invType; +#endif struct EQUIPITEM_INFO list[MAX_ITEMLIST]; } __attribute__((packed)); diff --git a/src/map/pet.c b/src/map/pet.c index cfb3e8253..c32a92b78 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -350,7 +350,7 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) sd->status.inventory[i].bound = IBT_NONE; } #if PACKETVER >= 20180704 - clif->inventorylist(sd); + clif->inventoryList(sd); clif->send_petdata(sd, pd, 6, 0); #endif pd->pet.incubate = 1; diff --git a/src/map/script.c b/src/map/script.c index 65ffc1a6d..2182b942c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9361,7 +9361,7 @@ static BUILDIN(repair) if(num==repaircounter) { sd->status.inventory[i].attribute |= ATTR_BROKEN; sd->status.inventory[i].attribute ^= ATTR_BROKEN; - clif->equiplist(sd); + clif->equipList(sd); clif->produce_effect(sd, 0, sd->status.inventory[i].nameid); clif->misceffect(&sd->bl, 3); break; @@ -9398,7 +9398,7 @@ static BUILDIN(repairall) if(repaircounter) { clif->misceffect(&sd->bl, 3); - clif->equiplist(sd); + clif->equipList(sd); } return true; diff --git a/src/map/skill.c b/src/map/skill.c index c5579c2f6..4eaab5457 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2588,7 +2588,7 @@ static int skill_break_equip(struct block_list *bl, unsigned short where, int ra pc->unequipitem(sd, j, PCUNEQUIPITEM_RECALC|PCUNEQUIPITEM_FORCE); } } - clif->equiplist(sd); + clif->equipList(sd); } return where; //Return list of pieces broken. @@ -16139,7 +16139,7 @@ static void skill_repairweapon(struct map_session_data *sd, int idx) item->attribute |= ATTR_BROKEN; item->attribute ^= ATTR_BROKEN; /* clear broken state */ - clif->equiplist(target_sd); + clif->equipList(target_sd); pc->delitem(sd, pc->search_inventory(sd, material), 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME); // FIXME: is this the correct reason flag? @@ -16222,7 +16222,7 @@ static void skill_weaponrefine(struct map_session_data *sd, int idx) } clif->delitem(sd, idx, 1, DELITEM_NORMAL); clif->upgrademessage(sd->fd, 0,item->nameid); - clif->inventorylist(sd); + clif->inventoryList(sd); clif->refine(sd->fd,0,idx,item->refine); if (ep) pc->equipitem(sd,idx,ep); |