summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-03-02 21:26:25 +0300
committerAndrei Karas <akaras@inbox.ru>2019-03-02 21:26:25 +0300
commitc2f54527e2a7047b5ef89f1b765efb51744d235e (patch)
tree17830545100667900cb5aa51ae710962fee209da /src/net/eathena
parentb3fea2cbd90c0d8a9560efe5227f035c701b5dff (diff)
downloadplus-c2f54527e2a7047b5ef89f1b765efb51744d235e.tar.gz
plus-c2f54527e2a7047b5ef89f1b765efb51744d235e.tar.bz2
plus-c2f54527e2a7047b5ef89f1b765efb51744d235e.tar.xz
plus-c2f54527e2a7047b5ef89f1b765efb51744d235e.zip
Impliment packet SMSG_PLAYER_COMBINED_EQUIPMENT 0x0b0a
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/inventoryrecv.cpp94
1 files changed, 74 insertions, 20 deletions
diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp
index 134a1e45b..8e713ae9b 100644
--- a/src/net/eathena/inventoryrecv.cpp
+++ b/src/net/eathena/inventoryrecv.cpp
@@ -525,7 +525,8 @@ void InventoryRecv::processPlayerStorage(Net::MessageIn &msg)
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
- Equipm_false));
+ Equipm_false,
+ -1));
}
BLOCK_END("InventoryRecv::processPlayerInventory")
}
@@ -744,7 +745,8 @@ void InventoryRecv::processPlayerStorageEquip(Net::MessageIn &msg)
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
- Equipm_false));
+ Equipm_false,
+ -1));
delete options;
}
BLOCK_END("InventoryRecv::processPlayerStorageEquip")
@@ -1029,7 +1031,8 @@ void InventoryRecv::processPlayerCartAdd(Net::MessageIn &msg)
fromBool(identified, Identified),
damaged,
Favorite_false,
- Equipm_false));
+ Equipm_false,
+ -1));
}
delete options;
BLOCK_END("InventoryRecv::processPlayerCartAdd")
@@ -1114,7 +1117,8 @@ void InventoryRecv::processPlayerCartEquip(Net::MessageIn &msg)
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
- Equipm_false));
+ Equipm_false,
+ -1));
delete options;
}
BLOCK_END("InventoryRecv::processPlayerCartEquip")
@@ -1180,7 +1184,8 @@ void InventoryRecv::processPlayerCartItems(Net::MessageIn &msg)
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
- Equipm_false));
+ Equipm_false,
+ -1));
}
BLOCK_END("InventoryRecv::processPlayerCartItems")
}
@@ -1671,13 +1676,13 @@ void InventoryRecv::processInventoryContinue(Net::MessageIn &msg,
fromBool(flags.bits.isIdentified, Identified),
fromBool(flags.bits.isDamaged, Damaged),
fromBool(flags.bits.isFavorite, Favorite),
- Equipm_false));
+ Equipm_false,
+ -1));
}
}
void InventoryRecv::processPlayerCombinedEquipment1(Net::MessageIn &msg)
{
- UNIMPLEMENTEDPACKET;
const int dataLen = msg.readInt16("len") - 4;
processEquipmentContinue(msg,
dataLen,
@@ -1686,7 +1691,6 @@ void InventoryRecv::processPlayerCombinedEquipment1(Net::MessageIn &msg)
void InventoryRecv::processPlayerCombinedEquipment2(Net::MessageIn &msg)
{
- UNIMPLEMENTEDPACKET;
const int dataLen = msg.readInt16("len") - 5;
const NetInventoryTypeT invType = static_cast<NetInventoryTypeT>(
msg.readUInt8("type"));
@@ -1697,33 +1701,83 @@ void InventoryRecv::processPlayerCombinedEquipment2(Net::MessageIn &msg)
void InventoryRecv::processEquipmentContinue(Net::MessageIn &msg,
const int len,
- const NetInventoryTypeT invType
- A_UNUSED)
+ const NetInventoryTypeT invType)
{
const int packetLen = 47 + itemIdLen * 5;
const int number = len / packetLen;
+ int offset = INVENTORY_OFFSET;
+
+ switch (invType)
+ {
+ case NetInventoryType::Inventory:
+ case NetInventoryType::Cart:
+ default:
+ offset = INVENTORY_OFFSET;
+ break;
+ case NetInventoryType::Storage:
+ case NetInventoryType::GuildStorage:
+ offset = STORAGE_OFFSET;
+ break;
+ }
+
+ Ea::InventoryItems *items = nullptr;
+ switch (invType)
+ {
+ case NetInventoryType::Inventory:
+ items = &mInventoryItems;
+ break;
+ case NetInventoryType::Cart:
+ items = &mCartItems;
+ break;
+ case NetInventoryType::Storage:
+ case NetInventoryType::GuildStorage:
+ items = &Ea::InventoryRecv::mStorageItems;
+ break;
+ default:
+ reportAlways("Unknown inventory type %d", CAST_S32(invType));
+ return;
+ }
for (int loop = 0; loop < number; loop++)
{
- msg.readInt16("index");
- msg.readItemId("item id");
- msg.readUInt8("item type");
+ const int index = msg.readInt16("item index") - offset;
+ const int itemId = msg.readItemId("item id");
+ const ItemTypeT itemType = static_cast<ItemTypeT>(
+ msg.readUInt8("item type"));
msg.readInt32("location");
- msg.readInt32("wear state");
- msg.readInt8("refine");
+ int equipType = msg.readInt32("wear state");
+ const uint8_t refine = CAST_U8(msg.readInt8("refine"));
+ int cards[maxCards];
for (int f = 0; f < maxCards; f++)
- msg.readItemId("card");
+ cards[f] = msg.readItemId("card");
msg.readInt32("hire expire date (?)");
msg.readInt16("equip type");
msg.readInt16("item sprite number");
- msg.readUInt8("option count");
+ ItemOptionsList *options = new ItemOptionsList(msg.readUInt8("option count"));
for (int f = 0; f < 5; f ++)
{
- msg.readInt16("option index");
- msg.readInt16("option value");
+ const uint16_t idx = msg.readInt16("option index");
+ const uint16_t val = msg.readInt16("option value");
msg.readUInt8("option param");
+ options->add(idx, val);
}
- msg.readUInt8("flags");
+ ItemFlags flags;
+ flags.byte = msg.readUInt8("flags");
+
+ items->push_back(Ea::InventoryItem(index,
+ itemId,
+ itemType,
+ cards,
+ options,
+ 1,
+ refine,
+ ItemColorManager::getColorFromCards(&cards[0]),
+ fromBool(flags.bits.isIdentified, Identified),
+ fromBool(flags.bits.isDamaged, Damaged),
+ fromBool(flags.bits.isFavorite, Favorite),
+ Equipm_true,
+ equipType));
+ delete options;
}
}