Index: /trunk/src/shared/ByteBuffer.h
===================================================================
--- /trunk/src/shared/ByteBuffer.h (revision 44)
+++ /trunk/src/shared/ByteBuffer.h (revision 78)
@@ -202,5 +202,5 @@
         }
 
-        uint8 operator[](size_t pos)
+        uint8 operator[](size_t pos) const
         {
             return read<uint8>(pos);
@@ -310,5 +310,5 @@
             memcpy(&_storage[pos], src, cnt);
         }
-        void print_storage()
+        void print_storage() const
         {
             if(!sLog.IsOutDebug())                          // optimize disabled debug output
@@ -321,5 +321,5 @@
         }
 
-        void textlike()
+        void textlike() const
         {
             if(!sLog.IsOutDebug())                          // optimize disabled debug output
@@ -332,5 +332,5 @@
         }
 
-        void hexlike()
+        void hexlike() const
         {
             if(!sLog.IsOutDebug())                          // optimize disabled debug output
Index: /trunk/src/shared/Database/DBCfmt.cpp
===================================================================
--- /trunk/src/shared/Database/DBCfmt.cpp (revision 44)
+++ /trunk/src/shared/Database/DBCfmt.cpp (revision 78)
@@ -28,5 +28,5 @@
 //const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
 const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
-const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
 const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxx";
 const char CreatureFamilyfmt[]="nfifiiiissssssssssssssssxx";
Index: /trunk/src/shared/Database/DBCStores.cpp
===================================================================
--- /trunk/src/shared/Database/DBCStores.cpp (revision 44)
+++ /trunk/src/shared/Database/DBCStores.cpp (revision 78)
@@ -555,5 +555,13 @@
 
     MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
-    return (!mapEntry || !mapEntry->IsExpansionMap()) ? CONTENT_1_60 : CONTENT_61_70;
+    if(!mapEntry)
+        return CONTENT_1_60;
+
+    switch(mapEntry->Expansion())
+    {
+        default: return CONTENT_1_60;
+        case 1:  return CONTENT_61_70;
+        case 2:  return CONTENT_71_80;
+    }
 }
 
Index: /trunk/src/shared/Database/DBCStructure.h
===================================================================
--- /trunk/src/shared/Database/DBCStructure.h (revision 44)
+++ /trunk/src/shared/Database/DBCStructure.h (revision 78)
@@ -180,5 +180,5 @@
                                                             // 64 string flags, unused
                                                             // 65-67 unused
-    //uint32    addon                                       // 68 (0 - original race, 1 - tbc addon, ...) unused
+    uint32    addon;                                         // 68 (0 - original race, 1 - tbc addon, ...)
 };
 
@@ -474,5 +474,5 @@
 
     // Helpers
-    bool IsExpansionMap() const { return addon != 0; }
+    uint32 Expansion() const { return addon; }
 
 
Index: /trunk/src/shared/Database/DBCStores.h
===================================================================
--- /trunk/src/shared/Database/DBCStores.h (revision 44)
+++ /trunk/src/shared/Database/DBCStores.h (revision 78)
@@ -45,5 +45,6 @@
 {
     CONTENT_1_60 = 0,
-    CONTENT_61_70
+    CONTENT_61_70,
+    CONTENT_71_80
 };
 ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
Index: /trunk/src/game/Chat.cpp
===================================================================
--- /trunk/src/game/Chat.cpp (revision 62)
+++ /trunk/src/game/Chat.cpp (revision 78)
@@ -627,5 +627,5 @@
     for(uint32 i = 0; table[i].Name != NULL; i++)
     {
-        if( !hasStringAbbr(table[i].Name, cmd.c_str()) )
+        if( *subcmd && !hasStringAbbr(table[i].Name, subcmd))
             continue;
 
Index: /trunk/src/game/WorldSocket.cpp
===================================================================
--- /trunk/src/game/WorldSocket.cpp (revision 44)
+++ /trunk/src/game/WorldSocket.cpp (revision 78)
@@ -679,5 +679,5 @@
   uint32 BuiltNumberClient;
   uint32 id, security;
-  bool tbc = false;
+  uint8 expansion = 0;
   LocaleConstant locale;
   std::string account;
@@ -729,5 +729,5 @@
                                 "v, " //6
                                 "s, " //7
-                                "tbc, " //8
+                                "expansion, " //8
                                 "mutetime, " //9
                                 "locale " //10
@@ -750,5 +750,8 @@
   Field* fields = result->Fetch ();
 
-  tbc = fields[8].GetUInt8 () && sWorld.getConfig (CONFIG_EXPANSION) > 0;
+    uint8 expansion = fields[8].GetUInt8();
+    uint32 world_expansion = sWorld.getConfig(CONFIG_EXPANSION);
+    if(expansion > world_expansion)
+        expansion = world_expansion;
 
   N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
@@ -910,5 +913,5 @@
   // TODO protect here probably ?
   // Althought atm the socket is singlethreaded
-  ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, tbc, mutetime, locale), -1);
+  ACE_NEW_RETURN (m_Session, WorldSession (id, this, security, expansion, mutetime, locale), -1);
 
   m_Crypt.SetKey (&K);
Index: /trunk/src/game/WorldSession.h
===================================================================
--- /trunk/src/game/WorldSession.h (revision 44)
+++ /trunk/src/game/WorldSession.h (revision 78)
@@ -72,5 +72,5 @@
     friend class CharacterHandler;
     public:
-        WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale);
+        WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale);
         ~WorldSession();
 
@@ -89,4 +89,5 @@
         uint32 GetSecurity() const { return _security; }
         uint32 GetAccountId() const { return _accountId; }
+        //std::string const& GetRemoteAddress() const { return m_remoteaddress; }
         Player* GetPlayer() const { return _player; }
         char const* GetPlayerName() const;
@@ -94,5 +95,5 @@
         std::string& GetRemoteAddress() { return m_Address; }
         void SetPlayer(Player *plr) { _player = plr; }
-        bool IsTBC() const { return m_isTBC; }
+        uint8 Expansion() const { return m_expansion; }
 
         /// Is the user engaged in a log out process?
@@ -630,5 +631,5 @@
         uint32 _security;
         uint32 _accountId;
-        bool m_isTBC;
+        uint8 m_expansion;
 
         time_t _logoutTime;
Index: /trunk/src/game/CharacterHandler.cpp
===================================================================
--- /trunk/src/game/CharacterHandler.cpp (revision 74)
+++ /trunk/src/game/CharacterHandler.cpp (revision 78)
@@ -180,5 +180,4 @@
     std::string name;
     uint8 race_,class_;
-    bool pTbc = this->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION) > 0;
     recv_data >> name;
 
@@ -213,6 +212,7 @@
     }
 
-    if (!sChrClassesStore.LookupEntry(class_)||
-        !sChrRacesStore.LookupEntry(race_))
+    ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_);
+    ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_);
+    if( !classEntry || !raceEntry )
     {
         data << (uint8)CHAR_CREATE_FAILED;
@@ -223,8 +223,18 @@
 
     // prevent character creating Expansion race without Expansion account
-    if (!pTbc&&(race_>RACE_TROLL))
+    if (raceEntry->addon > Expansion())
     {
         data << (uint8)CHAR_CREATE_EXPANSION;
-        sLog.outError("No Expansion Account:[%d] but tried to Create TBC character",GetAccountId());
+        sLog.outError("Not Expansion 1 account:[%d] but tried to Create character with expansion 1 race (%u)",GetAccountId(),race_);
+        SendPacket( &data );
+        return;
+    }
+
+    // prevent character creating Expansion class without Expansion account
+    // TODO: use possible addon field in ChrClassesEntry in next dbc version
+    if (Expansion() < 2 && class_ == CLASS_DEATH_KNIGHT)
+    {
+        data << (uint8)CHAR_CREATE_EXPANSION;
+        sLog.outError("Not Expansion 2 account:[%d] but tried to Create character with expansion 2 class (%u)",GetAccountId(),class_);
         SendPacket( &data );
         return;
Index: /trunk/src/game/WorldSession.cpp
===================================================================
--- /trunk/src/game/WorldSession.cpp (revision 73)
+++ /trunk/src/game/WorldSession.cpp (revision 78)
@@ -45,7 +45,7 @@
 
 /// WorldSession constructor
-WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale) :
+WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
 LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time),
-_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_isTBC(tbc),
+_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
 m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)),
 _logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0)
Index: /trunk/src/game/Player.cpp
===================================================================
--- /trunk/src/game/Player.cpp (revision 76)
+++ /trunk/src/game/Player.cpp (revision 78)
@@ -1516,10 +1516,8 @@
         return false;
 
