Core/Player: Log more information when Player::StopCastingCharm() fails

Port From (https://github.com/TrinityCore/TrinityCore/commit/89ea13ed46744414f74686cf2126dc637188180d)
This commit is contained in:
hondacrx
2022-05-26 20:20:18 -04:00
parent 9b6540c91d
commit ba87f08c37
3 changed files with 23 additions and 2 deletions
+1 -1
View File
@@ -990,7 +990,7 @@ namespace Game.Entities
Log.outFatal(LogFilter.Player, "Player {0} (GUID: {1} is not able to uncharm unit (GUID: {2} Entry: {3}, Type: {4})", GetName(), GetGUID(), GetCharmedGUID(), charm.GetEntry(), charm.GetTypeId());
if (!charm.GetCharmerGUID().IsEmpty())
{
Log.outFatal(LogFilter.Player, "Charmed unit has charmer guid {0}", charm.GetCharmerGUID());
Log.outFatal(LogFilter.Player, $"Player::StopCastingCharm: Charmed unit has charmer {charm.GetCharmerGUID()}\nPlayer debug info: {GetDebugInfo()}\nCharm debug info: {charm.GetDebugInfo()}");
Cypher.Assert(false);
}
+1 -1
View File
@@ -862,7 +862,7 @@ namespace Game.Entities
public override string GetDebugInfo()
{
return $"{base.GetDebugInfo()}\nIsAIEnabled: {IsAIEnabled()} DeathState: {GetDeathState()} UnitMovementFlags: {GetUnitMovementFlags()} UnitMovementFlags2: {GetUnitMovementFlags2()} Class: {GetClass()}\n" +
$" {(MoveSpline != null ? MoveSpline.ToString() : "Movespline: <none>")}";
$" {(MoveSpline != null ? MoveSpline.ToString() : "Movespline: <none>\n")} GetCharmedGUID(): {GetCharmedGUID()}\nGetCharmerGUID(): {GetCharmerGUID()}\n{(GetVehicleKit() != null ? GetVehicleKit().GetDebugInfo() : "No vehicle kit")}";
}
public Guardian GetGuardianPet()
+21
View File
@@ -24,6 +24,7 @@ using Game.Movement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game.Entities
{
@@ -559,6 +560,26 @@ namespace Game.Entities
return TimeSpan.FromMilliseconds(1);
}
public string GetDebugInfo()
{
StringBuilder str = new StringBuilder("Vehicle seats:\n");
foreach (var (id, seat) in Seats)
str.Append($"seat {id}: {(seat.IsEmpty() ? "empty" : seat.Passenger.Guid)}\n");
str.Append("Vehicle pending events:");
if (_pendingJoinEvents.Empty())
str.Append(" none");
else
{
str.Append("\n");
foreach (var joinEvent in _pendingJoinEvents)
str.Append($"seat {joinEvent.Seat.Key}: {joinEvent.Passenger.GetGUID()}\n");
}
return str.ToString();
}
public Unit GetBase() { return _me; }
public VehicleRecord GetVehicleInfo() { return _vehicleInfo; }
public uint GetCreatureEntry() { return _creatureEntry; }