bool ChatHandler::HandleLookupItemCommand(const char* args) { if(!*args) return false; std::string namepart = args; // Search in `item_template` for (uint32 id = 0; id < sItemStorage.GetNumRows(); id++) { ItemPrototype const *pProto = GetItemPrototype(id)); if(pProto) { std::string Name = pProto->Name1; int loc_idx = GetSessionLocaleIndex(); if ( loc_idx >= 0 ) { ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId); if (il) { if (il->Name.size() > loc_idx && !il->Name[loc_idx].empty()) Name = il->Name[loc_idx]; } } // converting ItemName to lower case std::transform( Name.begin(), Name.end(), Name.begin(), ::tolower ); // converting string that we try to find to lower case std::transform( namepart.begin(), namepart.end(), namepart.begin(), ::tolower ); if (Name.find(namepart) != std::string::npos) { PSendSysMessage(LANG_ITEM_LIST, id,id,Name.c_str()); } } } }