-    bool tbc = GetSession()->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION) > 0;
-
-    // normal client and TBC map
-    if(!tbc && mEntry->IsExpansionMap())
-    {
-        sLog.outDebug("Player %s using Normal client and tried teleport to non existing map %u", GetName(), mapid);
+    // client without expansion support
+    if(GetSession()->Expansion() < mEntry->Expansion())
+    {
+        sLog.outDebug("Player %s using client without required expansion tried teleport to non accessable map %u", GetName(), mapid);
 
         if(GetTransport())
@@ -1530,25 +1528,8 @@
         return false;                                       // normal client can't teleport to this map...
     }
-    else if(tbc)                                            // can teleport to any existing map
-    {
-        sLog.outDebug("Player %s have TBC client and will teleported to map %u", GetName(), mapid);
-    }
     else
     {
-        sLog.outDebug("Player %s have normal client and will teleported to standard map %u", GetName(), mapid);
-    }
-    /*
-    only TBC (no 0x80000 and 0x10 flags...)
-    3604590=0x37006E=0x200000 + 0x100000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x8 + 0x4 + 0x2
-
-    Kharazan (normal/TBC??), but not have 0x10 flag (accessible by normal client?)
-    4128878=0x3F006E=0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x8 + 0x4 + 0x2
-
-    normal+TBC maps
-    4128894=0x3F007E=0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x10 + 0x8 + 0x4 + 0x2
-
-    normal+TBC maps
-    8323198=0x7F007E=0x400000 + 0x200000 + 0x100000 + 0x80000 + 0x40000 + 0x20000 + 0x10000 + 0x40 + 0x20 + 0x10 + 0x8 + 0x4 + 0x2
-    */
+        sLog.outDebug("Player %s will teleported to map %u", GetName(), mapid);
+    }
 
     // if we were on a transport, leave
Index: /trunk/src/game/SharedDefines.h
===================================================================
--- /trunk/src/game/SharedDefines.h (revision 53)
+++ /trunk/src/game/SharedDefines.h (revision 78)
@@ -67,5 +67,5 @@
     CLASS_ROGUE         = 4,
     CLASS_PRIEST        = 5,
-    // CLASS_UNK1       = 6, DK
+    CLASS_DEATH_KNIGHT  = 6,
     CLASS_SHAMAN        = 7,
     CLASS_MAGE          = 8,
@@ -962,5 +962,5 @@
     GAMEOBJECT_TYPE_AURA_GENERATOR         = 30,
     GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY     = 31,
-    GAMEOBJECT_TYPE_DO_NOT_USE_YET         = 32,
+    GAMEOBJECT_TYPE_BARBER_CHAIR           = 32,
     GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING  = 33,
     GAMEOBJECT_TYPE_GUILD_BANK             = 34,
