Commit Graph

251 Commits

Author SHA1 Message Date
megamage 834580f6b2 *Move some Trinity-only functions to the end of file.
--HG--
branch : trunk
2009-05-15 16:26:00 -05:00
QAston d81352b421 *Allow hots to proc
--HG--
branch : trunk
2009-05-15 16:59:27 +02:00
QAston 47d5fc51c5 *Item enchancment/proc patch - original code by Thenecromancer
-void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType)
-{
-    if(!item || item->IsBroken())
-        return;
-
-    ItemPrototype const *proto = item->GetProto();
-    if(!proto)
-        return;
+void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
+{
+    Unit * Target = damageInfo->target;
+    WeaponAttackType attType = damageInfo->attackType;

     if (!Target || Target == this )
         return;

-    for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
-    {
-        _Spell const& spellData = proto->Spells[i];
-
-        // no spell
-        if(!spellData.SpellId )
-            continue;
-
-        // wrong triggering type
-        if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
-            continue;
-
-        SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
-        if(!spellInfo)
-        {
-            sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
-            continue;
-        }
-
-        // not allow proc extra attack spell at extra attack
-        if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
-            return;
-
-        float chance = spellInfo->procChance;
-
-        if(spellData.SpellPPMRate)
-        {
-            uint32 WeaponSpeed = GetAttackTime(attType);
-            chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
-        }
-        else if(chance > 100.0f)
-        {
-            chance = GetWeaponProcChance();
-        }
-
-        if (roll_chance_f(chance))
-            CastSpell(Target, spellInfo->Id, true, item);
+    // Can do effect if any damage done to target
+    if (damageInfo->damage)
+    {
+        for (int i = 0; i < 5; i++)
+        {
+            _Spell const& spellData = proto->Spells[i];
+
+            // no spell
+            if(!spellData.SpellId )
+                continue;
+
+            // wrong triggering type
+            if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
+                continue;
+
+            SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
+            if(!spellInfo)
+            {
+                sLog.outError("WORLD: unknown Item spellid %i", spellData.SpellId);
+                continue;
+            }
+
+            // not allow proc extra attack spell at extra attack
+            if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) )
+                return;
+
+            float chance = spellInfo->procChance;
+
+            if(spellData.SpellPPMRate)
+            {
+                uint32 WeaponSpeed = GetAttackTime(attType);
+                chance = GetPPMProcChance(WeaponSpeed, spellData.SpellPPMRate, spellInfo);
+            }
+            else if(chance > 100.0f)
+            {
+                chance = GetWeaponProcChance();
+            }
+
+            if (roll_chance_f(chance))
+                CastSpell(Target, spellInfo->Id, true, item);
+        }
     }

     // item combat enchantments
@@ -6993,6 +6993,21 @@
             if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
                 continue;

+            SpellEnchantProcEntry const* entry =  spellmgr.GetSpellEnchantProcEvent(enchant_id);
+
+            if (entry && entry->procEx)
+            {
+                // Check hit/crit/dodge/parry requirement
+                if((entry->procEx & damageInfo->procEx) == 0)
+                    continue;
+            }
+            else
+            {
+                // Can do effect if any damage done to target
+                if (!(damageInfo->damage))
+                    continue;
+            }
+
             SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
             if (!spellInfo)
             {
@@ -7001,6 +7016,18 @@
             }

             float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
+
+            if (entry && entry->PPMChance)
+            {
+                uint32 WeaponSpeed = GetAttackTime(attType);
+                chance = GetPPMProcChance(WeaponSpeed, entry->PPMChance, spellInfo);
+            }
+            else if (entry && entry->customChance)
+                chance = entry->customChance;
+
+            // Apply spell mods
+            ApplySpellMod(pEnchant->spellid[s],SPELLMOD_CHANCE_OF_SUCCESS,chance);
+
             if (roll_chance_f(chance))
             {
                 if(IsPositiveSpell(pEnchant->spellid[s]))
@@ -7012,6 +7039,7 @@
     }
 }

