mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Commands] Cleanup #hatelist Command. (#1976)
- Cleanup messages and logic.
This commit is contained in:
parent
7bf466cf3f
commit
968ae26c99
@ -209,7 +209,7 @@ int command_init(void)
|
||||
command_add("hair", "- Change the hair style of your target", AccountStatus::QuestTroupe, command_hair) ||
|
||||
command_add("haircolor", "- Change the hair color of your target", AccountStatus::QuestTroupe, command_haircolor) ||
|
||||
command_add("haste", "[percentage] - Set your haste percentage", AccountStatus::GMAdmin, command_haste) ||
|
||||
command_add("hatelist", " - Display hate list for target.", AccountStatus::QuestTroupe, command_hatelist) ||
|
||||
command_add("hatelist", "- Display hate list for NPC.", AccountStatus::QuestTroupe, command_hatelist) ||
|
||||
command_add("heal", "- Completely heal your target", AccountStatus::Steward, command_heal) ||
|
||||
command_add("helm", "- Change the helm of your target", AccountStatus::QuestTroupe, command_helm) ||
|
||||
command_add("help", "[search term] - List available commands and their description, specify partial command as argument to search", AccountStatus::Player, command_help) ||
|
||||
|
||||
@ -2,14 +2,12 @@
|
||||
|
||||
void command_hatelist(Client *c, const Seperator *sep)
|
||||
{
|
||||
Mob *target = c->GetTarget();
|
||||
if (target == nullptr) {
|
||||
c->Message(Chat::White, "Error: you must have a target.");
|
||||
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
||||
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(Chat::White, "Display hate list for %s..", target->GetName());
|
||||
auto target = c->GetTarget();
|
||||
|
||||
target->PrintHateListToClient(c);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -645,15 +645,53 @@ bool HateList::IsHateListEmpty() {
|
||||
|
||||
void HateList::PrintHateListToClient(Client *c)
|
||||
{
|
||||
auto iterator = list.begin();
|
||||
while (iterator != list.end())
|
||||
{
|
||||
struct_HateList *e = (*iterator);
|
||||
c->Message(Chat::White, "- name: %s, damage: %d, hate: %d",
|
||||
(e->entity_on_hatelist && e->entity_on_hatelist->GetName()) ? e->entity_on_hatelist->GetName() : "(null)",
|
||||
e->hatelist_damage, e->stored_hate_amount);
|
||||
if (list.size()) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Displaying hate list for {} ({}).",
|
||||
hate_owner->GetCleanName(),
|
||||
hate_owner->GetID()
|
||||
).c_str()
|
||||
);
|
||||
|
||||
++iterator;
|
||||
auto entity_number = 1;
|
||||
for (const auto& hate_entity : list) {
|
||||
if (hate_entity->entity_on_hatelist) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Hate Entity {} | Name: {} ({}) Damage: {} Hate: {}",
|
||||
entity_number,
|
||||
hate_entity->entity_on_hatelist->GetName(),
|
||||
hate_entity->entity_on_hatelist->GetID(),
|
||||
hate_entity->hatelist_damage,
|
||||
hate_entity->stored_hate_amount
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Hate Entity {} | Damage: {} Hate: {}",
|
||||
entity_number,
|
||||
hate_entity->hatelist_damage,
|
||||
hate_entity->stored_hate_amount
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
entity_number++;
|
||||
}
|
||||
} else {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) has nothing on its hatelist.",
|
||||
hate_owner->GetCleanName(),
|
||||
hate_owner->GetID()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user