@@ -1550,5 +1550,5 @@
 {
     CREATURE_TYPE_BEAST            = 1,
-    CREATURE_TYPE_DRAGON           = 2,
+    CREATURE_TYPE_DRAGONKIN        = 2,
     CREATURE_TYPE_DEMON            = 3,
     CREATURE_TYPE_ELEMENTAL        = 4,
@@ -1558,5 +1558,5 @@
     CREATURE_TYPE_CRITTER          = 8,
     CREATURE_TYPE_MECHANICAL       = 9,
-    CREATURE_TYPE_NOTSPECIFIED     = 10,
+    CREATURE_TYPE_NOT_SPECIFIED    = 10,
     CREATURE_TYPE_TOTEM            = 11,
     CREATURE_TYPE_NON_COMBAT_PET   = 12,
Index: /trunk/src/game/ObjectMgr.cpp
===================================================================
--- /trunk/src/game/ObjectMgr.cpp (revision 44)
+++ /trunk/src/game/ObjectMgr.cpp (revision 78)
@@ -2370,4 +2370,8 @@
             // skip expansion races if not playing with expansion
             if (sWorld.getConfig(CONFIG_EXPANSION) < 1 && (race == RACE_BLOODELF || race == RACE_DRAENEI))
+                continue;
+                
+            // skip expansion classes if not playing with expansion
+            if (sWorld.getConfig(CONFIG_EXPANSION) < 2 && class_ == CLASS_DEATH_KNIGHT)
                 continue;
 
Index: /trunk/src/game/Map.cpp
===================================================================
--- /trunk/src/game/Map.cpp (revision 61)
+++ /trunk/src/game/Map.cpp (revision 78)
@@ -19,4 +19,5 @@
  */
 
+#include "MapManager.h"
 #include "Player.h"
 #include "GridNotifiers.h"
@@ -36,5 +37,4 @@
 #include "Group.h"
 
-#include "MapManager.h"
 #include "MapInstanced.h"
 #include "InstanceSaveMgr.h"
Index: /trunk/src/trinitycore/CliRunnable.cpp
===================================================================
--- /trunk/src/trinitycore/CliRunnable.cpp (revision 44)
+++ /trunk/src/trinitycore/CliRunnable.cpp (revision 78)
@@ -68,5 +68,5 @@
 void CliSetLogLevel(char*,pPrintf);
 void CliUpTime(char*,pPrintf);
-void CliSetTBC(char*,pPrintf);
+void CliSetAddon(char*,pPrintf);
 void CliWritePlayerDump(char*,pPrintf);
 void CliLoadPlayerDump(char*,pPrintf);
@@ -92,5 +92,5 @@
     {"setgm", & CliSetGM,"Edit user privileges"},
     {"setpass", & CliSetPassword,"Set password for account"},
-    {"setbc", & CliSetTBC,"Set user expansion allowed"},
+    {"setaddon", & CliSetAddon,"Set user expansion addon level allowed"},
     {"listgm", & CliListGM,"Display user privileges"},
     {"loadscripts", & CliLoadScripts,"Load script library"},
@@ -473,5 +473,5 @@
     ///- Display the list of account/characters online
     zprintf("=====================================================================\r\n");
-    zprintf("|    Account    |       Character      |       IP        | GM | TBC |\r\n");
+    zprintf("|    Account    |       Character      |       IP        | GM | Exp |\r\n");
     zprintf("=====================================================================\r\n");
 
@@ -486,5 +486,5 @@
         // No SQL injection. account is uint32.
         //                                                      0         1        2        3
-        QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, tbc FROM account WHERE id = '%u'",account);
+        QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, expansion FROM account WHERE id = '%u'",account);
 
         if(resultLogin)
@@ -1038,21 +1038,21 @@
 
 /// Set/Unset the TBC flag for an account
-void CliSetTBC(char *command,pPrintf zprintf)
+void CliSetAddon(char *command,pPrintf zprintf)
 {
     ///- Get the command line arguments
     char *szAcc = strtok(command," ");
-    char *szTBC =  strtok(NULL," ");
-
-    if(!szAcc||!szTBC)
-    {
-        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc)>\r\n");
-        return;
-    }
-
-    int lev=atoi(szTBC);                                    //get int anyway (0 if error)
-
-    if((lev > 1)|| (lev < 0))
-    {
-        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc)>\r\n");
+    char *szExp =  strtok(NULL," ");
+
+    if(!szAcc||!szExp)
+    {
+        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc, 2 - wotlk)>\r\n");
+        return;
+    }
+
+    int lev=atoi(szExp);                                    //get int anyway (0 if error)
+
+    if(lev < 0)
+    {
+        zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc, 2 - wotlk)>\r\n");
         return;
     }
@@ -1075,5 +1075,5 @@
     {
         // No SQL injection (account name is escaped)
-        loginDatabase.PExecute("UPDATE account SET tbc = '%d' WHERE username = '%s'",lev,safe_account_name.c_str());
+        loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE username = '%s'",lev,safe_account_name.c_str());
         zprintf("We set %s to expansion allowed %d\r\n",safe_account_name.c_str(),lev);
 
Index: /trunk/src/trinitycore/trinitycore.conf.dist
===================================================================
--- /trunk/src/trinitycore/trinitycore.conf.dist (revision 62)
+++ /trunk/src/trinitycore/trinitycore.conf.dist (revision 78)
@@ -355,8 +355,10 @@
 #
 #    Expansion
-#        Allow server use expansion content
-#        Default: 1 - check expansion maps existence, and if client support expansion and account have 
-#                     expansion setting then allow visit expansion maps, allow create new races character)
-#                 0 - not check expansion maps existence, not allow wisit its, not allow create new race 
+#        Allow server use content from expansion 
+#                 2 - check expansion 2 maps existence, and if client support expansion 2 and account have 
+#                     expansion 2 setting then allow visit expansion 2 maps, allow create new class character)
+#        Default: 1 - check expansion 1 maps existence, and if client support expansion 1 and account have 
+#                     expansion 1 setting then allow visit expansion 1 maps, allow create new races character)
+#                 0 - not check expansion maps existence, not allow wisit its, not allow create new race or new class
 #                     characters, ignore account expansion setting)
 #
Index: /trunk/sql/updates/83_realmd.sql
===================================================================
--- /trunk/sql/updates/83_realmd.sql (revision 78)
+++ /trunk/sql/updates/83_realmd.sql (revision 78)
@@ -0,0 +1,2 @@
+ALTER TABLE account
+    CHANGE COLUMN tbc expansion tinyint(3) unsigned NOT NULL default '0';
