Core/Item: Localization items. (#223)

This commit is contained in:
HeartWell
2016-11-04 23:03:48 +03:00
committed by Shin
parent b9aa88ac2b
commit 8088ca220a
6 changed files with 38359 additions and 19 deletions

View File

@@ -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;