Core/Players: Fixed power slot ordering
This commit is contained in:
@@ -1425,6 +1425,7 @@ CREATE TABLE `character_stats` (
|
||||
`maxpower3` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxpower4` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxpower5` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`maxpower6` 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',
|
||||
@@ -1627,6 +1628,7 @@ CREATE TABLE `characters` (
|
||||
`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',
|
||||
`latency` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`talentGroupsCount` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
`activeTalentGroup` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE `characters` ADD `power6` int(10) unsigned NOT NULL DEFAULT '0' AFTER `power5`;
|
||||
ALTER TABLE `character_stats` ADD `maxpower6` int(10) unsigned NOT NULL DEFAULT '0' AFTER `maxpower5`;
|
||||
@@ -287,6 +287,7 @@ void DB2Manager::LoadStores(std::string const& dataPath)
|
||||
for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
|
||||
_charStartOutfits[outfit->RaceID | (outfit->ClassID << 8) | (outfit->GenderID << 16)] = outfit;
|
||||
|
||||
sChrClassesXPowerTypesStore.Sort(&ChrClassesXPowerTypesEntryComparator::Compare);
|
||||
for (uint32 i = 0; i < MAX_CLASSES; ++i)
|
||||
for (uint32 j = 0; j < MAX_POWERS; ++j)
|
||||
_powersByClass[i][j] = MAX_POWERS;
|
||||
@@ -784,14 +785,21 @@ std::vector<SpellPowerEntry const*> DB2Manager::GetSpellPowers(uint32 spellId, D
|
||||
return powers;
|
||||
}
|
||||
|
||||
bool DB2Manager::GlyphSlotEntryComparator::operator()(GlyphSlotEntry const* left, GlyphSlotEntry const* right) const
|
||||
bool DB2Manager::ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
|
||||
{
|
||||
if (left->ClassID != right->ClassID)
|
||||
return left->ClassID < right->ClassID;
|
||||
return left->PowerType < right->PowerType;
|
||||
}
|
||||
|
||||
bool DB2Manager::GlyphSlotEntryComparator::Compare(GlyphSlotEntry const* left, GlyphSlotEntry const* right)
|
||||
{
|
||||
if (left->Tooltip != right->Tooltip)
|
||||
return left->Tooltip < right->Tooltip;
|
||||
return left->Type > right->Type;
|
||||
}
|
||||
|
||||
bool DB2Manager::MountTypeXCapabilityEntryComparator::operator()(MountTypeXCapabilityEntry const* left, MountTypeXCapabilityEntry const* right) const
|
||||
bool DB2Manager::MountTypeXCapabilityEntryComparator::Compare(MountTypeXCapabilityEntry const* left, MountTypeXCapabilityEntry const* right)
|
||||
{
|
||||
if (left->MountTypeID == right->MountTypeID)
|
||||
return left->OrderIndex > right->OrderIndex;
|
||||
|
||||
@@ -115,12 +115,14 @@ typedef std::vector<HotfixNotify> HotfixData;
|
||||
#define DEFINE_DB2_SET_COMPARATOR(structure) \
|
||||
struct structure ## Comparator : public std::binary_function<structure const*, structure const*, bool> \
|
||||
{ \
|
||||
bool operator()(structure const* left, structure const* right) const; \
|
||||
bool operator()(structure const* left, structure const* right) const { return Compare(left, right); } \
|
||||
static bool Compare(structure const* left, structure const* right); \
|
||||
};
|
||||
|
||||
class DB2Manager
|
||||
{
|
||||
public:
|
||||
DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry);
|
||||
DEFINE_DB2_SET_COMPARATOR(GlyphSlotEntry);
|
||||
DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ char const AuctionHouseFormat[] = "niiis";
|
||||
char const BarberShopStyleFormat[] = "nissfiii";
|
||||
char const BroadcastTextFormat[] = "nissiiiiiiiii";
|
||||
char const CharStartOutfitFormat[] = "nbbbbiiiiiiiiiiiiiiiiiiiiiiiiii";
|
||||
char const ChrClassesXPowerTypesFormat[] = "nii";
|
||||
char const ChrClassesXPowerTypesFormat[] = "iii";
|
||||
char const CinematicSequencesFormat[] = "niiiiiiiii";
|
||||
char const CreatureDisplayInfoFormat[] = "niiiffissssiiiiiiiiiii";
|
||||
char const CreatureTypeFormat[] = "nsi";
|
||||
|
||||
@@ -2414,7 +2414,7 @@ void Player::Regenerate(Powers power)
|
||||
|
||||
// Skip regeneration for power type we cannot have
|
||||
uint32 powerIndex = GetPowerIndex(power);
|
||||
if (powerIndex == MAX_POWERS)
|
||||
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
|
||||
return;
|
||||
|
||||
float addvalue = 0.0f;
|
||||
|
||||
@@ -11505,7 +11505,7 @@ void Unit::SetMaxHealth(uint32 val)
|
||||
int32 Unit::GetPower(Powers power) const
|
||||
{
|
||||
uint32 powerIndex = GetPowerIndex(power);
|
||||
if (powerIndex == MAX_POWERS)
|
||||
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
|
||||
return 0;
|
||||
|
||||
return GetUInt32Value(UNIT_FIELD_POWER + powerIndex);
|
||||
@@ -11514,7 +11514,7 @@ int32 Unit::GetPower(Powers power) const
|
||||
int32 Unit::GetMaxPower(Powers power) const
|
||||
{
|
||||
uint32 powerIndex = GetPowerIndex(power);
|
||||
if (powerIndex == MAX_POWERS)
|
||||
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
|
||||
return 0;
|
||||
|
||||
return GetInt32Value(UNIT_FIELD_MAXPOWER + powerIndex);
|
||||
@@ -11523,7 +11523,7 @@ int32 Unit::GetMaxPower(Powers power) const
|
||||
void Unit::SetPower(Powers power, int32 val)
|
||||
{
|
||||
uint32 powerIndex = GetPowerIndex(power);
|
||||
if (powerIndex == MAX_POWERS)
|
||||
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
|
||||
return;
|
||||
|
||||
int32 maxPower = int32(GetMaxPower(power));
|
||||
@@ -11557,7 +11557,7 @@ void Unit::SetPower(Powers power, int32 val)
|
||||
void Unit::SetMaxPower(Powers power, int32 val)
|
||||
{
|
||||
uint32 powerIndex = GetPowerIndex(power);
|
||||
if (powerIndex == MAX_POWERS)
|
||||
if (powerIndex == MAX_POWERS || powerIndex >= MAX_POWERS_PER_CLASS)
|
||||
return;
|
||||
|
||||
int32 cur_power = GetPower(power);
|
||||
|
||||
@@ -267,7 +267,7 @@ enum Powers // (6.0)
|
||||
POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value)
|
||||
};
|
||||
|
||||
#define MAX_POWERS_PER_CLASS 5
|
||||
#define MAX_POWERS_PER_CLASS 6
|
||||
|
||||
enum SpellSchools : uint16
|
||||
{
|
||||
|
||||
@@ -181,6 +181,14 @@ public:
|
||||
DB2DatabaseLoader(_fileName).LoadStrings(_format, _hotfixStatement + 1, locale, _indexTable.AsChar, _stringPoolList);
|
||||
}
|
||||
|
||||
typedef bool(*SortFunc)(T const* left, T const* right);
|
||||
|
||||
void Sort(SortFunc pred)
|
||||
{
|
||||
ASSERT(strpbrk(_format, "nd") == nullptr, "Only non-indexed storages can be sorted");
|
||||
std::sort(_indexTable.AsT, _indexTable.AsT + _indexTableSize, pred);
|
||||
}
|
||||
|
||||
iterator begin() { return iterator(_indexTable.AsT, _indexTableSize); }
|
||||
iterator end() { return iterator(_indexTable.AsT, _indexTableSize, _indexTableSize); }
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ public:
|
||||
{
|
||||
if (_pos < _end)
|
||||
{
|
||||
do
|
||||
while (_pos < _end && !_index[_pos])
|
||||
++_pos;
|
||||
while (_pos < _end && !_index[_pos]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, "
|
||||
"resettalents_time, talentTree, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, "
|
||||
"totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, "
|
||||
"health, power1, power2, power3, power4, power5, instance_id, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, raidDifficulty, legacyRaidDifficulty "
|
||||
"health, power1, power2, power3, power4, power5, power6, instance_id, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels, raidDifficulty, legacyRaidDifficulty "
|
||||
"FROM characters WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
PrepareStatement(CHAR_SEL_GROUP_MEMBER, "SELECT guid FROM group_member WHERE memberGuid = ?", CONNECTION_BOTH);
|
||||
@@ -393,13 +393,13 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"extra_flags, stable_slots, at_login, zone, "
|
||||
"death_expire_time, taxi_path, totalKills, "
|
||||
"todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, "
|
||||
"power4, power5, latency, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels) VALUES "
|
||||
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
|
||||
"power4, power5, power6, latency, talentGroupsCount, activeTalentGroup, exploredZones, equipmentCache, knownTitles, actionBars, grantableLevels) VALUES "
|
||||
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,playerBytes=?,playerBytes2=?,playerFlags=?,"
|
||||
"map=?,instance_id=?,dungeonDifficulty=?,raidDifficulty=?,legacyRaidDifficulty=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?,"
|
||||
"logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,talentTree=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?,"
|
||||
"totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?,"
|
||||
"watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,latency=?,talentGroupsCount=?,activeTalentGroup=?,exploredZones=?,"
|
||||
"watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,latency=?,talentGroupsCount=?,activeTalentGroup=?,exploredZones=?,"
|
||||
"equipmentCache=?,knownTitles=?,actionBars=?,grantableLevels=?,online=? WHERE guid=?", CONNECTION_ASYNC);
|
||||
|
||||
PrepareStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG, "UPDATE characters SET at_login = at_login | ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
@@ -573,9 +573,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_UPD_CHAR_SKILLS, "UPDATE character_skills SET value = ?, max = ? WHERE guid = ? AND skill = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_CHAR_SPELL, "INSERT INTO character_spell (guid, spell, active, disabled) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CHAR_STATS, "DELETE FROM character_stats WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_CHAR_STATS, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, strength, agility, stamina, intellect, spirit, "
|
||||
PrepareStatement(CHAR_INS_CHAR_STATS, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, strength, agility, stamina, intellect, spirit, "
|
||||
"armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, "
|
||||
"spellPower, resilience) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
"spellPower, resilience) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_PETITION_BY_OWNER, "DELETE FROM petition WHERE ownerguid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER, "DELETE FROM petition_sign WHERE ownerguid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_CHAR_GLYPHS, "INSERT INTO character_glyphs (guid, talentGroup, glyph1, glyph2, glyph3, glyph4, glyph5, glyph6) VALUES(?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
|
||||
Reference in New Issue
Block a user