Core/Creatures: Implemented sending different creature id for summoner
Port From (https://github.com/TrinityCore/TrinityCore/commit/ebf1b6eb5cbfd1dc8f1b0d26c29ae1423784cabb)
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Game.Entities
|
||||
|
||||
public void WriteCreate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, WorldObject owner, Player receiver)
|
||||
{
|
||||
data.WriteUInt32(EntryId);
|
||||
data.WriteUInt32(GetViewerDependentEntryId(this, owner, receiver));
|
||||
data.WriteUInt32(GetViewerDependentDynamicFlags(this, owner, receiver));
|
||||
data.WriteFloat(Scale);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (changesMask[1])
|
||||
{
|
||||
data.WriteUInt32(EntryId);
|
||||
data.WriteUInt32(GetViewerDependentEntryId(this, owner, receiver));
|
||||
}
|
||||
if (changesMask[2])
|
||||
{
|
||||
@@ -77,6 +77,21 @@ namespace Game.Entities
|
||||
_changesMask.ResetAll();
|
||||
}
|
||||
|
||||
uint GetViewerDependentEntryId(ObjectFieldData objectData, WorldObject obj, Player receiver)
|
||||
{
|
||||
uint entryId = objectData.EntryId;
|
||||
Unit unit = obj.ToUnit();
|
||||
if (unit != null)
|
||||
{
|
||||
TempSummon summon = unit.ToTempSummon();
|
||||
if (summon != null)
|
||||
if (summon.GetSummonerGUID() == receiver.GetGUID() && summon.GetCreatureIdVisibleToSummoner().HasValue)
|
||||
entryId = summon.GetCreatureIdVisibleToSummoner().Value;
|
||||
}
|
||||
|
||||
return entryId;
|
||||
}
|
||||
|
||||
uint GetViewerDependentDynamicFlags(ObjectFieldData objectData, WorldObject obj, Player receiver)
|
||||
{
|
||||
uint unitDynFlags = objectData.DynamicFlags;
|
||||
@@ -2217,6 +2232,18 @@ namespace Game.Entities
|
||||
if (unit.IsCreature())
|
||||
{
|
||||
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
|
||||
TempSummon summon = unit.ToTempSummon();
|
||||
if (summon != null)
|
||||
{
|
||||
if (summon.GetSummonerGUID() == receiver.GetGUID())
|
||||
{
|
||||
if (summon.GetCreatureIdVisibleToSummoner().HasValue)
|
||||
cinfo = Global.ObjectMgr.GetCreatureTemplate(summon.GetCreatureIdVisibleToSummoner().Value);
|
||||
|
||||
if (summon.GetDisplayIdVisibleToSummoner().HasValue)
|
||||
displayId = summon.GetDisplayIdVisibleToSummoner().Value;
|
||||
}
|
||||
}
|
||||
|
||||
// this also applies for transform auras
|
||||
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransformSpell(), unit.GetMap().GetDifficultyID());
|
||||
|
||||
Reference in New Issue
Block a user