Skip to content

Commit

Permalink
[9635] Restore load/save shown action bars.
Browse files Browse the repository at this point in the history
Signed-off-by: hunuza <hunuza@gmail.com>
  • Loading branch information
hunuza committed Mar 28, 2010
1 parent c855b60 commit d6eccbd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
3 changes: 2 additions & 1 deletion sql/characters.sql
Expand Up @@ -21,7 +21,7 @@

DROP TABLE IF EXISTS `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';

--
Expand Down Expand Up @@ -255,6 +255,7 @@ CREATE TABLE `characters` (
`equipmentCache` longtext,
`ammoId` int(10) UNSIGNED NOT NULL default '0',
`knownTitles` longtext,
`actionBars` tinyint(3) UNSIGNED NOT NULL default '0',
PRIMARY KEY (`guid`),
KEY `idx_account` (`account`),
KEY `idx_online` (`online`),
Expand Down
4 changes: 4 additions & 0 deletions sql/updates/9635_01_characters_characters.sql
@@ -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;
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -94,6 +94,7 @@ pkgdata_DATA = \
9630_01_characters_characters.sql \
9632_01_characters_characters.sql \
9634_01_characters_corpse.sql \
9635_01_characters_characters.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -168,4 +169,5 @@ EXTRA_DIST = \
9630_01_characters_characters.sql \
9632_01_characters_characters.sql \
9634_01_characters_corpse.sql \
9635_01_characters_characters.sql \
README
2 changes: 1 addition & 1 deletion src/game/CharacterHandler.cpp
Expand Up @@ -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, 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_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));
Expand Down
14 changes: 8 additions & 6 deletions src/game/Corpse.cpp
Expand Up @@ -100,6 +100,9 @@ bool Corpse::Create( uint32 guidlow, Player *owner)

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
CharacterDatabase.BeginTransaction();
DeleteFromDB();
Expand Down Expand Up @@ -137,12 +140,11 @@ void Corpse::DeleteBonesFromWorld()

void Corpse::DeleteFromDB()
{
if(GetType() == CORPSE_BONES)
// only specific bones
CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%d'", GetGUIDLow());
else
// all corpses (not bones)
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
// bones should not be saved to DB (would be deleted on startup anyway)
assert(GetType() != CORPSE_BONES);

// all corpses (not bones)
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
}

bool Corpse::LoadFromDB(uint32 guid, Field *fields)
Expand Down
11 changes: 7 additions & 4 deletions src/game/Player.cpp
Expand Up @@ -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,"
// 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 63
//"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
// 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, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);

if(!result)
Expand Down Expand Up @@ -14732,6 +14732,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());

SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32());
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8());


InitDisplayIds();
Expand Down Expand Up @@ -16231,7 +16232,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, knownTitles) VALUES ("
"power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES ("
<< GetGUIDLow() << ", "
<< GetSession()->GetAccountId() << ", '"
<< sql_name << "', "
Expand Down Expand Up @@ -16351,7 +16352,9 @@ void Player::SaveToDB()
{
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " ";
}
ss << "')";
ss << "',";
ss << uint32(GetByteValue(PLAYER_FIELD_BYTES, 2));
ss << ")";

CharacterDatabase.Execute( ss.str().c_str() );

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9634"
#define REVISION_NR "9635"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
@@ -1,6 +1,6 @@
#ifndef __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_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__

2 comments on commit d6eccbd

@rsa
Copy link
Contributor

@rsa rsa commented on d6eccbd Mar 28, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May still instead of breaking something that worked fine, committers will occupy finalizing abandoned halfway? The last 30 commits just a horror ...

@digitalni
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a project for education (wehey) purposes only and devs have raised 20 USD in donations so far (l.o.l.), so based on that, I'm happy there are any commits at all :) Message to all you private server owners who earn money off of mangos: DONATE some of your filthy money to Mangos project!

Please sign in to comment.