diff --git a/sql/characters.sql b/sql/characters.sql index 5590969a9..232b4f4f8 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_9630_01_characters_characters` bit(1) default NULL + `required_9632_01_characters_characters` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; -- @@ -254,6 +254,7 @@ CREATE TABLE `characters` ( `exploredZones` longtext, `equipmentCache` longtext, `ammoId` int(10) UNSIGNED NOT NULL default '0', + `knownTitles` longtext, PRIMARY KEY (`guid`), KEY `idx_account` (`account`), KEY `idx_online` (`online`), diff --git a/sql/updates/9632_01_characters_characters.sql b/sql/updates/9632_01_characters_characters.sql new file mode 100644 index 000000000..97255e153 --- /dev/null +++ b/sql/updates/9632_01_characters_characters.sql @@ -0,0 +1,9 @@ +ALTER TABLE character_db_version CHANGE COLUMN required_9630_01_characters_characters required_9632_01_characters_characters bit; + +ALTER TABLE characters + ADD COLUMN `knownTitles` longtext AFTER ammoId; + +UPDATE characters, data_backup +SET characters.knownTitles = SUBSTRING(data_backup.data, +length(SUBSTRING_INDEX(data_backup.data, ' ', 626))+2, +length(SUBSTRING_INDEX(data_backup.data, ' ', 631+1))- length(SUBSTRING_INDEX(data_backup.data, ' ', 626)) - 1); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 12a940909..a061318ba 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -92,6 +92,7 @@ pkgdata_DATA = \ 9611_01_characters.sql \ 9622_01_mangos_gameobject.sql \ 9630_01_characters_characters.sql \ + 9632_01_characters_characters.sql \ README ## Additional files to include when running 'make dist' @@ -164,4 +165,5 @@ EXTRA_DIST = \ 9611_01_characters.sql \ 9622_01_mangos_gameobject.sql \ 9630_01_characters_characters.sql \ + 9632_01_characters_characters.sql \ README diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 1854556c7..aac4bfb0d 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, specCount, activeSpec, exploredZones, equipmentCache, ammoId FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + "health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles 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/LootMgr.cpp b/src/game/LootMgr.cpp index d4dde29a7..abd73ca34 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -25,7 +25,7 @@ #include "SharedDefines.h" #include "SpellMgr.h" -static eConfigFLoatValues const qualityToRate[MAX_ITEM_QUALITY] = { +static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] = { CONFIG_FLOAT_RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR CONFIG_FLOAT_RATE_DROP_ITEM_NORMAL, // ITEM_QUALITY_NORMAL CONFIG_FLOAT_RATE_DROP_ITEM_UNCOMMON, // ITEM_QUALITY_UNCOMMON diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d77831f9a..8a32bf88b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -14655,7 +14655,7 @@ void Player::_LoadExploredZones(const char* data) { if(!data) return; - + Tokens tokens = StrSplit(data, " "); if(tokens.size() != 128) @@ -14669,6 +14669,24 @@ void Player::_LoadExploredZones(const char* data) } } +void Player::_LoadKnownTitles(const char* data) +{ + if(!data) + return; + + Tokens tokens = StrSplit(data, " "); + + if(tokens.size() != 6) + return; + + Tokens::iterator iter; + int index; + for (iter = tokens.begin(), index = 0; index < 6; ++iter, ++index) + { + m_uint32Values[PLAYER__FIELD_KNOWN_TITLES + index] = atol((*iter).c_str()); + } +} + bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { // 0 1 2 3 4 5 6 7 8 9 10 11 @@ -14679,8 +14697,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," // 39 40 41 42 43 44 45 46 47 48 49 //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk," - // 50 51 52 53 54 55 56 57 58 59 60 61 62 - //"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + // 50 51 52 53 54 55 56 57 58 59 60 61 62 63 + //"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); if(!result) @@ -14729,6 +14747,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(PLAYER_XP, fields[7].GetUInt32()); _LoadExploredZones(fields[60].GetString()); + _LoadKnownTitles(fields[63].GetString()); SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE); SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f); SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); @@ -16246,7 +16265,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, specCount, activeSpec, exploredZones, equipmentCache, ammoId) VALUES (" + "power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles) VALUES (" << GetGUIDLow() << ", " << GetSession()->GetAccountId() << ", '" << sql_name << "', " @@ -16361,8 +16380,12 @@ void Player::SaveToDB() } ss << "',"; - ss << GetUInt32Value(PLAYER_AMMO_ID); - ss << ")"; + ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '"; + for(uint32 i = 0; i < 6; ++i ) + { + ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " "; + } + ss << "')"; CharacterDatabase.Execute( ss.str().c_str() ); diff --git a/src/game/Player.h b/src/game/Player.h index 1d356336d..65c8ebf95 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2321,6 +2321,7 @@ class MANGOS_DLL_SPEC Player : public Unit void _LoadBGData(QueryResult* result); void _LoadGlyphs(QueryResult *result); void _LoadExploredZones(const char* data); + void _LoadKnownTitles(const char* data); /*********************************************************/ /*** SAVE SYSTEM ***/ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index da42beae0..0ecdff1c9 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 "9631" + #define REVISION_NR "9632" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 6f663d158..9e0c4f6b4 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_9630_01_characters_characters" + #define REVISION_DB_CHARACTERS "required_9632_01_characters_characters" #define REVISION_DB_MANGOS "required_9622_01_mangos_gameobject" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #endif // __REVISION_SQL_H__