diff options
author | silinoron <none@none> | 2010-08-06 17:07:41 -0700 |
---|---|---|
committer | silinoron <none@none> | 2010-08-06 17:07:41 -0700 |
commit | f73e952de3811856e93d66944ee567831323f3a0 (patch) | |
tree | f274913f1643875b2b83e9db3396119eed1eaa80 | |
parent | c2ca2e1c98108c56977f5386a5dd9773cde351d3 (diff) |
Convert a bunch of World scripts to the new system.
--HG--
branch : trunk
-rw-r--r-- | src/server/scripts/World/boss_emeriss.cpp | 162 | ||||
-rw-r--r-- | src/server/scripts/World/boss_taerar.cpp | 316 | ||||
-rw-r--r-- | src/server/scripts/World/boss_ysondre.cpp | 238 | ||||
-rw-r--r-- | src/server/scripts/World/guards.cpp | 259 | ||||
-rw-r--r-- | src/server/scripts/World/item_scripts.cpp | 502 | ||||
-rw-r--r-- | src/server/scripts/World/mob_generic_creature.cpp | 297 | ||||
-rw-r--r-- | src/server/scripts/World/npc_innkeeper.cpp | 135 | ||||
-rw-r--r-- | src/server/scripts/World/npc_professions.cpp | 1551 | ||||
-rw-r--r-- | src/server/scripts/World/npc_taxi.cpp | 506 | ||||
-rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 3326 |
10 files changed, 3651 insertions, 3641 deletions
diff --git a/src/server/scripts/World/boss_emeriss.cpp b/src/server/scripts/World/boss_emeriss.cpp index dc36e189f95..9ac42137e86 100644 --- a/src/server/scripts/World/boss_emeriss.cpp +++ b/src/server/scripts/World/boss_emeriss.cpp @@ -33,114 +33,104 @@ enum eEnums SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, SPELL_TAILSWEEP = 15847, - //SPELL_MARKOFNATURE = 25040, // Not working SPELL_VOLATILEINFECTION = 24928, SPELL_CORRUPTIONOFEARTH = 24910 }; -struct boss_emerissAI : public ScriptedAI +class boss_emeriss : public CreatureScript { - boss_emerissAI(Creature *c) : ScriptedAI(c) {} +public: + boss_emeriss() : CreatureScript("boss_emeriss") { } - 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() - { - 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* /*pWho*/) + struct boss_emerissAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Sleep_Timer - if (m_uiSleep_Timer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SLEEP); + boss_emerissAI(Creature *c) : ScriptedAI(c) {} - m_uiSleep_Timer = 8000 + rand()%8000; - } - else - m_uiSleep_Timer -= uiDiff; + uint32 m_uiSleep_Timer; + uint32 m_uiNoxiousBreath_Timer; + uint32 m_uiTailSweep_Timer; + uint32 m_uiVolatileInfection_Timer; + uint32 m_uiCorruptionsCasted; - //NoxiousBreath_Timer - if (m_uiNoxiousBreath_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); - m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + m_uiVolatileInfection_Timer = 12000; + m_uiCorruptionsCasted = 0; } - else - m_uiNoxiousBreath_Timer -= uiDiff; - //Tailsweep every 2 seconds - if (m_uiTailSweep_Timer <= uiDiff) - { - DoCast(me, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer <= uiDiff) - //{ - // DoCast(me->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - //VolatileInfection_Timer - if (m_uiVolatileInfection_Timer <= uiDiff) + void EnterCombat(Unit* /*pWho*/) { - DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); - m_uiVolatileInfection_Timer = 7000 + rand()%5000; + DoScriptText(SAY_AGGRO, me); } - else - m_uiVolatileInfection_Timer -= uiDiff; - //CorruptionofEarth_Timer - //CorruptionofEarth at 75%, 50% and 25% - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + void UpdateAI(const uint32 uiDiff) { - ++m_uiCorruptionsCasted; // prevent casting twice on same hp - DoScriptText(SAY_CASTCORRUPTION, me); - DoCast(me->getVictim(), SPELL_CORRUPTIONOFEARTH); + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sleep_Timer + if (m_uiSleep_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); + + m_uiSleep_Timer = 8000 + rand()%8000; + } + else + m_uiSleep_Timer -= uiDiff; + + //NoxiousBreath_Timer + if (m_uiNoxiousBreath_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; + + //Tailsweep every 2 seconds + if (m_uiTailSweep_Timer <= uiDiff) + { + DoCast(me, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; + + //VolatileInfection_Timer + if (m_uiVolatileInfection_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); + m_uiVolatileInfection_Timer = 7000 + rand()%5000; + } + else + m_uiVolatileInfection_Timer -= uiDiff; + + //CorruptionofEarth_Timer + //CorruptionofEarth at 75%, 50% and 25% + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + { + ++m_uiCorruptionsCasted; // prevent casting twice on same hp + DoScriptText(SAY_CASTCORRUPTION, me); + DoCast(me->getVictim(), SPELL_CORRUPTIONOFEARTH); + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new boss_emerissAI(creature); } }; -CreatureAI* GetAI_boss_emeriss(Creature* pCreature) -{ - return new boss_emerissAI (pCreature); -} - void AddSC_boss_emeriss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_emeriss"; - newscript->GetAI = &GetAI_boss_emeriss; - newscript->RegisterSelf(); + new boss_emeriss; } diff --git a/src/server/scripts/World/boss_taerar.cpp b/src/server/scripts/World/boss_taerar.cpp index e23400feda7..7e6f39fba38 100644 --- a/src/server/scripts/World/boss_taerar.cpp +++ b/src/server/scripts/World/boss_taerar.cpp @@ -34,7 +34,6 @@ enum eEnums SPELL_SLEEP = 24777, SPELL_NOXIOUSBREATH = 24818, SPELL_TAILSWEEP = 15847, - // SPELL_MARKOFNATURE = 25040, // Not working SPELL_ARCANEBLAST = 24857, SPELL_BELLOWINGROAR = 22686, @@ -47,219 +46,210 @@ enum eEnums SPELL_POSIONBREATH = 20667 }; -uint32 m_auiSpellSummonShade[]= +uint32 m_auiSpellSummonShade[] = { SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3 }; -struct boss_taerarAI : public ScriptedAI +class boss_taerar : public CreatureScript { - boss_taerarAI(Creature *c) : ScriptedAI(c) {} +public: + boss_taerar() : CreatureScript("boss_taerar") { } - 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() + struct boss_taerarAI : public ScriptedAI { - 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; - } + boss_taerarAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - } + uint32 m_uiSleep_Timer; + uint32 m_uiNoxiousBreath_Timer; + uint32 m_uiTailSweep_Timer; + uint32 m_uiArcaneBlast_Timer; + uint32 m_uiBellowingRoar_Timer; + uint32 m_uiShades_Timer; + uint32 m_uiShadesSummoned; - void JustSummoned(Creature* pSummoned) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - } + bool m_bShades; - void UpdateAI(const uint32 uiDiff) - { - if (m_bShades && m_uiShades_Timer <= uiDiff) + void Reset() { - //Become unbanished again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + m_uiArcaneBlast_Timer = 12000; + m_uiBellowingRoar_Timer = 30000; + m_uiShades_Timer = 60000; //The time that Taerar is banished + m_uiShadesSummoned = 0; + m_bShades = false; } - else if (m_bShades) + + void EnterCombat(Unit* /*pWho*/) { - m_uiShades_Timer -= uiDiff; - //Do nothing while banished - return; + DoScriptText(SAY_AGGRO, me); } - //Return since we have no target - if (!UpdateVictim()) - return; - - //Sleep_Timer - if (m_uiSleep_Timer <= uiDiff) + void JustSummoned(Creature* pSummoned) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SLEEP); - - m_uiSleep_Timer = 8000 + rand()%7000; + pSummoned->AI()->AttackStart(pTarget); } - else - m_uiSleep_Timer -= uiDiff; - //NoxiousBreath_Timer - if (m_uiNoxiousBreath_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); - m_uiNoxiousBreath_Timer = 14000 + rand()%6000; - } - else - m_uiNoxiousBreath_Timer -= uiDiff; + if (m_bShades && m_uiShades_Timer <= uiDiff) + { + //Become unbanished again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_bShades = false; + } + else if (m_bShades) + { + m_uiShades_Timer -= uiDiff; + //Do nothing while banished + return; + } - //Tailsweep every 2 seconds - if (m_uiTailSweep_Timer <= uiDiff) - { - DoCast(me, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer <= uiDiff) - //{ - // DoCast(me->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - //ArcaneBlast_Timer - if (m_uiArcaneBlast_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_ARCANEBLAST); - m_uiArcaneBlast_Timer = 7000 + rand()%5000; - } - else - m_uiArcaneBlast_Timer -= uiDiff; + //Return since we have no target + if (!UpdateVictim()) + return; - //BellowingRoar_Timer - if (m_uiBellowingRoar_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_BELLOWINGROAR); - m_uiBellowingRoar_Timer = 20000 + rand()%10000; - } - else - m_uiBellowingRoar_Timer -= uiDiff; + //Sleep_Timer + if (m_uiSleep_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); - //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 && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + m_uiSleep_Timer = 8000 + rand()%7000; + } + else + m_uiSleep_Timer -= uiDiff; + + //NoxiousBreath_Timer + if (m_uiNoxiousBreath_Timer <= uiDiff) { - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; - //horrible workaround, need to fix - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //Tailsweep every 2 seconds + if (m_uiTailSweep_Timer <= uiDiff) + { + DoCast(me, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; - DoScriptText(SAY_SUMMONSHADE, me); + //ArcaneBlast_Timer + if (m_uiArcaneBlast_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_ARCANEBLAST); + m_uiArcaneBlast_Timer = 7000 + rand()%5000; + } + else + m_uiArcaneBlast_Timer -= uiDiff; + + //BellowingRoar_Timer + if (m_uiBellowingRoar_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BELLOWINGROAR); + m_uiBellowingRoar_Timer = 20000 + rand()%10000; + } + else + m_uiBellowingRoar_Timer -= uiDiff; + + //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 && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + + //horrible workaround, need to fix + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + DoScriptText(SAY_SUMMONSHADE, me); - int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); + int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); - for (int i = 0; i < iSize; ++i) - DoCast(pTarget, m_auiSpellSummonShade[i], true); + for (int i = 0; i < iSize; ++i) + DoCast(pTarget, m_auiSpellSummonShade[i], true); - ++m_uiShadesSummoned; // prevent casting twice at same health - m_bShades = true; + ++m_uiShadesSummoned; // prevent casting twice at same health + m_bShades = true; + } + m_uiShades_Timer = 60000; } - m_uiShades_Timer = 60000; + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new boss_taerarAI(creature); } }; -// Shades of Taerar Script -struct boss_shadeoftaerarAI : public ScriptedAI +class boss_shadeoftaerar : public CreatureScript { - boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} +public: + boss_shadeoftaerar() : CreatureScript("boss_shade_of_taerar") { } - uint32 m_uiPoisonCloud_Timer; - uint32 m_uiPosionBreath_Timer; - - void Reset() + struct boss_shadeoftaerarAI : public ScriptedAI { - m_uiPoisonCloud_Timer = 8000; - m_uiPosionBreath_Timer = 12000; - } + boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 m_uiPoisonCloud_Timer; + uint32 m_uiPosionBreath_Timer; - //PoisonCloud_Timer - if (m_uiPoisonCloud_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_POSIONCLOUD); - m_uiPoisonCloud_Timer = 30000; + m_uiPoisonCloud_Timer = 8000; + m_uiPosionBreath_Timer = 12000; } - else - m_uiPoisonCloud_Timer -= uiDiff; - //PosionBreath_Timer - if (m_uiPosionBreath_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_POSIONBREATH); - m_uiPosionBreath_Timer = 12000; + if (!UpdateVictim()) + return; + + //PoisonCloud_Timer + if (m_uiPoisonCloud_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_POSIONCLOUD); + m_uiPoisonCloud_Timer = 30000; + } + else + m_uiPoisonCloud_Timer -= uiDiff; + + //PosionBreath_Timer + if (m_uiPosionBreath_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_POSIONBREATH); + m_uiPosionBreath_Timer = 12000; + } + else + m_uiPosionBreath_Timer -= uiDiff; + + DoMeleeAttackIfReady(); } - else - m_uiPosionBreath_Timer -= uiDiff; + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new boss_shadeoftaerarAI(creature); } }; -CreatureAI* GetAI_boss_taerar(Creature* pCreature) -{ - return new boss_taerarAI (pCreature); -} - -CreatureAI* GetAI_boss_shadeoftaerar(Creature* pCreature) -{ - return new boss_shadeoftaerarAI (pCreature); -} - void AddSC_boss_taerar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_taerar"; - newscript->GetAI = &GetAI_boss_taerar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_shade_of_taerar"; - newscript->GetAI = &GetAI_boss_shadeoftaerar; - newscript->RegisterSelf(); + new boss_taerar; + new boss_shadeoftaerar; } diff --git a/src/server/scripts/World/boss_ysondre.cpp b/src/server/scripts/World/boss_ysondre.cpp index e9d7efc9d88..e0267d50fb3 100644 --- a/src/server/scripts/World/boss_ysondre.cpp +++ b/src/server/scripts/World/boss_ysondre.cpp @@ -44,162 +44,154 @@ enum eEnums }; // Ysondre script -struct boss_ysondreAI : public ScriptedAI +class boss_ysondre : public CreatureScript { - boss_ysondreAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + boss_ysondre() : CreatureScript("boss_ysondre") { } - uint32 m_uiSleep_Timer; - uint32 m_uiNoxiousBreath_Timer; - uint32 m_uiTailSweep_Timer; - //uint32 m_uiMarkOfNature_Timer; - uint32 m_uiLightningWave_Timer; - uint32 m_uiSummonDruidModifier; - - void Reset() + struct boss_ysondreAI : public ScriptedAI { - m_uiSleep_Timer = 15000 + rand()%5000; - m_uiNoxiousBreath_Timer = 8000; - m_uiTailSweep_Timer = 4000; - //m_uiMarkOfNature_Timer = 45000; - m_uiLightningWave_Timer = 12000; - m_uiSummonDruidModifier = 0; - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - } + boss_ysondreAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void JustSummoned(Creature* pSummoned) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 m_uiSleep_Timer; + uint32 m_uiNoxiousBreath_Timer; + uint32 m_uiTailSweep_Timer; + uint32 m_uiLightningWave_Timer; + uint32 m_uiSummonDruidModifier; - //Sleep_Timer - if (m_uiSleep_Timer <= uiDiff) + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SLEEP); - - m_uiSleep_Timer = 8000 + rand()%7000; + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + m_uiLightningWave_Timer = 12000; + m_uiSummonDruidModifier = 0; } - else - m_uiSleep_Timer -= uiDiff; - //NoxiousBreath_Timer - if (m_uiNoxiousBreath_Timer <= uiDiff) + void EnterCombat(Unit* /*pWho*/) { - DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); - m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + DoScriptText(SAY_AGGRO, me); } - else - m_uiNoxiousBreath_Timer -= uiDiff; - - //Tailsweep every 2 seconds - if (m_uiTailSweep_Timer <= uiDiff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer <= uiDiff) - //{ - // DoCast(me->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - //LightningWave_Timer - if (m_uiLightningWave_Timer <= uiDiff) + void JustSummoned(Creature* pSummoned) { - //Cast LIGHTNINGWAVE on a Random target - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_LIGHTNINGWAVE); - - m_uiLightningWave_Timer = 7000 + rand()%5000; + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); } - else - m_uiLightningWave_Timer -= uiDiff; - //Summon Druids - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) + void UpdateAI(const uint32 uiDiff) { - DoScriptText(SAY_SUMMONDRUIDS, me); - - for (int i = 0; i < 10; ++i) - DoCast(me, SPELL_SUMMONDRUIDS, true); - - ++m_uiSummonDruidModifier; + if (!UpdateVictim()) + return; + + //Sleep_Timer + if (m_uiSleep_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SLEEP); + + m_uiSleep_Timer = 8000 + rand()%7000; + } + else + m_uiSleep_Timer -= uiDiff; + + //NoxiousBreath_Timer + if (m_uiNoxiousBreath_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; + + //Tailsweep every 2 seconds + if (m_uiTailSweep_Timer <= uiDiff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_TAILSWEEP); + + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; + + //LightningWave_Timer + if (m_uiLightningWave_Timer <= uiDiff) + { + //Cast LIGHTNINGWAVE on a Random target + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_LIGHTNINGWAVE); + + m_uiLightningWave_Timer = 7000 + rand()%5000; + } + else + m_uiLightningWave_Timer -= uiDiff; + + //Summon Druids + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) + { + DoScriptText(SAY_SUMMONDRUIDS, me); + + for (int i = 0; i < 10; ++i) + DoCast(me, SPELL_SUMMONDRUIDS, true); + + ++m_uiSummonDruidModifier; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new boss_ysondreAI(creature); } }; // Summoned druid script -struct mob_dementeddruidsAI : public ScriptedAI +class mob_dementeddruids : public CreatureScript { - mob_dementeddruidsAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiMoonFire_Timer; +public: + mob_dementeddruids() : CreatureScript("mob_dementeddruids") { } - void Reset() + struct mob_dementeddruidsAI : public ScriptedAI { - m_uiMoonFire_Timer = 3000; - } + mob_dementeddruidsAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 m_uiMoonFire_Timer; - //MoonFire_Timer - if (m_uiMoonFire_Timer <= uiDiff) + void Reset() { - DoCast(me->getVictim(), SPELL_MOONFIRE); - m_uiMoonFire_Timer = 5000; + m_uiMoonFire_Timer = 3000; } - else - m_uiMoonFire_Timer -= uiDiff; - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //MoonFire_Timer + if (m_uiMoonFire_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MOONFIRE); + m_uiMoonFire_Timer = 5000; + } + else + m_uiMoonFire_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new mob_dementeddruidsAI(creature); } }; -CreatureAI* GetAI_boss_ysondre(Creature* pCreature) -{ - return new boss_ysondreAI (pCreature); -} - -CreatureAI* GetAI_mob_dementeddruids(Creature* pCreature) -{ - return new mob_dementeddruidsAI (pCreature); -} - void AddSC_boss_ysondre() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ysondre"; - newscript->GetAI = &GetAI_boss_ysondre; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_dementeddruids"; - newscript->GetAI = &GetAI_mob_dementeddruids; - newscript->RegisterSelf(); + new boss_ysondre; + new mob_dementeddruids; } diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index f475c276558..cb499676f61 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -38,19 +38,31 @@ EndContentData */ * guard_generic *******************************************************/ -CreatureAI* GetAI_guard_generic(Creature* pCreature) +class guard_generic : public CreatureScript { - return new guardAI (pCreature); -} +public: + guard_generic() : CreatureScript("guard_generic") { } + + CreatureAI *OnGetAI(Creature *creature) const + { + return new guardAI(creature); + } +}; /******************************************************* * guard_orgrimmar *******************************************************/ -CreatureAI* GetAI_guard_orgrimmar(Creature* pCreature) +class guard_orgrimmar : public CreatureScript { - return new guardAI_orgrimmar (pCreature); -} +public: + guard_orgrimmar() : CreatureScript("guard_orgrimmar") { } + + CreatureAI *OnGetAI(Creature *creature) const + { + return new guardAI_orgrimmar(creature); + } +}; /******************************************************* * guard_shattrath_aldor @@ -61,138 +73,156 @@ CreatureAI* GetAI_guard_orgrimmar(Creature* pCreature) #define SPELL_BANISH_TELEPORT 36643 #define SPELL_EXILE 39533 -struct guard_shattrath_aldorAI : public guardAI +class guard_shattrath_aldor : public CreatureScript { - guard_shattrath_aldorAI(Creature *c) : guardAI(c) {} +public: + guard_shattrath_aldor() : CreatureScript("guard_shattrath_aldor") { } - uint32 Exile_Timer; - uint32 Banish_Timer; - uint64 PlayerGUID; - bool CanTeleport; - - void Reset() + struct guard_shattrath_aldorAI : public guardAI { - Banish_Timer = 5000; - Exile_Timer = 8500; - PlayerGUID = 0; - CanTeleport = false; - } + guard_shattrath_aldorAI(Creature *c) : guardAI(c) {} - void EnterCombat(Unit * /*who*/) {} + uint32 Exile_Timer; + uint32 Banish_Timer; + uint64 PlayerGUID; + bool CanTeleport; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + Banish_Timer = 5000; + Exile_Timer = 8500; + PlayerGUID = 0; + CanTeleport = false; + } - if (CanTeleport) + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (Exile_Timer <= diff) + if (!UpdateVictim()) + return; + + if (CanTeleport) + { + if (Exile_Timer <= diff) + { + if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) + { + temp->CastSpell(temp,SPELL_EXILE,true); + temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); + } + PlayerGUID = 0; + Exile_Timer = 8500; + CanTeleport = false; + } else Exile_Timer -= diff; + } + else if (Banish_Timer <= diff) { - if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) + Unit* temp = me->getVictim(); + if (temp && temp->GetTypeId() == TYPEID_PLAYER) { - temp->CastSpell(temp,SPELL_EXILE,true); - temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); + DoCast(temp, SPELL_BANISHED_SHATTRATH_A); + Banish_Timer = 9000; + PlayerGUID = temp->GetGUID(); + if (PlayerGUID) + CanTeleport = true; } - PlayerGUID = 0; - Exile_Timer = 8500; - CanTeleport = false; - } else Exile_Timer -= diff; + } else Banish_Timer -= diff; + + DoMeleeAttackIfReady(); } - else if (Banish_Timer <= diff) - { - Unit* temp = me->getVictim(); - if (temp && temp->GetTypeId() == TYPEID_PLAYER) - { - DoCast(temp, SPELL_BANISHED_SHATTRATH_A); - Banish_Timer = 9000; - PlayerGUID = temp->GetGUID(); - if (PlayerGUID) - CanTeleport = true; - } - } else Banish_Timer -= diff; + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new guard_shattrath_aldorAI(creature); } }; -CreatureAI* GetAI_guard_shattrath_aldor(Creature* pCreature) -{ - return new guard_shattrath_aldorAI (pCreature); -} - /******************************************************* * guard_shattrath_scryer *******************************************************/ -struct guard_shattrath_scryerAI : public guardAI +class guard_shattrath_scryer : public CreatureScript { - guard_shattrath_scryerAI(Creature *c) : guardAI(c) {} +public: + guard_shattrath_scryer() : CreatureScript("guard_shattrath_scryer") { } - uint32 Exile_Timer; - uint32 Banish_Timer; - uint64 PlayerGUID; - bool CanTeleport; - - void Reset() + struct guard_shattrath_scryerAI : public guardAI { - Banish_Timer = 5000; - Exile_Timer = 8500; - PlayerGUID = 0; - CanTeleport = false; - } + guard_shattrath_scryerAI(Creature *c) : guardAI(c) {} - void EnterCombat(Unit * /*who*/) {} + uint32 Exile_Timer; + uint32 Banish_Timer; + uint64 PlayerGUID; + bool CanTeleport; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void Reset() + { + Banish_Timer = 5000; + Exile_Timer = 8500; + PlayerGUID = 0; + CanTeleport = false; + } - if (CanTeleport) + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (Exile_Timer <= diff) + if (!UpdateVictim()) + return; + + if (CanTeleport) + { + if (Exile_Timer <= diff) + { + if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) + { + temp->CastSpell(temp,SPELL_EXILE,true); + temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); + } + PlayerGUID = 0; + Exile_Timer = 8500; + CanTeleport = false; + } else Exile_Timer -= diff; + } + else if (Banish_Timer <= diff) { - if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) + Unit* temp = me->getVictim(); + if (temp && temp->GetTypeId() == TYPEID_PLAYER) { - temp->CastSpell(temp,SPELL_EXILE,true); - temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); + DoCast(temp, SPELL_BANISHED_SHATTRATH_S); + Banish_Timer = 9000; + PlayerGUID = temp->GetGUID(); + if (PlayerGUID) + CanTeleport = true; } - PlayerGUID = 0; - Exile_Timer = 8500; - CanTeleport = false; - } else Exile_Timer -= diff; + } else Banish_Timer -= diff; + + DoMeleeAttackIfReady(); } - else if (Banish_Timer <= diff) - { - Unit* temp = me->getVictim(); - if (temp && temp->GetTypeId() == TYPEID_PLAYER) - { - DoCast(temp, SPELL_BANISHED_SHATTRATH_S); - Banish_Timer = 9000; - PlayerGUID = temp->GetGUID(); - if (PlayerGUID) - CanTeleport = true; - } - } else Banish_Timer -= diff; + }; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new guard_shattrath_scryerAI(creature); } }; -CreatureAI* GetAI_guard_shattrath_scryer(Creature* pCreature) -{ - return new guard_shattrath_scryerAI (pCreature); -} - /******************************************************* * guard_stormwind *******************************************************/ -CreatureAI* GetAI_guard_stormwind(Creature* pCreature) +class guard_stormwind : public CreatureScript { - return new guardAI_stormwind (pCreature); -} +public: + guard_stormwind() : CreatureScript("guard_stormwind") { } + + CreatureAI *OnGetAI(Creature *creature) const + { + return new guardAI_stormwind(creature); + } +}; /******************************************************* * AddSC @@ -200,30 +230,9 @@ CreatureAI* GetAI_guard_stormwind(Creature* pCreature) void AddSC_guards() { - Script *newscript; - - newscript = new Script; - newscript->Name = "guard_generic"; - newscript->GetAI = &GetAI_guard_generic; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_orgrimmar"; - newscript->GetAI = &GetAI_guard_orgrimmar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_shattrath_aldor"; - newscript->GetAI = &GetAI_guard_shattrath_aldor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_shattrath_scryer"; - newscript->GetAI = &GetAI_guard_shattrath_scryer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "guard_stormwind"; - newscript->GetAI = &GetAI_guard_stormwind; - newscript->RegisterSelf(); + new guard_generic; + new guard_orgrimmar; + new guard_shattrath_aldor; + new guard_shattrath_scryer; + new guard_stormwind; } diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 1c70d9b2d3d..7b50e27a163 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -43,194 +43,244 @@ enum eOnlyForFlight SPELL_ARCANE_CHARGES = 45072 }; -bool ItemUse_item_only_for_flight(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) +class item_only_for_flight : public ItemScript { - uint32 itemId = pItem->GetEntry(); - bool disabled = false; +public: + item_only_for_flight() : ItemScript("item_only_for_flight") { } - //for special scripts - switch(itemId) + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) { - case 24538: - if (pPlayer->GetAreaId() != 3628) - disabled = true; - break; - case 34489: - if (pPlayer->GetZoneId() != 4080) - disabled = true; - break; - case 34475: - if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_ARCANE_CHARGES)) - Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); - break; - } + uint32 itemId = pItem->GetEntry(); + bool disabled = false; - // allow use in flight only - if (pPlayer->isInFlight() && !disabled) - return false; + //for special scripts + switch(itemId) + { + case 24538: + if (pPlayer->GetAreaId() != 3628) + disabled = true; + break; + case 34489: + if (pPlayer->GetZoneId() != 4080) + disabled = true; + break; + case 34475: + if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_ARCANE_CHARGES)) + Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_ON_GROUND); + break; + } - // error - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,pItem,NULL); - return true; -} + // allow use in flight only + if (pPlayer->isInFlight() && !disabled) + return false; + + // error + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,pItem,NULL); + return true; + } +}; /*##### # item_draenei_fishing_net #####*/ -//This is just a hack and should be removed from here. -//Creature/Item are in fact created before spell are sucessfully casted, without any checks at all to ensure proper/expected behavior. -bool ItemUse_item_draenei_fishing_net(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) +class item_draenei_fishing_net : public ItemScript { - //if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && - //targets.getGOTarget()->GetGOInfo()->type == GAMEOBJECT_TYPE_SPELL_FOCUS && targets.getGOTarget()->GetEntry() == 181616) - //{ - if (pPlayer->GetQuestStatus(9452) == QUEST_STATUS_INCOMPLETE) +public: + item_draenei_fishing_net() : ItemScript("item_draenei_fishing_net") { } + + //This is just a hack and should be removed from here. + //Creature/Item are in fact created before spell are sucessfully casted, without any checks at all to ensure proper/expected behavior. + bool OnUse(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) { - if (urand(0,99) < 35) - { - Creature *Murloc = pPlayer->SummonCreature(17102, pPlayer->GetPositionX(), pPlayer->GetPositionY()+20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - if (Murloc) - Murloc->AI()->AttackStart(pPlayer); - } - else + if (pPlayer->GetQuestStatus(9452) == QUEST_STATUS_INCOMPLETE) { - ItemPosCountVec dest; - uint32 itemId = 23614; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1); - if (msg == EQUIP_ERR_OK) + if (urand(0,99) < 35) { - if (Item* item = pPlayer->StoreNewItem(dest, itemId, true)) - pPlayer->SendNewItem(item, 1, false, true); - } else - pPlayer->SendEquipError(msg, NULL, NULL, itemId); + Creature *Murloc = pPlayer->SummonCreature(17102, pPlayer->GetPositionX(), pPlayer->GetPositionY()+20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + if (Murloc) + Murloc->AI()->AttackStart(pPlayer); + } + else + { + ItemPosCountVec dest; + uint32 itemId = 23614; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1); + if (msg == EQUIP_ERR_OK) + { + if (Item* item = pPlayer->StoreNewItem(dest, itemId, true)) + pPlayer->SendNewItem(item, 1, false, true); + } else + pPlayer->SendEquipError(msg, NULL, NULL, itemId); + } } + return false; } - //} - return false; -} +}; /*##### # item_nether_wraith_beacon #####*/ -bool ItemUse_item_nether_wraith_beacon(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) +class item_nether_wraith_beacon : public ItemScript { - if (pPlayer->GetQuestStatus(10832) == QUEST_STATUS_INCOMPLETE) +public: + item_nether_wraith_beacon() : ItemScript("item_nether_wraith_beacon") { } + + bool OnUse(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) { - Creature *Nether; - Nether = pPlayer->SummonCreature(22408, pPlayer->GetPositionX(), pPlayer->GetPositionY()+20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); - Nether = pPlayer->SummonCreature(22408, pPlayer->GetPositionX(), pPlayer->GetPositionY()-20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); - if (Nether) - Nether->AI()->AttackStart(pPlayer); + if (pPlayer->GetQuestStatus(10832) == QUEST_STATUS_INCOMPLETE) + { + Creature *Nether; + Nether = pPlayer->SummonCreature(22408, pPlayer->GetPositionX(), pPlayer->GetPositionY()+20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); + Nether = pPlayer->SummonCreature(22408, pPlayer->GetPositionX(), pPlayer->GetPositionY()-20, pPlayer->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); + if (Nether) + Nether->AI()->AttackStart(pPlayer); + } + return false; } - return false; -} +}; /*##### # item_flying_machine #####*/ -bool ItemUse_item_flying_machine(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) +class item_flying_machine : public ItemScript { - uint32 itemId = pItem->GetEntry(); - if (itemId == 34060) - if (pPlayer->GetBaseSkillValue(SKILL_RIDING) >= 225) - return false; +public: + item_flying_machine() : ItemScript("item_flying_machine") { } - if (itemId == 34061) - if (pPlayer->GetBaseSkillValue(SKILL_RIDING) == 300) - return false; + bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/) + { + uint32 itemId = pItem->GetEntry(); + if (itemId == 34060) + if (pPlayer->GetBaseSkillValue(SKILL_RIDING) >= 225) + return false; - sLog.outDebug("TSCR: Player attempt to use item %u, but did not meet riding requirement",itemId); - pPlayer->SendEquipError(EQUIP_ERR_CANT_EQUIP_SKILL,pItem,NULL); - return true; -} + if (itemId == 34061) + if (pPlayer->GetBaseSkillValue(SKILL_RIDING) == 300) + return false; + + sLog.outDebug("TSCR: Player attempt to use item %u, but did not meet riding requirement",itemId); + pPlayer->SendEquipError(EQUIP_ERR_CANT_EQUIP_SKILL,pItem,NULL); + return true; + } +}; /*##### # item_gor_dreks_ointment #####*/ -bool ItemUse_item_gor_dreks_ointment(Player *pPlayer, Item *pItem, SpellCastTargets const& targets) +class item_gor_dreks_ointment : public ItemScript { - if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT && - targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578)) - return false; +public: + item_gor_dreks_ointment() : ItemScript("item_gor_dreks_ointment") { } - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,pItem,NULL); - return true; -} + bool OnUse(Player *pPlayer, Item *pItem, SpellCastTargets const& targets) + { + if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT && + targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578)) + return false; + + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,pItem,NULL); + return true; + } +}; /*##### # item_incendiary_explosives #####*/ -bool ItemUse_item_incendiary_explosives(Player *pPlayer, Item *pItem, SpellCastTargets const & /*targets*/) +class item_incendiary_explosives : public ItemScript { - if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15)) - return false; - else +public: + item_incendiary_explosives() : ItemScript("item_incendiary_explosives") { } + + bool OnUse(Player *pPlayer, Item *pItem, SpellCastTargets const & /*targets*/) { - pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,pItem,NULL); - return true; + if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15)) + return false; + else + { + pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,pItem,NULL); + return true; + } } -} +}; /*##### # item_mysterious_egg #####*/ -bool ItemExpire_item_mysterious_egg(Player *pPlayer, ItemPrototype const * /*pItemProto*/) +class item_mysterious_egg : public ItemScript { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, 39883, true, Item::GenerateItemRandomPropertyId(39883)); +public: + item_mysterious_egg() : ItemScript("item_mysterious_egg") { } + bool OnExpire(Player *pPlayer, ItemPrototype const * /*pItemProto*/) + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, 39883, true, Item::GenerateItemRandomPropertyId(39883)); - return true; -} + return true; + } +}; /*##### # item_disgusting_jar #####*/ -bool ItemExpire_item_disgusting_jar(Player *pPlayer, ItemPrototype const * /*pItemProto*/) +class item_disgusting_jar : public ItemScript { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, 44718, true, Item::GenerateItemRandomPropertyId(44718)); +public: + item_disgusting_jar() : ItemScript("item_disgusting_jar") {} - return true; -} + bool OnExpire(Player *pPlayer, ItemPrototype const * /*pItemProto*/) + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, 44718, true, Item::GenerateItemRandomPropertyId(44718)); + + return true; + } +}; /*##### # item_harvesters_gift #####*/ #define GHOULS 28845 -bool ItemUse_item_harvesters_gift(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) + +class item_harvesters_gift : public ItemScript { - std::list<Creature*> MinionList; - pPlayer->GetAllMinionsByEntry(MinionList,GHOULS); +public: + item_harvesters_gift() : ItemScript("item_harvesters_gift") { } - if (pPlayer->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) + bool OnUse(Player* pPlayer, Item* /*pItem*/, SpellCastTargets const& /*targets*/) { - if (!MinionList.empty()) + std::list<Creature*> MinionList; + pPlayer->GetAllMinionsByEntry(MinionList,GHOULS); + + if (pPlayer->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) { - if (MinionList.size() < 5) - return false; - else + if (!MinionList.empty()) { - //This should be sent to the player as red text. - pPlayer->Say("You have created enough ghouls. Return to Gothik the Harvester at Death's Breach.",LANG_UNIVERSAL); - return true; + if (MinionList.size() < 5) + return false; + else + { + //This should be sent to the player as red text. + pPlayer->Say("You have created enough ghouls. Return to Gothik the Harvester at Death's Breach.",LANG_UNIVERSAL); + return true; + } } + else + return false; } - else - return false; + return true; } - return true; -} +}; /*##### # item_pile_fake_furs @@ -265,34 +315,39 @@ const uint32 CaribouTraps[CaribouTrapsNum] = GO_CARIBOU_TRAP_11, GO_CARIBOU_TRAP_12, GO_CARIBOU_TRAP_13, GO_CARIBOU_TRAP_14, GO_CARIBOU_TRAP_15, }; - -bool ItemUse_item_pile_fake_furs(Player *pPlayer, Item * /*pItem*/, SpellCastTargets const & /*targets*/) +class item_pile_fake_furs : public ItemScript { - GameObject *pGo = NULL; - for (uint8 i = 0; i < CaribouTrapsNum; ++i) +public: + item_pile_fake_furs() : ItemScript("item_pile_fake_furs") { } + + bool OnUse(Player *pPlayer, Item * /*pItem*/, SpellCastTargets const & /*targets*/) { - pGo = pPlayer->FindNearestGameObject(CaribouTraps[i], 5.0f); - if (pGo) - break; - } + GameObject *pGo = NULL; + for (uint8 i = 0; i < CaribouTrapsNum; ++i) + { + pGo = pPlayer->FindNearestGameObject(CaribouTraps[i], 5.0f); + if (pGo) + break; + } - if (!pGo) - return false; + if (!pGo) + return false; - if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f)) - return true; + if (pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || pGo->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || pGo->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f)) + return true; - float x, y, z; - pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f); - pGo->SummonGameObject(GO_HIGH_QUALITY_FUR, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 0, 0, 0, 0, 1000); - if (TempSummon* summon = pPlayer->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, pGo->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) - { - summon->SetVisibility(VISIBILITY_OFF); - summon->SetReactState(REACT_PASSIVE); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + float x, y, z; + pGo->GetClosePoint(x, y, z, pGo->GetObjectSize() / 3, 7.0f); + pGo->SummonGameObject(GO_HIGH_QUALITY_FUR, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, 0, 0, 0, 0, 1000); + if (TempSummon* summon = pPlayer->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, pGo->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) + { + summon->SetVisibility(VISIBILITY_OFF); + summon->SetReactState(REACT_PASSIVE); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + return false; } - return false; -} +}; /*##### # item_petrov_cluster_bombs @@ -305,23 +360,29 @@ enum ePetrovClusterBombs ZONE_ID_HOWLING = 495 }; -bool ItemUse_item_petrov_cluster_bombs(Player* pPlayer, Item* pItem, const SpellCastTargets & /*pTargets*/) +class item_petrov_cluster_bombs : public ItemScript { - if (pPlayer->GetZoneId() != ZONE_ID_HOWLING) - return false; +public: + item_petrov_cluster_bombs() : ItemScript("item_petrov_cluster_bombs") { } - if (!pPlayer->GetTransport() || pPlayer->GetAreaId() != AREA_ID_SHATTERED_STRAITS) + bool OnUse(Player* pPlayer, Item* pItem, const SpellCastTargets & /*pTargets*/) { - pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); + if (pPlayer->GetZoneId() != ZONE_ID_HOWLING) + return false; - if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_PETROV_BOMB)) - Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_HERE); + if (!pPlayer->GetTransport() || pPlayer->GetAreaId() != AREA_ID_SHATTERED_STRAITS) + { + pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, NULL); - return true; - } + if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_PETROV_BOMB)) + Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_NOT_HERE); - return false; -} + return true; + } + + return false; + } +}; /*###### # item_dehta_trap_smasher @@ -365,30 +426,36 @@ const uint32 MammothTraps[MammothTrapsNum] = GO_MAMMOTH_TRAP_21, GO_MAMMOTH_TRAP_22 }; -bool ItemUse_item_dehta_trap_smasher(Player* pPlayer, Item* /*pItem*/, const SpellCastTargets & /*pTargets*/) +class item_dehta_trap_smasher : public ItemScript { - if (pPlayer->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE) - return false; - - Creature* pMammoth; - pMammoth = pPlayer->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF,5.0f); - if (!pMammoth) - return false; +public: + item_dehta_trap_smasher() : ItemScript("item_dehta_trap_smasher") { } - GameObject* pTrap; - for (uint8 i = 0; i < MammothTrapsNum; ++i) + bool OnUse(Player* pPlayer, Item* /*pItem*/, const SpellCastTargets & /*pTargets*/) { - pTrap = pPlayer->FindNearestGameObject(MammothTraps[i],11.0f); - if (pTrap) + if (pPlayer->GetQuestStatus(QUEST_CANNOT_HELP_THEMSELVES) != QUEST_STATUS_INCOMPLETE) + return false; + + Creature* pMammoth; + pMammoth = pPlayer->FindNearestCreature(NPC_TRAPPED_MAMMOTH_CALF,5.0f); + if (!pMammoth) + return false; + + GameObject* pTrap; + for (uint8 i = 0; i < MammothTrapsNum; ++i) { - pMammoth->AI()->DoAction(1); - pTrap->SetGoState(GO_STATE_READY); - pPlayer->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF,0); - return true; + pTrap = pPlayer->FindNearestGameObject(MammothTraps[i],11.0f); + if (pTrap) + { + pMammoth->AI()->DoAction(1); + pTrap->SetGoState(GO_STATE_READY); + pPlayer->KilledMonsterCredit(NPC_TRAPPED_MAMMOTH_CALF,0); + return true; + } } + return false; } - return false; -} +}; enum TheEmissary { @@ -396,87 +463,40 @@ enum TheEmissary NPC_LEVIROTH = 26452 }; -bool ItemUse_item_Trident_of_Nazjan(Player* pPlayer, Item* pItem, const SpellCastTargets & /*pTargets*/) +class item_trident_of_nazjan : public ItemScript { - if (pPlayer->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE) +public: + item_trident_of_nazjan() : ItemScript("item_Trident_of_Nazjan") { } + + bool OnUse(Player* pPlayer, Item* pItem, const SpellCastTargets & /*pTargets*/) { - if (Creature* pLeviroth = pPlayer->FindNearestCreature(NPC_LEVIROTH, 10.0f)) // spell range + if (pPlayer->GetQuestStatus(QUEST_THE_EMISSARY) == QUEST_STATUS_INCOMPLETE) { - pLeviroth->AI()->AttackStart(pPlayer); - return false; + if (Creature* pLeviroth = pPlayer->FindNearestCreature(NPC_LEVIROTH, 10.0f)) // spell range + { + pLeviroth->AI()->AttackStart(pPlayer); + return false; + } else + pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL); } else - pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE, pItem, NULL); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW ,pItem, NULL); - return true; -} + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW ,pItem, NULL); + return true; + } +}; void AddSC_item_scripts() { - Script *newscript; - - newscript = new Script; - newscript->Name = "item_only_for_flight"; - newscript->pItemUse = &ItemUse_item_only_for_flight; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_draenei_fishing_net"; - newscript->pItemUse = &ItemUse_item_draenei_fishing_net; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_nether_wraith_beacon"; - newscript->pItemUse = &ItemUse_item_nether_wraith_beacon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_flying_machine"; - newscript->pItemUse = &ItemUse_item_flying_machine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_gor_dreks_ointment"; - newscript->pItemUse = &ItemUse_item_gor_dreks_ointment; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_incendiary_explosives"; - newscript->pItemUse = &ItemUse_item_incendiary_explosives; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_mysterious_egg"; - newscript->pItemExpire = &ItemExpire_item_mysterious_egg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_disgusting_jar"; - newscript->pItemExpire = &ItemExpire_item_disgusting_jar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_harvesters_gift"; - newscript->pItemUse = &ItemUse_item_harvesters_gift; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_pile_fake_furs"; - newscript->pItemUse = &ItemUse_item_pile_fake_furs; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_petrov_cluster_bombs"; - newscript->pItemUse = &ItemUse_item_petrov_cluster_bombs; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_dehta_trap_smasher"; - newscript->pItemUse = &ItemUse_item_dehta_trap_smasher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_Trident_of_Nazjan"; - newscript->pItemUse = &ItemUse_item_Trident_of_Nazjan; - newscript->RegisterSelf(); + new item_only_for_flight; + new item_draenei_fishing_net; + new item_nether_wraith_beacon; + new item_flying_machine; + new item_gor_dreks_ointment; + new item_incendiary_explosives; + new item_mysterious_egg; + new item_disgusting_jar; + new item_harvesters_gift; + new item_pile_fake_furs; + new item_petrov_cluster_bombs; + new item_dehta_trap_smasher; + new item_trident_of_nazjan; } diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index 9493d4e033a..ab32830f8df 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -27,203 +27,204 @@ EndScriptData */ #define GENERIC_CREATURE_COOLDOWN 5000 -struct generic_creatureAI : public ScriptedAI +class generic_creature : public CreatureScript { - generic_creatureAI(Creature *c) : ScriptedAI(c) {} +public: + generic_creature() : CreatureScript("generic_creature") { } - uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) - uint32 BuffTimer; //This variable keeps track of buffs - bool IsSelfRooted; - - void Reset() + struct generic_creatureAI : public ScriptedAI { - GlobalCooldown = 0; - BuffTimer = 0; //Rebuff as soon as we can - IsSelfRooted = false; - } + generic_creatureAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit *who) - { - if (!me->IsWithinMeleeRange(who)) + uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) + uint32 BuffTimer; //This variable keeps track of buffs + bool IsSelfRooted; + + void Reset() { - IsSelfRooted = true; + GlobalCooldown = 0; + BuffTimer = 0; //Rebuff as soon as we can + IsSelfRooted = false; } - } - void UpdateAI(const uint32 diff) - { - //Always decrease our global cooldown first - if (GlobalCooldown > diff) - GlobalCooldown -= diff; - else GlobalCooldown = 0; - - //Buff timer (only buff when we are alive and not in combat - if (!me->isInCombat() && me->isAlive()) - if (BuffTimer <= diff) - { - //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + void EnterCombat(Unit *who) + { + if (!me->IsWithinMeleeRange(who)) + IsSelfRooted = true; + } - if (info && !GlobalCooldown) + void UpdateAI(const uint32 diff) + { + //Always decrease our global cooldown first + if (GlobalCooldown > diff) + GlobalCooldown -= diff; + else GlobalCooldown = 0; + + //Buff timer (only buff when we are alive and not in combat + if (!me->isInCombat() && me->isAlive()) + if (BuffTimer <= diff) { - //Cast the buff spell - DoCastSpell(me, info); + //Find a spell that targets friendly and applies an aura (these are generally buffs) + SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); - //Set our global cooldown - GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + if (info && !GlobalCooldown) + { + //Cast the buff spell + DoCastSpell(me, info); - //Set our timer to 10 minutes before rebuff - BuffTimer = 600000; - }//Try agian in 30 seconds - else BuffTimer = 30000; - } else BuffTimer -= diff; + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - //Return since we have no target - if (!UpdateVictim()) - return; + //Set our timer to 10 minutes before rebuff + BuffTimer = 600000; + }//Try agian in 30 seconds + else BuffTimer = 30000; + } else BuffTimer -= diff; - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - //Make sure our attack is ready and we arn't currently casting - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + //Return since we have no target + if (!UpdateVictim()) + return; + + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) { - bool Healing = false; - SpellEntry const *info = NULL; + //Make sure our attack is ready and we arn't currently casting + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + { + bool Healing = false; + SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp - if (me->GetHealth()*100 / me->GetMaxHealth() < 30) - info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + //Select a healing spell if less than 30% hp + if (me->GetHealth()*100 / me->GetMaxHealth() < 30) + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, select a hostile spell - if (info) Healing = true; - else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); + //No healing spell available, select a hostile spell + if (info) Healing = true; + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); - //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell - if (info && (rand() % (me->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) - { - //Cast the spell - if (Healing)DoCastSpell(me, info); - else DoCastSpell(me->getVictim(), info); + //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell + if (info && (rand() % (me->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) + { + //Cast the spell + if (Healing)DoCastSpell(me, info); + else DoCastSpell(me->getVictim(), info); - //Set our global cooldown - GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - } - else me->AttackerStateUpdate(me->getVictim()); + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + } + else me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + me->resetAttackTimer(); + } } - } - else - { - //Only run this code if we arn't already casting - if (!me->IsNonMeleeSpellCasted(false)) + else { - bool Healing = false; - SpellEntry const *info = NULL; + //Only run this code if we arn't already casting + if (!me->IsNonMeleeSpellCasted(false)) + { + bool Healing = false; + SpellEntry const *info = NULL; - //Select a healing spell if less than 30% hp ONLY 33% of the time - if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) - info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + //Select a healing spell if less than 30% hp ONLY 33% of the time + if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); - //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) - if (info) Healing = true; - else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); + //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) + if (info) Healing = true; + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); - //Found a spell, check if we arn't on cooldown - if (info && !GlobalCooldown) - { - //If we are currently moving stop us and set the movement generator - if (!IsSelfRooted) + //Found a spell, check if we arn't on cooldown + if (info && !GlobalCooldown) { - IsSelfRooted = true; - } + //If we are currently moving stop us and set the movement generator + if (!IsSelfRooted) + IsSelfRooted = true; - //Cast spell - if (Healing) DoCastSpell(me,info); - else DoCastSpell(me->getVictim(),info); + //Cast spell + if (Healing) DoCastSpell(me,info); + else DoCastSpell(me->getVictim(),info); - //Set our global cooldown - GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - }//If no spells available and we arn't moving run to target - else if (IsSelfRooted) - { - //Cancel our current spell and then allow movement agian - me->InterruptNonMeleeSpells(false); - IsSelfRooted = false; + }//If no spells available and we arn't moving run to target + else if (IsSelfRooted) + { + //Cancel our current spell and then allow movement agian + me->InterruptNonMeleeSpells(false); + IsSelfRooted = false; + } } } } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new generic_creatureAI(creature); } }; -CreatureAI* GetAI_generic_creature(Creature* pCreature) +class trigger_periodic : public CreatureScript { - return new generic_creatureAI (pCreature); -} +public: + trigger_periodic() : CreatureScript("trigger_periodic") { } -struct trigger_periodicAI : public NullCreatureAI -{ - trigger_periodicAI(Creature* c) : NullCreatureAI(c) + struct trigger_periodicAI : public NullCreatureAI { - spell = me->m_spells[0] ? GetSpellStore()->LookupEntry(me->m_spells[0]) : NULL; - interval = me->GetAttackTime(BASE_ATTACK); - timer = interval; - } + trigger_periodicAI(Creature* c) : NullCreatureAI(c) + { + spell = me->m_spells[0] ? GetSpellStore()->LookupEntry(me->m_spells[0]) : NULL; + interval = me->GetAttackTime(BASE_ATTACK); + timer = interval; + } - uint32 timer, interval; - const SpellEntry * spell; + uint32 timer, interval; + const SpellEntry * spell; - void UpdateAI(const uint32 diff) - { - if (timer <= diff) + void UpdateAI(const uint32 diff) { - if (spell) - me->CastSpell(me, spell, true); - timer = interval; + if (timer <= diff) + { + if (spell) + me->CastSpell(me, spell, true); + timer = interval; + } + else + timer -= diff; } - else - timer -= diff; - } -}; + }; -struct trigger_deathAI : public NullCreatureAI -{ - trigger_deathAI(Creature* c) : NullCreatureAI(c) {} - void JustDied(Unit *killer) + CreatureAI *OnGetAI(Creature *creature) const { - if (me->m_spells[0]) - me->CastSpell(killer, me->m_spells[0], true); + return new trigger_periodicAI(creature); } }; -CreatureAI* GetAI_trigger_periodic(Creature* pCreature) +class trigger_death : public CreatureScript { - return new trigger_periodicAI (pCreature); -} +public: + trigger_death() : CreatureScript("trigger_death") { } -CreatureAI* GetAI_trigger_death(Creature* pCreature) -{ - return new trigger_deathAI (pCreature); -} + struct trigger_deathAI : public NullCreatureAI + { + trigger_deathAI(Creature* c) : NullCreatureAI(c) {} + void JustDied(Unit *killer) + { + if (me->m_spells[0]) + me->CastSpell(killer, me->m_spells[0], true); + } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new trigger_deathAI(creature); + } +}; void AddSC_generic_creature() { - Script *newscript; - /*newscript = new Script; - newscript->Name = "generic_creature"; - newscript->GetAI = &GetAI_generic_creature; - newscript->RegisterSelf();*/ - - newscript = new Script; - newscript->Name = "trigger_periodic"; - newscript->GetAI = &GetAI_trigger_periodic; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "trigger_death"; - newscript->GetAI = &GetAI_trigger_death; - newscript->RegisterSelf();*/ + //new generic_creature; + new trigger_periodic; + //new trigger_death; } - diff --git a/src/server/scripts/World/npc_innkeeper.cpp b/src/server/scripts/World/npc_innkeeper.cpp index 29b27484fc8..5175415d2bc 100644 --- a/src/server/scripts/World/npc_innkeeper.cpp +++ b/src/server/scripts/World/npc_innkeeper.cpp @@ -37,94 +37,95 @@ EndScriptData */ #define LOCALE_INNKEEPER_0 "Make this inn my home." #define LOCALE_INNKEEPER_3 "Ich möchte dieses Gasthaus zu meinem Heimatort machen." -bool GossipHello_npc_innkeeper(Player *pPlayer, Creature *pCreature) +class npc_innkeeper : public CreatureScript { - if (IsEventActive(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED)) +public: + npc_innkeeper() : CreatureScript("npc_innkeeper") { } + + bool OnGossipHello(Player *pPlayer, Creature *pCreature) { - char* localizedEntry; - switch (pPlayer->GetSession()->GetSessionDbcLocale()) + if (IsEventActive(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED)) { - case LOCALE_frFR: localizedEntry = LOCALE_TRICK_OR_TREAT_2; break; - case LOCALE_deDE: localizedEntry = LOCALE_TRICK_OR_TREAT_3; break; - case LOCALE_esES: localizedEntry = LOCALE_TRICK_OR_TREAT_6; break; - case LOCALE_enUS: default: localizedEntry = LOCALE_TRICK_OR_TREAT_0; + char* localizedEntry; + switch (pPlayer->GetSession()->GetSessionDbcLocale()) + { + case LOCALE_frFR: localizedEntry = LOCALE_TRICK_OR_TREAT_2; break; + case LOCALE_deDE: localizedEntry = LOCALE_TRICK_OR_TREAT_3; break; + case LOCALE_esES: localizedEntry = LOCALE_TRICK_OR_TREAT_6; break; + case LOCALE_enUS: default: localizedEntry = LOCALE_TRICK_OR_TREAT_0; + } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID); } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID); - } - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pCreature->isInnkeeper()) - { - char* localizedEntry; - switch (pPlayer->GetSession()->GetSessionDbcLocale()) + if (pCreature->isInnkeeper()) { - case LOCALE_deDE: localizedEntry = LOCALE_INNKEEPER_3; break; - case LOCALE_enUS: default: localizedEntry = LOCALE_INNKEEPER_0; + char* localizedEntry; + switch (pPlayer->GetSession()->GetSessionDbcLocale()) + { + case LOCALE_deDE: localizedEntry = LOCALE_INNKEEPER_3; break; + case LOCALE_enUS: default: localizedEntry = LOCALE_INNKEEPER_0; + } + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INN); } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, localizedEntry, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INN); - } - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_innkeeper(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && IsEventActive(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true); - - if (urand(0, 1)) - pPlayer->CastSpell(pPlayer, SPELL_TREAT, true); - else + if (uiAction == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && IsEventActive(HALLOWEEN_EVENTID) && !pPlayer->HasAura(SPELL_TRICK_OR_TREATED)) { - uint32 trickspell = 0; - switch (urand(0, 13)) + pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true); + + if (urand(0, 1)) + pPlayer->CastSpell(pPlayer, SPELL_TREAT, true); + else { - case 0: trickspell = 24753; break; // cannot cast, random 30sec - case 1: trickspell = 24713; break; // lepper gnome costume - case 2: trickspell = 24735; break; // male ghost costume - case 3: trickspell = 24736; break; // female ghostcostume - case 4: trickspell = 24710; break; // male ninja costume - case 5: trickspell = 24711; break; // female ninja costume - case 6: trickspell = 24708; break; // male pirate costume - case 7: trickspell = 24709; break; // female pirate costume - case 8: trickspell = 24723; break; // skeleton costume - case 9: trickspell = 24753; break; // Trick - case 10: trickspell = 24924; break; // Hallow's End Candy - case 11: trickspell = 24925; break; // Hallow's End Candy - case 12: trickspell = 24926; break; // Hallow's End Candy - case 13: trickspell = 24927; break; // Hallow's End Candy + uint32 trickspell = 0; + switch (urand(0, 13)) + { + case 0: trickspell = 24753; break; // cannot cast, random 30sec + case 1: trickspell = 24713; break; // lepper gnome costume + case 2: trickspell = 24735; break; // male ghost costume + case 3: trickspell = 24736; break; // female ghostcostume + case 4: trickspell = 24710; break; // male ninja costume + case 5: trickspell = 24711; break; // female ninja costume + case 6: trickspell = 24708; break; // male pirate costume + case 7: trickspell = 24709; break; // female pirate costume + case 8: trickspell = 24723; break; // skeleton costume + case 9: trickspell = 24753; break; // Trick + case 10: trickspell = 24924; break; // Hallow's End Candy + case 11: trickspell = 24925; break; // Hallow's End Candy + case 12: trickspell = 24926; break; // Hallow's End Candy + case 13: trickspell = 24927; break; // Hallow's End Candy + } + pPlayer->CastSpell(pPlayer, trickspell, true); } - pPlayer->CastSpell(pPlayer, trickspell, true); + pPlayer->CLOSE_GOSSIP_MENU(); + return true; } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } - pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CLOSE_GOSSIP_MENU(); - switch (uiAction) - { - case GOSSIP_ACTION_TRADE: pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break; - case GOSSIP_ACTION_INN: pPlayer->SetBindPoint(pCreature->GetGUID()); break; + switch (uiAction) + { + case GOSSIP_ACTION_TRADE: pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break; + case GOSSIP_ACTION_INN: pPlayer->SetBindPoint(pCreature->GetGUID()); break; + } + return true; } - return true; -} +}; void AddSC_npc_innkeeper() { - Script *newscript; - newscript = new Script; - newscript->Name = "npc_innkeeper"; - newscript->pGossipHello = &GossipHello_npc_innkeeper; - newscript->pGossipSelect = &GossipSelect_npc_innkeeper; - newscript->RegisterSelf(); + new npc_innkeeper; } diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 9a11c5773a0..930c70fafe3 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -352,181 +352,187 @@ bool HasAlchemySpell(Player* pPlayer) return false; } -bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) +class npc_prof_alchemy : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); +public: + npc_prof_alchemy() : CreatureScript("npc_prof_alchemy") { } - uint32 eCreature = pCreature->GetEntry(); - - if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 350 && pPlayer->getLevel() > 67) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestRewardStatus(10899) || pPlayer->GetQuestRewardStatus(10902) || pPlayer->GetQuestRewardStatus(10897)) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + + uint32 eCreature = pCreature->GetEntry(); + + if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 350 && pPlayer->getLevel() > 67) { - switch (eCreature) + if (pPlayer->GetQuestRewardStatus(10899) || pPlayer->GetQuestRewardStatus(10902) || pPlayer->GetQuestRewardStatus(10897)) { - case 22427: //Zarevhi - if (!HasAlchemySpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->HasSpell(S_TRANSMUTE)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); - break; - case 19052: //Lorokeem - if (!HasAlchemySpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->HasSpell(S_ELIXIR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 5); - break; - case 17909: //Lauranna Thar'well - if (!HasAlchemySpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 3); - if (pPlayer->HasSpell(S_POTION)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 6); - break; + switch (eCreature) + { + case 22427: //Zarevhi + if (!HasAlchemySpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->HasSpell(S_TRANSMUTE)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); + break; + case 19052: //Lorokeem + if (!HasAlchemySpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2); + if (pPlayer->HasSpell(S_ELIXIR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 5); + break; + case 17909: //Lauranna Thar'well + if (!HasAlchemySpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 3); + if (pPlayer->HasSpell(S_POTION)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 6); + break; + } } } - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -void SendActionMenu_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - break; - //Learn Alchemy - case GOSSIP_ACTION_INFO_DEF + 1: - if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_TRANSMUTE, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_ELIXIR, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - if (!pPlayer->HasSpell(S_POTION) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_POTION, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - //Unlearn Alchemy - case GOSSIP_ACTION_INFO_DEF + 4: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) - { - pCreature->CastSpell(pPlayer, S_UNLEARN_TRANSMUTE, true); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) - { - pCreature->CastSpell(pPlayer, S_UNLEARN_ELIXIR, true); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) - { - pCreature->CastSpell(pPlayer, S_UNLEARN_POTION, true); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } -} -void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendActionMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + switch(uiAction) { - case 22427: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); + break; + //Learn Alchemy + case GOSSIP_ACTION_INFO_DEF + 1: + if (!pPlayer->HasSpell(S_TRANSMUTE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_LEARN_TRANSMUTE, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + if (!pPlayer->HasSpell(S_ELIXIR) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_LEARN_ELIXIR, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + if (!pPlayer->HasSpell(S_POTION) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_LEARN_POTION, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + //Unlearn Alchemy + case GOSSIP_ACTION_INFO_DEF + 4: + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pCreature->CastSpell(pPlayer, S_UNLEARN_TRANSMUTE, true); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; - case 19052: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 5: + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pCreature->CastSpell(pPlayer, S_UNLEARN_ELIXIR, true); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; - case 17909: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 6: + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pCreature->CastSpell(pPlayer, S_UNLEARN_POTION, true); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; } } -} -void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendConfirmLearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + if (uiAction) { - case 22427: //Zarevhi - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 19052: //Lorokeem - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 17909: //Lauranna Thar'well - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 22427: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 19052: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 17909: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_POTION, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } } } -} -bool GossipSelect_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) + void SendConfirmUnlearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - case GOSSIP_SENDER_MAIN: SendActionMenu_npc_prof_alchemy(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn_npc_prof_alchemy(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn_npc_prof_alchemy(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu_npc_prof_alchemy(pPlayer, pCreature, uiAction); break; + if (uiAction) + { + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 22427: //Zarevhi + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRANSMUTE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 19052: //Lorokeem + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELIXIR, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 17909: //Lauranna Thar'well + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_POTION, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ALCHEMY_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } + } } - return true; -} + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + { + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: SendActionMenu(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_LEARN: SendConfirmLearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_CHECK: SendActionMenu(pPlayer, pCreature, uiAction); break; + } + return true; + } +}; /*### # start menues blacksmith @@ -539,279 +545,274 @@ bool HasWeaponSub(Player* pPlayer) return false; } -bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) +class npc_prof_blacksmith : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - - uint32 eCreature = pCreature->GetEntry(); - //WEAPONSMITH & ARMORSMITH - if (pPlayer->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225) +public: + npc_prof_blacksmith() : CreatureScript("npc_prof_blacksmith") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - switch (eCreature) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + + uint32 eCreature = pCreature->GetEntry(); + //WEAPONSMITH & ARMORSMITH + if (pPlayer->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 225) { - case 11145: //Myolor Sunderfury - case 11176: //Krathok Moltenfist - if (!pPlayer->HasSpell(S_ARMOR) && !pPlayer->HasSpell(S_WEAPON) && pPlayer->GetReputationRank(REP_ARMOR) >= REP_FRIENDLY) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (!pPlayer->HasSpell(S_WEAPON) && !pPlayer->HasSpell(S_ARMOR) && pPlayer->GetReputationRank(REP_WEAPON) >= REP_FRIENDLY) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - break; - case 11146: //Ironus Coldsteel - case 11178: //Borgosh Corebender - if (pPlayer->HasSpell(S_WEAPON)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); - break; - case 5164: //Grumnus Steelshaper - case 11177: //Okothos Ironrager - if (pPlayer->HasSpell(S_ARMOR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); - break; + switch (eCreature) + { + case 11145: //Myolor Sunderfury + case 11176: //Krathok Moltenfist + if (!pPlayer->HasSpell(S_ARMOR) && !pPlayer->HasSpell(S_WEAPON) && pPlayer->GetReputationRank(REP_ARMOR) >= REP_FRIENDLY) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (!pPlayer->HasSpell(S_WEAPON) && !pPlayer->HasSpell(S_ARMOR) && pPlayer->GetReputationRank(REP_WEAPON) >= REP_FRIENDLY) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_LEARN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + break; + case 11146: //Ironus Coldsteel + case 11178: //Borgosh Corebender + if (pPlayer->HasSpell(S_WEAPON)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEAPON_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); + break; + case 5164: //Grumnus Steelshaper + case 11177: //Okothos Ironrager + if (pPlayer->HasSpell(S_ARMOR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ARMOR_UNLEARN, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); + break; + } + } + //WEAPONSMITH SPEC + if (pPlayer->HasSpell(S_WEAPON) && pPlayer->getLevel() > 49 && pPlayer->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250) + { + switch (eCreature) + { + case 11191: //Lilith the Lithe + if (!HasWeaponSub(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 5); + if (pPlayer->HasSpell(S_HAMMER)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 8); + break; + case 11192: //Kilram + if (!HasWeaponSub(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 6); + if (pPlayer->HasSpell(S_AXE)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 9); + break; + case 11193: //Seril Scourgebane + if (!HasWeaponSub(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 7); + if (pPlayer->HasSpell(S_SWORD)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 10); + break; + } } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - //WEAPONSMITH SPEC - if (pPlayer->HasSpell(S_WEAPON) && pPlayer->getLevel() > 49 && pPlayer->GetBaseSkillValue(SKILL_BLACKSMITHING) >= 250) + + void SendActionMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - switch (eCreature) + switch(uiAction) { - case 11191: //Lilith the Lithe - if (!HasWeaponSub(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 5); - if (pPlayer->HasSpell(S_HAMMER)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 8); + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); break; - case 11192: //Kilram - if (!HasWeaponSub(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 6); - if (pPlayer->HasSpell(S_AXE)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 9); + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); break; - case 11193: //Seril Scourgebane - if (!HasWeaponSub(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 7); - if (pPlayer->HasSpell(S_SWORD)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 10); + //Learn Armor/Weapon + case GOSSIP_ACTION_INFO_DEF + 1: + if (!pPlayer->HasSpell(S_ARMOR)) + { + pPlayer->CastSpell(pPlayer, S_LEARN_ARMOR, true); + //_Creature->CastSpell(pPlayer, S_REP_ARMOR, true); + } + pPlayer->CLOSE_GOSSIP_MENU(); break; - } - } - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -void SendActionMenu_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - break; - //Learn Armor/Weapon - case GOSSIP_ACTION_INFO_DEF + 1: - if (!pPlayer->HasSpell(S_ARMOR)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_ARMOR, true); - //_Creature->CastSpell(pPlayer, S_REP_ARMOR, true); - } - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasSpell(S_WEAPON)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_WEAPON, true); - //_Creature->CastSpell(pPlayer, S_REP_WEAPON, true); - } - pPlayer->CLOSE_GOSSIP_MENU(); - break; - //Unlearn Armor/Weapon - case GOSSIP_ACTION_INFO_DEF + 3: - if (HasWeaponSub(pPlayer)) - { - //unknown textID (TALK_MUST_UNLEARN_WEAPON) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - else if (EquippedOk(pPlayer,S_UNLEARN_WEAPON)) - { - if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + case GOSSIP_ACTION_INFO_DEF + 2: + if (!pPlayer->HasSpell(S_WEAPON)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_WEAPON, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_WEAPON); - pPlayer->ModifyMoney(-DoLowUnlearnCost(pPlayer)); - pCreature->CastSpell(pPlayer, S_REP_ARMOR, true); - pPlayer->CLOSE_GOSSIP_MENU(); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } - else - { - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CastSpell(pPlayer, S_LEARN_WEAPON, true); + //_Creature->CastSpell(pPlayer, S_REP_WEAPON, true); + } pPlayer->CLOSE_GOSSIP_MENU(); - } - break; - case GOSSIP_ACTION_INFO_DEF + 4: - if (EquippedOk(pPlayer,S_UNLEARN_ARMOR)) - { - if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + break; + //Unlearn Armor/Weapon + case GOSSIP_ACTION_INFO_DEF + 3: + if (HasWeaponSub(pPlayer)) + { + //unknown textID (TALK_MUST_UNLEARN_WEAPON) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + else if (EquippedOk(pPlayer,S_UNLEARN_WEAPON)) + { + if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_WEAPON, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_WEAPON); + pPlayer->ModifyMoney(-DoLowUnlearnCost(pPlayer)); + pCreature->CastSpell(pPlayer, S_REP_ARMOR, true); + pPlayer->CLOSE_GOSSIP_MENU(); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + } + else { - pPlayer->CastSpell(pPlayer, S_UNLEARN_ARMOR, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ARMOR); - pPlayer->ModifyMoney(-DoLowUnlearnCost(pPlayer)); - pCreature->CastSpell(pPlayer, S_REP_WEAPON, true); + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + } + break; + case GOSSIP_ACTION_INFO_DEF + 4: + if (EquippedOk(pPlayer,S_UNLEARN_ARMOR)) + { + if (pPlayer->GetMoney() >= DoLowUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_ARMOR, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ARMOR); + pPlayer->ModifyMoney(-DoLowUnlearnCost(pPlayer)); + pCreature->CastSpell(pPlayer, S_REP_WEAPON, true); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - //Learn Hammer/Axe/Sword - case GOSSIP_ACTION_INFO_DEF + 5: - pPlayer->CastSpell(pPlayer, S_LEARN_HAMMER, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - pPlayer->CastSpell(pPlayer, S_LEARN_AXE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 7: - pPlayer->CastSpell(pPlayer, S_LEARN_SWORD, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - //Unlearn Hammer/Axe/Sword - case GOSSIP_ACTION_INFO_DEF + 8: - if (EquippedOk(pPlayer,S_UNLEARN_HAMMER)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + //Learn Hammer/Axe/Sword + case GOSSIP_ACTION_INFO_DEF + 5: + pPlayer->CastSpell(pPlayer, S_LEARN_HAMMER, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + pPlayer->CastSpell(pPlayer, S_LEARN_AXE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 7: + pPlayer->CastSpell(pPlayer, S_LEARN_SWORD, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + //Unlearn Hammer/Axe/Sword + case GOSSIP_ACTION_INFO_DEF + 8: + if (EquippedOk(pPlayer,S_UNLEARN_HAMMER)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_HAMMER, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_HAMMER); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_HAMMER, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_HAMMER); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 9: - if (EquippedOk(pPlayer,S_UNLEARN_AXE)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 9: + if (EquippedOk(pPlayer,S_UNLEARN_AXE)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_AXE, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_AXE); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_AXE, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_AXE); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 10: - if (EquippedOk(pPlayer,S_UNLEARN_SWORD)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 10: + if (EquippedOk(pPlayer,S_UNLEARN_SWORD)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_SWORD, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SWORD); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_SWORD, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SWORD); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } } -} -void SendConfirmLearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendConfirmLearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + if (uiAction) { - case 11191: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID (TALK_HAMMER_LEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 11192: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID (TALK_AXE_LEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 11193: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID (TALK_SWORD_LEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 11191: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID (TALK_HAMMER_LEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 11192: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_AXE, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID (TALK_AXE_LEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 11193: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID (TALK_SWORD_LEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } } } -} -void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendConfirmUnlearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + if (uiAction) { - case 11146: //Ironus Coldsteel - case 11178: //Borgosh Corebender - case 5164: //Grumnus Steelshaper - case 11177: //Okothos Ironrager - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(pPlayer),false); - //unknown textID (TALK_UNLEARN_AXEORWEAPON) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 11146: //Ironus Coldsteel + case 11178: //Borgosh Corebender + case 5164: //Grumnus Steelshaper + case 11177: //Okothos Ironrager + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SMITH_SPEC, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_ARMORORWEAPON, DoLowUnlearnCost(pPlayer),false); + //unknown textID (TALK_UNLEARN_AXEORWEAPON) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; - case 11191: - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID (TALK_HAMMER_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 11192: - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID (TALK_AXE_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 11193: - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID (TALK_SWORD_UNLEARN) - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + case 11191: + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_HAMMER, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID (TALK_HAMMER_UNLEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 11192: + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_AXE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID (TALK_AXE_UNLEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 11193: + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SWORD, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_WEAPON_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID (TALK_SWORD_UNLEARN) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } } } -} -bool GossipSelect_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - case GOSSIP_SENDER_MAIN: SendActionMenu_npc_prof_blacksmith(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn_npc_prof_blacksmith(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn_npc_prof_blacksmith(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu_npc_prof_blacksmith(pPlayer, pCreature, uiAction); break; + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: SendActionMenu(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_LEARN: SendConfirmLearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_CHECK: SendActionMenu(pPlayer, pCreature, uiAction); break; + } + return true; } - return true; -} - -/*bool QuestComplete_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, Quest const *_Quest) -{ - if ((_Quest->GetQuestId() == 5283) || (_Quest->GetQuestId() == 5301)) //armorsmith - pCreature->CastSpell(pPlayer, 17451, true); - - if ((_Quest->GetQuestId() == 5284) || (_Quest->GetQuestId() == 5302)) //weaponsmith - pCreature->CastSpell(pPlayer, 17452, true); - - return true; -}*/ +}; /*### # engineering trinkets @@ -843,244 +844,256 @@ enum eEngineeringTrinkets #define GOSSIP_ITEM_KABLAM "[PH] Unknown" #define GOSSIP_ITEM_SMILES "[PH] Unknown" -bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature) +class npc_engineering_tele_trinket : public CreatureScript { - uint32 NpcTextId = 0; - std::string GossipItem; - bool CanLearn = false; +public: + npc_engineering_tele_trinket() : CreatureScript("npc_engineering_tele_trinket") { } - if (pPlayer->HasSkill(SKILL_ENGINERING)) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - switch(pCreature->GetEntry()) + uint32 NpcTextId = 0; + std::string GossipItem; + bool CanLearn = false; + + if (pPlayer->HasSkill(SKILL_ENGINERING)) { - case NPC_ZAP: - NpcTextId = 7249; - if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GOBLIN)) - { - if (!pPlayer->HasSpell(SPELL_TO_EVERLOOK)) + switch(pCreature->GetEntry()) + { + case NPC_ZAP: + NpcTextId = 7249; + if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GOBLIN)) { - CanLearn = true; - GossipItem = GOSSIP_ITEM_ZAP; + if (!pPlayer->HasSpell(SPELL_TO_EVERLOOK)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_ZAP; + } + else if (pPlayer->HasSpell(SPELL_TO_EVERLOOK)) + NpcTextId = 0; } - else if (pPlayer->HasSpell(SPELL_TO_EVERLOOK)) - NpcTextId = 0; - } - break; - case NPC_JHORDY: - NpcTextId = 7251; - if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GNOMISH)) - { - if (!pPlayer->HasSpell(SPELL_TO_GADGET)) + break; + case NPC_JHORDY: + NpcTextId = 7251; + if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GNOMISH)) { - CanLearn = true; - GossipItem = GOSSIP_ITEM_JHORDY; + if (!pPlayer->HasSpell(SPELL_TO_GADGET)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_JHORDY; + } + else if (pPlayer->HasSpell(SPELL_TO_GADGET)) + NpcTextId = 7252; } - else if (pPlayer->HasSpell(SPELL_TO_GADGET)) - NpcTextId = 7252; - } - break; - case NPC_KABLAM: - NpcTextId = 10365; - if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 350 && pPlayer->HasSpell(S_GOBLIN)) - { - if (!pPlayer->HasSpell(SPELL_TO_AREA52)) + break; + case NPC_KABLAM: + NpcTextId = 10365; + if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 350 && pPlayer->HasSpell(S_GOBLIN)) { - CanLearn = true; - GossipItem = GOSSIP_ITEM_KABLAM; + if (!pPlayer->HasSpell(SPELL_TO_AREA52)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_KABLAM; + } + else if (pPlayer->HasSpell(SPELL_TO_AREA52)) + NpcTextId = 0; } - else if (pPlayer->HasSpell(SPELL_TO_AREA52)) - NpcTextId = 0; - } - break; - case NPC_SMILES: - NpcTextId = 10363; - if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 350 && pPlayer->HasSpell(S_GNOMISH)) - { - if (!pPlayer->HasSpell(SPELL_TO_TOSHLEY)) + break; + case NPC_SMILES: + NpcTextId = 10363; + if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 350 && pPlayer->HasSpell(S_GNOMISH)) { - CanLearn = true; - GossipItem = GOSSIP_ITEM_SMILES; + if (!pPlayer->HasSpell(SPELL_TO_TOSHLEY)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_SMILES; + } + else if (pPlayer->HasSpell(SPELL_TO_TOSHLEY)) + NpcTextId = 0; } - else if (pPlayer->HasSpell(SPELL_TO_TOSHLEY)) - NpcTextId = 0; - } - break; + break; + } } + + if (CanLearn) + { + if (pPlayer->HasItemCount(ITEM_GOBLIN_CARD,1) || pPlayer->HasItemCount(ITEM_GNOMISH_CARD,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GossipItem, pCreature->GetEntry(), GOSSIP_ACTION_INFO_DEF+1); + } + + pPlayer->SEND_GOSSIP_MENU(NpcTextId ? NpcTextId : pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - if (CanLearn) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - if (pPlayer->HasItemCount(ITEM_GOBLIN_CARD,1) || pPlayer->HasItemCount(ITEM_GNOMISH_CARD,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GossipItem, pCreature->GetEntry(), GOSSIP_ACTION_INFO_DEF+1); - } + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->SEND_GOSSIP_MENU(NpcTextId ? NpcTextId : pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + if (uiSender != pCreature->GetEntry()) + return true; -bool GossipSelect_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - pPlayer->CLOSE_GOSSIP_MENU(); + switch(uiSender) + { + case NPC_ZAP: + pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_EVERLOOK, false); + break; + case NPC_JHORDY: + pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_GADGET, false); + break; + case NPC_KABLAM: + pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_AREA52, false); + break; + case NPC_SMILES: + pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_TOSHLEY, false); + break; + } - if (uiSender != pCreature->GetEntry()) return true; - - switch(uiSender) - { - case NPC_ZAP: - pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_EVERLOOK, false); - break; - case NPC_JHORDY: - pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_GADGET, false); - break; - case NPC_KABLAM: - pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_AREA52, false); - break; - case NPC_SMILES: - pPlayer->CastSpell(pPlayer, SPELL_LEARN_TO_TOSHLEY, false); - break; } - - return true; -} +}; /*### # start menues leatherworking ###*/ -bool GossipHello_npc_prof_leather(Player* pPlayer, Creature* pCreature) +class npc_prof_leather : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); +public: + npc_prof_leather() : CreatureScript("npc_prof_leather") { } - uint32 eCreature = pCreature->GetEntry(); - - if (pPlayer->HasSkill(SKILL_LEATHERWORKING) && pPlayer->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 250 && pPlayer->getLevel() > 49) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - switch (eCreature) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + + uint32 eCreature = pCreature->GetEntry(); + + if (pPlayer->HasSkill(SKILL_LEATHERWORKING) && pPlayer->GetBaseSkillValue(SKILL_LEATHERWORKING) >= 250 && pPlayer->getLevel() > 49) { - case 7866: //Peter Galen - case 7867: //Thorkaf Dragoneye - if (pPlayer->HasSpell(S_DRAGON)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 1); - break; - case 7868: //Sarah Tanner - case 7869: //Brumn Winterhoof - if (pPlayer->HasSpell(S_ELEMENTAL)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 2); - break; - case 7870: //Caryssia Moonhunter - case 7871: //Se'Jib - if (pPlayer->HasSpell(S_TRIBAL)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); - break; + switch (eCreature) + { + case 7866: //Peter Galen + case 7867: //Thorkaf Dragoneye + if (pPlayer->HasSpell(S_DRAGON)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 1); + break; + case 7868: //Sarah Tanner + case 7869: //Brumn Winterhoof + if (pPlayer->HasSpell(S_ELEMENTAL)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 2); + break; + case 7870: //Caryssia Moonhunter + case 7871: //Se'Jib + if (pPlayer->HasSpell(S_TRIBAL)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 3); + break; + } } - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -void SendActionMenu_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) + void SendActionMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - break; - //Unlearn Leather - case GOSSIP_ACTION_INFO_DEF + 1: - if (EquippedOk(pPlayer,S_UNLEARN_DRAGON)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); + break; + //Unlearn Leather + case GOSSIP_ACTION_INFO_DEF + 1: + if (EquippedOk(pPlayer,S_UNLEARN_DRAGON)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_DRAGON, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_DRAGON); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_DRAGON, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_DRAGON); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - if (EquippedOk(pPlayer,S_UNLEARN_ELEMENTAL)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + if (EquippedOk(pPlayer,S_UNLEARN_ELEMENTAL)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_ELEMENTAL, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ELEMENTAL); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_ELEMENTAL, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_ELEMENTAL); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - if (EquippedOk(pPlayer,S_UNLEARN_TRIBAL)) - { - if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + if (EquippedOk(pPlayer,S_UNLEARN_TRIBAL)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_TRIBAL, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_TRIBAL); - pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + if (pPlayer->GetMoney() >= DoMedUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_TRIBAL, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_TRIBAL); + pPlayer->ModifyMoney(-DoMedUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } } -} -void SendConfirmUnlearn_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendConfirmUnlearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + if (uiAction) { - case 7866: //Peter Galen - case 7867: //Thorkaf Dragoneye - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 7868: //Sarah Tanner - case 7869: //Brumn Winterhoof - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 7870: //Caryssia Moonhunter - case 7871: //Se'Jib - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 7866: //Peter Galen + case 7867: //Thorkaf Dragoneye + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_DRAGON, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 7868: //Sarah Tanner + case 7869: //Brumn Winterhoof + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_ELEMENTAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 7870: //Caryssia Moonhunter + case 7871: //Se'Jib + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_TRIBAL, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_LEATHER_SPEC, DoMedUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } } } -} -bool GossipSelect_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - case GOSSIP_SENDER_MAIN: SendActionMenu_npc_prof_leather(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn_npc_prof_leather(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu_npc_prof_leather(pPlayer, pCreature, uiAction); break; + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: SendActionMenu(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_CHECK: SendActionMenu(pPlayer, pCreature, uiAction); break; + } + return true; } - return true; -} +}; /*### # start menues tailoring @@ -1093,209 +1106,202 @@ bool HasTailorSpell(Player* pPlayer) return false; } -bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) +class npc_prof_tailor : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - - uint32 eCreature = pCreature->GetEntry(); - //TAILORING SPEC - if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 350 && pPlayer->getLevel() > 59) +public: + npc_prof_tailor() : CreatureScript("npc_prof_tailor") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestRewardStatus(10831) || pPlayer->GetQuestRewardStatus(10832) || pPlayer->GetQuestRewardStatus(10833)) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + + uint32 eCreature = pCreature->GetEntry(); + //TAILORING SPEC + if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 350 && pPlayer->getLevel() > 59) { - switch (eCreature) + if (pPlayer->GetQuestRewardStatus(10831) || pPlayer->GetQuestRewardStatus(10832) || pPlayer->GetQuestRewardStatus(10833)) { - case 22213: //Gidge Spellweaver - if (!HasTailorSpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->HasSpell(S_SPELLFIRE)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); - break; - case 22208: //Nasmara Moonsong - if (!HasTailorSpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->HasSpell(S_MOONCLOTH)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 5); - break; - case 22212: //Andrion Darkspinner - if (!HasTailorSpell(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 3); - if (pPlayer->HasSpell(S_SHADOWEAVE)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 6); - break; + switch (eCreature) + { + case 22213: //Gidge Spellweaver + if (!HasTailorSpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->HasSpell(S_SPELLFIRE)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 4); + break; + case 22208: //Nasmara Moonsong + if (!HasTailorSpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 2); + if (pPlayer->HasSpell(S_MOONCLOTH)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 5); + break; + case 22212: //Andrion Darkspinner + if (!HasTailorSpell(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_LEARN, GOSSIP_ACTION_INFO_DEF + 3); + if (pPlayer->HasSpell(S_SHADOWEAVE)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_UNLEARN, GOSSIP_ACTION_INFO_DEF + 6); + break; + } } } - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -void SendActionMenu_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) + void SendActionMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - break; - //Learn Tailor - case GOSSIP_ACTION_INFO_DEF + 1: - if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_SPELLFIRE, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_MOONCLOTH, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) - { - pPlayer->CastSpell(pPlayer, S_LEARN_SHADOWEAVE, true); - pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); - } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - //Unlearn Tailor - case GOSSIP_ACTION_INFO_DEF + 4: - if (EquippedOk(pPlayer,S_UNLEARN_SPELLFIRE)) - { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); + break; + //Learn Tailor + case GOSSIP_ACTION_INFO_DEF + 1: + if (!pPlayer->HasSpell(S_SPELLFIRE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_SPELLFIRE, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SPELLFIRE); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + pPlayer->CastSpell(pPlayer, S_LEARN_SPELLFIRE, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - if (EquippedOk(pPlayer,S_UNLEARN_MOONCLOTH)) - { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + if (!pPlayer->HasSpell(S_MOONCLOTH) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_MOONCLOTH, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_MOONCLOTH); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + pPlayer->CastSpell(pPlayer, S_LEARN_MOONCLOTH, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - if (EquippedOk(pPlayer,S_UNLEARN_SHADOWEAVE)) - { - if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + if (!pPlayer->HasSpell(S_SHADOWEAVE) && pPlayer->GetMoney() >= DoLearnCost(pPlayer)) { - pPlayer->CastSpell(pPlayer, S_UNLEARN_SHADOWEAVE, true); - ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SHADOWEAVE); - pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + pPlayer->CastSpell(pPlayer, S_LEARN_SHADOWEAVE, true); + pPlayer->ModifyMoney(-DoLearnCost(pPlayer)); } else - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); - } else - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } -} - -void SendConfirmLearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) - { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) - { - case 22213: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; - case 22208: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + //Unlearn Tailor + case GOSSIP_ACTION_INFO_DEF + 4: + if (EquippedOk(pPlayer,S_UNLEARN_SPELLFIRE)) + { + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_SPELLFIRE, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SPELLFIRE); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + } else + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); break; - case 22212: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF + 5: + if (EquippedOk(pPlayer,S_UNLEARN_MOONCLOTH)) + { + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_MOONCLOTH, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_MOONCLOTH); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + } else + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + if (EquippedOk(pPlayer,S_UNLEARN_SHADOWEAVE)) + { + if (pPlayer->GetMoney() >= DoHighUnlearnCost(pPlayer)) + { + pPlayer->CastSpell(pPlayer, S_UNLEARN_SHADOWEAVE, true); + ProfessionUnlearnSpells(pPlayer, S_UNLEARN_SHADOWEAVE); + pPlayer->ModifyMoney(-DoHighUnlearnCost(pPlayer)); + } else + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, 0, 0); + } else + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,NULL,NULL); + pPlayer->CLOSE_GOSSIP_MENU(); break; } } -} -void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) + void SendConfirmLearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - uint32 eCreature = pCreature->GetEntry(); - switch(eCreature) + if (uiAction) { - case 22213: //Gidge Spellweaver - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 22208: //Nasmara Moonsong - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case 22212: //Andrion Darkspinner - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction,BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); - //unknown textID () - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 22213: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 22208: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 22212: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } } } -} -bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) + void SendConfirmUnlearn(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - case GOSSIP_SENDER_MAIN: SendActionMenu_npc_prof_tailor(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_LEARN: SendConfirmLearn_npc_prof_tailor(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn_npc_prof_tailor(pPlayer, pCreature, uiAction); break; - case GOSSIP_SENDER_CHECK: SendActionMenu_npc_prof_tailor(pPlayer, pCreature, uiAction); break; + if (uiAction) + { + uint32 eCreature = pCreature->GetEntry(); + switch(eCreature) + { + case 22213: //Gidge Spellweaver + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SPELLFIRE, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 22208: //Nasmara Moonsong + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_MOONCLOTH, GOSSIP_SENDER_CHECK, uiAction, BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case 22212: //Andrion Darkspinner + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_UNLEARN_SHADOWEAVE, GOSSIP_SENDER_CHECK, uiAction,BOX_UNLEARN_TAILOR_SPEC, DoHighUnlearnCost(pPlayer),false); + //unknown textID () + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + } + } } - return true; -} -/*### -# start menues for GO (engineering and leatherworking) -###*/ - -/*bool GOHello_go_soothsaying_for_dummies(Player* pPlayer, GameObject* pGo) -{ - pPlayer->PlayerTalkClass->GetGossipMenu()->AddMenuItem(0,GOSSIP_LEARN_DRAGON, GOSSIP_SENDER_INFO, GOSSIP_ACTION_INFO_DEF, "", 0); - - pPlayer->SEND_GOSSIP_MENU(5584, pGo->GetGUID()); - - return true; -}*/ + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + { + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: SendActionMenu(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_LEARN: SendConfirmLearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_UNLEARN: SendConfirmUnlearn(pPlayer, pCreature, uiAction); break; + case GOSSIP_SENDER_CHECK: SendActionMenu(pPlayer, pCreature, uiAction); break; + } + return true; + } +}; /*### # @@ -1303,42 +1309,9 @@ bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 u void AddSC_npc_professions() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_prof_alchemy"; - newscript->pGossipHello = &GossipHello_npc_prof_alchemy; - newscript->pGossipSelect = &GossipSelect_npc_prof_alchemy; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_blacksmith"; - newscript->pGossipHello = &GossipHello_npc_prof_blacksmith; - newscript->pGossipSelect = &GossipSelect_npc_prof_blacksmith; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_engineering_tele_trinket"; - newscript->pGossipHello = &GossipHello_npc_engineering_tele_trinket; - newscript->pGossipSelect = &GossipSelect_npc_engineering_tele_trinket; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_leather"; - newscript->pGossipHello = &GossipHello_npc_prof_leather; - newscript->pGossipSelect = &GossipSelect_npc_prof_leather; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prof_tailor"; - newscript->pGossipHello = &GossipHello_npc_prof_tailor; - newscript->pGossipSelect = &GossipSelect_npc_prof_tailor; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "go_soothsaying_for_dummies"; - newscript->pGOHello = &GOHello_go_soothsaying_for_dummies; - //newscript->pGossipSelect = &GossipSelect_go_soothsaying_for_dummies; - newscript->RegisterSelf();*/ + new npc_prof_alchemy; + new npc_prof_blacksmith; + new npc_engineering_tele_trinket; + new npc_prof_leather; + new npc_prof_tailor; } - diff --git a/src/server/scripts/World/npc_taxi.cpp b/src/server/scripts/World/npc_taxi.cpp index 1a296735b38..3a455a79041 100644 --- a/src/server/scripts/World/npc_taxi.cpp +++ b/src/server/scripts/World/npc_taxi.cpp @@ -58,271 +58,273 @@ EndScriptData #define GOSSIP_WILLIAMKEILAR2 "Take me to Eastwall Tower." #define GOSSIP_WILLIAMKEILAR3 "Take me to Crown Guard Tower." -bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) +class npc_taxi : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_taxi() : CreatureScript("npc_taxi") { } - switch(pCreature->GetEntry()) { - case 17435: // Azuremyst Isle - Susurrus - if (pPlayer->HasItemCount(23843,1,true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - break; - case 20903: // Netherstorm - Protectorate Nether Drake - if (pPlayer->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(29778,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NETHER_DRAKE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - break; - case 18725: // Old Hillsbrad Foothills - Brazen - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRAZEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - break; - case 29154: // Stormwind City - Thargold Ironwing - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRONWING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - break; - case 19409: // Hellfire Peninsula - Wing Commander Dabir'ee - //Mission: The Murketh and Shaadraz Gateways - if (pPlayer->GetQuestStatus(10146) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - //Shatter Point - if (!pPlayer->GetQuestRewardStatus(10340)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - break; - case 20235: // Hellfire Peninsula - Gryphoneer Windbellow - //Mission: The Abyssal Shelf || Return to the Abyssal Shelf - if (pPlayer->GetQuestStatus(10163) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10346) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + switch(pCreature->GetEntry()) + { + case 17435: // Azuremyst Isle - Susurrus + if (pPlayer->HasItemCount(23843,1,true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SUSURRUS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + break; + case 20903: // Netherstorm - Protectorate Nether Drake + if (pPlayer->GetQuestStatus(10438) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(29778,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NETHER_DRAKE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + break; + case 18725: // Old Hillsbrad Foothills - Brazen + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRAZEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + break; + case 29154: // Stormwind City - Thargold Ironwing + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRONWING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + break; + case 19409: // Hellfire Peninsula - Wing Commander Dabir'ee + //Mission: The Murketh and Shaadraz Gateways + if (pPlayer->GetQuestStatus(10146) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - //Go to the Front - if (pPlayer->GetQuestStatus(10382) != QUEST_STATUS_NONE && !pPlayer->GetQuestRewardStatus(10382)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - break; - case 19401: // Hellfire Peninsula - Wing Commander Brack - //Mission: The Murketh and Shaadraz Gateways - if (pPlayer->GetQuestStatus(10129) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + //Shatter Point + if (!pPlayer->GetQuestRewardStatus(10340)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DABIREE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + break; + case 20235: // Hellfire Peninsula - Gryphoneer Windbellow + //Mission: The Abyssal Shelf || Return to the Abyssal Shelf + if (pPlayer->GetQuestStatus(10163) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10346) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - //Mission: The Abyssal Shelf || Return to the Abyssal Shelf - if (pPlayer->GetQuestStatus(10162) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10347) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + //Go to the Front + if (pPlayer->GetQuestStatus(10382) != QUEST_STATUS_NONE && !pPlayer->GetQuestRewardStatus(10382)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WINDBELLOW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + break; + case 19401: // Hellfire Peninsula - Wing Commander Brack + //Mission: The Murketh and Shaadraz Gateways + if (pPlayer->GetQuestStatus(10129) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); - //Spinebreaker Post - if (pPlayer->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(10242)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - break; - case 23413: // Blade's Edge Mountains - Skyguard Handler Irena - if (pPlayer->GetReputationRank(1031) >= REP_HONORED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRENA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - break; - case 25059: // Isle of Quel'Danas - Ayren Cloudbreaker - if (pPlayer->GetQuestStatus(11532) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11533) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + //Mission: The Abyssal Shelf || Return to the Abyssal Shelf + if (pPlayer->GetQuestStatus(10162) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10347) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - break; - case 25236: // Isle of Quel'Danas - Unrestrained Dragonhawk - if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_COMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DRAGONHAWK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - break; - case 20162: // Netherstorm - Veronia - //Behind Enemy Lines - if (pPlayer->GetQuestStatus(10652) && !pPlayer->GetQuestRewardStatus(10652)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VERONIA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); - break; - case 23415: // Terokkar Forest - Skyguard Handler Deesak - if (pPlayer->GetReputationRank(1031) >= REP_HONORED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEESAK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16); - break; - case 27575: // Dragonblight - Lord Afrasastrasz - // middle -> ground - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17); - // middle -> top - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 18); - break; - case 26443: // Dragonblight - Tariolstrasz //need to check if quests are required before gossip available (12123, 12124) - // ground -> top - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 19); - // ground -> middle - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); - break; - case 26949: // Dragonblight - Torastrasza - // top -> middle - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - // top -> ground - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - break; - case 23816: // Howling Fjord - Bat Handler Camille - if (!pPlayer->GetQuestRewardStatus(11229)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - if (pPlayer->GetQuestStatus(11170) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); - break; - case 23704: // Dustwallow Marsh - Cassa Crimsonwing - if (pPlayer->GetQuestStatus(11142) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CRIMSONWING,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+25); - break; - case 26602: - if (pCreature->isTaxi()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TAXI, GOSSIP_THRICESTAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); - if (pPlayer->GetQuestStatus(11692) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_THRICESTAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 27); - break; - case 17209: - pPlayer->SetTaxiCheater(true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 28); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 29); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 30); - break; - } + //Spinebreaker Post + if (pPlayer->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(10242)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BRACK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + break; + case 23413: // Blade's Edge Mountains - Skyguard Handler Irena + if (pPlayer->GetReputationRank(1031) >= REP_HONORED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_IRENA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + break; + case 25059: // Isle of Quel'Danas - Ayren Cloudbreaker + if (pPlayer->GetQuestStatus(11532) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11533) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CLOUDBREAKER2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + break; + case 25236: // Isle of Quel'Danas - Unrestrained Dragonhawk + if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_COMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DRAGONHAWK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + break; + case 20162: // Netherstorm - Veronia + //Behind Enemy Lines + if (pPlayer->GetQuestStatus(10652) && !pPlayer->GetQuestRewardStatus(10652)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_VERONIA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); + break; + case 23415: // Terokkar Forest - Skyguard Handler Deesak + if (pPlayer->GetReputationRank(1031) >= REP_HONORED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEESAK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16); + break; + case 27575: // Dragonblight - Lord Afrasastrasz + // middle -> ground + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17); + // middle -> top + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_AFRASASTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 18); + break; + case 26443: // Dragonblight - Tariolstrasz //need to check if quests are required before gossip available (12123, 12124) + // ground -> top + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 19); + // ground -> middle + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TARIOLSTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); + break; + case 26949: // Dragonblight - Torastrasza + // top -> middle + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + // top -> ground + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TORASTRASZA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + break; + case 23816: // Howling Fjord - Bat Handler Camille + if (!pPlayer->GetQuestRewardStatus(11229)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + if (pPlayer->GetQuestStatus(11170) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CAMILLE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); + break; + case 23704: // Dustwallow Marsh - Cassa Crimsonwing + if (pPlayer->GetQuestStatus(11142) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CRIMSONWING,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+25); + break; + case 26602: + if (pCreature->isTaxi()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TAXI, GOSSIP_THRICESTAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); + if (pPlayer->GetQuestStatus(11692) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_THRICESTAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 27); + break; + case 17209: + pPlayer->SetTaxiCheater(true); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 28); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 29); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WILLIAMKEILAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 30); + break; + } -bool GossipSelect_npc_taxi(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) { - case GOSSIP_ACTION_INFO_DEF: - //spellId is correct, however it gives flight a somewhat funny effect //TaxiPath 506. - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,32474,true); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155)) - break; - case GOSSIP_ACTION_INFO_DEF + 2: - if (!pPlayer->HasItemCount(25853,1)) { - pPlayer->SEND_GOSSIP_MENU(9780, pCreature->GetGUID()); - } else { + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + //spellId is correct, however it gives flight a somewhat funny effect //TaxiPath 506. + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,32474,true); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(627); //TaxiPath 627 (possibly 627+628(152->153->154->155)) + break; + case GOSSIP_ACTION_INFO_DEF + 2: + if (!pPlayer->HasItemCount(25853,1)) { + pPlayer->SEND_GOSSIP_MENU(9780, pCreature->GetGUID()); + } else { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(534); //TaxiPath 534 + } + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,53335,true); //TaxiPath 1041 (Stormwind Harbor) + break; + case GOSSIP_ACTION_INFO_DEF + 4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,33768,true); //TaxiPath 585 (Gateways Murket and Shaadraz) + break; + case GOSSIP_ACTION_INFO_DEF + 5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,35069,true); //TaxiPath 612 (Taxi - Hellfire Peninsula - Expedition Point to Shatter Point) + break; + case GOSSIP_ACTION_INFO_DEF + 6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,33899,true); //TaxiPath 589 (Aerial Assault Flight (Alliance)) + break; + case GOSSIP_ACTION_INFO_DEF + 7: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,35065,true); //TaxiPath 607 (Taxi - Hellfire Peninsula - Shatter Point to Beach Head) + break; + case GOSSIP_ACTION_INFO_DEF + 8: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,33659,true); //TaxiPath 584 (Gateways Murket and Shaadraz) + break; + case GOSSIP_ACTION_INFO_DEF + 9: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,33825,true); //TaxiPath 587 (Aerial Assault Flight (Horde)) + break; + case GOSSIP_ACTION_INFO_DEF + 10: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,34578,true); //TaxiPath 604 (Taxi - Reaver's Fall to Spinebreaker Ridge) + break; + case GOSSIP_ACTION_INFO_DEF + 11: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,41278,true); //TaxiPath 706 + break; + case GOSSIP_ACTION_INFO_DEF + 12: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,45071,true); //TaxiPath 779 + break; + case GOSSIP_ACTION_INFO_DEF + 13: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,45113,true); //TaxiPath 784 + break; + case GOSSIP_ACTION_INFO_DEF + 14: pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(534); //TaxiPath 534 + pPlayer->CastSpell(pPlayer,45353,true); //TaxiPath 788 + break; + case GOSSIP_ACTION_INFO_DEF + 15: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,34905,true); //TaxiPath 606 + break; + case GOSSIP_ACTION_INFO_DEF + 16: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,41279,true); //TaxiPath 705 (Taxi - Skettis to Skyguard Outpost) + break; + case GOSSIP_ACTION_INFO_DEF + 17: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(882); + break; + case GOSSIP_ACTION_INFO_DEF + 18: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(881); + break; + case GOSSIP_ACTION_INFO_DEF + 19: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(878); + break; + case GOSSIP_ACTION_INFO_DEF + 20: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(883); + break; + case GOSSIP_ACTION_INFO_DEF + 21: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(880); + break; + case GOSSIP_ACTION_INFO_DEF + 22: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(879); + break; + case GOSSIP_ACTION_INFO_DEF + 23: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,43074,true); //TaxiPath 736 + break; + case GOSSIP_ACTION_INFO_DEF + 24: + pPlayer->CLOSE_GOSSIP_MENU(); + //pPlayer->ActivateTaxiPathTo(738); + pPlayer->CastSpell(pPlayer, 43136, false); + break; + case GOSSIP_ACTION_INFO_DEF + 25: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,42295,true); + break; + case GOSSIP_ACTION_INFO_DEF + 26: + pPlayer->GetSession()->SendTaxiMenu(pCreature); + break; + case GOSSIP_ACTION_INFO_DEF + 27: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, 51446, false); + break; + case GOSSIP_ACTION_INFO_DEF + 28: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(494); + break; + case GOSSIP_ACTION_INFO_DEF + 29: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(495); + break; + case GOSSIP_ACTION_INFO_DEF + 30: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(496); + break; } - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,53335,true); //TaxiPath 1041 (Stormwind Harbor) - break; - case GOSSIP_ACTION_INFO_DEF + 4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,33768,true); //TaxiPath 585 (Gateways Murket and Shaadraz) - break; - case GOSSIP_ACTION_INFO_DEF + 5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,35069,true); //TaxiPath 612 (Taxi - Hellfire Peninsula - Expedition Point to Shatter Point) - break; - case GOSSIP_ACTION_INFO_DEF + 6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,33899,true); //TaxiPath 589 (Aerial Assault Flight (Alliance)) - break; - case GOSSIP_ACTION_INFO_DEF + 7: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,35065,true); //TaxiPath 607 (Taxi - Hellfire Peninsula - Shatter Point to Beach Head) - break; - case GOSSIP_ACTION_INFO_DEF + 8: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,33659,true); //TaxiPath 584 (Gateways Murket and Shaadraz) - break; - case GOSSIP_ACTION_INFO_DEF + 9: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,33825,true); //TaxiPath 587 (Aerial Assault Flight (Horde)) - break; - case GOSSIP_ACTION_INFO_DEF + 10: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,34578,true); //TaxiPath 604 (Taxi - Reaver's Fall to Spinebreaker Ridge) - break; - case GOSSIP_ACTION_INFO_DEF + 11: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,41278,true); //TaxiPath 706 - break; - case GOSSIP_ACTION_INFO_DEF + 12: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,45071,true); //TaxiPath 779 - break; - case GOSSIP_ACTION_INFO_DEF + 13: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,45113,true); //TaxiPath 784 - break; - case GOSSIP_ACTION_INFO_DEF + 14: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,45353,true); //TaxiPath 788 - break; - case GOSSIP_ACTION_INFO_DEF + 15: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,34905,true); //TaxiPath 606 - break; - case GOSSIP_ACTION_INFO_DEF + 16: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,41279,true); //TaxiPath 705 (Taxi - Skettis to Skyguard Outpost) - break; - case GOSSIP_ACTION_INFO_DEF + 17: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(882); - break; - case GOSSIP_ACTION_INFO_DEF + 18: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(881); - break; - case GOSSIP_ACTION_INFO_DEF + 19: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(878); - break; - case GOSSIP_ACTION_INFO_DEF + 20: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(883); - break; - case GOSSIP_ACTION_INFO_DEF + 21: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(880); - break; - case GOSSIP_ACTION_INFO_DEF + 22: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(879); - break; - case GOSSIP_ACTION_INFO_DEF + 23: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,43074,true); //TaxiPath 736 - break; - case GOSSIP_ACTION_INFO_DEF + 24: - pPlayer->CLOSE_GOSSIP_MENU(); - //pPlayer->ActivateTaxiPathTo(738); - pPlayer->CastSpell(pPlayer, 43136, false); - break; - case GOSSIP_ACTION_INFO_DEF + 25: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,42295,true); - break; - case GOSSIP_ACTION_INFO_DEF + 26: - pPlayer->GetSession()->SendTaxiMenu(pCreature); - break; - case GOSSIP_ACTION_INFO_DEF + 27: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, 51446, false); - break; - case GOSSIP_ACTION_INFO_DEF + 28: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(494); - break; - case GOSSIP_ACTION_INFO_DEF + 29: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(495); - break; - case GOSSIP_ACTION_INFO_DEF + 30: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(496); - break; - } - return true; -} + return true; + } +}; void AddSC_npc_taxi() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_taxi"; - newscript->pGossipHello = &GossipHello_npc_taxi; - newscript->pGossipSelect = &GossipSelect_npc_taxi; - newscript->RegisterSelf(); + new npc_taxi; } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 6402a9b9507..4cf7be50e20 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -105,155 +105,162 @@ SpawnAssociation m_aSpawnAssociations[] = {22126, 22122, SPAWNTYPE_ALARMBOT} //Air Force Trip Wire - Rooftop (Cenarion Expedition) }; -struct npc_air_force_botsAI : public ScriptedAI +class npc_air_force_bots : public CreatureScript { - npc_air_force_botsAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_air_force_bots() : CreatureScript("npc_air_force_bots") { } + + struct npc_air_force_botsAI : public ScriptedAI { - m_pSpawnAssoc = NULL; - m_uiSpawnedGUID = 0; + npc_air_force_botsAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pSpawnAssoc = NULL; + m_uiSpawnedGUID = 0; - // find the correct spawnhandling - static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation); + // find the correct spawnhandling + static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation); - for (uint8 i=0; i<uiEntryCount; ++i) - { - if (m_aSpawnAssociations[i].m_uiThisCreatureEntry == pCreature->GetEntry()) + for (uint8 i=0; i<uiEntryCount; ++i) { - m_pSpawnAssoc = &m_aSpawnAssociations[i]; - break; + if (m_aSpawnAssociations[i].m_uiThisCreatureEntry == pCreature->GetEntry()) + { + m_pSpawnAssoc = &m_aSpawnAssociations[i]; + break; + } } - } - if (!m_pSpawnAssoc) - sLog.outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", pCreature->GetEntry()); - else - { - CreatureInfo const* spawnedTemplate = GetCreatureTemplateStore(m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - - if (!spawnedTemplate) + if (!m_pSpawnAssoc) + sLog.outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", pCreature->GetEntry()); + else { - m_pSpawnAssoc = NULL; - sLog.outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - return; + CreatureInfo const* spawnedTemplate = GetCreatureTemplateStore(m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + + if (!spawnedTemplate) + { + m_pSpawnAssoc = NULL; + sLog.outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + return; + } } } - } - - SpawnAssociation* m_pSpawnAssoc; - uint64 m_uiSpawnedGUID; - void Reset() {} + SpawnAssociation* m_pSpawnAssoc; + uint64 m_uiSpawnedGUID; - Creature* SummonGuard() - { - Creature* pSummoned = me->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + void Reset() {} - if (pSummoned) - m_uiSpawnedGUID = pSummoned->GetGUID(); - else + Creature* SummonGuard() { - sLog.outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - m_pSpawnAssoc = NULL; - } + Creature* pSummoned = me->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); - return pSummoned; - } + if (pSummoned) + m_uiSpawnedGUID = pSummoned->GetGUID(); + else + { + sLog.outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + m_pSpawnAssoc = NULL; + } - Creature* GetSummonedGuard() - { - Creature* pCreature = Unit::GetCreature(*me, m_uiSpawnedGUID); + return pSummoned; + } - if (pCreature && pCreature->isAlive()) - return pCreature; + Creature* GetSummonedGuard() + { + Creature* pCreature = Unit::GetCreature(*me, m_uiSpawnedGUID); - return NULL; - } + if (pCreature && pCreature->isAlive()) + return pCreature; - void MoveInLineOfSight(Unit* pWho) - { - if (!m_pSpawnAssoc) - return; + return NULL; + } - if (pWho->isTargetableForAttack() && me->IsHostileTo(pWho)) + void MoveInLineOfSight(Unit* pWho) { - Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; - - // airforce guards only spawn for players - if (!pPlayerTarget) + if (!m_pSpawnAssoc) return; - Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); + if (pWho->isTargetableForAttack() && me->IsHostileTo(pWho)) + { + Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; - // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup - if (!pLastSpawnedGuard) - m_uiSpawnedGUID = 0; + // airforce guards only spawn for players + if (!pPlayerTarget) + return; - switch(m_pSpawnAssoc->m_SpawnType) - { - case SPAWNTYPE_ALARMBOT: - { - if (!pWho->IsWithinDistInMap(me, RANGE_GUARDS_MARK)) - return; + Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); - Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK); - if (pMarkAura) + // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup + if (!pLastSpawnedGuard) + m_uiSpawnedGUID = 0; + + switch(m_pSpawnAssoc->m_SpawnType) + { + case SPAWNTYPE_ALARMBOT: { - // the target wasn't able to move out of our range within 25 seconds - if (!pLastSpawnedGuard) + if (!pWho->IsWithinDistInMap(me, RANGE_GUARDS_MARK)) + return; + + Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK); + if (pMarkAura) { - pLastSpawnedGuard = SummonGuard(); + // the target wasn't able to move out of our range within 25 seconds + if (!pLastSpawnedGuard) + { + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + } + + if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT) + { + if (!pLastSpawnedGuard->getVictim()) + pLastSpawnedGuard->AI()->AttackStart(pWho); + } + } + else + { + if (!pLastSpawnedGuard) + pLastSpawnedGuard = SummonGuard(); if (!pLastSpawnedGuard) return; - } - if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT) - { - if (!pLastSpawnedGuard->getVictim()) - pLastSpawnedGuard->AI()->AttackStart(pWho); + pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); } + break; } - else + case SPAWNTYPE_TRIPWIRE_ROOFTOP: { + if (!pWho->IsWithinDistInMap(me, RANGE_TRIPWIRE)) + return; + if (!pLastSpawnedGuard) pLastSpawnedGuard = SummonGuard(); if (!pLastSpawnedGuard) return; - pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); - } - break; - } - case SPAWNTYPE_TRIPWIRE_ROOFTOP: - { - if (!pWho->IsWithinDistInMap(me, RANGE_TRIPWIRE)) - return; - - if (!pLastSpawnedGuard) - pLastSpawnedGuard = SummonGuard(); - - if (!pLastSpawnedGuard) - return; - - // ROOFTOP only triggers if the player is on the ground - if (!pPlayerTarget->IsFlying()) - { - if (!pLastSpawnedGuard->getVictim()) - pLastSpawnedGuard->AI()->AttackStart(pWho); + // ROOFTOP only triggers if the player is on the ground + if (!pPlayerTarget->IsFlying()) + { + if (!pLastSpawnedGuard->getVictim()) + pLastSpawnedGuard->AI()->AttackStart(pWho); + } + break; } - break; } } } + }; + + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_air_force_botsAI(creature); } }; -CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) -{ - return new npc_air_force_botsAI(pCreature); -} - /*###### ## npc_lunaclaw_spirit ######*/ @@ -269,24 +276,30 @@ enum #define GOSSIP_ITEM_GRANT "You have thought well, spirit. I ask you to grant me the strength of your body and the strength of your heart." -bool GossipHello_npc_lunaclaw_spirit(Player *pPlayer, Creature *pCreature) +class npc_lunaclaw_spirit : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_BODY_HEART_A) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_BODY_HEART_H) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_lunaclaw_spirit() : CreatureScript("npc_lunaclaw_spirit") { } + + bool OnGossipHello(Player *pPlayer, Creature *pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_BODY_HEART_A) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_BODY_HEART_H) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->SEND_GOSSIP_MENU(TEXT_ID_DEFAULT, pCreature->GetGUID()); - return true; -} + return true; + } -bool GossipSelect_npc_lunaclaw_spirit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->SEND_GOSSIP_MENU(TEXT_ID_PROGRESS, pCreature->GetGUID()); - pPlayer->AreaExploredOrEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_BODY_HEART_A : QUEST_BODY_HEART_H); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->SEND_GOSSIP_MENU(TEXT_ID_PROGRESS, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_BODY_HEART_A : QUEST_BODY_HEART_H); + } + return true; } - return true; -} +}; /*######## # npc_chicken_cluck @@ -299,81 +312,87 @@ bool GossipSelect_npc_lunaclaw_spirit(Player* pPlayer, Creature* pCreature, uint #define FACTION_FRIENDLY 35 #define FACTION_CHICKEN 31 -struct npc_chicken_cluckAI : public ScriptedAI +class npc_chicken_cluck : public CreatureScript { - npc_chicken_cluckAI(Creature *c) : ScriptedAI(c) {} - - uint32 ResetFlagTimer; +public: + npc_chicken_cluck() : CreatureScript("npc_chicken_cluck") { } - void Reset() + struct npc_chicken_cluckAI : public ScriptedAI { - ResetFlagTimer = 120000; - me->setFaction(FACTION_CHICKEN); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - } + npc_chicken_cluckAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) {} + uint32 ResetFlagTimer; - void UpdateAI(const uint32 diff) - { - // Reset flags after a certain time has passed so that the next player has to start the 'event' again - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) + void Reset() { - if (ResetFlagTimer <= diff) - { - EnterEvadeMode(); - return; - } else ResetFlagTimer -= diff; + ResetFlagTimer = 120000; + me->setFaction(FACTION_CHICKEN); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } - if (UpdateVictim()) - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) {} - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - switch(emote) + void UpdateAI(const uint32 diff) { - case TEXTEMOTE_CHICKEN: - if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_HELLO, me); - } - break; - case TEXTEMOTE_CHEER: - if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) + // Reset flags after a certain time has passed so that the next player has to start the 'event' again + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) + { + if (ResetFlagTimer <= diff) { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_CLUCK_TEXT, me); - } - break; + EnterEvadeMode(); + return; + } else ResetFlagTimer -= diff; + } + + if (UpdateVictim()) + DoMeleeAttackIfReady(); } - } -}; -CreatureAI* GetAI_npc_chicken_cluck(Creature* pCreature) -{ - return new npc_chicken_cluckAI(pCreature); -} + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + switch(emote) + { + case TEXTEMOTE_CHICKEN: + if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_HELLO, me); + } + break; + case TEXTEMOTE_CHEER: + if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_CLUCK_TEXT, me); + } + break; + } + } + }; -bool QuestAccept_npc_chicken_cluck(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) -{ - if (_Quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_chicken_cluckAI(creature); + } - return true; -} + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) + { + if (_Quest->GetQuestId() == QUEST_CLUCK) + CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); -bool QuestComplete_npc_chicken_cluck(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) -{ - if (_Quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); + return true; + } - return true; -} + bool OnQuestComplete(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) + { + if (_Quest->GetQuestId() == QUEST_CLUCK) + CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); + + return true; + } +}; /*###### ## npc_dancing_flames @@ -383,74 +402,82 @@ bool QuestComplete_npc_chicken_cluck(Player* /*pPlayer*/, Creature* pCreature, c #define SPELL_SEDUCTION 47057 #define SPELL_FIERY_AURA 45427 -struct npc_dancing_flamesAI : public ScriptedAI +class npc_dancing_flames : public CreatureScript { - npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {} +public: + npc_dancing_flames() : CreatureScript("npc_dancing_flames") { } - bool active; - uint32 can_iteract; - - void Reset() + struct npc_dancing_flamesAI : public ScriptedAI { - active = true; - can_iteract = 3500; - DoCast(me, SPELL_BRAZIER, true); - DoCast(me, SPELL_FIERY_AURA, false); - float x, y, z; - me->GetPosition(x,y,z); - me->Relocate(x,y,z + 0.94f); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - WorldPacket data; //send update position to client - me->BuildHeartBeatMsg(&data); - me->SendMessageToSet(&data,true); - } + npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!active) + bool active; + uint32 can_iteract; + + void Reset() { - if (can_iteract <= diff){ - active = true; - can_iteract = 3500; - me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - } else can_iteract -= diff; + active = true; + can_iteract = 3500; + DoCast(me, SPELL_BRAZIER, true); + DoCast(me, SPELL_FIERY_AURA, false); + float x, y, z; + me->GetPosition(x,y,z); + me->Relocate(x,y,z + 0.94f); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + WorldPacket data; //send update position to client + me->BuildHeartBeatMsg(&data); + me->SendMessageToSet(&data,true); } - } - void EnterCombat(Unit* /*who*/){} - - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - if (me->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && me->IsWithinDistInMap(pPlayer,30.0f)) + void UpdateAI(const uint32 diff) { - me->SetInFront(pPlayer); - active = false; + if (!active) + { + if (can_iteract <= diff) + { + active = true; + can_iteract = 3500; + me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + } else can_iteract -= diff; + } + } - WorldPacket data; - me->BuildHeartBeatMsg(&data); - me->SendMessageToSet(&data,true); - switch(emote) + void EnterCombat(Unit* /*who*/){} + + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + if (me->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && me->IsWithinDistInMap(pPlayer,30.0f)) { - case TEXTEMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; - case TEXTEMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXTEMOTE_BOW: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXTEMOTE_JOKE: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; - case TEXTEMOTE_DANCE: + me->SetInFront(pPlayer); + active = false; + + WorldPacket data; + me->BuildHeartBeatMsg(&data); + me->SendMessageToSet(&data,true); + switch(emote) { - if (!pPlayer->HasAura(SPELL_SEDUCTION)) - DoCast(pPlayer, SPELL_SEDUCTION, true); + case TEXTEMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; + case TEXTEMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case TEXTEMOTE_BOW: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; + case TEXTEMOTE_JOKE: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; + case TEXTEMOTE_DANCE: + { + if (!pPlayer->HasAura(SPELL_SEDUCTION)) + DoCast(pPlayer, SPELL_SEDUCTION, true); + } + break; } - break; } } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_dancing_flamesAI(creature); } }; -CreatureAI* GetAI_npc_dancing_flames(Creature* pCreature) -{ - return new npc_dancing_flamesAI(pCreature); -} /*###### ## Triage quest @@ -519,251 +546,268 @@ const uint32 HordeSoldierId[3] = /*###### ## npc_doctor (handles both Gustaf Vanhowzen and Gregory Victor) ######*/ - -struct npc_doctorAI : public ScriptedAI +class npc_doctor : public CreatureScript { - npc_doctorAI(Creature *c) : ScriptedAI(c) {} +public: + npc_doctor() : CreatureScript("npc_doctor") {} - uint64 PlayerGUID; + struct npc_doctorAI : public ScriptedAI + { + npc_doctorAI(Creature *c) : ScriptedAI(c) {} - uint32 SummonPatient_Timer; - uint32 SummonPatientCount; - uint32 PatientDiedCount; - uint32 PatientSavedCount; + uint64 PlayerGUID; - bool Event; + uint32 SummonPatient_Timer; + uint32 SummonPatientCount; + uint32 PatientDiedCount; + uint32 PatientSavedCount; - std::list<uint64> Patients; - std::vector<Location*> Coordinates; + bool Event; - void Reset() - { - PlayerGUID = 0; + std::list<uint64> Patients; + std::vector<Location*> Coordinates; - SummonPatient_Timer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; + void Reset() + { + PlayerGUID = 0; - Patients.clear(); - Coordinates.clear(); + SummonPatient_Timer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; - Event = false; + Patients.clear(); + Coordinates.clear(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } + Event = false; - void BeginEvent(Player* pPlayer); - void PatientDied(Location* Point); - void PatientSaved(Creature* soldier, Player* pPlayer, Location* Point); - void UpdateAI(const uint32 diff); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void EnterCombat(Unit* /*who*/){} -}; + void BeginEvent(Player* pPlayer) + { + PlayerGUID = pPlayer->GetGUID(); -/*##### -## npc_injured_patient (handles all the patients, no matter Horde or Alliance) -#####*/ + SummonPatient_Timer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; -struct npc_injured_patientAI : public ScriptedAI -{ - npc_injured_patientAI(Creature *c) : ScriptedAI(c) {} + switch(me->GetEntry()) + { + case DOCTOR_ALLIANCE: + for (uint8 i = 0; i < ALLIANCE_COORDS; ++i) + Coordinates.push_back(&AllianceCoords[i]); + break; + case DOCTOR_HORDE: + for (uint8 i = 0; i < HORDE_COORDS; ++i) + Coordinates.push_back(&HordeCoords[i]); + break; + } - uint64 Doctorguid; - Location* Coord; + Event = true; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - void Reset() - { - Doctorguid = 0; - Coord = NULL; + void PatientDied(Location* Point) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) + { + ++PatientDiedCount; - //no select - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (PatientDiedCount > 5 && Event) + { + if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(6624); + else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(6622); - //no regen health - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + Reset(); + return; + } - //to make them lay with face down - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + Coordinates.push_back(Point); + } + else + // If no player or player abandon quest in progress + Reset(); + } - uint32 mobId = me->GetEntry(); + void PatientSaved(Creature* soldier, Player* pPlayer, Location* Point) + { + if (pPlayer && PlayerGUID == pPlayer->GetGUID()) + { + if ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) + { + ++PatientSavedCount; - switch (mobId) - { //lower max health - case 12923: - case 12938: //Injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.75)); - break; - case 12924: - case 12936: //Badly injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.50)); - break; - case 12925: - case 12937: //Critically injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.25)); - break; + if (PatientSavedCount == 15) + { + if (!Patients.empty()) + { + std::list<uint64>::const_iterator itr; + for (itr = Patients.begin(); itr != Patients.end(); ++itr) + { + if (Creature* Patient = Unit::GetCreature((*me), *itr)) + Patient->setDeathState(JUST_DIED); + } + } + + if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(6624); + else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(6622); + + Reset(); + return; + } + + Coordinates.push_back(Point); + } + } } + + void UpdateAI(const uint32 diff); + + void EnterCombat(Unit* /*who*/){} + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) + { + if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) + CAST_AI(npc_doctorAI, pCreature->AI())->BeginEvent(pPlayer); + + return true; } - void EnterCombat(Unit* /*who*/){} + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_doctorAI(creature); + } +}; + +/*##### +## npc_injured_patient (handles all the patients, no matter Horde or Alliance) +#####*/ - void SpellHit(Unit *caster, const SpellEntry *spell) +class npc_injured_patient : public CreatureScript +{ +public: + npc_injured_patient() : CreatureScript("npc_injured_patient") { } + + struct npc_injured_patientAI : public ScriptedAI { - if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804) - { - if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) - if (Doctorguid) - if (Creature* Doctor = Unit::GetCreature(*me, Doctorguid)) - CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); + npc_injured_patientAI(Creature *c) : ScriptedAI(c) {} - //make not selectable - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uint64 Doctorguid; + Location* Coord; + + void Reset() + { + Doctorguid = 0; + Coord = NULL; - //regen health - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + //no select + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //stand up - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + //no regen health + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - DoScriptText(RAND(SAY_DOC1,SAY_DOC2,SAY_DOC3), me); + //to make them lay with face down + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); uint32 mobId = me->GetEntry(); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); switch (mobId) - { + { //lower max health case 12923: + case 12938: //Injured Soldier + me->SetHealth(uint32(me->GetMaxHealth()*.75)); + break; case 12924: - case 12925: - me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); + case 12936: //Badly injured Soldier + me->SetHealth(uint32(me->GetMaxHealth()*.50)); break; - case 12936: - case 12937: - case 12938: - me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); + case 12925: + case 12937: //Critically injured Soldier + me->SetHealth(uint32(me->GetMaxHealth()*.25)); break; } } - } - void UpdateAI(const uint32 /*diff*/) - { - //lower HP on every world tick makes it a useful counter, not officlone though - if (me->isAlive() && me->GetHealth() > 6) - { - me->SetHealth(uint32(me->GetHealth()-5)); - } + void EnterCombat(Unit* /*who*/){} - if (me->isAlive() && me->GetHealth() <= 6) + void SpellHit(Unit *caster, const SpellEntry *spell) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setDeathState(JUST_DIED); - me->SetFlag(UNIT_DYNAMIC_FLAGS, 32); - - if (Doctorguid) + if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804) { - if (Creature* Doctor = Unit::GetCreature((*me), Doctorguid)) - CAST_AI(npc_doctorAI, Doctor->AI())->PatientDied(Coord); - } - } - } -}; + if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) + if (Doctorguid) + if (Creature* Doctor = Unit::GetCreature(*me, Doctorguid)) + CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); -CreatureAI* GetAI_npc_injured_patient(Creature* pCreature) -{ - return new npc_injured_patientAI (pCreature); -} + //make not selectable + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -/* -npc_doctor (continue) -*/ + //regen health + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); -void npc_doctorAI::BeginEvent(Player* pPlayer) -{ - PlayerGUID = pPlayer->GetGUID(); + //stand up + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - SummonPatient_Timer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; + DoScriptText(RAND(SAY_DOC1,SAY_DOC2,SAY_DOC3), me); - switch(me->GetEntry()) - { - case DOCTOR_ALLIANCE: - for (uint8 i = 0; i < ALLIANCE_COORDS; ++i) - Coordinates.push_back(&AllianceCoords[i]); - break; - case DOCTOR_HORDE: - for (uint8 i = 0; i < HORDE_COORDS; ++i) - Coordinates.push_back(&HordeCoords[i]); - break; - } + uint32 mobId = me->GetEntry(); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Event = true; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -} - -void npc_doctorAI::PatientDied(Location* Point) -{ - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) - { - ++PatientDiedCount; - - if (PatientDiedCount > 5 && Event) - { - if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(6624); - else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(6622); - - Reset(); - return; + switch (mobId) + { + case 12923: + case 12924: + case 12925: + me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); + break; + case 12936: + case 12937: + case 12938: + me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); + break; + } + } } - Coordinates.push_back(Point); - } - else - // If no player or player abandon quest in progress - Reset(); -} - -void npc_doctorAI::PatientSaved(Creature* /*soldier*/, Player* pPlayer, Location* Point) -{ - if (pPlayer && PlayerGUID == pPlayer->GetGUID()) - { - if ((pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) + void UpdateAI(const uint32 /*diff*/) { - ++PatientSavedCount; + //lower HP on every world tick makes it a useful counter, not officlone though + if (me->isAlive() && me->GetHealth() > 6) + { + me->SetHealth(uint32(me->GetHealth()-5)); + } - if (PatientSavedCount == 15) + if (me->isAlive() && me->GetHealth() <= 6) { - if (!Patients.empty()) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setDeathState(JUST_DIED); + me->SetFlag(UNIT_DYNAMIC_FLAGS, 32); + + if (Doctorguid) { - std::list<uint64>::const_iterator itr; - for (itr = Patients.begin(); itr != Patients.end(); ++itr) - { - if (Creature* Patient = Unit::GetCreature((*me), *itr)) - Patient->setDeathState(JUST_DIED); - } + if (Creature* Doctor = Unit::GetCreature((*me), Doctorguid)) + CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientDied(Coord); } - - if (pPlayer->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(6624); - else if (pPlayer->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(6622); - - Reset(); - return; } - - Coordinates.push_back(Point); } + }; + + CreatureAI *OnGetAI(Creature *creature) + { + return new npc_injured_patientAI(creature); } -} +}; -void npc_doctorAI::UpdateAI(const uint32 diff) +void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff) { if (Event && SummonPatientCount >= 20) { @@ -778,7 +822,7 @@ void npc_doctorAI::UpdateAI(const uint32 diff) Creature* Patient = NULL; Location* Point = NULL; - if (Coordinates.empty()) + if (Coordinates.empty()) return; std::vector<Location*>::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); @@ -786,11 +830,11 @@ void npc_doctorAI::UpdateAI(const uint32 diff) switch(me->GetEntry()) { - case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; - case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; - default: - sLog.outError("TSCR: Invalid entry for Triage doctor. Please check your database"); - return; + case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; + case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; + default: + sLog.outError("TSCR: Invalid entry for Triage doctor. Please check your database"); + return; } Point = *itr; @@ -803,10 +847,10 @@ void npc_doctorAI::UpdateAI(const uint32 diff) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); Patients.push_back(Patient->GetGUID()); - CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID(); + CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID(); if (Point) - CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point; + CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point; Coordinates.erase(itr); } @@ -816,19 +860,6 @@ void npc_doctorAI::UpdateAI(const uint32 diff) } } -bool QuestAccept_npc_doctor(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) - CAST_AI(npc_doctorAI, pCreature->AI())->BeginEvent(pPlayer); - - return true; -} - -CreatureAI* GetAI_npc_doctor(Creature* pCreature) -{ - return new npc_doctorAI (pCreature); -} - /*###### ## npc_garments_of_quests ######*/ @@ -866,219 +897,231 @@ enum eGarments SAY_SHAYA_GOODBYE = -1000174, //signed for 21469 }; -struct npc_garments_of_questsAI : public npc_escortAI +class npc_garments_of_quests : public CreatureScript { - npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();} +public: + npc_garments_of_quests() : CreatureScript("npc_garments_of_quests") { } + + struct npc_garments_of_questsAI : public npc_escortAI + { + npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();} - uint64 caster; + uint64 caster; - bool bIsHealed; - bool bCanRun; + bool bIsHealed; + bool bCanRun; - uint32 RunAwayTimer; + uint32 RunAwayTimer; - void Reset() - { - caster = 0; + void Reset() + { + caster = 0; - bIsHealed = false; - bCanRun = false; + bIsHealed = false; + bCanRun = false; - RunAwayTimer = 5000; + RunAwayTimer = 5000; - me->SetStandState(UNIT_STAND_STATE_KNEEL); - //expect database to have RegenHealth=0 - me->SetHealth(int(me->GetMaxHealth()*0.7)); - } + me->SetStandState(UNIT_STAND_STATE_KNEEL); + //expect database to have RegenHealth=0 + me->SetHealth(int(me->GetMaxHealth()*0.7)); + } - void EnterCombat(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} - void SpellHit(Unit* pCaster, const SpellEntry *Spell) - { - if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) + void SpellHit(Unit* pCaster, const SpellEntry *Spell) { - //not while in combat - if (me->isInCombat()) - return; + if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) + { + //not while in combat + if (me->isInCombat()) + return; - //nothing to be done now - if (bIsHealed && bCanRun) - return; + //nothing to be done now + if (bIsHealed && bCanRun) + return; - if (pCaster->GetTypeId() == TYPEID_PLAYER) - { - switch(me->GetEntry()) + if (pCaster->GetTypeId() == TYPEID_PLAYER) { - case ENTRY_SHAYA: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE) - { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) - { - DoScriptText(SAY_SHAYA_THANKS,me,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,me,pCaster); - bIsHealed = true; - } - } - break; - case ENTRY_ROBERTS: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE) - { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) - { - DoScriptText(SAY_ROBERTS_THANKS,me,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + switch(me->GetEntry()) + { + case ENTRY_SHAYA: + if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE) { - caster = pCaster->GetGUID(); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,me,pCaster); - bIsHealed = true; + if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + { + DoScriptText(SAY_SHAYA_THANKS,me,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); + bIsHealed = true; + } } - } - break; - case ENTRY_DOLF: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE) - { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + break; + case ENTRY_ROBERTS: + if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE) { - DoScriptText(SAY_DOLF_THANKS,me,pCaster); - bCanRun = true; + if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + { + DoScriptText(SAY_ROBERTS_THANKS,me,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); + bIsHealed = true; + } } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + break; + case ENTRY_DOLF: + if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE) { - caster = pCaster->GetGUID(); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,me,pCaster); - bIsHealed = true; + if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + { + DoScriptText(SAY_DOLF_THANKS,me,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); + bIsHealed = true; + } } - } - break; - case ENTRY_KORJA: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE) - { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + break; + case ENTRY_KORJA: + if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE) { - DoScriptText(SAY_KORJA_THANKS,me,pCaster); - bCanRun = true; + if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + { + DoScriptText(SAY_KORJA_THANKS,me,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); + bIsHealed = true; + } } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + break; + case ENTRY_DG_KEL: + if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE) { - caster = pCaster->GetGUID(); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,me,pCaster); - bIsHealed = true; + if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + { + DoScriptText(SAY_DG_KEL_THANKS,me,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); + bIsHealed = true; + } } - } - break; - case ENTRY_DG_KEL: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE) - { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) - { - DoScriptText(SAY_DG_KEL_THANKS,me,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,me,pCaster); - bIsHealed = true; - } - } - break; - } + break; + } - //give quest credit, not expect any special quest objectives - if (bCanRun) - CAST_PLR(pCaster)->TalkedToCreature(me->GetEntry(),me->GetGUID()); + //give quest credit, not expect any special quest objectives + if (bCanRun) + CAST_PLR(pCaster)->TalkedToCreature(me->GetEntry(),me->GetGUID()); + } } } - } - void WaypointReached(uint32 /*uiPoint*/) - { - } + void WaypointReached(uint32 /*uiPoint*/) + { + } - void UpdateAI(const uint32 diff) - { - if (bCanRun && !me->isInCombat()) + void UpdateAI(const uint32 diff) { - if (RunAwayTimer <= diff) + if (bCanRun && !me->isInCombat()) { - if (Unit *pUnit = Unit::GetUnit(*me,caster)) + if (RunAwayTimer <= diff) { - switch(me->GetEntry()) + if (Unit *pUnit = Unit::GetUnit(*me,caster)) { - case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,me,pUnit); break; - case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,me,pUnit); break; - case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,me,pUnit); break; - case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,me,pUnit); break; - case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,me,pUnit); break; + switch(me->GetEntry()) + { + case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,me,pUnit); break; + case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,me,pUnit); break; + case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,me,pUnit); break; + case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,me,pUnit); break; + case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,me,pUnit); break; + } + + Start(false,true,true); } + else + EnterEvadeMode(); //something went wrong - Start(false,true,true); - } - else - EnterEvadeMode(); //something went wrong + RunAwayTimer = 30000; + } else RunAwayTimer -= diff; + } - RunAwayTimer = 30000; - } else RunAwayTimer -= diff; + npc_escortAI::UpdateAI(diff); } + }; - npc_escortAI::UpdateAI(diff); + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_garments_of_questsAI(creature); } }; -CreatureAI* GetAI_npc_garments_of_quests(Creature* pCreature) -{ - return new npc_garments_of_questsAI(pCreature); -} - /*###### ## npc_guardian ######*/ #define SPELL_DEATHTOUCH 5 -struct npc_guardianAI : public ScriptedAI +class npc_guardian : public CreatureScript { - npc_guardianAI(Creature *c) : ScriptedAI(c) {} +public: + npc_guardian() : CreatureScript("npc_guardian") { } - void Reset() + struct npc_guardianAI : public ScriptedAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + npc_guardianAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + } - if (me->isAttackReady()) + void UpdateAI(const uint32 /*diff*/) { - DoCast(me->getVictim(), SPELL_DEATHTOUCH, true); - me->resetAttackTimer(); + if (!UpdateVictim()) + return; + + if (me->isAttackReady()) + { + DoCast(me->getVictim(), SPELL_DEATHTOUCH, true); + me->resetAttackTimer(); + } } + }; + + CreatureAI *OnGetAI(Creature *creature) + { + return new npc_guardianAI(creature); } }; -CreatureAI* GetAI_npc_guardian(Creature* pCreature) -{ - return new npc_guardianAI (pCreature); -} - /*###### ## npc_kingdom_of_dalaran_quests ######*/ @@ -1094,116 +1137,127 @@ enum eKingdomDalaran #define GOSSIP_ITEM_TELEPORT_TO "I am ready to be teleported to Dalaran." -bool GossipHello_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* pCreature) +class npc_kingdom_of_dalaran_quests : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_kingdom_of_dalaran_quests() : CreatureScript("npc_kingdom_of_dalaran_quests") { } + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->HasItemCount(ITEM_KT_SIGNET,1) && (!pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) || - !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->HasItemCount(ITEM_KT_SIGNET,1) && (!pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) || + !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !pPlayer->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_kingdom_of_dalaran_quests(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,SPELL_TELEPORT_DALARAN,false); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,SPELL_TELEPORT_DALARAN,false); + } + return true; } - return true; -} +}; /*###### ## npc_mount_vendor ######*/ -bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) +class npc_mount_vendor : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - bool canBuy; - canBuy = false; - uint32 vendor = pCreature->GetEntry(); - uint8 race = pPlayer->getRace(); +public: + npc_mount_vendor() : CreatureScript("npc_mount_vendor") { } - switch (vendor) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case 384: //Katie Hunter - case 1460: //Unger Statforth - case 2357: //Merideth Carlson - case 4885: //Gregor MacVince - if (pPlayer->GetReputationRank(72) != REP_EXALTED && race != RACE_HUMAN) - pPlayer->SEND_GOSSIP_MENU(5855, pCreature->GetGUID()); - else canBuy = true; - break; - case 1261: //Veron Amberstill - if (pPlayer->GetReputationRank(47) != REP_EXALTED && race != RACE_DWARF) - pPlayer->SEND_GOSSIP_MENU(5856, pCreature->GetGUID()); - else canBuy = true; - break; - case 3362: //Ogunaro Wolfrunner - if (pPlayer->GetReputationRank(76) != REP_EXALTED && race != RACE_ORC) - pPlayer->SEND_GOSSIP_MENU(5841, pCreature->GetGUID()); - else canBuy = true; - break; - case 3685: //Harb Clawhoof - if (pPlayer->GetReputationRank(81) != REP_EXALTED && race != RACE_TAUREN) - pPlayer->SEND_GOSSIP_MENU(5843, pCreature->GetGUID()); - else canBuy = true; - break; - case 4730: //Lelanai - if (pPlayer->GetReputationRank(69) != REP_EXALTED && race != RACE_NIGHTELF) - pPlayer->SEND_GOSSIP_MENU(5844, pCreature->GetGUID()); - else canBuy = true; - break; - case 4731: //Zachariah Post - if (pPlayer->GetReputationRank(68) != REP_EXALTED && race != RACE_UNDEAD_PLAYER) - pPlayer->SEND_GOSSIP_MENU(5840, pCreature->GetGUID()); - else canBuy = true; - break; - case 7952: //Zjolnir - if (pPlayer->GetReputationRank(530) != REP_EXALTED && race != RACE_TROLL) - pPlayer->SEND_GOSSIP_MENU(5842, pCreature->GetGUID()); - else canBuy = true; - break; - case 7955: //Milli Featherwhistle - if (pPlayer->GetReputationRank(54) != REP_EXALTED && race != RACE_GNOME) - pPlayer->SEND_GOSSIP_MENU(5857, pCreature->GetGUID()); - else canBuy = true; - break; - case 16264: //Winaestra - if (pPlayer->GetReputationRank(911) != REP_EXALTED && race != RACE_BLOODELF) - pPlayer->SEND_GOSSIP_MENU(10305, pCreature->GetGUID()); - else canBuy = true; - break; - case 17584: //Torallius the Pack Handler - if (pPlayer->GetReputationRank(930) != REP_EXALTED && race != RACE_DRAENEI) - pPlayer->SEND_GOSSIP_MENU(10239, pCreature->GetGUID()); - else canBuy = true; - break; - } + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (canBuy) - { - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool canBuy; + canBuy = false; + uint32 vendor = pCreature->GetEntry(); + uint8 race = pPlayer->getRace(); + + switch (vendor) + { + case 384: //Katie Hunter + case 1460: //Unger Statforth + case 2357: //Merideth Carlson + case 4885: //Gregor MacVince + if (pPlayer->GetReputationRank(72) != REP_EXALTED && race != RACE_HUMAN) + pPlayer->SEND_GOSSIP_MENU(5855, pCreature->GetGUID()); + else canBuy = true; + break; + case 1261: //Veron Amberstill + if (pPlayer->GetReputationRank(47) != REP_EXALTED && race != RACE_DWARF) + pPlayer->SEND_GOSSIP_MENU(5856, pCreature->GetGUID()); + else canBuy = true; + break; + case 3362: //Ogunaro Wolfrunner + if (pPlayer->GetReputationRank(76) != REP_EXALTED && race != RACE_ORC) + pPlayer->SEND_GOSSIP_MENU(5841, pCreature->GetGUID()); + else canBuy = true; + break; + case 3685: //Harb Clawhoof + if (pPlayer->GetReputationRank(81) != REP_EXALTED && race != RACE_TAUREN) + pPlayer->SEND_GOSSIP_MENU(5843, pCreature->GetGUID()); + else canBuy = true; + break; + case 4730: //Lelanai + if (pPlayer->GetReputationRank(69) != REP_EXALTED && race != RACE_NIGHTELF) + pPlayer->SEND_GOSSIP_MENU(5844, pCreature->GetGUID()); + else canBuy = true; + break; + case 4731: //Zachariah Post + if (pPlayer->GetReputationRank(68) != REP_EXALTED && race != RACE_UNDEAD_PLAYER) + pPlayer->SEND_GOSSIP_MENU(5840, pCreature->GetGUID()); + else canBuy = true; + break; + case 7952: //Zjolnir + if (pPlayer->GetReputationRank(530) != REP_EXALTED && race != RACE_TROLL) + pPlayer->SEND_GOSSIP_MENU(5842, pCreature->GetGUID()); + else canBuy = true; + break; + case 7955: //Milli Featherwhistle + if (pPlayer->GetReputationRank(54) != REP_EXALTED && race != RACE_GNOME) + pPlayer->SEND_GOSSIP_MENU(5857, pCreature->GetGUID()); + else canBuy = true; + break; + case 16264: //Winaestra + if (pPlayer->GetReputationRank(911) != REP_EXALTED && race != RACE_BLOODELF) + pPlayer->SEND_GOSSIP_MENU(10305, pCreature->GetGUID()); + else canBuy = true; + break; + case 17584: //Torallius the Pack Handler + if (pPlayer->GetReputationRank(930) != REP_EXALTED && race != RACE_DRAENEI) + pPlayer->SEND_GOSSIP_MENU(10239, pCreature->GetGUID()); + else canBuy = true; + break; + } + + if (canBuy) + { + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + return true; } - return true; -} -bool GossipSelect_npc_mount_vendor(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} + return true; + } +}; /*###### ## npc_rogue_trainer @@ -1213,71 +1267,77 @@ bool GossipSelect_npc_mount_vendor(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_HELLO_ROGUE2 "<Take the letter>" #define GOSSIP_HELLO_ROGUE3 "Purchase a Dual Talent Specialization." -bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) +class npc_rogue_trainer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rogue_trainer() : CreatureScript("npc_rogue_trainer") { } - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE1, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_UNLEARNTALENTS); + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - if (!(pPlayer->GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE3, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_LEARNDUALSPEC); + if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE1, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_UNLEARNTALENTS); - if (pPlayer->getClass() == CLASS_ROGUE && pPlayer->getLevel() >= 24 && !pPlayer->HasItemCount(17126,1) && !pPlayer->GetQuestRewardStatus(6681)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); - } else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (!(pPlayer->GetSpecsCount() == 1 && pCreature->isCanTrainingAndResetTalentsOf(pPlayer) && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL)))) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_HELLO_ROGUE3, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_LEARNDUALSPEC); - return true; -} + if (pPlayer->getClass() == CLASS_ROGUE && pPlayer->getLevel() >= 24 && !pPlayer->HasItemCount(17126,1) && !pPlayer->GetQuestRewardStatus(6681)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); + } else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + return true; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,21100,false); - break; - case GOSSIP_ACTION_TRAIN: - pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); - break; - case GOSSIP_OPTION_UNLEARNTALENTS: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->SendTalentWipeConfirm(pCreature->GetGUID()); - break; - case GOSSIP_OPTION_LEARNDUALSPEC: - if (pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) - { - if (pPlayer->GetMoney() < 10000000) - { - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); - pPlayer->PlayerTalkClass->CloseGossip(); - break; - } - else + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,21100,false); + break; + case GOSSIP_ACTION_TRAIN: + pPlayer->SEND_TRAINERLIST(pCreature->GetGUID()); + break; + case GOSSIP_OPTION_UNLEARNTALENTS: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->SendTalentWipeConfirm(pCreature->GetGUID()); + break; + case GOSSIP_OPTION_LEARNDUALSPEC: + if (pPlayer->GetSpecsCount() == 1 && !(pPlayer->getLevel() < sWorld.getConfig(CONFIG_MIN_DUALSPEC_LEVEL))) { - pPlayer->ModifyMoney(-10000000); + if (pPlayer->GetMoney() < 10000000) + { + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); + pPlayer->PlayerTalkClass->CloseGossip(); + break; + } + else + { + pPlayer->ModifyMoney(-10000000); - // Cast spells that teach dual spec - // Both are also ImplicitTarget self and must be cast by player - pPlayer->CastSpell(pPlayer,63680,true,NULL,NULL,pPlayer->GetGUID()); - pPlayer->CastSpell(pPlayer,63624,true,NULL,NULL,pPlayer->GetGUID()); + // Cast spells that teach dual spec + // Both are also ImplicitTarget self and must be cast by player + pPlayer->CastSpell(pPlayer,63680,true,NULL,NULL,pPlayer->GetGUID()); + pPlayer->CastSpell(pPlayer,63624,true,NULL,NULL,pPlayer->GetGUID()); - // Should show another Gossip text with "Congratulations..." - pPlayer->PlayerTalkClass->CloseGossip(); + // Should show another Gossip text with "Congratulations..." + pPlayer->PlayerTalkClass->CloseGossip(); + } } - } - break; + break; + } + return true; } - return true; -} +}; /*###### ## npc_sayge @@ -1312,247 +1372,276 @@ bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_SENDACTION_SAYGE16 "Let the knight take credit" #define GOSSIP_SENDACTION_SAYGE17 "Thanks" -bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) +class npc_sayge : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->HasSpellCooldown(SPELL_INT) || - pPlayer->HasSpellCooldown(SPELL_ARM) || - pPlayer->HasSpellCooldown(SPELL_DMG) || - pPlayer->HasSpellCooldown(SPELL_RES) || - pPlayer->HasSpellCooldown(SPELL_STR) || - pPlayer->HasSpellCooldown(SPELL_AGI) || - pPlayer->HasSpellCooldown(SPELL_STM) || - pPlayer->HasSpellCooldown(SPELL_SPI)) - pPlayer->SEND_GOSSIP_MENU(7393, pCreature->GetGUID()); - else +public: + npc_sayge() : CreatureScript("npc_sayge") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(7339, pCreature->GetGUID()); - } + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - return true; -} + if (pPlayer->HasSpellCooldown(SPELL_INT) || + pPlayer->HasSpellCooldown(SPELL_ARM) || + pPlayer->HasSpellCooldown(SPELL_DMG) || + pPlayer->HasSpellCooldown(SPELL_RES) || + pPlayer->HasSpellCooldown(SPELL_STR) || + pPlayer->HasSpellCooldown(SPELL_AGI) || + pPlayer->HasSpellCooldown(SPELL_STM) || + pPlayer->HasSpellCooldown(SPELL_SPI)) + pPlayer->SEND_GOSSIP_MENU(7393, pCreature->GetGUID()); + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(7339, pCreature->GetGUID()); + } -void SendAction_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) + return true; + } + + void SendAction(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(7340, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(7341, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(7361, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN+8, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(7362, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(7363, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(7364, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pCreature->CastSpell(pPlayer, SPELL_FORTUNE, false); - pPlayer->SEND_GOSSIP_MENU(7365, pCreature->GetGUID()); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(7340, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(7341, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(7361, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN+8, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(7362, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(7363, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(7364, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pCreature->CastSpell(pPlayer, SPELL_FORTUNE, false); + pPlayer->SEND_GOSSIP_MENU(7365, pCreature->GetGUID()); + break; + } } -} -bool GossipSelect_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - case GOSSIP_SENDER_MAIN: - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+1: - pCreature->CastSpell(pPlayer, SPELL_DMG, false); - pPlayer->AddSpellCooldown(SPELL_DMG,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+2: - pCreature->CastSpell(pPlayer, SPELL_RES, false); - pPlayer->AddSpellCooldown(SPELL_RES,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+3: - pCreature->CastSpell(pPlayer, SPELL_ARM, false); - pPlayer->AddSpellCooldown(SPELL_ARM,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+4: - pCreature->CastSpell(pPlayer, SPELL_SPI, false); - pPlayer->AddSpellCooldown(SPELL_SPI,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+5: - pCreature->CastSpell(pPlayer, SPELL_INT, false); - pPlayer->AddSpellCooldown(SPELL_INT,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+6: - pCreature->CastSpell(pPlayer, SPELL_STM, false); - pPlayer->AddSpellCooldown(SPELL_STM,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+7: - pCreature->CastSpell(pPlayer, SPELL_STR, false); - pPlayer->AddSpellCooldown(SPELL_STR,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; - case GOSSIP_SENDER_MAIN+8: - pCreature->CastSpell(pPlayer, SPELL_AGI, false); - pPlayer->AddSpellCooldown(SPELL_AGI,0,time(NULL) + 7200); - SendAction_npc_sayge(pPlayer, pCreature, uiAction); - break; + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+1: + pCreature->CastSpell(pPlayer, SPELL_DMG, false); + pPlayer->AddSpellCooldown(SPELL_DMG,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+2: + pCreature->CastSpell(pPlayer, SPELL_RES, false); + pPlayer->AddSpellCooldown(SPELL_RES,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+3: + pCreature->CastSpell(pPlayer, SPELL_ARM, false); + pPlayer->AddSpellCooldown(SPELL_ARM,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+4: + pCreature->CastSpell(pPlayer, SPELL_SPI, false); + pPlayer->AddSpellCooldown(SPELL_SPI,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+5: + pCreature->CastSpell(pPlayer, SPELL_INT, false); + pPlayer->AddSpellCooldown(SPELL_INT,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+6: + pCreature->CastSpell(pPlayer, SPELL_STM, false); + pPlayer->AddSpellCooldown(SPELL_STM,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+7: + pCreature->CastSpell(pPlayer, SPELL_STR, false); + pPlayer->AddSpellCooldown(SPELL_STR,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + case GOSSIP_SENDER_MAIN+8: + pCreature->CastSpell(pPlayer, SPELL_AGI, false); + pPlayer->AddSpellCooldown(SPELL_AGI,0,time(NULL) + 7200); + SendAction(pPlayer, pCreature, uiAction); + break; + } + return true; } - return true; -} +}; -struct npc_steam_tonkAI : public ScriptedAI +class npc_steam_tonk : public CreatureScript { - npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {} +public: + npc_steam_tonk() : CreatureScript("npc_steam_tonk") { } - void Reset() {} - void EnterCombat(Unit * /*who*/) {} - - void OnPossess(bool apply) + struct npc_steam_tonkAI : public ScriptedAI { - if (apply) + npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit * /*who*/) {} + + void OnPossess(bool apply) { - // Initialize the action bar without the melee attack command - me->InitCharmInfo(); - me->GetCharmInfo()->InitEmptyActionBar(false); + if (apply) + { + // Initialize the action bar without the melee attack command + me->InitCharmInfo(); + me->GetCharmInfo()->InitEmptyActionBar(false); - me->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); + } + else + me->SetReactState(REACT_AGGRESSIVE); } - else - me->SetReactState(REACT_AGGRESSIVE); - } -}; + }; -CreatureAI* GetAI_npc_steam_tonk(Creature* pCreature) -{ - return new npc_steam_tonkAI(pCreature); -} + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_steam_tonkAI(creature); + } +}; #define SPELL_TONK_MINE_DETONATE 25099 -struct npc_tonk_mineAI : public ScriptedAI +class npc_tonk_mine : public CreatureScript { - npc_tonk_mineAI(Creature *c) : ScriptedAI(c) +public: + npc_tonk_mine() : CreatureScript("npc_tonk_mine") { } + + struct npc_tonk_mineAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); - } + npc_tonk_mineAI(Creature *c) : ScriptedAI(c) + { + me->SetReactState(REACT_PASSIVE); + } - uint32 ExplosionTimer; + uint32 ExplosionTimer; - void Reset() - { - ExplosionTimer = 3000; - } + void Reset() + { + ExplosionTimer = 3000; + } - void EnterCombat(Unit * /*who*/) {} - void AttackStart(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void AttackStart(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (ExplosionTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_TONK_MINE_DETONATE, true); - me->setDeathState(DEAD); // unsummon it - } else - ExplosionTimer -= diff; + if (ExplosionTimer <= diff) + { + DoCast(me, SPELL_TONK_MINE_DETONATE, true); + me->setDeathState(DEAD); // unsummon it + } else + ExplosionTimer -= diff; + } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_tonk_mineAI(creature); } }; -CreatureAI* GetAI_npc_tonk_mine(Creature* pCreature) -{ - return new npc_tonk_mineAI(pCreature); -} - /*#### ## npc_brewfest_reveler ####*/ -struct npc_brewfest_revelerAI : public ScriptedAI +class npc_brewfest_reveler : public CreatureScript { - npc_brewfest_revelerAI(Creature* c) : ScriptedAI(c) {} - void ReceiveEmote(Player* pPlayer, uint32 emote) +public: + npc_brewfest_reveler() : CreatureScript("npc_brewfest_reveler") { } + + struct npc_brewfest_revelerAI : public ScriptedAI { - if (!IsHolidayActive(HOLIDAY_BREWFEST)) - return; + npc_brewfest_revelerAI(Creature* c) : ScriptedAI(c) {} + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + if (!IsHolidayActive(HOLIDAY_BREWFEST)) + return; - if (emote == TEXTEMOTE_DANCE) - me->CastSpell(pPlayer, 41586, false); + if (emote == TEXTEMOTE_DANCE) + me->CastSpell(pPlayer, 41586, false); + } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_brewfest_revelerAI(creature); } }; -CreatureAI* GetAI_npc_brewfest_reveler(Creature* pCreature) -{ - return new npc_brewfest_revelerAI(pCreature); -} - /*#### ## npc_winter_reveler ####*/ -struct npc_winter_revelerAI : public ScriptedAI +class npc_winter_reveler : public CreatureScript { - npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) - return; - //TODO: check auralist. - if (pPlayer->HasAura(26218)) - return; +public: + npc_winter_reveler() : CreatureScript("npc_winter_reveler") { } - if (emote == TEXTEMOTE_KISS) + struct npc_winter_revelerAI : public ScriptedAI + { + npc_winter_revelerAI(Creature* c) : ScriptedAI(c) {} + void ReceiveEmote(Player* pPlayer, uint32 emote) { - me->CastSpell(me, 26218, false); - pPlayer->CastSpell(pPlayer, 26218, false); - switch (urand(0,2)) + if (!IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL)) + return; + //TODO: check auralist. + if (pPlayer->HasAura(26218)) + return; + + if (emote == TEXTEMOTE_KISS) { - case 0: me->CastSpell(pPlayer, 26207, false); break; - case 1: me->CastSpell(pPlayer, 26206, false); break; - case 2: me->CastSpell(pPlayer, 45036, false); break; + me->CastSpell(me, 26218, false); + pPlayer->CastSpell(pPlayer, 26218, false); + switch (urand(0,2)) + { + case 0: me->CastSpell(pPlayer, 26207, false); break; + case 1: me->CastSpell(pPlayer, 26206, false); break; + case 2: me->CastSpell(pPlayer, 45036, false); break; + } } } + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_winter_revelerAI(creature); } }; -CreatureAI* GetAI_npc_winter_reveler(Creature* pCreature) -{ - return new npc_winter_revelerAI(pCreature); -} - - /*#### ## npc_snake_trap_serpents ####*/ @@ -1568,107 +1657,113 @@ CreatureAI* GetAI_npc_winter_reveler(Creature* pCreature) #define RAND 5 -struct npc_snake_trap_serpentsAI : public ScriptedAI +class npc_snake_trap : public CreatureScript { - npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {} +public: + npc_snake_trap() : CreatureScript("npc_snake_trap_serpents") { } - uint32 SpellTimer; - bool IsViper; - bool Spawn; + struct npc_snake_trap_serpentsAI : public ScriptedAI + { + npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) {} + uint32 SpellTimer; + bool IsViper; + bool Spawn; - void Reset() - { - Spawn = true; - SpellTimer = 0; + void EnterCombat(Unit * /*who*/) {} - CreatureInfo const *Info = me->GetCreatureInfo(); + void Reset() + { + Spawn = true; + SpellTimer = 0; - if (Info->Entry == C_VIPER) - IsViper = true; - else - IsViper = false; + CreatureInfo const *Info = me->GetCreatureInfo(); - //Add delta to make them not all hit the same time - uint32 delta = (rand() % 7) * 100; - me->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); - me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); - } + if (Info->Entry == C_VIPER) + IsViper = true; + else + IsViper = false; - //Redefined for random target selection: - void MoveInLineOfSight(Unit *who) - { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) - { - if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; + //Add delta to make them not all hit the same time + uint32 delta = (rand() % 7) * 100; + me->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); + me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); + } - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) + //Redefined for random target selection: + void MoveInLineOfSight(Unit *who) + { + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) { - if (!(rand() % RAND)) + if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) { - me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); - SpellTimer = (rand() % 10) * 100; - AttackStart(who); + if (!(rand() % RAND)) + { + me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); + SpellTimer = (rand() % 10) * 100; + AttackStart(who); + } } } } - } - void UpdateAI(const uint32 diff) - { - if (Spawn) + void UpdateAI(const uint32 diff) { - Spawn = false; - // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target - if (!me->getVictim() && me->isSummon()) - if (Unit * Owner = CAST_SUM(me)->GetSummoner()) - if (Owner->getAttackerForHelper()) - AttackStart(Owner->getAttackerForHelper()); - } + if (Spawn) + { + Spawn = false; + // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target + if (!me->getVictim() && me->isSummon()) + if (Unit * Owner = CAST_SUM(me)->GetSummoner()) + if (Owner->getAttackerForHelper()) + AttackStart(Owner->getAttackerForHelper()); + } - if (!me->getVictim()) - { - if (me->isInCombat()) - DoStopAttack(); - return; - } + if (!me->getVictim()) + { + if (me->isInCombat()) + DoStopAttack(); + return; + } - if (SpellTimer <= diff) - { - if (IsViper) //Viper + if (SpellTimer <= diff) { - if (urand(0,2) == 0) //33% chance to cast + if (IsViper) //Viper { - uint32 spell; - if (urand(0,1) == 0) - spell = SPELL_MIND_NUMBING_POISON; - else - spell = SPELL_CRIPPLING_POISON; + if (urand(0,2) == 0) //33% chance to cast + { + uint32 spell; + if (urand(0,1) == 0) + spell = SPELL_MIND_NUMBING_POISON; + else + spell = SPELL_CRIPPLING_POISON; + + DoCast(me->getVictim(), spell); + } - DoCast(me->getVictim(), spell); + SpellTimer = VIPER_TIMER; + } + else //Venomous Snake + { + if (urand(0,2) == 0) //33% chance to cast + DoCast(me->getVictim(), SPELL_DEADLY_POISON); + SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; } + } else SpellTimer -= diff; + DoMeleeAttackIfReady(); + } + }; - SpellTimer = VIPER_TIMER; - } - else //Venomous Snake - { - if (urand(0,2) == 0) //33% chance to cast - DoCast(me->getVictim(), SPELL_DEADLY_POISON); - SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; - } - } else SpellTimer -= diff; - DoMeleeAttackIfReady(); + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_snake_trap_serpentsAI(creature); } }; -CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) -{ - return new npc_snake_trap_serpentsAI(pCreature); -} - #define SAY_RANDOM_MOJO0 "Now that's what I call froggy-style!" #define SAY_RANDOM_MOJO1 "Your lily pad or mine?" #define SAY_RANDOM_MOJO2 "This won't take long, did it?" @@ -1679,321 +1774,357 @@ CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) #define SAY_RANDOM_MOJO6b ", I know of a little swamp not too far from here...." #define SAY_RANDOM_MOJO7 "There's just never enough Mojo to go around..." -struct mob_mojoAI : public ScriptedAI +class mob_mojo : public CreatureScript { - mob_mojoAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 hearts; - uint64 victimGUID; - void Reset() - { - victimGUID = 0; - hearts = 15000; - if (Unit* own = me->GetOwner()) - me->GetMotionMaster()->MoveFollow(own,0,0); - } - void EnterCombat(Unit * /*who*/){} - void UpdateAI(const uint32 diff) +public: + mob_mojo() : CreatureScript("mob_mojo") { } + + struct mob_mojoAI : public ScriptedAI { - if (me->HasAura(20372)) + mob_mojoAI(Creature *c) : ScriptedAI(c) {Reset();} + uint32 hearts; + uint64 victimGUID; + void Reset() { - if (hearts <= diff) - { - me->RemoveAurasDueToSpell(20372); - hearts = 15000; - } hearts -= diff; + victimGUID = 0; + hearts = 15000; + if (Unit* own = me->GetOwner()) + me->GetMotionMaster()->MoveFollow(own,0,0); } - } - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - me->HandleEmoteCommand(emote); - Unit* own = me->GetOwner(); - if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != pPlayer->GetTeam()) - return; - if (emote == TEXTEMOTE_KISS) - { - std::string whisp = ""; - switch (rand()%8) + void EnterCombat(Unit * /*who*/){} + void UpdateAI(const uint32 diff) + { + if (me->HasAura(20372)) { - case 0:whisp.append(SAY_RANDOM_MOJO0);break; - case 1:whisp.append(SAY_RANDOM_MOJO1);break; - case 2:whisp.append(SAY_RANDOM_MOJO2);break; - case 3:whisp.append(SAY_RANDOM_MOJO3);break; - case 4:whisp.append(SAY_RANDOM_MOJO4);break; - case 5:whisp.append(SAY_RANDOM_MOJO5);break; - case 6: - whisp.append(SAY_RANDOM_MOJO6a); - whisp.append(pPlayer->GetName()); - whisp.append(SAY_RANDOM_MOJO6b); - break; - case 7:whisp.append(SAY_RANDOM_MOJO7);break; + if (hearts <= diff) + { + me->RemoveAurasDueToSpell(20372); + hearts = 15000; + } hearts -= diff; } - me->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); - if (victimGUID) + } + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + me->HandleEmoteCommand(emote); + Unit* own = me->GetOwner(); + if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != pPlayer->GetTeam()) + return; + if (emote == TEXTEMOTE_KISS) { - Player* victim = Unit::GetPlayer(*me, victimGUID); - if (victim) - victim->RemoveAura(43906);//remove polymorph frog thing + std::string whisp = ""; + switch (rand()%8) + { + case 0:whisp.append(SAY_RANDOM_MOJO0);break; + case 1:whisp.append(SAY_RANDOM_MOJO1);break; + case 2:whisp.append(SAY_RANDOM_MOJO2);break; + case 3:whisp.append(SAY_RANDOM_MOJO3);break; + case 4:whisp.append(SAY_RANDOM_MOJO4);break; + case 5:whisp.append(SAY_RANDOM_MOJO5);break; + case 6: + whisp.append(SAY_RANDOM_MOJO6a); + whisp.append(pPlayer->GetName()); + whisp.append(SAY_RANDOM_MOJO6b); + break; + case 7:whisp.append(SAY_RANDOM_MOJO7);break; + } + me->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); + if (victimGUID) + { + Player* victim = Unit::GetPlayer(*me, victimGUID); + if (victim) + victim->RemoveAura(43906);//remove polymorph frog thing + } + me->AddAura(43906,pPlayer);//add polymorph frog thing + victimGUID = pPlayer->GetGUID(); + DoCast(me, 20372, true);//tag.hearts + me->GetMotionMaster()->MoveFollow(pPlayer,0,0); + hearts = 15000; } - me->AddAura(43906,pPlayer);//add polymorph frog thing - victimGUID = pPlayer->GetGUID(); - DoCast(me, 20372, true);//tag.hearts - me->GetMotionMaster()->MoveFollow(pPlayer,0,0); - hearts = 15000; } + }; + + CreatureAI *OnGetAI(Creature *creature) + { + return new mob_mojoAI(creature); } }; -CreatureAI* GetAI_mob_mojo(Creature* pCreature) +class npc_mirror_image : public CreatureScript { - return new mob_mojoAI (pCreature); -} +public: + npc_mirror_image() : CreatureScript("npc_mirror_image") { } -struct npc_mirror_image : CasterAI -{ - npc_mirror_image(Creature *c) : CasterAI(c) {} + struct npc_mirror_imageAI : CasterAI + { + npc_mirror_imageAI(Creature *c) : CasterAI(c) {} + + void InitializeAI() + { + CasterAI::InitializeAI(); + Unit * owner = me->GetOwner(); + if (!owner) + return; + // Inherit Master's Threat List (not yet implemented) + owner->CastSpell((Unit*)NULL, 58838, true); + // here mirror image casts on summoner spell (not present in client dbc) 49866 + // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?) + // Clone Me! + owner->CastSpell(me, 45204, false); + } + + // Do not reload Creature templates on evade mode enter - prevent visual lost + void EnterEvadeMode() + { + if (me->IsInEvadeMode() || !me->isAlive()) + return; + + Unit *owner = me->GetCharmerOrOwner(); + + me->CombatStop(true); + if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + } + }; - void InitializeAI() + CreatureAI *OnGetAI(Creature *creature) const { - CasterAI::InitializeAI(); - Unit * owner = me->GetOwner(); - if (!owner) - return; - // Inherit Master's Threat List (not yet implemented) - owner->CastSpell((Unit*)NULL, 58838, true); - // here mirror image casts on summoner spell (not present in client dbc) 49866 - // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?) - // Clone Me! - owner->CastSpell(me, 45204, false); + return new npc_mirror_imageAI(creature); } +}; - // Do not reload Creature templates on evade mode enter - prevent visual lost - void EnterEvadeMode() +class npc_ebon_gargoyle : public CreatureScript +{ +public: + npc_ebon_gargoyle() : CreatureScript("npc_ebon_gargoyle") { } + + struct npc_ebon_gargoyleAI : CasterAI { - if (me->IsInEvadeMode() || !me->isAlive()) - return; + npc_ebon_gargoyleAI(Creature *c) : CasterAI(c) {} - Unit *owner = me->GetCharmerOrOwner(); + int despawnTimer; - me->CombatStop(true); - if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) + void InitializeAI() { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); + CasterAI::InitializeAI(); + Unit * owner = me->GetOwner(); + if (!owner) + return; + // Not needed to be despawned now + despawnTimer = 0; + // Find victim of Summon Gargoyle spell + std::list<Unit*> targets; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30); + Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); + me->VisitNearbyObject(30, searcher); + for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) + if ((*iter)->GetAura(49206,owner->GetGUID())) + { + me->Attack((*iter),false); + break; + } } - } -}; -CreatureAI* GetAI_npc_mirror_image(Creature* pCreature) -{ - return new npc_mirror_image (pCreature); -} + void JustDied(Unit * /*killer*/) + { + // Stop Feeding Gargoyle when it dies + if (Unit *owner = me->GetOwner()) + owner->RemoveAurasDueToSpell(50514); + } -struct npc_ebon_gargoyleAI : CasterAI -{ - npc_ebon_gargoyleAI(Creature *c) : CasterAI(c) {} + // Fly away when dismissed + void SpellHit(Unit *source, const SpellEntry *spell) + { + if (spell->Id != 50515 || !me->isAlive()) + return; - int despawnTimer; + Unit *owner = me->GetOwner(); - void InitializeAI() - { - CasterAI::InitializeAI(); - Unit * owner = me->GetOwner(); - if (!owner) - return; - // Not needed to be despawned now - despawnTimer = 0; - // Find victim of Summon Gargoyle spell - std::list<Unit*> targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30); - Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); - me->VisitNearbyObject(30, searcher); - for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) - if ((*iter)->GetAura(49206,owner->GetGUID())) - { - me->Attack((*iter),false); - break; - } - } + if (!owner || owner != source) + return; - void JustDied(Unit * /*killer*/) - { - // Stop Feeding Gargoyle when it dies - if (Unit *owner = me->GetOwner()) - owner->RemoveAurasDueToSpell(50514); - } + // Stop Fighting + me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); + // Sanctuary + me->CastSpell(me, 54661, true); + me->SetReactState(REACT_PASSIVE); - // Fly away when dismissed - void SpellHit(Unit *source, const SpellEntry *spell) - { - if (spell->Id != 50515 || !me->isAlive()) - return; - - Unit *owner = me->GetOwner(); - - if (!owner || owner != source) - return; - - // Stop Fighting - me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); - // Sanctuary - me->CastSpell(me, 54661, true); - me->SetReactState(REACT_PASSIVE); - - // Fly Away - me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING); - me->SetSpeed(MOVE_FLIGHT, 0.75f, true); - me->SetSpeed(MOVE_RUN, 0.75f, true); - float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); - float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); - float z = me->GetPositionZ() + 40; - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(0, x, y, z); - - // Despawn as soon as possible - despawnTimer = 4 * IN_MILLISECONDS; - } + // Fly Away + me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY|MOVEMENTFLAG_ASCENDING|MOVEMENTFLAG_FLYING); + me->SetSpeed(MOVE_FLIGHT, 0.75f, true); + me->SetSpeed(MOVE_RUN, 0.75f, true); + float x = me->GetPositionX() + 20 * cos(me->GetOrientation()); + float y = me->GetPositionY() + 20 * sin(me->GetOrientation()); + float z = me->GetPositionZ() + 40; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MovePoint(0, x, y, z); - void UpdateAI(const uint32 diff) - { - if (despawnTimer > 0) + // Despawn as soon as possible + despawnTimer = 4 * IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) { - if (despawnTimer > diff) - despawnTimer -= diff; - else + if (despawnTimer > 0) { - me->ForcedDespawn(); + if (despawnTimer > diff) + despawnTimer -= diff; + else + { + me->ForcedDespawn(); + } + return; } - return; + CasterAI::UpdateAI(diff); } - CasterAI::UpdateAI(diff); + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_ebon_gargoyleAI(creature); } }; -CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature) +class npc_lightwell : public CreatureScript { - return new npc_ebon_gargoyleAI (pCreature); -} +public: + npc_lightwell() : CreatureScript("npc_lightwell") { } -struct npc_lightwellAI : public PassiveAI -{ - npc_lightwellAI(Creature *c) : PassiveAI(c) {} + struct npc_lightwellAI : public PassiveAI + { + npc_lightwellAI(Creature *c) : PassiveAI(c) {} + + void Reset() + { + DoCast(me, 59907, false); // Spell for Lightwell Charges + } + }; - void Reset() + CreatureAI *OnGetAI(Creature *creature) const { - DoCast(me, 59907, false); // Spell for Lightwell Charges + return new npc_lightwellAI(creature); } }; -CreatureAI* GetAI_npc_lightwellAI(Creature* pCreature) +class npc_training_dummy : public CreatureScript { - return new npc_lightwellAI (pCreature); -} - -struct npc_training_dummy : Scripted_NoMovementAI -{ - npc_training_dummy(Creature *c) : Scripted_NoMovementAI(c) - { - m_Entry = c->GetEntry(); - } +public: + npc_training_dummy() : CreatureScript("npc_training_dummy") { } - uint64 m_Entry; - uint32 ResetTimer; - uint32 DespawnTimer; - void Reset() + struct npc_training_dummyAI : Scripted_NoMovementAI { - me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); - ResetTimer = 10000; - DespawnTimer = 15000; - } + npc_training_dummyAI(Creature *c) : Scripted_NoMovementAI(c) + { + m_Entry = c->GetEntry(); + } - void EnterEvadeMode() - { - if (!_EnterEvadeMode()) - return; + uint64 m_Entry; + uint32 ResetTimer; + uint32 DespawnTimer; + void Reset() + { + me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); + ResetTimer = 10000; + DespawnTimer = 15000; + } - Reset(); - } + void EnterEvadeMode() + { + if (!_EnterEvadeMode()) + return; - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - ResetTimer = 10000; - damage = 0; - } + Reset(); + } - void EnterCombat(Unit * /*who*/) - { - if (m_Entry != 2674 && m_Entry != 2673) - return; - } + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + ResetTimer = 10000; + damage = 0; + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (!me->hasUnitState(UNIT_STAT_STUNNED)) - me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + void EnterCombat(Unit * /*who*/) + { + if (m_Entry != 2674 && m_Entry != 2673) + return; + } - if (m_Entry != 2674 && m_Entry != 2673) + void UpdateAI(const uint32 diff) { - if (ResetTimer <= diff) + if (!UpdateVictim()) + return; + if (!me->hasUnitState(UNIT_STAT_STUNNED)) + me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + + if (m_Entry != 2674 && m_Entry != 2673) { - EnterEvadeMode(); - ResetTimer = 10000; + if (ResetTimer <= diff) + { + EnterEvadeMode(); + ResetTimer = 10000; + } + else + ResetTimer -= diff; + return; } else - ResetTimer -= diff; - return; - } - else - { - if (DespawnTimer <= diff) - me->ForcedDespawn(); - else - DespawnTimer -= diff; + { + if (DespawnTimer <= diff) + me->ForcedDespawn(); + else + DespawnTimer -= diff; + } } + void MoveInLineOfSight(Unit * /*who*/){return;} + }; + + CreatureAI *OnGetAI(Creature *creature) const + { + return new npc_training_dummyAI(creature); } - void MoveInLineOfSight(Unit * /*who*/){return;} }; -CreatureAI* GetAI_npc_training_dummy(Creature* pCreature) -{ - return new npc_training_dummy (pCreature); -} - /*###### # npc_shadowfiend ######*/ #define GLYPH_OF_SHADOWFIEND_MANA 58227 #define GLYPH_OF_SHADOWFIEND 58228 -struct npc_shadowfiendAI : public ScriptedAI +class npc_shadowfiend : public CreatureScript { - npc_shadowfiendAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_shadowfiend() : CreatureScript("npc_shadowfiend") { } - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + struct npc_shadowfiendAI : public ScriptedAI { - if (me->isSummon()) - if (Unit* pOwner = CAST_SUM(me)->GetSummoner()) - { - if (pOwner->HasAura(GLYPH_OF_SHADOWFIEND)) - if (damage >= me->GetHealth()) - pOwner->CastSpell(pOwner,GLYPH_OF_SHADOWFIEND_MANA,true); - } - } + npc_shadowfiendAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 /*diff*/) + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (me->isSummon()) + if (Unit* pOwner = CAST_SUM(me)->GetSummoner()) + { + if (pOwner->HasAura(GLYPH_OF_SHADOWFIEND)) + if (damage >= me->GetHealth()) + pOwner->CastSpell(pOwner,GLYPH_OF_SHADOWFIEND_MANA,true); + } + } + + void UpdateAI(const uint32 /*diff*/) + { + DoMeleeAttackIfReady(); + } + }; + + CreatureAI *OnGetAI(Creature *creature) const { - DoMeleeAttackIfReady(); + return new npc_shadowfiendAI(creature); } }; -CreatureAI* GetAI_npc_shadowfiend(Creature* pCreature) -{ - return new npc_shadowfiendAI(pCreature); -} - /*###### # npc_wormhole ######*/ @@ -2014,56 +2145,62 @@ enum eWormhole TEXT_WORMHOLE = 907 }; -bool GossipHello_npc_wormhole(Player* pPlayer, Creature* pCreature) +class npc_wormhole : public CreatureScript { - if (pCreature->isSummon()) +public: + npc_wormhole() : CreatureScript("npc_wormhole") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer == CAST_SUM(pCreature)->GetSummoner()) + if (pCreature->isSummon()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + if (pPlayer == CAST_SUM(pCreature)->GetSummoner()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, pCreature->GetGUID()); + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, pCreature->GetGUID()); + } } + return true; } - return true; -} -bool GossipSelect_npc_wormhole(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - bool roll = urand(0,1); - - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra - pPlayer->CLOSE_GOSSIP_MENU(); - if (roll) //At the moment we don't have chance on spell_target_position table so we hack this - pPlayer->TeleportTo(571, 4305.505859, 5450.839844, 63.005806, 0.627286); - else - pPlayer->TeleportTo(571, 3201.936279, 5630.123535, 133.658798, 3.855272); - break; - case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_HOWLING_FJORD, true); - break; - case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SHOLAZAR_BASIN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_ICECROWN, true); - break; - case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_STORM_PEAKS, true); - break; + bool roll = urand(0,1); + + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra + pPlayer->CLOSE_GOSSIP_MENU(); + if (roll) //At the moment we don't have chance on spell_target_position table so we hack this + pPlayer->TeleportTo(571, 4305.505859, 5450.839844, 63.005806, 0.627286); + else + pPlayer->TeleportTo(571, 3201.936279, 5630.123535, 133.658798, 3.855272); + break; + case GOSSIP_ACTION_INFO_DEF + 2: //Howling Fjord + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_HOWLING_FJORD, true); + break; + case GOSSIP_ACTION_INFO_DEF + 3: //Sholazar Basin + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SHOLAZAR_BASIN, true); + break; + case GOSSIP_ACTION_INFO_DEF + 4: //Icecrown + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_ICECROWN, true); + break; + case GOSSIP_ACTION_INFO_DEF + 5: //Storm peaks + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_STORM_PEAKS, true); + break; + } + return true; } - return true; -} +}; /*###### ## npc_pet_trainer @@ -2081,46 +2218,52 @@ enum ePetTrainer #define GOSSIP_PET2 "I wish to untrain my pet." #define GOSSIP_PET_CONFIRM "Yes, please do." -bool GossipHello_npc_pet_trainer(Player* pPlayer, Creature* pCreature) +class npc_pet_trainer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_pet_trainer() : CreatureScript("npc_pet_trainer") { } - if (pPlayer->getClass() == CLASS_HUNTER) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetPet() && pPlayer->GetPet()->getPetType() == HUNTER_PET) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->getClass() == CLASS_HUNTER) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->GetPet() && pPlayer->GetPet()->getPetType() == HUNTER_PET) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, pCreature->GetGUID()); + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, pCreature->GetGUID()); + return true; + } + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_NOTHUNTER, pCreature->GetGUID()); return true; } - pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_NOTHUNTER, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_pet_trainer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 3: - { - pPlayer->ResetPetTalents(); - pPlayer->CLOSE_GOSSIP_MENU(); - } - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 3: + { + pPlayer->ResetPetTalents(); + pPlayer->CLOSE_GOSSIP_MENU(); + } + break; + } + return true; } - return true; -} +}; /*###### ## npc_locksmith @@ -2159,72 +2302,76 @@ enum eLockSmith #define GOSSIP_LOST_THE_MASTERS_KEY "I've lost my key to the Karazhan." #define GOSSIP_LOST_VIOLET_HOLD_KEY "I've lost my key to the Violet Hold." - -bool GossipHello_npc_locksmith(Player* pPlayer, Creature* pCreature) +class npc_locksmith : public CreatureScript { +public: + npc_locksmith() : CreatureScript("npc_locksmith") { } - // Arcatraz Key - if (pPlayer->GetQuestRewardStatus(QUEST_HOW_TO_BRAKE_IN_TO_THE_ARCATRAZ) && !pPlayer->HasItemCount(ITEM_ARCATRAZ_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + // Arcatraz Key + if (pPlayer->GetQuestRewardStatus(QUEST_HOW_TO_BRAKE_IN_TO_THE_ARCATRAZ) && !pPlayer->HasItemCount(ITEM_ARCATRAZ_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); - // Shadowforge Key - if (pPlayer->GetQuestRewardStatus(QUEST_DARK_IRON_LEGACY) && !pPlayer->HasItemCount(ITEM_SHADOWFORGE_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); + // Shadowforge Key + if (pPlayer->GetQuestRewardStatus(QUEST_DARK_IRON_LEGACY) && !pPlayer->HasItemCount(ITEM_SHADOWFORGE_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); - // Skeleton Key - if ((pPlayer->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_A) || pPlayer->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_H)) && - !pPlayer->HasItemCount(ITEM_SKELETON_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +3); + // Skeleton Key + if ((pPlayer->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_A) || pPlayer->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_H)) && + !pPlayer->HasItemCount(ITEM_SKELETON_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +3); - // Shatered Halls Key - if ((pPlayer->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_A) || pPlayer->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_H)) && - !pPlayer->HasItemCount(ITEM_SHATTERED_HALLS_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +4); + // Shatered Halls Key + if ((pPlayer->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_A) || pPlayer->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_H)) && + !pPlayer->HasItemCount(ITEM_SHATTERED_HALLS_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +4); - // Master's Key - if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_KHAGDAR) && !pPlayer->HasItemCount(ITEM_THE_MASTERS_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +5); + // Master's Key + if (pPlayer->GetQuestRewardStatus(QUEST_RETURN_TO_KHAGDAR) && !pPlayer->HasItemCount(ITEM_THE_MASTERS_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +5); - // Violet Hold Key - if (pPlayer->GetQuestRewardStatus(QUEST_CONTAINMENT) && !pPlayer->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +6); + // Violet Hold Key + if (pPlayer->GetQuestRewardStatus(QUEST_CONTAINMENT) && !pPlayer->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +6); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + return true; + } -bool GossipSelect_npc_locksmith(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_ARCATRAZ_KEY, false); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SHADOWFORGE_KEY, false); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SKELETON_KEY, false); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SHATTERED_HALLS_KEY, false); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_THE_MASTERS_KEY, false); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_VIOLET_HOLD_KEY, false); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_ARCATRAZ_KEY, false); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SHADOWFORGE_KEY, false); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SKELETON_KEY, false); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SHATTERED_HALLS_KEY, false); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_THE_MASTERS_KEY, false); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_VIOLET_HOLD_KEY, false); + break; + } + return true; } - return true; -} +}; /*###### ## npc_tabard_vendor @@ -2278,112 +2425,118 @@ enum #define GOSSIP_LOST_TABARD_OF_THE_EXPLORER "I've lost my Tabard of the Explorer." #define GOSSIP_LOST_TABARD_OF_THE_ACHIEVER "I've lost my Tabard of the Achiever." -bool GossipHello_npc_tabard_vendor(Player* pPlayer, Creature* pCreature) -{ - bool m_bLostBloodKnight = false; - bool m_bLostHand = false; - bool m_bLostProtector = false; - bool m_bLostIllidari = false; - bool m_bLostSummer = false; - - //Tabard of the Blood Knight - if (pPlayer->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) - m_bLostBloodKnight = true; - - //Tabard of the Hand - if (pPlayer->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) - m_bLostHand = true; - - //Tabard of the Protector - if (pPlayer->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) - m_bLostProtector = true; - - //Green Trophy Tabard of the Illidari - //Purple Trophy Tabard of the Illidari - if (pPlayer->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) && - (!pPlayer->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !pPlayer->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && - !pPlayer->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) - m_bLostIllidari = true; - - //Tabard of Summer Skies - //Tabard of Summer Flames - if (pPlayer->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && - !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && - !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) - m_bLostSummer = true; - - if (m_bLostBloodKnight || m_bLostHand || m_bLostProtector || m_bLostIllidari || m_bLostSummer) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (m_bLostBloodKnight) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); - - if (m_bLostHand) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); - - if (m_bLostProtector) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - - if (m_bLostIllidari) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - } - - if (m_bLostSummer) +class npc_tabard_vendor : public CreatureScript +{ +public: + npc_tabard_vendor() : CreatureScript("npc_tabard_vendor") { } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + bool m_bLostBloodKnight = false; + bool m_bLostHand = false; + bool m_bLostProtector = false; + bool m_bLostIllidari = false; + bool m_bLostSummer = false; + + //Tabard of the Blood Knight + if (pPlayer->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) + m_bLostBloodKnight = true; + + //Tabard of the Hand + if (pPlayer->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) + m_bLostHand = true; + + //Tabard of the Protector + if (pPlayer->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) + m_bLostProtector = true; + + //Green Trophy Tabard of the Illidari + //Purple Trophy Tabard of the Illidari + if (pPlayer->GetQuestRewardStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) && + (!pPlayer->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && + !pPlayer->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && + !pPlayer->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) + m_bLostIllidari = true; + + //Tabard of Summer Skies + //Tabard of Summer Flames + if (pPlayer->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && + !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && + !pPlayer->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) + m_bLostSummer = true; + + if (m_bLostBloodKnight || m_bLostHand || m_bLostProtector || m_bLostIllidari || m_bLostSummer) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (m_bLostBloodKnight) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); + + if (m_bLostHand) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); + + if (m_bLostProtector) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + + if (m_bLostIllidari) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + } + + if (m_bLostSummer) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + } + + pPlayer->SEND_GOSSIP_MENU(13583, pCreature->GetGUID()); } - - pPlayer->SEND_GOSSIP_MENU(13583, pCreature->GetGUID()); - } - else - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_tabard_vendor(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_TRADE: + else pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_HAND, false); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_PROTECTOR, false); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_SUMMER_SKIES, false); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_SUMMER_FLAMES, false); - break; + + return true; } - return true; -} + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_HAND, false); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_THE_PROTECTOR, false); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_SUMMER_SKIES, false); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TABARD_OF_SUMMER_FLAMES, false); + break; + } + return true; + } +}; /*###### ## npc_experience @@ -2394,209 +2547,88 @@ bool GossipSelect_npc_tabard_vendor(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_XP_OFF "I no longer wish to gain experience." #define GOSSIP_XP_ON "I wish to start gaining experience again." - -bool GossipHello_npc_experience(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_experience(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) +class npc_experience : public CreatureScript { - bool noXPGain = pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); - bool doSwitch = false; +public: + npc_experience() : CreatureScript("npc_experience") { } - switch(uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF + 1://xp off - { - if (!noXPGain)//does gain xp - doSwitch = true;//switch to don't gain xp - } - break; - case GOSSIP_ACTION_INFO_DEF + 2://xp on - { - if (noXPGain)//doesn't gain xp - doSwitch = true;//switch to gain xp - } - break; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, pCreature->GetGUID()); + return true; } - if (doSwitch) + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - if (pPlayer->GetMoney() < EXP_COST) - pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); - else if (noXPGain) + bool noXPGain = pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + bool doSwitch = false; + + switch(uiAction) { - pPlayer->ModifyMoney(-EXP_COST); - pPlayer->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + case GOSSIP_ACTION_INFO_DEF + 1://xp off + { + if (!noXPGain)//does gain xp + doSwitch = true;//switch to don't gain xp + } + break; + case GOSSIP_ACTION_INFO_DEF + 2://xp on + { + if (noXPGain)//doesn't gain xp + doSwitch = true;//switch to gain xp + } + break; } - else if (!noXPGain) + if (doSwitch) { - pPlayer->ModifyMoney(-EXP_COST); - pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + if (pPlayer->GetMoney() < EXP_COST) + pPlayer->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0); + else if (noXPGain) + { + pPlayer->ModifyMoney(-EXP_COST); + pPlayer->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + } + else if (!noXPGain) + { + pPlayer->ModifyMoney(-EXP_COST); + pPlayer->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); + } } + pPlayer->PlayerTalkClass->CloseGossip(); + return true; } - pPlayer->PlayerTalkClass->CloseGossip(); - return true; -} +}; void AddSC_npcs_special() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_air_force_bots"; - newscript->GetAI = &GetAI_npc_air_force_bots; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lunaclaw_spirit"; - newscript->pGossipHello = &GossipHello_npc_lunaclaw_spirit; - newscript->pGossipSelect = &GossipSelect_npc_lunaclaw_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_chicken_cluck"; - newscript->GetAI = &GetAI_npc_chicken_cluck; - newscript->pQuestAccept = &QuestAccept_npc_chicken_cluck; - newscript->pQuestComplete = &QuestComplete_npc_chicken_cluck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dancing_flames"; - newscript->GetAI = &GetAI_npc_dancing_flames; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_injured_patient"; - newscript->GetAI = &GetAI_npc_injured_patient; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_doctor"; - newscript->GetAI = &GetAI_npc_doctor; - newscript->pQuestAccept = &QuestAccept_npc_doctor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_garments_of_quests"; - newscript->GetAI = &GetAI_npc_garments_of_quests; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_guardian"; - newscript->GetAI = &GetAI_npc_guardian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kingdom_of_dalaran_quests"; - newscript->pGossipHello = &GossipHello_npc_kingdom_of_dalaran_quests; - newscript->pGossipSelect = &GossipSelect_npc_kingdom_of_dalaran_quests; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mount_vendor"; - newscript->pGossipHello = &GossipHello_npc_mount_vendor; - newscript->pGossipSelect = &GossipSelect_npc_mount_vendor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rogue_trainer"; - newscript->pGossipHello = &GossipHello_npc_rogue_trainer; - newscript->pGossipSelect = &GossipSelect_npc_rogue_trainer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_sayge"; - newscript->pGossipHello = &GossipHello_npc_sayge; - newscript->pGossipSelect = &GossipSelect_npc_sayge; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_steam_tonk"; - newscript->GetAI = &GetAI_npc_steam_tonk; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tonk_mine"; - newscript->GetAI = &GetAI_npc_tonk_mine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_winter_reveler"; - newscript->GetAI = &GetAI_npc_winter_reveler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_brewfest_reveler"; - newscript->GetAI = &GetAI_npc_winter_reveler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_snake_trap_serpents"; - newscript->GetAI = &GetAI_npc_snake_trap_serpents; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mirror_image"; - newscript->GetAI = &GetAI_npc_mirror_image; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ebon_gargoyle"; - newscript->GetAI = &GetAI_npc_ebon_gargoyle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lightwell"; - newscript->GetAI = &GetAI_npc_lightwellAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_mojo"; - newscript->GetAI = &GetAI_mob_mojo; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_training_dummy"; - newscript->GetAI = &GetAI_npc_training_dummy; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shadowfiend"; - newscript->GetAI = &GetAI_npc_shadowfiend; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_wormhole"; - newscript->pGossipHello = &GossipHello_npc_wormhole; - newscript->pGossipSelect = &GossipSelect_npc_wormhole; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_pet_trainer"; - newscript->pGossipHello = &GossipHello_npc_pet_trainer; - newscript->pGossipSelect = &GossipSelect_npc_pet_trainer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_locksmith"; - newscript->pGossipHello = &GossipHello_npc_locksmith; - newscript->pGossipSelect = &GossipSelect_npc_locksmith; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tabard_vendor"; - newscript->pGossipHello = &GossipHello_npc_tabard_vendor; - newscript->pGossipSelect = &GossipSelect_npc_tabard_vendor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_experience"; - newscript->pGossipHello = &GossipHello_npc_experience; - newscript->pGossipSelect = &GossipSelect_npc_experience; - newscript->RegisterSelf(); + new npc_air_force_bots; + new npc_lunaclaw_spirit; + new npc_chicken_cluck; + new npc_dancing_flames; + new npc_doctor; + new npc_injured_patient; + new npc_garments_of_quests; + new npc_guardian; + new npc_kingdom_of_dalaran_quests; + new npc_mount_vendor; + new npc_rogue_trainer; + new npc_sayge; + new npc_steam_tonk; + new npc_tonk_mine; + new npc_winter_reveler; + new npc_brewfest_reveler; + new npc_snake_trap; + new npc_mirror_image; + new npc_ebon_gargoyle; + new npc_lightwell; + new mob_mojo; + new npc_training_dummy; + new npc_shadowfiend; + new npc_wormhole; + new npc_pet_trainer; + new npc_locksmith; + new npc_tabard_vendor; + new npc_experience; } |