[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
+48 -4
View File
@@ -23,15 +23,59 @@ std::vector<int> GlobalLootManager::GetGlobalLootTables(NPC *mob) const
void GlobalLootManager::ShowZoneGlobalLoot(Client *to) const
{
for (auto &e : m_entries)
to->Message(Chat::White, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
int table_number = 1;
for (auto &e : m_entries) {
to->Message(
Chat::White,
fmt::format(
"Table {} | Name: {}",
table_number,
e.GetDescription()
).c_str()
);
to->Message(
Chat::White,
fmt::format(
"Table {} | Global Table ID: {} Loot Table ID: {}",
table_number,
e.GetID(),
e.GetLootTableID()
).c_str()
);
table_number++;
}
}
void GlobalLootManager::ShowNPCGlobalLoot(Client *to, NPC *who) const
{
int table_number = 1;
for (auto &e : m_entries) {
if (e.PassesRules(who))
to->Message(Chat::White, " %s : %d table %d", e.GetDescription().c_str(), e.GetID(), e.GetLootTableID());
if (e.PassesRules(who)) {
to->Message(
Chat::White,
fmt::format(
"Table {} | Name: {}",
table_number,
e.GetDescription()
).c_str()
);
to->Message(
Chat::White,
fmt::format(
"Table {} | Global Table ID: {} Loot Table ID: {}",
table_number,
e.GetID(),
e.GetLootTableID()
).c_str()
);
table_number++;
}
}
}