[9635] Restore load/save shown action bars.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-03-28 15:24:55 +02:00
parent d85e4228f1
commit 8e25d43443
8 changed files with 26 additions and 14 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_9634_01_characters_corpse` bit(1) default NULL `required_9635_01_characters_characters` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -255,6 +255,7 @@ CREATE TABLE `characters` (
`equipmentCache` longtext, `equipmentCache` longtext,
`ammoId` int(10) UNSIGNED NOT NULL default '0', `ammoId` int(10) UNSIGNED NOT NULL default '0',
`knownTitles` longtext, `knownTitles` longtext,
`actionBars` tinyint(3) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`guid`), PRIMARY KEY (`guid`),
KEY `idx_account` (`account`), KEY `idx_account` (`account`),
KEY `idx_online` (`online`), KEY `idx_online` (`online`),

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9634_01_characters_corpse required_9635_01_characters_characters bit;
ALTER TABLE characters
ADD COLUMN `actionBars` tinyint(3) UNSIGNED NOT NULL default '0' AFTER knownTitles;

View file

@ -94,6 +94,7 @@ pkgdata_DATA = \
9630_01_characters_characters.sql \ 9630_01_characters_characters.sql \
9632_01_characters_characters.sql \ 9632_01_characters_characters.sql \
9634_01_characters_corpse.sql \ 9634_01_characters_corpse.sql \
9635_01_characters_characters.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -168,4 +169,5 @@ EXTRA_DIST = \
9630_01_characters_characters.sql \ 9630_01_characters_characters.sql \
9632_01_characters_characters.sql \ 9632_01_characters_characters.sql \
9634_01_characters_corpse.sql \ 9634_01_characters_corpse.sql \
9635_01_characters_characters.sql \
README README

View file

@ -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," "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," "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," "arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); "health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars 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_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_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)); 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));

View file

@ -100,6 +100,9 @@ bool Corpse::Create( uint32 guidlow, Player *owner)
void Corpse::SaveToDB() void Corpse::SaveToDB()
{ {
// bones should not be saved to DB (would be deleted on startup anyway)
assert(GetType() != CORPSE_BONES);
// prevent DB data inconsistence problems and duplicates // prevent DB data inconsistence problems and duplicates
CharacterDatabase.BeginTransaction(); CharacterDatabase.BeginTransaction();
DeleteFromDB(); DeleteFromDB();
@ -137,12 +140,11 @@ void Corpse::DeleteBonesFromWorld()
void Corpse::DeleteFromDB() void Corpse::DeleteFromDB()
{ {
if(GetType() == CORPSE_BONES) // bones should not be saved to DB (would be deleted on startup anyway)
// only specific bones assert(GetType() != CORPSE_BONES);
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%d'", GetGUIDLow());
else // all corpses (not bones)
// all corpses (not bones) CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
} }
bool Corpse::LoadFromDB(uint32 guid, Field *fields) bool Corpse::LoadFromDB(uint32 guid, Field *fields)

View file

@ -14662,8 +14662,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," //"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 // 39 40 41 42 43 44 45 46 47 48 49
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk," //"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 // 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
//"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); //"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
if(!result) if(!result)
@ -14732,6 +14732,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64()); SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32()); SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32());
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8());
InitDisplayIds(); InitDisplayIds();
@ -16231,7 +16232,7 @@ void Player::SaveToDB()
"trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, 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, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, " "death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
"todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, " "todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
"power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles) VALUES (" "power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES ("
<< GetGUIDLow() << ", " << GetGUIDLow() << ", "
<< GetSession()->GetAccountId() << ", '" << GetSession()->GetAccountId() << ", '"
<< sql_name << "', " << sql_name << "', "
@ -16351,7 +16352,9 @@ void Player::SaveToDB()
{ {
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " "; ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " ";
} }
ss << "')"; ss << "',";
ss << uint32(GetByteValue(PLAYER_FIELD_BYTES, 2));
ss << ")";
CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.Execute( ss.str().c_str() );

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9634" #define REVISION_NR "9635"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9634_01_characters_corpse" #define REVISION_DB_CHARACTERS "required_9635_01_characters_characters"
#define REVISION_DB_MANGOS "required_9622_01_mangos_gameobject" #define REVISION_DB_MANGOS "required_9622_01_mangos_gameobject"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__