Core/Commands: Add .debug guidlimits <optional map id> chat command
Port From (https://github.com/TrinityCore/TrinityCore/commit/e7b94603f256386eae8a9724c830d37593c0f0e1)
This commit is contained in:
@@ -106,6 +106,28 @@ namespace Game.Chat
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("combat", RBACPermissions.CommandDebugCombat)]
|
||||||
|
static bool HandleDebugCombatListCommand(CommandHandler handler, StringArguments args)
|
||||||
|
{
|
||||||
|
Unit target = handler.GetSelectedUnit();
|
||||||
|
if (!target)
|
||||||
|
target = handler.GetSession().GetPlayer();
|
||||||
|
|
||||||
|
handler.SendSysMessage($"Combat refs: (Combat state: {target.IsInCombat()} | Manager state: {target.GetCombatManager().HasCombat()})");
|
||||||
|
foreach (var refe in target.GetCombatManager().GetPvPCombatRefs())
|
||||||
|
{
|
||||||
|
Unit unit = refe.Value.GetOther(target);
|
||||||
|
handler.SendSysMessage($"[PvP] {unit.GetName()} (SpawnID {(unit.IsCreature() ? unit.ToCreature().GetSpawnId() : 0)})");
|
||||||
|
}
|
||||||
|
foreach (var refe in target.GetCombatManager().GetPvECombatRefs())
|
||||||
|
{
|
||||||
|
Unit unit = refe.Value.GetOther(target);
|
||||||
|
handler.SendSysMessage($"[PvE] {unit.GetName()} (SpawnID {(unit.IsCreature() ? unit.ToCreature().GetSpawnId() : 0)})");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[Command("conversation", RBACPermissions.CommandDebugConversation)]
|
[Command("conversation", RBACPermissions.CommandDebugConversation)]
|
||||||
static bool HandleDebugConversationCommand(CommandHandler handler, StringArguments args)
|
static bool HandleDebugConversationCommand(CommandHandler handler, StringArguments args)
|
||||||
{
|
{
|
||||||
@@ -443,25 +465,16 @@ namespace Game.Chat
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("combat", RBACPermissions.CommandDebugCombat)]
|
[Command("guidlimits", RBACPermissions.CommandDebug, true)]
|
||||||
static bool HandleDebugCombatListCommand(CommandHandler handler, StringArguments args)
|
static bool HandleDebugGuidLimitsCommand(CommandHandler handler, uint mapId)
|
||||||
{
|
{
|
||||||
Unit target = handler.GetSelectedUnit();
|
if (mapId != 0)
|
||||||
if (!target)
|
Global.MapMgr.DoForAllMapsWithMapId(mapId, map => HandleDebugGuidLimitsMap(handler, map));
|
||||||
target = handler.GetSession().GetPlayer();
|
else
|
||||||
|
Global.MapMgr.DoForAllMaps(map => HandleDebugGuidLimitsMap(handler, map));
|
||||||
handler.SendSysMessage($"Combat refs: (Combat state: {target.IsInCombat()} | Manager state: {target.GetCombatManager().HasCombat()})");
|
|
||||||
foreach (var refe in target.GetCombatManager().GetPvPCombatRefs())
|
|
||||||
{
|
|
||||||
Unit unit = refe.Value.GetOther(target);
|
|
||||||
handler.SendSysMessage($"[PvP] {unit.GetName()} (SpawnID {(unit.IsCreature() ? unit.ToCreature().GetSpawnId() : 0)})");
|
|
||||||
}
|
|
||||||
foreach (var refe in target.GetCombatManager().GetPvECombatRefs())
|
|
||||||
{
|
|
||||||
Unit unit = refe.Value.GetOther(target);
|
|
||||||
handler.SendSysMessage($"[PvE] {unit.GetName()} (SpawnID {(unit.IsCreature() ? unit.ToCreature().GetSpawnId() : 0)})");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
handler.SendSysMessage($"Guid Warn Level: {WorldConfig.GetIntValue(WorldCfg.RespawnGuidWarnLevel)}");
|
||||||
|
handler.SendSysMessage($"Guid Alert Level: {WorldConfig.GetIntValue(WorldCfg.RespawnGuidAlertLevel)}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1439,5 +1452,10 @@ namespace Game.Chat
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void HandleDebugGuidLimitsMap(CommandHandler handler, Map map)
|
||||||
|
{
|
||||||
|
handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Highest Guid Creature: {map.GenerateLowGuid(HighGuid.Creature)} GameObject: {map.GetMaxLowGuid(HighGuid.GameObject)}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4087,11 +4087,14 @@ namespace Game.Maps
|
|||||||
|
|
||||||
public ulong GenerateLowGuid(HighGuid high)
|
public ulong GenerateLowGuid(HighGuid high)
|
||||||
{
|
{
|
||||||
//Cypher.Assert(!ObjectGuid.IsMapSpecific(high), "Only map specific guid can be generated in Map context");
|
|
||||||
|
|
||||||
return GetGuidSequenceGenerator(high).Generate();
|
return GetGuidSequenceGenerator(high).Generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ulong GetMaxLowGuid(HighGuid high)
|
||||||
|
{
|
||||||
|
return GetGuidSequenceGenerator(high).GetNextAfterMaxUsed();
|
||||||
|
}
|
||||||
|
|
||||||
ObjectGuidGenerator GetGuidSequenceGenerator(HighGuid high)
|
ObjectGuidGenerator GetGuidSequenceGenerator(HighGuid high)
|
||||||
{
|
{
|
||||||
if (!_guidGenerators.ContainsKey(high))
|
if (!_guidGenerators.ContainsKey(high))
|
||||||
|
|||||||
Reference in New Issue
Block a user