diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 1b320b9f7..b2304cb18 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -197,3 +197,65 @@ void Corpse::ResetGhostTime() { m_time = GameTime::GetGameTime().count(); } + +void Corpse::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const +{ + if (!target) + return; + + ByteBuffer fieldBuffer; + UpdateMask updateMask; + updateMask.SetCount(m_valuesCount); + + uint32* flags = nullptr; + uint32 visibleFlag = GetUpdateFieldData(target, flags); + + for (uint16 index = 0; index < m_valuesCount; ++index) + { + if (_fieldNotifyFlags & flags[index] || ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag))) + { + updateMask.SetBit(index); + + if (index == CORPSE_FIELD_BYTES_1 || index == CORPSE_FIELD_BYTES_2) + { + Player* owner = ObjectAccessor::GetPlayer(*this, GetOwnerGUID()); + if (owner && owner != target && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && owner->IsInRaidWith(target) && owner->GetTeamId() != target->GetTeamId()) + { + uint32 playerBytes = target->GetUInt32Value(PLAYER_BYTES); + uint32 playerBytes2 = target->GetUInt32Value(PLAYER_BYTES_2); + + uint8 race = target->getRace(); + uint8 skin = (uint8)(playerBytes); + uint8 face = (uint8)(playerBytes >> 8); + uint8 hairstyle = (uint8)(playerBytes >> 16); + uint8 haircolor = (uint8)(playerBytes >> 24); + uint8 facialhair = (uint8)(playerBytes2); + + uint32 corpseBytes1 = ((0x00) | (race << 8) | (target->GetByteValue(PLAYER_BYTES_3, 0) << 16) | (skin << 24)); + uint32 corpseBytes2 = ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24)); + + if (index == CORPSE_FIELD_BYTES_1) + { + fieldBuffer << corpseBytes1; + } + else + { + fieldBuffer << corpseBytes2; + } + } + else + { + fieldBuffer << m_uint32Values[index]; + } + } + else + { + fieldBuffer << m_uint32Values[index]; + } + } + } + + *data << uint8(updateMask.GetBlockCount()); + updateMask.AppendToPacket(data); + data->append(fieldBuffer); +} diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index acd852d2b..6d1dedcf0 100644 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -54,6 +54,8 @@ public: void AddToWorld() override; void RemoveFromWorld() override; + void BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target) const override; + bool Create(ObjectGuid::LowType guidlow); bool Create(ObjectGuid::LowType guidlow, Player* owner); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index cecd1ad03..693d53197 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3629,7 +3629,7 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia /*= bones->SetPhaseMask(corpse->GetPhaseMask(), false); bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES); - bones->SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Empty); + bones->SetGuidValue(CORPSE_FIELD_OWNER, corpse->GetOwnerGUID()); for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))