eqemu-server/zone/gm_commands/emoteview.cpp
Chris Miles 0550fcfd3f
[GM Commands] Split GM Commands Into Separate Files (#1766)
* Split GM commands into their own files

* Code cleanup
2021-11-14 22:48:47 -06:00

40 lines
908 B
C++
Executable File

#include "../client.h"
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.");
return;
}
if (c->GetTarget() && c->GetTarget()->IsNPC()) {
int count = 0;
int emoteid = c->GetTarget()->CastToNPC()->GetEmoteID();
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);
}
}
}