From 72990d60ecb68cf58765d097ab5ca3b5e776bed0 Mon Sep 17 00:00:00 2001 From: Winfidonarleyan Date: Sat, 30 Oct 2021 01:55:09 +0700 Subject: [PATCH] feat(Core/Locale): add support GameLocale --- src/Transmogrification.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Transmogrification.cpp b/src/Transmogrification.cpp index 3bd2efb..85a6e10 100644 --- a/src/Transmogrification.cpp +++ b/src/Transmogrification.cpp @@ -1,4 +1,5 @@ #include "Transmogrification.h" +#include "GameLocale.h" Transmogrification* Transmogrification::instance() { @@ -193,8 +194,8 @@ std::string Transmogrification::GetItemLink(Item* item, WorldSession* session) c int loc_idx = session->GetSessionDbLocaleIndex(); const ItemTemplate* temp = item->GetTemplate(); std::string name = temp->Name1; - if (ItemLocale const* il = sObjectMgr->GetItemLocale(temp->ItemId)) - ObjectMgr::GetLocaleString(il->Name, loc_idx, name); + if (ItemLocale const* il = sGameLocale->GetItemLocale(temp->ItemId)) + GameLocale::GetLocaleString(il->Name, loc_idx, name); if (int32 itemRandPropId = item->GetItemRandomPropertyId()) { @@ -238,17 +239,7 @@ std::string Transmogrification::GetItemLink(uint32 entry, WorldSession* session) { LOG_DEBUG("modules", "Transmogrification::GetItemLink"); - const ItemTemplate* temp = sObjectMgr->GetItemTemplate(entry); - 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(); + return sGameLocale->GetItemLink(entry, session->GetSessionDbLocaleIndex()); } uint32 Transmogrification::GetFakeEntry(ObjectGuid itemGUID) const