[Commands] Cleanup #getplayerburiedcorpsecount Command. (#1818)

* [Commands] Cleanup #getplayerburiedcorpsecount Command.
- Cleanup message and logic.

* Update command.cpp
This commit is contained in:
Kinglykrab 2021-11-25 21:01:23 -05:00 committed by GitHub
parent e474b2a280
commit b29f398239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 21 deletions

View File

@ -164,9 +164,9 @@ int command_init(void)
command_add("emote", "['name'/'world'/'zone'] [type] [message] - Send an emote message", AccountStatus::QuestTroupe, command_emote) ||
command_add("emotesearch", "Searches NPC Emotes", AccountStatus::QuestTroupe, command_emotesearch) ||
command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) ||
command_add("emptyinventory", "- Clears you or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) ||
command_add("emptyinventory", "- Clears your or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) ||
command_add("enablerecipe", "[Recipe ID] - Enables a Recipe", AccountStatus::QuestTroupe, command_enablerecipe) ||
command_add("endurance", "Restores you or your target's endurance.", AccountStatus::Guide, command_endurance) ||
command_add("endurance", "Restores your or your target's endurance.", AccountStatus::Guide, command_endurance) ||
command_add("equipitem", "[slotid(0-21)] - Equip the item on your cursor into the specified slot", AccountStatus::Guide, command_equipitem) ||
command_add("face", "- Change the face of your target", AccountStatus::QuestTroupe, command_face) ||
command_add("faction", "[Find (criteria | all ) | Review (criteria | all) | Reset (id)] - Resets Player's Faction", AccountStatus::QuestTroupe, command_faction) ||
@ -189,7 +189,7 @@ int command_init(void)
command_add("gassign", "[id] - Assign targetted NPC to predefined wandering grid id", AccountStatus::GMAdmin, command_gassign) ||
command_add("gearup", "Developer tool to quickly equip a character", AccountStatus::GMMgmt, command_gearup) ||
command_add("gender", "[0/1/2] - Change your or your target's gender to male/female/neuter", AccountStatus::Guide, command_gender) ||
command_add("getplayerburiedcorpsecount", "- Get the target's total number of buried player corpses.", AccountStatus::GMAdmin, command_getplayerburiedcorpsecount) ||
command_add("getplayerburiedcorpsecount", "- Get your or your target's total number of buried player corpses.", AccountStatus::GMAdmin, command_getplayerburiedcorpsecount) ||
command_add("getvariable", "[varname] - Get the value of a variable from the database", AccountStatus::GMMgmt, command_getvariable) ||
command_add("ginfo", "- get group info on target.", AccountStatus::ApprenticeGuide, command_ginfo) ||
command_add("giveitem", "[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.", AccountStatus::GMMgmt, command_giveitem) ||

View File

@ -3,25 +3,32 @@
void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep)
{
Client *t = c;
Client *target = c;
if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) {
t = c->GetTarget()->CastToClient();
}
else {
c->Message(Chat::White, "You must first select a target!");
return;
target = c->GetTarget()->CastToClient();
}
uint32 CorpseCount = database.GetCharacterBuriedCorpseCount(t->CharacterID());
if (CorpseCount > 0) {
c->Message(Chat::White, "Your target has a total of %u buried corpses.", CorpseCount);
uint32 corpse_count = database.GetCharacterBuriedCorpseCount(target->CharacterID());
c->Message(
Chat::White,
fmt::format(
"{} {} {} buried corpse{}.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
),
c == target ? "have" : "has",
(
corpse_count ?
std::to_string(corpse_count) :
"no"
),
corpse_count != 1 ? "s" : ""
).c_str()
);
}
else {
c->Message(Chat::White, "Your target doesn't have any buried corpses.");
}
return;
}