diff --git a/zone/command.cpp b/zone/command.cpp index 35b920e53..8ede0ebf0 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -230,6 +230,7 @@ int command_init(void) command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_traindisc) || command_add("tune", "Calculate statistical values related to combat.", AccountStatus::GMAdmin, command_tune) || command_add("undye", "Remove dye from all of your or your target's armor slots", AccountStatus::GMAdmin, command_undye) || + command_add("underworld", "- Show all mobs under the world", AccountStatus::GMAreas, command_underworld) || command_add("unmemspell", "[Spell ID] - Unmemorize a Spell by ID for you or your target", AccountStatus::Guide, command_unmemspell) || command_add("unmemspells", " Unmemorize all spells for you or your target", AccountStatus::Guide, command_unmemspells) || command_add("unscribespell", "[Spell ID] - Unscribe a spell from your or your target's spell book by Spell ID", AccountStatus::GMCoder, command_unscribespell) || @@ -923,6 +924,7 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/task.cpp" #include "gm_commands/traindisc.cpp" #include "gm_commands/tune.cpp" +#include "gm_commands/underworld.cpp" #include "gm_commands/undye.cpp" #include "gm_commands/unmemspell.cpp" #include "gm_commands/unmemspells.cpp" diff --git a/zone/command.h b/zone/command.h index 09164e6bf..e792ee82a 100644 --- a/zone/command.h +++ b/zone/command.h @@ -183,6 +183,7 @@ void command_task(Client *c, const Seperator *sep); void command_petname(Client *c, const Seperator *sep); void command_traindisc(Client *c, const Seperator *sep); void command_tune(Client *c, const Seperator *sep); +void command_underworld(Client *c, const Seperator *sep); void command_undye(Client *c, const Seperator *sep); void command_unmemspell(Client *c, const Seperator *sep); void command_unmemspells(Client *c, const Seperator *sep); diff --git a/zone/entity.cpp b/zone/entity.cpp index 85f492c58..9dd885687 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -5963,3 +5963,20 @@ std::vector EntityList::GetExcludedNPCsByIDs(std::vector npc_ids) return v; } + +void EntityList::GetUnderworldMobs(Client* c) { + float underworld = zone->newzone_data.underworld; + auto it = npc_list.begin(); + while (it != npc_list.end()) { + NPC* mob = it->second->CastToNPC(); + if (mob->IsTrackable()) { + if (mob->GetZ() <= underworld) { + c->Message(Chat::White, "%s was under the world at %f %f %f. Resetting to spawn point at %f %f %f.", + mob->GetCleanName(), mob->GetX(), mob->GetY(), mob->GetZ(), mob->respawn2->GetX(), mob->respawn2->GetY(), mob->respawn2->GetZ()); + mob->Teleport(glm::vec3(mob->respawn2->GetX(), mob->respawn2->GetY(), mob->respawn2->GetZ())); + mob->SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0, true); + } + } + ++it; + } +} diff --git a/zone/entity.h b/zone/entity.h index f073a4fb5..1c23a7e0a 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -578,6 +578,8 @@ public: int MovePlayerCorpsesToGraveyard(bool force_move_from_instance = false); + void GetUnderworldMobs(Client* c); + protected: friend class Zone; void Depop(bool StartSpawnTimer = false); diff --git a/zone/gm_commands/underworld.cpp b/zone/gm_commands/underworld.cpp new file mode 100644 index 000000000..15915f24f --- /dev/null +++ b/zone/gm_commands/underworld.cpp @@ -0,0 +1,5 @@ +#include "../client.h" + +void command_underworld(Client *c, const Seperator *sep) { + entity_list.GetUnderworldMobs(c); +} diff --git a/zone/npc.cpp b/zone/npc.cpp index ba5782c34..2cbee0f76 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -595,6 +595,16 @@ bool NPC::Process() spun_timer.Disable(); } + // If mobs are under the world, move them back to spawn point. + if (!IsEngaged() && IsTrackable()) { + if (GetZ() <= zone->newzone_data.underworld) { + if (respawn2) { + Teleport(glm::vec3(respawn2->GetX(), respawn2->GetY(), respawn2->GetZ())); + SentPositionPacket(0.0f, 0.0f, 0.0f, 0.0f, 0, true); + } + } + } + SpellProcess(); if (swarm_timer.Check()) {