Update lookup command (#909)

* Update lookup command

* Fix bugs

Update SlashCommandHandler.cpp
This commit is contained in:
David Markowitz 2023-01-06 22:17:09 -08:00 committed by GitHub
parent a28a2e60cf
commit a580e3a2f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -1198,11 +1198,17 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
EntityManager::Instance()->SerializeEntity(entity);
}
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER && args.size() == 1) {
if (chatCommand == "lookup" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
auto query = CDClientDatabase::CreatePreppedStmt(
"SELECT `id`, `name` FROM `Objects` WHERE `displayName` LIKE ?1 OR `name` LIKE ?1 OR `description` LIKE ?1 LIMIT 50");
// Concatenate all of the arguments into a single query so a multi word query can be used properly.
std::string conditional = args[0];
args.erase(args.begin());
for (auto& argument : args) {
conditional += ' ' + argument;
}
const std::string query_text = "%" + args[0] + "%";
const std::string query_text = "%" + conditional + "%";
query.bind(1, query_text.c_str());
auto tables = query.execQuery();

View File

@ -78,7 +78,7 @@ These commands are primarily for development and testing. The usage of many of t
|inspect|`/inspect <component> (-m <waypoint> \| -a <animation> \| -s \| -p \| -f (faction) \| -t)`|Finds the closest entity with the given component or LDF variable (ignoring players and racing cars), printing its ID, distance from the player, and whether it is sleeping, as well as the the IDs of all components the entity has. See [Detailed `/inspect` Usage](#detailed-inspect-usage) below.|8|
|list-spawns|`/list-spawns`|Lists all the character spawn points in the zone. Additionally, this command will display the current scene that plays when the character lands in the next zone, if there is one.|8|
|locrow|`/locrow`|Prints the your current position and rotation information to the console.|8|
|lookup|`/lookup <query>`|Searches through the Objects table in the client SQLite database for items whose display name, name, or description contains the query.|8|
|lookup|`/lookup <query>`|Searches through the Objects table in the client SQLite database for items whose display name, name, or description contains the query. Query can be multiple words delimited by spaces.|8|
|playanimation|`/playanimation <id>`|Plays animation with given ID. Alias: `/playanim`.|8|
|playeffect|`/playeffect <effect id> <effect type> <effect name>`|Plays an effect.|8|
|playlvlfx|`/playlvlfx`|Plays the level up animation on your character.|8|