-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Commands] Add #emotesearch to #find command (#3480)
# Notes - Missed this with initial `#find` command consolidation.
- Loading branch information
1 parent
7427318
commit 01a1186
Showing
5 changed files
with
136 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#include "../../client.h" | ||
|
||
void FindEmote(Client *c, const Seperator *sep) | ||
{ | ||
uint32 found_count = 0; | ||
|
||
if (sep->IsNumber(2)) { | ||
auto emote_id = Strings::ToUnsignedInt(sep->arg[2]); | ||
|
||
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: {} ({})", | ||
e->emoteid, | ||
EQ::constants::GetEmoteEventTypeName(e->event_), | ||
e->event_, | ||
EQ::constants::GetEmoteTypeName(e->type), | ||
e->type | ||
).c_str() | ||
); | ||
|
||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"Emote {} | Text: {}", | ||
e->emoteid, | ||
e->text | ||
).c_str() | ||
); | ||
|
||
found_count++; | ||
} | ||
|
||
if (found_count == 50) { | ||
break; | ||
} | ||
|
||
iterator.Advance(); | ||
} | ||
|
||
if (found_count == 50) { | ||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"50 Emotes shown matching ID '{}', max reached.", | ||
emote_id | ||
).c_str() | ||
); | ||
|
||
return; | ||
} | ||
|
||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"{} Emote{} found matching ID '{}'.", | ||
found_count, | ||
found_count != 1 ? "s" : "", | ||
emote_id | ||
).c_str() | ||
); | ||
|
||
return; | ||
} | ||
|
||
const std::string& search_criteria = sep->argplus[2]; | ||
|
||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList); | ||
iterator.Reset(); | ||
while (iterator.MoreElements()) { | ||
auto &e = iterator.GetData(); | ||
|
||
const std::string& current_text = Strings::ToLower(e->text); | ||
|
||
if (Strings::Contains(current_text, Strings::ToLower(search_criteria))) { | ||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"Emote {} | Event: {} ({}) Type: {} ({})", | ||
e->emoteid, | ||
EQ::constants::GetEmoteEventTypeName(e->event_), | ||
e->event_, | ||
EQ::constants::GetEmoteTypeName(e->type), | ||
e->type | ||
).c_str() | ||
); | ||
|
||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"Emote {} | Text: {}", | ||
e->emoteid, | ||
e->text | ||
).c_str() | ||
); | ||
|
||
found_count++; | ||
} | ||
|
||
if (found_count == 50) { | ||
break; | ||
} | ||
|
||
iterator.Advance(); | ||
} | ||
|
||
if (found_count == 50) { | ||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"50 Emotes shown matching '{}', max reached.", | ||
search_criteria | ||
).c_str() | ||
); | ||
|
||
return; | ||
} | ||
|
||
c->Message( | ||
Chat::White, | ||
fmt::format( | ||
"{} Emote{} found matching '{}'.", | ||
found_count, | ||
found_count != 1 ? "s" : "", | ||
search_criteria | ||
).c_str() | ||
); | ||
} |