New hook OnBeforeUpdateAttackPowerAndDamage

This commit is contained in:
Matteo Emili
2017-01-23 02:27:50 +01:00
committed by Yehonal
parent f3b2dd4f1f
commit 15b1a99b55
3 changed files with 9 additions and 0 deletions
+1
View File
@@ -312,6 +312,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
{ {
float val2 = 0.0f; float val2 = 0.0f;
float level = float(getLevel()); float level = float(getLevel());
sScriptMgr->OnBeforeUpdateAttackPowerAndDamage(this, level, ranged);
UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER; UnitMods unitMod = ranged ? UNIT_MOD_ATTACK_POWER_RANGED : UNIT_MOD_ATTACK_POWER;
+5
View File
@@ -1555,6 +1555,11 @@ void ScriptMgr::OnAfterUpdateMaxHealth(Player* player, float& value)
FOREACH_SCRIPT(PlayerScript)->OnAfterUpdateMaxHealth(player, value); FOREACH_SCRIPT(PlayerScript)->OnAfterUpdateMaxHealth(player, value);
} }
void ScriptMgr::OnBeforeUpdateAttackPowerAndDamage(Player* player, float& level, bool ranged)
{
FOREACH_SCRIPT(PlayerScript)->OnBeforeUpdateAttackPowerAndDamage(player, level, ranged);
}
AllMapScript::AllMapScript(const char* name) AllMapScript::AllMapScript(const char* name)
: ScriptObject(name) : ScriptObject(name)
{ {
+3
View File
@@ -894,6 +894,8 @@ class PlayerScript : public ScriptObject
virtual void OnAfterUpdateMaxHealth(Player* /*player*/, float& /*value*/) { } virtual void OnAfterUpdateMaxHealth(Player* /*player*/, float& /*value*/) { }
virtual void OnBeforeUpdateAttackPowerAndDamage(Player* /*player*/, float& /*level*/, bool /*ranged*/) { }
}; };
class GuildScript : public ScriptObject class GuildScript : public ScriptObject
@@ -1207,6 +1209,7 @@ class ScriptMgr
void OnAfterStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32 &item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore); void OnAfterStoreOrEquipNewItem(Player* player, uint32 vendorslot, uint32 &item, uint8 count, uint8 bag, uint8 slot, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore);
void OnAfterUpdateMaxPower(Player* player, Powers& power, float& value); void OnAfterUpdateMaxPower(Player* player, Powers& power, float& value);
void OnAfterUpdateMaxHealth(Player* player, float& value); void OnAfterUpdateMaxHealth(Player* player, float& value);
void OnBeforeUpdateAttackPowerAndDamage(Player* player, float& level, bool ranged);
public: /* GuildScript */ public: /* GuildScript */