mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-19 21:08:20 +00:00
[Commands] Cleanup #emotesearch and #emoteview Command. (#2494)
* [Commands] Cleanup #emoteview Command. Cleanup command messages and logic. Add constants for Emote Events and Emote Types and replace all the old constants with the new constants. * Update emoteview.cpp * Cleanup #emotesearch Command.
This commit is contained in:
@@ -3,37 +3,70 @@
|
||||
void command_emoteview(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (!c->GetTarget() || !c->GetTarget()->IsNPC()) {
|
||||
c->Message(Chat::White, "You must target a NPC to view their emotes.");
|
||||
c->Message(Chat::White, "You must target an NPC to view their emotes.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->GetTarget() && c->GetTarget()->IsNPC()) {
|
||||
int count = 0;
|
||||
int emoteid = c->GetTarget()->CastToNPC()->GetEmoteID();
|
||||
auto target = c->GetTarget()->CastToNPC();
|
||||
|
||||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
NPC_Emote_Struct *nes = iterator.GetData();
|
||||
if (emoteid == nes->emoteid) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
"EmoteID: %i Event: %i Type: %i Text: %s",
|
||||
nes->emoteid,
|
||||
nes->event_,
|
||||
nes->type,
|
||||
nes->text
|
||||
);
|
||||
count++;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
if (count == 0) {
|
||||
c->Message(Chat::White, "No emotes found.");
|
||||
}
|
||||
else {
|
||||
c->Message(Chat::White, "%i emote(s) found", count);
|
||||
auto emote_count = 0;
|
||||
auto emote_id = target->GetEmoteID();
|
||||
|
||||
auto emote_number = 1;
|
||||
|
||||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
auto &e = iterator.GetData();
|
||||
if (emote_id == e->emoteid) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Emote {} | Event: {} ({}) Type: {} ({})",
|
||||
emote_number,
|
||||
EQ::constants::GetEmoteEventTypeName(e->event_),
|
||||
e->event_,
|
||||
EQ::constants::GetEmoteTypeName(e->type),
|
||||
e->type
|
||||
).c_str()
|
||||
);
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Emote {} | Text: {}",
|
||||
emote_number,
|
||||
e->text
|
||||
).c_str()
|
||||
);
|
||||
|
||||
emote_count++;
|
||||
emote_number++;
|
||||
}
|
||||
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
|
||||
if (!emote_count) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} has no emotes on Emote ID {}.",
|
||||
c->GetTargetDescription(target),
|
||||
emote_id
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} has {} emote{} on Emote ID {}.",
|
||||
c->GetTargetDescription(target),
|
||||
emote_count,
|
||||
emote_count != 1 ? "s" : "",
|
||||
emote_id
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user