casucristy

gfqw

Jul 16th, 2012
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.56 KB | None | 0 0
  1. From 4ecb186fadfb0360290e2aacfdd1467987b425e6 Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Tue, 17 Jul 2012 00:50:05 +0300
  4. Subject: [PATCH] Fix Quests: Bombing Run(ally and horde side) && Bomb Then
  5.  Again
  6.  
  7. ---
  8.  .../Outland/Zones/blades_edge_mountains.cpp        |   89 ++++++++++++++++++++
  9.  1 file changed, 89 insertions(+)
  10.  
  11. diff --git a/src/server/scripts/Outland/Zones/blades_edge_mountains.cpp b/src/server/scripts/Outland/Zones/blades_edge_mountains.cpp
  12. index 4346841..d91a54f 100644
  13. --- a/src/server/scripts/Outland/Zones/blades_edge_mountains.cpp
  14. +++ b/src/server/scripts/Outland/Zones/blades_edge_mountains.cpp
  15. @@ -555,6 +555,94 @@ class go_thunderspike : public GameObjectScript
  16.          }
  17.  };
  18.  
  19. +/*#########
  20. ++### Support for quests Bombing Run/Bomb them again
  21. ++###############*/
  22. +
  23. +#define FEL_CANONBALL          185861
  24. +#define SPELL_THROW_BOMB       40160
  25. +
  26. +#define QUEST_BOMBING_RUN_A        11102
  27. +#define QUEST_BOMBING_RUN_H        11010
  28. +#define QUEST_BOMB_THEM_AGAIN  11023
  29. +
  30. +#define QUEST_CREDIT           23118
  31. +
  32. +#define ZONE_FORGE_CAMP    3785
  33. +
  34. +class spell_throw_bomb : public SpellScriptLoader
  35. +{
  36. +public:
  37. +    spell_throw_bomb() : SpellScriptLoader("spell_throw_bomb") {}
  38. +
  39. +    class spell_throw_bomb_SpellScript : public SpellScript
  40. +    {
  41. +        PrepareSpellScript(spell_throw_bomb_SpellScript)
  42. +
  43. +        bool Validate(SpellInfo const* /*spell*/)
  44. +       {
  45. +           if (!sSpellMgr->GetSpellInfo(SPELL_THROW_BOMB))
  46. +               return false;
  47. +           return true;
  48. +       }
  49. +
  50. +       SpellCastResult CheckIfInZone()
  51. +        {
  52. +            Unit* caster = GetCaster();
  53. +
  54. +           if(caster->GetAreaId()==ZONE_FORGE_CAMP && caster->IsMounted())
  55. +               return SPELL_CAST_OK;
  56. +            else
  57. +                return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
  58. +        }
  59. +
  60. +        void HandleBombEffect(SpellEffIndex effIndex)
  61. +        {
  62. +            Unit* caster = GetCaster();
  63. +           Player* player = caster->ToPlayer();
  64. +
  65. +           if (player &&  HasBombsInRange(player) && (player->GetQuestStatus(QUEST_BOMBING_RUN_A)==QUEST_STATUS_INCOMPLETE
  66. +                      || player->GetQuestStatus(QUEST_BOMBING_RUN_H)==QUEST_STATUS_INCOMPLETE
  67. +                      || player->GetQuestStatus(QUEST_BOMB_THEM_AGAIN)==QUEST_STATUS_INCOMPLETE))
  68. +                    player->KilledMonsterCredit(QUEST_CREDIT,0);      
  69. +        }
  70. +
  71. +       bool HasBombsInRange(Player* player)
  72. +       {
  73. +           std::list<GameObject*> lBombs;
  74. +
  75. +           WorldLocation* worldlocation = GetHitDest();
  76. +          
  77. +           if(worldlocation)
  78. +           {
  79. +               player->GetGameObjectListWithEntryInGrid(lBombs,FEL_CANONBALL,35.0f);
  80. +               std::list<GameObject*>::iterator it = lBombs.begin();
  81. +               std::list<GameObject*>::iterator end = lBombs.end();
  82. +
  83. +               for(;it!=end;it++)
  84. +               {
  85. +                   if((*it)->GetDistance(worldlocation->GetPositionX(),worldlocation->GetPositionY(),worldlocation->GetPositionZ()) < 5.0f)
  86. +                       return true;
  87. +               }
  88. +           }
  89. +          
  90. +           return false;
  91. +       }
  92. +
  93. +        void Register()
  94. +        {
  95. +            OnCheckCast += SpellCheckCastFn(spell_throw_bomb_SpellScript::CheckIfInZone);
  96. +            OnEffectHit += SpellEffectFn(spell_throw_bomb_SpellScript::HandleBombEffect, EFFECT_0, SPELL_EFFECT_DUMMY);   
  97. +        }
  98. +                              
  99. +    };
  100. +
  101. +    SpellScript* GetSpellScript() const
  102. +    {
  103. +        return new spell_throw_bomb_SpellScript();
  104. +    }
  105. +};
  106. +
  107.  void AddSC_blades_edge_mountains()
  108.  {
  109.      new mobs_bladespire_ogre();
  110. @@ -566,4 +654,5 @@ void AddSC_blades_edge_mountains()
  111.      new npc_bloodmaul_brutebane();
  112.      new npc_ogre_brute();
  113.      new go_thunderspike();
  114. +   new spell_throw_bomb();
  115.  }
  116. \ No newline at end of file
  117. --
  118. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment