Changeset 78

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

[svn] * fixed help for subcommands - source mangos
* Renamed accounts column tbc to expansion and it only took a little over 4 hours o.O

Original author: KingPin?
Date: 2008-10-20 12:23:56-05:00

Location:
trunk
Files:
1 added
16 modified

Legend:

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

    r74 r78  
    180180    std::string name; 
    181181    uint8 race_,class_; 
    182     bool pTbc = this->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION) > 0; 
    183182    recv_data >> name; 
    184183 
     
    213212    } 
    214213 
    215     if (!sChrClassesStore.LookupEntry(class_)|| 
    216         !sChrRacesStore.LookupEntry(race_)) 
     214    ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); 
     215    ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); 
     216    if( !classEntry || !raceEntry ) 
    217217    { 
    218218        data << (uint8)CHAR_CREATE_FAILED; 
     
    223223 
    224224    // prevent character creating Expansion race without Expansion account 
    225     if (!pTbc&&(race_>RACE_TROLL)) 
     225    if (raceEntry->addon > Expansion()) 
    226226    { 
    227227        data << (uint8)CHAR_CREATE_EXPANSION; 
    228         sLog.outError("No Expansion Account:[%d] but tried to Create TBC character",GetAccountId()); 
     228        sLog.outError("Not Expansion 1 account:[%d] but tried to Create character with expansion 1 race (%u)",GetAccountId(),race_); 
     229        SendPacket( &data ); 
     230        return; 
     231    } 
     232 
     233    // prevent character creating Expansion class without Expansion account 
     234    // TODO: use possible addon field in ChrClassesEntry in next dbc version 
     235    if (Expansion() < 2 && class_ == CLASS_DEATH_KNIGHT) 
     236    { 
     237        data << (uint8)CHAR_CREATE_EXPANSION; 
     238        sLog.outError("Not Expansion 2 account:[%d] but tried to Create character with expansion 2 class (%u)",GetAccountId(),class_); 
    229239        SendPacket( &data ); 
    230240        return; 
  • trunk/src/game/Chat.cpp

    r62 r78  
    627627    for(uint32 i = 0; table[i].Name != NULL; i++) 
    628628    { 
    629         if( !hasStringAbbr(table[i].Name, cmd.c_str()) ) 
     629        if( *subcmd && !hasStringAbbr(table[i].Name, subcmd)) 
    630630            continue; 
    631631 
  • trunk/src/game/Map.cpp

    r61 r78  
    1919 */ 
    2020 
     21#include "MapManager.h" 
    2122#include "Player.h" 
    2223#include "GridNotifiers.h" 
     
    3637#include "Group.h" 
    3738 
    38 #include "MapManager.h" 
    3939#include "MapInstanced.h" 
    4040#include "InstanceSaveMgr.h" 
  • trunk/src/game/ObjectMgr.cpp

    r44 r78  
    23702370            // skip expansion races if not playing with expansion 
    23712371            if (sWorld.getConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI)) 
     2372                continue; 
     2373                 
     2374            // skip expansion classes if not playing with expansion 
     2375            if (sWorld.getConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT) 
    23722376                continue; 
    23732377 
  • trunk/src/game/Player.cpp

    r76 r78  
    15161516        return false; 
    15171517 
    1518     bool tbc = GetSession()->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION) > 0; 
    1519  
    1520     // normal client and TBC map 
    1521     if(!tbc && mEntry->IsExpansionMap()) 
    1522     { 
    1523         sLog.outDebug("Player %s using Normal client and tried teleport to non existing map %u", GetName(), mapid); 
     1518    // client without expansion support 
     1519    if(GetSession()->Expansion() < mEntry->Expansion()) 
     1520    { 
     1521        sLog.outDebug("Player %s using client without required expansion tried teleport to non accessable map %u", GetName(), mapid); 
    15241522 
    15251523        if(GetTransport()) 
     
    15301528        return false;                                       // normal client can't teleport to this map... 
    15311529    } 
    1532     else if(tbc)                                            // can teleport to any existing map 
    1533     { 
    1534         sLog.outDebug("Player %s have TBC client and will teleported to map %u", GetName(), mapid); 
    1535     } 
    15361530    else 
    15371531    { 
    1538         sLog.outDebug("Player %s have normal client and will teleported to standard map %u", GetName(), mapid); 
    1539     } 
    1540     /* 
    1541     only TBC (no 0x80000 and 0x10 flags...) 
    1542     3604590=0x37006E=0x200000 + 0x100000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x8 + 0x4 + 0x2 
    1543  
    1544     Kharazan (normal/TBC??), but not have 0x10 flag (accessible by normal client?) 
    1545     4128878=0x3F006E=0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x8 + 0x4 + 0x2 
    1546  
    1547     normal+TBC maps 
    1548     4128894=0x3F007E=0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x10 + 0x8 + 0x4 + 0x2 
    1549  
    1550     normal+TBC maps 
    1551     8323198=0x7F007E=0x400000 + 0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x10 + 0x8 + 0x4 + 0x2 
    1552     */ 
     1532        sLog.outDebug("Player %s will teleported to map %u", GetName(), mapid); 
     1533    } 
    15531534 
    15541535    // if we were on a transport, leave 
  • trunk/src/game/SharedDefines.h

    r53 r78  
    6767    CLASS_ROGUE         = 4, 
    6868    CLASS_PRIEST        = 5, 
    69     // CLASS_UNK1       = 6, DK 
     69    CLASS_DEATH_KNIGHT  = 6, 
    7070    CLASS_SHAMAN        = 7, 
    7171    CLASS_MAGE          = 8, 
     
    962962    GAMEOBJECT_TYPE_AURA_GENERATOR         = 30, 
    963963    GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY     = 31, 
    964     GAMEOBJECT_TYPE_DO_NOT_USE_YET         = 32, 
     964    GAMEOBJECT_TYPE_BARBER_CHAIR           = 32, 
    965965    GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING  = 33, 
    966966    GAMEOBJECT_TYPE_GUILD_BANK             = 34, 
     
    15501550{ 
    15511551    CREATURE_TYPE_BEAST            = 1, 
    1552     CREATURE_TYPE_DRAGON           = 2, 
     1552    CREATURE_TYPE_DRAGONKIN        = 2, 
    15531553    CREATURE_TYPE_DEMON            = 3, 
    15541554    CREATURE_TYPE_ELEMENTAL        = 4, 
     
    15581558    CREATURE_TYPE_CRITTER          = 8, 
    15591559    CREATURE_TYPE_MECHANICAL       = 9, 
    1560     CREATURE_TYPE_NOTSPECIFIED     = 10, 
     1560    CREATURE_TYPE_NOT_SPECIFIED    = 10, 
    15611561    CREATURE_TYPE_TOTEM            = 11, 
    15621562    CREATURE_TYPE_NON_COMBAT_PET   = 12, 
  • trunk/src/game/WorldSession.cpp

    r73 r78  
    4545 
    4646/// WorldSession constructor 
    47 WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale) : 
     47WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : 
    4848LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), 
    49 _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_isTBC(tbc), 
     49_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), 
    5050m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), 
    5151_logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0) 
  • trunk/src/game/WorldSession.h

    r44 r78  
    7272    friend class CharacterHandler; 
    7373    public: 
    74         WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale); 
     74        WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale); 
    7575        ~WorldSession(); 
    7676 
     
    8989        uint32 GetSecurity() const { return _security; } 
    9090        uint32 GetAccountId() const { return _accountId; } 
     91        //std::string const& GetRemoteAddress() const { return m_remoteaddress; } 
    9192        Player* GetPlayer() const { return _player; } 
    9293        char const* GetPlayerName() const; 
     
    9495        std::string& GetRemoteAddress() { return m_Address; } 
    9596        void SetPlayer(Player *plr) { _player = plr; } 
    96         bool IsTBC() const { return m_isTBC; } 
     97        uint8 Expansion() const { return m_expansion; } 
    9798 
    9899        /// Is the user engaged in a log out process? 
     
    630631        uint32 _security; 
    631632        uint32 _accountId; 
    632         bool m_isTBC; 
     633        uint8 m_expansion; 
    633634 
    634635        time_t _logoutTime; 
  • trunk/src/game/WorldSocket.cpp

    r44 r78  
    679679  uint32 BuiltNumberClient; 
    680680  uint32 id, security; 
    681   bool tbc = false; 
     681  uint8 expansion = 0; 
    682682  LocaleConstant locale; 
    683683  std::string account; 
     
    729729                                "v, " //6 
    730730                                "s, " //7 
    731                                 "tbc, " //8 
     731                                "expansion, " //8 
    732732                                "mutetime, " //9 
    733733                                "locale " //10 
     
    750750  Field* fields = result->Fetch (); 
    751751 
    752   tbc = fields[8].GetUInt8 () && sWorld.getConfig (CONFIG_EXPANSION) > 0; 
     752    uint8 expansion = fields[8].GetUInt8(); 
     753    uint32 world_expansion = sWorld.getConfig(CONFIG_EXPANSION); 
     754    if(expansion > world_expansion) 
     755        expansion = world_expansion; 
    753756 
    754757  N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); 
     
    910913  // TODO protect here probably ? 
    911914  // Althought atm the socket is singlethreaded 
    912   ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, tbc, mutetime, locale), -1); 
     915  ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, expansion, mutetime, locale), -1); 
    913916 
    914917  m_Crypt.SetKey (&K); 
  • trunk/src/shared/ByteBuffer.h

    r44 r78  
    202202        } 
    203203 
    204         uint8 operator[](size_t pos) 
     204        uint8 operator[](size_t pos) const 
    205205        { 
    206206            return read<uint8>(pos); 
     
    310310            memcpy(&_storage[pos], src, cnt); 
    311311        } 
    312         void print_storage() 
     312        void print_storage() const 
    313313        { 
    314314            if(!sLog.IsOutDebug())                          // optimize disabled debug output 
     
    321321        } 
    322322 
    323         void textlike() 
     323        void textlike() const 
    324324        { 
    325325            if(!sLog.IsOutDebug())                          // optimize disabled debug output 
     
    332332        } 
    333333 
    334         void hexlike() 
     334        void hexlike() const 
    335335        { 
    336336            if(!sLog.IsOutDebug())                          // optimize disabled debug output 
  • trunk/src/shared/Database/DBCStores.cpp

    r44 r78  
    555555 
    556556    MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); 
    557     return (!mapEntry || !mapEntry->IsExpansionMap()) ? CONTENT_1_60 : CONTENT_61_70; 
     557    if(!mapEntry) 
     558        return CONTENT_1_60; 
     559 
     560    switch(mapEntry->Expansion()) 
     561    { 
     562        default: return CONTENT_1_60; 
     563        case 1:  return CONTENT_61_70; 
     564        case 2:  return CONTENT_71_80; 
     565    } 
    558566} 
    559567 
  • trunk/src/shared/Database/DBCStores.h

    r44 r78  
    4545{ 
    4646    CONTENT_1_60 = 0, 
    47     CONTENT_61_70 
     47    CONTENT_61_70, 
     48    CONTENT_71_80 
    4849}; 
    4950ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); 
  • trunk/src/shared/Database/DBCStructure.h

    r44 r78  
    180180                                                            // 64 string flags, unused 
    181181                                                            // 65-67 unused 
    182     //uint32    addon                                       // 68 (0 - original race, 1 - tbc addon, ...) unused 
     182    uint32    addon;                                         // 68 (0 - original race, 1 - tbc addon, ...) 
    183183}; 
    184184 
     
    474474 
    475475    // Helpers 
    476     bool IsExpansionMap() const { return addon != 0; } 
     476    uint32 Expansion() const { return addon; } 
    477477 
    478478 
  • trunk/src/shared/Database/DBCfmt.cpp

    r44 r78  
    2828//const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; 
    2929const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; 
    30 const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; 
     30const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; 
    3131const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxx"; 
    3232const char CreatureFamilyfmt[]="nfifiiiissssssssssssssssxx"; 
  • trunk/src/trinitycore/CliRunnable.cpp

    r44 r78  
    6868void CliSetLogLevel(char*,pPrintf); 
    6969void CliUpTime(char*,pPrintf); 
    70 void CliSetTBC(char*,pPrintf); 
     70void CliSetAddon(char*,pPrintf); 
    7171void CliWritePlayerDump(char*,pPrintf); 
    7272void CliLoadPlayerDump(char*,pPrintf); 
     
    9292    {"setgm", & CliSetGM,"Edit user privileges"}, 
    9393    {"setpass", & CliSetPassword,"Set password for account"}, 
    94     {"setbc", & CliSetTBC,"Set user expansion allowed"}, 
     94    {"setaddon", & CliSetAddon,"Set user expansion addon level allowed"}, 
    9595    {"listgm", & CliListGM,"Display user privileges"}, 
    9696    {"loadscripts", & CliLoadScripts,"Load script library"}, 
     
    473473    ///- Display the list of account/characters online 
    474474    zprintf("=====================================================================\r\n"); 
    475     zprintf("|    Account    |       Character      |       IP        | GM | TBC |\r\n"); 
     475    zprintf("|    Account    |       Character      |       IP        | GM | Exp |\r\n"); 
    476476    zprintf("=====================================================================\r\n"); 
    477477 
     
    486486        // No SQL injection. account is uint32. 
    487487        //                                                      0         1        2        3 
    488         QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, tbc FROM account WHERE id = '%u'",account); 
     488        QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, expansion FROM account WHERE id = '%u'",account); 
    489489 
    490490        if(resultLogin) 
     
    10381038 
    10391039/// Set/Unset the TBC flag for an account 
    1040 void CliSetTBC(char *command,pPrintf zprintf) 
     1040void CliSetAddon(char *command,pPrintf zprintf) 
    10411041{ 
    10421042    ///- Get the command line arguments 
    10431043    char *szAcc = strtok(command," "); 
    1044     char *szTBC =  strtok(NULL," "); 
    1045  
    1046     if(!szAcc||!szTBC) 
    1047     { 
    1048         zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc)>\r\n"); 
    1049         return; 
    1050     } 
    1051  
    1052     int lev=atoi(szTBC);                                    //get int anyway (0 if error) 
    1053  
    1054     if((lev > 1)|| (lev < 0)) 
    1055     { 
    1056         zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc)>\r\n"); 
     1044    char *szExp =  strtok(NULL," "); 
     1045 
     1046    if(!szAcc||!szExp) 
     1047    { 
     1048        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc, 2 - wotlk)>\r\n"); 
     1049        return; 
     1050    } 
     1051 
     1052    int lev=atoi(szExp);                                    //get int anyway (0 if error) 
     1053 
     1054    if(lev < 0) 
     1055    { 
     1056        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc, 2 - wotlk)>\r\n"); 
    10571057        return; 
    10581058    } 
     
    10751075    { 
    10761076        // No SQL injection (account name is escaped) 
    1077         loginDatabase.PExecute("UPDATE account SET tbc = '%d' WHERE username = '%s'",lev,safe_account_name.c_str()); 
     1077        loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE username = '%s'",lev,safe_account_name.c_str()); 
    10781078        zprintf("We set %s to expansion allowed %d\r\n",safe_account_name.c_str(),lev); 
    10791079 
  • trunk/src/trinitycore/trinitycore.conf.dist

    r62 r78  
    355355# 
    356356#    Expansion 
    357 #        Allow server use expansion content 
    358 #        Default: 1 - check expansion maps existence, and if client support expansion and account have  
    359 #                     expansion setting then allow visit expansion maps, allow create new races character) 
    360 #                 0 - not check expansion maps existence, not allow wisit its, not allow create new race  
     357#        Allow server use content from expansion  
     358#                 2 - check expansion 2 maps existence, and if client support expansion 2 and account have  
     359#                     expansion 2 setting then allow visit expansion 2 maps, allow create new class character) 
     360#        Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have  
     361#                     expansion 1 setting then allow visit expansion 1 maps, allow create new races character) 
     362#                 0 - not check expansion maps existence, not allow wisit its, not allow create new race or new class 
    361363#                     characters, ignore account expansion setting) 
    362364#