mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Commands] Add #emotesearch to #find command (#3480)
# Notes - Missed this with initial `#find` command consolidation.
This commit is contained in:
parent
7427318213
commit
01a1186e63
@ -126,7 +126,6 @@ int command_init(void)
|
|||||||
command_add("dzkickplayers", "Removes all players from current expedition. (/kickplayers alternative for pre-RoF clients)", AccountStatus::Player, command_dzkickplayers) ||
|
command_add("dzkickplayers", "Removes all players from current expedition. (/kickplayers alternative for pre-RoF clients)", AccountStatus::Player, command_dzkickplayers) ||
|
||||||
command_add("editmassrespawn", "[name-search] [second-value] - Mass (Zone wide) NPC respawn timer editing command", AccountStatus::GMAdmin, command_editmassrespawn) ||
|
command_add("editmassrespawn", "[name-search] [second-value] - Mass (Zone wide) NPC respawn timer editing command", AccountStatus::GMAdmin, command_editmassrespawn) ||
|
||||||
command_add("emote", "[Name|World|Zone] [type] [message] - Send an emote message by name, to the world, or to your zone (^ separator allows multiple messages to be sent at once)", AccountStatus::QuestTroupe, command_emote) ||
|
command_add("emote", "[Name|World|Zone] [type] [message] - Send an emote message by name, to the world, or to your zone (^ separator allows multiple messages to be sent at once)", AccountStatus::QuestTroupe, command_emote) ||
|
||||||
command_add("emotesearch", "[Search Criteria] - Search for NPC Emotes", AccountStatus::QuestTroupe, command_emotesearch) ||
|
|
||||||
command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) ||
|
command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) ||
|
||||||
command_add("emptyinventory", "Clears your or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) ||
|
command_add("emptyinventory", "Clears your or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) ||
|
||||||
command_add("enablerecipe", "[Recipe ID] - Enables a Recipe", AccountStatus::QuestTroupe, command_enablerecipe) ||
|
command_add("enablerecipe", "[Recipe ID] - Enables a Recipe", AccountStatus::QuestTroupe, command_enablerecipe) ||
|
||||||
@ -380,6 +379,7 @@ int command_init(void)
|
|||||||
"findclass",
|
"findclass",
|
||||||
"findcurrency",
|
"findcurrency",
|
||||||
"finddeity",
|
"finddeity",
|
||||||
|
"findemote",
|
||||||
"findfaction",
|
"findfaction",
|
||||||
"finditem",
|
"finditem",
|
||||||
"findlanguage",
|
"findlanguage",
|
||||||
@ -1002,7 +1002,6 @@ void command_bot(Client *c, const Seperator *sep)
|
|||||||
#include "gm_commands/dzkickplayers.cpp"
|
#include "gm_commands/dzkickplayers.cpp"
|
||||||
#include "gm_commands/editmassrespawn.cpp"
|
#include "gm_commands/editmassrespawn.cpp"
|
||||||
#include "gm_commands/emote.cpp"
|
#include "gm_commands/emote.cpp"
|
||||||
#include "gm_commands/emotesearch.cpp"
|
|
||||||
#include "gm_commands/emoteview.cpp"
|
#include "gm_commands/emoteview.cpp"
|
||||||
#include "gm_commands/emptyinventory.cpp"
|
#include "gm_commands/emptyinventory.cpp"
|
||||||
#include "gm_commands/enablerecipe.cpp"
|
#include "gm_commands/enablerecipe.cpp"
|
||||||
|
|||||||
@ -77,7 +77,6 @@ void command_dz(Client *c, const Seperator *sep);
|
|||||||
void command_dzkickplayers(Client *c, const Seperator *sep);
|
void command_dzkickplayers(Client *c, const Seperator *sep);
|
||||||
void command_editmassrespawn(Client *c, const Seperator *sep);
|
void command_editmassrespawn(Client *c, const Seperator *sep);
|
||||||
void command_emote(Client *c, const Seperator *sep);
|
void command_emote(Client *c, const Seperator *sep);
|
||||||
void command_emotesearch(Client *c, const Seperator *sep);
|
|
||||||
void command_emoteview(Client *c, const Seperator *sep);
|
void command_emoteview(Client *c, const Seperator *sep);
|
||||||
void command_emptyinventory(Client *c, const Seperator *sep);
|
void command_emptyinventory(Client *c, const Seperator *sep);
|
||||||
void command_enablerecipe(Client *c, const Seperator *sep);
|
void command_enablerecipe(Client *c, const Seperator *sep);
|
||||||
|
|||||||
@ -1,142 +0,0 @@
|
|||||||
#include "../client.h"
|
|
||||||
|
|
||||||
void command_emotesearch(Client *c, const Seperator *sep)
|
|
||||||
{
|
|
||||||
auto arguments = sep->argnum;
|
|
||||||
if (!arguments) {
|
|
||||||
c->Message(Chat::White, "Usage: #emotesearch [Emote ID]");
|
|
||||||
c->Message(Chat::White, "Usage: #emotesearch [Search Crteria]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto emote_count = 0;
|
|
||||||
auto emote_number = 1;
|
|
||||||
|
|
||||||
std::string search_criteria = sep->argplus[1];
|
|
||||||
bool found_by_id = false;
|
|
||||||
|
|
||||||
if (!sep->IsNumber(1)) {
|
|
||||||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
|
|
||||||
iterator.Reset();
|
|
||||||
while (iterator.MoreElements()) {
|
|
||||||
auto &e = iterator.GetData();
|
|
||||||
auto current_text = Strings::ToLower(e->text);
|
|
||||||
|
|
||||||
if (Strings::Contains(current_text, Strings::ToLower(search_criteria))) {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"Emote {} | Emote ID: {}",
|
|
||||||
emote_number,
|
|
||||||
e->emoteid
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emote_count == 50) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator.Advance();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
auto emote_id = Strings::ToUnsignedInt(search_criteria);
|
|
||||||
|
|
||||||
LinkedListIterator<NPC_Emote_Struct *> iterator(zone->NPCEmoteList);
|
|
||||||
iterator.Reset();
|
|
||||||
while (iterator.MoreElements()) {
|
|
||||||
auto &e = iterator.GetData();
|
|
||||||
if (emote_id == e->emoteid) {
|
|
||||||
found_by_id = true;
|
|
||||||
|
|
||||||
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++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emote_count == 50) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
iterator.Advance();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
auto found_string = (
|
|
||||||
found_by_id ?
|
|
||||||
fmt::format("ID {}", search_criteria) :
|
|
||||||
search_criteria
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!emote_count) {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"No Emotes found matching {}.",
|
|
||||||
found_string
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
} else if (emote_count == 50) {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"50 Emotes shown matching {}, too many results.",
|
|
||||||
found_string
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"{} Emote{} found matching {}.",
|
|
||||||
emote_count,
|
|
||||||
emote_count != 1 ? "s" : "",
|
|
||||||
found_string
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,6 +4,7 @@
|
|||||||
#include "find/class.cpp"
|
#include "find/class.cpp"
|
||||||
#include "find/currency.cpp"
|
#include "find/currency.cpp"
|
||||||
#include "find/deity.cpp"
|
#include "find/deity.cpp"
|
||||||
|
#include "find/emote.cpp"
|
||||||
#include "find/faction.cpp"
|
#include "find/faction.cpp"
|
||||||
#include "find/item.cpp"
|
#include "find/item.cpp"
|
||||||
#include "find/language.cpp"
|
#include "find/language.cpp"
|
||||||
@ -33,6 +34,7 @@ void command_find(Client *c, const Seperator *sep)
|
|||||||
Cmd{.cmd = "class", .u = "class [Search Criteria]", .fn = FindClass, .a = {"#findclass"}},
|
Cmd{.cmd = "class", .u = "class [Search Criteria]", .fn = FindClass, .a = {"#findclass"}},
|
||||||
Cmd{.cmd = "currency", .u = "currency [Search Criteria]", .fn = FindCurrency, .a = {"#findcurrency"}},
|
Cmd{.cmd = "currency", .u = "currency [Search Criteria]", .fn = FindCurrency, .a = {"#findcurrency"}},
|
||||||
Cmd{.cmd = "deity", .u = "deity [Search Criteria]", .fn = FindDeity, .a = {"#finddeity"}},
|
Cmd{.cmd = "deity", .u = "deity [Search Criteria]", .fn = FindDeity, .a = {"#finddeity"}},
|
||||||
|
Cmd{.cmd = "emote", .u = "emote [Search Criteria]", .fn = FindEmote, .a = {"#findemote"}},
|
||||||
Cmd{.cmd = "faction", .u = "faction [Search Criteria]", .fn = FindFaction, .a = {"#findfaction"}},
|
Cmd{.cmd = "faction", .u = "faction [Search Criteria]", .fn = FindFaction, .a = {"#findfaction"}},
|
||||||
Cmd{.cmd = "item", .u = "item [Search Criteria]", .fn = FindItem, .a = {"#fi", "#finditem"}},
|
Cmd{.cmd = "item", .u = "item [Search Criteria]", .fn = FindItem, .a = {"#fi", "#finditem"}},
|
||||||
Cmd{.cmd = "language", .u = "language [Search Criteria]", .fn = FindLanguage, .a = {"#findlanguage"}},
|
Cmd{.cmd = "language", .u = "language [Search Criteria]", .fn = FindLanguage, .a = {"#findlanguage"}},
|
||||||
|
|||||||
133
zone/gm_commands/find/emote.cpp
Normal file
133
zone/gm_commands/find/emote.cpp
Normal file
@ -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()
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user