mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
[Commands] Cleanup #corpsefix Command. (#2197)
* [Commands] Cleanup #corpsefix Command. - Cleanup messages and logic. * Update entity.cpp
This commit is contained in:
parent
129a738072
commit
e6db71e31e
@ -3308,18 +3308,44 @@ uint32 EntityList::DeleteNPCCorpses()
|
||||
|
||||
void EntityList::CorpseFix(Client* c)
|
||||
{
|
||||
uint32 fixed_count = 0;
|
||||
for (const auto& e : corpse_list) {
|
||||
auto cur = e.second;
|
||||
if (cur->IsNPCCorpse()) {
|
||||
if (DistanceNoZ(c->GetPosition(), cur->GetPosition()) < 100) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Attempting to fix {}.",
|
||||
cur->GetCleanName()
|
||||
).c_str()
|
||||
);
|
||||
|
||||
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(Chat::Yellow, "Attempting to fix %s", it->second->GetCleanName());
|
||||
corpse->GMMove(corpse->GetX(), corpse->GetY(), c->GetZ() + 2, 0);
|
||||
cur->GMMove(
|
||||
cur->GetX(),
|
||||
cur->GetY(),
|
||||
cur->GetFixedZ(c->GetPosition()),
|
||||
c->GetHeading()
|
||||
);
|
||||
|
||||
fixed_count++;
|
||||
}
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
if (!fixed_count) {
|
||||
c->Message(Chat::White, "There were no nearby NPC corpses to fix.");
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Fixed {} nearby NPC corpse{}.",
|
||||
fixed_count,
|
||||
fixed_count != 1 ? "s" : ""
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
// returns the number of corpses deleted. A negative number indicates an error code.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user