Misc fixes, and added GetDebugInfo() which was missed.

This commit is contained in:
hondacrx
2022-01-05 13:11:32 -05:00
parent b2ddeb3408
commit 0d68984717
28 changed files with 170 additions and 53 deletions
+8 -3
View File
@@ -1098,6 +1098,11 @@ namespace Game.Entities
return false;
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nAIName: {GetAIName()} ScriptName: {GetScriptName()} WaypointPath: {GetWaypointPath()} SpawnId: {GetSpawnId()}";
}
public override bool IsMovementPreventedByCasting()
{
// first check if currently a movement allowed channel is active and we're not casting
@@ -3022,7 +3027,7 @@ namespace Game.Entities
{
if (!HasSpellFocus())
{
//Log.outError(LogFilter.Unit, $"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {GetDebugInfo()}");
Log.outError(LogFilter.Unit, $"Creature::ReacquireSpellFocusTarget() being called with HasSpellFocus() returning false. {GetDebugInfo()}");
return;
}
@@ -3170,7 +3175,7 @@ namespace Game.Entities
// @todo pools need fixing! this is just a temporary thing, but they violate dynspawn principles
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
{
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group '{data.spawnGroupData.name}'");
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load in inactive spawn group '{data.spawnGroupData.name}':\n{GetDebugInfo()}");
return false;
}
}
@@ -3185,7 +3190,7 @@ namespace Game.Entities
// @todo same as above
if (Global.PoolMgr.IsPartOfAPool<Creature>(spawnId) == 0)
{
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress");
Log.outError(LogFilter.Unit, $"Creature (SpawnID {spawnId}) trying to load despite a respawn timer in progress:\n{GetDebugInfo()}");
return false;
}
}
@@ -2292,6 +2292,11 @@ namespace Game.Entities
return localRotation;
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nSpawnId: {GetSpawnId()} GoState: {GetGoState()} ScriptId: {GetScriptId()} AIName: {GetAIName()}";
}
public bool IsAtInteractDistance(Player player, SpellInfo spell = null)
{
if (spell != null || (spell = GetSpellForLock(player)) != null)
+5
View File
@@ -2340,6 +2340,11 @@ namespace Game.Entities
return _bonusData.RequiredLevel;
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nOwner: {GetOwnerGUID()} Count: {GetCount()} BagSlot: {GetBagSlot()} Slot: {GetSlot()} Equipped: {IsEquipped()}";
}
public static Item NewItemOrBag(ItemTemplate proto)
{
if (proto.GetInventoryType() == InventoryType.Bag)
+8
View File
@@ -15,8 +15,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Game.DataStorage;
using Game.Maps;
using System;
using System.Collections.Generic;
using System.Numerics;
namespace Game.Entities
@@ -409,6 +411,12 @@ namespace Game.Entities
return this;
}
public virtual string GetDebugInfo()
{
var mapEntry = CliDB.MapStorage.LookupByKey(_mapId);
return $"MapID: {_mapId} Map name: '{(mapEntry != null ? mapEntry.MapName[Global.WorldMgr.GetDefaultDbcLocale()] : "<not found>")}' {base.ToString()}";
}
public override string ToString()
{
return $"X: {posX} Y: {posY} Z: {posZ} O: {Orientation} MapId: {_mapId}";
@@ -750,6 +750,11 @@ namespace Game.Entities
BuildValuesUpdateBlockForPlayer(data_map[player], player);
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\n{GetGUID()} Entry: {GetEntry()}\nName: { GetName()}";
}
public abstract void BuildValuesCreate(WorldPacket data, Player target);
public abstract void BuildValuesUpdate(WorldPacket data, Player target);
+5
View File
@@ -1598,6 +1598,11 @@ namespace Game.Entities
return ss.ToString();
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nPetType: {GetPetType()}";
}
public DeclinedName GetDeclinedNames() { return _declinedname; }
public new Dictionary<uint, PetSpell> m_spells = new();
+1 -1
View File
@@ -5076,7 +5076,7 @@ namespace Game.Entities
return area.HasFlag2(AreaFlags2.CanEnableWarMode);
}
// Used in triggers for check "Only to targets that grant experience or honor" req
public bool IsHonorOrXPTarget(Unit victim)
{
+10
View File
@@ -300,6 +300,11 @@ namespace Game.Entities
base.RemoveFromWorld();
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nTempSummonType : {GetSummonType()} Summoner: {GetSummonerGUID()}";
}
public override void SaveToDB(uint mapid, List<Difficulty> spawnDifficulties) { }
public ObjectGuid GetSummonerGUID() { return m_summonerGUID; }
@@ -380,6 +385,11 @@ namespace Game.Entities
return IsPet() || (m_Properties != null && m_Properties.Control == SummonCategory.Pet);
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nOwner: {(GetOwner() ? GetOwner().GetGUID() : "")}";
}
public override Unit GetOwner() { return m_owner; }
public override float GetFollowAngle() { return m_followAngle; }
+1 -1
View File
@@ -817,7 +817,7 @@ namespace Game.Entities
if (pet.IsAIEnabled())
pet.GetAI().KilledUnit(victim);
else
Log.outError(LogFilter.Unit, "Pet doesn't have any AI in Unit.Kill()");
Log.outError(LogFilter.Unit, $"Pet doesn't have any AI in Unit.Kill() {pet.GetDebugInfo()}");
}
}
+7 -1
View File
@@ -847,6 +847,12 @@ namespace Game.Entities
return collisionHeight1 == 0.0f ? MapConst.DefaultCollesionHeight : collisionHeight1;
}
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nIsAIEnabled: {IsAIEnabled()} DeathState: {GetDeathState()} UnitMovementFlags: {GetUnitMovementFlags()} UnitMovementFlags2: {GetUnitMovementFlags2()} Class: {GetClass()}\n" +
$" {(MoveSpline != null ? MoveSpline.ToString() : "Movespline: <none>")}";
}
public Guardian GetGuardianPet()
{
ObjectGuid pet_guid = GetPetGUID();
@@ -1424,7 +1430,7 @@ namespace Game.Entities
// this can happen if OnEffectHitTarget() script hook killed the unit or the aura owner (which can be different)
if (aura.IsRemoved())
{
Log.outError(LogFilter.Spells, "Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)");//\nUnit: {}\nAura: {}", GetDebugInfo().c_str(), aura->GetDebugInfo().c_str());
Log.outError(LogFilter.Spells, $"Unit::_CreateAuraApplication() called with a removed aura. Check if OnEffectHitTarget() is triggering any spell with apply aura effect (that's not allowed!)\nUnit: {GetDebugInfo()}\nAura: {aura.GetDebugInfo()}");
return null;
}