bool ChatHandler::HandleLookupItemCommand(const char* args) { if(!*args) return false; std::string namepart = args; uint32 counter = 0; // converting string that we try to find to lower case std::transform( namepart.begin(), namepart.end(), namepart.begin(), ::tolower ); // Search in `item_template` for (uint32 id = 0; id < sItemStorage.MaxEntry; id++) { ItemPrototype const *pProto = sItemStorage.LookupEntry(id); if(!pProto) continue; std::string Name = pProto->Name1; int loc_idx = m_session->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 Name to lower case std::transform( Name.begin(), Name.end(), Name.begin(), ::tolower ); if (Name.find(namepart) != std::string::npos) { PSendSysMessage(LANG_ITEM_LIST, id, id, il->Name[loc_idx].c_str()); counter++; continue; } } } } Name = pProto->Name1; // converting Name to lower case std::transform( Name.begin(), Name.end(), Name.begin(), ::tolower ); if (Name.find(namepart) != std::string::npos) { PSendSysMessage(LANG_ITEM_LIST, id, id, pProto->Name1); counter++; } } if (counter==0) SendSysMessage(LANG_COMMAND_NOITEMFOUND); return true; }