[Commands] Cleanup #shownpcgloballoot and #showzonegloballoot Command. (#2141)

- Cleanup messages and logic.
This commit is contained in:
Kinglykrab
2022-05-06 19:50:03 -04:00
committed by GitHub
parent 5aaaaed6f1
commit e5acc7c322
4 changed files with 70 additions and 16 deletions
+13 -6
View File
@@ -2,15 +2,22 @@
void command_shownpcgloballoot(Client *c, const Seperator *sep)
{
auto tar = c->GetTarget();
if (!tar || !tar->IsNPC()) {
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
c->Message(Chat::White, "You must target an NPC to use this command.");
return;
}
auto npc = tar->CastToNPC();
c->Message(Chat::White, "GlobalLoot for %s (%d)", npc->GetName(), npc->GetNPCTypeID());
zone->ShowNPCGlobalLoot(c, npc);
auto target = c->GetTarget()->CastToNPC();
c->Message(
Chat::White,
fmt::format(
"Global loot for {} ({}).",
target->GetCleanName(),
target->GetNPCTypeID()
).c_str()
);
zone->ShowNPCGlobalLoot(c, target);
}