mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Equipment set fix
This commit is contained in:
parent
2884b06b0a
commit
18ecba8b5f
1 changed files with 31 additions and 6 deletions
|
|
@ -20038,18 +20038,43 @@ void Player::SendEquipmentSetList()
|
|||
|
||||
void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
|
||||
{
|
||||
if(eqset.Guid != 0)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for(EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
|
||||
{
|
||||
if((itr->second.Guid == eqset.Guid) && (itr->first == index))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) // something wrong...
|
||||
{
|
||||
sLog.outError("Player %s tried to save equipment set "I64FMTD" (index %u), but that equipment set not found!", GetName(), eqset.Guid, index);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EquipmentSet& eqslot = m_EquipmentSets[index];
|
||||
|
||||
EquipmentSetUpdateState old_state = eqslot.state;
|
||||
|
||||
eqslot = eqset;
|
||||
eqslot.Guid = objmgr.GenerateEquipmentSetGuid();
|
||||
eqslot.state = old_state == EQUIPMENT_SET_NEW ? EQUIPMENT_SET_NEW : EQUIPMENT_SET_CHANGED;
|
||||
|
||||
WorldPacket data(SMSG_EQUIPMENT_SET_SAVED, 4+1);
|
||||
data << uint32(index);
|
||||
data.appendPackGUID(eqset.Guid);
|
||||
GetSession()->SendPacket(&data);
|
||||
if(eqset.Guid == 0)
|
||||
{
|
||||
eqslot.Guid = objmgr.GenerateEquipmentSetGuid();
|
||||
|
||||
WorldPacket data(SMSG_EQUIPMENT_SET_SAVED, 4+1);
|
||||
data << uint32(index);
|
||||
data.appendPackGUID(eqslot.Guid);
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
eqslot.state = old_state == EQUIPMENT_SET_NEW ? EQUIPMENT_SET_NEW : EQUIPMENT_SET_CHANGED;
|
||||
}
|
||||
|
||||
void Player::_SaveEquipmentSets()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue