casucristy

ss

Jul 23rd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.97 KB | None | 0 0
  1. From c56724e959647781356bb9de8b3b7e529264f52f Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Tue, 24 Jul 2012 01:17:29 +0300
  4. Subject: [PATCH] Fix quest Imposing Confrontation
  5.  
  6. ---
  7.  src/server/scripts/Maelstrom/deepholm.cpp |  167 +++++++++++++++++++++++++++++
  8.  1 file changed, 167 insertions(+)
  9.  
  10. diff --git a/src/server/scripts/Maelstrom/deepholm.cpp b/src/server/scripts/Maelstrom/deepholm.cpp
  11. index ed3451d..55c3260 100644
  12. --- a/src/server/scripts/Maelstrom/deepholm.cpp
  13. +++ b/src/server/scripts/Maelstrom/deepholm.cpp
  14. @@ -1217,6 +1217,171 @@ class npc_dormant_stonebound_elemental : public CreatureScript
  15.         }
  16.  };
  17.  
  18. +/*####
  19. +## Quest fix support for quest Imposing Confrontation
  20. +###############*/
  21. +
  22. +enum eImposingConfrontationEntries
  23. +{
  24. +   QUEST_IMPOSING_CONFRONTATION    =   26315,
  25. +   SPELL_EARTHEN_RING_PROCLAMATION =   79715,
  26. +   NPC_BODEN_THE_IMPOSING          =   42471,
  27. +   QUEST_IMPOSING_CREDIT           =   42731,
  28. +   SPELL_KNOCK_BACK                =   65873,
  29. +};
  30. +
  31. +#define BODEN_YELL_01  "Hah! Did you mistake me for Diamant, $R? Or perhaps some other whimpering, complaint stone trogg who cares?"
  32. +#define BODEN_YELL_02  "If you seek peace, relinquish the World Pillar and leave Deepholm. This is our realm. Your only welcome here shall be found underneath my stone foot."
  33. +
  34. +#define BODEN_PLAYER_SAY_01 "Boden the Imposing. I come on behalf of the Earthen Ring. We wish your kind no harm. We seek to repair the rift between our worlds. Why do you attack us?"
  35. +
  36. +class npc_boden_the_imposing : public CreatureScript
  37. +{
  38. +    public:
  39. +        npc_boden_the_imposing() : CreatureScript("npc_boden_the_imposing") { }
  40. +
  41. +       struct npc_boden_the_imposingAI : public ScriptedAI
  42. +       {
  43. +           npc_boden_the_imposingAI(Creature* creature) : ScriptedAI(creature)
  44. +           { pQuestOwner = NULL; }
  45. +
  46. +           bool    bOnQuestEventStarted;
  47. +           uint32  m_saytimer;
  48. +           uint32  m_phase;
  49. +           Player* pQuestOwner;
  50. +
  51. +           void Reset()
  52. +           {
  53. +               me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE+UNIT_FLAG_NOT_SELECTABLE);
  54. +               bOnQuestEventStarted = false;
  55. +               m_saytimer = 2000;
  56. +               m_phase = 0;
  57. +               pQuestOwner = NULL;
  58. +           }
  59. +
  60. +           void UpdateAI(uint32 const diff)
  61. +           {
  62. +               if(bOnQuestEventStarted)
  63. +               {
  64. +                   if(m_saytimer <= diff)
  65. +                   {
  66. +                       if(pQuestOwner && pQuestOwner->isAlive() && me->GetDistance(pQuestOwner) <= 50.0f)
  67. +                       {
  68. +                           switch (m_phase)
  69. +                           {
  70. +                               case 0: pQuestOwner->MonsterSay(BODEN_PLAYER_SAY_01,LANG_UNIVERSAL,pQuestOwner->GetGUID());m_phase++;break;
  71. +                               case 1: me->MonsterYell(BODEN_YELL_01,LANG_UNIVERSAL,pQuestOwner->GetGUID());m_phase++;break;
  72. +                               case 2: me->MonsterYell(BODEN_YELL_02,LANG_UNIVERSAL,pQuestOwner->GetGUID());m_phase++;break;
  73. +                               default: break;
  74. +                           }
  75. +
  76. +                           if(m_phase == 3 && pQuestOwner->isAlive())
  77. +                           {
  78. +                               pQuestOwner->KilledMonsterCredit(QUEST_IMPOSING_CREDIT,0);
  79. +                               pQuestOwner->CastSpell(pQuestOwner,SPELL_KNOCK_BACK);
  80. +                               me->GetAI()->Reset();
  81. +                               return;
  82. +                           }
  83. +
  84. +                           m_saytimer = 4000;
  85. +                       }
  86. +                       else
  87. +                           me->GetAI()->Reset();
  88. +                   }
  89. +                   else m_saytimer -= diff;
  90. +               }
  91. +
  92. +               if(!UpdateVictim())
  93. +                   return;
  94. +
  95. +               DoMeleeAttackIfReady();
  96. +           }
  97. +
  98. +       };
  99. +
  100. +       CreatureAI* GetAI(Creature *creature) const
  101. +       {
  102. +           return new npc_boden_the_imposingAI(creature);
  103. +       }
  104. +};
  105. +
  106. +class spell_earthen_ring_proclamation : public SpellScriptLoader
  107. +{
  108. +public:
  109. +    spell_earthen_ring_proclamation() : SpellScriptLoader("spell_earthen_ring_proclamation") { }
  110. +
  111. +    class spell_earthen_ring_proclamation_SpellScript : public SpellScript
  112. +    {
  113. +        PrepareSpellScript(spell_earthen_ring_proclamation_SpellScript);
  114. +
  115. +        bool Validate(SpellInfo const* /*spellEntry*/)
  116. +        {
  117. +            if (!sSpellMgr->GetSpellInfo(SPELL_EARTHEN_RING_PROCLAMATION))
  118. +                return false;
  119. +            return true;
  120. +        }
  121. +
  122. +        SpellCastResult CheckTarget()
  123. +        {
  124. +           bool result = false;
  125. +           Unit*   target = NULL;
  126. +           Player*     pCaster = NULL;
  127. +
  128. +            if(Unit* caster = GetCaster())
  129. +               if(pCaster = caster->ToPlayer())
  130. +               {
  131. +                   target = pCaster->GetSelectedUnit();
  132. +                   target &&
  133. +                   target->GetEntry() == NPC_BODEN_THE_IMPOSING &&
  134. +                   target->GetDistance(pCaster) < 25.0f ? result = true : result = false;
  135. +               }
  136. +
  137. +            if (!result)
  138. +               return SPELL_FAILED_OUT_OF_RANGE;
  139. +            return SPELL_CAST_OK;
  140. +        }
  141. +
  142. +        void HandleDummy()//SpellEffIndex /*effIndex*/)
  143. +        {
  144. +           Player* player = NULL;
  145. +           Unit* creature = NULL;
  146. +           Creature* pCreature = NULL;
  147. +
  148. +            if(Unit* caster = GetCaster())
  149. +               player = caster->ToPlayer();
  150. +
  151. +           if(player && player->GetQuestStatus(QUEST_IMPOSING_CONFRONTATION)==QUEST_STATUS_INCOMPLETE)
  152. +           {
  153. +               if(creature = player->GetSelectedUnit())
  154. +                   pCreature = creature->ToCreature();
  155. +               else
  156. +                   return;
  157. +
  158. +               if(pCreature && pCreature->GetEntry() == NPC_BODEN_THE_IMPOSING)
  159. +               {
  160. +                   if (npc_boden_the_imposing::npc_boden_the_imposingAI* pBoden = CAST_AI(npc_boden_the_imposing::npc_boden_the_imposingAI, pCreature->AI()))
  161. +                   {
  162. +                       pBoden->bOnQuestEventStarted = true;
  163. +                       pBoden->pQuestOwner = player;
  164. +                       pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE+UNIT_FLAG_NOT_SELECTABLE);
  165. +                   }
  166. +               }
  167. +           }  
  168. +        }
  169. +
  170. +        void Register()
  171. +       {
  172. +            AfterCast += SpellCastFn(spell_earthen_ring_proclamation_SpellScript::HandleDummy);
  173. +            OnCheckCast += SpellCheckCastFn(spell_earthen_ring_proclamation_SpellScript::CheckTarget);
  174. +        }
  175. +    };
  176. +
  177. +   SpellScript* GetSpellScript() const
  178. +    {
  179. +        return new spell_earthen_ring_proclamation_SpellScript();
  180. +    }
  181. +};
  182. +
  183.  void AddSC_deepholm()
  184.  {
  185.      new npc_lodestone();
  186. @@ -1240,4 +1405,6 @@ void AddSC_deepholm()
  187.     new spell_smash_chains();
  188.     new npc_therazane();
  189.     new npc_dormant_stonebound_elemental();
  190. +   new npc_boden_the_imposing();
  191. +   new spell_earthen_ring_proclamation();
  192.  }
  193. --
  194. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment