Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. const Position cauldronMobsPositions[3] =
  2. {
  3. // Spawn
  4. {6813.22f, 1584.97f, 389.03f, 0.0f},
  5. {6812.64f, 1557.85f, 389.03f, 0.0f},
  6. {6811.49f, 1612.89f, 389.03f, 0.0f}
  7. };
  8. enum eNeutralizePlague
  9. {
  10. CREDIT_PLAGUE_CAULDRON_NEUTRALIZED = 31767,
  11. NPC_LIVING_PLAGUE = 32181,
  12. NPC_RAMPAGING_GHOUL = 32178,
  13. NPC_PLAGUE_DRENCHED_GHOULD = 32176,
  14. };
  15. class spell_q_neutralize_plague : public SpellScriptLoader
  16. {
  17. public:
  18. spell_q_neutralize_plague() : SpellScriptLoader("spell_q_neutralize_plague") { }
  19.  
  20. class spell_q_neutralize_plague_AuraScript : public AuraScript
  21. {
  22. PrepareAuraScript(spell_q_neutralize_plague_AuraScript)
  23.  
  24. void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  25. {
  26. if (Unit* pCaster = GetCaster())
  27. {
  28. switch (urand(0, 3))
  29. {
  30. case 0:
  31. for (uint8 i = 0 ; i < 8 ; i++)
  32. if (Creature* pMob = pCaster->SummonCreature(NPC_LIVING_PLAGUE, cauldronMobsPositions[urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
  33. pMob->AI()->AttackStart(pCaster);
  34. break;
  35. case 1:
  36. for (uint8 i = 0 ; i < 2 ; i++)
  37. if (Creature* pMob = pCaster->SummonCreature(NPC_RAMPAGING_GHOUL, cauldronMobsPositions[urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
  38. pMob->AI()->AttackStart(pCaster);
  39. break;
  40. case 2:
  41. if (Creature* pMob = pCaster->SummonCreature(NPC_PLAGUE_DRENCHED_GHOULD, cauldronMobsPositions[urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
  42. pMob->AI()->AttackStart(pCaster);
  43. break;
  44. case 3:
  45. for (uint8 i = 0 ; i < 4 ; i++)
  46. if (Creature* pMob = pCaster->SummonCreature(NPC_LIVING_PLAGUE, cauldronMobsPositions[urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
  47. pMob->AI()->AttackStart(pCaster);
  48. if (Creature* pMob = pCaster->SummonCreature(NPC_RAMPAGING_GHOUL, cauldronMobsPositions[urand(0, 2)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
  49. pMob->AI()->AttackStart(pCaster);
  50. break;
  51. }
  52. }
  53. }
  54.  
  55. void Register()
  56. {
  57. OnEffectApply += AuraEffectApplyFn(spell_q_neutralize_plague_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
  58. }
  59. };
  60.  
  61. AuraScript* GetAuraScript() const
  62. {
  63. return new spell_q_neutralize_plague_AuraScript();
  64. }
  65. };
  66.  
  67. class spell_q_neutralizing_doze_applied : public SpellScriptLoader
  68. {
  69. public:
  70. spell_q_neutralizing_doze_applied() : SpellScriptLoader("spell_q_neutralizing_doze_applied") { }
  71.  
  72. class spell_q_neutralizing_doze_applied_SpellScript : public SpellScript
  73. {
  74. public:
  75. PrepareSpellScript(spell_q_neutralizing_doze_applied_SpellScript)
  76. bool Validate(SpellEntry const * /*spellEntry*/)
  77. {
  78. return true;
  79. }
  80.  
  81. void HandleDummy(SpellEffIndex /*effIndex*/)
  82. {
  83. if (Unit* pCaster = GetCaster())
  84. if (pCaster->GetTypeId() == TYPEID_PLAYER)
  85. pCaster->ToPlayer()->KilledMonsterCredit(CREDIT_PLAGUE_CAULDRON_NEUTRALIZED, 0);
  86. }
  87.  
  88. void Register()
  89. {
  90. OnEffect += SpellEffectFn(spell_q_neutralizing_doze_applied_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
  91. }
  92. };
  93.  
  94. SpellScript* GetSpellScript() const
  95. {
  96. return new spell_q_neutralizing_doze_applied_SpellScript();
  97. }
  98. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement