diff options
author | HeartWell <heartwell@list.ru> | 2016-11-04 23:03:48 +0300 |
---|---|---|
committer | Shin <borzifrancesco@gmail.com> | 2016-11-04 21:03:48 +0100 |
commit | 8088ca220a0766f39811ad7b7bb3354f01799edb (patch) | |
tree | 2880e7d4e783927e5f4d1a321eef0e4c4a7ad7aa /src/scripts/Commands/cs_lookup.cpp | |
parent | b9aa88ac2b0ceaf315373aff17db2e0d4c42b326 (diff) |
Core/Item: Localization items. (#223)
Diffstat (limited to 'src/scripts/Commands/cs_lookup.cpp')
-rw-r--r-- | src/scripts/Commands/cs_lookup.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/scripts/Commands/cs_lookup.cpp b/src/scripts/Commands/cs_lookup.cpp index ad2e62dbbf..c8f72068d1 100644 --- a/src/scripts/Commands/cs_lookup.cpp +++ b/src/scripts/Commands/cs_lookup.cpp @@ -372,6 +372,38 @@ public: ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore(); for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr) { + int localeIndex = handler->GetSessionDbLocaleIndex(); + if (localeIndex >= 0) + { + uint8 ulocaleIndex = uint8(localeIndex); + if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId)) + { + if (il->Name.size() > ulocaleIndex && !il->Name[ulocaleIndex].empty()) + { + std::string name = il->Name[ulocaleIndex]; + + if (Utf8FitTo(name, wNamePart)) + { + if (maxResults && count++ == maxResults) + { + handler->PSendSysMessage(LANG_COMMAND_LOOKUP_MAX_RESULTS, maxResults); + return true; + } + + if (handler->GetSession()) + handler->PSendSysMessage(LANG_ITEM_LIST_CHAT, itr->second.ItemId, itr->second.ItemId, name.c_str()); + else + handler->PSendSysMessage(LANG_ITEM_LIST_CONSOLE, itr->second.ItemId, name.c_str()); + + if (!found) + found = true; + + continue; + } + } + } + } + std::string name = itr->second.Name1; if (name.empty()) continue; |