Core/Player: Fix issues with 'ignore this slot' option on equipment manager usage
This commit is contained in:
@@ -16677,10 +16677,11 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result)
|
||||
uint8 index = fields[1].GetUInt8();
|
||||
eqSet.Name = fields[2].GetString();
|
||||
eqSet.IconName = fields[3].GetString();
|
||||
eqSet.IgnoreMask = fields[4].GetUInt32();
|
||||
eqSet.state = EQUIPMENT_SET_UNCHANGED;
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
eqSet.Items[i] = fields[4+i].GetUInt32();
|
||||
eqSet.Items[i] = fields[5+i].GetUInt32();
|
||||
|
||||
m_EquipmentSets[index] = eqSet;
|
||||
|
||||
@@ -24822,7 +24823,13 @@ void Player::SendEquipmentSetList()
|
||||
data << itr->second.Name;
|
||||
data << itr->second.IconName;
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
|
||||
{
|
||||
// ignored slots stored in IgnoreMask, client wants "1" as raw GUID, so no HIGHGUID_ITEM
|
||||
if (itr->second.IgnoreMask & (1 << i))
|
||||
data.appendPackGUID(MAKE_NEW_GUID(uint64(1)));
|
||||
else
|
||||
data.appendPackGUID(MAKE_NEW_GUID(itr->second.Items[i], 0, HIGHGUID_ITEM));
|
||||
}
|
||||
|
||||
++count; // client have limit but it checked at loading and set
|
||||
}
|
||||
@@ -24888,6 +24895,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_EQUIP_SET);
|
||||
stmt->setString(j++, eqset.Name.c_str());
|
||||
stmt->setString(j++, eqset.IconName.c_str());
|
||||
stmt->setUInt32(j++, eqset.IgnoreMask);
|
||||
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt32(j++, eqset.Items[i]);
|
||||
stmt->setUInt32(j++, GetGUIDLow());
|
||||
@@ -24904,6 +24912,7 @@ void Player::_SaveEquipmentSets(SQLTransaction& trans)
|
||||
stmt->setUInt32(j++, index);
|
||||
stmt->setString(j++, eqset.Name.c_str());
|
||||
stmt->setString(j++, eqset.IconName.c_str());
|
||||
stmt->setUInt32(j++, eqset.IgnoreMask);
|
||||
for (uint8 i=0; i<EQUIPMENT_SLOT_END; ++i)
|
||||
stmt->setUInt32(j++, eqset.Items[i]);
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -640,7 +640,7 @@ enum EquipmentSetUpdateState
|
||||
|
||||
struct EquipmentSet
|
||||
{
|
||||
EquipmentSet() : Guid(0), state(EQUIPMENT_SET_NEW)
|
||||
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
|
||||
{
|
||||
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
Items[i] = 0;
|
||||
@@ -649,6 +649,7 @@ struct EquipmentSet
|
||||
uint64 Guid;
|
||||
std::string Name;
|
||||
std::string IconName;
|
||||
uint32 IgnoreMask;
|
||||
uint32 Items[EQUIPMENT_SLOT_END];
|
||||
EquipmentSetUpdateState state;
|
||||
};
|
||||
|
||||
@@ -1514,6 +1514,14 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
||||
uint64 itemGuid;
|
||||
recv_data.readPackGUID(itemGuid);
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
|
||||
if (itemGuid == 1)
|
||||
{
|
||||
// ignored slots saved as bit mask because we have no free special values for Items[i]
|
||||
eqSet.IgnoreMask |= 1 << i;
|
||||
continue;
|
||||
}
|
||||
|
||||
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
|
||||
if (!item && itemGuid) // cheating check 1
|
||||
@@ -1555,6 +1563,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
|
||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||
if (itemGuid == 1)
|
||||
continue;
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
|
||||
Reference in New Issue
Block a user