mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[9551] Add and use PackedGuid wrapper.
Also * use more wide bytebuff << >> operators for objects * use at read packet faisl alsways exception way instead some time used bool results.
This commit is contained in:
parent
ad9243ebd0
commit
c8fd454a79
26 changed files with 351 additions and 340 deletions
|
|
@ -1233,43 +1233,41 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_EQUIPMENT_SET_SAVE");
|
||||
|
||||
uint64 setGuid;
|
||||
if(!recv_data.readPackGUID(setGuid))
|
||||
return;
|
||||
|
||||
ObjectGuid setGuid;
|
||||
uint32 index;
|
||||
std::string name;
|
||||
std::string iconName;
|
||||
|
||||
recv_data >> setGuid.ReadAsPacked();
|
||||
recv_data >> index;
|
||||
recv_data >> name;
|
||||
recv_data >> iconName;
|
||||
|
||||
if(index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
||||
return;
|
||||
|
||||
std::string name;
|
||||
recv_data >> name;
|
||||
|
||||
std::string iconName;
|
||||
recv_data >> iconName;
|
||||
|
||||
EquipmentSet eqSet;
|
||||
|
||||
eqSet.Guid = setGuid;
|
||||
eqSet.Guid = setGuid.GetRawValue();
|
||||
eqSet.Name = name;
|
||||
eqSet.IconName = iconName;
|
||||
eqSet.state = EQUIPMENT_SET_NEW;
|
||||
|
||||
for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
if(!recv_data.readPackGUID(itemGuid))
|
||||
return;
|
||||
ObjectGuid itemGuid;
|
||||
|
||||
recv_data >> itemGuid.ReadAsPacked();
|
||||
|
||||
Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
|
||||
if(!item && itemGuid) // cheating check 1
|
||||
if(!item && !itemGuid.IsEmpty()) // cheating check 1
|
||||
return;
|
||||
|
||||
if(item && item->GetGUID() != itemGuid) // cheating check 2
|
||||
if(item && item->GetGUID() != itemGuid.GetRawValue())// cheating check 2
|
||||
return;
|
||||
|
||||
eqSet.Items[i] = GUID_LOPART(itemGuid);
|
||||
eqSet.Items[i] = itemGuid.GetCounter();
|
||||
}
|
||||
|
||||
_player->SetEquipmentSet(index, eqSet);
|
||||
|
|
@ -1279,11 +1277,11 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
|
|||
{
|
||||
sLog.outDebug("CMSG_EQUIPMENT_SET_DELETE");
|
||||
|
||||
uint64 setGuid;
|
||||
if(!recv_data.readPackGUID(setGuid))
|
||||
return;
|
||||
ObjectGuid setGuid;
|
||||
|
||||
_player->DeleteEquipmentSet(setGuid);
|
||||
recv_data >> setGuid.ReadAsPacked();
|
||||
|
||||
_player->DeleteEquipmentSet(setGuid.GetRawValue());
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
|
|
@ -1293,16 +1291,15 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
|||
|
||||
for(uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
if(!recv_data.readPackGUID(itemGuid))
|
||||
return;
|
||||
|
||||
ObjectGuid itemGuid;
|
||||
uint8 srcbag, srcslot;
|
||||
|
||||
recv_data >> itemGuid.ReadAsPacked();
|
||||
recv_data >> srcbag >> srcslot;
|
||||
|
||||
sLog.outDebug("Item " I64FMT ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
|
||||
Item *item = _player->GetItemByGuid(itemGuid);
|
||||
Item *item = _player->GetItemByGuid(itemGuid.GetRawValue());
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue