Core/GameObjects: Implemented per player gameobject state and visibility for looted non-consumable chests

Port From (https://github.com/TrinityCore/TrinityCore/commit/879c0cccfcb9224f9e15cbed926c57a4e010a070)
This commit is contained in:
hondacrx
2022-10-21 17:34:52 -04:00
parent cf7c183a51
commit 0b2621b348
6 changed files with 135 additions and 9 deletions
@@ -4997,7 +4997,7 @@ namespace Game.Entities
data.WriteFloat(rotation.Z);
data.WriteFloat(rotation.W);
data.WriteUInt32(FactionTemplate);
data.WriteInt8(State);
data.WriteInt8(GetViewerGameObjectState(this, owner, receiver));
data.WriteInt8(TypeID);
data.WriteUInt8(PercentHealth);
data.WriteUInt32(ArtKit);
@@ -5104,7 +5104,7 @@ namespace Game.Entities
}
if (changesMask[14])
{
data.WriteInt8(State);
data.WriteInt8(GetViewerGameObjectState(this, owner, receiver));
}
if (changesMask[15])
{
@@ -5167,6 +5167,11 @@ namespace Game.Entities
return flags;
}
sbyte GetViewerGameObjectState(GameObjectFieldData gameObjectData, GameObject gameObject, Player receiver)
{
return (sbyte)gameObject.GetGoStateFor(receiver.GetGUID());
}
}
public class DynamicObjectData : BaseUpdateData<DynamicObject>
+2 -2
View File
@@ -1218,7 +1218,7 @@ namespace Game.Entities
return false;
}
if (obj.IsInvisibleDueToDespawn())
if (obj.IsInvisibleDueToDespawn(this))
return false;
if (!CanDetect(obj, ignoreStealth, checkAlert))
@@ -3038,7 +3038,7 @@ namespace Game.Entities
public virtual bool IsNeverVisibleFor(WorldObject seer) { return !IsInWorld || IsDestroyedObject(); }
public virtual bool IsAlwaysVisibleFor(WorldObject seer) { return false; }
public virtual bool IsInvisibleDueToDespawn() { return false; }
public virtual bool IsInvisibleDueToDespawn(WorldObject seer) { return false; }
public virtual bool IsAlwaysDetectableFor(WorldObject seer) { return false; }
public virtual bool LoadFromDB(ulong spawnId, Map map, bool addToMap, bool allowDuplicate) { return true; }