mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +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)
|
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();
|
cur->GMMove(
|
||||||
while (it != corpse_list.end()) {
|
cur->GetX(),
|
||||||
Corpse* corpse = it->second;
|
cur->GetY(),
|
||||||
if (corpse->IsNPCCorpse()) {
|
cur->GetFixedZ(c->GetPosition()),
|
||||||
if (DistanceNoZ(c->GetPosition(), corpse->GetPosition()) < 100) {
|
c->GetHeading()
|
||||||
c->Message(Chat::Yellow, "Attempting to fix %s", it->second->GetCleanName());
|
);
|
||||||
corpse->GMMove(corpse->GetX(), corpse->GetY(), c->GetZ() + 2, 0);
|
|
||||||
|
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.
|
// returns the number of corpses deleted. A negative number indicates an error code.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user