mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-01 07:12:26 +00:00
Added 'exact match' option to command npceditmass search criteria
This commit is contained in:
parent
e46fcdd48a
commit
9ced3270a0
@ -7712,6 +7712,11 @@ void command_npcemote(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
void command_npceditmass(Client *c, const Seperator *sep)
|
void command_npceditmass(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
|
if (strcasecmp(sep->arg[1], "usage") == 0) {
|
||||||
|
c->Message(Chat::White, "#npceditmass search_column [exact_match: =]search_value change_column change_value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string query = SQL(
|
std::string query = SQL(
|
||||||
SELECT
|
SELECT
|
||||||
COLUMN_NAME
|
COLUMN_NAME
|
||||||
@ -7807,6 +7812,12 @@ void command_npceditmass(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
std::vector <std::string> npc_ids;
|
std::vector <std::string> npc_ids;
|
||||||
|
|
||||||
|
bool exact_match = false;
|
||||||
|
if (search_value[0] == '=') {
|
||||||
|
exact_match = true;
|
||||||
|
search_value = search_value.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
int found_count = 0;
|
int found_count = 0;
|
||||||
results = database.QueryDatabase(query);
|
results = database.QueryDatabase(query);
|
||||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||||
@ -7816,8 +7827,15 @@ void command_npceditmass(Client *c, const Seperator *sep)
|
|||||||
std::string search_column_value = str_tolower(row[2]);
|
std::string search_column_value = str_tolower(row[2]);
|
||||||
std::string change_column_current_value = row[3];
|
std::string change_column_current_value = row[3];
|
||||||
|
|
||||||
if (search_column_value.find(search_value) == std::string::npos) {
|
if (exact_match) {
|
||||||
continue;
|
if (search_column_value.compare(search_value) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (search_column_value.find(search_value) == std::string::npos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c->Message(
|
c->Message(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user