Show
Ignore:
Timestamp:
11/19/08 13:37:14 (17 years ago)
Author:
yumileroy
Message:

[svn] * Merge CLI Commands with regular commands and give them level4 access. sec_console. Source mangos - thanks to ogeraisi for the amalgamated patch.
* Redid/Fixed/Added some lang strings.
* As usual remember this is a trunk rev so stability only guaranteed on northern countries of Mars and western parts of Pluto. No warranties outside the solar system, sorry :( . Check with your local government or dictator on regulations regarding export.

Original author: KingPin?
Date: 2008-10-26 13:32:42-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Level1.cpp

    r102 r112  
    16931693bool ChatHandler::HandleLookupAreaCommand(const char* args) 
    16941694{ 
    1695     if(!*args) 
     1695    if (!*args) 
    16961696        return false; 
    16971697 
     
    16991699    std::wstring wnamepart; 
    17001700 
    1701     if(!Utf8toWStr(namepart,wnamepart)) 
     1701    if (!Utf8toWStr (namepart,wnamepart)) 
    17021702        return false; 
    17031703 
     
    17051705 
    17061706    // converting string that we try to find to lower case 
    1707     wstrToLower( wnamepart ); 
     1707    wstrToLower (wnamepart); 
    17081708 
    17091709    // Search in AreaTable.dbc 
    1710     for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag) 
    1711     { 
    1712         AreaTableEntry const *areaEntry = sAreaStore.LookupEntry(areaflag); 
    1713         if(areaEntry) 
    1714         { 
    1715             int loc = m_session->GetSessionDbcLocale(); 
     1710    for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) 
     1711    { 
     1712        AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag); 
     1713        if (areaEntry) 
     1714        { 
     1715            int loc = m_session ? m_session->GetSessionDbcLocale () : sWorld.GetDefaultDbcLocale(); 
    17161716            std::string name = areaEntry->area_name[loc]; 
    1717             if(name.empty()) 
     1717            if (name.empty()) 
    17181718                continue; 
    17191719 
    1720             if(!Utf8FitTo(name, wnamepart)) 
     1720            if (!Utf8FitTo (name, wnamepart)) 
    17211721            { 
    17221722                loc = 0; 
    17231723                for(; loc < MAX_LOCALE; ++loc) 
    17241724                { 
    1725                     if(loc==m_session->GetSessionDbcLocale()) 
     1725                    if (m_session && loc==m_session->GetSessionDbcLocale ()) 
    17261726                        continue; 
    17271727 
    17281728                    name = areaEntry->area_name[loc]; 
    1729                     if(name.empty()) 
     1729                    if (name.empty ()) 
    17301730                        continue; 
    17311731 
    1732                     if (Utf8FitTo(name, wnamepart)) 
     1732                    if (Utf8FitTo (name, wnamepart)) 
    17331733                        break; 
    17341734                } 
    17351735            } 
    17361736 
    1737             if(loc < MAX_LOCALE) 
     1737            if (loc < MAX_LOCALE) 
    17381738            { 
    17391739                // send area in "id - [name]" format 
    17401740                std::ostringstream ss; 
    1741                 ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; 
    1742  
    1743                 SendSysMessage(ss.str().c_str()); 
     1741                if (m_session) 
     1742                                        ss << areaEntry->ID << " - |cffffffff|Harea:" << areaEntry->ID << "|h[" << name << " " << localeNames[loc]<< "]|h|r"; 
     1743                                else 
     1744                                        ss << areaEntry->ID << " - " << name << " " << localeNames[loc]; 
     1745 
     1746                SendSysMessage (ss.str ().c_str()); 
    17441747 
    17451748                ++counter; 
     
    17471750        } 
    17481751    } 
    1749     if (counter == 0)                                       // if counter == 0 then we found nth 
    1750         SendSysMessage(LANG_COMMAND_NOAREAFOUND); 
     1752    if (counter == 0)                                      // if counter == 0 then we found nth 
     1753        SendSysMessage (LANG_COMMAND_NOAREAFOUND); 
    17511754    return true; 
    17521755} 
     
    17611764        return false; 
    17621765    } 
     1766 
    17631767    char const* str = strtok((char*)args, " "); 
    17641768    if(!str) 
     
    17741778    wstrToLower( wnamepart ); 
    17751779 
    1776     GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); 
    1777  
    17781780    std::ostringstream reply; 
     1781 
     1782        GameTeleMap const & teleMap = objmgr.GetGameTeleMap(); 
    17791783    for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr) 
    17801784    { 
     
    17841788            continue; 
    17851789 
    1786         reply << "  |cffffffff|Htele:"; 
    1787         reply << itr->first; 
    1788         reply << "|h["; 
    1789         reply << tele->name; 
    1790         reply << "]|h|r\n"; 
     1790        if (m_session) 
     1791                        reply << "  |cffffffff|Htele:" << itr->first << "|h[" << tele->name << "]|h|r\n"; 
     1792                else 
     1793                        reply << "  " << itr->first << " " << tele->name << "\n"; 
    17911794    } 
    17921795 
     
    20732076        PSendSysMessage(LANG_TELEPORTING_TO, chr->GetName(),"", tele->name.c_str()); 
    20742077 
    2075         if (m_session->GetPlayer()->IsVisibleGloballyFor(chr)) 
    2076             ChatHandler(chr).PSendSysMessage(LANG_TELEPORTED_TO_BY, m_session->GetPlayer()->GetName()); 
     2078        if (m_session) 
     2079                { 
     2080                        if(m_session->GetPlayer()->IsVisibleGloballyFor(chr)) 
     2081                                ChatHandler(chr).PSendSysMessage(LANG_TELEPORTED_TO_BY, m_session->GetPlayer()->GetName()); 
     2082                } 
     2083                else 
     2084                        ChatHandler(chr).SendSysMessage(LANG_TELEPORTED_TO_BY_CONSOLE); 
    20772085 
    20782086        // stop flight if need