+
 void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex)
 {
     ItemPrototype const* proto = item->GetProto();

--HG--
branch : trunk
2009-05-15 16:37:22 +02:00
megamage 8fc07d443a *Change waypoint data structure. Use creature db guid as path id. If a creature uses waypoint movement as default movement type, the path id should be DBGUID*10. For paths of script use, the path id should be DBGUID*10+1 ~ DBGUID*10+9.
*Two sql queries are included. Converter is used to convert the existing path id to new path id. "...creature_add..." is used to change table structure. You can first run the converter, then run the other one. Or run the other one directly and get the new data from the db team. Because it may take hours to run the converter.
*If you have custom data, you may need to run the converter. We suggest you use console to run it It is extremely slow to run the query. If you have multiple paths for a creature in your db, you need to do more work to convert it. However, if you know how to use multiple paths, you should already have more db knowledge than I do and you should know how to convert it.
*There may be a faster query to convert the db. If you know, please tell us. I am no sql expert.
*Backup your db first!
*Thanks to X-Savior and subhuman_bob.

--HG--
branch : trunk
2009-05-11 13:27:10 -05:00
megamage 82f886e3c1 *Update AI scripts. Use better default AI.
--HG--
branch : trunk
2009-05-10 22:48:22 -05:00
QAston 50bf49bd81 Allow class specific periodic dummy and dummy auras to always stack
--HG--
branch : trunk
2009-05-11 00:05:36 +02:00
megamage 979073cebd *Update some spell attr flag. Use better way to check IsRangedSpell and UnaffectedByInvulnerability
--HG--
branch : trunk
2009-05-08 00:49:02 -05:00
QAston e8474f3291 *Do not allow to cast cyclone on divine shielded target.
--HG--
branch : trunk
2009-05-08 00:37:13 +02:00
megamage a3447b294d *Update Naxx scripts.
--HG--
branch : trunk
2009-05-06 00:08:19 -05:00
QAston 6998da2028 *Fix chains of ice
*Correct typo in my prev commit-by megamage
*Fix hearthstone obtaining from innkeeper.

--HG--
branch : trunk
2009-05-04 18:31:37 +02:00
megamage 1cfc04f1f5 [7745] Fixed gcc warnings. Author: AlexDereka
--HG--
branch : trunk
2009-05-03 22:21:46 -05:00
megamage 84fc76439c *Fix a crash caused by feedpet.
*Also have delay for jump spells.

--HG--
branch : trunk
2009-05-03 16:29:33 -05:00
megamage 193b0634df *Some fix of sapphiron script.
--HG--
branch : trunk
2009-05-03 11:28:14 -05:00
QAston f9b13b45e0 *Fix grounding totem.
*Fix runic power regeneration of butchery
*Fix some problems with master of subtlety buff expire.
*Do not allow arcane intellect and brillance to stack.

--HG--
branch : trunk
2009-05-03 16:55:09 +02:00
QAston abe9b27ee4 *Fix target selection for wild growth and circle of healing
--HG--
branch : trunk
2009-05-03 00:02:02 +02:00
megamage 9f0f239e60 *Merge.
*Also fix build in VC7 and VC8.

--HG--
branch : trunk
2009-05-02 13:30:55 -05:00
megamage f303ee08c5 *Update spell selection.
--HG--
branch : trunk
2009-05-02 11:28:11 -05:00
QAston a1f73a8a08 *More correct handling of fly mod auras.
*Pets now learn all levelup spells.
*Fix lightning overload.

--HG--
branch : trunk
2009-05-02 16:08:52 +02:00
megamage db817d668a *Merge.
--HG--
branch : trunk
2009-05-01 18:37:32 -05:00
megamage 5a66774008 *Fix the bug that shapeshift can remove blind.
--HG--
branch : trunk
2009-05-01 15:36:32 -05:00
Iskander 77bd6f148a *Do not allow 2 same blessings to stack
--HG--
branch : trunk
2009-05-01 19:23:10 +02:00
QAston 0f5a9cb46f *Implement enchanting vellums.
--HG--
branch : trunk
2009-05-01 15:40:49 +02:00
megamage 8a57a94eca *Merge.
--HG--
branch : trunk
2009-04-30 23:38:21 -05:00
megamage d44d827200 *Explicitly implement spell target 28 and 29.
--HG--
branch : trunk
2009-04-30 22:04:15 -05:00
QAston c3c303fb99 *Correctly trigger avenging wrath marker.
--HG--
branch : trunk
2009-04-29 21:43:59 +02:00
QAston 3e45bb2bfb *Fix Blessing of Sanctuary
--HG--
branch : trunk
2009-04-29 20:33:49 +02:00
megamage de11b9e901 [7730] Some optimizantion and code style. Author: zhenya
--HG--
branch : trunk
2009-04-29 00:26:07 -05:00
megamage 94e25701ad *Fix the bug that neutural npc aggro players.
*Fix build.

--HG--
branch : trunk
2009-04-25 18:46:07 -05:00
QAston ec4031be35 *Fix improved shadowform.
--HG--
branch : trunk
2009-04-25 20:36:31 +02:00
QAston a00563a127 *Fix deadly brew.
*Some changes in flag SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY.

--HG--
branch : trunk
2009-04-25 18:53:29 +02:00
megamage c4e6f9708f [7713] Fix AreaGroup.dbc structure, more correct check it Author: DiSlord
--HG--
branch : trunk
2009-04-25 09:06:43 -05:00
QAston e23ec703fe *Trigger offhand hit for Whirlwind
*Allow to cast conflagrate if target is affected by shadowflame

--HG--
branch : trunk
2009-04-25 13:58:26 +02:00
QAston 066af701d3 *Fix frenzy and Ferocious Inspiration proc.
*Add command .reset all pet_spells - use it if you still have problems with pet talents after recent revs changes (like pets with all talents for example)

--HG--
branch : trunk
2009-04-23 20:57:17 +02:00
QAston 68b02ae227 *Fix bug that pets learn talents instantly - clear your pet_spell table to have changes applied.
--HG--
branch : trunk
2009-04-20 23:37:47 +02:00
QAston dcc7b99982 *Update petLevelupSpellLearn code
*Remove triggered aura of shadow embrace when main aura expires.

--HG--
branch : trunk
rename : sql/updates/2773_world_spell_linked_spell.sql => sql/updates/2814_world_spell_linked_spell.sql
2009-04-19 20:45:55 +02:00
Machiavelli 99fc17d44f * Tabs to spaces cleanup
--HG--
branch : trunk
2009-04-19 18:48:20 +02:00
QAston a23df5a270 *Fix compile.
--HG--
branch : trunk
2009-04-19 17:29:17 +02:00
QAston cfabdd2fd2 *Some changes to pet spell learning-now pet passives should work.
*Fix a crash with lifebloom.

--HG--
branch : trunk
2009-04-19 17:23:03 +02:00
QAston 49bfc48f6e *Fix Dash - original patch by Dani.
*Set max target limit for Circle of healing.

--HG--
branch : trunk
2009-04-19 02:32:03 +02:00
QAston d362d446bd *Fix Alchemist's Stone.
--HG--
branch : trunk
2009-04-18 23:08:34 +02:00
QAston 08976f5c6e *Fix a typo in latest rev
--HG--
branch : trunk
2009-04-18 22:43:35 +02:00
QAston a731f9a3c0 *Update of procflag system:
-Improved holy concentration, Second wind and other spells which can trigger from triggered spells should work correctly now
-Allow potions to trigger

--HG--
branch : trunk
2009-04-18 21:25:48 +02:00
QAston c9290eac28 *Allow imp to learn Phase Shift
*Correct bonus damage for Unstable Affliction
*Correct some procflags.

--HG--
branch : trunk
rename : sql/updates/2685_world_spell_proc_event.sql => sql/updates/2774_world_spell_proc_event.sql
2009-04-18 17:32:04 +02:00
QAston 6c44316d8e *Correct positivity of some spells
--HG--
branch : trunk
2009-04-14 19:09:08 +02:00
QAston a13e6537e9 *Fix T.N.T proc chance
--HG--
branch : trunk
2009-04-13 18:56:29 +02:00
QAston beab3e0125 *Fix some problems with ProcFlag
--HG--
branch : trunk
2009-04-13 15:52:59 +02:00
QAston b2c3413806 *Fix a typo causing all auras to be on cooldown
--HG--
branch : trunk
2009-04-12 18:31:22 +02:00
megamage dda2fdff33 *Implement spell Disengage and Death Grip.
--HG--
branch : trunk
2009-04-11 22:41:15 -05:00
QAston 1d640d0272 Do not trigger arcane power with presence of mind
--HG--
branch : trunk
2009-04-12 01:35:06 +02:00
QAston d6f792d307 *Fix Riptide.
*Show bladestorm as buff.

--HG--
branch : trunk
2009-04-10 16:59:34 +02:00