Provide and use universal way for get locale and locale index for chat/console command use.

This commit is contained in:
VladimirMangos 2009-05-19 00:45:48 +04:00
parent 695d83568a
commit fdbc22ac93
6 changed files with 56 additions and 30 deletions

View file

@ -880,7 +880,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args)
{
FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL;
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = factionEntry->name[loc];
if(name.empty())
continue;
@ -890,7 +890,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char* args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(m_session && loc==m_session->GetSessionDbcLocale())
if(loc==GetSessionDbcLocale())
continue;
name = factionEntry->name[loc];
@ -1035,13 +1035,13 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
if (factionEntry->reputationListID < 0)
{
PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[m_session->GetSessionDbcLocale()], factionId);
PSendSysMessage(LANG_COMMAND_FACTION_NOREP_ERROR, factionEntry->name[GetSessionDbcLocale()], factionId);
SetSentErrorMessage(true);
return false;
}
target->GetReputationMgr().SetReputation(factionEntry,amount);
PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[m_session->GetSessionDbcLocale()], factionId,
PSendSysMessage(LANG_COMMAND_MODIFY_REP, factionEntry->name[GetSessionDbcLocale()], factionId,
GetNameLink(target).c_str(), target->GetReputationMgr().GetReputation(factionEntry));
return true;
}
@ -2211,7 +2211,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
for(FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr)
{
FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->second.ID);
char const* factionName = factionEntry ? factionEntry->name[m_session->GetSessionDbcLocale()] : "#Not found#";
char const* factionName = factionEntry ? factionEntry->name[GetSessionDbcLocale()] : "#Not found#";
ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry);
std::string rankName = GetMangosString(ReputationRankStrIndex[rank]);
std::ostringstream ss;
@ -3976,7 +3976,7 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
skillInfo->categoryId != SKILL_CATEGORY_SECONDARY )
continue;
int loc = m_session->GetSessionDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = skillInfo->name[loc];
if(Utf8FitTo(name, wnamepart))