[9246] Move more values from data to own fields.

Now possible (need recheck) glyphs still used form `data`.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
hunuza 2010-01-24 00:29:52 +03:00 committed by VladimirMangos
parent 0ff9250de2
commit aa14f45e60
8 changed files with 168 additions and 32 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_9136_07_characters_characters` bit(1) default NULL `required_9246_01_characters_character` 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';
-- --
@ -231,7 +231,25 @@ CREATE TABLE `characters` (
`zone` int(11) unsigned NOT NULL default '0', `zone` int(11) unsigned NOT NULL default '0',
`death_expire_time` bigint(20) unsigned NOT NULL default '0', `death_expire_time` bigint(20) unsigned NOT NULL default '0',
`taxi_path` text, `taxi_path` text,
`arena_pending_points` int(10) UNSIGNED NOT NULL default '0', `arenaPoints` int(10) UNSIGNED NOT NULL default '0',
`totalHonorPoints` int(10) UNSIGNED NOT NULL default '0',
`todayHonorPoints` int(10) UNSIGNED NOT NULL default '0',
`yesterdayHonorPoints` int(10) UNSIGNED NOT NULL default '0',
`totalKills` int(10) UNSIGNED NOT NULL default '0',
`todayKills` smallint(5) UNSIGNED NOT NULL default '0',
`yesterdayKills` smallint(5) UNSIGNED NOT NULL default '0',
`chosenTitle` int(10) UNSIGNED NOT NULL default '0',
`knownCurrencies` bigint(20) UNSIGNED NOT NULL default '0',
`watchedFaction` int(10) UNSIGNED NOT NULL default '0',
`drunk` smallint(5) UNSIGNED NOT NULL default '0',
`health` int(10) UNSIGNED NOT NULL default '0',
`power1` int(10) UNSIGNED NOT NULL default '0',
`power2` int(10) UNSIGNED NOT NULL default '0',
`power3` int(10) UNSIGNED NOT NULL default '0',
`power4` int(10) UNSIGNED NOT NULL default '0',
`power5` int(10) UNSIGNED NOT NULL default '0',
`power6` int(10) UNSIGNED NOT NULL default '0',
`power7` int(10) 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,65 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9136_07_characters_characters required_9246_01_characters_character bit;
ALTER TABLE characters
ADD COLUMN `arenaPoints` int(10) UNSIGNED NOT NULL default '0' AFTER arena_pending_points,
ADD COLUMN `totalHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER arenaPoints,
ADD COLUMN `todayHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER totalHonorPoints,
ADD COLUMN `yesterdayHonorPoints` int(10) UNSIGNED NOT NULL default '0' AFTER todayHonorPoints,
ADD COLUMN `totalKills` int(10) UNSIGNED NOT NULL default '0' AFTER yesterdayHonorPoints,
ADD COLUMN `todayKills` smallint(5) UNSIGNED NOT NULL default '0' AFTER totalKills,
ADD COLUMN `yesterdayKills` smallint(5) UNSIGNED NOT NULL default '0' AFTER todayKills,
ADD COLUMN `chosenTitle` int(10) UNSIGNED NOT NULL default '0' AFTER yesterdayKills,
ADD COLUMN `knownCurrencies` bigint(20) UNSIGNED NOT NULL default '0' AFTER chosenTitle,
ADD COLUMN `watchedFaction` int(10) NOT NULL default '0' AFTER knownCurrencies,
ADD COLUMN `drunk` smallint(5) UNSIGNED NOT NULL default '0' AFTER watchedFaction,
ADD COLUMN `health` int(10) UNSIGNED NOT NULL default '0' AFTER drunk,
ADD COLUMN `power1` int(10) UNSIGNED NOT NULL default '0' AFTER health,
ADD COLUMN `power2` int(10) UNSIGNED NOT NULL default '0' AFTER power1,
ADD COLUMN `power3` int(10) UNSIGNED NOT NULL default '0' AFTER power2,
ADD COLUMN `power4` int(10) UNSIGNED NOT NULL default '0' AFTER power3,
ADD COLUMN `power5` int(10) UNSIGNED NOT NULL default '0' AFTER power4,
ADD COLUMN `power6` int(10) UNSIGNED NOT NULL default '0' AFTER power5,
ADD COLUMN `power7` int(10) UNSIGNED NOT NULL default '0' AFTER power6;
UPDATE characters SET
arenaPoints = arena_pending_points +
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1278))+2, length(SUBSTRING_INDEX(data, ' ', 1278+1))- length(SUBSTRING_INDEX(data, ' ', 1278)) - 1),
totalHonorPoints =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1277))+2, length(SUBSTRING_INDEX(data, ' ', 1277+1))- length(SUBSTRING_INDEX(data, ' ', 1277)) - 1),
todayHonorPoints =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1226))+2, length(SUBSTRING_INDEX(data, ' ', 1226+1))- length(SUBSTRING_INDEX(data, ' ', 1226)) - 1),
yesterdayHonorPoints =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1227))+2, length(SUBSTRING_INDEX(data, ' ', 1227+1))- length(SUBSTRING_INDEX(data, ' ', 1227)) - 1),
totalKills =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1228))+2, length(SUBSTRING_INDEX(data, ' ', 1228+1))- length(SUBSTRING_INDEX(data, ' ', 1228)) - 1),
todayKills =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1225))+2, length(SUBSTRING_INDEX(data, ' ', 1225+1))- length(SUBSTRING_INDEX(data, ' ', 1225)) - 1) & 0x0000FFFF,
yesterdayKills =
(SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1225))+2, length(SUBSTRING_INDEX(data, ' ', 1225+1))- length(SUBSTRING_INDEX(data, ' ', 1225)) - 1) & 0xFFFF0000) >> 16,
chosenTitle =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 321))+2, length(SUBSTRING_INDEX(data, ' ', 321+1))- length(SUBSTRING_INDEX(data, ' ', 321)) - 1),
knownCurrencies =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 632))+2, length(SUBSTRING_INDEX(data, ' ', 632+1))- length(SUBSTRING_INDEX(data, ' ', 632)) - 1),
watchedFaction =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 1230))+2, length(SUBSTRING_INDEX(data, ' ', 1230+1))- length(SUBSTRING_INDEX(data, ' ', 1230)) - 1),
drunk =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 155))+2, length(SUBSTRING_INDEX(data, ' ', 155+1))- length(SUBSTRING_INDEX(data, ' ', 155)) - 1) & 0xFFFE,
health =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 23))+2, length(SUBSTRING_INDEX(data, ' ', 23+1))- length(SUBSTRING_INDEX(data, ' ', 23)) - 1),
power1 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 24))+2, length(SUBSTRING_INDEX(data, ' ', 24+1))- length(SUBSTRING_INDEX(data, ' ', 24)) - 1),
power2 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 25))+2, length(SUBSTRING_INDEX(data, ' ', 25+1))- length(SUBSTRING_INDEX(data, ' ', 25)) - 1),
power3 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 26))+2, length(SUBSTRING_INDEX(data, ' ', 26+1))- length(SUBSTRING_INDEX(data, ' ', 26)) - 1),
power4 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 27))+2, length(SUBSTRING_INDEX(data, ' ', 27+1))- length(SUBSTRING_INDEX(data, ' ', 27)) - 1),
power5 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 28))+2, length(SUBSTRING_INDEX(data, ' ', 28+1))- length(SUBSTRING_INDEX(data, ' ', 28)) - 1),
power6 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 29))+2, length(SUBSTRING_INDEX(data, ' ', 29+1))- length(SUBSTRING_INDEX(data, ' ', 29)) - 1),
power7 =
SUBSTRING(data, length(SUBSTRING_INDEX(data, ' ', 30))+2, length(SUBSTRING_INDEX(data, ' ', 30+1))- length(SUBSTRING_INDEX(data, ' ', 30)) - 1);
ALTER TABLE characters
DROP COLUMN arena_pending_points;

View file

@ -250,6 +250,7 @@ pkgdata_DATA = \
9222_01_mangos_playercreateinfo_spell.sql \ 9222_01_mangos_playercreateinfo_spell.sql \
9244_01_mangos_spell_proc_event.sql \ 9244_01_mangos_spell_proc_event.sql \
9244_02_mangos_spell_chain.sql \ 9244_02_mangos_spell_chain.sql \
9246_01_characters_character.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -480,4 +481,5 @@ EXTRA_DIST = \
9222_01_mangos_playercreateinfo_spell.sql \ 9222_01_mangos_playercreateinfo_spell.sql \
9244_01_mangos_spell_proc_event.sql \ 9244_01_mangos_spell_proc_event.sql \
9244_02_mangos_spell_chain.sql \ 9244_02_mangos_spell_chain.sql \
9246_01_characters_character.sql \
README README

View file

@ -1800,7 +1800,7 @@ void BattleGroundMgr::DistributeArenaPoints()
for (std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.begin(); plr_itr != PlayerPoints.end(); ++plr_itr) for (std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.begin(); plr_itr != PlayerPoints.end(); ++plr_itr)
{ {
//update to database //update to database
CharacterDatabase.PExecute("UPDATE characters SET arena_pending_points = '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first); CharacterDatabase.PExecute("UPDATE characters SET arenaPoints = arenaPoints + '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first);
//add points if player is online //add points if player is online
Player* pl = sObjectMgr.GetPlayer(plr_itr->first); Player* pl = sObjectMgr.GetPlayer(plr_itr->first);
if (pl) if (pl)

View file

@ -68,7 +68,11 @@ 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: 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` // !!! NOTE: including unused `zone`,`online`
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, 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, arena_pending_points FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid)); res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags,"
"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));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%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_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

