diff options
author | Kudlaty <none@none> | 2009-08-14 15:58:37 +0200 |
---|---|---|
committer | Kudlaty <none@none> | 2009-08-14 15:58:37 +0200 |
commit | 75faad4b9346d6d1983e56d2e5054c2fab17ddcc (patch) | |
tree | c74353f26399d59096c15671a0bddbd5ee59ea89 /src | |
parent | 1bb93e3534342054ea74857af8713f8081c09947 (diff) |
Merge [SD2]
r1251 Add waypoints for Hellmaw
r1252 Add missing SQL to *_full for script added in rev 1243
r1253 Increment count value only for alive creature in SL instance script. Some minor cleanup.
r1254 Fix typo, and not set friendly creature in combat with zone. Also add comments and re-order code for readability. Patch by astriconX - skip
r1255 Handle akama channelers in different way, fill list of guids only when needed for event. - skip
r1256 Clean up akama script and apply sd2 code style. - skip
r1257 Correct 2 waypoints and apply sd2 code style to related script.
r1258 Add basic support for quest 1560
r1259 Simplify way to summon druid creatures. Patch by Turok
r1260 Clean up two more world bosses, apply SD2 code style and simplify code. Add missing texts. Patch by Turok.
--HG--
branch : trunk
Diffstat (limited to 'src')
7 files changed, 597 insertions, 425 deletions
diff --git a/src/bindings/scripts/scripts/boss/boss_emeriss.cpp b/src/bindings/scripts/scripts/boss/boss_emeriss.cpp index 5814c58773d..9881525e3ad 100644 --- a/src/bindings/scripts/scripts/boss/boss_emeriss.cpp +++ b/src/bindings/scripts/scripts/boss/boss_emeriss.cpp @@ -23,124 +23,113 @@ EndScriptData */ #include "precompiled.h" -#define SPELL_SLEEP 24777 -#define SPELL_NOXIOUSBREATH 24818 -#define SPELL_TAILSWEEP 15847 -//#define SPELL_MARKOFNATURE 25040 // Not working -#define SPELL_VOLATILEINFECTION 24928 -#define SPELL_CORRUPTIONOFEARTH 24910 +enum +{ + SAY_AGGRO = -1000401, + SAY_CASTCORRUPTION = -1000402, + + SPELL_SLEEP = 24777, + SPELL_NOXIOUSBREATH = 24818, + SPELL_TAILSWEEP = 15847, + //SPELL_MARKOFNATURE = 25040, // Not working + SPELL_VOLATILEINFECTION = 24928, + SPELL_CORRUPTIONOFEARTH = 24910 +}; struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI { boss_emerissAI(Creature *c) : ScriptedAI(c) {} - uint32 Sleep_Timer; - uint32 NoxiousBreath_Timer; - uint32 TailSweep_Timer; - //uint32 MarkOfNature_Timer; - uint32 VolatileInfection_Timer; - uint32 CorruptionofEarth1_Timer; - uint32 CorruptionofEarth2_Timer; - uint32 CorruptionofEarth3_Timer; + uint32 m_uiSleep_Timer; + uint32 m_uiNoxiousBreath_Timer; + uint32 m_uiTailSweep_Timer; + //uint32 m_uiMarkOfNature_Timer; + uint32 m_uiVolatileInfection_Timer; + uint32 m_uiCorruptionsCasted; + void Reset() { - Sleep_Timer = 15000 + rand()%5000; - NoxiousBreath_Timer = 8000; - TailSweep_Timer = 4000; - //MarkOfNature_Timer = 45000; - VolatileInfection_Timer = 12000; - CorruptionofEarth1_Timer = 0; - CorruptionofEarth2_Timer = 0; - CorruptionofEarth3_Timer = 0; + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + //m_uiMarkOfNature_Timer = 45000; + m_uiVolatileInfection_Timer = 12000; + m_uiCorruptionsCasted = 0; } - void EnterCombat(Unit *who) {} + void Aggro(Unit* pWho) + { + DoScriptText(SAY_AGGRO, m_creature); + } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!UpdateVictim()) return; //Sleep_Timer - if (Sleep_Timer < diff) + if (m_uiSleep_Timer < uiDiff) { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_SLEEP); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); - Sleep_Timer = 8000 + rand()%8000; - }else Sleep_Timer -= diff; + m_uiSleep_Timer = 8000 + rand()%8000; + } + else + m_uiSleep_Timer -= uiDiff; //NoxiousBreath_Timer - if (NoxiousBreath_Timer < diff) + if (m_uiNoxiousBreath_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_NOXIOUSBREATH); - NoxiousBreath_Timer = 14000 + rand()%6000; - }else NoxiousBreath_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; //Tailsweep every 2 seconds - if (TailSweep_Timer < diff) + if (m_uiTailSweep_Timer < uiDiff) { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_TAILSWEEP); - - TailSweep_Timer = 2000; - }else TailSweep_Timer -= diff; + DoCast(m_creature, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; //MarkOfNature_Timer - //if (MarkOfNature_Timer < diff) + //if (m_uiMarkOfNature_Timer < uiDiff) //{ - // DoCast(m_creature->getVictim(),SPELL_MARKOFNATURE); - // MarkOfNature_Timer = 45000; - //}else MarkOfNature_Timer -= diff; - - //VolatileInfection_Timer - if (VolatileInfection_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_VOLATILEINFECTION); - VolatileInfection_Timer = 7000 + rand()%5000; - }else VolatileInfection_Timer -= diff; - - //CorruptionofEarth_Timer - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 75) - { - if (CorruptionofEarth1_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CORRUPTIONOFEARTH); + // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // m_uiMarkOfNature_Timer = 45000; + //} + //else + // m_uiMarkOfNature_Timer -= uiDiff; - //1 minutes for next one. Means not again with this health value - CorruptionofEarth1_Timer = 60000; - } else CorruptionofEarth1_Timer -= diff; - } - //CorruptionofEarth_Timer - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 50) + //VolatileInfection_Timer + if (m_uiVolatileInfection_Timer < uiDiff) { - if (CorruptionofEarth2_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CORRUPTIONOFEARTH); - - //1 minutes for next one. Means not again with this health value - CorruptionofEarth2_Timer = 60000; - } else CorruptionofEarth2_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_VOLATILEINFECTION); + m_uiVolatileInfection_Timer = 7000 + rand()%5000; } + else + m_uiVolatileInfection_Timer -= uiDiff; //CorruptionofEarth_Timer - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 25) - { - if (CorruptionofEarth3_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CORRUPTIONOFEARTH); - - //1 minutes for next one. Means not again with this health value - CorruptionofEarth3_Timer = 60000; - } else CorruptionofEarth3_Timer -= diff; + //CorruptionofEarth at 75%, 50% and 25% + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + { + ++m_uiCorruptionsCasted; // prevent casting twice on same hp + DoScriptText(SAY_CASTCORRUPTION, m_creature); + DoCast(m_creature->getVictim(), SPELL_CORRUPTIONOFEARTH); } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_emeriss(Creature* pCreature) { return new boss_emerissAI (pCreature); diff --git a/src/bindings/scripts/scripts/boss/boss_taerar.cpp b/src/bindings/scripts/scripts/boss/boss_taerar.cpp index 11baa975e0c..3f45ab26331 100644 --- a/src/bindings/scripts/scripts/boss/boss_taerar.cpp +++ b/src/bindings/scripts/scripts/boss/boss_taerar.cpp @@ -16,103 +16,92 @@ /* ScriptData SDName: Taerar -SD%Complete: 90 -SDComment: Mark of Nature & Teleport NYI +SD%Complete: 70 +SDComment: Mark of Nature & Teleport NYI. Fix the way to be banished. SDCategory: Bosses EndScriptData */ #include "precompiled.h" -//Spells of Taerar - -#define SPELL_SLEEP 24777 -#define SPELL_NOXIOUSBREATH 24818 -#define SPELL_TAILSWEEP 15847 -//#define SPELL_MARKOFNATURE 25040 // Not working -#define SPELL_ARCANEBLAST 24857 -#define SPELL_BELLOWINGROAR 22686 -#define SPELL_SUMMONSHADE 24843 - -//Spells of Shades of Taerar +enum +{ + SAY_AGGRO = -1000399, + SAY_SUMMONSHADE = -1000400, + + //Spells of Taerar + SPELL_SLEEP = 24777, + SPELL_NOXIOUSBREATH = 24818, + SPELL_TAILSWEEP = 15847, + // SPELL_MARKOFNATURE = 25040, // Not working + SPELL_ARCANEBLAST = 24857, + SPELL_BELLOWINGROAR = 22686, + + SPELL_SUMMONSHADE_1 = 24841, + SPELL_SUMMONSHADE_2 = 24842, + SPELL_SUMMONSHADE_3 = 24843, + + //Spells of Shades of Taerar + SPELL_POSIONCLOUD = 24840, + SPELL_POSIONBREATH = 20667 +}; -#define SPELL_POSIONCLOUD 24840 -#define SPELL_POSIONBREATH 20667 +uint32 m_auiSpellSummonShade[]= +{ + SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3 +}; struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI { boss_taerarAI(Creature *c) : ScriptedAI(c) {} - uint32 Sleep_Timer; - uint32 NoxiousBreath_Timer; - uint32 TailSweep_Timer; - //uint32 MarkOfNature_Timer; - uint32 ArcaneBlast_Timer; - uint32 BellowingRoar_Timer; - uint32 Shades_Timer; - uint32 Summon1_Timer; - uint32 Summon2_Timer; - uint32 Summon3_Timer; - int Rand; - int RandX; - int RandY; - Creature* Summoned; - bool Shades; + uint32 m_uiSleep_Timer; + uint32 m_uiNoxiousBreath_Timer; + uint32 m_uiTailSweep_Timer; + //uint32 m_uiMarkOfNature_Timer; + uint32 m_uiArcaneBlast_Timer; + uint32 m_uiBellowingRoar_Timer; + uint32 m_uiShades_Timer; + uint32 m_uiShadesSummoned; + + bool m_bShades; void Reset() { - Sleep_Timer = 15000 + rand()%5000; - NoxiousBreath_Timer = 8000; - TailSweep_Timer = 4000; - //MarkOfNature_Timer = 45000; - ArcaneBlast_Timer = 12000; - BellowingRoar_Timer = 30000; - Summon1_Timer = 0; - Summon2_Timer = 0; - Summon3_Timer = 0; - Shades_Timer = 60000; //The time that Taerar is banished - Shades = false; + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + //m_uiMarkOfNature_Timer = 45000; + m_uiArcaneBlast_Timer = 12000; + m_uiBellowingRoar_Timer = 30000; + m_uiShades_Timer = 60000; //The time that Taerar is banished + m_uiShadesSummoned = 0; + + m_bShades = false; } - void EnterCombat(Unit *who) + void EnterCombat(Unit* pWho) { + DoScriptText(SAY_AGGRO, m_creature); } - void SummonShades(Unit* victim) + void JustSummoned(Creature* pSummoned) { - if (!victim) - return; - - Rand = rand()%15; - switch (rand()%2) - { - case 0: RandX = 0 - Rand; break; - case 1: RandX = 0 + Rand; break; - } - Rand = 0; - Rand = rand()%15; - switch (rand()%2) - { - case 0: RandY = 0 - Rand; break; - case 1: RandY = 0 + Rand; break; - } - Rand = 0; - Summoned = DoSpawnCreature(15302, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - if (Summoned) - (Summoned->AI())->AttackStart(victim); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { - if (Shades && Shades_Timer < diff) + if (m_bShades && m_uiShades_Timer < uiDiff) { //Become unbanished again m_creature->setFaction(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //m_creature->m_canMove = true; - Shades = false; - } else if (Shades) + m_bShades = false; + } + else if (m_bShades) { - Shades_Timer -= diff; + m_uiShades_Timer -= uiDiff; //Do nothing while banished return; } @@ -122,119 +111,84 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI return; //Sleep_Timer - if (Sleep_Timer < diff) + if (m_uiSleep_Timer < uiDiff) { - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - if (target) DoCast(target,SPELL_SLEEP); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); - Sleep_Timer = 8000 + rand()%7000; - }else Sleep_Timer -= diff; + m_uiSleep_Timer = 8000 + rand()%7000; + } + else + m_uiSleep_Timer -= uiDiff; //NoxiousBreath_Timer - if (NoxiousBreath_Timer < diff) + if (m_uiNoxiousBreath_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_NOXIOUSBREATH); - NoxiousBreath_Timer = 14000 + rand()%6000; - } else NoxiousBreath_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; //Tailsweep every 2 seconds - if (TailSweep_Timer < diff) + if (m_uiTailSweep_Timer < uiDiff) { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_TAILSWEEP); - - TailSweep_Timer = 2000; - }else TailSweep_Timer -= diff; + DoCast(m_creature, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; //MarkOfNature_Timer - //if (MarkOfNature_Timer < diff) + //if (m_uiMarkOfNature_Timer < uiDiff) //{ - // DoCast(m_creature->getVictim(),SPELL_MARKOFNATURE); - // MarkOfNature_Timer = 45000; - //}else MarkOfNature_Timer -= diff; + // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // m_uiMarkOfNature_Timer = 45000; + //} + //else + // m_uiMarkOfNature_Timer -= uiDiff; //ArcaneBlast_Timer - if (ArcaneBlast_Timer < diff) + if (m_uiArcaneBlast_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_ARCANEBLAST); - ArcaneBlast_Timer = 7000 + rand()%5000; - }else ArcaneBlast_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_ARCANEBLAST); + m_uiArcaneBlast_Timer = 7000 + rand()%5000; + } + else + m_uiArcaneBlast_Timer -= uiDiff; //BellowingRoar_Timer - if (BellowingRoar_Timer < diff) + if (m_uiBellowingRoar_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_BELLOWINGROAR); - BellowingRoar_Timer = 20000 + rand()%10000; - } else BellowingRoar_Timer -= diff; - - //Summon 3 Shades - if (!Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 75) - { - if (Summon1_Timer < diff) - { - //Inturrupt any spell casting - m_creature->InterruptNonMeleeSpells(false); - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //m_creature->m_canMove = false; - - //Cast - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - SummonShades(target); - SummonShades(target); - SummonShades(target); - Summon1_Timer = 120000; - Shades = true; - Shades_Timer = 60000; - } else Summon1_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); + m_uiBellowingRoar_Timer = 20000 + rand()%10000; } + else + m_uiBellowingRoar_Timer -= uiDiff; - //Summon 3 Shades - if (!Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 50) + //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again) + if (!m_bShades && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) { - if (Summon2_Timer < diff) + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { //Inturrupt any spell casting m_creature->InterruptNonMeleeSpells(false); - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //m_creature->m_canMove = false; - - //Cast - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - SummonShades(target); - SummonShades(target); - SummonShades(target); - Summon2_Timer = 120000; - Shades = true; - Shades_Timer = 60000; - } else Summon2_Timer -= diff; - } - //Summon 3 Shades - if (!Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 25) - { - if (Summon3_Timer < diff) - { - //Inturrupt any spell casting - m_creature->InterruptNonMeleeSpells(false); + //horrible workaround, need to fix m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //m_creature->m_canMove = false; - - //Cast - Unit* target = NULL; - target = SelectUnit(SELECT_TARGET_RANDOM,0); - SummonShades(target); - SummonShades(target); - SummonShades(target); - Summon3_Timer = 120000; - Shades = true; - Shades_Timer = 60000; - } else Summon3_Timer -= diff; + + DoScriptText(SAY_SUMMONSHADE, m_creature); + + int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); + + for(int i = 0; i < iSize; ++i) + m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true); + + ++m_uiShadesSummoned; // prevent casting twice at same health + m_bShades = true; + } + m_uiShades_Timer = 60000; } DoMeleeAttackIfReady(); @@ -242,42 +196,41 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI }; // Shades of Taerar Script - struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI { boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} - uint32 PoisonCloud_Timer; - uint32 PosionBreath_Timer; + uint32 m_uiPoisonCloud_Timer; + uint32 m_uiPosionBreath_Timer; void Reset() { - PoisonCloud_Timer = 8000; - PosionBreath_Timer = 12000; + m_uiPoisonCloud_Timer = 8000; + m_uiPosionBreath_Timer = 12000; } - void EnterCombat(Unit *who) - { - } - - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; //PoisonCloud_Timer - if (PoisonCloud_Timer < diff) + if (m_uiPoisonCloud_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_POSIONCLOUD); - PoisonCloud_Timer = 30000; - }else PoisonCloud_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_POSIONCLOUD); + m_uiPoisonCloud_Timer = 30000; + } + else + m_uiPoisonCloud_Timer -= uiDiff; //PosionBreath_Timer - if (PosionBreath_Timer < diff) + if (m_uiPosionBreath_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_POSIONBREATH); - PosionBreath_Timer = 12000; - }else PosionBreath_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_POSIONBREATH); + m_uiPosionBreath_Timer = 12000; + } + else + m_uiPosionBreath_Timer -= uiDiff; DoMeleeAttackIfReady(); } diff --git a/src/bindings/scripts/scripts/boss/boss_ysondre.cpp b/src/bindings/scripts/scripts/boss/boss_ysondre.cpp index 116f8807cd3..1b93f54c047 100644 --- a/src/bindings/scripts/scripts/boss/boss_ysondre.cpp +++ b/src/bindings/scripts/scripts/boss/boss_ysondre.cpp @@ -25,16 +25,18 @@ EndScriptData */ enum { - SAY_AGGRO = -1000360, // sound unknown - SAY_SUMMONDRUIDS = -1000361, // sound unknown + SAY_AGGRO = -1000360, + SAY_SUMMONDRUIDS = -1000361, SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, SPELL_TAILSWEEP = 15847, - //#SPELL_MARKOFNATURE = 25040, // Not working + //SPELL_MARKOFNATURE = 25040, // Not working SPELL_LIGHTNINGWAVE = 24819, SPELL_SUMMONDRUIDS = 24795, + SPELL_SUMMON_PLAYER = 24776, + //druid spells SPELL_MOONFIRE = 21669 }; @@ -49,9 +51,7 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI uint32 m_uiTailSweep_Timer; //uint32 m_uiMarkOfNature_Timer; uint32 m_uiLightningWave_Timer; - uint32 m_uiSummonDruids1_Timer; - uint32 m_uiSummonDruids2_Timer; - uint32 m_uiSummonDruids3_Timer; + uint32 m_uiSummonDruidModifier; void Reset() { @@ -60,9 +60,7 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI m_uiTailSweep_Timer = 4000; //m_uiMarkOfNature_Timer = 45000; m_uiLightningWave_Timer = 12000; - m_uiSummonDruids1_Timer = 0; - m_uiSummonDruids2_Timer = 0; - m_uiSummonDruids3_Timer = 0; + m_uiSummonDruidModifier = 0; } void EnterCombat(Unit* pWho) @@ -70,13 +68,10 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI DoScriptText(SAY_AGGRO, m_creature); } - void DoSummonDruids() + void JustSummoned(Creature* pSummoned) { - for(int i = 0; i < 10; ++i) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SUMMONDRUIDS, true); - } + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); } void UpdateAI(const uint32 uiDiff) @@ -87,8 +82,8 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI //Sleep_Timer if (m_uiSleep_Timer < uiDiff) { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_SLEEP); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); m_uiSleep_Timer = 8000 + rand()%7000; } @@ -137,42 +132,14 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI m_uiLightningWave_Timer -= uiDiff; //Summon Druids - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 75) + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) { - if (m_uiSummonDruids1_Timer < uiDiff) - { - DoScriptText(SAY_SUMMONDRUIDS, m_creature); - DoSummonDruids(); - m_uiSummonDruids1_Timer = 60000; - } - else - m_uiSummonDruids1_Timer -= uiDiff; - } + DoScriptText(SAY_SUMMONDRUIDS, m_creature); - //Summon Druids - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 50) - { - if (m_uiSummonDruids2_Timer < uiDiff) - { - DoScriptText(SAY_SUMMONDRUIDS, m_creature); - DoSummonDruids(); - m_uiSummonDruids2_Timer = 60000; - } - else - m_uiSummonDruids2_Timer -= uiDiff; - } + for(int i = 0; i < 10; ++i) + DoCast(m_creature, SPELL_SUMMONDRUIDS, true); - //Summon Druids - if ((int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 25) - { - if (m_uiSummonDruids3_Timer < uiDiff) - { - DoScriptText(SAY_SUMMONDRUIDS, m_creature); - DoSummonDruids(); - m_uiSummonDruids3_Timer = 60000; - } - else - m_uiSummonDruids3_Timer -= uiDiff; + ++m_uiSummonDruidModifier; } DoMeleeAttackIfReady(); diff --git a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp index 98d589ed009..0a4b6839011 100644 --- a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp @@ -32,31 +32,32 @@ EndContentData */ ## npc_professor_phizzlethorpe ######*/ -#define SAY_PROGRESS_1 -1000235 -#define SAY_PROGRESS_2 -1000236 -#define SAY_PROGRESS_3 -1000237 -#define EMOTE_PROGRESS_4 -1000238 -#define SAY_AGGRO -1000239 -#define SAY_PROGRESS_5 -1000240 -#define SAY_PROGRESS_6 -1000241 -#define SAY_PROGRESS_7 -1000242 -#define EMOTE_PROGRESS_8 -1000243 -#define SAY_PROGRESS_9 -1000244 - -#define QUEST_SUNKEN_TREASURE 665 -#define MOB_VENGEFUL_SURGE 2776 +enum +{ + SAY_PROGRESS_1 = -1000235, + SAY_PROGRESS_2 = -1000236, + SAY_PROGRESS_3 = -1000237, + EMOTE_PROGRESS_4 = -1000238, + SAY_AGGRO = -1000239, + SAY_PROGRESS_5 = -1000240, + SAY_PROGRESS_6 = -1000241, + SAY_PROGRESS_7 = -1000242, + EMOTE_PROGRESS_8 = -1000243, + SAY_PROGRESS_9 = -1000244, + + QUEST_SUNKEN_TREASURE = 665, + MOB_VENGEFUL_SURGE = 2776 +}; struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI { npc_professor_phizzlethorpeAI(Creature *c) : npc_escortAI(c) {} - bool m_bCompleted; - - void WaypointReached(uint32 i) + void WaypointReached(uint32 uiPointId) { Player* pPlayer = Unit::GetPlayer(PlayerGUID); - switch(i) + switch(uiPointId) { case 4:DoScriptText(SAY_PROGRESS_2, m_creature, pPlayer);break; case 5:DoScriptText(SAY_PROGRESS_3, m_creature, pPlayer);break; @@ -68,31 +69,28 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI break; } case 10:DoScriptText(SAY_PROGRESS_5, m_creature, pPlayer);break; - case 11:DoScriptText(SAY_PROGRESS_6, m_creature, pPlayer);break; + case 11: + DoScriptText(SAY_PROGRESS_6, m_creature, pPlayer); + SetRun(); + break; case 19:DoScriptText(SAY_PROGRESS_7, m_creature, pPlayer); break; case 20: DoScriptText(EMOTE_PROGRESS_8, m_creature); DoScriptText(SAY_PROGRESS_9, m_creature, pPlayer); - m_bCompleted = true; if (pPlayer) CAST_PLR(pPlayer)->GroupEventHappens(QUEST_SUNKEN_TREASURE, m_creature); break; } } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature); - } - - void Reset() + void JustSummoned(Creature* pSummoned) { - m_bCompleted = true; + pSummoned->AI()->AttackStart(m_creature); } - void EnterCombat(Unit* who) + void EnterCombat(Unit* pWho) { - DoScriptText(SAY_AGGRO, m_creature, NULL); + DoScriptText(SAY_AGGRO, m_creature); } void UpdateAI(const uint32 diff) @@ -101,13 +99,13 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI } }; -bool QuestAccept_npc_professor_phizzlethorpe(Player* pPlayer, Creature* pCreature, Quest const* quest) +bool QuestAccept_npc_professor_phizzlethorpe(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - if (quest->GetQuestId() == QUEST_SUNKEN_TREASURE) + if (pQuest->GetQuestId() == QUEST_SUNKEN_TREASURE) { DoScriptText(SAY_PROGRESS_1, pCreature, pPlayer); if (npc_escortAI* pEscortAI = CAST_AI(npc_professor_phizzlethorpeAI, (pCreature->AI()))) - pEscortAI->Start(false, false, pPlayer->GetGUID()); + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); pCreature->setFaction(113); } diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp index 70e37b48504..7266c0d5a2a 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp @@ -16,41 +16,41 @@ /* ScriptData SDName: Boss_Ambassador_Hellmaw -SD%Complete: 75 -SDComment: Waypoints after Intro not implemented. Enrage spell missing/not known +SD%Complete: 80 +SDComment: Enrage spell missing/not known SDCategory: Auchindoun, Shadow Labyrinth EndScriptData */ #include "precompiled.h" +#include "../../../npc/npc_escortAI.h" #include "def_shadow_labyrinth.h" -#define SAY_INTRO -1555000 - -#define SAY_AGGRO1 -1555001 -#define SAY_AGGRO2 -1555002 -#define SAY_AGGRO3 -1555003 - -#define SAY_HELP -1555004 - -#define SAY_SLAY1 -1555005 -#define SAY_SLAY2 -1555006 - -#define SAY_DEATH -1555007 - -#define SPELL_BANISH 30231 -#define SPELL_CORROSIVE_ACID 33551 -#define SPELL_FEAR 33547 -#define SPELL_ENRAGE 34970 +enum +{ + SAY_INTRO = -1555000, + SAY_AGGRO1 = -1555001, + SAY_AGGRO2 = -1555002, + SAY_AGGRO3 = -1555003, + SAY_HELP = -1555004, + SAY_SLAY1 = -1555005, + SAY_SLAY2 = -1555006, + SAY_DEATH = -1555007, + + SPELL_BANISH = 30231, + SPELL_CORROSIVE_ACID = 33551, + SPELL_FEAR = 33547, + SPELL_ENRAGE = 34970 +}; -struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI +struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI { - boss_ambassador_hellmawAI(Creature *c) : ScriptedAI(c) + boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) { - pInstance = c->GetInstanceData(); - HeroicMode = m_creature->GetMap()->IsHeroic(); + m_pInstance = pCreature->GetInstanceData(); + HeroicMode = pCreature->GetMap()->IsHeroic(); } - ScriptedInstance* pInstance; + ScriptedInstance* m_pInstance; bool HeroicMode; uint32 EventCheck_Timer; @@ -68,52 +68,52 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI Fear_Timer = 25000 + rand()%5000; Enrage_Timer = 180000; Intro = false; - IsBanished = false; + IsBanished = true; Enraged = false; - if (pInstance) + if (m_pInstance && m_creature->isAlive()) { - if (pInstance->GetData(TYPE_HELLMAW) == NOT_STARTED) - { - DoCast(m_creature,SPELL_BANISH); - IsBanished = true; - } - else pInstance->SetData(TYPE_HELLMAW,FAIL); - if (pInstance->GetData(TYPE_OVERSEER) == DONE) - { - if (m_creature->HasAura(SPELL_BANISH)) - m_creature->RemoveAurasDueToSpell(SPELL_BANISH); - Intro = true; - } + if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) + m_creature->CastSpell(m_creature, SPELL_BANISH, true); } } - void MoveInLineOfSight(Unit *who) + void JustReachedHome() + { + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, FAIL); + } + + void MoveInLineOfSight(Unit* pWho) { if (m_creature->HasAura(SPELL_BANISH)) return; - ScriptedAI::MoveInLineOfSight(who); + npc_escortAI::MoveInLineOfSight(pWho); } - void MovementInform(uint32 type, uint32 id) + void WaypointReached(uint32 i) { - if (type != POINT_MOTION_TYPE) - return; } void DoIntro() { - DoScriptText(SAY_INTRO, m_creature); - if (m_creature->HasAura(SPELL_BANISH)) m_creature->RemoveAurasDueToSpell(SPELL_BANISH); IsBanished = false; Intro = true; - if (pInstance) - pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) + { + DoScriptText(SAY_INTRO, m_creature); + Start(true, false, 0, NULL, false, true); + } + + m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); + } } void EnterCombat(Unit *who) @@ -139,30 +139,35 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI { DoScriptText(SAY_DEATH, m_creature); - if (pInstance) - pInstance->SetData(TYPE_HELLMAW, DONE); + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, DONE); } void UpdateAI(const uint32 diff) { - if (!Intro) + if (!Intro && !IsBeingEscorted) { if (EventCheck_Timer < diff) { - if (pInstance) + if (m_pInstance) { - if (pInstance->GetData(TYPE_OVERSEER) == DONE) + if (m_pInstance->GetData(TYPE_OVERSEER) == DONE) + { DoIntro(); + return; + } } EventCheck_Timer = 5000; - }else EventCheck_Timer -= diff; + return; + } + else + { + EventCheck_Timer -= diff; + return; + } } - if (!m_creature->isInCombat() && !IsBanished) - { - //this is where we add MovePoint() - //DoWhine("I haz no mount!", LANG_UNIVERSAL, NULL); - } + npc_escortAI::UpdateAI(diff); if (!UpdateVictim()) return; @@ -193,13 +198,16 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI Enraged = true; }else Enrage_Timer -= diff; } - - DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature) { - return new boss_ambassador_hellmawAI (pCreature); + boss_ambassador_hellmawAI* pHellAI = new boss_ambassador_hellmawAI(pCreature); + + pHellAI->FillPointMovementListForCreature(); + + return (CreatureAI*)pHellAI; } void AddSC_boss_ambassador_hellmaw() diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp index 084dcec32c0..f8f3b73bffa 100644 --- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp +++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp @@ -68,78 +68,86 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance return false; } - void OnGameObjectCreate(GameObject *go, bool add) + void OnGameObjectCreate(GameObject* pGo, bool add) { - switch(go->GetEntry()) + switch(pGo->GetEntry()) { case REFECTORY_DOOR: - m_uiRefectoryDoorGUID = go->GetGUID(); + m_uiRefectoryDoorGUID = pGo->GetGUID(); if (m_auiEncounter[2] == DONE) - DoUseDoorOrButton(m_uiRefectoryDoorGUID); + pGo->SetGoState(GO_STATE_ACTIVE); break; case SCREAMING_HALL_DOOR: - m_uiScreamingHallDoorGUID = go->GetGUID(); + m_uiScreamingHallDoorGUID = pGo->GetGUID(); if (m_auiEncounter[3] == DONE) - DoUseDoorOrButton(m_uiScreamingHallDoorGUID); + pGo->SetGoState(GO_STATE_ACTIVE); break; } } - void OnCreatureCreate(Creature *creature, bool add) + void OnCreatureCreate(Creature* pCreature, bool add) { - switch(creature->GetEntry()) + switch(pCreature->GetEntry()) { case 18732: - m_uiGrandmasterVorpil = creature->GetGUID(); + m_uiGrandmasterVorpil = pCreature->GetGUID(); break; case 18796: - ++m_uiFelOverseerCount; - debug_log("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); + if (pCreature->isAlive()) + { + ++m_uiFelOverseerCount; + debug_log("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); + } break; } } - void SetData(uint32 type, uint32 data) + void SetData(uint32 type, uint32 uiData) { switch(type) { case TYPE_HELLMAW: - m_auiEncounter[0] = data; + m_auiEncounter[0] = uiData; break; case TYPE_OVERSEER: - if (data != DONE) + if (uiData != DONE) + { error_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); + return; + } if (m_uiFelOverseerCount) { --m_uiFelOverseerCount; - debug_log("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); - } - if (m_uiFelOverseerCount == 0) - { - m_auiEncounter[1] = DONE; - debug_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + + if (m_uiFelOverseerCount) + debug_log("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); + else + { + m_auiEncounter[1] = DONE; + debug_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + } } break; case DATA_BLACKHEARTTHEINCITEREVENT: - if (data == DONE) + if (uiData == DONE) DoUseDoorOrButton(m_uiRefectoryDoorGUID); - m_auiEncounter[2] = data; + m_auiEncounter[2] = uiData; break; case DATA_GRANDMASTERVORPILEVENT: - if (data == DONE) + if (uiData == DONE) DoUseDoorOrButton(m_uiScreamingHallDoorGUID); - m_auiEncounter[3] = data; + m_auiEncounter[3] = uiData; break; case DATA_MURMUREVENT: - m_auiEncounter[4] = data; + m_auiEncounter[4] = uiData; break; } - if (data == DONE) + if (uiData == DONE) { if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) return; diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp index a44aa564c2e..a12da0c5f80 100644 --- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp +++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Tanaris SD%Complete: 80 -SDComment: Quest support: 648, 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor +SDComment: Quest support: 648, 1560, 2954, 4005, 10277, 10279(Special flight path). Noggenfogger vendor SDCategory: Tanaris EndScriptData */ @@ -28,6 +28,7 @@ npc_marin_noggenfogger npc_steward_of_time npc_stone_watcher_of_norgannon npc_OOX17 +npc_tooga EndContentData */ #include "precompiled.h" @@ -520,9 +521,251 @@ CreatureAI* GetAI_npc_OOX17(Creature* pCreature) return OOX17AI; } -/*###### -## AddSC -######*/ +/*#### +# npc_tooga +####*/ + +enum +{ + SAY_TOOG_THIRST = -1000391, + SAY_TOOG_WORRIED = -1000392, + SAY_TOOG_POST_1 = -1000393, + SAY_TORT_POST_2 = -1000394, + SAY_TOOG_POST_3 = -1000395, + SAY_TORT_POST_4 = -1000396, + SAY_TOOG_POST_5 = -1000397, + SAY_TORT_POST_6 = -1000398, + + QUEST_TOOGA = 1560, + NPC_TORTA = 6015, + + POINT_ID_TO_WATER = 1, + FACTION_TOOG_ESCORTEE = 113 +}; + +const float m_afToWaterLoc[] = {-7032.664551, -4906.199219, -1.606446}; + +//Script not fully complete, need to change faction. +struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI +{ + npc_toogaAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_uiNpcFlags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS); + m_uiPlayerGUID = 0; + } + + uint64 m_uiPlayerGUID; + uint32 m_uiNpcFlags; + uint32 m_uiCheckPlayerTimer; + uint32 m_uiPostEventTimer; + uint32 m_uiPhasePostEvent; + + Unit* pTorta; + + void Reset() + { + m_uiCheckPlayerTimer = 2500; + m_uiPostEventTimer = 5000; + m_uiPhasePostEvent = 0; + + pTorta = NULL; + } + + void MoveInLineOfSight(Unit *pWho) + { + if (pWho->GetEntry() == NPC_TORTA) + { + if (m_creature->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + { + if (!pTorta && CanDoComplete()) + { + pTorta = pWho; + m_uiPhasePostEvent = 1; + } + } + } + } + + void EnterEvadeMode() + { + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(true); + m_creature->LoadCreaturesAddon(); + + if (m_creature->isAlive()) + { + if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiPlayerGUID)) + { + //for later development, it appear this kind return to combatStart, then resume to MoveFollow + m_creature->GetMotionMaster()->MoveFollow(pUnit, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + else + { + m_creature->GetMotionMaster()->MoveTargetedHome(); + } + } + + m_creature->SetLootRecipient(NULL); + + Reset(); + } + + void JustRespawned() + { + if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) + m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); + + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_creature->GetCreatureInfo()->npcflag); + + Reset(); + } + + void DoStart(Player* pPlayer) + { + m_uiPlayerGUID = pPlayer->GetGUID(); + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + //m_creature->setFaction(FACTION_TOOG_ESCORTEE); + + m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + } + + bool CanDoComplete() + { + if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, m_uiPlayerGUID)) + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + { + uint16 uiQuestLogSlot = pPlayer->FindQuestSlot(QUEST_TOOGA); + + if (uiQuestLogSlot < MAX_QUEST_LOG_SIZE) + { + if (pPlayer->GetQuestSlotState(uiQuestLogSlot) != QUEST_STATE_FAIL) + { + pPlayer->GroupEventHappens(QUEST_TOOGA, m_creature); + m_creature->GetMotionMaster()->MovementExpired(); + return true; + } + } + } + } + + return false; + } + + void MovementInform(uint32 uiMoveType, uint32 uiPointId) + { + if (uiMoveType != POINT_MOTION_TYPE || !m_uiPlayerGUID) + return; + + if (uiPointId == POINT_ID_TO_WATER) + m_creature->ForcedDespawn(); + } + + void JustDied(Unit* pKiller) + { + if (Player* pPlayer = Unit::GetPlayer(m_uiPlayerGUID)) + pPlayer->FailQuest(QUEST_TOOGA); + + m_uiPlayerGUID = 0; + m_creature->GetMotionMaster()->MovementExpired(); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + //we are doing the post-event, or... + if (m_uiPhasePostEvent) + { + if (m_uiPostEventTimer < uiDiff) + { + m_uiPostEventTimer = 5000; + + if (!pTorta || !pTorta->isAlive()) + { + //something happened, so just despawn (what can go wrong?) + m_creature->ForcedDespawn(); + return; + } + + switch(m_uiPhasePostEvent) + { + case 1: + DoScriptText(SAY_TOOG_POST_1, m_creature); + break; + case 2: + DoScriptText(SAY_TORT_POST_2, pTorta); + break; + case 3: + DoScriptText(SAY_TOOG_POST_3, m_creature); + break; + case 4: + DoScriptText(SAY_TORT_POST_4, pTorta); + break; + case 5: + DoScriptText(SAY_TOOG_POST_5, m_creature); + break; + case 6: + DoScriptText(SAY_TORT_POST_6, pTorta); + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + break; + } + + ++m_uiPhasePostEvent; + } + else + m_uiPostEventTimer -= uiDiff; + } + //...we are doing regular player check + else if (m_uiPlayerGUID) + { + if (m_uiCheckPlayerTimer < uiDiff) + { + m_uiCheckPlayerTimer = 5000; + + switch(rand()%50) + { + case 10: DoScriptText(SAY_TOOG_THIRST, m_creature); break; + case 25: DoScriptText(SAY_TOOG_WORRIED, m_creature); break; + } + + Unit* pUnit = Unit::GetUnit(*m_creature, m_uiPlayerGUID); + + if (pUnit && !pUnit->isAlive()) + { + m_uiPlayerGUID = 0; + m_creature->ForcedDespawn(); + } + } + else + m_uiCheckPlayerTimer -= uiDiff; + } + + return; + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_tooga(Creature* pCreature) +{ + return new npc_toogaAI(pCreature); +} + +bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_TOOGA) + { + if (npc_toogaAI* pToogaAI = CAST_AI(npc_toogaAI, pCreature->AI())) + pToogaAI->DoStart(pPlayer); + } + + return true; +} void AddSC_tanaris() { @@ -562,5 +805,11 @@ void AddSC_tanaris() newscript->GetAI = &GetAI_npc_OOX17; newscript->pQuestAccept = &QuestAccept_npc_OOX17; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_tooga"; + newscript->GetAI = &GetAI_npc_tooga; + newscript->pQuestAccept = &QuestAccept_npc_tooga; + newscript->RegisterSelf(); } |