feat(Core/Locale): add support GameLocale

This commit is contained in:
Winfidonarleyan
2021-10-30 01:55:09 +07:00
parent 627be00a2d
commit 72990d60ec

View File

@@ -1,4 +1,5 @@
#include "Transmogrification.h" #include "Transmogrification.h"
#include "GameLocale.h"
Transmogrification* Transmogrification::instance() Transmogrification* Transmogrification::instance()
{ {
@@ -193,8 +194,8 @@ std::string Transmogrification::GetItemLink(Item* item, WorldSession* session) c
int loc_idx = session->GetSessionDbLocaleIndex(); int loc_idx = session->GetSessionDbLocaleIndex();
const ItemTemplate* temp = item->GetTemplate(); const ItemTemplate* temp = item->GetTemplate();
std::string name = temp->Name1; std::string name = temp->Name1;
if (ItemLocale const* il = sObjectMgr->GetItemLocale(temp->ItemId)) if (ItemLocale const* il = sGameLocale->GetItemLocale(temp->ItemId))
ObjectMgr::GetLocaleString(il->Name, loc_idx, name); GameLocale::GetLocaleString(il->Name, loc_idx, name);
if (int32 itemRandPropId = item->GetItemRandomPropertyId()) if (int32 itemRandPropId = item->GetItemRandomPropertyId())
{ {
@@ -238,17 +239,7 @@ std::string Transmogrification::GetItemLink(uint32 entry, WorldSession* session)
{ {
LOG_DEBUG("modules", "Transmogrification::GetItemLink"); LOG_DEBUG("modules", "Transmogrification::GetItemLink");
const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry); return sGameLocale->GetItemLink(entry, session->GetSessionDbLocaleIndex());
int loc_idx = session->GetSessionDbLocaleIndex();
std::string name = temp->Name1;
if (ItemLocale const* il = sObjectMgr->GetItemLocale(entry))
ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
std::ostringstream oss;
oss << "|c" << std::hex << ItemQualityColors[temp->Quality] << std::dec <<
"|Hitem:" << entry << ":0:0:0:0:0:0:0:0:0|h[" << name << "]|h|r";
return oss.str();
} }
uint32 Transmogrification::GetFakeEntry(ObjectGuid itemGUID) const uint32 Transmogrification::GetFakeEntry(ObjectGuid itemGUID) const