diff options
author | Treeston <treeston.mmoc@gmail.com> | 2017-08-21 17:07:53 +0200 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2017-08-21 17:07:53 +0200 |
commit | cac99beffd66218c6cbdd873d4a90461d04b25c4 (patch) | |
tree | 28ab96a83c87ef6eba176f13ddf5ee7a07c1e770 /src | |
parent | 165bc028893a1971d4c75b146e3cd3ce92f13982 (diff) |
Scripts/Commands: .npc delete and .gobj delete now work while the specified guid is despawned. Fixes #20145.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Commands/cs_gobject.cpp | 5 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 46927a1c8f6..392f619b1d6 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -351,6 +351,9 @@ public: if (!guidLow) return false; + Player const* const player = handler->GetSession()->GetPlayer(); + // force respawn to make sure we find something + player->GetMap()->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, guidLow, true); GameObject* object = handler->GetObjectFromPlayerMapByDbGuid(guidLow); if (!object) { @@ -362,7 +365,7 @@ public: ObjectGuid ownerGuid = object->GetOwnerGUID(); if (ownerGuid) { - Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); + Unit* owner = ObjectAccessor::GetUnit(*player, ownerGuid); if (!owner || !ownerGuid.IsPlayer()) { handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), guidLow); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 2f527cd5e99..8eecd2a70e1 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -561,6 +561,9 @@ public: ObjectGuid::LowType lowguid = atoul(cId); if (!lowguid) return false; + // force respawn to make sure we find something + handler->GetSession()->GetPlayer()->GetMap()->RemoveRespawnTime(SPAWN_TYPE_CREATURE, lowguid, true); + // then try to find it creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid); } else |