diff --git a/sql/characters.sql b/sql/characters.sql index a2b2437fb..5683ee52b 100644 --- a/sql/characters.sql +++ b/sql/characters.sql @@ -175,7 +175,7 @@ CREATE TABLE `characters` ( `trans_z` float NOT NULL default '0', `trans_o` float NOT NULL default '0', `transguid` bigint(20) unsigned NOT NULL default '0', - `gmstate` int(11) unsigned NOT NULL default '0', + `extra_flags` int(11) unsigned NOT NULL default '0', `stable_slots` tinyint(1) unsigned NOT NULL default '0', `at_login` int(11) unsigned NOT NULL default '0', `zone` int(11) unsigned NOT NULL default '0', diff --git a/sql/updates/2008_10_18_01_characters_characters.sql b/sql/updates/2008_10_18_01_characters_characters.sql new file mode 100644 index 000000000..4544be275 --- /dev/null +++ b/sql/updates/2008_10_18_01_characters_characters.sql @@ -0,0 +1,2 @@ +ALTER TABLE characters + CHANGE COLUMN gmstate extra_flags int(11) unsigned NOT NULL default '0'; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 01c541d83..8ae0a2d4a 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -92,6 +92,7 @@ pkgdata_DATA = \ 06750_mangos_command.sql \ 06751_realmd_account.sql \ 06760_mangos_creature_template.sql \ + 2008_10_18_01_characters_characters.sql \ README ## Additional files to include when running 'make dist' @@ -165,4 +166,5 @@ EXTRA_DIST = \ 06750_mangos_command.sql \ 06751_realmd_account.sql \ 06760_mangos_creature_template.sql \ + 2008_10_18_01_characters_characters.sql \ README diff --git a/sql/updates/README b/sql/updates/README index 39dc777b9..e25eb54d5 100644 --- a/sql/updates/README +++ b/sql/updates/README @@ -26,11 +26,14 @@ See an example below: | | Name of affected DB (default recommended name) | | Can be: characters, mangos, realmd | | - | Counter show number of sql update in updates list for provided data - | and set proper order for sql updates for some date + | Counter show number of sql update in updates list for provided date + | and set proper order for sql updates for same date | MaNGOS commit date related to sql update. For related commit you can see http://github.com/mangos/mangos/commits/master Expected commit will be in commits list for provided date and it will have sql update file name (2008_10_17_01_characters_character_spell.sql in our case) in list changed files, After appling this update DB compatiable with found commit. + +=== For commiters ==== +Please, include sql update name in first line of commit description for simplify it search by users in commits list. \ No newline at end of file diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index fdbe12f79..ef2fcbf59 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -59,7 +59,7 @@ bool LoginQueryHolder::Initialize() // NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure. // !!! NOTE: including unused `zone`,`online` - res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, 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, gmstate, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); + res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, 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 FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid 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,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 68aafbe7a..25b35a944 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13314,8 +13314,8 @@ float Player::GetFloatValueFromDB(uint16 index, uint64 guid) bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) { - //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] [29] 30 31 32 - //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, 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, gmstate, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty FROM characters WHERE guid = '%u'", guid); + //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] [29] 30 31 32 + //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, 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 FROM characters WHERE guid = '%u'", guid); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); if(!result) @@ -13550,7 +13550,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) m_taxi.LoadTaxiMask( fields[11].GetString() ); // must be before InitTaxiNodesForLevel - uint32 gmstate = fields[25].GetUInt32(); + uint32 extraflags = fields[25].GetUInt32(); m_stableSlots = fields[26].GetUInt32(); if(m_stableSlots > 2) @@ -13740,7 +13740,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) case 0: break; // disable case 1: SetGameMaster(true); break; // enable case 2: // save state - if(gmstate & PLAYER_EXTRA_GM_ON) + if(extraflags & PLAYER_EXTRA_GM_ON) SetGameMaster(true); break; } @@ -13751,7 +13751,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) case 0: break; // disable case 1: SetAcceptTicket(true); break; // enable case 2: // save state - if(gmstate & PLAYER_EXTRA_GM_ACCEPT_TICKETS) + if(extraflags & PLAYER_EXTRA_GM_ACCEPT_TICKETS) SetAcceptTicket(true); break; } @@ -13762,7 +13762,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) case 0: break; // disable case 1: SetGMChat(true); break; // enable case 2: // save state - if(gmstate & PLAYER_EXTRA_GM_CHAT) + if(extraflags & PLAYER_EXTRA_GM_CHAT) SetGMChat(true); break; } @@ -13773,7 +13773,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) case 0: break; // disable case 1: SetAcceptWhispers(true); break; // enable case 2: // save state - if(gmstate & PLAYER_EXTRA_ACCEPT_WHISPERS) + if(extraflags & PLAYER_EXTRA_ACCEPT_WHISPERS) SetAcceptWhispers(true); break; } @@ -14758,7 +14758,7 @@ void Player::SaveToDB() "map, dungeon_difficulty, position_x, position_y, position_z, orientation, data, " "taximask, online, cinematic, " "totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, " - "trans_x, trans_y, trans_z, trans_o, transguid, gmstate, stable_slots, at_login, zone, " + "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, " "death_expire_time, taxi_path) VALUES (" << GetGUIDLow() << ", " << GetSession()->GetAccountId() << ", '"