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

@ -2584,7 +2584,7 @@ bool ChatHandler::HandleLookupItemCommand(const char* args)
if(!pProto)
continue;
int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex();
int loc_idx = GetSessionDbLocaleIndex();
if ( loc_idx >= 0 )
{
ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId);
@ -2649,7 +2649,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args)
ItemSetEntry const *set = sItemSetStore.LookupEntry(id);
if(set)
{
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = set->name[loc];
if(name.empty())
continue;
@ -2659,7 +2659,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char* args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(m_session && loc==m_session->GetSessionDbcLocale())
if(loc==GetSessionDbcLocale())
continue;
name = set->name[loc];
@ -2712,7 +2712,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args)
SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id);
if(skillInfo)
{
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = skillInfo->name[loc];
if(name.empty())
continue;
@ -2722,7 +2722,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char* args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(m_session && loc==m_session->GetSessionDbcLocale())
if(loc==GetSessionDbcLocale())
continue;
name = skillInfo->name[loc];
@ -2790,7 +2790,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
if(spellInfo)
{
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = spellInfo->SpellName[loc];
if(name.empty())
continue;
@ -2800,7 +2800,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char* args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(m_session && loc==m_session->GetSessionDbcLocale())
if(loc==GetSessionDbcLocale())
continue;
name = spellInfo->SpellName[loc];
@ -2889,7 +2889,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args)
{
Quest * qinfo = iter->second;
int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex();
int loc_idx = GetSessionDbLocaleIndex();
if ( loc_idx >= 0 )
{
QuestLocale const *il = objmgr.GetQuestLocale(qinfo->GetQuestId());
@ -2989,7 +2989,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char* args)
if(!cInfo)
continue;
int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex();
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
CreatureLocale const *cl = objmgr.GetCreatureLocale (id);
@ -3054,7 +3054,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char* args)
if(!gInfo)
continue;
int loc_idx = m_session ? m_session->GetSessionDbLocaleIndex() : objmgr.GetDBCLocaleIndex();
int loc_idx = GetSessionDbLocaleIndex();
if ( loc_idx >= 0 )
{
GameObjectLocale const *gl = objmgr.GetGameObjectLocale(id);
@ -3119,7 +3119,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id);
if(nodeEntry)
{
int loc = m_session ? m_session->GetSessionDbcLocale() : sWorld.GetDefaultDbcLocale();
int loc = GetSessionDbcLocale();
std::string name = nodeEntry->name[loc];
if(name.empty())
continue;
@ -3129,7 +3129,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args)
loc = 0;
for(; loc < MAX_LOCALE; ++loc)
{
if(m_session && loc==m_session->GetSessionDbcLocale())
if(loc==GetSessionDbcLocale())
continue;
name = nodeEntry->name[loc];
@ -4394,7 +4394,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
{
bool talent = GetTalentSpellCost(itr->second->GetId()) > 0;
char const* name = itr->second->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()];
char const* name = itr->second->GetSpellProto()->SpellName[GetSessionDbcLocale()];
if (m_session)
{
@ -4425,7 +4425,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
{
bool talent = GetTalentSpellCost((*itr)->GetId()) > 0;
char const* name = (*itr)->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()];
char const* name = (*itr)->GetSpellProto()->SpellName[GetSessionDbcLocale()];
if (m_session)
{