From aed1959dbec91b0d4d60174bc90101011b949ed3 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 3 Jul 2017 01:53:41 -0500 Subject: [PATCH] Fix issues with underground NPC corpses - add command #fixcorpses to fix nearby NPC corpses of the player (this should be a seldom need) --- zone/attack.cpp | 12 ------------ zone/command.cpp | 6 ++++++ zone/command.h | 1 + zone/entity.cpp | 16 ++++++++++++++++ zone/entity.h | 1 + 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/zone/attack.cpp b/zone/attack.cpp index b681745e7..819623148 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -2388,18 +2388,6 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQEmu::skills::Skil entity_list.UnMarkNPC(GetID()); entity_list.RemoveNPC(GetID()); - /* Fix Z on Corpse Creation */ - glm::vec3 dest(m_Position.x, m_Position.y, m_Position.z); - float new_z = zone->zonemap->FindBestZ(dest, nullptr); - corpse->SetFlyMode(1); - float size = GetSize(); - if (size > 10) - size = 10; - - new_z += size / 2; - - corpse->GMMove(m_Position.x, m_Position.y, new_z, m_Position.w); - this->SetID(0); if (killer != 0 && emoteid != 0) diff --git a/zone/command.cpp b/zone/command.cpp index a80a0481e..b6c79e235 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -173,6 +173,7 @@ int command_init(void) command_add("checklos", "- Check for line of sight to your target", 50, command_checklos) || command_add("clearinvsnapshots", "[use rule] - Clear inventory snapshot history (true - elapsed entries, false - all entries)", 200, command_clearinvsnapshots) || command_add("corpse", "- Manipulate corpses, use with no arguments for help", 50, command_corpse) || + command_add("corpsefix", "Attempts to bring corpses from underneath the ground within close proximity of the player", 0, command_corpsefix) || command_add("crashtest", "- Crash the zoneserver", 255, command_crashtest) || command_add("cvs", "- Summary of client versions currently online.", 200, command_cvs) || command_add("damage", "[amount] - Damage your target", 100, command_damage) || @@ -2977,6 +2978,11 @@ void command_reloadqst(Client *c, const Seperator *sep) } +void command_corpsefix(Client *c, const Seperator *sep) +{ + entity_list.CorpseFix(c); +} + void command_reloadworld(Client *c, const Seperator *sep) { c->Message(0, "Reloading quest cache and repopping zones worldwide."); diff --git a/zone/command.h b/zone/command.h index 987adf674..0a850fbca 100644 --- a/zone/command.h +++ b/zone/command.h @@ -72,6 +72,7 @@ void command_checklos(Client *c, const Seperator *sep); void command_clearinvsnapshots(Client *c, const Seperator *sep); void command_connectworldserver(Client *c, const Seperator *sep); void command_corpse(Client *c, const Seperator *sep); +void command_corpsefix(Client *c, const Seperator *sep); void command_crashtest(Client *c, const Seperator *sep); void command_cvs(Client *c, const Seperator *sep); void command_d1(Client *c, const Seperator *sep); diff --git a/zone/entity.cpp b/zone/entity.cpp index 5a8e9fa5e..35d67a5d3 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2845,6 +2845,22 @@ int32 EntityList::DeleteNPCCorpses() return x; } +void EntityList::CorpseFix(Client* c) +{ + + auto it = corpse_list.begin(); + while (it != corpse_list.end()) { + Corpse* corpse = it->second; + if (corpse->IsNPCCorpse()) { + if (DistanceNoZ(c->GetPosition(), corpse->GetPosition()) < 100) { + c->Message(15, "Attempting to fix %s", it->second->GetCleanName()); + corpse->GMMove(corpse->GetX(), corpse->GetY(), c->GetZ() + 2, 0); + } + } + ++it; + } +} + // returns the number of corpses deleted. A negative number indicates an error code. int32 EntityList::DeletePlayerCorpses() { diff --git a/zone/entity.h b/zone/entity.h index e2224d05d..7752e97b1 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -386,6 +386,7 @@ public: void FindPathsToAllNPCs(); int32 DeleteNPCCorpses(); int32 DeletePlayerCorpses(); + void CorpseFix(Client* c); void WriteEntityIDs(); void HalveAggro(Mob* who); void DoubleAggro(Mob* who);