aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2014-12-30 00:39:51 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2014-12-30 00:39:51 +0100
commit45187b036fdfc2c6f7993cea01fa0731e22d7bb4 (patch)
tree4b9fac8fc034c120a909e2f283c81b5a1c7bcdc7 /src/server/game/Server
parent56a665ccf35bd523221a52d7483545761fda9d65 (diff)
Core/Packets: rename packet structs to match client names
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/ItemPackets.cpp73
-rw-r--r--src/server/game/Server/Packets/ItemPackets.h57
-rw-r--r--src/server/game/Server/Packets/QuestPackets.h8
3 files changed, 92 insertions, 46 deletions
diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp
index ed57485299c..1442f23eb88 100644
--- a/src/server/game/Server/Packets/ItemPackets.cpp
+++ b/src/server/game/Server/Packets/ItemPackets.cpp
@@ -58,21 +58,20 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Item::ItemInstance const&
return data;
}
-WorldPacket const* WorldPackets::Item::EquipError::Write()
+WorldPacket const* WorldPackets::Item::InventoryChangeFailure::Write()
{
- _worldPacket << uint8(msg);
- _worldPacket << itemGUID1;
- _worldPacket << itemGUID2;
- _worldPacket << uint8(0); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
+ _worldPacket << int8(BagResult);
+ _worldPacket << Item[0];
+ _worldPacket << Item[1];
+ _worldPacket << uint8(ContainerBSlot); // bag type subclass, used with EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM and EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG2
- switch (msg)
+ switch (BagResult)
{
case EQUIP_ERR_CANT_EQUIP_LEVEL_I:
case EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW:
- {
- _worldPacket << level;
+ _worldPacket << int32(Level);
break;
- }
+ /// @todo: add more cases
default:
break;
}
@@ -82,42 +81,64 @@ WorldPacket const* WorldPackets::Item::EquipError::Write()
void WorldPackets::Item::SplitItem::Read()
{
- itemCount = _worldPacket.ReadBits(2);
- _worldPacket >> srcbag >> srcslot >> dstbag >> dstslot >> count;
+ Inv.Items.resize(_worldPacket.ReadBits(2));
+ for (size_t i = 0; i < Inv.Items.size(); ++i)
+ {
+ _worldPacket >> Inv.Items[i].ContainerSlot;
+ _worldPacket >> Inv.Items[i].Slot;
+ }
+
+ _worldPacket >> FromPackSlot
+ >> FromSlot
+ >> ToPackSlot
+ >> ToSlot
+ >> Quantity;
}
void WorldPackets::Item::SwapInvItem::Read()
{
- itemCount = _worldPacket.ReadBits(2);
- for (uint32 i = 0; i < itemCount; ++i)
+ Inv.Items.resize(_worldPacket.ReadBits(2));
+ for (size_t i = 0; i < Inv.Items.size(); ++i)
{
- _worldPacket.read_skip<uint8>(); // bag
- _worldPacket.read_skip<uint8>(); // slot
+ _worldPacket >> Inv.Items[i].ContainerSlot;
+ _worldPacket >> Inv.Items[i].Slot;
}
- _worldPacket >> dstslot >> srcslot;
+
+ _worldPacket >> Slot2
+ >> Slot1;
}
void WorldPackets::Item::SwapItem::Read()
{
- itemCount = _worldPacket.ReadBits(2);
- for (uint32 i = 0; i < itemCount; ++i)
+ Inv.Items.resize(_worldPacket.ReadBits(2));
+ for (size_t i = 0; i < Inv.Items.size(); ++i)
{
- _worldPacket.read_skip<uint8>(); // bag
- _worldPacket.read_skip<uint8>(); // slot
+ _worldPacket >> Inv.Items[i].ContainerSlot;
+ _worldPacket >> Inv.Items[i].Slot;
}
- _worldPacket >> dstbag >> srcbag >> dstslot >> srcslot;
+
+ _worldPacket >> ContainerSlotB
+ >> ContainerSlotA
+ >> SlotB
+ >> SlotA;
}
void WorldPackets::Item::AutoEquipItem::Read()
{
- itemCount = _worldPacket.ReadBits(2);
+ Inv.Items.resize(_worldPacket.ReadBits(2));
+ for (size_t i = 0; i < Inv.Items.size(); ++i)
+ {
+ _worldPacket >> Inv.Items[i].ContainerSlot;
+ _worldPacket >> Inv.Items[i].Slot;
+ }
- _worldPacket >> srcbag >> srcslot;
- _worldPacket.read_skip<uint8>();
- _worldPacket.read_skip<uint8>();
+ _worldPacket >> PackSlot
+ >> Slot;
}
void WorldPackets::Item::DestroyItem::Read()
{
- _worldPacket >> count >> bag >> slot;
+ _worldPacket >> Count
+ >> ContainerId
+ >> SlotNum;
}
diff --git a/src/server/game/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h
index d052659d329..7576c52159d 100644
--- a/src/server/game/Server/Packets/ItemPackets.h
+++ b/src/server/game/Server/Packets/ItemPackets.h
@@ -51,17 +51,32 @@ namespace WorldPackets
std::vector<int32> Modifications;
};
- class EquipError final : public ServerPacket
+ struct InvUpdate
+ {
+ struct InvItem
+ {
+ uint8 ContainerSlot = 0;
+ uint8 Slot = 0;
+ };
+
+ std::vector<InvItem> Items;
+ };
+
+ class InventoryChangeFailure final : public ServerPacket
{
public:
- EquipError() : ServerPacket(SMSG_INVENTORY_CHANGE_FAILURE, 22) { }
+ InventoryChangeFailure() : ServerPacket(SMSG_INVENTORY_CHANGE_FAILURE, 22) { }
WorldPacket const* Write() override;
- InventoryResult msg;
- ObjectGuid itemGUID1;
- ObjectGuid itemGUID2;
- uint32 level;
+ int8 BagResult = EQUIP_ERR_OK; /// @see enum InventoryResult
+ uint8 ContainerBSlot = 0;
+ ObjectGuid SrcContainer;
+ ObjectGuid DstContainer;
+ int32 SrcSlot = 0;
+ int32 LimitCategory = 0;
+ int32 Level = 0;
+ ObjectGuid Item[2];
};
class SplitItem final : public ClientPacket
@@ -71,8 +86,12 @@ namespace WorldPackets
void Read() override;
- uint8 srcbag, srcslot, dstbag, dstslot;
- uint32 itemCount, count;
+ uint8 ToSlot = 0;
+ uint8 ToPackSlot = 0;
+ uint8 FromPackSlot = 0;
+ int32 Quantity = 0;
+ InvUpdate Inv;
+ uint8 FromSlot = 0;
};
class SwapInvItem final : public ClientPacket
@@ -82,8 +101,9 @@ namespace WorldPackets
void Read() override;
- uint32 itemCount;
- uint8 srcslot, dstslot;
+ InvUpdate Inv;
+ uint8 Slot1 = 0; /// Source Slot
+ uint8 Slot2 = 0; /// Destination Slot
};
class SwapItem final : public ClientPacket
@@ -93,8 +113,11 @@ namespace WorldPackets
void Read() override;
- uint32 itemCount;
- uint8 dstbag, dstslot, srcbag, srcslot;
+ InvUpdate Inv;
+ uint8 SlotA = 0;
+ uint8 ContainerSlotB = 0;
+ uint8 SlotB = 0;
+ uint8 ContainerSlotA = 0;
};
class AutoEquipItem final : public ClientPacket
@@ -104,8 +127,9 @@ namespace WorldPackets
void Read() override;
- uint32 itemCount;
- uint8 srcbag, srcslot;
+ uint8 Slot = 0;
+ InvUpdate Inv;
+ uint8 PackSlot = 0;
};
class DestroyItem final : public ClientPacket
@@ -115,8 +139,9 @@ namespace WorldPackets
void Read() override;
- uint32 count;
- uint8 bag, slot;
+ uint32 Count = 0;
+ uint8 SlotNum = 0;
+ uint8 ContainerId = 0;
};
}
}
diff --git a/src/server/game/Server/Packets/QuestPackets.h b/src/server/game/Server/Packets/QuestPackets.h
index a92e4d02c56..e9b6e5ec78e 100644
--- a/src/server/game/Server/Packets/QuestPackets.h
+++ b/src/server/game/Server/Packets/QuestPackets.h
@@ -94,14 +94,14 @@ namespace WorldPackets
void Read() override;
ObjectGuid QuestGiver;
- int32 QuestID;
+ int32 QuestID = 0;
};
struct QuestInfoChoiceItem
{
- int32 ItemID;
- int32 Quantity;
- int32 DisplayID;
+ int32 ItemID = 0;
+ int32 Quantity = 0;
+ int32 DisplayID = 0;
};
struct QuestInfo