Advertisement
Guest User

Untitled

a guest
Oct 13th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 49.37 KB | None | 0 0
  1. diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
  2. index 26d7034..0490a53 100755
  3. --- a/src/server/game/Scripting/ScriptLoader.cpp
  4. +++ b/src/server/game/Scripting/ScriptLoader.cpp
  5. @@ -93,6 +93,7 @@ void AddSC_boss_high_interrogator_gerstahn();
  6.  void AddSC_boss_magmus();
  7.  void AddSC_boss_moira_bronzebeard();
  8.  void AddSC_boss_tomb_of_seven();
  9. +void AddSC_boss_coren_direbrew();
  10.  void AddSC_instance_blackrock_depths();
  11.  void AddSC_boss_drakkisath();                //Blackrock Spire
  12.  void AddSC_boss_halycon();
  13. @@ -702,6 +703,7 @@ void AddEasternKingdomsScripts()
  14.      AddSC_boss_magmus();
  15.      AddSC_boss_moira_bronzebeard();
  16.      AddSC_boss_tomb_of_seven();
  17. +    AddSC_boss_coren_direbrew();
  18.      AddSC_instance_blackrock_depths();
  19.      AddSC_boss_drakkisath();                //Blackrock Spire
  20.      AddSC_boss_halycon();
  21. diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_coren_direbrew.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_coren_direbrew.cpp
  22. new file mode 100644
  23. index 0000000..5474c59
  24. --- /dev/null
  25. +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_coren_direbrew.cpp
  26. @@ -0,0 +1,1175 @@
  27. +/*######
  28. +## BrewFest Event
  29. +######*/
  30. +
  31. +#include "ScriptPCH.h"
  32. +#include "ScriptedEscortAI.h"
  33. +#include "blackrock_depths.h"
  34. +#include "LFGMgr.h"
  35. +#include "SpellAuraEffects.h"
  36. +#include "ScriptMgr.h"
  37. +#include "ObjectMgr.h"
  38. +#include "World.h"
  39. +
  40. +/*####
  41. +## brewfest_trigger 2
  42. +####*/
  43. +
  44. +enum eBrewfestBarkQuests
  45. +{
  46. +    BARK_FOR_THE_THUNDERBREWS       = 11294,
  47. +    BARK_FOR_TCHALIS_VOODOO_BREWERY = 11408,
  48. +    BARK_FOR_THE_BARLEYBREWS        = 11293,
  49. +    BARK_FOR_DROHNS_DISTILLERY      = 11407,
  50. +
  51. +    SPELL_RAMSTEIN_SWIFT_WORK_RAM   = 43880,
  52. +    SPELL_BREWFEST_RAM              = 43883,
  53. +    SPELL_RAM_FATIGUE               = 43052,
  54. +    SPELL_SPEED_RAM_GALLOP          = 42994,
  55. +    SPELL_SPEED_RAM_CANTER          = 42993,
  56. +    SPELL_SPEED_RAM_TROT            = 42992,
  57. +    SPELL_SPEED_RAM_NORMAL          = 43310,
  58. +    SPELL_SPEED_RAM_EXHAUSED        = 43332,
  59. +
  60. +    NPC_SPEED_BUNNY_GREEN           = 24263,
  61. +    NPC_SPEED_BUNNY_YELLOW          = 24264,
  62. +    NPC_SPEED_BUNNY_RED             = 24265,
  63. +    NPC_BARKER_BUNNY_1              = 24202,
  64. +    NPC_BARKER_BUNNY_2              = 24203,
  65. +    NPC_BARKER_BUNNY_3              = 24204,
  66. +    NPC_BARKER_BUNNY_4              = 24205,
  67. +};
  68. +
  69. +class npc_brewfest_trigger : public CreatureScript
  70. +{
  71. +public:
  72. +    npc_brewfest_trigger() : CreatureScript("npc_brewfest_trigger") { }
  73. +
  74. +    CreatureAI *GetAI(Creature *creature) const
  75. +    {
  76. +        return new npc_brewfest_triggerAI(creature);
  77. +    }
  78. +
  79. +    struct npc_brewfest_triggerAI : public ScriptedAI
  80. +    {
  81. +        npc_brewfest_triggerAI(Creature* c) : ScriptedAI(c) {}
  82. +
  83. +        void MoveInLineOfSight(Unit *who)
  84. +        {
  85. +            if (!who)
  86. +                return;
  87. +
  88. +            if (who->GetTypeId() == TYPEID_PLAYER)
  89. +            {
  90. +                if (!(CAST_PLR(who)->GetAura(SPELL_BREWFEST_RAM)))
  91. +                    return;
  92. +
  93. +                if (CAST_PLR(who)->GetQuestStatus(BARK_FOR_THE_THUNDERBREWS) == QUEST_STATUS_INCOMPLETE||
  94. +                    CAST_PLR(who)->GetQuestStatus(BARK_FOR_TCHALIS_VOODOO_BREWERY) == QUEST_STATUS_INCOMPLETE||
  95. +                    CAST_PLR(who)->GetQuestStatus(BARK_FOR_THE_BARLEYBREWS) == QUEST_STATUS_INCOMPLETE||
  96. +                    CAST_PLR(who)->GetQuestStatus(BARK_FOR_DROHNS_DISTILLERY) == QUEST_STATUS_INCOMPLETE)
  97. +                {
  98. +                    uint32 creditMarkerId = me->GetEntry();
  99. +                    if ((creditMarkerId >= 24202) && (creditMarkerId <= 24205))
  100. +                    {
  101. +                        // 24202: Brewfest Barker Bunny 1, 24203: Brewfest Barker Bunny 2, 24204: Brewfest Barker Bunny 3, 24205: Brewfest Barker Bunny 4
  102. +                        if (!CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_BARLEYBREWS, creditMarkerId)||
  103. +                            !CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_THUNDERBREWS, creditMarkerId)||
  104. +                            !CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_DROHNS_DISTILLERY, creditMarkerId)||
  105. +                            !CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_TCHALIS_VOODOO_BREWERY, creditMarkerId))
  106. +                            CAST_PLR(who)->KilledMonsterCredit(creditMarkerId, me->GetGUID());
  107. +                        // Caso para quest 11293 que no se completa teniendo todas las marcas
  108. +                        if (CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_BARLEYBREWS, NPC_BARKER_BUNNY_1)&&
  109. +                            CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_BARLEYBREWS, NPC_BARKER_BUNNY_2)&&
  110. +                            CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_BARLEYBREWS, NPC_BARKER_BUNNY_3)&&
  111. +                            CAST_PLR(who)->GetReqKillOrCastCurrentCount(BARK_FOR_THE_BARLEYBREWS, NPC_BARKER_BUNNY_4))
  112. +                            CAST_PLR(who)->CompleteQuest(BARK_FOR_THE_BARLEYBREWS);
  113. +                    }
  114. +                }
  115. +            }
  116. +        }
  117. +    };
  118. +};
  119. +
  120. +/*####
  121. +## npc_brewfest_apple_trigger
  122. +####*/
  123. +
  124. +class npc_brewfest_apple_trigger : public CreatureScript
  125. +{
  126. +public:
  127. +    npc_brewfest_apple_trigger() : CreatureScript("npc_brewfest_apple_trigger") { }
  128. +
  129. +    struct npc_brewfest_apple_triggerAI : public ScriptedAI
  130. +    {
  131. +        npc_brewfest_apple_triggerAI(Creature* c) : ScriptedAI(c) {}
  132. +
  133. +        void MoveInLineOfSight(Unit *who)
  134. +        {
  135. +            Player *player = who->ToPlayer();
  136. +            if (!player)
  137. +                return;
  138. +            if (player->HasAura(SPELL_RAM_FATIGUE) && me->GetDistance(player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()) <= 7.5f)
  139. +                player->RemoveAura(SPELL_RAM_FATIGUE);
  140. +        }
  141. +    };
  142. +
  143. +    CreatureAI *GetAI(Creature *creature) const
  144. +    {
  145. +        return new npc_brewfest_apple_triggerAI(creature);
  146. +    }
  147. +};
  148. +
  149. +/*####
  150. +## spell_brewfest_speed
  151. +####*/
  152. +
  153. +class spell_brewfest_speed : public SpellScriptLoader
  154. +{
  155. +public:
  156. +    spell_brewfest_speed() : SpellScriptLoader("spell_brewfest_speed") {}
  157. +
  158. +    class spell_brewfest_speed_AuraScript : public AuraScript
  159. +    {
  160. +        PrepareAuraScript(spell_brewfest_speed_AuraScript);
  161. +
  162. +        bool Validate(SpellInfo const* /*spellInfo*/)
  163. +        {
  164. +            if (!sSpellMgr->GetSpellInfo(SPELL_RAM_FATIGUE)) //Усталость барана
  165. +                return false;
  166. +            if (!sSpellMgr->GetSpellInfo(SPELL_RAMSTEIN_SWIFT_WORK_RAM)) //Стремительный рабочий баран Рамштайна
  167. +                return false;
  168. +            if (!sSpellMgr->GetSpellInfo(SPELL_BREWFEST_RAM)) // Арендованный скаковой баран
  169. +                return false;
  170. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_GALLOP)) //42994
  171. +                return false;
  172. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_CANTER)) // 42993
  173. +                return false;
  174. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_TROT)) // 42992
  175. +                return false;
  176. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_NORMAL)) // 43310
  177. +                return false;
  178. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_GALLOP))
  179. +                return false;
  180. +            if (!sSpellMgr->GetSpellInfo(SPELL_SPEED_RAM_EXHAUSED)) // Изнемогший баран
  181. +                return false;
  182. +            return true;
  183. +        }
  184. +
  185. +        void HandlePeriodicTick(AuraEffect const* aurEff)
  186. +        {
  187. +            if (GetId() == SPELL_SPEED_RAM_EXHAUSED)
  188. +                return;
  189. +
  190. +            Player* pCaster = GetCaster()->ToPlayer();
  191. +            if (!pCaster)
  192. +                return;
  193. +            int i;
  194. +            switch (GetId())
  195. +            {
  196. +            case SPELL_SPEED_RAM_GALLOP:
  197. +                for (i = 0; i < 5; i++)
  198. +                    pCaster->AddAura(SPELL_RAM_FATIGUE, pCaster);
  199. +                break;
  200. +            case SPELL_SPEED_RAM_CANTER:
  201. +                pCaster->AddAura(SPELL_RAM_FATIGUE, pCaster);
  202. +                break;
  203. +            case SPELL_SPEED_RAM_TROT:
  204. +                if (pCaster->HasAura(SPELL_RAM_FATIGUE))
  205. +                    if (pCaster->GetAura(SPELL_RAM_FATIGUE)->GetStackAmount() <= 2)
  206. +                        pCaster->RemoveAura(SPELL_RAM_FATIGUE);
  207. +                    else
  208. +                        pCaster->GetAura(SPELL_RAM_FATIGUE)->ModStackAmount(-2);
  209. +                break;
  210. +            case SPELL_SPEED_RAM_NORMAL:
  211. +                if (pCaster->HasAura(SPELL_RAM_FATIGUE))
  212. +                    if (pCaster->GetAura(SPELL_RAM_FATIGUE)->GetStackAmount() <= 4)
  213. +                        pCaster->RemoveAura(SPELL_RAM_FATIGUE);
  214. +                    else
  215. +                        pCaster->GetAura(SPELL_RAM_FATIGUE)->ModStackAmount(-4);
  216. +                break;
  217. +            }
  218. +
  219. +            switch (aurEff->GetId())
  220. +            {
  221. +            case SPELL_SPEED_RAM_TROT:
  222. +                if (aurEff->GetTickNumber() == 4)
  223. +                    pCaster->KilledMonsterCredit(NPC_SPEED_BUNNY_GREEN, 0);
  224. +                break;
  225. +            case SPELL_SPEED_RAM_CANTER:
  226. +                if (aurEff->GetTickNumber() == 8)
  227. +                    pCaster->KilledMonsterCredit(NPC_SPEED_BUNNY_YELLOW, 0);
  228. +                break;
  229. +            case SPELL_SPEED_RAM_GALLOP:
  230. +                if (aurEff->GetTickNumber() == 8)
  231. +                    pCaster->KilledMonsterCredit(NPC_SPEED_BUNNY_RED, 0);
  232. +                break;
  233. +            }
  234. +            if (pCaster->HasAura(SPELL_RAM_FATIGUE))
  235. +                if (pCaster->GetAura(SPELL_RAM_FATIGUE)->GetStackAmount() >= 100)
  236. +                    pCaster->CastSpell(pCaster, SPELL_SPEED_RAM_EXHAUSED, false);
  237. +        }
  238. +
  239. +        void OnRemove(AuraEffect const * aurEff, AuraEffectHandleModes /*mode*/)
  240. +        {
  241. +            Player* pCaster = GetCaster()->ToPlayer();
  242. +            if (!pCaster)
  243. +                return;
  244. +            if (!pCaster->HasAura(SPELL_BREWFEST_RAM) || !pCaster->HasAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM))
  245. +                return;
  246. +            if (GetId() == SPELL_SPEED_RAM_EXHAUSED)
  247. +            {
  248. +                if (pCaster->HasAura(SPELL_RAM_FATIGUE))
  249. +                    pCaster->GetAura(SPELL_RAM_FATIGUE)->ModStackAmount(-15);
  250. +            } else if (!pCaster->HasAura(SPELL_RAM_FATIGUE) || pCaster->GetAura(SPELL_RAM_FATIGUE)->GetStackAmount() < 100)
  251. +
  252. +                switch (GetId())
  253. +            {
  254. +                case SPELL_SPEED_RAM_GALLOP:
  255. +                    if (!pCaster->HasAura(SPELL_SPEED_RAM_EXHAUSED))
  256. +                        pCaster->CastSpell(pCaster, SPELL_SPEED_RAM_CANTER, false);
  257. +                    break;
  258. +                case SPELL_SPEED_RAM_CANTER:
  259. +                    if (!pCaster->HasAura(SPELL_SPEED_RAM_GALLOP))
  260. +                        pCaster->CastSpell(pCaster, SPELL_SPEED_RAM_TROT, false);
  261. +                    break;
  262. +                case SPELL_SPEED_RAM_TROT:
  263. +                    if (!pCaster->HasAura(SPELL_SPEED_RAM_CANTER))
  264. +                        pCaster->CastSpell(pCaster, SPELL_SPEED_RAM_NORMAL, false);
  265. +                    break;
  266. +            }
  267. +        }
  268. +
  269. +        void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
  270. +        {
  271. +            Player* pCaster = GetCaster()->ToPlayer();
  272. +
  273. +            if (!pCaster)
  274. +                return;
  275. +
  276. +            switch (GetId())
  277. +            {
  278. +            case SPELL_SPEED_RAM_GALLOP:
  279. +                pCaster->GetAura(SPELL_SPEED_RAM_GALLOP)->SetDuration(4000);
  280. +                break;
  281. +            case SPELL_SPEED_RAM_CANTER:
  282. +                pCaster->GetAura(SPELL_SPEED_RAM_CANTER)->SetDuration(4000);
  283. +                break;
  284. +            case SPELL_SPEED_RAM_TROT:
  285. +                pCaster->GetAura(SPELL_SPEED_RAM_TROT)->SetDuration(4000);
  286. +                break;
  287. +            }
  288. +        }
  289. +
  290. +        void Register()
  291. +        {
  292. +            OnEffectApply += AuraEffectApplyFn(spell_brewfest_speed_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, AURA_EFFECT_HANDLE_REAL);
  293. +            OnEffectPeriodic += AuraEffectPeriodicFn(spell_brewfest_speed_AuraScript::HandlePeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_DUMMY);
  294. +            OnEffectRemove += AuraEffectRemoveFn(spell_brewfest_speed_AuraScript::OnRemove, EFFECT_2, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, AURA_EFFECT_HANDLE_REAL);
  295. +        }
  296. +    };
  297. +
  298. +    AuraScript* GetAuraScript() const
  299. +    {
  300. +        return new spell_brewfest_speed_AuraScript();
  301. +    }
  302. +};
  303. +
  304. +/*######
  305. +## Q Пей до дна!
  306. +######*/
  307. +
  308. +enum BrewfestQuestChugAndChuck
  309. +{
  310. +    QUEST_CHUG_AND_CHUCK_A      = 12022,
  311. +    QUEST_CHUG_AND_CHUCK_H      = 12191,
  312. +
  313. +    NPC_BREWFEST_STOUT          = 24108
  314. +};
  315. +
  316. +class item_brewfest_ChugAndChuck : public ItemScript
  317. +{
  318. +public:
  319. +    item_brewfest_ChugAndChuck() : ItemScript("item_brewfest_ChugAndChuck") { }
  320. +
  321. +    bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*pTargets*/)
  322. +    {
  323. +        if (player->GetQuestStatus(QUEST_CHUG_AND_CHUCK_A) == QUEST_STATUS_INCOMPLETE
  324. +            || player->GetQuestStatus(QUEST_CHUG_AND_CHUCK_H) == QUEST_STATUS_INCOMPLETE)
  325. +        {
  326. +            if (Creature* pStout = player->FindNearestCreature(NPC_BREWFEST_STOUT, 10.0f)) // spell range
  327. +            {
  328. +                return false;
  329. +            } else
  330. +                player->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL);
  331. +        } else
  332. +            player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
  333. +        return true;
  334. +    }
  335. +};
  336. +
  337. +class item_brewfest_ram_reins : public ItemScript
  338. +{
  339. +public:
  340. +    item_brewfest_ram_reins() : ItemScript("item_brewfest_ram_reins") { }
  341. +
  342. +    bool OnUse(Player* player, Item* pItem, const SpellCastTargets & /*pTargets*/)
  343. +    {
  344. +        if ((player->HasAura(SPELL_BREWFEST_RAM) || player->HasAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM)) && !player->HasAura(SPELL_SPEED_RAM_EXHAUSED))
  345. +        {
  346. +            if (player->HasAura(SPELL_SPEED_RAM_NORMAL))
  347. +                player->CastSpell(player, SPELL_SPEED_RAM_TROT, false);
  348. +            else if (player->HasAura(SPELL_SPEED_RAM_TROT))
  349. +            {
  350. +                if (player->GetAura(SPELL_SPEED_RAM_TROT)->GetDuration() < 3000)
  351. +                    player->GetAura(SPELL_SPEED_RAM_TROT)->SetDuration(4000);
  352. +                else
  353. +                    player->CastSpell(player, SPELL_SPEED_RAM_CANTER, false);
  354. +            } else if (player->HasAura(SPELL_SPEED_RAM_CANTER))
  355. +            {
  356. +                if (player->GetAura(SPELL_SPEED_RAM_CANTER)->GetDuration() < 3000)
  357. +                    player->GetAura(SPELL_SPEED_RAM_CANTER)->SetDuration(4000);
  358. +                else
  359. +                    player->CastSpell(player, SPELL_SPEED_RAM_GALLOP, false);
  360. +            } else if (player->HasAura(SPELL_SPEED_RAM_GALLOP))
  361. +                player->GetAura(SPELL_SPEED_RAM_GALLOP)->SetDuration(4000);
  362. +        }
  363. +        else
  364. +            player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
  365. +
  366. +        return true;
  367. +    }
  368. +};
  369. +
  370. +/*####
  371. +## npc_brewfest_keg_thrower
  372. +####*/
  373. +
  374. +enum BrewfestKegThrower
  375. +{
  376. +    SPELL_THROW_KEG     = 43660, // Хмельной фестиваль - брошенный бочонок - DND
  377. +    ITEM_BREWFEST_KEG   = 33797 // Переносной холодильник для пива
  378. +};
  379. +
  380. +class npc_brewfest_keg_thrower : public CreatureScript
  381. +{
  382. +public:
  383. +    npc_brewfest_keg_thrower() : CreatureScript("npc_brewfest_keg_thrower") { }
  384. +
  385. +    struct npc_brewfest_keg_throwerAI : public ScriptedAI
  386. +    {
  387. +        npc_brewfest_keg_throwerAI(Creature* c) : ScriptedAI(c) {}
  388. +
  389. +        void MoveInLineOfSight(Unit *who)
  390. +        {
  391. +            Player *player = who->ToPlayer();
  392. +            if (!player)
  393. +                return;
  394. +            if ((player->HasAura(SPELL_BREWFEST_RAM) || player->HasAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM))
  395. +                && me->GetDistance(player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()) <= 25.0f
  396. +                && !player->HasItemCount(ITEM_BREWFEST_KEG, 1))
  397. +            {
  398. +                me->CastSpell(player, SPELL_THROW_KEG, false);
  399. +                me->CastSpell(player, 42414, false);
  400. +            }
  401. +        }
  402. +    };
  403. +
  404. +    CreatureAI *GetAI(Creature *creature) const
  405. +    {
  406. +        return new npc_brewfest_keg_throwerAI(creature);
  407. +    }
  408. +};
  409. +
  410. +/*####
  411. +## Туда и обратно
  412. +####*/
  413. +
  414. +enum BrewfestKegReceiver
  415. +{
  416. +    SPELL_CREATE_TICKETS            = 44501, // Holiday - Brewfest - Daily - Relay Race - Create Tickets - DND
  417. +
  418. +    QUEST_THERE_AND_BACK_AGAIN_A    = 11122,
  419. +    QUEST_THERE_AND_BACK_AGAIN_H    = 11412,
  420. +
  421. +    NPC_BREWFEST_DELIVERY_BUNNY     = 24337 // [DND] Brewfest Delivery Bunny
  422. +};
  423. +
  424. +class npc_brewfest_keg_receiver : public CreatureScript
  425. +{
  426. +public:
  427. +    npc_brewfest_keg_receiver() : CreatureScript("npc_brewfest_keg_receiver") { }
  428. +
  429. +    struct npc_brewfest_keg_receiverAI : public ScriptedAI
  430. +    {
  431. +        npc_brewfest_keg_receiverAI(Creature* c) : ScriptedAI(c) {}
  432. +
  433. +        void MoveInLineOfSight(Unit *who)
  434. +        {
  435. +            Player *player = who->ToPlayer();
  436. +            if (!player)
  437. +                return;
  438. +
  439. +            if ((player->HasAura(SPELL_BREWFEST_RAM) || player->HasAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM))
  440. +                && me->GetDistance(player->GetPositionX(),player->GetPositionY(),player->GetPositionZ()) <= 5.0f
  441. +                && player->HasItemCount(ITEM_BREWFEST_KEG, 1))
  442. +            {
  443. +                player->CastSpell(me, SPELL_THROW_KEG, true);
  444. +                player->DestroyItemCount(ITEM_BREWFEST_KEG, 1, true);
  445. +                if (player->HasAura(SPELL_BREWFEST_RAM))
  446. +                    player->GetAura(SPELL_BREWFEST_RAM)->SetDuration(player->GetAura(SPELL_BREWFEST_RAM)->GetDuration() + 30000);
  447. +                if (player->HasAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM))
  448. +                    player->GetAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM)->SetDuration(player->GetAura(SPELL_RAMSTEIN_SWIFT_WORK_RAM)->GetDuration() + 30000);
  449. +                if (player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_A)
  450. +                    || player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_H))
  451. +                {
  452. +                    player->CastSpell(player, SPELL_CREATE_TICKETS, true);
  453. +                }
  454. +                else
  455. +                {
  456. +                    player->KilledMonsterCredit(NPC_BREWFEST_DELIVERY_BUNNY, 0);
  457. +                    if (player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_A) == QUEST_STATUS_INCOMPLETE)
  458. +                        player->AreaExploredOrEventHappens(QUEST_THERE_AND_BACK_AGAIN_A);
  459. +                    if (player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_H) == QUEST_STATUS_INCOMPLETE)
  460. +                        player->AreaExploredOrEventHappens(QUEST_THERE_AND_BACK_AGAIN_H);
  461. +                    if (player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_A) == QUEST_STATUS_COMPLETE
  462. +                        || player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_H) == QUEST_STATUS_COMPLETE)
  463. +                        player->RemoveAura(SPELL_BREWFEST_RAM);
  464. +                }
  465. +            }
  466. +        }
  467. +    };
  468. +
  469. +    CreatureAI *GetAI(Creature *creature) const
  470. +    {
  471. +        return new npc_brewfest_keg_receiverAI(creature);
  472. +    }
  473. +};
  474. +
  475. +/*####
  476. +## npc_brewfest_ram_master
  477. +####*/
  478. +
  479. +#define GOSSIP_ITEM_RAM "Do you have additional work?"
  480. +#define GOSSIP_ITEM_RAM_REINS "Give me another Ram Racing Reins"
  481. +#define SPELL_BREWFEST_SUMMON_RAM 43720 // Trigger Brewfest Racing Ram - Relay Race - Intro
  482. +
  483. +class npc_brewfest_ram_master : public CreatureScript
  484. +{
  485. +public:
  486. +    npc_brewfest_ram_master() : CreatureScript("npc_brewfest_ram_master") { }
  487. +
  488. +    bool OnGossipHello(Player *player, Creature *creature)
  489. +    {
  490. +        if (creature->isQuestGiver())
  491. +            player->PrepareQuestMenu(creature->GetGUID());
  492. +
  493. +        if (player->HasSpellCooldown(SPELL_BREWFEST_SUMMON_RAM)
  494. +            && !player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_A)
  495. +            && !player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_H)
  496. +            && (player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_A) == QUEST_STATUS_INCOMPLETE
  497. +            || player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_H) == QUEST_STATUS_INCOMPLETE))
  498. +            player->RemoveSpellCooldown(SPELL_BREWFEST_SUMMON_RAM);
  499. +
  500. +        if (!player->HasAura(SPELL_BREWFEST_RAM) && ((player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_A) == QUEST_STATUS_INCOMPLETE
  501. +            || player->GetQuestStatus(QUEST_THERE_AND_BACK_AGAIN_H) == QUEST_STATUS_INCOMPLETE
  502. +            || (!player->HasSpellCooldown(SPELL_BREWFEST_SUMMON_RAM) &&
  503. +            (player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_A)
  504. +            || player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_H))))))
  505. +            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RAM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  506. +
  507. +        if ((player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_A)
  508. +            || player->GetQuestRewardStatus(QUEST_THERE_AND_BACK_AGAIN_H))
  509. +            && !player->HasItemCount(33306, 1, true))
  510. +            player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RAM_REINS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
  511. +
  512. +        player->SEND_GOSSIP_MENU(384, creature->GetGUID());
  513. +        return true;
  514. +    }
  515. +
  516. +    bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction)
  517. +    {
  518. +        if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
  519. +        {
  520. +            if (player->HasItemCount(ITEM_BREWFEST_KEG, 1))
  521. +                player->DestroyItemCount(ITEM_BREWFEST_KEG, 1, true);
  522. +            player->CastSpell(player, SPELL_BREWFEST_SUMMON_RAM, true);
  523. +            player->AddSpellCooldown(SPELL_BREWFEST_SUMMON_RAM, 0, time(NULL) + 18*60*60);
  524. +        }
  525. +        if (uiAction == GOSSIP_ACTION_INFO_DEF+2)
  526. +        {
  527. +            player->CastSpell(player, 44371, false);
  528. +        }
  529. +        return true;
  530. +    }
  531. +};
  532. +
  533. +/*######
  534. +## npc_coren direbrew
  535. +######*/
  536. +
  537. +enum CorenDirebrew
  538. +{
  539. +    SPELL_DISARM                = 47310, // Обезвреживание Зловещего Варева
  540. +    SPELL_DISARM_PRECAST        = 47407, // Обезвреживание Зловещего Варева (без затраты маны)
  541. +    SPELL_MOLE_MACHINE_EMERGE   = 50313, // bad id. Появление буровой установки
  542. +
  543. +    NPC_ILSA_DIREBREW           = 26764,
  544. +    NPC_URSULA_DIREBREW         = 26822,
  545. +    NPC_DIREBREW_MINION         = 26776,
  546. +
  547. +    EQUIP_ID_TANKARD            = 48663,
  548. +    FACTION_HOSTILE_COREN       = 736
  549. +};
  550. +
  551. +#define GOSSIP_TEXT_INSULT "Insult Coren Direbrew's brew."
  552. +
  553. +static Position _pos[]=
  554. +{
  555. +    {890.87f, -133.95f, -48.0f, 1.53f},
  556. +    {892.47f, -133.26f, -48.0f, 2.16f},
  557. +    {893.54f, -131.81f, -48.0f, 2.75f}
  558. +};
  559. +
  560. +class npc_coren_direbrew : public CreatureScript
  561. +{
  562. +public:
  563. +    npc_coren_direbrew() : CreatureScript("npc_coren_direbrew") { }
  564. +
  565. +    bool OnGossipHello(Player* player, Creature* creature)
  566. +    {
  567. +        if (creature->isQuestGiver())
  568. +            player->PrepareQuestMenu(creature->GetGUID());
  569. +
  570. +        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT_INSULT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  571. +        player->SEND_GOSSIP_MENU(15858, creature->GetGUID());
  572. +        return true;
  573. +    }
  574. +
  575. +    bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
  576. +    {
  577. +        player->PlayerTalkClass->ClearMenus();
  578. +
  579. +        if (action == GOSSIP_ACTION_INFO_DEF + 1)
  580. +        {
  581. +            creature->setFaction(FACTION_HOSTILE_COREN);
  582. +            creature->AI()->AttackStart(player);
  583. +            creature->AI()->DoZoneInCombat();
  584. +            player->CLOSE_GOSSIP_MENU();
  585. +        }
  586. +
  587. +        return true;
  588. +    }
  589. +
  590. +    struct npc_coren_direbrewAI : public ScriptedAI
  591. +    {
  592. +        npc_coren_direbrewAI(Creature* c) : ScriptedAI(c), _summons(me)
  593. +        {
  594. +        }
  595. +
  596. +        void Reset()
  597. +        {
  598. +            me->RestoreFaction();
  599. +            me->SetCorpseDelay(90); // 1.5 minutes
  600. +
  601. +            _addTimer = 20000;
  602. +            _disarmTimer = urand(10, 15) *IN_MILLISECONDS;
  603. +
  604. +            _spawnedIlsa = false;
  605. +            _spawnedUrsula = false;
  606. +            _summons.DespawnAll();
  607. +
  608. +            for (uint8 i = 0; i < 3; ++i)
  609. +                if (Creature* creature = me->SummonCreature(NPC_DIREBREW_MINION, _pos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
  610. +                    _add[i] = creature->GetGUID();
  611. +        }
  612. +
  613. +        void EnterCombat(Unit* /*who*/)
  614. +        {
  615. +            SetEquipmentSlots(false, EQUIP_ID_TANKARD, EQUIP_ID_TANKARD, EQUIP_NO_CHANGE);
  616. +
  617. +            for (uint8 i = 0; i < 3; ++i)
  618. +            {
  619. +                if (_add[i])
  620. +                {
  621. +                    Creature* creature = ObjectAccessor::GetCreature((*me), _add[i]);
  622. +                    if (creature && creature->isAlive())
  623. +                    {
  624. +                        creature->setFaction(FACTION_HOSTILE_COREN);
  625. +                        creature->SetInCombatWithZone();
  626. +                    }
  627. +                    _add[i] = 0;
  628. +                }
  629. +            }
  630. +        }
  631. +
  632. +        void UpdateAI(uint32 const diff)
  633. +        {
  634. +            if (!UpdateVictim())
  635. +                return;
  636. +
  637. +            // disarm
  638. +            if (_disarmTimer <= diff)
  639. +            {
  640. +                DoCast(SPELL_DISARM_PRECAST);
  641. +                DoCastVictim(SPELL_DISARM, false);
  642. +                _disarmTimer = urand(20, 25) *IN_MILLISECONDS;
  643. +            }
  644. +            else
  645. +                _disarmTimer -= diff;
  646. +
  647. +            // spawn non-elite adds
  648. +            if (_addTimer <= diff)
  649. +            {
  650. +                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
  651. +                {
  652. +                    float posX, posY, posZ;
  653. +                    target->GetPosition(posX, posY, posZ);
  654. +                    target->CastSpell(target, SPELL_MOLE_MACHINE_EMERGE, true, 0, 0, me->GetGUID());
  655. +                    me->SummonCreature(NPC_DIREBREW_MINION, posX, posY, posZ, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
  656. +
  657. +                    _addTimer = 15000;
  658. +                    if (_spawnedIlsa)
  659. +                        _addTimer -= 3000;
  660. +                    if (_spawnedUrsula)
  661. +                        _addTimer -= 3000;
  662. +                }
  663. +            }
  664. +            else
  665. +                _addTimer -= diff;
  666. +
  667. +            if (!_spawnedIlsa && HealthBelowPct(66))
  668. +            {
  669. +                DoSpawnCreature(NPC_ILSA_DIREBREW, 0, 0, 0, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
  670. +                _spawnedIlsa = true;
  671. +            }
  672. +
  673. +            if (!_spawnedUrsula && HealthBelowPct(33))
  674. +            {
  675. +                DoSpawnCreature(NPC_URSULA_DIREBREW, 0, 0, 0, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
  676. +                _spawnedUrsula = true;
  677. +            }
  678. +
  679. +            DoMeleeAttackIfReady();
  680. +        }
  681. +
  682. +        void JustSummoned(Creature* summon)
  683. +        {
  684. +            if (me->getFaction() == FACTION_HOSTILE_COREN)
  685. +            {
  686. +                summon->setFaction(FACTION_HOSTILE_COREN);
  687. +
  688. +                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
  689. +                    summon->AI()->AttackStart(target);
  690. +            }
  691. +
  692. +            _summons.Summon(summon);
  693. +        }
  694. +
  695. +        void JustDied(Unit* /*killer*/)
  696. +        {
  697. +            _summons.DespawnAll();
  698. +
  699. +            // TODO: unhack
  700. +            Map* map = me->GetMap();
  701. +            if (map && map->IsDungeon())
  702. +            {
  703. +                Map::PlayerList const& players = map->GetPlayers();
  704. +                if (!players.isEmpty())
  705. +                    for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
  706. +                        if (Player* player = i->getSource())
  707. +                            if (player->GetDistance(me) < 100.0f)
  708. +                                sLFGMgr->RewardDungeonDoneFor(287, player);
  709. +            }
  710. +        }
  711. +
  712. +    private:
  713. +        SummonList _summons;
  714. +        uint64 _add[3];
  715. +        uint32 _addTimer;
  716. +        uint32 _disarmTimer;
  717. +        bool _spawnedIlsa;
  718. +        bool _spawnedUrsula;
  719. +    };
  720. +
  721. +    CreatureAI* GetAI(Creature* c) const
  722. +    {
  723. +        return new npc_coren_direbrewAI(c);
  724. +    }
  725. +};
  726. +
  727. +/*######
  728. +## dark iron brewmaiden
  729. +######*/
  730. +
  731. +enum Brewmaiden
  732. +{
  733. +    SPELL_SEND_FIRST_MUG            = 47333,
  734. +    SPELL_SEND_SECOND_MUG           = 47339,
  735. +    //SPELL_CREATE_BREW             = 47345,
  736. +    SPELL_HAS_BREW_BUFF             = 47376,
  737. +    //SPELL_HAS_BREW                = 47331,
  738. +    //SPELL_DARK_BREWMAIDENS_STUN   = 47340,
  739. +    SPELL_CONSUME_BREW              = 47377,
  740. +    SPELL_BARRELED                  = 47442,
  741. +    SPELL_CHUCK_MUG                 = 50276
  742. +};
  743. +
  744. +class npc_brewmaiden : public CreatureScript
  745. +{
  746. +public:
  747. +    npc_brewmaiden() : CreatureScript("npc_brewmaiden") { }
  748. +
  749. +    struct npc_brewmaidenAI : public ScriptedAI
  750. +    {
  751. +        npc_brewmaidenAI(Creature* c) : ScriptedAI(c)
  752. +        {
  753. +        }
  754. +
  755. +        void Reset()
  756. +        {
  757. +            _brewTimer = 2000;
  758. +            _barrelTimer = 5000;
  759. +            _chuckMugTimer = 10000;
  760. +        }
  761. +
  762. +        void EnterCombat(Unit* /*who*/)
  763. +        {
  764. +            me->SetInCombatWithZone();
  765. +        }
  766. +
  767. +        void AttackStart(Unit* who)
  768. +        {
  769. +            if (!who)
  770. +                return;
  771. +
  772. +            if (me->Attack(who, true))
  773. +            {
  774. +                me->AddThreat(who, 1.0f);
  775. +                me->SetInCombatWith(who);
  776. +                who->SetInCombatWith(me);
  777. +
  778. +                if (me->GetEntry() == NPC_URSULA_DIREBREW)
  779. +                    me->GetMotionMaster()->MoveFollow(who, 10.0f, 0.0f);
  780. +                else
  781. +                    me->GetMotionMaster()->MoveChase(who);
  782. +            }
  783. +        }
  784. +
  785. +        void SpellHitTarget(Unit* target, SpellInfo const* spell)
  786. +        {
  787. +            // TODO: move to DB
  788. +
  789. +            if (spell->Id == SPELL_SEND_FIRST_MUG)
  790. +                target->CastSpell(target, SPELL_HAS_BREW_BUFF, true);
  791. +
  792. +            if (spell->Id == SPELL_SEND_SECOND_MUG)
  793. +                target->CastSpell(target, SPELL_CONSUME_BREW, true);
  794. +        }
  795. +
  796. +        void UpdateAI(uint32 const diff)
  797. +        {
  798. +            if (!UpdateVictim())
  799. +                return;
  800. +
  801. +            if (_brewTimer <= diff)
  802. +            {
  803. +                if (!me->IsNonMeleeSpellCasted(false))
  804. +                {
  805. +                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
  806. +
  807. +                    if (target && me->GetDistance(target) > 5.0f)
  808. +                    {
  809. +                        DoCast(target, SPELL_SEND_FIRST_MUG);
  810. +                        _brewTimer = 12000;
  811. +                    }
  812. +                }
  813. +            }
  814. +            else
  815. +                _brewTimer -= diff;
  816. +
  817. +            if (_chuckMugTimer <= diff)
  818. +            {
  819. +                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
  820. +                    DoCast(target, SPELL_CHUCK_MUG);
  821. +
  822. +                _chuckMugTimer = 15000;
  823. +            }
  824. +            else
  825. +                _chuckMugTimer -= diff;
  826. +
  827. +            if (me->GetEntry() == NPC_URSULA_DIREBREW)
  828. +            {
  829. +                if (_barrelTimer <= diff)
  830. +                {
  831. +                    if (!me->IsNonMeleeSpellCasted(false))
  832. +                    {
  833. +                        DoCastVictim(SPELL_BARRELED);
  834. +                        _barrelTimer = urand(15, 18) *IN_MILLISECONDS;
  835. +                    }
  836. +                }
  837. +                else
  838. +                    _barrelTimer -= diff;
  839. +            }
  840. +            else
  841. +                DoMeleeAttackIfReady();
  842. +        }
  843. +
  844. +    private:
  845. +        uint32 _brewTimer;
  846. +        uint32 _barrelTimer;
  847. +        uint32 _chuckMugTimer;
  848. +    };
  849. +
  850. +    CreatureAI* GetAI(Creature* c) const
  851. +    {
  852. +        return new npc_brewmaidenAI(c);
  853. +    }
  854. +};
  855. +
  856. +/*######
  857. +## go_mole_machine_console
  858. +######*/
  859. +
  860. +enum MoleMachineConsole
  861. +{
  862. +    SPELL_TELEPORT = 49466 // bad id?
  863. +};
  864. +
  865. +#define GOSSIP_ITEM_MOLE_CONSOLE "[PH] Please teleport me."
  866. +
  867. +class go_mole_machine_console : public GameObjectScript
  868. +{
  869. +public:
  870. +    go_mole_machine_console() : GameObjectScript("go_mole_machine_console") { }
  871. +
  872. +    bool OnGossipHello (Player* player, GameObject* go)
  873. +    {
  874. +        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MOLE_CONSOLE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  875. +        player->SEND_GOSSIP_MENU(12709, go->GetGUID());
  876. +        return true;
  877. +    }
  878. +
  879. +    bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 /*sender*/, uint32 action)
  880. +    {
  881. +        if (action == GOSSIP_ACTION_INFO_DEF + 1)
  882. +            player->CastSpell(player, SPELL_TELEPORT, true);
  883. +
  884. +        return true;
  885. +    }
  886. +};
  887. +
  888. +
  889. +// Dark Iron Guzzler in the Brewfest achievement 'Down With The Dark Iron'
  890. +enum DarkIronGuzzler
  891. +{
  892. +    NPC_DARK_IRON_GUZZLER       = 23709,
  893. +    NPC_DARK_IRON_HERALD        = 24536,
  894. +    NPC_DARK_IRON_SPAWN_BUNNY   = 23894,
  895. +
  896. +    NPC_FESTIVE_KEG_1           = 23702, // Thunderbrew Festive Keg
  897. +    NPC_FESTIVE_KEG_2           = 23700, // Barleybrew Festive Keg
  898. +    NPC_FESTIVE_KEG_3           = 23706, // Gordok Festive Keg
  899. +    NPC_FESTIVE_KEG_4           = 24373, // T'chalis's Festive Keg
  900. +    NPC_FESTIVE_KEG_5           = 24372, // Drohn's Festive Keg
  901. +
  902. +    SPELL_GO_TO_NEW_TARGET      = 42498,
  903. +    SPELL_ATTACK_KEG            = 42393,
  904. +    SPELL_RETREAT               = 42341,
  905. +    SPELL_DRINK                 = 42436,
  906. +
  907. +    SAY_RANDOM              = 0,
  908. +};
  909. +
  910. +class npc_dark_iron_guzzler : public CreatureScript
  911. +{
  912. +public:
  913. +    npc_dark_iron_guzzler() : CreatureScript("npc_dark_iron_guzzler") { }
  914. +
  915. +    CreatureAI *GetAI(Creature* creature) const
  916. +    {
  917. +        return new npc_dark_iron_guzzlerAI(creature);
  918. +    }
  919. +
  920. +    struct npc_dark_iron_guzzlerAI : public ScriptedAI
  921. +    {
  922. +        npc_dark_iron_guzzlerAI(Creature* creature) : ScriptedAI(creature) { }
  923. +
  924. +        bool atKeg;
  925. +        bool playersLost;
  926. +        bool barleyAlive;
  927. +        bool thunderAlive;
  928. +        bool gordokAlive;
  929. +        bool drohnAlive;
  930. +        bool tchaliAlive;
  931. +
  932. +        uint32 AttackKegTimer;
  933. +        uint32 TalkTimer;
  934. +
  935. +        void Reset()
  936. +        {
  937. +            AttackKegTimer = 5000;
  938. +            TalkTimer = (urand(1000, 120000));
  939. +            me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
  940. +        }
  941. +
  942. +        void IsSummonedBy(Unit* summoner)
  943. +        {
  944. +            // Only cast the spell on spawn
  945. +            DoCast(me, SPELL_GO_TO_NEW_TARGET);
  946. +        }
  947. +
  948. +        // These values are set through SAI - when a Festive Keg dies it will set data to all Dark Iron Guzzlers within 3 yards (the killers)
  949. +        void SetData(uint32 type, uint32 data)
  950. +        {
  951. +            if (type == 10 && data == 10)
  952. +            {
  953. +                DoCast(me, SPELL_GO_TO_NEW_TARGET);
  954. +                thunderAlive = false;
  955. +            }
  956. +
  957. +            if (type == 11 && data == 11)
  958. +            {
  959. +                DoCast(me, SPELL_GO_TO_NEW_TARGET);
  960. +                barleyAlive = false;
  961. +            }
  962. +
  963. +            if (type == 12 && data == 12)
  964. +            {
  965. +                DoCast(me, SPELL_GO_TO_NEW_TARGET);
  966. +                gordokAlive = false;
  967. +            }
  968. +
  969. +            if (type == 13 && data == 13)
  970. +            {
  971. +                DoCast(me, SPELL_GO_TO_NEW_TARGET);
  972. +                drohnAlive = false;
  973. +            }
  974. +
  975. +            if (type == 14 && data == 14)
  976. +            {
  977. +                DoCast(me, SPELL_GO_TO_NEW_TARGET);
  978. +                tchaliAlive = false;
  979. +            }
  980. +        }
  981. +
  982. +        // As you can see here we do not have to use a spellscript for this
  983. +        void SpellHit(Unit* caster, const SpellInfo* spell)
  984. +        {
  985. +            if (spell->Id == SPELL_DRINK)
  986. +            {
  987. +                // Fake death - it's only visual!
  988. +                me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD);
  989. +                me->StopMoving();
  990. +
  991. +                // Time based on information from videos
  992. +                me->ForcedDespawn(7000);
  993. +            }
  994. +
  995. +            // Retreat - run back
  996. +            if (spell->Id == SPELL_RETREAT)
  997. +            {
  998. +                // Remove walking flag so we start running
  999. +                me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
  1000. +
  1001. +                if (me->GetAreaId() == 1296)
  1002. +                {
  1003. +                    me->GetMotionMaster()->MovePoint(1, 1197.63f, -4293.571f, 21.243f);
  1004. +                }
  1005. +                else if (me->GetAreaId() == 1)
  1006. +                {
  1007. +                     me->GetMotionMaster()->MovePoint(2, -5152.3f, -603.529f, 398.356f);
  1008. +                }
  1009. +            }
  1010. +
  1011. +            if (spell->Id == SPELL_GO_TO_NEW_TARGET)
  1012. +            {
  1013. +                // If we're at Durotar we target different kegs if we are at at Dun Morogh
  1014. +                if (me->GetAreaId() == 1296)
  1015. +                {
  1016. +                    if (drohnAlive && gordokAlive && tchaliAlive)
  1017. +                    {
  1018. +                        switch (urand(0, 2))
  1019. +                        {
  1020. +                            case 0: // Gordok Festive Keg
  1021. +                                me->GetMotionMaster()->MovePoint(4, 1220.86f, -4297.37f, 21.192f);
  1022. +                                break;
  1023. +                            case 1: // Drohn's Festive Keg
  1024. +                                me->GetMotionMaster()->MovePoint(5, 1185.98f, -4312.98f, 21.294f);
  1025. +                                break;
  1026. +                            case 2: // Ti'chali's Festive Keg
  1027. +                                me->GetMotionMaster()->MovePoint(6, 1184.12f, -4275.21f, 21.191f);
  1028. +                                break;
  1029. +                        }
  1030. +                    }
  1031. +                    else if (!drohnAlive)
  1032. +                    {
  1033. +                        switch (urand(0, 1))
  1034. +                        {
  1035. +                            case 0: // Gordok Festive Keg
  1036. +                                me->GetMotionMaster()->MovePoint(4, 1220.86f, -4297.37f, 21.192f);
  1037. +                                break;
  1038. +                            case 1: // Ti'chali's Festive Keg
  1039. +                                me->GetMotionMaster()->MovePoint(6, 1184.12f, -4275.21f, 21.191f);
  1040. +                                break;
  1041. +                        }
  1042. +                    }
  1043. +                    else if (!gordokAlive)
  1044. +                    {
  1045. +                        switch (urand(0, 1))
  1046. +                        {
  1047. +                            case 0: // Drohn's Festive Keg
  1048. +                                me->GetMotionMaster()->MovePoint(5, 1185.98f, -4312.98f, 21.294f);
  1049. +                                break;
  1050. +                            case 1: // Ti'chali's Festive Keg
  1051. +                                me->GetMotionMaster()->MovePoint(6, 1184.12f, -4275.21f, 21.191f);
  1052. +                                break;
  1053. +                        }
  1054. +                    }
  1055. +                    else if (!tchaliAlive)
  1056. +                    {
  1057. +                        switch (urand(0, 1))
  1058. +                        {
  1059. +                            case 0: // Gordok Festive Keg
  1060. +                                me->GetMotionMaster()->MovePoint(4, 1220.86f, -4297.37f, 21.192f);
  1061. +                                break;
  1062. +                            case 1: // Drohn's Festive Keg
  1063. +                                me->GetMotionMaster()->MovePoint(5, 1185.98f, -4312.98f, 21.294f);
  1064. +                                break;
  1065. +                        }
  1066. +                    }
  1067. +                }
  1068. +                // If we're at Dun Morogh we target different kegs if we are at Durotar
  1069. +                else if (me->GetAreaId() == 1)
  1070. +                {
  1071. +                    if (barleyAlive && gordokAlive && thunderAlive)
  1072. +                    {
  1073. +                        switch (urand(0, 2))
  1074. +                        {
  1075. +                            case 0: // Barleybrew Festive Keg
  1076. +                                me->GetMotionMaster()->MovePoint(7, -5183.67f, -599.58f, 397.177f);
  1077. +                                break;
  1078. +                            case 1: // Thunderbrew Festive Keg
  1079. +                                me->GetMotionMaster()->MovePoint(8, -5159.53f, -629.52f, 397.213f);
  1080. +                                break;
  1081. +                            case 2: // Gordok Festive Keg
  1082. +                                me->GetMotionMaster()->MovePoint(9, -5148.01f, -578.34f, 397.177f);
  1083. +                                break;
  1084. +                        }
  1085. +                    }
  1086. +                    else if (!barleyAlive)
  1087. +                    {
  1088. +                        switch (urand(0, 1))
  1089. +                        {
  1090. +                            case 0: // Thunderbrew Festive Keg
  1091. +                                me->GetMotionMaster()->MovePoint(8, -5159.53f, -629.52f, 397.213f);
  1092. +                                break;
  1093. +                            case 1: // Gordok Festive Keg
  1094. +                                me->GetMotionMaster()->MovePoint(9, -5148.01f, -578.34f, 397.177f);
  1095. +                                break;
  1096. +                        }
  1097. +                    }
  1098. +                    else if (!gordokAlive)
  1099. +                    {
  1100. +                        switch (urand(0, 1))
  1101. +                        {
  1102. +                            case 0: // Barleybrew Festive Keg
  1103. +                                me->GetMotionMaster()->MovePoint(7, -5183.67f, -599.58f, 397.177f);
  1104. +                                break;
  1105. +                            case 1: // Thunderbrew Festive Keg
  1106. +                                me->GetMotionMaster()->MovePoint(8, -5159.53f, -629.52f, 397.213f);
  1107. +                                break;
  1108. +                        }
  1109. +                    }
  1110. +                    else if (!thunderAlive)
  1111. +                    {
  1112. +                        switch (urand(0, 1))
  1113. +                        {
  1114. +                            case 0: // Barleybrew Festive Keg
  1115. +                                me->GetMotionMaster()->MovePoint(7, -5183.67f, -599.58f, 397.177f);
  1116. +                                break;
  1117. +                            case 1: // Gordok Festive Keg
  1118. +                                me->GetMotionMaster()->MovePoint(9, -5148.01f, -578.34f, 397.177f);
  1119. +                                break;
  1120. +                        }
  1121. +                    }
  1122. +                }
  1123. +                atKeg = false;
  1124. +            }
  1125. +        }
  1126. +
  1127. +        void MovementInform(uint32 Type, uint32 PointId)
  1128. +        {
  1129. +            if (Type != POINT_MOTION_TYPE)
  1130. +                return;
  1131. +
  1132. +            // Arrived at the retreat spot, we should despawn
  1133. +            if (PointId == 1 || PointId == 2)
  1134. +                me->ForcedDespawn(1000);
  1135. +
  1136. +            // Arrived at the new keg - the spell has conditions in database
  1137. +            if (PointId == 4 || PointId == 5 || PointId == 6 || PointId == 7 || PointId == 8 || PointId == 9)
  1138. +            {
  1139. +                DoCast(SPELL_ATTACK_KEG);
  1140. +                me->SetByteFlag(UNIT_FIELD_BYTES_1, 1, 0x01); // Sit down
  1141. +                atKeg = true;
  1142. +            }
  1143. +        }
  1144. +
  1145. +        void UpdateAI(const uint32 diff)
  1146. +        {
  1147. +            if (!IsHolidayActive(HOLIDAY_BREWFEST))
  1148. +                return;
  1149. +
  1150. +            // If all kegs are dead we should retreat because we have won
  1151. +            if ((!gordokAlive && !thunderAlive && !barleyAlive) || (!gordokAlive && !drohnAlive && !tchaliAlive))
  1152. +            {
  1153. +                DoCast(me, SPELL_RETREAT);
  1154. +
  1155. +                // We are doing this because we'll have to reset our scripts when we won
  1156. +                if (Creature* herald = me->FindNearestCreature(NPC_DARK_IRON_HERALD, 100.0f))
  1157. +                    herald->AI()->SetData(20, 20);
  1158. +
  1159. +                // Despawn all summon bunnies so they will stop summoning guzzlers
  1160. +                if (Creature* spawnbunny = me->FindNearestCreature(NPC_DARK_IRON_SPAWN_BUNNY, 100.0f))
  1161. +                    spawnbunny->ForcedDespawn();
  1162. +            }
  1163. +
  1164. +            if (TalkTimer <= diff)
  1165. +            {
  1166. +                me->AI()->Talk(SAY_RANDOM);
  1167. +                TalkTimer = (urand(44000, 120000));
  1168. +            } else TalkTimer -= diff;
  1169. +
  1170. +            // Only happens if we're at keg
  1171. +            if (atKeg)
  1172. +            {
  1173. +                if (AttackKegTimer <= diff)
  1174. +                {
  1175. +                    DoCast(SPELL_ATTACK_KEG);
  1176. +                    AttackKegTimer = 5000;
  1177. +                } else AttackKegTimer -= diff;
  1178. +            }
  1179. +        }
  1180. +    };
  1181. +};
  1182. +
  1183. +void AddSC_boss_coren_direbrew()
  1184. +{
  1185. +    //
  1186. +    new npc_brewfest_trigger;
  1187. +    new spell_brewfest_speed;
  1188. +    new npc_brewfest_apple_trigger;
  1189. +    //
  1190. +    new item_brewfest_ChugAndChuck;
  1191. +    new item_brewfest_ram_reins;
  1192. +    new npc_brewfest_keg_thrower;
  1193. +    new npc_brewfest_keg_receiver;
  1194. +    new npc_brewfest_ram_master;
  1195. +    //
  1196. +    new npc_coren_direbrew;
  1197. +    new npc_brewmaiden;
  1198. +    new go_mole_machine_console;
  1199. +    //
  1200. +    new npc_dark_iron_guzzler;
  1201. +}
  1202. diff --git a/src/server/scripts/EasternKingdoms/CMakeLists.txt b/src/server/scripts/EasternKingdoms/CMakeLists.txt
  1203. index af106ea..d8e328b 100644
  1204. --- a/src/server/scripts/EasternKingdoms/CMakeLists.txt
  1205. +++ b/src/server/scripts/EasternKingdoms/CMakeLists.txt
  1206. @@ -68,6 +68,7 @@ set(scripts_STAT_SRCS
  1207.    EasternKingdoms/BlackrockDepths/blackrock_depths.h
  1208.    EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp
  1209.    EasternKingdoms/BlackrockDepths/boss_magmus.cpp
  1210. +  EasternKingdoms/BlackrockDepths/boss_coren_direbrew.cpp
  1211.    EasternKingdoms/ironforge.cpp
  1212.    EasternKingdoms/ScarletEnclave/chapter2.cpp
  1213.    EasternKingdoms/ScarletEnclave/chapter5.cpp
  1214. diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp
  1215. index a9ed794..980ed69 100644
  1216. --- a/src/server/scripts/World/areatrigger_scripts.cpp
  1217. +++ b/src/server/scripts/World/areatrigger_scripts.cpp
  1218. @@ -368,6 +368,61 @@ class AreaTrigger_at_sholazar_waygate : public AreaTriggerScript
  1219.          }
  1220.  };
  1221.  
  1222. +/*####
  1223. +## at_brewfest trigger 1
  1224. +####*/
  1225. +
  1226. +enum Brewfest
  1227. +{
  1228. +        NPC_TAPPER_SWINDLEKEG     = 24711,
  1229. +        NPC_IPFELKOFER_IRONKEG    = 24710,
  1230. +
  1231. +        AT_BREWFEST_DUROTAR       = 4829,
  1232. +        AT_BREWFEST_DUN_MOROGH    = 4820,
  1233. +
  1234. +        SAY_WELCOME               = 4,
  1235. +
  1236. +        AREATRIGGER_TALK_COOLDOWN = 5, // in seconds
  1237. +};
  1238. +
  1239. +class AreaTrigger_at_brewfest : public AreaTriggerScript
  1240. +{
  1241. +        public:
  1242. +                AreaTrigger_at_brewfest() : AreaTriggerScript("at_brewfest")
  1243. +                {
  1244. +                        // Initialize for cooldown
  1245. +                        _triggerTimes[AT_BREWFEST_DUROTAR] = _triggerTimes[AT_BREWFEST_DUN_MOROGH] = 0;
  1246. +                }
  1247. +
  1248. +                bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
  1249. +                {
  1250. +                        uint32 triggerId = trigger->id;
  1251. +                        // Second trigger happened too early after first, skip for now
  1252. +                        if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
  1253. +                                return false;
  1254. +
  1255. +                        switch (triggerId)
  1256. +                        {
  1257. +                                case AT_BREWFEST_DUROTAR:
  1258. +                                        if (Creature* tapper = player->FindNearestCreature(NPC_TAPPER_SWINDLEKEG, 20.0f))
  1259. +                                                tapper->AI()->Talk(SAY_WELCOME, player->GetGUID());
  1260. +                                        break;
  1261. +                                case AT_BREWFEST_DUN_MOROGH:
  1262. +                                        if (Creature* ipfelkofer = player->FindNearestCreature(NPC_IPFELKOFER_IRONKEG, 20.0f))
  1263. +                                                ipfelkofer->AI()->Talk(SAY_WELCOME, player->GetGUID());
  1264. +                                        break;
  1265. +                                default:
  1266. +                                        break;
  1267. +                        }
  1268. +
  1269. +                        _triggerTimes[triggerId] = sWorld->GetGameTime();
  1270. +                        return false;
  1271. +                }
  1272. +
  1273. +        private:
  1274. +                std::map<uint32, time_t> _triggerTimes;
  1275. +};
  1276. +
  1277.  void AddSC_areatrigger_scripts()
  1278.  {
  1279.      new AreaTrigger_at_aldurthar_gate();
  1280. @@ -379,4 +434,5 @@ void AddSC_areatrigger_scripts()
  1281.      new AreaTrigger_at_scent_larkorwi();
  1282.      new AreaTrigger_at_last_rites();
  1283.      new AreaTrigger_at_sholazar_waygate();
  1284. +    new AreaTrigger_at_brewfest();
  1285.  }
  1286. diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
  1287. index a5e5b46..137c711 100644
  1288. --- a/src/server/scripts/World/npcs_special.cpp
  1289. +++ b/src/server/scripts/World/npcs_special.cpp
  1290. @@ -1594,7 +1594,7 @@ public:
  1291.  /*####
  1292.  ## npc_brewfest_reveler
  1293.  ####*/
  1294. -
  1295. +/*
  1296.  class npc_brewfest_reveler : public CreatureScript
  1297.  {
  1298.  public:
  1299. @@ -1617,7 +1617,7 @@ public:
  1300.      {
  1301.          return new npc_brewfest_revelerAI(creature);
  1302.      }
  1303. -};
  1304. +};*/
  1305.  
  1306.  /*####
  1307.  ## npc_winter_reveler
  1308. @@ -2660,7 +2660,7 @@ void AddSC_npcs_special()
  1309.      new npc_steam_tonk;
  1310.      new npc_tonk_mine;
  1311.      new npc_winter_reveler;
  1312. -    new npc_brewfest_reveler;
  1313. +    //new npc_brewfest_reveler;
  1314.      new npc_snake_trap;
  1315.      new npc_mirror_image;
  1316.      new npc_ebon_gargoyle;
  1317.  
  1318.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement