aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DBCStores.cpp23
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.h2
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp17
-rw-r--r--src/server/game/Entities/Player/Player.cpp15
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h4
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp34
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h2
7 files changed, 50 insertions, 47 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index ffceb4e60aa..22c450e33d5 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -76,6 +76,7 @@ DBCStorage <CreatureModelDataEntry> sCreatureModelDataStore(CreatureModelDatafmt
DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt);
DBCStorage <CreatureTypeEntry> sCreatureTypeStore(CreatureTypefmt);
DBCStorage <CurrencyTypesEntry> sCurrencyTypesStore(CurrencyTypesfmt);
+uint32 PowersByClass[MAX_CLASSES][MAX_POWERS];
DBCStorage <DestructibleModelDataEntry> sDestructibleModelDataStore(DestructibleModelDatafmt);
DBCStorage <DungeonEncounterEntry> sDungeonEncounterStore(DungeonEncounterfmt);
@@ -345,6 +346,23 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sChrClassesStore, dbcPath, "ChrClasses.dbc");//14545
LoadDBC(availableDbcLocales, bad_dbc_files, sChrRacesStore, dbcPath, "ChrRaces.dbc");//14545
LoadDBC(availableDbcLocales, bad_dbc_files, sChrPowerTypesStore, dbcPath, "ChrClassesXPowerTypes.dbc");//14545
+ for (uint32 i = 0; i < MAX_CLASSES; ++i)
+ for (uint32 j = 0; j < MAX_POWERS; ++j)
+ PowersByClass[i][j] = MAX_POWERS;
+
+ for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
+ {
+ if (ChrPowerTypesEntry const* power = sChrPowerTypesStore.LookupEntry(i))
+ {
+ uint32 index = 0;
+ for (uint32 j = 0; j < MAX_POWERS; ++j)
+ if (PowersByClass[power->classId][j] != MAX_POWERS)
+ ++index;
+
+ PowersByClass[power->classId][power->power] = index;
+ }
+ }
+
LoadDBC(availableDbcLocales, bad_dbc_files, sCinematicSequencesStore, dbcPath, "CinematicSequences.dbc");//14545
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureDisplayInfoStore, dbcPath, "CreatureDisplayInfo.dbc");//14545
LoadDBC(availableDbcLocales, bad_dbc_files, sCreatureFamilyStore, dbcPath, "CreatureFamily.dbc");//14545
@@ -1044,6 +1062,11 @@ uint32 GetLiquidFlags(uint32 liquidType)
return 0;
}
+uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId)
+{
+ return PowersByClass[classId][powerType];
+}
+
uint32 ScalingStatValuesEntry::GetStatMultiplier(uint32 inventoryType) const
{
if (inventoryType < MAX_INVTYPE)
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index f669049be5c..98ae2aa5ff6 100755
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -73,6 +73,8 @@ uint32 GetLiquidFlags(uint32 liquidType);
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level);
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id);
+uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId);
+
extern DBCStorage <AchievementEntry> sAchievementStore;
extern DBCStorage <AchievementCriteriaEntry> sAchievementCriteriaStore;
extern DBCStorage <AreaTableEntry> sAreaStore;// recommend access using functions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 5e7f5984ac5..be690b52803 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1164,16 +1164,11 @@ void Creature::SelectLevel(const CreatureTemplate* cinfo)
{
case CLASS_WARRIOR:
setPowerType(POWER_RAGE);
- SetMaxPower(POWER_RAGE, GetCreatePowers(POWER_RAGE));
- SetPower(POWER_RAGE, GetCreatePowers(POWER_RAGE));
break;
case CLASS_ROGUE:
setPowerType(POWER_ENERGY);
- SetMaxPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
- SetPower(POWER_ENERGY, GetCreatePowers(POWER_ENERGY));
break;
default:
- setPowerType(POWER_MANA);
SetMaxPower(POWER_MANA, mana);
SetPower(POWER_MANA, mana);
break;
@@ -1183,15 +1178,15 @@ void Creature::SelectLevel(const CreatureTemplate* cinfo)
SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, (float)mana);
//damage
- float damagemod = 1.0f;//_GetDamageMod(rank);
+ //float damagemod = _GetDamageMod(rank); // Set during loading templates into dmg_multiplier field
- SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg * damagemod);
- SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg * damagemod);
+ SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg);
+ SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg);
- SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, cinfo->minrangedmg * damagemod);
- SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, cinfo->maxrangedmg * damagemod);
+ SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, cinfo->minrangedmg);
+ SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, cinfo->maxrangedmg);
- SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower * damagemod);
+ SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, cinfo->attackpower);
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2c350956c0a..6ce0c0f902b 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -964,15 +964,11 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
}
+
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);
- SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client
- SetFloatValue(UNIT_MOD_CAST_HASTE, 1.0f);
- SetFloatValue(PLAYER_FIELD_MOD_HASTE, 1.0f);
- SetFloatValue(PLAYER_FIELD_MOD_RANGED_HASTE, 1.0f);
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // default for players in 3.0.3
- // -1 is default value
- SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1));
+ SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); // -1 is default value
SetUInt32Value(PLAYER_BYTES, (createInfo->Skin | (createInfo->Face << 8) | (createInfo->HairStyle << 16) | (createInfo->HairColor << 24)));
SetUInt32Value(PLAYER_BYTES_2, (createInfo->FacialHair |
@@ -3284,13 +3280,17 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(index, 0);
SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, 0);
+ SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, 1.0f);
+ SetFloatValue(PLAYER_FIELD_MOD_HEALING_DONE_PCT, 1.0f);
for (uint8 i = 0; i < 7; ++i)
{
SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0);
SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, 0);
- SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i, 1.00f);
+ SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i, 1.0f);
}
+ SetFloatValue(PLAYER_FIELD_MOD_SPELL_POWER_PCT, 1.0f);
+
//reset attack power, damage and attack speed fields
SetFloatValue(UNIT_FIELD_BASEATTACKTIME, 2000.0f);
SetFloatValue(UNIT_FIELD_BASEATTACKTIME + 1, 2000.0f); // offhand attack time
@@ -3302,6 +3302,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, 0.0f);
SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, 0.0f);
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, 0.0f);
+ SetFloatValue(PLAYER_FIELD_WEAPON_DMG_MULTIPLIERS, 1.0f);
SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0);
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, 0.0f);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 0da557aff50..368a78d5539 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -2095,7 +2095,9 @@ class Player : public Unit, public GridObject<Player>
float OCTRegenMPPerSpirit();
float GetRatingMultiplier(CombatRating cr) const;
float GetRatingBonusValue(CombatRating cr) const;
- uint32 GetBaseSpellPowerBonus() { return m_baseSpellPower; }
+
+ /// Returns base spellpower bonus from spellpower stat on items, without spellpower from intellect stat
+ uint32 GetBaseSpellPowerBonus() const { return m_baseSpellPower; }
int32 GetSpellPenetrationItemMod() const { return m_spellPenetrationItemMod; }
float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 58bc4c541e6..1c583e4937e 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -9689,6 +9689,10 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
// Base value
DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
+ // Check if we are ever using mana - PaperDollFrame.lua
+ if (GetPowerIndexByClass(POWER_MANA, getClass()) != MAX_POWERS)
+ DoneAdvertisedBenefit += std::max(0, int32(GetStat(STAT_INTELLECT)) - 10); // spellpower from intellect
+
// Damage bonus from stats
AuraEffectList const& mDamageDoneOfStatPercent = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
@@ -10211,6 +10215,10 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
// Base value
AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
+ // Check if we are ever using mana - PaperDollFrame.lua
+ if (GetPowerIndexByClass(POWER_MANA, getClass()) != MAX_POWERS)
+ AdvertisedBenefit += std::max(0, int32(GetStat(STAT_INTELLECT)) - 10); // spellpower from intellect
+
// Healing bonus from stats
AuraEffectList const& mHealingDoneOfStatPercent = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
@@ -12799,32 +12807,6 @@ void Unit::SetMaxHealth(uint32 val)
SetHealth(val);
}
-uint32 Unit::GetPowerIndexByClass(uint32 powerId, uint32 classId) const
-{
- ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(classId);
-
- ASSERT(classEntry && "Class not found");
-
- uint32 index = 0;
- for (uint32 i = 0; i <= sChrPowerTypesStore.GetNumRows(); ++i)
- {
- ChrPowerTypesEntry const* powerEntry = sChrPowerTypesStore.LookupEntry(i);
- if (!powerEntry)
- continue;
-
- if (powerEntry->classId != classId)
- continue;
-
- if (powerEntry->power == powerId)
- return index;
-
- ++index;
- }
-
- // return invalid value - this class doesn't use this power
- return MAX_POWERS;
-};
-
int32 Unit::GetPower(Powers power) const
{
uint32 powerIndex = GetPowerIndexByClass(power, getClass());
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 60bf93e312d..3f79c8430b3 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1359,8 +1359,6 @@ class Unit : public WorldObject
int32 ModifyPower(Powers power, int32 val);
int32 ModifyPowerPct(Powers power, float pct, bool apply = true);
- uint32 GetPowerIndexByClass(uint32 powerId, uint32 classId) const;
-
uint32 GetAttackTime(WeaponAttackType att) const
{
float f_BaseAttackTime = GetFloatValue(UNIT_FIELD_BASEATTACKTIME+att) / m_modAttackSpeedPct[att];