mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 15:57:58 +00:00
[Commands] Cleanup #corpse Command. (#1790)
- Cleanup message and logic. - Add ConvertMoneyToString(platinum, gold, silver, copper) helper method. - Cleanup NPC::QueryLoot() and Corpse::QueryLoot().
This commit is contained in:
+62
-40
@@ -3152,50 +3152,75 @@ char *EntityList::RemoveNumbers(char *name)
|
||||
|
||||
void EntityList::ListNPCCorpses(Client *client)
|
||||
{
|
||||
uint32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
client->Message(Chat::White, "NPC Corpses in the zone:");
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsNPCCorpse()) {
|
||||
client->Message(Chat::White, " %5d: %s", it->first, it->second->GetName());
|
||||
x++;
|
||||
uint32 corpse_count = 0;
|
||||
for (const auto& corpse : corpse_list) {
|
||||
uint32 corpse_number = (corpse_count + 1);
|
||||
if (corpse.second->IsNPCCorpse()) {
|
||||
client->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Corpse {} | Name: {} ({})",
|
||||
corpse_number,
|
||||
corpse.second->GetName(),
|
||||
corpse.second->GetID()
|
||||
).c_str()
|
||||
);
|
||||
corpse_count++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
client->Message(Chat::White, "%d npc corpses listed.", x);
|
||||
|
||||
if (corpse_count > 0) {
|
||||
client->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} NPC corpses listed.",
|
||||
corpse_count
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void EntityList::ListPlayerCorpses(Client *client)
|
||||
{
|
||||
uint32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
client->Message(Chat::White, "Player Corpses in the zone:");
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsPlayerCorpse()) {
|
||||
client->Message(Chat::White, " %5d: %s", it->first, it->second->GetName());
|
||||
x++;
|
||||
uint32 corpse_count = 0;
|
||||
for (const auto& corpse : corpse_list) {
|
||||
uint32 corpse_number = (corpse_count + 1);
|
||||
if (corpse.second->IsPlayerCorpse()) {
|
||||
client->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Corpse {} | Name: {} ({})",
|
||||
corpse_number,
|
||||
corpse.second->GetName(),
|
||||
corpse.second->GetID()
|
||||
).c_str()
|
||||
);
|
||||
corpse_count++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
client->Message(Chat::White, "%d player corpses listed.", x);
|
||||
|
||||
if (corpse_count > 0) {
|
||||
client->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} Player corpses listed.",
|
||||
corpse_count
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// returns the number of corpses deleted. A negative number indicates an error code.
|
||||
int32 EntityList::DeleteNPCCorpses()
|
||||
uint32 EntityList::DeleteNPCCorpses()
|
||||
{
|
||||
int32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsNPCCorpse()) {
|
||||
it->second->DepopNPCCorpse();
|
||||
x++;
|
||||
uint32 corpse_count = 0;
|
||||
for (const auto& corpse : corpse_list) {
|
||||
if (corpse.second->IsNPCCorpse()) {
|
||||
corpse.second->DepopNPCCorpse();
|
||||
corpse_count++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return x;
|
||||
return corpse_count;
|
||||
}
|
||||
|
||||
void EntityList::CorpseFix(Client* c)
|
||||
@@ -3215,19 +3240,16 @@ void EntityList::CorpseFix(Client* c)
|
||||
}
|
||||
|
||||
// returns the number of corpses deleted. A negative number indicates an error code.
|
||||
int32 EntityList::DeletePlayerCorpses()
|
||||
uint32 EntityList::DeletePlayerCorpses()
|
||||
{
|
||||
int32 x = 0;
|
||||
|
||||
auto it = corpse_list.begin();
|
||||
while (it != corpse_list.end()) {
|
||||
if (it->second->IsPlayerCorpse()) {
|
||||
it->second->CastToCorpse()->Delete();
|
||||
x++;
|
||||
uint32 corpse_count = 0;
|
||||
for (const auto& corpse : corpse_list) {
|
||||
if (corpse.second->IsPlayerCorpse()) {
|
||||
corpse.second->Delete();
|
||||
corpse_count++;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return x;
|
||||
return corpse_count;
|
||||
}
|
||||
|
||||
void EntityList::SendPetitionToAdmins()
|
||||
|
||||
Reference in New Issue
Block a user