@ -14555,8 +14555,16 @@ float Player::GetFloatValueFromDB(uint16 index, uint64 guid)
bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) 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 33 34 35 36 37 38 39 40 // 0 1 2 3 4 5 6 7 8 9 10 11 12
//QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, 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, arena_pending_points FROM characters WHERE guid = '%u'", guid); //SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags,"
// 13 14 15 16 17 18 19 20 21 22 23 24 25
//"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost,"
// 26 27 28 29 30 31 32 33 34 35 36 37 38 39
//"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));
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM); QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
if(!result) if(!result)
@ -14610,11 +14618,19 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt32Value(UNIT_FIELD_LEVEL, fields[7].GetUInt8()); SetUInt32Value(UNIT_FIELD_LEVEL, fields[7].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[8].GetUInt32()); SetUInt32Value(PLAYER_XP, fields[8].GetUInt32());
SetUInt32Value(PLAYER_FIELD_COINAGE, fields[9].GetUInt32());
uint32 money = fields[9].GetUInt32();
if(money > MAX_MONEY_AMOUNT)
money = MAX_MONEY_AMOUNT;
SetMoney(money);
SetUInt32Value(PLAYER_BYTES, fields[10].GetUInt32()); SetUInt32Value(PLAYER_BYTES, fields[10].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[11].GetUInt32()); SetUInt32Value(PLAYER_BYTES_2, fields[11].GetUInt32());
SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & ~1) | fields[6].GetUInt8()); SetUInt32Value(PLAYER_BYTES_3, (fields[50].GetUInt16() & 0xFFFE) | fields[6].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[12].GetUInt32()); SetUInt32Value(PLAYER_FLAGS, fields[12].GetUInt32());
SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[49].GetUInt32());
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[48].GetUInt64());
InitDisplayIds(); InitDisplayIds();
@ -14631,10 +14647,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
} }
} }
// update money limits
if(GetMoney() > MAX_MONEY_AMOUNT)
SetMoney(MAX_MONEY_AMOUNT);
sLog.outDebug("Load Basic value of player %s is: ", m_name.c_str()); sLog.outDebug("Load Basic value of player %s is: ", m_name.c_str());
outDebugValues(); outDebugValues();
@ -14666,7 +14678,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadArenaTeamInfo(holder->GetResult(PLAYER_LOGIN_QUERY_LOADARENAINFO)); _LoadArenaTeamInfo(holder->GetResult(PLAYER_LOGIN_QUERY_LOADARENAINFO));
uint32 arena_currency = GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY) + fields[40].GetUInt32(); uint32 arena_currency = GetUInt32Value(fields[40].GetUInt32());
if (arena_currency > sWorld.getConfig(CONFIG_MAX_ARENA_POINTS)) if (arena_currency > sWorld.getConfig(CONFIG_MAX_ARENA_POINTS))
arena_currency = sWorld.getConfig(CONFIG_MAX_ARENA_POINTS); arena_currency = sWorld.getConfig(CONFIG_MAX_ARENA_POINTS);
@ -14688,6 +14700,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arena_slot * ARENA_TEAM_END) + j, 0); SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arena_slot * ARENA_TEAM_END) + j, 0);
} }
SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, fields[41].GetUInt32());
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[42].GetUInt32());
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[43].GetUInt32());
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[44].GetUInt32());
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[45].GetUInt16());
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[46].GetUInt16());
_LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES)); _LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
if(!IsPositionValid()) if(!IsPositionValid())
@ -14917,8 +14936,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
std::string taxi_nodes = fields[38].GetCppString(); std::string taxi_nodes = fields[38].GetCppString();
delete result;
// clear channel spell data (if saved at channel spell casting) // clear channel spell data (if saved at channel spell casting)
SetChannelObjectGUID(0); SetChannelObjectGUID(0);
SetUInt32Value(UNIT_CHANNEL_SPELL,0); SetUInt32Value(UNIT_CHANNEL_SPELL,0);
@ -14947,12 +14964,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt64Value(PLAYER_DUEL_ARBITER, 0); SetUInt64Value(PLAYER_DUEL_ARBITER, 0);
SetUInt32Value(PLAYER_DUEL_TEAM, 0); SetUInt32Value(PLAYER_DUEL_TEAM, 0);
// remember loaded power/health values to restore after stats initialization and modifier applying
uint32 savedHealth = GetHealth();
uint32 savedPower[MAX_POWERS];
for(uint32 i = 0; i < MAX_POWERS; ++i)
savedPower[i] = GetPower(Powers(i));
// reset stats before loading any modifiers // reset stats before loading any modifiers
InitStatsForLevel(); InitStatsForLevel();
InitGlyphsForLevel(); InitGlyphsForLevel();
@ -15001,11 +15012,11 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES // check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
// note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded // note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded
if(uint32 curTitle = GetUInt32Value(PLAYER_CHOSEN_TITLE)) uint32 curTitle = fields[10].GetUInt32();
{ if (curTitle && !HasTitle(curTitle))
if(!HasTitle(curTitle)) curTitle = 0;
SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
} SetUInt32Value(PLAYER_CHOSEN_TITLE, curTitle);
// Not finish taxi flight path // Not finish taxi flight path
if(m_bgData.HasTaxiPath()) if(m_bgData.HasTaxiPath())
@ -15069,13 +15080,20 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
UpdateAllStats(); UpdateAllStats();
// restore remembered power/health values (but not more max values) // restore remembered power/health values (but not more max values)
SetHealth(savedHealth > GetMaxHealth() ? GetMaxHealth() : savedHealth); uint32 savedhealth = fields[51].GetUInt32();
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
for(uint32 i = 0; i < MAX_POWERS; ++i) for(uint32 i = 0; i < MAX_POWERS; ++i)
SetPower(Powers(i),savedPower[i] > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedPower[i]); {
uint32 savedpower = fields[52+i].GetUInt32();
SetPower(Powers(i),savedpower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedpower);
}
sLog.outDebug("The value of player %s after load item and aura is: ", m_name.c_str()); sLog.outDebug("The value of player %s after load item and aura is: ", m_name.c_str());
outDebugValues(); outDebugValues();
// all fields read
delete result;
// GM state // GM state
if(GetSession()->GetSecurity() > SEC_PLAYER) if(GetSession()->GetSecurity() > SEC_PLAYER)
{ {
@ -16116,7 +16134,9 @@ void Player::SaveToDB()
"taximask, online, cinematic, " "taximask, online, cinematic, "
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, " "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, " "trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
"death_expire_time, taxi_path, arena_pending_points) VALUES (" "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 ("
<< GetGUIDLow() << ", " << GetGUIDLow() << ", "
<< GetSession()->GetAccountId() << ", '" << GetSession()->GetAccountId() << ", '"
<< sql_name << "', " << sql_name << "', "
@ -16195,7 +16215,34 @@ void Player::SaveToDB()
ss << (uint64)m_deathExpireTime << ", '"; ss << (uint64)m_deathExpireTime << ", '";
ss << m_taxi.SaveTaxiDestinationsToString() << "', "; ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
ss << "'0' "; // arena_pending_points
ss << GetArenaPoints() << ", ";
ss << GetHonorPoints() << ", ";
ss << GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS) << ", ";
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 0) << ", ";
ss << GetUInt16Value(PLAYER_FIELD_KILLS, 1) << ", ";
ss << GetUInt32Value(PLAYER_CHOSEN_TITLE) << ", ";
ss << GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES) << ", ";
ss << GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX) << ", ";
ss << (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE) << ", ";
ss << GetHealth();
for(uint32 i = 0; i < MAX_POWERS; ++i)
ss << "," << GetPower(Powers(i));
ss << ")"; 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 "9245" #define REVISION_NR "9246"
#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_9136_07_characters_characters" #define REVISION_DB_CHARACTERS "required_9246_01_characters_character"
#define REVISION_DB_MANGOS "required_9244_02_mangos_spell_chain" #define REVISION_DB_MANGOS "required_9244_02_mangos_spell_chain"
#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__