diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 6f630f7585..876be8148d 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -2906,9 +2906,33 @@ void clif_inventorylist( struct map_session_data *sd ){ // Non-stackable (Equippable) if( !itemdb_isstackable2( sd->inventory_data[i] ) ){ clif_item_equip( client_index( i ), &itemlist_equip.list[equip++], &sd->inventory.u.items_inventory[i], sd->inventory_data[i], pc_equippoint( sd, i ) ); + + if( equip == MAX_INVENTORY_ITEM_PACKET_NORMAL ){ + itemlist_equip.PacketType = inventorylistequipType; + itemlist_equip.PacketLength = ( sizeof( itemlist_equip ) - sizeof( itemlist_equip.list ) ) + ( sizeof( struct EQUIPITEM_INFO ) * equip ); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 + itemlist_equip.invType = type; +#endif + + clif_send( &itemlist_equip, itemlist_equip.PacketLength, &sd->bl, SELF ); + + equip = 0; + } // Stackable (Normal) }else{ clif_item_normal( client_index( i ), &itemlist_normal.list[normal++], &sd->inventory.u.items_inventory[i], sd->inventory_data[i] ); + + if( normal == MAX_INVENTORY_ITEM_PACKET_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 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 + itemlist_normal.invType = type; +#endif + + clif_send( &itemlist_normal, itemlist_normal.PacketLength, &sd->bl, SELF ); + + normal = 0; + } } } @@ -2977,9 +3001,37 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items // Non-stackable (Equippable) if( !itemdb_isstackable2( id ) ){ clif_item_equip( client_storage_index( i ), &storage_itemlist_equip.list[equip++], &items[i], id, pc_equippoint_sub( sd, id ) ); + + if( equip == MAX_STORAGE_ITEM_PACKET_EQUIP ){ + storage_itemlist_equip.PacketType = storageListEquipType; + storage_itemlist_equip.PacketLength = ( sizeof( storage_itemlist_equip ) - sizeof( storage_itemlist_equip.list ) ) + ( sizeof( struct EQUIPITEM_INFO ) * equip ); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 + storage_itemlist_equip.invType = type; +#elif PACKETVER >= 20120925 + safestrncpy( storage_itemlist_equip.name, storename, NAME_LENGTH ); +#endif + + clif_send( &storage_itemlist_equip, storage_itemlist_equip.PacketLength, &sd->bl, SELF ); + + equip = 0; + } // Stackable (Normal) }else{ clif_item_normal( client_storage_index( i ), &storage_itemlist_normal.list[normal++], &items[i], id ); + + if( normal == MAX_STORAGE_ITEM_PACKET_NORMAL ){ + storage_itemlist_normal.PacketType = storageListNormalType; + storage_itemlist_normal.PacketLength = ( sizeof( storage_itemlist_normal ) - sizeof( storage_itemlist_normal.list ) ) + ( sizeof( struct NORMALITEM_INFO ) * normal ); +#if PACKETVER_RE_NUM >= 20180912 || PACKETVER_ZERO_NUM >= 20180919 || PACKETVER_MAIN_NUM >= 20181002 + storage_itemlist_normal.invType = type; +#elif PACKETVER >= 20120925 + safestrncpy( storage_itemlist_normal.name, storename, NAME_LENGTH ); +#endif + + clif_send( &storage_itemlist_normal, storage_itemlist_normal.PacketLength, &sd->bl, SELF ); + + normal = 0; + } } } diff --git a/src/map/packets.hpp b/src/map/packets.hpp index 803695f5c8..4d5e525aaf 100644 --- a/src/map/packets.hpp +++ b/src/map/packets.hpp @@ -26,6 +26,12 @@ #include "packets_struct.hpp" +const int16 MAX_INVENTORY_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_normal ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) ); +const int16 MAX_INVENTORY_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct packet_itemlist_equip ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) ); + +const int16 MAX_STORAGE_ITEM_PACKET_NORMAL = ( ( INT16_MAX - ( sizeof( struct ZC_STORE_ITEMLIST_NORMAL ) - ( sizeof( struct NORMALITEM_INFO ) * MAX_ITEMLIST) ) ) / sizeof( struct NORMALITEM_INFO ) ); +const int16 MAX_STORAGE_ITEM_PACKET_EQUIP = ( ( INT16_MAX - ( sizeof( struct ZC_STORE_ITEMLIST_EQUIP ) - ( sizeof( struct EQUIPITEM_INFO ) * MAX_ITEMLIST ) ) ) / sizeof( struct EQUIPITEM_INFO ) ); + #undef MAX_ITEM_OPTIONS #undef UNAVAILABLE_STRUCT #undef MAX_ITEMLIST