aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-05-11 23:46:45 +0200
committerQAston <none@none>2009-05-11 23:46:45 +0200
commit51b5f2aa640d08d547e3b6de4831f9bb02e870fd (patch)
treeb8cf57947ed23fc4bb4ff4d1257e5769b0cd9a68 /src
parent95504364e04b33345d7c7251383eb719ab64bf8c (diff)
*Allow Hots to proc-this should fix talents like 33776 effect from hots.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp9
-rw-r--r--src/game/Player.h2
-rw-r--r--src/game/SpellAuras.cpp29
-rw-r--r--src/game/SpellMgr.cpp37
-rw-r--r--src/game/SpellMgr.h4
-rw-r--r--src/game/Unit.cpp64
6 files changed, 88 insertions, 57 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 9eb97ee295c..4ebd4f03684 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -6991,15 +6991,8 @@ void Player::UpdateEquipSpellsAtFormChange()
}
}
-void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo)
+void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
{
- if(!item || item->IsBroken())
- return;
-
- ItemPrototype const *proto = item->GetProto();
- if(!proto)
- return;
-
Unit * Target = damageInfo->target;
WeaponAttackType attType = damageInfo->attackType;
diff --git a/src/game/Player.h b/src/game/Player.h
index fbe365173dc..27e088f5131 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1797,7 +1797,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
void UpdateEquipSpellsAtFormChange();
- void CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo);
+ void CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto);
void SendInitWorldStates(bool force = false, uint32 forceZoneId = 0);
void SendUpdateWorldState(uint32 Field, uint32 Value);
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 8c9c640c86b..96c73cf8732 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -5440,12 +5440,13 @@ void Aura::PeriodicTick()
SpellEntry const* spellProto = GetSpellProto();
// Set trigger flag
- uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
- uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
+ uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
+ uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
+ uint32 procEx = PROC_EX_INTERNAL_DOT;
pdamage = (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
if (pdamage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
- pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
+ pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, true);
break;
@@ -5560,12 +5561,13 @@ void Aura::PeriodicTick()
float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1;
// Set trigger flag
- uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
- uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
+ uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
+ uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
+ uint32 procEx = PROC_EX_INTERNAL_DOT;
pdamage = (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist);
if (pdamage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
- pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
+ pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
int32 new_damage = pCaster->DealDamage(target, pdamage, &cleanDamage, DOT, GetSpellSchoolMask(spellProto), spellProto, false);
if (!target->isAlive() && pCaster->IsNonMeleeSpellCasted(false))
@@ -5670,11 +5672,12 @@ void Aura::PeriodicTick()
}
}
- uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HEAL;
- uint32 procVictim = 0;//ROC_FLAG_ON_TAKE_PERIODIC | PROC_FLAG_TAKEN_HEAL;
+ uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
+ uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
+ uint32 procEx = PROC_EX_INTERNAL_HOT;
// ignore item heals
-// if(procSpell && !haveCastItem)
-// pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, PROC_EX_NORMAL_HIT, pdamage, BASE_ATTACK, spellProto);
+ if(procSpell && !haveCastItem)
+ pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, pdamage, BASE_ATTACK, spellProto);
break;
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
@@ -5863,9 +5866,9 @@ void Aura::PeriodicTick()
pCaster->SendSpellNonMeleeDamageLog(&damageInfo);
// Set trigger flag
- uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
- uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;// | PROC_FLAG_TAKEN_HARMFUL_SPELL_HIT;
- uint32 procEx = createProcExtendMask(&damageInfo, SPELL_MISS_NONE);
+ uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;
+ uint32 procVictim = PROC_FLAG_ON_TAKE_PERIODIC;
+ uint32 procEx = createProcExtendMask(&damageInfo, SPELL_MISS_NONE) | PROC_EX_INTERNAL_DOT;
if (damageInfo.damage)
procVictim|=PROC_FLAG_TAKEN_ANY_DAMAGE;
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 3a22efd71d6..55c45209583 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1213,6 +1213,41 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellP
if((procFlags & EventProcFlag) == 0)
return false;
+ /* Check Periodic Auras
+
+ * Both hots and dots can trigger if spell has no PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
+ nor PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT
+
+ *Only Hots can trigger if spell has PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
+
+ *Only dots can trigger if spell has both positivity flags or PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT
+
+ */
+
+ if (EventProcFlag & PROC_FLAG_ON_DO_PERIODIC)
+ {
+ if (procFlags & PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT)
+ {
+ if (!(procExtra & PROC_EX_INTERNAL_DOT))
+ return false;
+ }
+ else if (procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL
+ && !(procExtra & PROC_EX_INTERNAL_HOT))
+ return false;
+ }
+
+ if (EventProcFlag & PROC_FLAG_ON_TAKE_PERIODIC)
+ {
+ if (procFlags & PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT)
+ {
+ if (!(procExtra & PROC_EX_INTERNAL_DOT))
+ return false;
+ }
+ else if (procFlags & PROC_FLAG_TAKEN_POSITIVE_SPELL
+ && !(procExtra & PROC_EX_INTERNAL_HOT))
+ return false;
+ }
+
// Always trigger for this
if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL_AND_GET_XP))
return true;
@@ -1337,7 +1372,7 @@ void SpellMgr::LoadSpellEnchantProcData()
uint32 count = 0;
// 0 1 2 3
- QueryResult *result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx");
+ QueryResult *result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if( !result )
{
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 749abab0efb..aeba2deb068 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -547,7 +547,9 @@ enum ProcFlagsEx
PROC_EX_RESERVED2 = 0x0004000,
PROC_EX_RESERVED3 = 0x0008000,
PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges
- PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000 // If set trigger always but only one time
+ PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time
+ PROC_EX_INTERNAL_HOT = 0x1000000, // Only for internal use
+ PROC_EX_INTERNAL_DOT = 0x2000000 // Only for internal use
};
struct SpellProcEventEntry
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 7117449ae34..d0b71d0f3a3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -1615,41 +1615,39 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
{
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
{
- EquipmentSlots slot = (EquipmentSlots)i;
- // For weapon slots check if valid attack type and if weapon useable
- if (i == EQUIPMENT_SLOT_MAINHAND
- || i == EQUIPMENT_SLOT_OFFHAND
- || i == EQUIPMENT_SLOT_RANGED)
- {
- switch (damageInfo->attackType)
- {
- case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
- case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
- case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
- default:
- slot=EQUIPMENT_SLOT_END;
- }
- // offhand item cannot proc from main hand hit etc
- if (slot != i)
- slot=EQUIPMENT_SLOT_END;
- else
- {
- // Check if item is useable (forms or disarm)
- if (damageInfo->attackType == BASE_ATTACK)
- {
- if (!((Player*)this)->IsUseEquipedWeapon(true))
- slot=EQUIPMENT_SLOT_END;
- }
- else if (damageInfo->attackType == OFF_ATTACK)
+ // If usable, try to cast item spell
+ if (Item * item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i))
+ if(!item->IsBroken())
+ if (ItemPrototype const *proto = item->GetProto())
{
- if (((Player*)this)->IsInFeralForm())
- slot=EQUIPMENT_SLOT_END;
+ // Additional check for weapons
+ if (proto->Class==ITEM_CLASS_WEAPON)
+ {
+ // offhand item cannot proc from main hand hit etc
+ EquipmentSlots slot;
+ switch (damageInfo->attackType)
+ {
+ case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
+ case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
+ case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
+ default: slot = EQUIPMENT_SLOT_END; break;
+ }
+ if (slot != i)
+ continue;
+ // Check if item is useable (forms or disarm)
+ if (damageInfo->attackType == BASE_ATTACK)
+ {
+ if (!((Player*)this)->IsUseEquipedWeapon(true))
+ continue;
+ }
+ else
+ {
+ if (((Player*)this)->IsInFeralForm())
+ continue;
+ }
+ }
+ ((Player*)this)->CastItemCombatSpell(item, damageInfo, proto);
}
- }
- }
- // If usable, try to cast item spell
- if(slot!=EQUIPMENT_SLOT_END)
- ((Player*)this)->CastItemCombatSpell(((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i), damageInfo);
}
}