Changeset 78
- Timestamp:
- 11/19/08 13:32:10 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 16 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/CharacterHandler.cpp
r74 r78 180 180 std::string name; 181 181 uint8 race_,class_; 182 bool pTbc = this->IsTBC() && sWorld.getConfig(CONFIG_EXPANSION) > 0;183 182 recv_data >> name; 184 183 … … 213 212 } 214 213 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 ) 217 217 { 218 218 data << (uint8)CHAR_CREATE_FAILED; … … 223 223 224 224 // prevent character creating Expansion race without Expansion account 225 if ( !pTbc&&(race_>RACE_TROLL))225 if (raceEntry->addon > Expansion()) 226 226 { 227 227 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_); 229 239 SendPacket( &data ); 230 240 return; -
trunk/src/game/Chat.cpp
r62 r78 627 627 for(uint32 i = 0; table[i].Name != NULL; i++) 628 628 { 629 if( !hasStringAbbr(table[i].Name, cmd.c_str()))629 if( *subcmd && !hasStringAbbr(table[i].Name, subcmd)) 630 630 continue; 631 631 -
trunk/src/game/Map.cpp
r61 r78 19 19 */ 20 20 21 #include "MapManager.h" 21 22 #include "Player.h" 22 23 #include "GridNotifiers.h" … … 36 37 #include "Group.h" 37 38 38 #include "MapManager.h"39 39 #include "MapInstanced.h" 40 40 #include "InstanceSaveMgr.h" -
trunk/src/game/ObjectMgr.cpp
r44 r78 2370 2370 // skip expansion races if not playing with expansion 2371 2371 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) 2372 2376 continue; 2373 2377 -
trunk/src/game/Player.cpp
r76 r78 1516 1516 return false; 1517 1517 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); 1524 1522 1525 1523 if(GetTransport()) … … 1530 1528 return false; // normal client can't teleport to this map... 1531 1529 } 1532 else if(tbc) // can teleport to any existing map1533 {1534 sLog.outDebug("Player %s have TBC client and will teleported to map %u", GetName(), mapid);1535 }1536 1530 else 1537 1531 { 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 } 1553 1534 1554 1535 // if we were on a transport, leave -
trunk/src/game/SharedDefines.h
r53 r78 67 67 CLASS_ROGUE = 4, 68 68 CLASS_PRIEST = 5, 69 // CLASS_UNK1 = 6, DK69 CLASS_DEATH_KNIGHT = 6, 70 70 CLASS_SHAMAN = 7, 71 71 CLASS_MAGE = 8, … … 962 962 GAMEOBJECT_TYPE_AURA_GENERATOR = 30, 963 963 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY = 31, 964 GAMEOBJECT_TYPE_ DO_NOT_USE_YET= 32,964 GAMEOBJECT_TYPE_BARBER_CHAIR = 32, 965 965 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING = 33, 966 966 GAMEOBJECT_TYPE_GUILD_BANK = 34, … … 1550 1550 { 1551 1551 CREATURE_TYPE_BEAST = 1, 1552 CREATURE_TYPE_DRAGON 1552 CREATURE_TYPE_DRAGONKIN = 2, 1553 1553 CREATURE_TYPE_DEMON = 3, 1554 1554 CREATURE_TYPE_ELEMENTAL = 4, … … 1558 1558 CREATURE_TYPE_CRITTER = 8, 1559 1559 CREATURE_TYPE_MECHANICAL = 9, 1560 CREATURE_TYPE_NOT SPECIFIED= 10,1560 CREATURE_TYPE_NOT_SPECIFIED = 10, 1561 1561 CREATURE_TYPE_TOTEM = 11, 1562 1562 CREATURE_TYPE_NON_COMBAT_PET = 12, -
trunk/src/game/WorldSession.cpp
r73 r78 45 45 46 46 /// WorldSession constructor 47 WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, bool tbc, time_t mute_time, LocaleConstant locale) :47 WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : 48 48 LookingForGroup_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), 50 50 m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)), 51 51 _logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0) -
trunk/src/game/WorldSession.h
r44 r78 72 72 friend class CharacterHandler; 73 73 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); 75 75 ~WorldSession(); 76 76 … … 89 89 uint32 GetSecurity() const { return _security; } 90 90 uint32 GetAccountId() const { return _accountId; } 91 //std::string const& GetRemoteAddress() const { return m_remoteaddress; } 91 92 Player* GetPlayer() const { return _player; } 92 93 char const* GetPlayerName() const; … … 94 95 std::string& GetRemoteAddress() { return m_Address; } 95 96 void SetPlayer(Player *plr) { _player = plr; } 96 bool IsTBC() const { return m_isTBC; }97 uint8 Expansion() const { return m_expansion; } 97 98 98 99 /// Is the user engaged in a log out process? … … 630 631 uint32 _security; 631 632 uint32 _accountId; 632 bool m_isTBC;633 uint8 m_expansion; 633 634 634 635 time_t _logoutTime; -
trunk/src/game/WorldSocket.cpp
r44 r78 679 679 uint32 BuiltNumberClient; 680 680 uint32 id, security; 681 bool tbc = false;681 uint8 expansion = 0; 682 682 LocaleConstant locale; 683 683 std::string account; … … 729 729 "v, " //6 730 730 "s, " //7 731 " tbc, " //8731 "expansion, " //8 732 732 "mutetime, " //9 733 733 "locale " //10 … … 750 750 Field* fields = result->Fetch (); 751 751 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; 753 756 754 757 N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); … … 910 913 // TODO protect here probably ? 911 914 // 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); 913 916 914 917 m_Crypt.SetKey (&K); -
trunk/src/shared/ByteBuffer.h
r44 r78 202 202 } 203 203 204 uint8 operator[](size_t pos) 204 uint8 operator[](size_t pos) const 205 205 { 206 206 return read<uint8>(pos); … … 310 310 memcpy(&_storage[pos], src, cnt); 311 311 } 312 void print_storage() 312 void print_storage() const 313 313 { 314 314 if(!sLog.IsOutDebug()) // optimize disabled debug output … … 321 321 } 322 322 323 void textlike() 323 void textlike() const 324 324 { 325 325 if(!sLog.IsOutDebug()) // optimize disabled debug output … … 332 332 } 333 333 334 void hexlike() 334 void hexlike() const 335 335 { 336 336 if(!sLog.IsOutDebug()) // optimize disabled debug output -
trunk/src/shared/Database/DBCStores.cpp
r44 r78 555 555 556 556 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 } 558 566 } 559 567 -
trunk/src/shared/Database/DBCStores.h
r44 r78 45 45 { 46 46 CONTENT_1_60 = 0, 47 CONTENT_61_70 47 CONTENT_61_70, 48 CONTENT_71_80 48 49 }; 49 50 ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId); -
trunk/src/shared/Database/DBCStructure.h
r44 r78 180 180 // 64 string flags, unused 181 181 // 65-67 unused 182 //uint32 addon // 68 (0 - original race, 1 - tbc addon, ...) unused182 uint32 addon; // 68 (0 - original race, 1 - tbc addon, ...) 183 183 }; 184 184 … … 474 474 475 475 // Helpers 476 bool IsExpansionMap() const { return addon != 0; }476 uint32 Expansion() const { return addon; } 477 477 478 478 -
trunk/src/shared/Database/DBCfmt.cpp
r44 r78 28 28 //const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; 29 29 const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix"; 30 const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x";30 const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi"; 31 31 const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxx"; 32 32 const char CreatureFamilyfmt[]="nfifiiiissssssssssssssssxx"; -
trunk/src/trinitycore/CliRunnable.cpp
r44 r78 68 68 void CliSetLogLevel(char*,pPrintf); 69 69 void CliUpTime(char*,pPrintf); 70 void CliSet TBC(char*,pPrintf);70 void CliSetAddon(char*,pPrintf); 71 71 void CliWritePlayerDump(char*,pPrintf); 72 72 void CliLoadPlayerDump(char*,pPrintf); … … 92 92 {"setgm", & CliSetGM,"Edit user privileges"}, 93 93 {"setpass", & CliSetPassword,"Set password for account"}, 94 {"set bc", & CliSetTBC,"Set user expansionallowed"},94 {"setaddon", & CliSetAddon,"Set user expansion addon level allowed"}, 95 95 {"listgm", & CliListGM,"Display user privileges"}, 96 96 {"loadscripts", & CliLoadScripts,"Load script library"}, … … 473 473 ///- Display the list of account/characters online 474 474 zprintf("=====================================================================\r\n"); 475 zprintf("| Account | Character | IP | GM | TBC|\r\n");475 zprintf("| Account | Character | IP | GM | Exp |\r\n"); 476 476 zprintf("=====================================================================\r\n"); 477 477 … … 486 486 // No SQL injection. account is uint32. 487 487 // 0 1 2 3 488 QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, tbcFROM account WHERE id = '%u'",account);488 QueryResult *resultLogin = loginDatabase.PQuery("SELECT username, last_ip, gmlevel, expansion FROM account WHERE id = '%u'",account); 489 489 490 490 if(resultLogin) … … 1038 1038 1039 1039 /// Set/Unset the TBC flag for an account 1040 void CliSet TBC(char *command,pPrintf zprintf)1040 void CliSetAddon(char *command,pPrintf zprintf) 1041 1041 { 1042 1042 ///- Get the command line arguments 1043 1043 char *szAcc = strtok(command," "); 1044 char *sz TBC= strtok(NULL," ");1045 1046 if(!szAcc||!sz TBC)1047 { 1048 zprintf("Syntax is: setbc $account $number (0 - normal, 1 - tbc )>\r\n");1049 return; 1050 } 1051 1052 int lev=atoi(sz TBC); //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"); 1057 1057 return; 1058 1058 } … … 1075 1075 { 1076 1076 // 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()); 1078 1078 zprintf("We set %s to expansion allowed %d\r\n",safe_account_name.c_str(),lev); 1079 1079 -
trunk/src/trinitycore/trinitycore.conf.dist
r62 r78 355 355 # 356 356 # 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 361 363 # characters, ignore account expansion setting) 362 364 #