casucristy

gweryrew

Jul 14th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.20 KB | None | 0 0
  1. From a5e582645605a8c4070de39d002db6546f2a1729 Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Sun, 15 Jul 2012 01:43:37 +0300
  4. Subject: [PATCH] Fix quest Raise the Barricades(ally and horde side).
  5.  
  6. ---
  7.  src/server/scripts/Northrend/icecrown.cpp |   71 +++++++++++++++++++++++++++++
  8.  1 file changed, 71 insertions(+)
  9.  
  10. diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp
  11. index fb2e0f6..8b43cf5 100644
  12. --- a/src/server/scripts/Northrend/icecrown.cpp
  13. +++ b/src/server/scripts/Northrend/icecrown.cpp
  14. @@ -491,6 +491,76 @@ class npc_tournament_training_dummy : public CreatureScript
  15.  
  16.  };
  17.  
  18. +/*###########
  19. +### Support for quest Raise the Barricades
  20. +#################*/
  21. +
  22. +enum BarricadeData
  23. +{
  24. +    SPELL_CONSTRUCT_BARRICADE = 59925,
  25. +    SPELL_SUMMON_BARRICADE_A = 59922,
  26. +    SPELL_SUMMON_BARRICADE_B = 59923,
  27. +    SPELL_SUMMON_BARRICADE_C = 59924,
  28. +    NPC_EBON_BLADE_MARKER   = 31887,
  29. +   ZONE_FALLEN_HEROES       = 4540
  30. +};
  31. +
  32. +
  33. +class spell_construct_barricade : public SpellScriptLoader
  34. +{
  35. +public:
  36. +    spell_construct_barricade() : SpellScriptLoader("spell_construct_barricade") {}
  37. +
  38. +    class spell_construct_barricade_SpellScript : public SpellScript
  39. +    {
  40. +        PrepareSpellScript(spell_construct_barricade_SpellScript)
  41. +
  42. +        bool Validate(SpellInfo const * /*spellInfo*/)
  43. +        {
  44. +            if (!sSpellMgr->GetSpellInfo(SPELL_CONSTRUCT_BARRICADE))
  45. +                return false;
  46. +            return true;
  47. +        }
  48. +
  49. +       SpellCastResult CheckIfInZone()
  50. +        {
  51. +            Unit* caster = GetCaster();
  52. +
  53. +           if(caster->GetAreaId()==ZONE_FALLEN_HEROES)
  54. +               return SPELL_CAST_OK;
  55. +            else
  56. +                return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
  57. +        }
  58. +
  59. +        void HandleDummy(SpellEffIndex /*effIndex*/)
  60. +        {
  61. +            if (Unit* caster = GetCaster())
  62. +                if (Player* player = caster->ToPlayer())
  63. +                {
  64. +                    uint32 SummonBarricadeSpell = 0;
  65. +                    switch (urand(1,3))
  66. +                    {
  67. +                        case 1: SummonBarricadeSpell = SPELL_SUMMON_BARRICADE_A; break;
  68. +                        case 2: SummonBarricadeSpell = SPELL_SUMMON_BARRICADE_B; break;
  69. +                        case 3: SummonBarricadeSpell = SPELL_SUMMON_BARRICADE_C; break;
  70. +                    }
  71. +                    player->CastSpell(player, SummonBarricadeSpell, true);
  72. +                    player->KilledMonsterCredit(NPC_EBON_BLADE_MARKER, 0);
  73. +                }
  74. +        }
  75. +        void Register()
  76. +        {
  77. +           OnCheckCast += SpellCheckCastFn(spell_construct_barricade_SpellScript::CheckIfInZone);
  78. +            OnEffectHit += SpellEffectFn(spell_construct_barricade_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
  79. +        }
  80. +    };
  81. +
  82. +    SpellScript* GetSpellScript() const
  83. +    {
  84. +        return new spell_construct_barricade_SpellScript();
  85. +    }
  86. +};
  87. +
  88.  void AddSC_icecrown()
  89.  {
  90.      new npc_arete;
  91. @@ -499,4 +569,5 @@ void AddSC_icecrown()
  92.      new npc_guardian_pavilion;
  93.      new npc_vereth_the_cunning;
  94.      new npc_tournament_training_dummy;
  95. +   new spell_construct_barricade;
  96.  }
  97. --
  98. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment