Skip to content

Commit

Permalink
Add Holy Power
Browse files Browse the repository at this point in the history
  • Loading branch information
zergtmn committed May 16, 2011
1 parent da9687b commit 554c048
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
6 changes: 4 additions & 2 deletions sql/400/01_characters.sql
@@ -1,7 +1,9 @@
alter table `characters`.`characters`
add column `power8` int(10) UNSIGNED DEFAULT '0' NOT NULL after `power7`,
add column `power9` int(10) UNSIGNED DEFAULT '0' NOT NULL after `power8`;
add column `power9` int(10) UNSIGNED DEFAULT '0' NOT NULL after `power8`,
add column `power10` int(10) UNSIGNED DEFAULT '0' NOT NULL after `power9`;

alter table `characters`.`character_stats`
add column `maxpower8` int(10) UNSIGNED DEFAULT '0' NOT NULL after `maxpower7`,
add column `maxpower9` int(10) UNSIGNED DEFAULT '0' NOT NULL after `maxpower8`;
add column `maxpower9` int(10) UNSIGNED DEFAULT '0' NOT NULL after `maxpower8`,
add column `maxpower10` int(10) UNSIGNED DEFAULT '0' NOT NULL after `maxpower9`;
6 changes: 6 additions & 0 deletions sql/characters.sql
Expand Up @@ -250,6 +250,9 @@ CREATE TABLE `characters` (
`power5` int(10) UNSIGNED NOT NULL default '0',
`power6` int(10) UNSIGNED NOT NULL default '0',
`power7` int(10) UNSIGNED NOT NULL default '0',
`power8` int(10) UNSIGNED NOT NULL default '0',
`power9` int(10) UNSIGNED NOT NULL default '0',
`power10` int(10) UNSIGNED NOT NULL default '0',
`specCount` tinyint(3) UNSIGNED NOT NULL default '1',
`activeSpec` tinyint(3) UNSIGNED NOT NULL default '0',
`exploredZones` longtext,
Expand Down Expand Up @@ -899,6 +902,9 @@ CREATE TABLE `character_stats` (
`maxpower5` int(10) UNSIGNED NOT NULL default '0',
`maxpower6` int(10) UNSIGNED NOT NULL default '0',
`maxpower7` int(10) UNSIGNED NOT NULL default '0',
`maxpower8` int(10) UNSIGNED NOT NULL default '0',
`maxpower9` int(10) UNSIGNED NOT NULL default '0',
`maxpower10` int(10) UNSIGNED NOT NULL default '0',
`strength` int(10) UNSIGNED NOT NULL default '0',
`agility` int(10) UNSIGNED NOT NULL default '0',
`stamina` int(10) UNSIGNED NOT NULL default '0',
Expand Down
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, power8, power9, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", m_guid.GetCounter());
"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", m_guid.GetCounter());
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT groupId FROM group_member WHERE memberGuid ='%u'", m_guid.GetCounter());
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", m_guid.GetCounter());
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,item_guid,spell,stackcount,remaincharges,basepoints0,basepoints1,basepoints2,periodictime0,periodictime1,periodictime2,maxduration,remaintime,effIndexMask FROM character_aura WHERE guid = '%u'", m_guid.GetCounter());
Expand Down
27 changes: 14 additions & 13 deletions src/game/Player.cpp
Expand Up @@ -2800,7 +2800,7 @@ void Player::InitStatsForLevel(bool reapplyMods)

// save new stats
for (int i = POWER_MANA; i < MAX_POWERS; ++i)
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));

SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later

Expand Down Expand Up @@ -15308,8 +15308,8 @@ bool Player::LoadFromDB(ObjectGuid 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 64 65 66
//"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
//"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, 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 @@ -15359,8 +15359,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());

_LoadIntoDataField(fields[62].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
_LoadIntoDataField(fields[65].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
_LoadIntoDataField(fields[63].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
_LoadIntoDataField(fields[66].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);

InitDisplayIds(); // model, scale and model data

Expand All @@ -15387,10 +15387,10 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )

//SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());

//SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32());
//SetUInt32Value(PLAYER_AMMO_ID, fields[63].GetUInt32());

// Action bars state
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8());
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[65].GetUInt8());

// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
for(uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
Expand Down Expand Up @@ -15721,8 +15721,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
_LoadMailedItems(holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS));
UpdateNextMailTimeAndUnreads();

m_specsCount = fields[60].GetUInt8();
m_activeSpec = fields[61].GetUInt8();
m_specsCount = fields[61].GetUInt8();
m_activeSpec = fields[62].GetUInt8();

_LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));

Expand Down Expand Up @@ -15832,6 +15832,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder *holder )
// restore remembered power/health values (but not more max values)
uint32 savedhealth = fields[50].GetUInt32();
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);

for(uint32 i = 0; i < MAX_POWERS; ++i)
{
uint32 savedpower = fields[51+i].GetUInt32();
Expand Down Expand Up @@ -17152,15 +17153,15 @@ 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, power8, power9, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES ("
"power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) VALUES ("
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, "
"?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");

uberInsert.addUInt32(GetGUIDLow());
uberInsert.addUInt32(GetSession()->GetAccountId());
Expand Down Expand Up @@ -17928,10 +17929,10 @@ void Player::_SaveStats()
SqlStatement stmt = CharacterDatabase.CreateStatement(delStats, "DELETE FROM character_stats WHERE guid = ?");
stmt.PExecute(GetGUIDLow());

stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, "
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10"
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) "
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(GetMaxHealth());
Expand Down
3 changes: 2 additions & 1 deletion src/game/SharedDefines.h
Expand Up @@ -153,10 +153,11 @@ enum Powers
POWER_RUNIC_POWER = 6,
POWER_SOUL_SHARDS = 7,
POWER_ECLIPSE = 8,
POWER_HOLY_POWER = 9,
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
};

#define MAX_POWERS 9
#define MAX_POWERS 10

enum SpellSchools
{
Expand Down
1 change: 1 addition & 0 deletions src/game/Unit.cpp
Expand Up @@ -9364,6 +9364,7 @@ uint32 Unit::GetCreatePowers( Powers power ) const
case POWER_RUNIC_POWER: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 1000 : 0);
case POWER_SOUL_SHARDS: return 0; // TODO: fix me
case POWER_ECLIPSE: return 0; // TODO: fix me
case POWER_HOLY_POWER: return 0;
}

return 0;
Expand Down

0 comments on commit 554c048

Please sign in to comment.