aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/ItemPrototype.h23
-rw-r--r--src/game/Player.cpp14
-rw-r--r--src/shared/revision_nr.h2
3 files changed, 29 insertions, 10 deletions
diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h
index 07264f00043..c23c0d5978c 100644
--- a/src/game/ItemPrototype.h
+++ b/src/game/ItemPrototype.h
@@ -630,6 +630,29 @@ struct ItemPrototype
}
uint32 GetMaxStackSize() const { return Stackable > 0 ? uint32(Stackable) : uint32(0x7FFFFFFF-1); }
+
+ float getDPS() const
+ {
+ if (Delay == 0)
+ return 0;
+ float temp = 0;
+ for (int i=0;i<5;++i)
+ temp+=Damage[i].DamageMin + Damage[i].DamageMax;
+ return temp*500/Delay;
+ }
+
+ int32 getFeralBonus() const
+ {
+ // 0x02A5F3 - is mask for Melee weapon from ItemSubClassMask.dbc
+ if (Class == ITEM_CLASS_WEAPON && (1<<SubClass)&0x02A5F3)
+ {
+ int32 bonus = int32(getDPS()*14.0f) - 767;
+ if (bonus < 0)
+ return 0;
+ return bonus;
+ }
+ return 0;
+ }
};
struct ItemLocale
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index c6ac1f2be58..d3db16934f7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -6998,16 +6998,12 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
SetBaseWeaponDamage(attType, MAXDAMAGE, damage);
}
- if (proto->Class == ITEM_CLASS_WEAPON && proto->Delay)
+ // Druids get feral AP bonus from weapon dps
+ if(getClass() == CLASS_DRUID)
{
- // Druids get feral AP bonus from weapon dps
- if(getClass() == CLASS_DRUID && (slot==EQUIPMENT_SLOT_MAINHAND || slot==EQUIPMENT_SLOT_OFFHAND))
- {
- float dps = (proto->Damage[0].DamageMin + proto->Damage[0].DamageMax)/(2*proto->Delay/1000.0f);
- int32 feral_bonus = int32(dps*14.0f) - 767;
- if (feral_bonus > 0)
- ApplyFeralAPBonus(feral_bonus, apply);
- }
+ int32 feral_bonus = proto->getFeralBonus();
+ if (feral_bonus > 0)
+ ApplyFeralAPBonus(feral_bonus, apply);
}
if(!IsUseEquipedWeapon(slot==EQUIPMENT_SLOT_MAINHAND))
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index 04871acce89..048435dc33b 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "7264"
+ #define REVISION_NR "7265"
#endif // __REVISION_NR_H__