diff --git a/sql/characters.sql b/sql/characters.sql index 7b069280f..372ec0038 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -21,7 +21,7 @@ DROP TABLE IF EXISTS `character_db_version`; CREATE TABLE `character_db_version` ( - `required_9354_01_characters_character_action` bit(1) default NULL + `required_9359_01_characters_characters` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -250,6 +250,8 @@ CREATE TABLE `characters` ( `power5` int(10) UNSIGNED NOT NULL default '0', `power6` int(10) UNSIGNED NOT NULL default '0', `power7` int(10) UNSIGNED NOT NULL default '0', + `specCount` tinyint(3) UNSIGNED NOT NULL default '1', + `activeSpec` tinyint(3) UNSIGNED NOT NULL default '0', PRIMARY KEY (`guid`), KEY `idx_account` (`account`), KEY `idx_online` (`online`), diff --git a/sql/updates/9359_01_characters_characters.sql b/sql/updates/9359_01_characters_characters.sql new file mode 100644 index 000000000..73bc0ded2 --- /dev/null +++ b/sql/updates/9359_01_characters_characters.sql @@ -0,0 +1,4 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_9354_01_characters_character_action required_9359_01_characters_characters bit; + +ALTER TABLE `characters` ADD `specCount` tinyint(3) unsigned NOT NULL default 1 AFTER `power7`; +ALTER TABLE `characters` ADD `activeSpec` tinyint(3) unsigned NOT NULL default 0 AFTER `specCount`; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 63c604c00..cc8af0902 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -65,6 +65,7 @@ pkgdata_DATA = \ 9339_01_characters_group.sql \ 9349_01_characters_character_action.sql \ 9354_01_characters_character_action.sql \ + 9359_01_characters_characters.sql \ README ## Additional files to include when running 'make dist' @@ -110,4 +111,5 @@ EXTRA_DIST = \ 9339_01_characters_group.sql \ 9349_01_characters_character_action.sql \ 9354_01_characters_character_action.sql \ + 9359_01_characters_characters.sql \ README diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 773335c1e..8c4f868d5 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -72,7 +72,7 @@ bool LoginQueryHolder::Initialize() "position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost," "resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty," "arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk," - "health, power1, power2, power3, power4, power5, power6, power7 FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + "health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT groupId FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8c0be777a..02800e27d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14598,8 +14598,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) //"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty," // 40 41 42 43 44 45 46 47 48 49 50 //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk," - // 51 52 53 54 55 56 57 58 - //"health, power1, power2, power3, power4, power5, power6, power7 FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + // 51 52 53 54 55 56 57 58 59 60 + //"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); if(!result) @@ -14996,6 +14996,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // Mail _LoadMail(); + m_specsCount = fields[59].GetUInt8(); + m_activeSpec = fields[60].GetUInt8(); + _LoadAuras(holder->GetResult(PLAYER_LOGIN_QUERY_LOADAURAS), time_diff); _LoadGlyphAuras(); @@ -16159,7 +16162,7 @@ void Player::SaveToDB() "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, " "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, " "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, " - "power4, power5, power6, power7) VALUES (" + "power4, power5, power6, power7, specCount, activeSpec) VALUES (" << GetGUIDLow() << ", " << GetSession()->GetAccountId() << ", '" << sql_name << "', " @@ -16267,6 +16270,10 @@ void Player::SaveToDB() for(uint32 i = 0; i < MAX_POWERS; ++i) ss << "," << GetPower(Powers(i)); + ss << ", "; + ss << uint32(m_specsCount) << ", "; + ss << uint32(m_activeSpec); + ss << ")"; CharacterDatabase.Execute( ss.str().c_str() ); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7f38585b2..399aff507 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9358" + #define REVISION_NR "9359" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index a18e3b044..754aedf40 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ - #define REVISION_DB_CHARACTERS "required_9354_01_characters_character_action" + #define REVISION_DB_CHARACTERS "required_9359_01_characters_characters" #define REVISION_DB_MANGOS "required_9331_01_mangos_quest_template" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #endif // __REVISION_SQL_H__