[Cleanup] Cleanup #view zone_loot Command (#3523)

* [Cleanup] Cleanup #view zone_loot Command

# Notes
- An item ID was being required, we don't want to do that.
- Cleanup messages to only show item name/item ID

* Update zone_loot.cpp
This commit is contained in:
Alex King 2023-08-02 19:58:25 -04:00 committed by GitHub
parent 2dc2bac456
commit 68b40f0239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,15 +2,7 @@
void ShowZoneLoot(Client *c, const Seperator *sep) void ShowZoneLoot(Client *c, const Seperator *sep)
{ {
if (!sep->IsNumber(2)) { const uint32 search_item_id = sep->IsNumber(2) ? Strings::ToUnsignedInt(sep->arg[2]) : 0;
c->Message(
Chat::White,
"Usage: #show zone_loot [Item ID]"
);
return;
}
const uint32 search_item_id = Strings::ToUnsignedInt(sep->arg[2]);
std::vector<std::pair<NPC *, ItemList>> v; std::vector<std::pair<NPC *, ItemList>> v;
@ -44,7 +36,7 @@ void ShowZoneLoot(Client *c, const Seperator *sep)
); );
npc_link = fmt::format( npc_link = fmt::format(
"NPC: {} (ID {}) [{}]", "{} (ID {}) | {}",
n->GetCleanName(), n->GetCleanName(),
n->GetID(), n->GetID(),
command_link command_link
@ -60,11 +52,32 @@ void ShowZoneLoot(Client *c, const Seperator *sep)
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
"{}. {} ({}) {}", "Item {} | {}{}{}",
loot_number, loot_number,
linker.GenerateLink(), (
i->item_id, !search_item_id ?
npc_link fmt::format(
"{} ({}) | ",
linker.GenerateLink(),
i->item_id
) :
""
),
npc_link,
(
!search_item_id ?
fmt::format(
" | {}",
Saylink::Silent(
fmt::format(
"#show zone_loot {}",
i->item_id
),
"Show"
)
) :
""
)
).c_str() ).c_str()
); );
@ -81,7 +94,7 @@ void ShowZoneLoot(Client *c, const Seperator *sep)
fmt::format( fmt::format(
"{} ({}) is dropping in {} place{}.", "{} ({}) is dropping in {} place{}.",
database.CreateItemLink(search_item_id), database.CreateItemLink(search_item_id),
Strings::Commify(search_item_id), search_item_id,
loot_count, loot_count,
loot_count != 1 ? "s" : "" loot_count != 1 ? "s" : ""
).c_str() ).c_str()
@ -93,7 +106,7 @@ void ShowZoneLoot(Client *c, const Seperator *sep)
c->Message( c->Message(
Chat::White, Chat::White,
fmt::format( fmt::format(
"{} Item {} {} dropping.", "{} Item{} {} dropping.",
loot_count, loot_count,
loot_count != 1 ? "s" : "", loot_count != 1 ? "s" : "",
loot_count != 1 ? "are" : "is" loot_count != 1 ? "are" : "is"