mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
Finally fix UnitMods and add more assertions.
This commit is contained in:
parent
a5ca883668
commit
9bfd741583
3 changed files with 10 additions and 5 deletions
|
|
@ -16158,7 +16158,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
||||||
uint32 savedhealth = fields[50].GetUInt32();
|
uint32 savedhealth = fields[50].GetUInt32();
|
||||||
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
|
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
|
||||||
|
|
||||||
for(uint32 i = 0; i < MAX_STORED_POWERS; ++i)
|
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
|
||||||
|
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
|
||||||
{
|
{
|
||||||
uint32 savedpower = fields[51 + i].GetUInt32();
|
uint32 savedpower = fields[51 + i].GetUInt32();
|
||||||
SetPowerByIndex(i, std::min(savedpower, GetMaxPowerByIndex(i)));
|
SetPowerByIndex(i, std::min(savedpower, GetMaxPowerByIndex(i)));
|
||||||
|
|
@ -17592,6 +17593,7 @@ void Player::SaveToDB()
|
||||||
|
|
||||||
uberInsert.addUInt32(GetHealth());
|
uberInsert.addUInt32(GetHealth());
|
||||||
|
|
||||||
|
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
|
||||||
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
|
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
|
||||||
uberInsert.addUInt32(GetPowerByIndex(i));
|
uberInsert.addUInt32(GetPowerByIndex(i));
|
||||||
|
|
||||||
|
|
@ -18267,7 +18269,8 @@ void Player::_SaveStats()
|
||||||
|
|
||||||
stmt.addUInt32(GetGUIDLow());
|
stmt.addUInt32(GetGUIDLow());
|
||||||
stmt.addUInt32(GetMaxHealth());
|
stmt.addUInt32(GetMaxHealth());
|
||||||
for (int i = 0; i < MAX_STORED_POWERS; ++i)
|
static_assert(MAX_STORED_POWERS == 5, "Query not updated.");
|
||||||
|
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
|
||||||
stmt.addUInt32(GetMaxPowerByIndex(i));
|
stmt.addUInt32(GetMaxPowerByIndex(i));
|
||||||
for (int i = 0; i < MAX_STATS; ++i)
|
for (int i = 0; i < MAX_STATS; ++i)
|
||||||
stmt.addFloat(GetStat(Stats(i)));
|
stmt.addFloat(GetStat(Stats(i)));
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ enum Powers
|
||||||
POWER_SOUL_SHARDS = 7,
|
POWER_SOUL_SHARDS = 7,
|
||||||
POWER_ECLIPSE = 8,
|
POWER_ECLIPSE = 8,
|
||||||
POWER_HOLY_POWER = 9,
|
POWER_HOLY_POWER = 9,
|
||||||
POWER_ALTERNATE = 10,
|
POWER_ALTERNATIVE = 10,
|
||||||
MAX_POWERS = 11,
|
MAX_POWERS = 11,
|
||||||
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
|
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ enum UnitMods
|
||||||
UNIT_MOD_SOUL_SHARDS,
|
UNIT_MOD_SOUL_SHARDS,
|
||||||
UNIT_MOD_ECLIPSE,
|
UNIT_MOD_ECLIPSE,
|
||||||
UNIT_MOD_HOLY_POWER,
|
UNIT_MOD_HOLY_POWER,
|
||||||
UNIT_MOD_ALTERNATE,
|
UNIT_MOD_ALTERNATIVE,
|
||||||
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum.
|
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existing order, it's accessed by index values of SpellSchools enum.
|
||||||
UNIT_MOD_RESISTANCE_HOLY,
|
UNIT_MOD_RESISTANCE_HOLY,
|
||||||
UNIT_MOD_RESISTANCE_FIRE,
|
UNIT_MOD_RESISTANCE_FIRE,
|
||||||
|
|
@ -358,9 +358,11 @@ enum UnitMods
|
||||||
UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR,
|
UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR,
|
||||||
UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1,
|
UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1,
|
||||||
UNIT_MOD_POWER_START = UNIT_MOD_MANA,
|
UNIT_MOD_POWER_START = UNIT_MOD_MANA,
|
||||||
UNIT_MOD_POWER_END = UNIT_MOD_RUNIC_POWER + 1
|
UNIT_MOD_POWER_END = UNIT_MOD_ALTERNATIVE + 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(UNIT_MOD_POWER_END - UNIT_MOD_POWER_START == MAX_POWERS, "Power-related UnitMods are not updated.");
|
||||||
|
|
||||||
enum BaseModGroup
|
enum BaseModGroup
|
||||||
{
|
{
|
||||||
CRIT_PERCENTAGE,
|
CRIT_PERCENTAGE,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue