Core/PacketIO: Fixed client crash with heirlooms

Closes #17964
This commit is contained in:
Shauren
2016-11-03 16:56:58 +01:00
parent 1cd38a5650
commit b34904f4b5
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -1468,7 +1468,7 @@ void Item::BuildDynamicValuesUpdate(uint8 updateType, ByteBuffer* data, Player*
{
for (std::size_t v = 0; v < values.size(); ++v)
{
if (updateType == UPDATETYPE_VALUES ? _dynamicChangesArrayMask[index][v] : values[v])
if (updateType != UPDATETYPE_VALUES || _dynamicChangesArrayMask[index][v])
{
UpdateMask::SetUpdateBit(data->contents() + arrayMaskPos, v);
*data << uint32(values[v]);
+2 -2
View File
@@ -815,7 +815,7 @@ void Object::BuildDynamicValuesUpdate(uint8 updateType, ByteBuffer* data, Player
data->resize(data->size() + arrayBlockCount * sizeof(UpdateMask::BlockType));
for (std::size_t v = 0; v < values.size(); ++v)
{
if (updateType == UPDATETYPE_VALUES ? _dynamicChangesArrayMask[index][v] : values[v])
if (updateType != UPDATETYPE_VALUES || _dynamicChangesArrayMask[index][v])
{
UpdateMask::SetUpdateBit(data->contents() + arrayMaskPos, v);
*data << uint32(values[v]);
@@ -1411,7 +1411,7 @@ void Object::SetDynamicValue(uint16 index, uint16 offset, uint32 value)
if (_dynamicChangesArrayMask[index].size() <= offset)
_dynamicChangesArrayMask[index].resize((offset / 32 + 1) * 32);
if (values[offset] != value)
if (values[offset] != value || changeType == UpdateMask::VALUE_AND_SIZE_CHANGED)
{
values[offset] = value;
_dynamicChangesMask[index] = changeType;
@@ -238,7 +238,7 @@ void CollectionMgr::UpgradeHeirloom(uint32 itemId, uint32 castItem)
// Get heirloom offset to update only one part of dynamic field
std::vector<uint32> const& fields = player->GetDynamicValues(PLAYER_DYNAMIC_FIELD_HEIRLOOMS);
uint8 offset = uint8(std::find(fields.begin(), fields.end(), itemId) - fields.begin());
uint16 offset = uint16(std::find(fields.begin(), fields.end(), itemId) - fields.begin());
player->SetDynamicValue(PLAYER_DYNAMIC_FIELD_HEIRLOOM_FLAGS, offset, flags);
itr->second.flags = flags;
@@ -278,7 +278,7 @@ void CollectionMgr::CheckHeirloomUpgrades(Item* item)
if (newItemId)
{
std::vector<uint32> const& fields = player->GetDynamicValues(PLAYER_DYNAMIC_FIELD_HEIRLOOMS);
uint8 offset = uint8(std::find(fields.begin(), fields.end(), itr->first) - fields.begin());
uint16 offset = uint16(std::find(fields.begin(), fields.end(), itr->first) - fields.begin());
player->SetDynamicValue(PLAYER_DYNAMIC_FIELD_HEIRLOOMS, offset, newItemId);
player->SetDynamicValue(PLAYER_DYNAMIC_FIELD_HEIRLOOM_FLAGS, offset, 0);