diff options
author | Shauren <shauren.trinity@gmail.com> | 2014-12-21 13:35:43 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2014-12-21 13:35:43 +0100 |
commit | 6dbb516b651d5d4b1988c7f450b25136b9d28a2e (patch) | |
tree | c93bee9c6b5bea94ea403b29089704c308b878f8 /src/server/game/Chat/ChatLink.cpp | |
parent | 77dc1b00dbf9baedf1785232c83d31e77d7936b3 (diff) |
Core/Items: Refactored ItemTemplate
Diffstat (limited to 'src/server/game/Chat/ChatLink.cpp')
-rw-r--r-- | src/server/game/Chat/ChatLink.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index eb99a19cf78..ed8c2598832 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -121,9 +121,9 @@ bool ItemChatLink::Initialize(std::istringstream& iss) return false; } // Validate item's color - if (_color != ItemQualityColors[_item->Quality]) + if (_color != ItemQualityColors[_item->GetQuality()]) { - TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->GetQuality()], _color); return false; } // Number of various item properties after item entry @@ -167,13 +167,11 @@ bool ItemChatLink::Initialize(std::istringstream& iss) return true; } -inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* suffixStrings) const +inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* /*locale*/, char* suffixStrings) const { std::stringstream ss; - if (locale == NULL || index >= locale->Name.size()) - ss << _item->Name1; - else - ss << locale->Name[index]; + ss << _item->GetName(LocaleConstant(index)); + if (suffixStrings) ss << ' ' << suffixStrings[index]; return ss.str(); @@ -188,7 +186,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer); if (!res) { - ItemLocale const* il = sObjectMgr->GetItemLocale(_item->ItemId); + ItemLocale const* il = sObjectMgr->GetItemLocale(_item->GetId()); for (uint8 index = LOCALE_koKR; index < TOTAL_LOCALES; ++index) { if (FormatName(index, il, suffixStrings) == buffer) @@ -199,7 +197,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) } } if (!res) - TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId); + TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->GetId()); return res; } |