mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[sql/updates/2008_10_22_02_mangos_mangos_string.sql] Allow use in console .event/.reload/.lookup/.list (some)/.guild (some) subcommands.
This commit is contained in:
parent
4e889c1b41
commit
b10349a737
10 changed files with 484 additions and 364 deletions
|
|
@ -1644,62 +1644,67 @@ bool ChatHandler::HandleTeleCommand(const char * args)
|
|||
|
||||
bool ChatHandler::HandleLookupAreaCommand(const char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if(!Utf8toWStr(namepart,wnamepart))
|
||||
if (!Utf8toWStr (namepart,wnamepart))
|
||||
return false;
|
||||
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
wstrToLower( wnamepart );
|
||||
wstrToLower (wnamepart);
|
||||
|
||||
// Search in AreaTable.dbc
|
||||
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
|
||||
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag)
|
||||
{
|
||||
AreaTableEntry const *areaEntry = sAreaStore.LookupEntry(areaflag);
|
||||
if(areaEntry)
|
||||
AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag);
|
||||
if (areaEntry)
|
||||
{
|
||||
int loc = m_session->GetSessionDbcLocale();
|
||||
int loc = m_session ? m_session->GetSessionDbcLocale () : sWorld.GetDefaultDbcLocale();
|
||||
std::string name = areaEntry->area_name[loc];
|
||||
if(name.empty())
|
||||
if (name.empty())
|
||||
continue;
|
||||
|
||||
if(!Utf8FitTo(name, wnamepart))
|
||||
if (!Utf8FitTo (name, wnamepart))
|
||||
{
|
||||
loc = 0;
|
||||
for(; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if(loc==m_session->GetSessionDbcLocale())
|
||||
if (m_session && loc==m_session->GetSessionDbcLocale ())
|
||||
continue;
|
||||
|
||||
name = areaEntry->area_name[loc];
|
||||
if(name.empty())
|
||||
if (name.empty ())
|
||||
continue;
|
||||
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
if (Utf8FitTo (name, wnamepart))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(loc < MAX_LOCALE)
|
||||
if (loc < MAX_LOCALE)
|
||||
{
|
||||
// send area in "id - [name]" format
|
||||
std::ostringstream ss;
|
||||
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r";
|
||||
if (m_session)
|
||||
ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r";
|
||||
else
|
||||
ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
|
||||
|
||||
SendSysMessage(ss.str().c_str());
|
||||
SendSysMessage (ss.str ().c_str());
|
||||
|
||||
++counter;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage(LANG_COMMAND_NOAREAFOUND);
|
||||
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage (LANG_COMMAND_NOAREAFOUND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1712,6 +1717,7 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char const* str = strtok((char*)args, " ");
|
||||
if(!str)
|
||||
return false;
|
||||
|
|
@ -1725,9 +1731,9 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||
// converting string that we try to find to lower case
|
||||
wstrToLower( wnamepart );
|
||||
|
||||
GameTeleMap const & teleMap = objmgr.GetGameTeleMap();
|
||||
|
||||
std::ostringstream reply;
|
||||
|
||||
GameTeleMap const & teleMap = objmgr.GetGameTeleMap();
|
||||
for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||
{
|
||||
GameTele const* tele = &itr->second;
|
||||
|
|
@ -1735,11 +1741,10 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
|||
if(tele->wnameLow.find(wnamepart) == std::wstring::npos)
|
||||
continue;
|
||||
|
||||
reply << " |cffffffff|Htele:";
|
||||
reply << itr->first;
|
||||
reply << "|h[";
|
||||
reply << tele->name;
|
||||
reply << "]|h|r\n";
|
||||
if (m_session)
|
||||
reply << " |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n";
|
||||
else
|
||||
reply << " " << itr->first << " " << tele->name << "\n";
|
||||
}
|
||||
|
||||
if(reply.str().empty())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue