Entities/Unit: Nuke Map::ForceRespawn from orbit, with the following implications:
- .npc respawn no longer causes stupid things to happen (Fixes #23014) - ::DeleteFromDB methods on Creature and GameObject rewritten to be as sensible as such a colossally stupid method can ever be. They're static now. - .npc delete and .gobj delete ported to new argument handling, and rewritten as per above. They can no longer crash the server when used in instances, too. Yay for that. - Adjusted various dusty cobwebbed hacks around the core (why does waypoint visualization use permanent spawns *shudder*) to still work too.
This commit is contained in:
1 parent
8a1828aa43
commit
f9184f026b
12 files changed
+150
-182
No files matched your search
@@ -558,8 +558,7 @@ public:
|
||||
|
||||
static bool HandleNpcDeleteCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
|
||||
ObjectGuid::LowType spawnId;
|
||||
if (*args)
|
||||
{
|
||||
// number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
|
||||
@@ -567,37 +566,39 @@ public:
|
||||
if (!cId)
|
||||
return false;
|
||||
|
||||
ObjectGuid::LowType lowguid = atoul(cId);
|
||||
if (!lowguid)
|
||||
spawnId = atoul(cId);
|
||||
if (!spawnId)
|
||||
return false;
|
||||
// force respawn to make sure we find something
|
||||
handler->GetSession()->GetPlayer()->GetMap()->ForceRespawn(SPAWN_TYPE_CREATURE, lowguid);
|
||||
// then try to find it
|
||||
creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
|
||||
}
|
||||
else
|
||||
creature = handler->getSelectedCreature();
|
||||
|
||||
if (!creature || creature->IsPet() || creature->IsTotem())
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CREATURE);
|
||||
Creature* creature = handler->getSelectedCreature();
|
||||
if (!creature || creature->IsPet() || creature->IsTotem())
|
||||
{
|
||||
handler->SendSysMessage(LANG_SELECT_CREATURE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
if (TempSummon* summon = creature->ToTempSummon())
|
||||
{
|
||||
summon->UnSummon();
|
||||
handler->SendSysMessage(LANG_COMMAND_DELCREATMESSAGE);
|
||||
return true;
|
||||
}
|
||||
spawnId = creature->GetSpawnId();
|
||||
}
|
||||
|
||||
if (Creature::DeleteFromDB(spawnId))
|
||||
{
|
||||
handler->SendSysMessage(LANG_COMMAND_DELCREATMESSAGE);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, spawnId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TempSummon* summon = creature->ToTempSummon())
|
||||
summon->UnSummon();
|
||||
else
|
||||
{
|
||||
// Delete the creature
|
||||
creature->CombatStop();
|
||||
creature->DeleteFromDB();
|
||||
creature->AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
handler->SendSysMessage(LANG_COMMAND_DELCREATMESSAGE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//del item from vendor list
|
||||
|
||||
Reference in new issue
Block a user