Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct MANGOS_DLL_DECL npc_fireworkAI : public ScriptedAI
- {
- npc_firework(Creature* pCreature) : ScriptedAI(pCreature)
- {
- m_bFireworkPossible = false;
- m_bTethyrComplete = false;
- m_uiFirework_1_Timer = urand(1000, 2500);
- m_uiFirework_2_Timer = urand(1000, 2500);
- m_uiFirework_3_Timer = urand(1000, 2500);
- m_uiTethyrCheckTimer = 15000;
- Reset();
- }
- bool m_bFireworkPossible;
- bool m_bTethyrComplete;
- uint32 m_uiFirework_1_Timer;
- uint32 m_uiFirework_2_Timer;
- uint32 m_uiFirework_3_Timer;
- uint32 m_uiTethyrCheckTimer;
- void Reset()
- {
- m_bFireworkPossible = false;
- m_bTethyrComplete = false;
- m_uiFirework_1_Timer = urand(1000, 2500);
- m_uiFirework_2_Timer = urand(1000, 2500);
- m_uiFirework_3_Timer = urand(1000, 2500);
- m_uiTethyrCheckTimer = 15000;
- }
- void UpdateAI(const uint32 uiDiff)
- {
- if(m_uiTethyrCheckTimer < uiDiff && m_bFireworkPossible == false)
- {
- Creature* pTethyr = GetClosestCreatureWithEntry(m_creature, MOB_TETHYR, 150.0f);
- if (pTethyr)
- {
- m_bFireworkPossible = true;
- }
- }
- if(m_bFireworkPossible == true)
- {
- if(m_bTethyrComplete == true)
- {
- switch(urand(0, 2))
- {
- case 0:
- if(m_uiFirework_1_Timer < uiDiff)
- {
- DoCastSpellIfCan(m_creature, SPELL_FIREWORK_1, CAST_TRIGGERED);
- m_uiFirework_1_Timer = urand(1000, 2000);
- }
- break;
- case 1:
- if(m_uiFirework_2_Timer < uiDiff)
- {
- DoCastSpellIfCan(m_creature, SPELL_FIREWORK_2, CAST_TRIGGERED);
- m_uiFirework_2_Timer = urand(1000, 2000);
- }
- break;
- case 2:
- if(m_uiFirework_3_Timer < uiDiff)
- {
- DoCastSpellIfCan(m_creature, SPELL_FIREWORK_3, CAST_TRIGGERED);
- m_uiFirework_3_Timer = urand(1000, 2000);
- }
- break;
- }
- }
- }
- }
- };
- CreatureAI* GetAI_npc_firework(Creature* pCreature)
- {
- return new npc_fireworkAI(pCreature);
- }
Add Comment
Please, Sign In to add comment