Jump to content

[fix]Invincible (Winged Pony!!!!)


Guest laise

Recommended Posts

What bug does the patch fix? What features does the patch add?

fixes Invincible

For which repository revision was the patch created?

9609

Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

haven't seen any

Who has been writing this patch? Please include either forum user names or email addresses.

me

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5f8439e..a76efd7 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5806,6 +5806,38 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
                    m_caster->CastSpell(unitTarget, 72588, true);
                    return;
                }
+                case 72286:                                 // Invincible
+                {
+                    if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
+                        return;
+
+                    // Prevent stacking of mounts
+                    unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+                    uint16 skillval = ((Player*)unitTarget)->GetSkillValue(SKILL_RIDING);
+                    if (!skillval)
+                        return;
+
+                    if (skillval >= 225)
+                    {
+                        uint32 spellid = skillval >= 300 ? 72284 : 72283;
+                        SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid);
+                        // zone check
+                        uint32 zone, area;
+                        unitTarget->GetZoneAndAreaId(zone, area);
+
+                        SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, unitTarget->GetMapId(), zone, area, unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself());
+                        if (locRes != SPELL_CAST_OK || !((Player*)unitTarget)->IsKnowHowFlyIn(unitTarget->GetMapId(),zone))
+                            unitTarget->CastSpell(unitTarget, 72282, true);
+                        else
+                            unitTarget->CastSpell(unitTarget, pSpell, true);
+                    }
+                    else if (skillval >= 150)
+                        unitTarget->CastSpell(unitTarget, 72282, true);
+                    else 
+                        unitTarget->CastSpell(unitTarget, 72281, true);
+
+                    return;
+                }
            }
            break;
        }

note: needed data in creature_template for correct work

Link to comment
Share on other sites

  • 3 weeks later...
REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid_A`, `modelid_A2`, `modelid_H`, `modelid_H2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `PetSpellDataId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `unk16`, `unk17`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
(38545, 0, 0, 0, 0, 0, 31007, 0, 31007, 0, 'Invincible', '', '', 0, 1, 1, 0, 0, 0, 0, 0, 35, 35, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, ''); 

Link to comment
Share on other sites

  • 3 weeks later...

Worked like a charm!!

TY laise.

EDIT:

I was studying the patch, isnt there any easy way to implement this functionality for all mounts that use the same kind of "scale leveling"?? So we dont have to make the same procedure for each mount that use the same feature. Just include a small table in the DB maybe to call the correct spell to cast, or something like that.

Link to comment
Share on other sites

Worked like a charm!!

TY laise.

EDIT:

I was studying the patch, isnt there any easy way to implement this functionality for all mounts that use the same kind of "scale leveling"?? So we dont have to make the same procedure for each mount that use the same feature. Just include a small table in the DB maybe to call the correct spell to cast, or something like that.

isn't this easy enough?

Celestial Steed:

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5f8439e..a76efd7 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5806,6 +5806,38 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
                    m_caster->CastSpell(unitTarget, 72588, true);
                    return;
                }
+               case 75614:                                 // Celestial Steed
               case 72286:                                 // Invincible
               {
                   if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
                       return;

                   // Prevent stacking of mounts
                   unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
                   uint16 skillval = ((Player*)unitTarget)->GetSkillValue(SKILL_RIDING);
                   if (!skillval)
                       return;

                   if (skillval >= 225)
                   {
-                       uint32 spellid = skillval >= 300 ? 72284 : 72283;
+                       if m_spellInfo->Id == 72286
+                           uint32 spellid = skillval >= 300 ? 72284 : 72283;
+                       else if m_spellInfo->Id == 75614
+                           uint32 spellid = skillval >= 300 ? 76153 : 75617;
                       SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid);
                       // zone check
                       uint32 zone, area;
                       unitTarget->GetZoneAndAreaId(zone, area);

                       SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, unitTarget->GetMapId(), zone, area, unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself());
                       if (locRes != SPELL_CAST_OK || !((Player*)unitTarget)->IsKnowHowFlyIn(unitTarget->GetMapId(),zone))
+                       {
-                           unitTarget->CastSpell(unitTarget, 72282, true);
+                            if m_spellInfo->Id == 72286
+                               unitTarget->CastSpell(unitTarget, 72282, true);
+                            else if m_spellInfo->Id == 75614
+                               unitTarget->CastSpell(unitTarget, 75620, true);
+                       }
                       else
                           unitTarget->CastSpell(unitTarget, pSpell, true);
                   }
                   else if (skillval >= 150)
-                   unitTarget->CastSpell(unitTarget, 72282, true);
+                   {
+                       if m_spellInfo->Id == 72286
+                           unitTarget->CastSpell(unitTarget, 72282, true);
+                       else if m_spellInfo->Id == 75614
+                           unitTarget->CastSpell(unitTarget, 75620, true);
+                   }
                   else
-                       unitTarget->CastSpell(unitTarget, 72281, true);
+                   {
+                       if m_spellInfo->Id == 72286
+                           unitTarget->CastSpell(unitTarget, 72281, true);
+                       else if m_spellInfo->Id == 75614
+                           unitTarget->CastSpell(unitTarget, 75619, true);
+                   }

                   return;
               }

Link to comment
Share on other sites

Read the whole code

                   else if (skillval >= 150)
                       unitTarget->CastSpell(unitTarget, 72282, true);
                   else
                       unitTarget->CastSpell(unitTarget, 72281, true);

It will cast Invincible, not Celestial Steed, thats why i suggest the DB thing with the different spell's ID

Ah, yeah sorry... lol...must've been a bit sleepy

Anyway, updated my post...perhaps this will suit your needs?

Link to comment
Share on other sites

2 different spells(Invincible, Celestial Steed) that should work in same way.. maybe its better to have more generic way to reuse custom scripted spells

Yeah laise I was thinking the same when i wrote what i wrote before.

There are some other mounts that dont work exactly the same but use a similar method, for example the broom or the mount of the boss from Hallow's End (http://www.wowhead.com/item=37012) and etc.

Note that Invincible counts as 310% mount, and that "Harmony Harmony Pony" doesn't.

The Pony doesnt count as a 310% mount, but if you already own a 310% mount the Pony will gain the 310% speed

Link to comment
Share on other sites

Hey Darkruler I got some errors with your patch.

4>SpellEffects.cpp
4>..\\..\\src\\game\\SpellEffects.cpp(6087) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6091) : error C2181: 'else' no válido sin el correspondiente 'if'
4>..\\..\\src\\game\\SpellEffects.cpp(6091) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6095) : error C2065: 'spellid' : identificador no declarado
4>..\\..\\src\\game\\SpellEffects.cpp(6103) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6105) : error C2181: 'else' no válido sin el correspondiente 'if'
4>..\\..\\src\\game\\SpellEffects.cpp(6105) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6113) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6115) : error C2181: 'else' no válido sin el correspondiente 'if'
4>..\\..\\src\\game\\SpellEffects.cpp(6115) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6120) : error C2061: error de sintaxis : identificador 'm_spellInfo'
4>..\\..\\src\\game\\SpellEffects.cpp(6124) : error C2181: 'else' no válido sin el correspondiente 'if'
4>..\\..\\src\\game\\SpellEffects.cpp(6124) : error C2061: error de sintaxis : identificador 'm_spellInfo'

Link to comment
Share on other sites

Try this, I think he simply missed some brackets:

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5f8439e..a76efd7 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5806,6 +5806,38 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
                    m_caster->CastSpell(unitTarget, 72588, true);
                    return;
                }
+               case 75614:                                 // Celestial Steed
               case 72286:                                 // Invincible
               {
                   if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
                       return;

                   // Prevent stacking of mounts
                   unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
                   uint16 skillval = ((Player*)unitTarget)->GetSkillValue(SKILL_RIDING);
                   if (!skillval)
                       return;

                   if (skillval >= 225)
                   {
-                       uint32 spellid = skillval >= 300 ? 72284 : 72283;
+                       if (m_spellInfo->Id == 72286)
+                           uint32 spellid = skillval >= 300 ? 72284 : 72283;
+                       else if (m_spellInfo->Id == 75614)
+                           uint32 spellid = skillval >= 300 ? 76153 : 75617;
                       SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid);
                       // zone check
                       uint32 zone, area;
                       unitTarget->GetZoneAndAreaId(zone, area);

                       SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, unitTarget->GetMapId(), zone, area, unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself());
                       if (locRes != SPELL_CAST_OK || !((Player*)unitTarget)->IsKnowHowFlyIn(unitTarget->GetMapId(),zone))
+                       {
-                           unitTarget->CastSpell(unitTarget, 72282, true);
+                            if (m_spellInfo->Id == 72286)
+                               unitTarget->CastSpell(unitTarget, 72282, true);
+                           else if (m_spellInfo->Id == 75614)
+                               unitTarget->CastSpell(unitTarget, 75620, true);
+                       }
                       else
                           unitTarget->CastSpell(unitTarget, pSpell, true);
                   }
                   else if (skillval >= 150)
-                   unitTarget->CastSpell(unitTarget, 72282, true);
+                   {
+                       if (m_spellInfo->Id == 72286)
+                           unitTarget->CastSpell(unitTarget, 72282, true);
+                       else if (m_spellInfo->Id == 75614)
+                           unitTarget->CastSpell(unitTarget, 75620, true);
+                   }
                   else
-                       unitTarget->CastSpell(unitTarget, 72281, true);
+                   {
+                       if (m_spellInfo->Id == 72286)
+                           unitTarget->CastSpell(unitTarget, 72281, true);
+                       else if (m_spellInfo->Id == 75614)
+                           unitTarget->CastSpell(unitTarget, 75619, true);
+                   }

                   return;
               }

Link to comment
Share on other sites

did you even try to compile this? :confused:

+ if (m_spellInfo->Id == 72286)

+ uint32 spellid = skillval >= 300 ? 72284 : 72283;

+ else if (m_spellInfo->Id == 75614)

+ uint32 spellid = skillval >= 300 ? 76153 : 75617;

maybe:

+ uint32 spellid = 0;

+ if (m_spellInfo->Id == 72286)

+ spellid = skillval >= 300 ? 72284 : 72283;

+ else if (m_spellInfo->Id == 75614)

+ spellid = skillval >= 300 ? 76153 : 75617;

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use