Scripts/Commands: .npc delete and .gobj delete now work while the specified guid is despawned.
Port From (https://github.com/TrinityCore/TrinityCore/commit/2924ae08038314e3c935a132cc56a4135d9f103c)
This commit is contained in:
@@ -72,6 +72,9 @@ namespace Game.Chat
|
||||
if (!ulong.TryParse(id, out ulong guidLow) || guidLow == 0)
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
// force respawn to make sure we find something
|
||||
player.GetMap().RemoveRespawnTime(SpawnObjectType.GameObject, guidLow, true);
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
@@ -82,7 +85,7 @@ namespace Game.Chat
|
||||
ObjectGuid ownerGuid = obj.GetOwnerGUID();
|
||||
if (ownerGuid.IsEmpty())
|
||||
{
|
||||
Unit owner = Global.ObjAccessor.GetUnit(handler.GetPlayer(), ownerGuid);
|
||||
Unit owner = Global.ObjAccessor.GetUnit(player, ownerGuid);
|
||||
if (!owner || !ownerGuid.IsPlayer())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandDelobjrefercreature, ownerGuid.ToString(), obj.GetGUID().ToString());
|
||||
|
||||
@@ -879,6 +879,9 @@ 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().RemoveRespawnTime(SpawnObjectType.Creature, guidLow, true);
|
||||
// then try to find it
|
||||
creature = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user