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:
Treeston authored and Ovahlord committed 2019-08-18 12:12:09 +02:00
1 parent 8a1828aa43
commit f9184f026b
12 files changed
+150 -182

No files matched your search

+28 -42
View File
@@ -637,22 +637,28 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
target->DeleteFromDB();
target->AddObjectToRemoveList();
if (Creature::DeleteFromDB(target->GetSpawnId()))
{
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
WorldDatabase.Execute(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
WorldDatabase.Execute(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POINT);
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
WorldDatabase.Execute(stmt);
stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_POINT);
stmt->setUInt32(0, pathid);
stmt->setUInt32(1, point);
WorldDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_WAYPOINT_REMOVED);
return true;
} // del
handler->SendSysMessage(LANG_WAYPOINT_REMOVED);
return true;
}
else
{
handler->SendSysMessage(LANG_WAYPOINT_NOTREMOVED);
handler->SetSentErrorMessage(true);
return false;
}
} // del
if (show == "move")
{
@@ -663,8 +669,12 @@ public:
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
target->DeleteFromDB();
target->AddObjectToRemoveList();
if (!Creature::DeleteFromDB(target->GetSpawnId()))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
handler->SetSentErrorMessage(true);
return false;
}
// re-create
Creature* wpCreature = new Creature();
@@ -837,24 +847,11 @@ public:
{
Field* fields = result2->Fetch();
uint32 wpguid = fields[0].GetUInt32();
Creature* creature = handler->GetCreatureFromPlayerMapByDbGuid(wpguid);
if (!creature)
if (!Creature::DeleteFromDB(wpguid))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid);
hasError = true;
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
stmt->setUInt32(0, wpguid);
WorldDatabase.Execute(stmt);
}
else
{
creature->CombatStop();
creature->DeleteFromDB();
creature->AddObjectToRemoveList();
}
}
while (result2->NextRow());
@@ -1040,21 +1037,10 @@ public:
Field* fields = result->Fetch();
ObjectGuid::LowType lowguid = fields[0].GetUInt32();
Creature* creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
if (!creature)
if (!Creature::DeleteFromDB(lowguid))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, lowguid);
hasError = true;
stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE);
stmt->setUInt32(0, lowguid);
WorldDatabase.Execute(stmt);
}
else
{
creature->CombatStop();
creature->DeleteFromDB();
creature->AddObjectToRemoveList();
}
}
while (result->NextRow());