Core/Player: Set max power values from PowerType.db2
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
--
|
||||
-- Table structure for table `power_type`
|
||||
--
|
||||
DROP TABLE IF EXISTS `power_type`;
|
||||
CREATE TABLE `power_type` (
|
||||
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`PowerTypeToken` text,
|
||||
`PowerCostToken` text,
|
||||
`RegenerationPeace` float NOT NULL DEFAULT '0',
|
||||
`RegenerationCombat` float NOT NULL DEFAULT '0',
|
||||
`MaxPower` smallint(6) NOT NULL DEFAULT '0',
|
||||
`RegenerationDelay` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`Flags` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`PowerTypeEnum` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`RegenerationMin` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`RegenerationCenter` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`RegenerationMax` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`UIModifier` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`VerifiedBuild` smallint(6) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
@@ -645,6 +645,10 @@ void HotfixDatabaseConnection::DoPrepareStatements()
|
||||
// PowerDisplay.db2
|
||||
PrepareStatement(HOTFIX_SEL_POWER_DISPLAY, "SELECT ID, GlobalStringBaseTag, PowerType, Red, Green, Blue FROM power_display ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
|
||||
// PowerType.db2
|
||||
PrepareStatement(HOTFIX_SEL_POWER_TYPE, "SELECT ID, PowerTypeToken, PowerCostToken, RegenerationPeace, RegenerationCombat, MaxPower, "
|
||||
"RegenerationDelay, Flags, PowerTypeEnum, RegenerationMin, RegenerationCenter, RegenerationMax, UIModifier FROM power_type ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
|
||||
// PvpDifficulty.db2
|
||||
PrepareStatement(HOTFIX_SEL_PVP_DIFFICULTY, "SELECT ID, MapID, BracketID, MinLevel, MaxLevel FROM pvp_difficulty ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
|
||||
@@ -858,8 +862,8 @@ void HotfixDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(HOTFIX_SEL_SUMMON_PROPERTIES, "SELECT ID, Category, Faction, Type, Slot, Flags FROM summon_properties ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
|
||||
// TactKey.db2
|
||||
PrepareStatement(HOTFIX_SEL_TACT_KEY, "SELECT ID, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key10, Key11, Key12, Key13, Key14, "
|
||||
"Key15, Key16 FROM tact_key ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
PrepareStatement(HOTFIX_SEL_TACT_KEY, "SELECT ID, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key10, Key11, Key12, Key13, Key14, Key15, "
|
||||
"Key16 FROM tact_key ORDER BY ID DESC", CONNECTION_SYNCH);
|
||||
|
||||
// Talent.db2
|
||||
PrepareStatement(HOTFIX_SEL_TALENT, "SELECT ID, SpellID, OverridesSpellID, Description, SpecID, TierID, ColumnIndex, Flags, CategoryMask1, "
|
||||
|
||||
@@ -349,6 +349,8 @@ enum HotfixDatabaseStatements
|
||||
|
||||
HOTFIX_SEL_POWER_DISPLAY,
|
||||
|
||||
HOTFIX_SEL_POWER_TYPE,
|
||||
|
||||
HOTFIX_SEL_PVP_DIFFICULTY,
|
||||
|
||||
HOTFIX_SEL_QUEST_FACTION_REWARD,
|
||||
|
||||
@@ -3973,7 +3973,7 @@ struct PowerTypeMeta
|
||||
{
|
||||
static DB2Meta const* Instance()
|
||||
{
|
||||
static char const* types = "ssffhhhbbbbb";
|
||||
static char const* types = "SSffhhhbbbbb";
|
||||
static uint8 const arraySizes[12] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
static DB2Meta instance(-1, 12, 0x042B76A1, types, arraySizes);
|
||||
return &instance;
|
||||
|
||||
@@ -159,6 +159,7 @@ DB2Storage<PhaseEntry> sPhaseStore("Phase.db2", PhaseMe
|
||||
DB2Storage<PhaseXPhaseGroupEntry> sPhaseXPhaseGroupStore("PhaseXPhaseGroup.db2", PhaseXPhaseGroupMeta::Instance(), HOTFIX_SEL_PHASE_X_PHASE_GROUP);
|
||||
DB2Storage<PlayerConditionEntry> sPlayerConditionStore("PlayerCondition.db2", PlayerConditionMeta::Instance(), HOTFIX_SEL_PLAYER_CONDITION);
|
||||
DB2Storage<PowerDisplayEntry> sPowerDisplayStore("PowerDisplay.db2", PowerDisplayMeta::Instance(), HOTFIX_SEL_POWER_DISPLAY);
|
||||
DB2Storage<PowerTypeEntry> sPowerTypeStore("PowerType.db2", PowerTypeMeta::Instance(), HOTFIX_SEL_POWER_TYPE);
|
||||
DB2Storage<PvPDifficultyEntry> sPvpDifficultyStore("PvpDifficulty.db2", PvpDifficultyMeta::Instance(), HOTFIX_SEL_PVP_DIFFICULTY);
|
||||
DB2Storage<QuestFactionRewardEntry> sQuestFactionRewardStore("QuestFactionReward.db2", QuestFactionRewardMeta::Instance(), HOTFIX_SEL_QUEST_FACTION_REWARD);
|
||||
DB2Storage<QuestMoneyRewardEntry> sQuestMoneyRewardStore("QuestMoneyReward.db2", QuestMoneyRewardMeta::Instance(), HOTFIX_SEL_QUEST_MONEY_REWARD);
|
||||
@@ -437,6 +438,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
|
||||
LOAD_DB2(sPhaseXPhaseGroupStore);
|
||||
LOAD_DB2(sPlayerConditionStore);
|
||||
LOAD_DB2(sPowerDisplayStore);
|
||||
LOAD_DB2(sPowerTypeStore);
|
||||
LOAD_DB2(sPvpDifficultyStore);
|
||||
LOAD_DB2(sQuestFactionRewardStore);
|
||||
LOAD_DB2(sQuestMoneyRewardStore);
|
||||
@@ -749,6 +751,14 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
|
||||
if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseID))
|
||||
_phasesByGroup[group->PhaseGroupID].insert(phase->ID);
|
||||
|
||||
for (PowerTypeEntry const* powerType : sPowerTypeStore)
|
||||
{
|
||||
ASSERT(powerType->PowerTypeEnum < MAX_POWERS);
|
||||
ASSERT(!_powerTypes[powerType->PowerTypeEnum]);
|
||||
|
||||
_powerTypes[powerType->PowerTypeEnum] = powerType;
|
||||
}
|
||||
|
||||
for (PvPDifficultyEntry const* entry : sPvpDifficultyStore)
|
||||
{
|
||||
ASSERT(entry->BracketID < MAX_BATTLEGROUND_BRACKETS, "PvpDifficulty bracket (%d) exceeded max allowed value (%d)", entry->BracketID, MAX_BATTLEGROUND_BRACKETS);
|
||||
@@ -1604,6 +1614,12 @@ std::set<uint32> DB2Manager::GetPhasesForGroup(uint32 group) const
|
||||
return std::set<uint32>();
|
||||
}
|
||||
|
||||
PowerTypeEntry const* DB2Manager::GetPowerTypeEntry(Powers power) const
|
||||
{
|
||||
ASSERT(power < MAX_POWERS);
|
||||
return _powerTypes[power];
|
||||
}
|
||||
|
||||
uint32 DB2Manager::GetRulesetItemUpgrade(uint32 itemId) const
|
||||
{
|
||||
auto itr = _rulesetItemUpgrade.find(itemId);
|
||||
|
||||
@@ -320,6 +320,7 @@ public:
|
||||
MountTypeXCapabilitySet const* GetMountCapabilities(uint32 mountType) const;
|
||||
ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale) const;
|
||||
std::set<uint32> GetPhasesForGroup(uint32 group) const;
|
||||
PowerTypeEntry const* GetPowerTypeEntry(Powers power) const;
|
||||
static PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
|
||||
static PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
|
||||
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID) const;
|
||||
@@ -373,6 +374,7 @@ private:
|
||||
NameGenContainer _nameGenData;
|
||||
NameValidationRegexContainer _nameValidators;
|
||||
PhaseGroupContainer _phasesByGroup;
|
||||
PowerTypeEntry const* _powerTypes[MAX_POWERS];
|
||||
QuestPackageItemContainer _questPackages;
|
||||
RulesetItemUpgradeContainer _rulesetItemUpgrade;
|
||||
SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
|
||||
|
||||
@@ -1957,6 +1957,23 @@ struct PowerDisplayEntry
|
||||
uint8 Blue;
|
||||
};
|
||||
|
||||
struct PowerTypeEntry
|
||||
{
|
||||
uint32 ID;
|
||||
char const* PowerTypeToken;
|
||||
char const* PowerCostToken;
|
||||
float RegenerationPeace;
|
||||
float RegenerationCombat;
|
||||
int16 MaxPower;
|
||||
uint16 RegenerationDelay;
|
||||
uint16 Flags;
|
||||
uint8 PowerTypeEnum;
|
||||
int8 RegenerationMin;
|
||||
int8 RegenerationCenter;
|
||||
int8 RegenerationMax;
|
||||
uint8 UIModifier;
|
||||
};
|
||||
|
||||
struct PvPDifficultyEntry
|
||||
{
|
||||
uint32 ID;
|
||||
|
||||
@@ -11101,47 +11101,11 @@ uint32 Unit::GetPowerIndex(uint32 powerType) const
|
||||
|
||||
int32 Unit::GetCreatePowers(Powers power) const
|
||||
{
|
||||
switch (power)
|
||||
{
|
||||
case POWER_MANA:
|
||||
return GetCreateMana();
|
||||
case POWER_RAGE:
|
||||
case POWER_PAIN:
|
||||
return 1000;
|
||||
case POWER_FOCUS:
|
||||
if (GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_HUNTER)
|
||||
return 100;
|
||||
return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
|
||||
case POWER_ENERGY:
|
||||
case POWER_FURY:
|
||||
return 100;
|
||||
case POWER_COMBO_POINTS:
|
||||
return 5;
|
||||
case POWER_RUNIC_POWER:
|
||||
return 1000;
|
||||
case POWER_RUNES:
|
||||
return 6;
|
||||
case POWER_SOUL_SHARDS:
|
||||
return 400;
|
||||
case POWER_LUNAR_POWER:
|
||||
return 100;
|
||||
case POWER_HOLY_POWER:
|
||||
return 3;
|
||||
case POWER_CHI:
|
||||
return 4;
|
||||
case POWER_INSANITY:
|
||||
return 3;
|
||||
case POWER_BURNING_EMBERS:
|
||||
return 40;
|
||||
case POWER_DEMONIC_FURY:
|
||||
return 1000;
|
||||
case POWER_ARCANE_CHARGES:
|
||||
return 4;
|
||||
case POWER_HEALTH:
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (power == POWER_MANA)
|
||||
return GetCreateMana();
|
||||
|
||||
if (PowerTypeEntry const* powerType = sDB2Manager.GetPowerTypeEntry(power))
|
||||
return powerType->MaxPower;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user