Entities/Unit: Nuke Map::ForceRespawn from orbit, with the following implications:

Port From (https://github.com/TrinityCore/TrinityCore/commit/2532de6acb7d73957a8fca44e7fc26160f47cc47)
This commit is contained in:
hondacrx
2021-12-27 16:29:29 -05:00
parent a693bed211
commit 828fafbcc8
7 changed files with 146 additions and 157 deletions
+23 -21
View File
@@ -869,7 +869,7 @@ namespace Game.Chat
[Command("", RBACPermissions.CommandNpcDelete)]
static bool HandleNpcDeleteCommand(StringArguments args, CommandHandler handler)
{
Creature creature;
ulong spawnId;
if (!args.Empty())
{
@@ -881,34 +881,36 @@ namespace Game.Chat
if (!ulong.TryParse(cId, out ulong guidLow) || guidLow == 0)
return false;
// force respawn to make sure we find something
handler.GetSession().GetPlayer().GetMap().ForceRespawn(SpawnObjectType.Creature, guidLow);
// then try to find it
creature = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
spawnId = guidLow;
}
else
creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet() || creature.IsTotem())
{
handler.SendSysMessage(CypherStrings.SelectCreature);
return false;
Creature creature = handler.GetSelectedCreature();
if (!creature || creature.IsPet() || creature.IsTotem())
{
handler.SendSysMessage(CypherStrings.SelectCreature);
return false;
}
TempSummon summon = creature.ToTempSummon();
if (summon != null)
{
summon.UnSummon();
handler.SendSysMessage(CypherStrings.CommandDelcreatmessage);
return true;
}
spawnId = creature.GetSpawnId();
}
TempSummon summon = creature.ToTempSummon();
if (summon != null)
summon.UnSummon();
else
if (Creature.DeleteFromDB(spawnId))
{
// Delete the creature
creature.CombatStop();
creature.DeleteFromDB();
creature.AddObjectToRemoveList();
handler.SendSysMessage(CypherStrings.CommandDelcreatmessage);
return true;
}
handler.SendSysMessage(CypherStrings.CommandDelcreatmessage);
return true;
handler.SendSysMessage(CypherStrings.CommandCreatguidnotfound, spawnId);
return false;
}
[Command("item", RBACPermissions.CommandNpcDeleteItem)]