From e00175d23bc6905d7ca75ec09c6eca6e58409717 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sun, 16 Aug 2009 00:10:26 +0200 Subject: Merge [SD2] r1287 Move all non-instance scripts that are not related to any special continent to new world folder. sorry about mistake in last sd2 merge. there should be: r1286 Restructure file layout and move all non-instance source files to a logical continental single folder. --HG-- branch : trunk --- src/bindings/scripts/CMakeLists.txt | 24 +- src/bindings/scripts/VC80/80ScriptDev2.vcproj | 124 +- src/bindings/scripts/VC90/90ScriptDev2.vcproj | 124 +- .../scripts/areatrigger/areatrigger_scripts.cpp | 92 - src/bindings/scripts/scripts/boss/boss_emeriss.cpp | 146 -- src/bindings/scripts/scripts/boss/boss_lethon.cpp | 25 - src/bindings/scripts/scripts/boss/boss_taerar.cpp | 263 --- src/bindings/scripts/scripts/boss/boss_ysondre.cpp | 203 -- .../scripts/creature/mob_generic_creature.cpp | 260 --- src/bindings/scripts/scripts/go/go_scripts.cpp | 476 ----- src/bindings/scripts/scripts/item/item_scripts.cpp | 253 --- src/bindings/scripts/scripts/item/item_test.cpp | 43 - src/bindings/scripts/scripts/npc/npc_innkeeper.cpp | 145 -- .../scripts/scripts/npc/npc_professions.cpp | 1342 ------------- src/bindings/scripts/scripts/npc/npc_taxi.cpp | 262 --- src/bindings/scripts/scripts/npc/npcs_special.cpp | 1965 -------------------- .../scripts/scripts/world/areatrigger_scripts.cpp | 92 + .../scripts/scripts/world/boss_emeriss.cpp | 146 ++ src/bindings/scripts/scripts/world/boss_lethon.cpp | 25 + src/bindings/scripts/scripts/world/boss_taerar.cpp | 263 +++ .../scripts/scripts/world/boss_ysondre.cpp | 203 ++ src/bindings/scripts/scripts/world/go_scripts.cpp | 476 +++++ .../scripts/scripts/world/item_scripts.cpp | 253 +++ .../scripts/scripts/world/mob_generic_creature.cpp | 260 +++ .../scripts/scripts/world/npc_innkeeper.cpp | 145 ++ .../scripts/scripts/world/npc_professions.cpp | 1342 +++++++++++++ src/bindings/scripts/scripts/world/npc_taxi.cpp | 262 +++ .../scripts/scripts/world/npcs_special.cpp | 1965 ++++++++++++++++++++ 28 files changed, 5548 insertions(+), 5631 deletions(-) delete mode 100644 src/bindings/scripts/scripts/areatrigger/areatrigger_scripts.cpp delete mode 100644 src/bindings/scripts/scripts/boss/boss_emeriss.cpp delete mode 100644 src/bindings/scripts/scripts/boss/boss_lethon.cpp delete mode 100644 src/bindings/scripts/scripts/boss/boss_taerar.cpp delete mode 100644 src/bindings/scripts/scripts/boss/boss_ysondre.cpp delete mode 100644 src/bindings/scripts/scripts/creature/mob_generic_creature.cpp delete mode 100644 src/bindings/scripts/scripts/go/go_scripts.cpp delete mode 100644 src/bindings/scripts/scripts/item/item_scripts.cpp delete mode 100644 src/bindings/scripts/scripts/item/item_test.cpp delete mode 100644 src/bindings/scripts/scripts/npc/npc_innkeeper.cpp delete mode 100644 src/bindings/scripts/scripts/npc/npc_professions.cpp delete mode 100644 src/bindings/scripts/scripts/npc/npc_taxi.cpp delete mode 100644 src/bindings/scripts/scripts/npc/npcs_special.cpp create mode 100644 src/bindings/scripts/scripts/world/areatrigger_scripts.cpp create mode 100644 src/bindings/scripts/scripts/world/boss_emeriss.cpp create mode 100644 src/bindings/scripts/scripts/world/boss_lethon.cpp create mode 100644 src/bindings/scripts/scripts/world/boss_taerar.cpp create mode 100644 src/bindings/scripts/scripts/world/boss_ysondre.cpp create mode 100644 src/bindings/scripts/scripts/world/go_scripts.cpp create mode 100644 src/bindings/scripts/scripts/world/item_scripts.cpp create mode 100644 src/bindings/scripts/scripts/world/mob_generic_creature.cpp create mode 100644 src/bindings/scripts/scripts/world/npc_innkeeper.cpp create mode 100644 src/bindings/scripts/scripts/world/npc_professions.cpp create mode 100644 src/bindings/scripts/scripts/world/npc_taxi.cpp create mode 100644 src/bindings/scripts/scripts/world/npcs_special.cpp (limited to 'src/bindings/scripts') diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index bdb9291e4fd..88b134108e9 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -10,12 +10,6 @@ SET(trinityscript_LIB_SRCS include/sc_creature.h include/sc_gossip.h include/sc_instance.h - scripts/areatrigger/areatrigger_scripts.cpp - scripts/boss/boss_emeriss.cpp - scripts/boss/boss_lethon.cpp - scripts/boss/boss_taerar.cpp - scripts/boss/boss_ysondre.cpp - scripts/creature/mob_generic_creature.cpp scripts/creature/simple_ai.cpp scripts/creature/simple_ai.h scripts/eastern_kingdoms/alterac_mountains.cpp @@ -44,11 +38,9 @@ SET(trinityscript_LIB_SRCS scripts/examples/example_escort.cpp scripts/examples/example_gossip_codebox.cpp scripts/examples/example_misc.cpp - scripts/go/go_scripts.cpp scripts/guard/guard_ai.cpp scripts/guard/guard_ai.h scripts/guard/guards.cpp - scripts/item/item_scripts.cpp scripts/kalimdor/ashenvale.cpp scripts/kalimdor/azshara.cpp scripts/kalimdor/azuremyst_isle.cpp @@ -78,10 +70,6 @@ SET(trinityscript_LIB_SRCS scripts/northrend/zuldrak.cpp scripts/npc/npc_escortAI.cpp scripts/npc/npc_escortAI.h - scripts/npc/npc_innkeeper.cpp - scripts/npc/npc_professions.cpp - scripts/npc/npcs_special.cpp - scripts/npc/npc_taxi.cpp scripts/outland/blades_edge_mountains.cpp scripts/outland/boss_doomlord_kazzak.cpp scripts/outland/boss_doomwalker.cpp @@ -508,6 +496,18 @@ SET(trinityscript_LIB_SRCS scripts/zone/ulduar/ulduar/boss_yoggsaron.cpp scripts/zone/ulduar/ulduar/def_ulduar.h scripts/zone/ulduar/ulduar/instance_ulduar.cpp + scripts/world/areatrigger_scripts.cpp + scripts/world/boss_emeriss.cpp + scripts/world/boss_lethon.cpp + scripts/world/boss_taerar.cpp + scripts/world/boss_ysondre.cpp + scripts/world/go_scripts.cpp + scripts/world/item_scripts.cpp + scripts/world/mob_generic_creature.cpp + scripts/world/npc_innkeeper.cpp + scripts/world/npc_professions.cpp + scripts/world/npcs_special.cpp + scripts/world/npc_taxi.cpp system.cpp ) diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index e4a32705566..5518d35f66f 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -363,41 +363,9 @@ - - - - - - - - - - - - - - - - @@ -519,14 +487,6 @@ > - - - - @@ -543,14 +503,6 @@ > - - - - @@ -677,22 +629,6 @@ RelativePath="..\scripts\npc\npc_escortAI.h" > - - - - - - - - - - - - @@ -2795,6 +2723,58 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - @@ -516,14 +484,6 @@ > - - - - @@ -540,14 +500,6 @@ > - - - - @@ -674,22 +626,6 @@ RelativePath="..\scripts\npc\npc_escortAI.h" > - - - - - - - - - - - - @@ -2792,6 +2720,58 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Areatrigger_Scripts -SD%Complete: 100 -SDComment: Scripts for areatriggers -SDCategory: Areatrigger -EndScriptData */ - -/* ContentData -at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm -EndContentData */ - -#include "precompiled.h" - -/*##### -## at_legion_teleporter -#####*/ - -enum -{ - SPELL_TELE_A_TO = 37387, - QUEST_GAINING_ACCESS_A = 10589, - - SPELL_TELE_H_TO = 37389, - QUEST_GAINING_ACCESS_H = 10604 -}; - -bool AreaTrigger_at_legion_teleporter(Player* pPlayer, AreaTriggerEntry* pAt) -{ - if (pPlayer->isAlive() && !pPlayer->isInCombat()) - { - if (pPlayer->GetTeam()== ALLIANCE && pPlayer->GetQuestRewardStatus(QUEST_GAINING_ACCESS_A)) - { - pPlayer->CastSpell(pPlayer,SPELL_TELE_A_TO,false); - return true; - } - - if (pPlayer->GetTeam()== HORDE && pPlayer->GetQuestRewardStatus(QUEST_GAINING_ACCESS_H)) - { - pPlayer->CastSpell(pPlayer,SPELL_TELE_H_TO,false); - return true; - } - - return false; - } - return false; -} - -enum -{ - QUEST_MANOR_RAVENHOLDT = 6681, - NPC_RAVENHOLDT = 13936 -}; - -bool AreaTrigger_at_ravenholdt(Player* pPlayer, AreaTriggerEntry* pAt) -{ - if (pPlayer->GetQuestStatus(QUEST_MANOR_RAVENHOLDT) == QUEST_STATUS_INCOMPLETE) - pPlayer->KilledMonsterCredit(NPC_RAVENHOLDT, 0); - - return false; -} - -void AddSC_areatrigger_scripts() -{ - Script *newscript; - - newscript = new Script; - newscript->Name = "at_legion_teleporter"; - newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_ravenholdt"; - newscript->pAreaTrigger = &AreaTrigger_at_ravenholdt; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/boss/boss_emeriss.cpp b/src/bindings/scripts/scripts/boss/boss_emeriss.cpp deleted file mode 100644 index 9881525e3ad..00000000000 --- a/src/bindings/scripts/scripts/boss/boss_emeriss.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Emeriss -SD%Complete: 90 -SDComment: Teleport function & Mark of Nature missing -SDCategory: Bosses -EndScriptData */ - -#include "precompiled.h" - -enum -{ - SAY_AGGRO = -1000401, - SAY_CASTCORRUPTION = -1000402, - - SPELL_SLEEP = 24777, - SPELL_NOXIOUSBREATH = 24818, - SPELL_TAILSWEEP = 15847, - //SPELL_MARKOFNATURE = 25040, // Not working - SPELL_VOLATILEINFECTION = 24928, - SPELL_CORRUPTIONOFEARTH = 24910 -}; - -struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI -{ - boss_emerissAI(Creature *c) : ScriptedAI(c) {} - - uint32 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 Aggro(Unit* pWho) - { - DoScriptText(SAY_AGGRO, m_creature); - } - - 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); - - m_uiSleep_Timer = 8000 + rand()%8000; - } - else - m_uiSleep_Timer -= uiDiff; - - //NoxiousBreath_Timer - if (m_uiNoxiousBreath_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); - m_uiNoxiousBreath_Timer = 14000 + rand()%6000; - } - else - m_uiNoxiousBreath_Timer -= uiDiff; - - //Tailsweep every 2 seconds - if (m_uiTailSweep_Timer < uiDiff) - { - DoCast(m_creature, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer < uiDiff) - //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - - //VolatileInfection_Timer - if (m_uiVolatileInfection_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_VOLATILEINFECTION); - m_uiVolatileInfection_Timer = 7000 + rand()%5000; - } - else - m_uiVolatileInfection_Timer -= uiDiff; - - //CorruptionofEarth_Timer - //CorruptionofEarth at 75%, 50% and 25% - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) - { - ++m_uiCorruptionsCasted; // prevent casting twice on same hp - DoScriptText(SAY_CASTCORRUPTION, m_creature); - DoCast(m_creature->getVictim(), SPELL_CORRUPTIONOFEARTH); - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_emeriss(Creature* pCreature) -{ - return new boss_emerissAI (pCreature); -} - -void AddSC_boss_emeriss() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_emeriss"; - newscript->GetAI = &GetAI_boss_emeriss; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/boss/boss_lethon.cpp b/src/bindings/scripts/scripts/boss/boss_lethon.cpp deleted file mode 100644 index e387891efed..00000000000 --- a/src/bindings/scripts/scripts/boss/boss_lethon.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Lethon -SD%Complete: 0 -SDComment: Place Holder -SDCategory: Bosses -EndScriptData */ - -#include "precompiled.h" - diff --git a/src/bindings/scripts/scripts/boss/boss_taerar.cpp b/src/bindings/scripts/scripts/boss/boss_taerar.cpp deleted file mode 100644 index 3f45ab26331..00000000000 --- a/src/bindings/scripts/scripts/boss/boss_taerar.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Taerar -SD%Complete: 70 -SDComment: Mark of Nature & Teleport NYI. Fix the way to be banished. -SDCategory: Bosses -EndScriptData */ - -#include "precompiled.h" - -enum -{ - SAY_AGGRO = -1000399, - SAY_SUMMONSHADE = -1000400, - - //Spells of Taerar - SPELL_SLEEP = 24777, - SPELL_NOXIOUSBREATH = 24818, - SPELL_TAILSWEEP = 15847, - // SPELL_MARKOFNATURE = 25040, // Not working - SPELL_ARCANEBLAST = 24857, - SPELL_BELLOWINGROAR = 22686, - - SPELL_SUMMONSHADE_1 = 24841, - SPELL_SUMMONSHADE_2 = 24842, - SPELL_SUMMONSHADE_3 = 24843, - - //Spells of Shades of Taerar - SPELL_POSIONCLOUD = 24840, - SPELL_POSIONBREATH = 20667 -}; - -uint32 m_auiSpellSummonShade[]= -{ - SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3 -}; - -struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI -{ - boss_taerarAI(Creature *c) : ScriptedAI(c) {} - - uint32 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() - { - m_uiSleep_Timer = 15000 + rand()%5000; - m_uiNoxiousBreath_Timer = 8000; - m_uiTailSweep_Timer = 4000; - //m_uiMarkOfNature_Timer = 45000; - m_uiArcaneBlast_Timer = 12000; - m_uiBellowingRoar_Timer = 30000; - m_uiShades_Timer = 60000; //The time that Taerar is banished - m_uiShadesSummoned = 0; - - m_bShades = false; - } - - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_AGGRO, m_creature); - } - - void JustSummoned(Creature* pSummoned) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - } - - void UpdateAI(const uint32 uiDiff) - { - if (m_bShades && m_uiShades_Timer < uiDiff) - { - //Become unbanished again - m_creature->setFaction(14); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_bShades = false; - } - else if (m_bShades) - { - m_uiShades_Timer -= uiDiff; - //Do nothing while banished - return; - } - - //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()%7000; - } - else - m_uiSleep_Timer -= uiDiff; - - //NoxiousBreath_Timer - if (m_uiNoxiousBreath_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); - m_uiNoxiousBreath_Timer = 14000 + rand()%6000; - } - else - m_uiNoxiousBreath_Timer -= uiDiff; - - //Tailsweep every 2 seconds - if (m_uiTailSweep_Timer < uiDiff) - { - DoCast(m_creature, SPELL_TAILSWEEP); - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer < uiDiff) - //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - //ArcaneBlast_Timer - if (m_uiArcaneBlast_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_ARCANEBLAST); - m_uiArcaneBlast_Timer = 7000 + rand()%5000; - } - else - m_uiArcaneBlast_Timer -= uiDiff; - - //BellowingRoar_Timer - if (m_uiBellowingRoar_Timer < uiDiff) - { - DoCast(m_creature->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 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - //Inturrupt any spell casting - m_creature->InterruptNonMeleeSpells(false); - - //horrible workaround, need to fix - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - DoScriptText(SAY_SUMMONSHADE, m_creature); - - int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); - - for(int i = 0; i < iSize; ++i) - m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true); - - ++m_uiShadesSummoned; // prevent casting twice at same health - m_bShades = true; - } - m_uiShades_Timer = 60000; - } - - DoMeleeAttackIfReady(); - } -}; - -// Shades of Taerar Script -struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI -{ - boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiPoisonCloud_Timer; - uint32 m_uiPosionBreath_Timer; - - void Reset() - { - m_uiPoisonCloud_Timer = 8000; - m_uiPosionBreath_Timer = 12000; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //PoisonCloud_Timer - if (m_uiPoisonCloud_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_POSIONCLOUD); - m_uiPoisonCloud_Timer = 30000; - } - else - m_uiPoisonCloud_Timer -= uiDiff; - - //PosionBreath_Timer - if (m_uiPosionBreath_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_POSIONBREATH); - m_uiPosionBreath_Timer = 12000; - } - else - m_uiPosionBreath_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } -}; - -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(); -} - diff --git a/src/bindings/scripts/scripts/boss/boss_ysondre.cpp b/src/bindings/scripts/scripts/boss/boss_ysondre.cpp deleted file mode 100644 index 1b93f54c047..00000000000 --- a/src/bindings/scripts/scripts/boss/boss_ysondre.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Ysondre -SD%Complete: 90 -SDComment: Mark of Nature & Teleport missing -SDCategory: Bosses -EndScriptData */ - -#include "precompiled.h" - -enum -{ - SAY_AGGRO = -1000360, - SAY_SUMMONDRUIDS = -1000361, - - SPELL_SLEEP = 24777, - SPELL_NOXIOUSBREATH = 24818, - SPELL_TAILSWEEP = 15847, - //SPELL_MARKOFNATURE = 25040, // Not working - SPELL_LIGHTNINGWAVE = 24819, - SPELL_SUMMONDRUIDS = 24795, - - SPELL_SUMMON_PLAYER = 24776, - - //druid spells - SPELL_MOONFIRE = 21669 -}; - -// Ysondre script -struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI -{ - boss_ysondreAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - 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() - { - 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, m_creature); - } - - void JustSummoned(Creature* pSummoned) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - } - - void UpdateAI(const uint32 uiDiff) - { - 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(m_creature->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 *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_TAILSWEEP); - - m_uiTailSweep_Timer = 2000; - } - else - m_uiTailSweep_Timer -= uiDiff; - - //MarkOfNature_Timer - //if (m_uiMarkOfNature_Timer < uiDiff) - //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); - // m_uiMarkOfNature_Timer = 45000; - //} - //else - // m_uiMarkOfNature_Timer -= uiDiff; - - //LightningWave_Timer - if (m_uiLightningWave_Timer < uiDiff) - { - //Cast LIGHTNINGWAVE on a Random target - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_LIGHTNINGWAVE); - - m_uiLightningWave_Timer = 7000 + rand()%5000; - } - else - m_uiLightningWave_Timer -= uiDiff; - - //Summon Druids - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) - { - DoScriptText(SAY_SUMMONDRUIDS, m_creature); - - for(int i = 0; i < 10; ++i) - DoCast(m_creature, SPELL_SUMMONDRUIDS, true); - - ++m_uiSummonDruidModifier; - } - - DoMeleeAttackIfReady(); - } -}; - -// Summoned druid script -struct TRINITY_DLL_DECL mob_dementeddruidsAI : public ScriptedAI -{ - mob_dementeddruidsAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiMoonFire_Timer; - - void Reset() - { - m_uiMoonFire_Timer = 3000; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //MoonFire_Timer - if (m_uiMoonFire_Timer < uiDiff) - { - DoCast(m_creature->getVictim(), SPELL_MOONFIRE); - m_uiMoonFire_Timer = 5000; - } - else - m_uiMoonFire_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } -}; - -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(); -} - diff --git a/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp b/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp deleted file mode 100644 index 30a57e56dd5..00000000000 --- a/src/bindings/scripts/scripts/creature/mob_generic_creature.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -/* ScriptData -SDName: Generic_Creature -SD%Complete: 80 -SDComment: Should be replaced with core based AI -SDCategory: Creatures -EndScriptData */ - -#include "precompiled.h" - -#define GENERIC_CREATURE_COOLDOWN 5000 - -struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI -{ - generic_creatureAI(Creature *c) : ScriptedAI(c) {} - - 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() - { - GlobalCooldown = 0; - BuffTimer = 0; //Rebuff as soon as we can - IsSelfRooted = false; - } - - void EnterCombat(Unit *who) - { - if (!m_creature->IsWithinMeleeRange(who)) - { - IsSelfRooted = true; - } - } - - 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 (!m_creature->isInCombat() && m_creature->isAlive()) - if (BuffTimer < diff) - { - //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); - - if (info && !GlobalCooldown) - { - //Cast the buff spell - DoCastSpell(m_creature, info); - - //Set our global cooldown - GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - - //Set our timer to 10 minutes before rebuff - BuffTimer = 600000; - }//Try agian in 30 seconds - else BuffTimer = 30000; - }else BuffTimer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - //If we are within range melee the target - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) - { - //Make sure our attack is ready and we arn't currently casting - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) - { - bool Healing = false; - SpellEntry const *info = NULL; - - //Select a healing spell if less than 30% hp - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) - info = SelectSpell(m_creature, -1, -1, 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(m_creature->getVictim(), -1, -1, 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() % (m_creature->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) - { - //Cast the spell - if (Healing)DoCastSpell(m_creature, info); - else DoCastSpell(m_creature->getVictim(), info); - - //Set our global cooldown - GlobalCooldown = GENERIC_CREATURE_COOLDOWN; - } - else m_creature->AttackerStateUpdate(m_creature->getVictim()); - - m_creature->resetAttackTimer(); - } - } - else - { - //Only run this code if we arn't already casting - if (!m_creature->IsNonMeleeSpellCasted(false)) - { - bool Healing = false; - SpellEntry const *info = NULL; - - //Select a healing spell if less than 30% hp ONLY 33% of the time - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0) - info = SelectSpell(m_creature, -1, -1, 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(m_creature->getVictim(), -1, -1, 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) - { - IsSelfRooted = true; - } - - //Cast spell - if (Healing) DoCastSpell(m_creature,info); - else DoCastSpell(m_creature->getVictim(),info); - - //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 - m_creature->InterruptNonMeleeSpells(false); - IsSelfRooted = false; - } - } - } - } -}; - -CreatureAI* GetAI_generic_creature(Creature* pCreature) -{ - return new generic_creatureAI (pCreature); -} - -struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI -{ - 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; - - void UpdateAI(const uint32 diff) - { - if (timer < diff) - { - if (spell) - me->CastSpell(me, spell, true); - timer = interval; - } - else - timer -= diff; - } -}; - -struct TRINITY_DLL_DECL 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); - } -}; - -struct TRINITY_DLL_DECL mob_webwrapAI : public NullCreatureAI -{ - mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} - - uint64 victimGUID; - - void SetGUID(const uint64 &guid, int32 param) - { - victimGUID = guid; - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); - } - - void JustDied(Unit *killer) - { - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); - } -}; - -CreatureAI* GetAI_trigger_periodic(Creature* pCreature) -{ - return new trigger_periodicAI (pCreature); -} - -CreatureAI* GetAI_trigger_death(Creature* pCreature) -{ - return new trigger_deathAI (pCreature); -} - -CreatureAI* GetAI_mob_webwrap(Creature* pCreature) -{ - return new mob_webwrapAI (pCreature); -} - -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();*/ - - newscript = new Script; - newscript->Name="mob_webwrap"; - newscript->GetAI = &GetAI_mob_webwrap; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/go/go_scripts.cpp b/src/bindings/scripts/scripts/go/go_scripts.cpp deleted file mode 100644 index d0818fe8dc0..00000000000 --- a/src/bindings/scripts/scripts/go/go_scripts.cpp +++ /dev/null @@ -1,476 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: GO_Scripts -SD%Complete: 100 -SDComment: Quest support: 4285,4287,4288(crystal pylons), 4296, 6481, 10990, 10991, 10992, Field_Repair_Bot->Teaches spell 22704. Barov_journal->Teaches spell 26089 -SDCategory: Game Objects -EndScriptData */ - -/* ContentData -go_cat_figurine (the "trap" version of GO, two different exist) -go_northern_crystal_pylon -go_eastern_crystal_pylon -go_western_crystal_pylon -go_barov_journal -go_ethereum_prison -go_ethereum_stasis -go_sacred_fire_of_life -go_shrine_of_the_birds -go_field_repair_bot_74A -go_orb_of_command -go_resonite_cask -go_tablet_of_madness -go_tablet_of_the_seven -go_tele_to_dalaran_crystal -go_tele_to_violet_stand -EndContentData */ - -#include "precompiled.h" - -/*###### -## go_cat_figurine -######*/ - -enum -{ - SPELL_SUMMON_GHOST_SABER = 5968, -}; - -bool GOHello_go_cat_figurine(Player* pPlayer, GameObject* pGo) -{ - pPlayer->CastSpell(pPlayer,SPELL_SUMMON_GHOST_SABER,true); - return false; -} - -/*###### -## go_crystal_pylons (3x) -######*/ - -bool GOHello_go_northern_crystal_pylon(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - pPlayer->PrepareQuestMenu(pGo->GetGUID()); - pPlayer->SendPreparedQuest(pGo->GetGUID()); - } - - if (pPlayer->GetQuestStatus(4285) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(4285); - - return true; -} - -bool GOHello_go_eastern_crystal_pylon(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - pPlayer->PrepareQuestMenu(pGo->GetGUID()); - pPlayer->SendPreparedQuest(pGo->GetGUID()); - } - - if (pPlayer->GetQuestStatus(4287) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(4287); - - return true; -} - -bool GOHello_go_western_crystal_pylon(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) - { - pPlayer->PrepareQuestMenu(pGo->GetGUID()); - pPlayer->SendPreparedQuest(pGo->GetGUID()); - } - - if (pPlayer->GetQuestStatus(4288) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(4288); - - return true; -} - -/*###### -## go_barov_journal -######*/ - -bool GOHello_go_barov_journal(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !pPlayer->HasSpell(26086)) - { - pPlayer->CastSpell(pPlayer,26095,false); - } - return true; -} - -/*###### -## go_field_repair_bot_74A -######*/ - -bool GOHello_go_field_repair_bot_74A(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->HasSkill(SKILL_ENGINERING) && pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 300 && !pPlayer->HasSpell(22704)) - { - pPlayer->CastSpell(pPlayer,22864,false); - } - return true; -} - -/*###### -## go_gilded_brazier -######*/ - -enum -{ - NPC_STILLBLADE = 17716, -}; - -bool GOHello_go_gilded_brazier(Player* pPlayer, GameObject* pGO) -{ - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) - { - if (Creature* pCreature = pPlayer->SummonCreature(NPC_STILLBLADE, 8087.632, -7542.740, 151.568, 0.122, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - pCreature->AI()->AttackStart(pPlayer); - } - - return true; -} - -/*###### -## go_orb_of_command -######*/ - -bool GOHello_go_orb_of_command(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->GetQuestRewardStatus(7761)) - pPlayer->CastSpell(pPlayer,23460,true); - - return true; -} - -/*###### -## go_tablet_of_madness -######*/ - -bool GOHello_go_tablet_of_madness(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetSkillValue(SKILL_ALCHEMY) >= 300 && !pPlayer->HasSpell(24266)) - { - pPlayer->CastSpell(pPlayer,24267,false); - } - return true; -} - -/*###### -## go_tablet_of_the_seven -######*/ - -//TODO: use gossip option ("Transcript the Tablet") instead, if Trinity adds support. -bool GOHello_go_tablet_of_the_seven(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) - return true; - - if (pPlayer->GetQuestStatus(4296) == QUEST_STATUS_INCOMPLETE) - pPlayer->CastSpell(pPlayer,15065,false); - - return true; -} - -/*##### -## go_jump_a_tron -######*/ - -bool GOHello_go_jump_a_tron(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->GetQuestStatus(10111) == QUEST_STATUS_INCOMPLETE) - pPlayer->CastSpell(pPlayer,33382,true); - - return true; -} - -/*###### -## go_ethereum_prison -######*/ - -enum -{ - SPELL_REP_LC = 39456, - SPELL_REP_SHAT = 39457, - SPELL_REP_CE = 39460, - SPELL_REP_CON = 39474, - SPELL_REP_KT = 39475, - SPELL_REP_SPOR = 39476 -}; - -const uint32 NpcPrisonEntry[] = -{ - 22810, 22811, 22812, 22813, 22814, 22815, //good guys - 20783, 20784, 20785, 20786, 20788, 20789, 20790 //bad guys -}; - -bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) -{ - int Random = rand() % (sizeof(NpcPrisonEntry) / sizeof(uint32)); - - if (Creature* pCreature = pPlayer->SummonCreature(NpcPrisonEntry[Random], - pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - if (!pCreature->IsHostileTo(pPlayer)) - { - uint32 Spell = 0; - - if (FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry()) - { - switch(pFaction->faction) - { - case 1011: Spell = SPELL_REP_LC; break; - case 935: Spell = SPELL_REP_SHAT; break; - case 942: Spell = SPELL_REP_CE; break; - case 933: Spell = SPELL_REP_CON; break; - case 989: Spell = SPELL_REP_KT; break; - case 970: Spell = SPELL_REP_SPOR; break; - } - - if (Spell) - pCreature->CastSpell(pPlayer, Spell, false); - else - error_log("TSCR: go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", pCreature->GetEntry(), pCreature->getFaction()); - } - } - } - - return false; -} - -/*###### -## go_ethereum_stasis -######*/ - -const uint32 NpcStasisEntry[] = -{ - 22825, 20888, 22827, 22826, 22828 -}; - -bool GOHello_go_ethereum_stasis(Player* pPlayer, GameObject* pGo) -{ - int Random = rand() % (sizeof(NpcStasisEntry) / sizeof(uint32)); - - pPlayer->SummonCreature(NpcStasisEntry[Random], - pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - - return false; -} - -/*###### -## go_resonite_cask -######*/ - -enum -{ - NPC_GOGGEROC = 11920 -}; - -bool GOHello_go_resonite_cask(Player* pPlayer, GameObject* pGO) -{ - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) - pGO->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); - - return false; -} - -/*###### -## go_sacred_fire_of_life -######*/ - -#define NPC_ARIKARA 10882 - -bool GOHello_go_sacred_fire_of_life(Player* pPlayer, GameObject* pGO) -{ - if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) - pPlayer->SummonCreature(NPC_ARIKARA, -5008.338, -2118.894, 83.657, 0.874, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - - return true; -} - -/*###### -## go_shrine_of_the_birds -######*/ - -enum -{ - NPC_HAWK_GUARD = 22992, - NPC_EAGLE_GUARD = 22993, - NPC_FALCON_GUARD = 22994, - GO_SHRINE_HAWK = 185551, - GO_SHRINE_EAGLE = 185547, - GO_SHRINE_FALCON = 185553 -}; - -bool GOHello_go_shrine_of_the_birds(Player* pPlayer, GameObject* pGo) -{ - uint32 BirdEntry = 0; - - float fX, fY, fZ; - pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectSize(), INTERACTION_DISTANCE); - - switch(pGo->GetEntry()) - { - case GO_SHRINE_HAWK: - BirdEntry = NPC_HAWK_GUARD; - break; - case GO_SHRINE_EAGLE: - BirdEntry = NPC_EAGLE_GUARD; - break; - case GO_SHRINE_FALCON: - BirdEntry = NPC_FALCON_GUARD; - break; - } - - if (BirdEntry) - pPlayer->SummonCreature(BirdEntry, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - - return false; -} - -/*###### -## go_tele_to_dalaran_crystal -######*/ - -enum -{ - QUEST_LEARN_LEAVE_RETURN = 12790, - QUEST_TELE_CRYSTAL_FLAG = 12845 -}; - -bool GOHello_go_tele_to_dalaran_crystal(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG)) - return false; - - //TODO: must send error message (what kind of message? On-screen?) - return true; -} - -/*###### -## go_tele_to_violet_stand -######*/ - -bool GOHello_go_tele_to_violet_stand(Player* pPlayer, GameObject* pGo) -{ - if (pPlayer->GetQuestRewardStatus(QUEST_LEARN_LEAVE_RETURN) || pPlayer->GetQuestStatus(QUEST_LEARN_LEAVE_RETURN) == QUEST_STATUS_INCOMPLETE) - return false; - - return true; -} - -void AddSC_go_scripts() -{ - Script *newscript; - - newscript = new Script; - newscript->Name = "go_cat_figurine"; - newscript->pGOHello = &GOHello_go_cat_figurine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_northern_crystal_pylon"; - newscript->pGOHello = &GOHello_go_northern_crystal_pylon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_eastern_crystal_pylon"; - newscript->pGOHello = &GOHello_go_eastern_crystal_pylon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_western_crystal_pylon"; - newscript->pGOHello = &GOHello_go_western_crystal_pylon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_barov_journal"; - newscript->pGOHello = &GOHello_go_barov_journal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_field_repair_bot_74A"; - newscript->pGOHello = &GOHello_go_field_repair_bot_74A; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_gilded_brazier"; - newscript->pGOHello = &GOHello_go_gilded_brazier; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_orb_of_command"; - newscript->pGOHello = &GOHello_go_orb_of_command; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_shrine_of_the_birds"; - newscript->pGOHello = &GOHello_go_shrine_of_the_birds; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_tablet_of_madness"; - newscript->pGOHello = &GOHello_go_tablet_of_madness; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_tablet_of_the_seven"; - newscript->pGOHello = &GOHello_go_tablet_of_the_seven; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_jump_a_tron"; - newscript->pGOHello = &GOHello_go_jump_a_tron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_ethereum_prison"; - newscript->pGOHello = &GOHello_go_ethereum_prison; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_ethereum_stasis"; - newscript->pGOHello = &GOHello_go_ethereum_stasis; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_resonite_cask"; - newscript->pGOHello = &GOHello_go_resonite_cask; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_sacred_fire_of_life"; - newscript->pGOHello = &GOHello_go_sacred_fire_of_life; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_tele_to_dalaran_crystal"; - newscript->pGOHello = &GOHello_go_tele_to_dalaran_crystal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_tele_to_violet_stand"; - newscript->pGOHello = &GOHello_go_tele_to_violet_stand; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp deleted file mode 100644 index f103dc86cdc..00000000000 --- a/src/bindings/scripts/scripts/item/item_scripts.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Item_Scripts -SD%Complete: 100 -SDComment: Items for a range of different items. See content below (in script) -SDCategory: Items -EndScriptData */ - -/* ContentData -item_draenei_fishing_net(i23654) Hacklike implements chance to spawn item or creature -item_nether_wraith_beacon(i31742) Summons creatures for quest Becoming a Spellfire Tailor (q10832) -item_flying_machine(i34060,i34061) Engineering crafted flying machines -item_gor_dreks_ointment(i30175) Protecting Our Own(q10488) -item_only_for_flight Items which should only useable while flying -EndContentData */ - -#include "precompiled.h" -#include "Spell.h" - -/*##### -# item_only_for_flight -#####*/ - -enum -{ - SPELL_ARCANE_CHARGES = 45072 -}; - -bool ItemUse_item_only_for_flight(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) -{ - uint32 itemId = _Item->GetEntry(); - bool disabled = 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; - } - - // allow use in flight only - if (pPlayer->isInFlight() && !disabled) - return false; - - // error - pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,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* _Item, SpellCastTargets const& targets) -{ - //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) - { - if (rand()%100 < 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 - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 23614, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = pPlayer->StoreNewItem(dest,23614,true); - if (item) - pPlayer->SendNewItem(item,1,false,true); - }else - pPlayer->SendEquipError(msg,NULL,NULL); - } - } - //} - return false; -} - -/*##### -# item_nether_wraith_beacon -#####*/ - -bool ItemUse_item_nether_wraith_beacon(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) -{ - 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; -} - -/*##### -# item_flying_machine -#####*/ - -bool ItemUse_item_flying_machine(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) -{ - uint32 itemId = _Item->GetEntry(); - if (itemId == 34060) - if (pPlayer->GetBaseSkillValue(SKILL_RIDING) >= 225) - return false; - - if (itemId == 34061) - if (pPlayer->GetBaseSkillValue(SKILL_RIDING) == 300) - return false; - - debug_log("TSCR: Player attempt to use item %u, but did not meet riding requirement",itemId); - pPlayer->SendEquipError(EQUIP_ERR_ERR_CANT_EQUIP_SKILL,_Item,NULL); - return true; -} - -/*##### -# item_gor_dreks_ointment -#####*/ - -bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* _Item, 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,_Item,NULL); - return true; -} - -/*##### -# item_incendiary_explosives -#####*/ - -bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) -{ - if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15)) - { - return false; - } - else - { - pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,_Item,NULL); - return true; - } -} - -/*##### -# item_mysterious_egg -#####*/ - -bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * _ItemProto) -{ - 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; -} - -/*##### -# item_disgusting_jar -#####*/ - -bool ItemExpire_item_disgusting_jar(Player* pPlayer, ItemPrototype const * _ItemProto) -{ - 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; -} - -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(); -} - diff --git a/src/bindings/scripts/scripts/item/item_test.cpp b/src/bindings/scripts/scripts/item/item_test.cpp deleted file mode 100644 index 0c2d9ac2793..00000000000 --- a/src/bindings/scripts/scripts/item/item_test.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2006 - 2008 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Item_Test -SD%Complete: 100 -SDComment: Used for Testing Item Scripts -SDCategory: Items -EndScriptData */ - -#include "precompiled.h" - -extern void LoadDatabase(); - -bool ItemUse_item_test(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) -{ - LoadDatabase(); - return true; -} - -void AddSC_item_test() -{ - Script *newscript; - - newscript = new Script; - newscript->Name="item_test"; - newscript->pItemUse = &ItemUse_item_test; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp b/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp deleted file mode 100644 index 8a99ea7fc7a..00000000000 --- a/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Npc_Innkeeper -SD%Complete: 50 -SDComment: This script are currently not in use. EventSystem cannot be used on Windows build of SD2 -SDCategory: NPCs -EndScriptData */ - -#include "precompiled.h" - -#define HALLOWEEN_EVENTID 12 -#define SPELL_TRICK_OR_TREATED 24755 -#define SPELL_TREAT 24715 - -#define LOCALE_TRICK_OR_TREAT_0 "Trick or Treat!" -#define LOCALE_TRICK_OR_TREAT_2 "Des bonbons ou des blagues!" -#define LOCALE_TRICK_OR_TREAT_3 "Süßes oder Saures!" -#define LOCALE_TRICK_OR_TREAT_6 "¡Truco o trato!" - -bool isEventActive() -{ - /* - const GameEvent::ActiveEvents *ActiveEventsList = gameeventmgr.GetActiveEventList(); - GameEvent::ActiveEvents::const_iterator itr; - for (itr = ActiveEventsList->begin(); itr != ActiveEventsList->end(); ++itr) - { - if (*itr==HALLOWEEN_EVENTID) - { - return true; - } - }*/ - return false; -} - -bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (isEventActive()&& !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) - { - char* localizedEntry; - switch (pPlayer->GetSession()->GetSessionDbLocaleIndex()) - { - case 0: - localizedEntry=LOCALE_TRICK_OR_TREAT_0; - break; - case 2: - localizedEntry=LOCALE_TRICK_OR_TREAT_2; - break; - case 3: - localizedEntry=LOCALE_TRICK_OR_TREAT_3; - break; - case 6: - localizedEntry=LOCALE_TRICK_OR_TREAT_6; - break; - 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->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), 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() && !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true); - - // either trick or treat, 50% chance - if (rand()%2) - { - pPlayer->CastSpell(pPlayer, SPELL_TREAT, true); - } - else - { - int32 trickspell=0; - switch (rand()%9) // note that female characters can get male costumes and vice versa - { - case 0: - trickspell=24753; // cannot cast, random 30sec - break; - case 1: - trickspell=24713; // lepper gnome costume - break; - case 2: - trickspell=24735; // male ghost costume - break; - case 3: - trickspell=24736; // female ghostcostume - break; - case 4: - trickspell=24710; // male ninja costume - break; - case 5: - trickspell=24711; // female ninja costume - break; - case 6: - trickspell=24708; // male pirate costume - break; - case 7: - trickspell=24709; // female pirate costume - break; - case 8: - trickspell=24723; // skeleton costume - break; - } - pPlayer->CastSpell(pPlayer, trickspell, true); - } - return true; // prevent Trinity core handling - } - return false; // the player didn't select "trick or treat" or cheated, normal core handling -} - -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(); -} - diff --git a/src/bindings/scripts/scripts/npc/npc_professions.cpp b/src/bindings/scripts/scripts/npc/npc_professions.cpp deleted file mode 100644 index 07b40555fd5..00000000000 --- a/src/bindings/scripts/scripts/npc/npc_professions.cpp +++ /dev/null @@ -1,1342 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Npc_Professions -SD%Complete: 80 -SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering, re-learn leatherworking. -SDCategory: NPCs -EndScriptData */ - -#include "precompiled.h" - -/* -A few notes for future developement: -- A full implementation of gossip for GO's is required. They must have the same scripting capabilities as creatures. Basically, -there is no difference here (except that default text is chosen with `gameobject_template`.`data3` (for GO type2, different dataN for a few others) -- It's possible blacksmithing still require some tweaks and adjustments due to the way we _have_ to use reputation. -*/ - -/* --- UPDATE `gameobject_template` SET `ScriptName` = 'go_soothsaying_for_dummies' WHERE `entry` = 177226; -*/ - -/*### -# to be removed from here (->ncp_text). This is data for database projects. -###*/ -#define TALK_MUST_UNLEARN_WEAPON "You must forget your weapon type specialty before I can help you. Go to Everlook in Winterspring and seek help there." - -#define TALK_HAMMER_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the hammersmith." -#define TALK_AXE_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the axesmith." -#define TALK_SWORD_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the swordsmith." - -#define TALK_HAMMER_UNLEARN "Forgetting your Hammersmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Hammersmithing to create!" -#define TALK_AXE_UNLEARN "Forgetting your Axesmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Axesmithing to create!" -#define TALK_SWORD_UNLEARN "Forgetting your Swordsmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Swordsmithing to create!" - -/*### -# generic defines -###*/ - -#define GOSSIP_SENDER_LEARN 50 -#define GOSSIP_SENDER_UNLEARN 51 -#define GOSSIP_SENDER_CHECK 52 - -/*### -# gossip item and box texts -###*/ - -#define GOSSIP_LEARN_POTION "Please teach me how to become a Master of Potions, Lauranna" -#define GOSSIP_UNLEARN_POTION "I wish to unlearn Potion Mastery" -#define GOSSIP_LEARN_TRANSMUTE "Please teach me how to become a Master of Transmutations, Zarevhi" -#define GOSSIP_UNLEARN_TRANSMUTE "I wish to unlearn Transmutation Mastery" -#define GOSSIP_LEARN_ELIXIR "Please teach me how to become a Master of Elixirs, Lorokeem" -#define GOSSIP_UNLEARN_ELIXIR "I wish to unlearn Elixir Mastery" - -#define BOX_UNLEARN_ALCHEMY_SPEC "Do you really want to unlearn your alchemy specialty and lose all associated recipes? \n Cost: " - -#define GOSSIP_WEAPON_LEARN "Please teach me how to become a Weaponsmith" -#define GOSSIP_WEAPON_UNLEARN "I wish to unlearn the art of Weaponsmithing" -#define GOSSIP_ARMOR_LEARN "Please teach me how to become a Armorsmith" -#define GOSSIP_ARMOR_UNLEARN "I wish to unlearn the art of Armorsmithing" - -#define GOSSIP_UNLEARN_SMITH_SPEC "I wish to unlearn my blacksmith specialty" -#define BOX_UNLEARN_ARMORORWEAPON "Do you really want to unlearn your blacksmith specialty and lose all associated recipes? \n Cost: " - -#define GOSSIP_LEARN_HAMMER "Please teach me how to become a Hammersmith, Lilith" -#define GOSSIP_UNLEARN_HAMMER "I wish to unlearn Hammersmithing" -#define GOSSIP_LEARN_AXE "Please teach me how to become a Axesmith, Kilram" -#define GOSSIP_UNLEARN_AXE "I wish to unlearn Axesmithing" -#define GOSSIP_LEARN_SWORD "Please teach me how to become a Swordsmith, Seril" -#define GOSSIP_UNLEARN_SWORD "I wish to unlearn Swordsmithing" - -#define BOX_UNLEARN_WEAPON_SPEC "Do you really want to unlearn your weaponsmith specialty and lose all associated recipes? \n Cost: " - -#define GOSSIP_LEARN_DRAGON "I am absolutely certain that i want to learn dragonscale leatherworking" -#define GOSSIP_UNLEARN_DRAGON "I wish to unlearn Dragonscale Leatherworking" -#define GOSSIP_LEARN_ELEMENTAL "I am absolutely certain that i want to learn elemental leatherworking" -#define GOSSIP_UNLEARN_ELEMENTAL "I wish to unlearn Elemental Leatherworking" -#define GOSSIP_LEARN_TRIBAL "I am absolutely certain that i want to learn tribal leatherworking" -#define GOSSIP_UNLEARN_TRIBAL "I wish to unlearn Tribal Leatherworking" - -#define BOX_UNLEARN_LEATHER_SPEC "Do you really want to unlearn your leatherworking specialty and lose all associated recipes? \n Cost: " - -#define GOSSIP_LEARN_SPELLFIRE "Please teach me how to become a Spellcloth tailor" -#define GOSSIP_UNLEARN_SPELLFIRE "I wish to unlearn Spellfire Tailoring" -#define GOSSIP_LEARN_MOONCLOTH "Please teach me how to become a Mooncloth tailor" -#define GOSSIP_UNLEARN_MOONCLOTH "I wish to unlearn Mooncloth Tailoring" -#define GOSSIP_LEARN_SHADOWEAVE "Please teach me how to become a Shadoweave tailor" -#define GOSSIP_UNLEARN_SHADOWEAVE "I wish to unlearn Shadoweave Tailoring" - -#define BOX_UNLEARN_TAILOR_SPEC "Do you really want to unlearn your tailoring specialty and lose all associated recipes? \n Cost: " - -#define GOSSIP_LEARN_GOBLIN "I am absolutely certain that i want to learn Goblin engineering" -#define GOSSIP_LEARN_GNOMISH "I am absolutely certain that i want to learn Gnomish engineering" - -/*### -# spells defines -###*/ - -#define S_WEAPON 9787 -#define S_ARMOR 9788 -#define S_HAMMER 17040 -#define S_AXE 17041 -#define S_SWORD 17039 - -#define S_LEARN_WEAPON 9789 -#define S_LEARN_ARMOR 9790 -#define S_LEARN_HAMMER 39099 -#define S_LEARN_AXE 39098 -#define S_LEARN_SWORD 39097 - -#define S_UNLEARN_WEAPON 36436 -#define S_UNLEARN_ARMOR 36435 -#define S_UNLEARN_HAMMER 36441 -#define S_UNLEARN_AXE 36439 -#define S_UNLEARN_SWORD 36438 - -#define S_REP_ARMOR 17451 -#define S_REP_WEAPON 17452 - -#define REP_ARMOR 46 -#define REP_WEAPON 289 -#define REP_HAMMER 569 -#define REP_AXE 570 -#define REP_SWORD 571 - -#define S_DRAGON 10656 -#define S_ELEMENTAL 10658 -#define S_TRIBAL 10660 - -#define S_LEARN_DRAGON 10657 -#define S_LEARN_ELEMENTAL 10659 -#define S_LEARN_TRIBAL 10661 - -#define S_UNLEARN_DRAGON 36434 -#define S_UNLEARN_ELEMENTAL 36328 -#define S_UNLEARN_TRIBAL 36433 - -#define S_GOBLIN 20222 -#define S_GNOMISH 20219 - -#define S_LEARN_GOBLIN 20221 -#define S_LEARN_GNOMISH 20220 - -#define S_SPELLFIRE 26797 -#define S_MOONCLOTH 26798 -#define S_SHADOWEAVE 26801 - -#define S_LEARN_SPELLFIRE 26796 -#define S_LEARN_MOONCLOTH 26799 -#define S_LEARN_SHADOWEAVE 26800 - -#define S_UNLEARN_SPELLFIRE 41299 -#define S_UNLEARN_MOONCLOTH 41558 -#define S_UNLEARN_SHADOWEAVE 41559 - -#define S_TRANSMUTE 28672 -#define S_ELIXIR 28677 -#define S_POTION 28675 - -#define S_LEARN_TRANSMUTE 28674 -#define S_LEARN_ELIXIR 28678 -#define S_LEARN_POTION 28676 - -#define S_UNLEARN_TRANSMUTE 41565 -#define S_UNLEARN_ELIXIR 41564 -#define S_UNLEARN_POTION 41563 - -/*### -# formulas to calculate unlearning cost -###*/ - -int32 DoLearnCost(Player* pPlayer) //tailor, alchemy -{ - return 200000; -} - -int32 DoHighUnlearnCost(Player* pPlayer) //tailor, alchemy -{ - return 1500000; -} - -int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork -{ - uint32 level = pPlayer->getLevel(); - if (level < 51) - return 250000; - else if (level < 66) - return 500000; - else - return 1000000; -} - -int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith -{ - uint32 level = pPlayer->getLevel(); - if (level < 66) - return 50000; - else - return 100000; -} - -/*### -# unlearning related profession spells -###*/ - -bool EquippedOk(Player* pPlayer, uint32 spellId) -{ - SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId); - - if (!spell) - return false; - - for(uint8 i=0; i<3; ++i) - { - uint32 reqSpell = spell->EffectTriggerSpell[i]; - if (!reqSpell) - continue; - - Item* pItem; - for(uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; j++) - { - pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, j); - if (pItem) - if (pItem->GetProto()->RequiredSpell == reqSpell) - { - //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first - debug_log("TSCR: player attempt to unlearn spell %u, but item %u is equipped.",reqSpell,pItem->GetProto()->ItemId); - return false; - } - } - } - return true; -} - -void ProfessionUnlearnSpells(Player* pPlayer, uint32 type) -{ - switch (type) - { - case 36436: // S_UNLEARN_WEAPON - pPlayer->removeSpell(36125); // Light Earthforged Blade - pPlayer->removeSpell(36128); // Light Emberforged Hammer - pPlayer->removeSpell(36126); // Light Skyforged Axe - break; - case 36435: // S_UNLEARN_ARMOR - pPlayer->removeSpell(36122); // Earthforged Leggings - pPlayer->removeSpell(36129); // Heavy Earthforged Breastplate - pPlayer->removeSpell(36130); // Stormforged Hauberk - pPlayer->removeSpell(34533); // Breastplate of Kings - pPlayer->removeSpell(34529); // Nether Chain Shirt - pPlayer->removeSpell(34534); // Bulwark of Kings - pPlayer->removeSpell(36257); // Bulwark of the Ancient Kings - pPlayer->removeSpell(36256); // Embrace of the Twisting Nether - pPlayer->removeSpell(34530); // Twisting Nether Chain Shirt - pPlayer->removeSpell(36124); // Windforged Leggings - break; - case 36441: // S_UNLEARN_HAMMER - pPlayer->removeSpell(36262); // Dragonstrike - pPlayer->removeSpell(34546); // Dragonmaw - pPlayer->removeSpell(34545); // Drakefist Hammer - pPlayer->removeSpell(36136); // Lavaforged Warhammer - pPlayer->removeSpell(34547); // Thunder - pPlayer->removeSpell(34567); // Deep Thunder - pPlayer->removeSpell(36263); // Stormherald - pPlayer->removeSpell(36137); // Great Earthforged Hammer - break; - case 36439: // S_UNLEARN_AXE - pPlayer->removeSpell(36260); // Wicked Edge of the Planes - pPlayer->removeSpell(34562); // Black Planar Edge - pPlayer->removeSpell(34541); // The Planar Edge - pPlayer->removeSpell(36134); // Stormforged Axe - pPlayer->removeSpell(36135); // Skyforged Great Axe - pPlayer->removeSpell(36261); // Bloodmoon - pPlayer->removeSpell(34543); // Lunar Crescent - pPlayer->removeSpell(34544); // Mooncleaver - break; - case 36438: // S_UNLEARN_SWORD - pPlayer->removeSpell(36258); // Blazefury - pPlayer->removeSpell(34537); // Blazeguard - pPlayer->removeSpell(34535); // Fireguard - pPlayer->removeSpell(36131); // Windforged Rapier - pPlayer->removeSpell(36133); // Stoneforged Claymore - pPlayer->removeSpell(34538); // Lionheart Blade - pPlayer->removeSpell(34540); // Lionheart Champion - pPlayer->removeSpell(36259); // Lionheart Executioner - break; - case 36434: // S_UNLEARN_DRAGON - pPlayer->removeSpell(36076); // Dragonstrike Leggings - pPlayer->removeSpell(36079); // Golden Dragonstrike Breastplate - pPlayer->removeSpell(35576); // Ebon Netherscale Belt - pPlayer->removeSpell(35577); // Ebon Netherscale Bracers - pPlayer->removeSpell(35575); // Ebon Netherscale Breastplate - pPlayer->removeSpell(35582); // Netherstrike Belt - pPlayer->removeSpell(35584); // Netherstrike Bracers - pPlayer->removeSpell(35580); // Netherstrike Breastplate - break; - case 36328: // S_UNLEARN_ELEMENTAL - pPlayer->removeSpell(36074); // Blackstorm Leggings - pPlayer->removeSpell(36077); // Primalstorm Breastplate - pPlayer->removeSpell(35590); // Primalstrike Belt - pPlayer->removeSpell(35591); // Primalstrike Bracers - pPlayer->removeSpell(35589); // Primalstrike Vest - break; - case 36433: // S_UNLEARN_TRIBAL - pPlayer->removeSpell(35585); // Windhawk Hauberk - pPlayer->removeSpell(35587); // Windhawk Belt - pPlayer->removeSpell(35588); // Windhawk Bracers - pPlayer->removeSpell(36075); // Wildfeather Leggings - pPlayer->removeSpell(36078); // Living Crystal Breastplate - break; - case 41299: // S_UNLEARN_SPELLFIRE - pPlayer->removeSpell(26752); // Spellfire Belt - pPlayer->removeSpell(26753); // Spellfire Gloves - pPlayer->removeSpell(26754); // Spellfire Robe - break; - case 41558: // S_UNLEARN_MOONCLOTH - pPlayer->removeSpell(26760); // Primal Mooncloth Belt - pPlayer->removeSpell(26761); // Primal Mooncloth Shoulders - pPlayer->removeSpell(26762); // Primal Mooncloth Robe - break; - case 41559: // S_UNLEARN_SHADOWEAVE - pPlayer->removeSpell(26756); // Frozen Shadoweave Shoulders - pPlayer->removeSpell(26757); // Frozen Shadoweave Boots - pPlayer->removeSpell(26758); // Frozen Shadoweave Robe - break; - } -} - -/*### -# start menues alchemy -###*/ - -bool HasAlchemySpell(Player* pPlayer) -{ - if (pPlayer->HasSpell(S_TRANSMUTE) || pPlayer->HasSpell(S_ELIXIR) || pPlayer->HasSpell(S_POTION)) - return true; - return false; -} - -bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) -{ - 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) - { - if (pPlayer->GetQuestRewardStatus(10899) || pPlayer->GetQuestRewardStatus(10902) || pPlayer->GetQuestRewardStatus(10897)) - { - 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(pCreature->GetNpcTextId(), 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; - } -} - -void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) - { - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -bool GossipSelect_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) - { - 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; - } - return true; -} - -/*### -# start menues blacksmith -###*/ - -bool HasWeaponSub(Player* pPlayer) -{ - if (pPlayer->HasSpell(S_HAMMER) || pPlayer->HasSpell(S_AXE) || pPlayer->HasSpell(S_SWORD)) - return true; - return false; -} - -bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) -{ - 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) - { - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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->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->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->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->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->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->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->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->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) - { - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction) - { - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -bool GossipSelect_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) - { - 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; - } - 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 -###*/ - -enum -{ - NPC_ZAP = 14742, - NPC_JHORDY = 14743, - NPC_KABLAM = 21493, - NPC_SMILES = 21494, - - SPELL_LEARN_TO_EVERLOOK = 23490, - SPELL_LEARN_TO_GADGET = 23491, - SPELL_LEARN_TO_AREA52 = 36956, - SPELL_LEARN_TO_TOSHLEY = 36957, - - SPELL_TO_EVERLOOK = 23486, - SPELL_TO_GADGET = 23489, - SPELL_TO_AREA52 = 36954, - SPELL_TO_TOSHLEY = 36955, - - ITEM_GNOMISH_CARD = 10790, - ITEM_GOBLIN_CARD = 10791 -}; - -#define GOSSIP_ITEM_ZAP "[PH] Unknown" -#define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!" -#define GOSSIP_ITEM_KABLAM "[PH] Unknown" -#define GOSSIP_ITEM_SMILES "[PH] Unknown" - -bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature) -{ - uint32 NpcTextId = 0; - std::string GossipItem; - bool CanLearn = false; - - if (pPlayer->HasSkill(SKILL_ENGINERING)) - { - switch(pCreature->GetEntry()) - { - case NPC_ZAP: - NpcTextId = 7249; - if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GOBLIN)) - { - if (!pPlayer->HasSpell(SPELL_TO_EVERLOOK)) - { - CanLearn = true; - GossipItem = GOSSIP_ITEM_ZAP; - } - 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)) - { - CanLearn = true; - GossipItem = GOSSIP_ITEM_JHORDY; - } - 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)) - { - CanLearn = true; - GossipItem = GOSSIP_ITEM_KABLAM; - } - 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)) - { - CanLearn = true; - GossipItem = GOSSIP_ITEM_SMILES; - } - else if (pPlayer->HasSpell(SPELL_TO_TOSHLEY)) - NpcTextId = 0; - } - 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 : pCreature->GetNpcTextId(), pCreature->GetGUID()); - 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(); - - 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) -{ - 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) - { - 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; -} - -void SendActionMenu_npc_prof_leather(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; - //Unlearn Leather - case GOSSIP_ACTION_INFO_DEF + 1: - if (EquippedOk(pPlayer,S_UNLEARN_DRAGON)) - { - 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->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->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->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->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->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) - { - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -bool GossipSelect_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) - { - 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; - } - return true; -} - -/*### -# start menues tailoring -###*/ - -bool HasTailorSpell(Player* pPlayer) -{ - if (pPlayer->HasSpell(S_MOONCLOTH) || pPlayer->HasSpell(S_SHADOWEAVE) || pPlayer->HasSpell(S_SPELLFIRE)) - return true; - return false; -} - -bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) -{ - 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) - { - if (pPlayer->GetQuestRewardStatus(10831) || pPlayer->GetQuestRewardStatus(10832) || pPlayer->GetQuestRewardStatus(10833)) - { - 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; -} - -void SendActionMenu_npc_prof_tailor(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 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)) - { - 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 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 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - break; - } - } -} - -bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) - { - 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; - } - 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; -}*/ - -/*### -# -###*/ - -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();*/ -} - diff --git a/src/bindings/scripts/scripts/npc/npc_taxi.cpp b/src/bindings/scripts/scripts/npc/npc_taxi.cpp deleted file mode 100644 index 161b663fbb1..00000000000 --- a/src/bindings/scripts/scripts/npc/npc_taxi.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Npc_Taxi -SD%Complete: 0% -SDComment: To be used for taxi NPCs that are located globally. -SDCategory: NPCs -EndScriptData -*/ - -#include "precompiled.h" - -bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - switch(pCreature->GetEntry()) { - case 17435: // Azuremyst Isle - Susurrus - if (pPlayer->HasItemCount(23843,1,true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am ready.", 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, "I'm ready to fly! Take me up, dragon!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - break; - case 18725: // Old Hillsbrad Foothills - Brazen - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am ready to go to Durnholde Keep.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - break; - case 29154: // Stormwind City - Thargold Ironwing - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'd like to take a flight around Stormwind Harbor.", 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, "Fly me to Murketh and Shaadraz Gateways", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - - //Shatter Point - if (!pPlayer->GetQuestRewardStatus(10340)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Shatter Point", 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, "Fly me to The Abyssal Shelf", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - - //Go to the Front - if (pPlayer->GetQuestStatus(10382) != QUEST_STATUS_NONE && !pPlayer->GetQuestRewardStatus(10382)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Honor Point", 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, "Fly me to Murketh and Shaadraz Gateways", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); - - //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, "Fly me to The Abyssal Shelf", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - - //Spinebreaker Post - if (pPlayer->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(10242)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Spinebreaker Post", 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, "Fly me to Skettis please", 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, "Speaking of uiAction, I've been ordered to undertake an air strike.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - - if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I need to intercept the Dawnblade reinforcements.", 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_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, "Fly me to Manaforge Coruu please", 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, "Fly me to Ogri'la please", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16); - break; - case 27575: // Dragonblight - Lord Afrasastrasz - // middle -> ground - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to take a flight to the ground, Lord Of Afrasastrasz.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17); - // middle -> top - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "My Lord, I must go to the upper floor of the temple.", 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, "My Lord, I must go to the upper floor of the temple.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 19); - // ground -> middle - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Can you spare a drake to travel to Lord Of Afrasastrasz, in the middle of the temple?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); - break; - case 26949: // Dragonblight - Torastrasza - // top -> middle - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to see Lord Of Afrasastrasz, in the middle of the temple.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - // top -> ground - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Yes, Please. I would like to return to the ground floor of the temple.", 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, "I need to fly to the Windrunner Official business!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - if (pPlayer->GetQuestStatus(11170) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I need to commandeer a riding bat for special assignment for us.", 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_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+25); - break; - } - - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - return true; -} - -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->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(534); //TaxiPath 534 - } - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->GetSession()->SendDoFlight(1149, 1041); - 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); - break; - case GOSSIP_ACTION_INFO_DEF + 25: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,42295,true); - break; - } - - 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(); -} diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp deleted file mode 100644 index 64f89628528..00000000000 --- a/src/bindings/scripts/scripts/npc/npcs_special.cpp +++ /dev/null @@ -1,1965 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Npcs_Special -SD%Complete: 100 -SDComment: To be used for special NPCs that are located globally. -SDCategory: NPCs -EndScriptData -*/ - -/* ContentData -npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell -npc_chicken_cluck 100% support for quest 3861 (Cluck!) -npc_dancing_flames 100% midsummer event NPC -npc_guardian 100% guardianAI used to prevent players from accessing off-limits areas. Not in use by SD2 -npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 -npc_injured_patient 100% patients for triage-quests (6622 and 6624) -npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 and 6624 (Triage) -npc_kingdom_of_dalaran_quests Misc NPC's gossip option related to quests 12791, 12794 and 12796 -npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy -npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 -npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given -npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap -EndContentData */ - -#include "precompiled.h" -#include "../npc/npc_escortAI.h" -#include "ObjectMgr.h" - -/*######## -# npc_air_force_bots -#########*/ - -enum SpawnType -{ - SPAWNTYPE_TRIPWIRE_ROOFTOP, // no warning, summon Creature at smaller range - SPAWNTYPE_ALARMBOT, // cast guards mark and summon npc - if player shows up with that buff duration < 5 seconds attack -}; - -struct SpawnAssociation -{ - uint32 m_uiThisCreatureEntry; - uint32 m_uiSpawnedCreatureEntry; - SpawnType m_SpawnType; -}; - -enum -{ - SPELL_GUARDS_MARK = 38067, - AURA_DURATION_TIME_LEFT = 5000 -}; - -const float RANGE_TRIPWIRE = 15.0f; -const float RANGE_GUARDS_MARK = 50.0f; - -SpawnAssociation m_aSpawnAssociations[] = -{ - {2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance) - {2615, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Horde) - {21974, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Area 52) - {21993, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Horde - Bat Rider) - {21996, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Alliance - Gryphon) - {21997, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Goblin - Area 52 - Zeppelin) - {21999, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Alliance) - {22001, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Horde) - {22002, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Horde) - {22003, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Alliance) - {22063, 21976, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Goblin - Area 52) - {22065, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Ethereal - Stormspire) - {22066, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Scryer - Dragonhawk) - {22068, 22064, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Ethereal - Stormspire) - {22069, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Stormspire) - {22070, 22067, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Scryer) - {22071, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Scryer) - {22078, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Aldor) - {22079, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Aldor - Gryphon) - {22080, 22077, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Aldor) - {22086, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Sporeggar) - {22087, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Sporeggar - Spore Bat) - {22088, 22085, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Sporeggar) - {22090, 22089, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Toshley's Station - Flying Machine) - {22124, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Cenarion) - {22125, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Cenarion - Stormcrow) - {22126, 22122, SPAWNTYPE_ALARMBOT} //Air Force Trip Wire - Rooftop (Cenarion Expedition) -}; - -struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI -{ - 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); - - for (uint8 i=0; iGetEntry()) - { - m_pSpawnAssoc = &m_aSpawnAssociations[i]; - break; - } - } - - if (!m_pSpawnAssoc) - error_db_log("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) - { - m_pSpawnAssoc = NULL; - error_db_log("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() { } - - Creature* SummonGuard() - { - Creature* pSummoned = m_creature->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); - - if (pSummoned) - m_uiSpawnedGUID = pSummoned->GetGUID(); - else - { - error_db_log("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - m_pSpawnAssoc = NULL; - } - - return pSummoned; - } - - Creature* GetSummonedGuard() - { - Creature* pCreature = Unit::GetCreature(*m_creature, m_uiSpawnedGUID); - - if (pCreature && pCreature->isAlive()) - return pCreature; - - return NULL; - } - - void MoveInLineOfSight(Unit* pWho) - { - if (!m_pSpawnAssoc) - return; - - if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) - { - Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; - - // airforce guards only spawn for players - if (!pPlayerTarget) - return; - - Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); - - // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup - if (!pLastSpawnedGuard) - m_uiSpawnedGUID = 0; - - switch(m_pSpawnAssoc->m_SpawnType) - { - case SPAWNTYPE_ALARMBOT: - { - if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) - return; - - Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0); - if (pMarkAura) - { - // the target wasn't able to move out of our range within 25 seconds - if (!pLastSpawnedGuard) - { - pLastSpawnedGuard = SummonGuard(); - - if (!pLastSpawnedGuard) - return; - } - - if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT) - { - if (!pLastSpawnedGuard->getVictim()) - pLastSpawnedGuard->AI()->AttackStart(pWho); - } - } - else - { - if (!pLastSpawnedGuard) - pLastSpawnedGuard = SummonGuard(); - - if (!pLastSpawnedGuard) - return; - - pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); - } - break; - } - case SPAWNTYPE_TRIPWIRE_ROOFTOP: - { - if (!pWho->IsWithinDistInMap(m_creature, 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); - } - break; - } - } - } - } -}; - -CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) -{ - return new npc_air_force_botsAI(pCreature); -} - -/*######## -# npc_chicken_cluck -#########*/ - -#define EMOTE_HELLO -1070004 -#define EMOTE_CLUCK_TEXT -1070006 - -#define QUEST_CLUCK 3861 -#define FACTION_FRIENDLY 35 -#define FACTION_CHICKEN 31 - -struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI -{ - npc_chicken_cluckAI(Creature *c) : ScriptedAI(c) {} - - uint32 ResetFlagTimer; - - void Reset() - { - ResetFlagTimer = 120000; - m_creature->setFaction(FACTION_CHICKEN); - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - } - - void EnterCombat(Unit *who) {} - - 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 (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) - { - if (ResetFlagTimer < diff) - { - EnterEvadeMode(); - return; - }else ResetFlagTimer -= diff; - } - - if (UpdateVictim()) - DoMeleeAttackIfReady(); - } - - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - switch(emote) - { - case TEXTEMOTE_CHICKEN: - if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) - { - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_HELLO, m_creature); - } - break; - case TEXTEMOTE_CHEER: - if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) - { - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_CLUCK_TEXT, m_creature); - } - break; - } - } -}; - -CreatureAI* GetAI_npc_chicken_cluck(Creature* pCreature) -{ - return new npc_chicken_cluckAI(pCreature); -} - -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(); - - return true; -} - -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; -} - -/*###### -## npc_dancing_flames -######*/ - -#define SPELL_BRAZIER 45423 -#define SPELL_SEDUCTION 47057 -#define SPELL_FIERY_AURA 45427 - -struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI -{ - npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {} - - bool active; - uint32 can_iteract; - - void Reset() - { - active = true; - can_iteract = 3500; - DoCast(m_creature,SPELL_BRAZIER,true); - DoCast(m_creature,SPELL_FIERY_AURA,false); - float x, y, z; - m_creature->GetPosition(x,y,z); - m_creature->Relocate(x,y,z + 0.94f); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - WorldPacket data; //send update position to client - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); - } - - void UpdateAI(const uint32 diff) - { - if (!active) - { - if (can_iteract <= diff){ - active = true; - can_iteract = 3500; - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - }else can_iteract -= diff; - } - } - - void EnterCombat(Unit* who){} - - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - if (m_creature->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && m_creature->IsWithinDistInMap(pPlayer,30.0f)) - { - m_creature->SetInFront(pPlayer); - active = false; - - WorldPacket data; - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); - switch(emote) - { - case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; - case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXTEMOTE_BOW: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXTEMOTE_JOKE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; - case TEXTEMOTE_DANCE: - { - if (!pPlayer->HasAura(SPELL_SEDUCTION)) - m_creature->CastSpell(pPlayer,SPELL_SEDUCTION,true); - } - break; - } - } - } -}; - -CreatureAI* GetAI_npc_dancing_flames(Creature* pCreature) -{ - return new npc_dancing_flamesAI(pCreature); -} - -/*###### -## Triage quest -######*/ - -#define SAY_DOC1 -1000201 -#define SAY_DOC2 -1000202 -#define SAY_DOC3 -1000203 - -#define DOCTOR_ALLIANCE 12939 -#define DOCTOR_HORDE 12920 -#define ALLIANCE_COORDS 7 -#define HORDE_COORDS 6 - -struct Location -{ - float x, y, z, o; -}; - -static Location AllianceCoords[]= -{ - {-3757.38, -4533.05, 14.16, 3.62}, // Top-far-right bunk as seen from entrance - {-3754.36, -4539.13, 14.16, 5.13}, // Top-far-left bunk - {-3749.54, -4540.25, 14.28, 3.34}, // Far-right bunk - {-3742.10, -4536.85, 14.28, 3.64}, // Right bunk near entrance - {-3755.89, -4529.07, 14.05, 0.57}, // Far-left bunk - {-3749.51, -4527.08, 14.07, 5.26}, // Mid-left bunk - {-3746.37, -4525.35, 14.16, 5.22}, // Left bunk near entrance -}; - -//alliance run to where -#define A_RUNTOX -3742.96 -#define A_RUNTOY -4531.52 -#define A_RUNTOZ 11.91 - -static Location HordeCoords[]= -{ - {-1013.75, -3492.59, 62.62, 4.34}, // Left, Behind - {-1017.72, -3490.92, 62.62, 4.34}, // Right, Behind - {-1015.77, -3497.15, 62.82, 4.34}, // Left, Mid - {-1019.51, -3495.49, 62.82, 4.34}, // Right, Mid - {-1017.25, -3500.85, 62.98, 4.34}, // Left, front - {-1020.95, -3499.21, 62.98, 4.34} // Right, Front -}; - -//horde run to where -#define H_RUNTOX -1016.44 -#define H_RUNTOY -3508.48 -#define H_RUNTOZ 62.96 - -const uint32 AllianceSoldierId[3] = -{ - 12938, // 12938 Injured Alliance Soldier - 12936, // 12936 Badly injured Alliance Soldier - 12937 // 12937 Critically injured Alliance Soldier -}; - -const uint32 HordeSoldierId[3] = -{ - 12923, //12923 Injured Soldier - 12924, //12924 Badly injured Soldier - 12925 //12925 Critically injured Soldier -}; - -/*###### -## npc_doctor (handles both Gustaf Vanhowzen and Gregory Victor) -######*/ - -struct TRINITY_DLL_DECL npc_doctorAI : public ScriptedAI -{ - npc_doctorAI(Creature *c) : ScriptedAI(c) {} - - uint64 PlayerGUID; - - uint32 SummonPatient_Timer; - uint32 SummonPatientCount; - uint32 PatientDiedCount; - uint32 PatientSavedCount; - - bool Event; - - std::list Patients; - std::vector Coordinates; - - void Reset() - { - PlayerGUID = 0; - - SummonPatient_Timer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; - - Patients.clear(); - Coordinates.clear(); - - Event = false; - - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void BeginEvent(Player* pPlayer); - void PatientDied(Location* Point); - void PatientSaved(Creature* soldier, Player* pPlayer, Location* Point); - void UpdateAI(const uint32 diff); - - void EnterCombat(Unit* who){} -}; - -/*##### -## npc_injured_patient (handles all the patients, no matter Horde or Alliance) -#####*/ - -struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI -{ - npc_injured_patientAI(Creature *c) : ScriptedAI(c) {} - - uint64 Doctorguid; - Location* Coord; - - void Reset() - { - Doctorguid = 0; - Coord = NULL; - - //no select - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - //no regen health - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - - //to make them lay with face down - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); - - uint32 mobId = m_creature->GetEntry(); - - switch (mobId) - { //lower max health - case 12923: - case 12938: //Injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.75)); - break; - case 12924: - case 12936: //Badly injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.50)); - break; - case 12925: - case 12937: //Critically injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.25)); - break; - } - } - - void EnterCombat(Unit* who){} - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->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(*m_creature, Doctorguid)) - CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord); - } - } - - //make not selectable - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - //regen health - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - - //stand up - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - - switch(rand()%3) - { - case 0: DoScriptText(SAY_DOC1,m_creature); break; - case 1: DoScriptText(SAY_DOC2,m_creature); break; - case 2: DoScriptText(SAY_DOC3,m_creature); break; - } - - uint32 mobId = m_creature->GetEntry(); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - - switch (mobId) - { - case 12923: - case 12924: - case 12925: - m_creature->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); - break; - case 12936: - case 12937: - case 12938: - m_creature->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); - break; - } - } - } - - void UpdateAI(const uint32 diff) - { - //lower HP on every world tick makes it a useful counter, not officlone though - if (m_creature->isAlive() && m_creature->GetHealth() > 6) - { - m_creature->SetHealth(uint32(m_creature->GetHealth()-5)); - } - - if (m_creature->isAlive() && m_creature->GetHealth() <= 6) - { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->setDeathState(JUST_DIED); - m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, 32); - - if (Doctorguid) - { - if (Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid)) - CAST_AI(npc_doctorAI, Doctor->AI())->PatientDied(Coord); - } - } - } -}; - -CreatureAI* GetAI_npc_injured_patient(Creature* pCreature) -{ - return new npc_injured_patientAI (pCreature); -} - -/* -npc_doctor (continue) -*/ - -void npc_doctorAI::BeginEvent(Player* pPlayer) -{ - PlayerGUID = pPlayer->GetGUID(); - - SummonPatient_Timer = 10000; - SummonPatientCount = 0; - PatientDiedCount = 0; - PatientSavedCount = 0; - - switch(m_creature->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; - } - - Event = true; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -} - -void npc_doctorAI::PatientDied(Location* Point) -{ - Player* pPlayer = Unit::GetPlayer(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; - } - - 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)) - { - ++PatientSavedCount; - - if (PatientSavedCount == 15) - { - if (!Patients.empty()) - { - std::list::iterator itr; - for(itr = Patients.begin(); itr != Patients.end(); ++itr) - { - if (Creature* Patient = Unit::GetCreature((*m_creature), *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 npc_doctorAI::UpdateAI(const uint32 diff) -{ - if (Event && SummonPatientCount >= 20) - { - Reset(); - return; - } - - if (Event) - { - if (SummonPatient_Timer < diff) - { - Creature* Patient = NULL; - Location* Point = NULL; - - if (Coordinates.empty()) - return; - - std::vector::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); - uint32 patientEntry = 0; - - switch(m_creature->GetEntry()) - { - case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; - case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; - default: - error_log("TSCR: Invalid entry for Triage doctor. Please check your database"); - return; - } - - Point = *itr; - - Patient = m_creature->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - - if (Patient) - { - //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) - Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - - Patients.push_back(Patient->GetGUID()); - CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = m_creature->GetGUID(); - - if (Point) - CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point; - - Coordinates.erase(itr); - } - SummonPatient_Timer = 10000; - SummonPatientCount++; - }else SummonPatient_Timer -= 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 -######*/ - -//TODO: get text for each NPC - -enum -{ - SPELL_LESSER_HEAL_R2 = 2052, - SPELL_FORTITUDE_R1 = 1243, - - QUEST_MOON = 5621, - QUEST_LIGHT_1 = 5624, - QUEST_LIGHT_2 = 5625, - QUEST_SPIRIT = 5648, - QUEST_DARKNESS = 5650, - - ENTRY_SHAYA = 12429, - ENTRY_ROBERTS = 12423, - ENTRY_DOLF = 12427, - ENTRY_KORJA = 12430, - ENTRY_DG_KEL = 12428, - - SAY_COMMON_HEALED = -1000164, - SAY_DG_KEL_THANKS = -1000165, - SAY_DG_KEL_GOODBYE = -1000166, - SAY_ROBERTS_THANKS = -1000167, - SAY_ROBERTS_GOODBYE = -1000168, - SAY_KORJA_THANKS = -1000169, - SAY_KORJA_GOODBYE = -1000170, - SAY_DOLF_THANKS = -1000171, - SAY_DOLF_GOODBYE = -1000172, - SAY_SHAYA_THANKS = -1000173, - SAY_SHAYA_GOODBYE = -1000174, -}; - -struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI -{ - npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();} - - uint64 caster; - - bool bIsHealed; - bool bCanRun; - - uint32 RunAwayTimer; - - void Reset() - { - caster = 0; - - bIsHealed = false; - bCanRun = false; - - RunAwayTimer = 5000; - - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); - //expect database to have RegenHealth=0 - m_creature->SetHealth(int(m_creature->GetMaxHealth()*0.7)); - } - - void EnterCombat(Unit *who) {} - - void SpellHit(Unit* pCaster, const SpellEntry *Spell) - { - if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) - { - //not while in combat - if (m_creature->isInCombat()) - return; - - //nothing to be done now - if (bIsHealed && bCanRun) - return; - - if (pCaster->GetTypeId() == TYPEID_PLAYER) - { - switch(m_creature->GetEntry()) - { - 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,m_creature,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,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,m_creature,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,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) - { - DoScriptText(SAY_DOLF_THANKS,m_creature,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,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) - { - DoScriptText(SAY_KORJA_THANKS,m_creature,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,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,m_creature,pCaster); - bCanRun = true; - } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) - { - caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); - bIsHealed = true; - } - } - break; - } - - //give quest credit, not expect any special quest objectives - if (bCanRun) - CAST_PLR(pCaster)->TalkedToCreature(m_creature->GetEntry(),m_creature->GetGUID()); - } - } - } - - void WaypointReached(uint32 uiPoint) - { - } - - void UpdateAI(const uint32 diff) - { - if (bCanRun && !m_creature->isInCombat()) - { - if (RunAwayTimer <= diff) - { - if (Unit *pUnit = Unit::GetUnit(*m_creature,caster)) - { - switch(m_creature->GetEntry()) - { - case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,m_creature,pUnit); break; - case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,m_creature,pUnit); break; - case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,m_creature,pUnit); break; - case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit); break; - case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit); break; - } - - Start(false,true,true); - } - else - EnterEvadeMode(); //something went wrong - - RunAwayTimer = 30000; - }else RunAwayTimer -= diff; - } - - npc_escortAI::UpdateAI(diff); - } -}; - -CreatureAI* GetAI_npc_garments_of_quests(Creature* pCreature) -{ - npc_garments_of_questsAI* tempAI = new npc_garments_of_questsAI(pCreature); - - tempAI->FillPointMovementListForCreature(); - - return tempAI; -} - -/*###### -## npc_guardian -######*/ - -#define SPELL_DEATHTOUCH 5 - -struct TRINITY_DLL_DECL npc_guardianAI : public ScriptedAI -{ - npc_guardianAI(Creature *c) : ScriptedAI(c) {} - - void Reset() - { - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void EnterCombat(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (m_creature->isAttackReady()) - { - m_creature->CastSpell(m_creature->getVictim(),SPELL_DEATHTOUCH, true); - m_creature->resetAttackTimer(); - } - } -}; - -CreatureAI* GetAI_npc_guardian(Creature* pCreature) -{ - return new npc_guardianAI (pCreature); -} - -/*###### -## npc_kingdom_of_dalaran_quests -######*/ - -enum -{ - SPELL_TELEPORT_DALARAN = 53360, - ITEM_KT_SIGNET = 39740, - QUEST_MAGICAL_KINGDOM_A = 12794, - QUEST_MAGICAL_KINGDOM_H = 12791, - QUEST_MAGICAL_KINGDOM_N = 12796 -}; - -#define GOSSIP_ITEM_TELEPORT_TO "I am ready to be teleported to Dalaran." - -bool GossipHello_npc_kingdom_of_dalaran_quests(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); - - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), 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) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer,SPELL_TELEPORT_DALARAN,false); - } - return true; -} - -/*###### -## npc_mount_vendor -######*/ - -bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(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(pCreature->GetNpcTextId(), pCreature->GetGUID()); - } - 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()); - - return true; -} - -/*###### -## npc_rogue_trainer -######*/ - -bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pCreature->isTrainer()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); - - if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "I wish to unlearn my talents", 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_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); - } else - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - 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; - } - return true; -} - -/*###### -## npc_sayge -######*/ - -#define SPELL_DMG 23768 //dmg -#define SPELL_RES 23769 //res -#define SPELL_ARM 23767 //arm -#define SPELL_SPI 23738 //spi -#define SPELL_INT 23766 //int -#define SPELL_STM 23737 //stm -#define SPELL_STR 23735 //str -#define SPELL_AGI 23736 //agi -#define SPELL_FORTUNE 23765 //faire fortune - -bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) -{ - 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 - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Yes", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(7339, pCreature->GetGUID()); - } - - return true; -} - -void SendAction_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Slay the Man", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Turn him over to liege", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Confiscate the corn", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let him go and have the corn", 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, "Execute your friend painfully", GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Execute your friend painlessly", GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let your friend go", 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, "Confront the diplomat", GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Show not so quiet defiance", GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Remain quiet", 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, "Speak against your brother openly", GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Help your brother in", GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Keep your brother out without letting him know", 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, "Take credit, keep gold", GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Take credit, share the gold", GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let the knight take credit", 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, "Thanks", 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) - { - 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; - } - return true; -} - -struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI -{ - npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - void EnterCombat(Unit *who) {} - - void OnPossess(bool apply) - { - if (apply) - { - // Initialize the action bar without the melee attack command - m_creature->InitCharmInfo(); - m_creature->GetCharmInfo()->InitEmptyActionBar(false); - - m_creature->SetReactState(REACT_PASSIVE); - } - else - m_creature->SetReactState(REACT_AGGRESSIVE); - } - -}; - -CreatureAI* GetAI_npc_steam_tonk(Creature* pCreature) -{ - return new npc_steam_tonkAI(pCreature); -} - -#define SPELL_TONK_MINE_DETONATE 25099 - -struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI -{ - npc_tonk_mineAI(Creature *c) : ScriptedAI(c) - { - m_creature->SetReactState(REACT_PASSIVE); - } - - uint32 ExplosionTimer; - - void Reset() - { - ExplosionTimer = 3000; - } - - void EnterCombat(Unit *who) {} - void AttackStart(Unit *who) {} - void MoveInLineOfSight(Unit *who) {} - - void UpdateAI(const uint32 diff) - { - if (ExplosionTimer < diff) - { - m_creature->CastSpell(m_creature, SPELL_TONK_MINE_DETONATE, true); - m_creature->setDeathState(DEAD); // unsummon it - } else - ExplosionTimer -= diff; - } -}; - -CreatureAI* GetAI_npc_tonk_mine(Creature* pCreature) -{ - return new npc_tonk_mineAI(pCreature); -} - -/*#### -## npc_winter_reveler -####*/ - -bool ReceiveEmote_npc_winter_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) -{ - //TODO: check auralist. - if (pPlayer->HasAura(26218)) - return false; - - if (emote == TEXTEMOTE_KISS) - { - pCreature->CastSpell(pCreature, 26218, false); - pPlayer->CastSpell(pPlayer, 26218, false); - switch(rand()%3) - { - case 0: pCreature->CastSpell(pPlayer, 26207, false); break; - case 1: pCreature->CastSpell(pPlayer, 26206, false); break; - case 2: pCreature->CastSpell(pPlayer, 45036, false); break; - } - } - return true; -} - -/*#### -## npc_brewfest_reveler -####*/ - -bool ReceiveEmote_npc_brewfest_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) -{ - if (emote == TEXTEMOTE_DANCE) - pCreature->CastSpell(pPlayer, 41586, false); - - return true; -} - -/*#### -## npc_snake_trap_serpents -####*/ - -#define SPELL_MIND_NUMBING_POISON 8692 //Viper -#define SPELL_DEADLY_POISON 34655 //Venomous Snake -#define SPELL_CRIPPLING_POISON 3409 //Viper - -#define VENOMOUS_SNAKE_TIMER 1200 -#define VIPER_TIMER 3000 - -#define C_VIPER 19921 - -#define RAND 5 - -struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI -{ - npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {} - - uint32 SpellTimer; - bool IsViper; - bool Spawn; - - void EnterCombat(Unit *who) {} - - void Reset() - { - Spawn = true; - SpellTimer = 0; - - CreatureInfo const *Info = m_creature->GetCreatureInfo(); - - if (Info->Entry == C_VIPER) - IsViper = true; - else - IsViper = false; - - //We have to reload the states from db for summoned guardians - m_creature->SetMaxHealth(Info->maxhealth); - m_creature->SetHealth(Info->maxhealth); - m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg); - m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg); - - //Add delta to make them not all hit the same time - uint32 delta = (rand() % 7) *100; - m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); - m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); - } - - //Redefined for random target selection: - void MoveInLineOfSight(Unit *who) - { - if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) - { - if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; - - float attackRadius = m_creature->GetAttackDistance(who); - if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) - { - if (!(rand() % RAND)) - { - m_creature->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); - SpellTimer = (rand() % 10) * 100; - AttackStart(who); - } - } - } - } - - void UpdateAI(const uint32 diff) - { - 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 (!m_creature->getVictim() && m_creature->isSummon()) - if (Unit * Owner = CAST_SUM(m_creature)->GetSummoner()) - if (Owner->getAttackerForHelper()) - AttackStart(Owner->getAttackerForHelper()); - } - - if (!m_creature->getVictim()) - { - if (m_creature->isInCombat()) - DoStopAttack(); - return; - } - - if (SpellTimer < diff) - { - if (IsViper) //Viper - { - if (rand() % 3 == 0) //33% chance to cast - { - uint32 spell; - if (rand() % 2 == 0) - spell = SPELL_MIND_NUMBING_POISON; - else - spell = SPELL_CRIPPLING_POISON; - - DoCast(m_creature->getVictim(),spell); - } - - SpellTimer = VIPER_TIMER; - } - else //Venomous Snake - { - if (rand() % 10 < 8) //80% chance to cast - DoCast(m_creature->getVictim(),SPELL_DEADLY_POISON); - SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; - } - }else SpellTimer-=diff; - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) -{ - return new npc_snake_trap_serpentsAI(pCreature); -} - -struct TRINITY_DLL_DECL mob_mojoAI : public ScriptedAI -{ - mob_mojoAI(Creature *c) : ScriptedAI(c) {Reset();} - uint32 hearts; - uint64 victimGUID; - void Reset() - { - victimGUID = 0; - hearts = 15000; - Unit* own = m_creature->GetOwner(); - if (own) - m_creature->GetMotionMaster()->MoveFollow(own,0,0); - } - void Aggro(Unit *who){} - void UpdateAI(const uint32 diff) - { - if (m_creature->HasAura(20372,0)) - { - if (heartsRemoveAurasDueToSpell(20372); - hearts = 15000; - }hearts-=diff; - } - } - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - m_creature->HandleEmoteCommand(emote); - Unit* own = m_creature->GetOwner(); - if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != pPlayer->GetTeam()) - return; - if (emote == TEXTEMOTE_KISS) - { - std::string whisp = ""; - switch (rand()%8) - { - case 0:whisp.append("Now that's what I call froggy-style!");break; - case 1:whisp.append("Your lily pad or mine?");break; - case 2:whisp.append("This won't take long, did it?");break; - case 3:whisp.append("I thought you'd never ask!");break; - case 4:whisp.append("I promise not to give you warts...");break; - case 5:whisp.append("Feelin' a little froggy, are ya?");break; - case 6: - whisp.append("Listen, "); - whisp.append(pPlayer->GetName()); - whisp.append(", I know of a little swamp not too far from here...."); - break; - case 7:whisp.append("There's just never enough Mojo to go around...");break; - } - m_creature->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); - if (victimGUID) - { - Player* victim = Unit::GetPlayer(victimGUID); - if (victim) - victim->RemoveAura(43906);//remove polymorph frog thing - } - m_creature->AddAura(43906,pPlayer);//add polymorph frog thing - victimGUID = pPlayer->GetGUID(); - m_creature->CastSpell(m_creature,20372,true);//tag.hearts - m_creature->GetMotionMaster()->MoveFollow(pPlayer,0,0); - hearts = 15000; - } - } -}; - -CreatureAI* GetAI_mob_mojo(Creature* pCreature) -{ - return new mob_mojoAI (pCreature); -} - -struct TRINITY_DLL_DECL npc_mirror_image : SpellCasterAI -{ - npc_mirror_image(Creature *c) : SpellCasterAI(c) {} - - void InitializeAI() - { - SpellCasterAI::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, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE); - } - } -}; - -CreatureAI* GetAI_npc_mirror_image(Creature* pCreature) -{ - return new npc_mirror_image (pCreature); -} - -struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : SpellCasterAI -{ - npc_ebon_gargoyleAI(Creature *c) : SpellCasterAI(c) {} - - int despawnTimer; - - void InitializeAI() - { - SpellCasterAI::InitializeAI(); - Unit * owner = me->GetOwner(); - if (!owner) - return; - // Not needed to be despawned now - despawnTimer = 0; - // Find victim of Summon Gargoyle spell - std::list targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); - Trinity::UnitListSearcher searcher(m_creature, targets, u_check); - m_creature->VisitNearbyObject(30, searcher); - for(std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) - if((*iter)->GetAura(49206,owner->GetGUID())) - { - me->Attack((*iter),false); - break; - } - } - - void JustDied(Unit *killer) - { - // Stop Feeding Gargoyle when it dies - if (Unit *owner = me->GetOwner()) - owner->RemoveAurasDueToSpell(50514); - } - - // 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(m_creature, 54661, true); - me->SetReactState(REACT_PASSIVE); - - // Fly Away - me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE); - me->SetSpeed(MOVE_FLIGHT, 0.25f, true); - me->SetSpeed(MOVE_RUN, 0.25f, true); - float x = me->GetPositionX() + 10 * cos(me->GetOrientation()); - float y = me->GetPositionY() + 10 * sin(me->GetOrientation()); - float z = me->GetPositionZ() + 25; - me->GetMotionMaster()->MovePoint(0, x, y, z); - - // Despawn as soon as possible - despawnTimer = 4 * IN_MILISECONDS; - } - - void UpdateAI(const uint32 diff) - { - if (despawnTimer > 0) - { - if (despawnTimer > diff) - despawnTimer -= diff; - else - { - me->ForcedDespawn(); - } - return; - } - SpellCasterAI::UpdateAI(diff); - } -}; - -CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature) -{ - return new npc_ebon_gargoyleAI (pCreature); -} - -//TODO: 30% Attackdamage check for Lightwell -struct TRINITY_DLL_DECL npc_lightwellAI : public PassiveAI -{ - npc_lightwellAI(Creature *c) : PassiveAI(c) {} - - //uint32 desummon_timer; - - void Reset() - { - //desummon_timer = 180000; - m_creature->CastSpell(m_creature, 59907, false); // Spell for Lightwell Charges - } - - /* - void UpdateAI(const uint32 diff) - { - if (desummon_timer < diff) - { - m_creature->Kill(m_creature); - }else desummon_timer -= diff; - - if (!m_creature->HasAura(59907)) - { - m_creature->Kill(m_creature); - } - } - */ -}; - -CreatureAI* GetAI_npc_lightwellAI(Creature* pCreature) -{ - return new npc_lightwellAI (pCreature); -} - -struct TRINITY_DLL_DECL npc_training_dummy : Scripted_NoMovementAI -{ - npc_training_dummy(Creature *c) : Scripted_NoMovementAI(c) {} - - uint32 ResetTimer; - void Reset() - { - m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate - m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave - m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); - ResetTimer = 10000; - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - ResetTimer = 10000; - damage = 0; - } - - void EnterCombat(Unit *who){return;} - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) - m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate - if (ResetTimer <= diff) - { - EnterEvadeMode(); - ResetTimer = 10000; - }else ResetTimer -= diff; - return; - } - void MoveInLineOfSight(Unit *who){return;} -}; - -CreatureAI* GetAI_npc_training_dummy(Creature* pCreature) -{ - return new npc_training_dummy (pCreature); -} - -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_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->pReceiveEmote = &ReceiveEmote_npc_winter_reveler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_brewfest_reveler"; - //newscript->pReceiveEmote = &ReceiveEmote_npc_brewfest_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(); -} - diff --git a/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp b/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp new file mode 100644 index 00000000000..9ed608ce97b --- /dev/null +++ b/src/bindings/scripts/scripts/world/areatrigger_scripts.cpp @@ -0,0 +1,92 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Areatrigger_Scripts +SD%Complete: 100 +SDComment: Scripts for areatriggers +SDCategory: Areatrigger +EndScriptData */ + +/* ContentData +at_legion_teleporter 4560 Teleporter TO Invasion Point: Cataclysm +EndContentData */ + +#include "precompiled.h" + +/*##### +## at_legion_teleporter +#####*/ + +enum +{ + SPELL_TELE_A_TO = 37387, + QUEST_GAINING_ACCESS_A = 10589, + + SPELL_TELE_H_TO = 37389, + QUEST_GAINING_ACCESS_H = 10604 +}; + +bool AreaTrigger_at_legion_teleporter(Player* pPlayer, AreaTriggerEntry* pAt) +{ + if (pPlayer->isAlive() && !pPlayer->isInCombat()) + { + if (pPlayer->GetTeam()== ALLIANCE && pPlayer->GetQuestRewardStatus(QUEST_GAINING_ACCESS_A)) + { + pPlayer->CastSpell(pPlayer,SPELL_TELE_A_TO,false); + return true; + } + + if (pPlayer->GetTeam()== HORDE && pPlayer->GetQuestRewardStatus(QUEST_GAINING_ACCESS_H)) + { + pPlayer->CastSpell(pPlayer,SPELL_TELE_H_TO,false); + return true; + } + + return false; + } + return false; +} + +enum +{ + QUEST_MANOR_RAVENHOLDT = 6681, + NPC_RAVENHOLDT = 13936 +}; + +bool AreaTrigger_at_ravenholdt(Player* pPlayer, AreaTriggerEntry* pAt) +{ + if (pPlayer->GetQuestStatus(QUEST_MANOR_RAVENHOLDT) == QUEST_STATUS_INCOMPLETE) + pPlayer->KilledMonsterCredit(NPC_RAVENHOLDT, 0); + + return false; +} + +void AddSC_areatrigger_scripts() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "at_legion_teleporter"; + newscript->pAreaTrigger = &AreaTrigger_at_legion_teleporter; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "at_ravenholdt"; + newscript->pAreaTrigger = &AreaTrigger_at_ravenholdt; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/world/boss_emeriss.cpp b/src/bindings/scripts/scripts/world/boss_emeriss.cpp new file mode 100644 index 00000000000..9881525e3ad --- /dev/null +++ b/src/bindings/scripts/scripts/world/boss_emeriss.cpp @@ -0,0 +1,146 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Emeriss +SD%Complete: 90 +SDComment: Teleport function & Mark of Nature missing +SDCategory: Bosses +EndScriptData */ + +#include "precompiled.h" + +enum +{ + SAY_AGGRO = -1000401, + SAY_CASTCORRUPTION = -1000402, + + SPELL_SLEEP = 24777, + SPELL_NOXIOUSBREATH = 24818, + SPELL_TAILSWEEP = 15847, + //SPELL_MARKOFNATURE = 25040, // Not working + SPELL_VOLATILEINFECTION = 24928, + SPELL_CORRUPTIONOFEARTH = 24910 +}; + +struct TRINITY_DLL_DECL boss_emerissAI : public ScriptedAI +{ + boss_emerissAI(Creature *c) : ScriptedAI(c) {} + + uint32 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 Aggro(Unit* pWho) + { + DoScriptText(SAY_AGGRO, m_creature); + } + + 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); + + m_uiSleep_Timer = 8000 + rand()%8000; + } + else + m_uiSleep_Timer -= uiDiff; + + //NoxiousBreath_Timer + if (m_uiNoxiousBreath_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; + + //Tailsweep every 2 seconds + if (m_uiTailSweep_Timer < uiDiff) + { + DoCast(m_creature, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; + + //MarkOfNature_Timer + //if (m_uiMarkOfNature_Timer < uiDiff) + //{ + // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // m_uiMarkOfNature_Timer = 45000; + //} + //else + // m_uiMarkOfNature_Timer -= uiDiff; + + + //VolatileInfection_Timer + if (m_uiVolatileInfection_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_VOLATILEINFECTION); + m_uiVolatileInfection_Timer = 7000 + rand()%5000; + } + else + m_uiVolatileInfection_Timer -= uiDiff; + + //CorruptionofEarth_Timer + //CorruptionofEarth at 75%, 50% and 25% + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + { + ++m_uiCorruptionsCasted; // prevent casting twice on same hp + DoScriptText(SAY_CASTCORRUPTION, m_creature); + DoCast(m_creature->getVictim(), SPELL_CORRUPTIONOFEARTH); + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_emeriss(Creature* pCreature) +{ + return new boss_emerissAI (pCreature); +} + +void AddSC_boss_emeriss() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_emeriss"; + newscript->GetAI = &GetAI_boss_emeriss; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/world/boss_lethon.cpp b/src/bindings/scripts/scripts/world/boss_lethon.cpp new file mode 100644 index 00000000000..e387891efed --- /dev/null +++ b/src/bindings/scripts/scripts/world/boss_lethon.cpp @@ -0,0 +1,25 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Lethon +SD%Complete: 0 +SDComment: Place Holder +SDCategory: Bosses +EndScriptData */ + +#include "precompiled.h" + diff --git a/src/bindings/scripts/scripts/world/boss_taerar.cpp b/src/bindings/scripts/scripts/world/boss_taerar.cpp new file mode 100644 index 00000000000..3f45ab26331 --- /dev/null +++ b/src/bindings/scripts/scripts/world/boss_taerar.cpp @@ -0,0 +1,263 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Taerar +SD%Complete: 70 +SDComment: Mark of Nature & Teleport NYI. Fix the way to be banished. +SDCategory: Bosses +EndScriptData */ + +#include "precompiled.h" + +enum +{ + SAY_AGGRO = -1000399, + SAY_SUMMONSHADE = -1000400, + + //Spells of Taerar + SPELL_SLEEP = 24777, + SPELL_NOXIOUSBREATH = 24818, + SPELL_TAILSWEEP = 15847, + // SPELL_MARKOFNATURE = 25040, // Not working + SPELL_ARCANEBLAST = 24857, + SPELL_BELLOWINGROAR = 22686, + + SPELL_SUMMONSHADE_1 = 24841, + SPELL_SUMMONSHADE_2 = 24842, + SPELL_SUMMONSHADE_3 = 24843, + + //Spells of Shades of Taerar + SPELL_POSIONCLOUD = 24840, + SPELL_POSIONBREATH = 20667 +}; + +uint32 m_auiSpellSummonShade[]= +{ + SPELL_SUMMONSHADE_1, SPELL_SUMMONSHADE_2, SPELL_SUMMONSHADE_3 +}; + +struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI +{ + boss_taerarAI(Creature *c) : ScriptedAI(c) {} + + uint32 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() + { + m_uiSleep_Timer = 15000 + rand()%5000; + m_uiNoxiousBreath_Timer = 8000; + m_uiTailSweep_Timer = 4000; + //m_uiMarkOfNature_Timer = 45000; + m_uiArcaneBlast_Timer = 12000; + m_uiBellowingRoar_Timer = 30000; + m_uiShades_Timer = 60000; //The time that Taerar is banished + m_uiShadesSummoned = 0; + + m_bShades = false; + } + + void EnterCombat(Unit* pWho) + { + DoScriptText(SAY_AGGRO, m_creature); + } + + void JustSummoned(Creature* pSummoned) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); + } + + void UpdateAI(const uint32 uiDiff) + { + if (m_bShades && m_uiShades_Timer < uiDiff) + { + //Become unbanished again + m_creature->setFaction(14); + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_bShades = false; + } + else if (m_bShades) + { + m_uiShades_Timer -= uiDiff; + //Do nothing while banished + return; + } + + //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()%7000; + } + else + m_uiSleep_Timer -= uiDiff; + + //NoxiousBreath_Timer + if (m_uiNoxiousBreath_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + m_uiNoxiousBreath_Timer = 14000 + rand()%6000; + } + else + m_uiNoxiousBreath_Timer -= uiDiff; + + //Tailsweep every 2 seconds + if (m_uiTailSweep_Timer < uiDiff) + { + DoCast(m_creature, SPELL_TAILSWEEP); + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; + + //MarkOfNature_Timer + //if (m_uiMarkOfNature_Timer < uiDiff) + //{ + // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // m_uiMarkOfNature_Timer = 45000; + //} + //else + // m_uiMarkOfNature_Timer -= uiDiff; + + //ArcaneBlast_Timer + if (m_uiArcaneBlast_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_ARCANEBLAST); + m_uiArcaneBlast_Timer = 7000 + rand()%5000; + } + else + m_uiArcaneBlast_Timer -= uiDiff; + + //BellowingRoar_Timer + if (m_uiBellowingRoar_Timer < uiDiff) + { + DoCast(m_creature->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 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + //Inturrupt any spell casting + m_creature->InterruptNonMeleeSpells(false); + + //horrible workaround, need to fix + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + DoScriptText(SAY_SUMMONSHADE, m_creature); + + int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); + + for(int i = 0; i < iSize; ++i) + m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true); + + ++m_uiShadesSummoned; // prevent casting twice at same health + m_bShades = true; + } + m_uiShades_Timer = 60000; + } + + DoMeleeAttackIfReady(); + } +}; + +// Shades of Taerar Script +struct TRINITY_DLL_DECL boss_shadeoftaerarAI : public ScriptedAI +{ + boss_shadeoftaerarAI(Creature *c) : ScriptedAI(c) {} + + uint32 m_uiPoisonCloud_Timer; + uint32 m_uiPosionBreath_Timer; + + void Reset() + { + m_uiPoisonCloud_Timer = 8000; + m_uiPosionBreath_Timer = 12000; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //PoisonCloud_Timer + if (m_uiPoisonCloud_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_POSIONCLOUD); + m_uiPoisonCloud_Timer = 30000; + } + else + m_uiPoisonCloud_Timer -= uiDiff; + + //PosionBreath_Timer + if (m_uiPosionBreath_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_POSIONBREATH); + m_uiPosionBreath_Timer = 12000; + } + else + m_uiPosionBreath_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } +}; + +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(); +} + diff --git a/src/bindings/scripts/scripts/world/boss_ysondre.cpp b/src/bindings/scripts/scripts/world/boss_ysondre.cpp new file mode 100644 index 00000000000..1b93f54c047 --- /dev/null +++ b/src/bindings/scripts/scripts/world/boss_ysondre.cpp @@ -0,0 +1,203 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Ysondre +SD%Complete: 90 +SDComment: Mark of Nature & Teleport missing +SDCategory: Bosses +EndScriptData */ + +#include "precompiled.h" + +enum +{ + SAY_AGGRO = -1000360, + SAY_SUMMONDRUIDS = -1000361, + + SPELL_SLEEP = 24777, + SPELL_NOXIOUSBREATH = 24818, + SPELL_TAILSWEEP = 15847, + //SPELL_MARKOFNATURE = 25040, // Not working + SPELL_LIGHTNINGWAVE = 24819, + SPELL_SUMMONDRUIDS = 24795, + + SPELL_SUMMON_PLAYER = 24776, + + //druid spells + SPELL_MOONFIRE = 21669 +}; + +// Ysondre script +struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI +{ + boss_ysondreAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + 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() + { + 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, m_creature); + } + + void JustSummoned(Creature* pSummoned) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); + } + + void UpdateAI(const uint32 uiDiff) + { + 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(m_creature->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 *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_TAILSWEEP); + + m_uiTailSweep_Timer = 2000; + } + else + m_uiTailSweep_Timer -= uiDiff; + + //MarkOfNature_Timer + //if (m_uiMarkOfNature_Timer < uiDiff) + //{ + // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // m_uiMarkOfNature_Timer = 45000; + //} + //else + // m_uiMarkOfNature_Timer -= uiDiff; + + //LightningWave_Timer + if (m_uiLightningWave_Timer < uiDiff) + { + //Cast LIGHTNINGWAVE on a Random target + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_LIGHTNINGWAVE); + + m_uiLightningWave_Timer = 7000 + rand()%5000; + } + else + m_uiLightningWave_Timer -= uiDiff; + + //Summon Druids + if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) + { + DoScriptText(SAY_SUMMONDRUIDS, m_creature); + + for(int i = 0; i < 10; ++i) + DoCast(m_creature, SPELL_SUMMONDRUIDS, true); + + ++m_uiSummonDruidModifier; + } + + DoMeleeAttackIfReady(); + } +}; + +// Summoned druid script +struct TRINITY_DLL_DECL mob_dementeddruidsAI : public ScriptedAI +{ + mob_dementeddruidsAI(Creature *c) : ScriptedAI(c) {} + + uint32 m_uiMoonFire_Timer; + + void Reset() + { + m_uiMoonFire_Timer = 3000; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //MoonFire_Timer + if (m_uiMoonFire_Timer < uiDiff) + { + DoCast(m_creature->getVictim(), SPELL_MOONFIRE); + m_uiMoonFire_Timer = 5000; + } + else + m_uiMoonFire_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } +}; + +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(); +} + diff --git a/src/bindings/scripts/scripts/world/go_scripts.cpp b/src/bindings/scripts/scripts/world/go_scripts.cpp new file mode 100644 index 00000000000..d0818fe8dc0 --- /dev/null +++ b/src/bindings/scripts/scripts/world/go_scripts.cpp @@ -0,0 +1,476 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: GO_Scripts +SD%Complete: 100 +SDComment: Quest support: 4285,4287,4288(crystal pylons), 4296, 6481, 10990, 10991, 10992, Field_Repair_Bot->Teaches spell 22704. Barov_journal->Teaches spell 26089 +SDCategory: Game Objects +EndScriptData */ + +/* ContentData +go_cat_figurine (the "trap" version of GO, two different exist) +go_northern_crystal_pylon +go_eastern_crystal_pylon +go_western_crystal_pylon +go_barov_journal +go_ethereum_prison +go_ethereum_stasis +go_sacred_fire_of_life +go_shrine_of_the_birds +go_field_repair_bot_74A +go_orb_of_command +go_resonite_cask +go_tablet_of_madness +go_tablet_of_the_seven +go_tele_to_dalaran_crystal +go_tele_to_violet_stand +EndContentData */ + +#include "precompiled.h" + +/*###### +## go_cat_figurine +######*/ + +enum +{ + SPELL_SUMMON_GHOST_SABER = 5968, +}; + +bool GOHello_go_cat_figurine(Player* pPlayer, GameObject* pGo) +{ + pPlayer->CastSpell(pPlayer,SPELL_SUMMON_GHOST_SABER,true); + return false; +} + +/*###### +## go_crystal_pylons (3x) +######*/ + +bool GOHello_go_northern_crystal_pylon(Player* pPlayer, GameObject* pGo) +{ + if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + { + pPlayer->PrepareQuestMenu(pGo->GetGUID()); + pPlayer->SendPreparedQuest(pGo->GetGUID()); + } + + if (pPlayer->GetQuestStatus(4285) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(4285); + + return true; +} + +bool GOHello_go_eastern_crystal_pylon(Player* pPlayer, GameObject* pGo) +{ + if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + { + pPlayer->PrepareQuestMenu(pGo->GetGUID()); + pPlayer->SendPreparedQuest(pGo->GetGUID()); + } + + if (pPlayer->GetQuestStatus(4287) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(4287); + + return true; +} + +bool GOHello_go_western_crystal_pylon(Player* pPlayer, GameObject* pGo) +{ + if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + { + pPlayer->PrepareQuestMenu(pGo->GetGUID()); + pPlayer->SendPreparedQuest(pGo->GetGUID()); + } + + if (pPlayer->GetQuestStatus(4288) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(4288); + + return true; +} + +/*###### +## go_barov_journal +######*/ + +bool GOHello_go_barov_journal(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->HasSkill(SKILL_TAILORING) && pPlayer->GetBaseSkillValue(SKILL_TAILORING) >= 280 && !pPlayer->HasSpell(26086)) + { + pPlayer->CastSpell(pPlayer,26095,false); + } + return true; +} + +/*###### +## go_field_repair_bot_74A +######*/ + +bool GOHello_go_field_repair_bot_74A(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->HasSkill(SKILL_ENGINERING) && pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 300 && !pPlayer->HasSpell(22704)) + { + pPlayer->CastSpell(pPlayer,22864,false); + } + return true; +} + +/*###### +## go_gilded_brazier +######*/ + +enum +{ + NPC_STILLBLADE = 17716, +}; + +bool GOHello_go_gilded_brazier(Player* pPlayer, GameObject* pGO) +{ + if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + { + if (Creature* pCreature = pPlayer->SummonCreature(NPC_STILLBLADE, 8087.632, -7542.740, 151.568, 0.122, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + pCreature->AI()->AttackStart(pPlayer); + } + + return true; +} + +/*###### +## go_orb_of_command +######*/ + +bool GOHello_go_orb_of_command(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->GetQuestRewardStatus(7761)) + pPlayer->CastSpell(pPlayer,23460,true); + + return true; +} + +/*###### +## go_tablet_of_madness +######*/ + +bool GOHello_go_tablet_of_madness(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->HasSkill(SKILL_ALCHEMY) && pPlayer->GetSkillValue(SKILL_ALCHEMY) >= 300 && !pPlayer->HasSpell(24266)) + { + pPlayer->CastSpell(pPlayer,24267,false); + } + return true; +} + +/*###### +## go_tablet_of_the_seven +######*/ + +//TODO: use gossip option ("Transcript the Tablet") instead, if Trinity adds support. +bool GOHello_go_tablet_of_the_seven(Player* pPlayer, GameObject* pGo) +{ + if (pGo->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) + return true; + + if (pPlayer->GetQuestStatus(4296) == QUEST_STATUS_INCOMPLETE) + pPlayer->CastSpell(pPlayer,15065,false); + + return true; +} + +/*##### +## go_jump_a_tron +######*/ + +bool GOHello_go_jump_a_tron(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->GetQuestStatus(10111) == QUEST_STATUS_INCOMPLETE) + pPlayer->CastSpell(pPlayer,33382,true); + + return true; +} + +/*###### +## go_ethereum_prison +######*/ + +enum +{ + SPELL_REP_LC = 39456, + SPELL_REP_SHAT = 39457, + SPELL_REP_CE = 39460, + SPELL_REP_CON = 39474, + SPELL_REP_KT = 39475, + SPELL_REP_SPOR = 39476 +}; + +const uint32 NpcPrisonEntry[] = +{ + 22810, 22811, 22812, 22813, 22814, 22815, //good guys + 20783, 20784, 20785, 20786, 20788, 20789, 20790 //bad guys +}; + +bool GOHello_go_ethereum_prison(Player* pPlayer, GameObject* pGo) +{ + int Random = rand() % (sizeof(NpcPrisonEntry) / sizeof(uint32)); + + if (Creature* pCreature = pPlayer->SummonCreature(NpcPrisonEntry[Random], + pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + if (!pCreature->IsHostileTo(pPlayer)) + { + uint32 Spell = 0; + + if (FactionTemplateEntry const* pFaction = pCreature->getFactionTemplateEntry()) + { + switch(pFaction->faction) + { + case 1011: Spell = SPELL_REP_LC; break; + case 935: Spell = SPELL_REP_SHAT; break; + case 942: Spell = SPELL_REP_CE; break; + case 933: Spell = SPELL_REP_CON; break; + case 989: Spell = SPELL_REP_KT; break; + case 970: Spell = SPELL_REP_SPOR; break; + } + + if (Spell) + pCreature->CastSpell(pPlayer, Spell, false); + else + error_log("TSCR: go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", pCreature->GetEntry(), pCreature->getFaction()); + } + } + } + + return false; +} + +/*###### +## go_ethereum_stasis +######*/ + +const uint32 NpcStasisEntry[] = +{ + 22825, 20888, 22827, 22826, 22828 +}; + +bool GOHello_go_ethereum_stasis(Player* pPlayer, GameObject* pGo) +{ + int Random = rand() % (sizeof(NpcStasisEntry) / sizeof(uint32)); + + pPlayer->SummonCreature(NpcStasisEntry[Random], + pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), pGo->GetAngle(pPlayer), + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + + return false; +} + +/*###### +## go_resonite_cask +######*/ + +enum +{ + NPC_GOGGEROC = 11920 +}; + +bool GOHello_go_resonite_cask(Player* pPlayer, GameObject* pGO) +{ + if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + pGO->SummonCreature(NPC_GOGGEROC, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + + return false; +} + +/*###### +## go_sacred_fire_of_life +######*/ + +#define NPC_ARIKARA 10882 + +bool GOHello_go_sacred_fire_of_life(Player* pPlayer, GameObject* pGO) +{ + if (pGO->GetGoType() == GAMEOBJECT_TYPE_GOOBER) + pPlayer->SummonCreature(NPC_ARIKARA, -5008.338, -2118.894, 83.657, 0.874, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + + return true; +} + +/*###### +## go_shrine_of_the_birds +######*/ + +enum +{ + NPC_HAWK_GUARD = 22992, + NPC_EAGLE_GUARD = 22993, + NPC_FALCON_GUARD = 22994, + GO_SHRINE_HAWK = 185551, + GO_SHRINE_EAGLE = 185547, + GO_SHRINE_FALCON = 185553 +}; + +bool GOHello_go_shrine_of_the_birds(Player* pPlayer, GameObject* pGo) +{ + uint32 BirdEntry = 0; + + float fX, fY, fZ; + pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectSize(), INTERACTION_DISTANCE); + + switch(pGo->GetEntry()) + { + case GO_SHRINE_HAWK: + BirdEntry = NPC_HAWK_GUARD; + break; + case GO_SHRINE_EAGLE: + BirdEntry = NPC_EAGLE_GUARD; + break; + case GO_SHRINE_FALCON: + BirdEntry = NPC_FALCON_GUARD; + break; + } + + if (BirdEntry) + pPlayer->SummonCreature(BirdEntry, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + + return false; +} + +/*###### +## go_tele_to_dalaran_crystal +######*/ + +enum +{ + QUEST_LEARN_LEAVE_RETURN = 12790, + QUEST_TELE_CRYSTAL_FLAG = 12845 +}; + +bool GOHello_go_tele_to_dalaran_crystal(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->GetQuestRewardStatus(QUEST_TELE_CRYSTAL_FLAG)) + return false; + + //TODO: must send error message (what kind of message? On-screen?) + return true; +} + +/*###### +## go_tele_to_violet_stand +######*/ + +bool GOHello_go_tele_to_violet_stand(Player* pPlayer, GameObject* pGo) +{ + if (pPlayer->GetQuestRewardStatus(QUEST_LEARN_LEAVE_RETURN) || pPlayer->GetQuestStatus(QUEST_LEARN_LEAVE_RETURN) == QUEST_STATUS_INCOMPLETE) + return false; + + return true; +} + +void AddSC_go_scripts() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "go_cat_figurine"; + newscript->pGOHello = &GOHello_go_cat_figurine; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_northern_crystal_pylon"; + newscript->pGOHello = &GOHello_go_northern_crystal_pylon; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_eastern_crystal_pylon"; + newscript->pGOHello = &GOHello_go_eastern_crystal_pylon; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_western_crystal_pylon"; + newscript->pGOHello = &GOHello_go_western_crystal_pylon; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_barov_journal"; + newscript->pGOHello = &GOHello_go_barov_journal; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_field_repair_bot_74A"; + newscript->pGOHello = &GOHello_go_field_repair_bot_74A; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_gilded_brazier"; + newscript->pGOHello = &GOHello_go_gilded_brazier; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_orb_of_command"; + newscript->pGOHello = &GOHello_go_orb_of_command; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_shrine_of_the_birds"; + newscript->pGOHello = &GOHello_go_shrine_of_the_birds; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_tablet_of_madness"; + newscript->pGOHello = &GOHello_go_tablet_of_madness; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_tablet_of_the_seven"; + newscript->pGOHello = &GOHello_go_tablet_of_the_seven; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_jump_a_tron"; + newscript->pGOHello = &GOHello_go_jump_a_tron; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="go_ethereum_prison"; + newscript->pGOHello = &GOHello_go_ethereum_prison; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_ethereum_stasis"; + newscript->pGOHello = &GOHello_go_ethereum_stasis; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_resonite_cask"; + newscript->pGOHello = &GOHello_go_resonite_cask; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_sacred_fire_of_life"; + newscript->pGOHello = &GOHello_go_sacred_fire_of_life; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_tele_to_dalaran_crystal"; + newscript->pGOHello = &GOHello_go_tele_to_dalaran_crystal; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "go_tele_to_violet_stand"; + newscript->pGOHello = &GOHello_go_tele_to_violet_stand; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/world/item_scripts.cpp b/src/bindings/scripts/scripts/world/item_scripts.cpp new file mode 100644 index 00000000000..f103dc86cdc --- /dev/null +++ b/src/bindings/scripts/scripts/world/item_scripts.cpp @@ -0,0 +1,253 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Item_Scripts +SD%Complete: 100 +SDComment: Items for a range of different items. See content below (in script) +SDCategory: Items +EndScriptData */ + +/* ContentData +item_draenei_fishing_net(i23654) Hacklike implements chance to spawn item or creature +item_nether_wraith_beacon(i31742) Summons creatures for quest Becoming a Spellfire Tailor (q10832) +item_flying_machine(i34060,i34061) Engineering crafted flying machines +item_gor_dreks_ointment(i30175) Protecting Our Own(q10488) +item_only_for_flight Items which should only useable while flying +EndContentData */ + +#include "precompiled.h" +#include "Spell.h" + +/*##### +# item_only_for_flight +#####*/ + +enum +{ + SPELL_ARCANE_CHARGES = 45072 +}; + +bool ItemUse_item_only_for_flight(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) +{ + uint32 itemId = _Item->GetEntry(); + bool disabled = 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; + } + + // allow use in flight only + if (pPlayer->isInFlight() && !disabled) + return false; + + // error + pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,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* _Item, SpellCastTargets const& targets) +{ + //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) + { + if (rand()%100 < 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 + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 23614, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = pPlayer->StoreNewItem(dest,23614,true); + if (item) + pPlayer->SendNewItem(item,1,false,true); + }else + pPlayer->SendEquipError(msg,NULL,NULL); + } + } + //} + return false; +} + +/*##### +# item_nether_wraith_beacon +#####*/ + +bool ItemUse_item_nether_wraith_beacon(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) +{ + 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; +} + +/*##### +# item_flying_machine +#####*/ + +bool ItemUse_item_flying_machine(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) +{ + uint32 itemId = _Item->GetEntry(); + if (itemId == 34060) + if (pPlayer->GetBaseSkillValue(SKILL_RIDING) >= 225) + return false; + + if (itemId == 34061) + if (pPlayer->GetBaseSkillValue(SKILL_RIDING) == 300) + return false; + + debug_log("TSCR: Player attempt to use item %u, but did not meet riding requirement",itemId); + pPlayer->SendEquipError(EQUIP_ERR_ERR_CANT_EQUIP_SKILL,_Item,NULL); + return true; +} + +/*##### +# item_gor_dreks_ointment +#####*/ + +bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* _Item, 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,_Item,NULL); + return true; +} + +/*##### +# item_incendiary_explosives +#####*/ + +bool ItemUse_item_incendiary_explosives(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) +{ + if (pPlayer->FindNearestCreature(26248,15) || pPlayer->FindNearestCreature(26249,15)) + { + return false; + } + else + { + pPlayer->SendEquipError(EQUIP_ERR_OUT_OF_RANGE,_Item,NULL); + return true; + } +} + +/*##### +# item_mysterious_egg +#####*/ + +bool ItemExpire_item_mysterious_egg(Player* pPlayer, ItemPrototype const * _ItemProto) +{ + 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; +} + +/*##### +# item_disgusting_jar +#####*/ + +bool ItemExpire_item_disgusting_jar(Player* pPlayer, ItemPrototype const * _ItemProto) +{ + 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; +} + +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(); +} + diff --git a/src/bindings/scripts/scripts/world/mob_generic_creature.cpp b/src/bindings/scripts/scripts/world/mob_generic_creature.cpp new file mode 100644 index 00000000000..30a57e56dd5 --- /dev/null +++ b/src/bindings/scripts/scripts/world/mob_generic_creature.cpp @@ -0,0 +1,260 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* ScriptData +SDName: Generic_Creature +SD%Complete: 80 +SDComment: Should be replaced with core based AI +SDCategory: Creatures +EndScriptData */ + +#include "precompiled.h" + +#define GENERIC_CREATURE_COOLDOWN 5000 + +struct TRINITY_DLL_DECL generic_creatureAI : public ScriptedAI +{ + generic_creatureAI(Creature *c) : ScriptedAI(c) {} + + 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() + { + GlobalCooldown = 0; + BuffTimer = 0; //Rebuff as soon as we can + IsSelfRooted = false; + } + + void EnterCombat(Unit *who) + { + if (!m_creature->IsWithinMeleeRange(who)) + { + IsSelfRooted = true; + } + } + + 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 (!m_creature->isInCombat() && m_creature->isAlive()) + if (BuffTimer < diff) + { + //Find a spell that targets friendly and applies an aura (these are generally buffs) + SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + + if (info && !GlobalCooldown) + { + //Cast the buff spell + DoCastSpell(m_creature, info); + + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + + //Set our timer to 10 minutes before rebuff + BuffTimer = 600000; + }//Try agian in 30 seconds + else BuffTimer = 30000; + }else BuffTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + //If we are within range melee the target + if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + { + //Make sure our attack is ready and we arn't currently casting + if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + { + bool Healing = false; + SpellEntry const *info = NULL; + + //Select a healing spell if less than 30% hp + if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) + info = SelectSpell(m_creature, -1, -1, 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(m_creature->getVictim(), -1, -1, 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() % (m_creature->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) + { + //Cast the spell + if (Healing)DoCastSpell(m_creature, info); + else DoCastSpell(m_creature->getVictim(), info); + + //Set our global cooldown + GlobalCooldown = GENERIC_CREATURE_COOLDOWN; + } + else m_creature->AttackerStateUpdate(m_creature->getVictim()); + + m_creature->resetAttackTimer(); + } + } + else + { + //Only run this code if we arn't already casting + if (!m_creature->IsNonMeleeSpellCasted(false)) + { + bool Healing = false; + SpellEntry const *info = NULL; + + //Select a healing spell if less than 30% hp ONLY 33% of the time + if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0) + info = SelectSpell(m_creature, -1, -1, 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(m_creature->getVictim(), -1, -1, 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) + { + IsSelfRooted = true; + } + + //Cast spell + if (Healing) DoCastSpell(m_creature,info); + else DoCastSpell(m_creature->getVictim(),info); + + //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 + m_creature->InterruptNonMeleeSpells(false); + IsSelfRooted = false; + } + } + } + } +}; + +CreatureAI* GetAI_generic_creature(Creature* pCreature) +{ + return new generic_creatureAI (pCreature); +} + +struct TRINITY_DLL_DECL trigger_periodicAI : public NullCreatureAI +{ + 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; + + void UpdateAI(const uint32 diff) + { + if (timer < diff) + { + if (spell) + me->CastSpell(me, spell, true); + timer = interval; + } + else + timer -= diff; + } +}; + +struct TRINITY_DLL_DECL 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); + } +}; + +struct TRINITY_DLL_DECL mob_webwrapAI : public NullCreatureAI +{ + mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} + + uint64 victimGUID; + + void SetGUID(const uint64 &guid, int32 param) + { + victimGUID = guid; + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); + } + + void JustDied(Unit *killer) + { + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); + } +}; + +CreatureAI* GetAI_trigger_periodic(Creature* pCreature) +{ + return new trigger_periodicAI (pCreature); +} + +CreatureAI* GetAI_trigger_death(Creature* pCreature) +{ + return new trigger_deathAI (pCreature); +} + +CreatureAI* GetAI_mob_webwrap(Creature* pCreature) +{ + return new mob_webwrapAI (pCreature); +} + +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();*/ + + newscript = new Script; + newscript->Name="mob_webwrap"; + newscript->GetAI = &GetAI_mob_webwrap; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/world/npc_innkeeper.cpp b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp new file mode 100644 index 00000000000..8a99ea7fc7a --- /dev/null +++ b/src/bindings/scripts/scripts/world/npc_innkeeper.cpp @@ -0,0 +1,145 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Npc_Innkeeper +SD%Complete: 50 +SDComment: This script are currently not in use. EventSystem cannot be used on Windows build of SD2 +SDCategory: NPCs +EndScriptData */ + +#include "precompiled.h" + +#define HALLOWEEN_EVENTID 12 +#define SPELL_TRICK_OR_TREATED 24755 +#define SPELL_TREAT 24715 + +#define LOCALE_TRICK_OR_TREAT_0 "Trick or Treat!" +#define LOCALE_TRICK_OR_TREAT_2 "Des bonbons ou des blagues!" +#define LOCALE_TRICK_OR_TREAT_3 "Süßes oder Saures!" +#define LOCALE_TRICK_OR_TREAT_6 "¡Truco o trato!" + +bool isEventActive() +{ + /* + const GameEvent::ActiveEvents *ActiveEventsList = gameeventmgr.GetActiveEventList(); + GameEvent::ActiveEvents::const_iterator itr; + for (itr = ActiveEventsList->begin(); itr != ActiveEventsList->end(); ++itr) + { + if (*itr==HALLOWEEN_EVENTID) + { + return true; + } + }*/ + return false; +} + +bool GossipHello_npc_innkeeper(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (isEventActive()&& !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) + { + char* localizedEntry; + switch (pPlayer->GetSession()->GetSessionDbLocaleIndex()) + { + case 0: + localizedEntry=LOCALE_TRICK_OR_TREAT_0; + break; + case 2: + localizedEntry=LOCALE_TRICK_OR_TREAT_2; + break; + case 3: + localizedEntry=LOCALE_TRICK_OR_TREAT_3; + break; + case 6: + localizedEntry=LOCALE_TRICK_OR_TREAT_6; + break; + 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->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), 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() && !pPlayer->GetAura(SPELL_TRICK_OR_TREATED, pPlayer->GetGUID())) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_TRICK_OR_TREATED, true); + + // either trick or treat, 50% chance + if (rand()%2) + { + pPlayer->CastSpell(pPlayer, SPELL_TREAT, true); + } + else + { + int32 trickspell=0; + switch (rand()%9) // note that female characters can get male costumes and vice versa + { + case 0: + trickspell=24753; // cannot cast, random 30sec + break; + case 1: + trickspell=24713; // lepper gnome costume + break; + case 2: + trickspell=24735; // male ghost costume + break; + case 3: + trickspell=24736; // female ghostcostume + break; + case 4: + trickspell=24710; // male ninja costume + break; + case 5: + trickspell=24711; // female ninja costume + break; + case 6: + trickspell=24708; // male pirate costume + break; + case 7: + trickspell=24709; // female pirate costume + break; + case 8: + trickspell=24723; // skeleton costume + break; + } + pPlayer->CastSpell(pPlayer, trickspell, true); + } + return true; // prevent Trinity core handling + } + return false; // the player didn't select "trick or treat" or cheated, normal core handling +} + +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(); +} + diff --git a/src/bindings/scripts/scripts/world/npc_professions.cpp b/src/bindings/scripts/scripts/world/npc_professions.cpp new file mode 100644 index 00000000000..07b40555fd5 --- /dev/null +++ b/src/bindings/scripts/scripts/world/npc_professions.cpp @@ -0,0 +1,1342 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Npc_Professions +SD%Complete: 80 +SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering, re-learn leatherworking. +SDCategory: NPCs +EndScriptData */ + +#include "precompiled.h" + +/* +A few notes for future developement: +- A full implementation of gossip for GO's is required. They must have the same scripting capabilities as creatures. Basically, +there is no difference here (except that default text is chosen with `gameobject_template`.`data3` (for GO type2, different dataN for a few others) +- It's possible blacksmithing still require some tweaks and adjustments due to the way we _have_ to use reputation. +*/ + +/* +-- UPDATE `gameobject_template` SET `ScriptName` = 'go_soothsaying_for_dummies' WHERE `entry` = 177226; +*/ + +/*### +# to be removed from here (->ncp_text). This is data for database projects. +###*/ +#define TALK_MUST_UNLEARN_WEAPON "You must forget your weapon type specialty before I can help you. Go to Everlook in Winterspring and seek help there." + +#define TALK_HAMMER_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the hammersmith." +#define TALK_AXE_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the axesmith." +#define TALK_SWORD_LEARN "Ah, a seasoned veteran you once were. I know you are capable, you merely need to ask and I shall teach you the way of the swordsmith." + +#define TALK_HAMMER_UNLEARN "Forgetting your Hammersmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Hammersmithing to create!" +#define TALK_AXE_UNLEARN "Forgetting your Axesmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Axesmithing to create!" +#define TALK_SWORD_UNLEARN "Forgetting your Swordsmithing skill is not something to do lightly. If you choose to abandon it you will forget all recipes that require Swordsmithing to create!" + +/*### +# generic defines +###*/ + +#define GOSSIP_SENDER_LEARN 50 +#define GOSSIP_SENDER_UNLEARN 51 +#define GOSSIP_SENDER_CHECK 52 + +/*### +# gossip item and box texts +###*/ + +#define GOSSIP_LEARN_POTION "Please teach me how to become a Master of Potions, Lauranna" +#define GOSSIP_UNLEARN_POTION "I wish to unlearn Potion Mastery" +#define GOSSIP_LEARN_TRANSMUTE "Please teach me how to become a Master of Transmutations, Zarevhi" +#define GOSSIP_UNLEARN_TRANSMUTE "I wish to unlearn Transmutation Mastery" +#define GOSSIP_LEARN_ELIXIR "Please teach me how to become a Master of Elixirs, Lorokeem" +#define GOSSIP_UNLEARN_ELIXIR "I wish to unlearn Elixir Mastery" + +#define BOX_UNLEARN_ALCHEMY_SPEC "Do you really want to unlearn your alchemy specialty and lose all associated recipes? \n Cost: " + +#define GOSSIP_WEAPON_LEARN "Please teach me how to become a Weaponsmith" +#define GOSSIP_WEAPON_UNLEARN "I wish to unlearn the art of Weaponsmithing" +#define GOSSIP_ARMOR_LEARN "Please teach me how to become a Armorsmith" +#define GOSSIP_ARMOR_UNLEARN "I wish to unlearn the art of Armorsmithing" + +#define GOSSIP_UNLEARN_SMITH_SPEC "I wish to unlearn my blacksmith specialty" +#define BOX_UNLEARN_ARMORORWEAPON "Do you really want to unlearn your blacksmith specialty and lose all associated recipes? \n Cost: " + +#define GOSSIP_LEARN_HAMMER "Please teach me how to become a Hammersmith, Lilith" +#define GOSSIP_UNLEARN_HAMMER "I wish to unlearn Hammersmithing" +#define GOSSIP_LEARN_AXE "Please teach me how to become a Axesmith, Kilram" +#define GOSSIP_UNLEARN_AXE "I wish to unlearn Axesmithing" +#define GOSSIP_LEARN_SWORD "Please teach me how to become a Swordsmith, Seril" +#define GOSSIP_UNLEARN_SWORD "I wish to unlearn Swordsmithing" + +#define BOX_UNLEARN_WEAPON_SPEC "Do you really want to unlearn your weaponsmith specialty and lose all associated recipes? \n Cost: " + +#define GOSSIP_LEARN_DRAGON "I am absolutely certain that i want to learn dragonscale leatherworking" +#define GOSSIP_UNLEARN_DRAGON "I wish to unlearn Dragonscale Leatherworking" +#define GOSSIP_LEARN_ELEMENTAL "I am absolutely certain that i want to learn elemental leatherworking" +#define GOSSIP_UNLEARN_ELEMENTAL "I wish to unlearn Elemental Leatherworking" +#define GOSSIP_LEARN_TRIBAL "I am absolutely certain that i want to learn tribal leatherworking" +#define GOSSIP_UNLEARN_TRIBAL "I wish to unlearn Tribal Leatherworking" + +#define BOX_UNLEARN_LEATHER_SPEC "Do you really want to unlearn your leatherworking specialty and lose all associated recipes? \n Cost: " + +#define GOSSIP_LEARN_SPELLFIRE "Please teach me how to become a Spellcloth tailor" +#define GOSSIP_UNLEARN_SPELLFIRE "I wish to unlearn Spellfire Tailoring" +#define GOSSIP_LEARN_MOONCLOTH "Please teach me how to become a Mooncloth tailor" +#define GOSSIP_UNLEARN_MOONCLOTH "I wish to unlearn Mooncloth Tailoring" +#define GOSSIP_LEARN_SHADOWEAVE "Please teach me how to become a Shadoweave tailor" +#define GOSSIP_UNLEARN_SHADOWEAVE "I wish to unlearn Shadoweave Tailoring" + +#define BOX_UNLEARN_TAILOR_SPEC "Do you really want to unlearn your tailoring specialty and lose all associated recipes? \n Cost: " + +#define GOSSIP_LEARN_GOBLIN "I am absolutely certain that i want to learn Goblin engineering" +#define GOSSIP_LEARN_GNOMISH "I am absolutely certain that i want to learn Gnomish engineering" + +/*### +# spells defines +###*/ + +#define S_WEAPON 9787 +#define S_ARMOR 9788 +#define S_HAMMER 17040 +#define S_AXE 17041 +#define S_SWORD 17039 + +#define S_LEARN_WEAPON 9789 +#define S_LEARN_ARMOR 9790 +#define S_LEARN_HAMMER 39099 +#define S_LEARN_AXE 39098 +#define S_LEARN_SWORD 39097 + +#define S_UNLEARN_WEAPON 36436 +#define S_UNLEARN_ARMOR 36435 +#define S_UNLEARN_HAMMER 36441 +#define S_UNLEARN_AXE 36439 +#define S_UNLEARN_SWORD 36438 + +#define S_REP_ARMOR 17451 +#define S_REP_WEAPON 17452 + +#define REP_ARMOR 46 +#define REP_WEAPON 289 +#define REP_HAMMER 569 +#define REP_AXE 570 +#define REP_SWORD 571 + +#define S_DRAGON 10656 +#define S_ELEMENTAL 10658 +#define S_TRIBAL 10660 + +#define S_LEARN_DRAGON 10657 +#define S_LEARN_ELEMENTAL 10659 +#define S_LEARN_TRIBAL 10661 + +#define S_UNLEARN_DRAGON 36434 +#define S_UNLEARN_ELEMENTAL 36328 +#define S_UNLEARN_TRIBAL 36433 + +#define S_GOBLIN 20222 +#define S_GNOMISH 20219 + +#define S_LEARN_GOBLIN 20221 +#define S_LEARN_GNOMISH 20220 + +#define S_SPELLFIRE 26797 +#define S_MOONCLOTH 26798 +#define S_SHADOWEAVE 26801 + +#define S_LEARN_SPELLFIRE 26796 +#define S_LEARN_MOONCLOTH 26799 +#define S_LEARN_SHADOWEAVE 26800 + +#define S_UNLEARN_SPELLFIRE 41299 +#define S_UNLEARN_MOONCLOTH 41558 +#define S_UNLEARN_SHADOWEAVE 41559 + +#define S_TRANSMUTE 28672 +#define S_ELIXIR 28677 +#define S_POTION 28675 + +#define S_LEARN_TRANSMUTE 28674 +#define S_LEARN_ELIXIR 28678 +#define S_LEARN_POTION 28676 + +#define S_UNLEARN_TRANSMUTE 41565 +#define S_UNLEARN_ELIXIR 41564 +#define S_UNLEARN_POTION 41563 + +/*### +# formulas to calculate unlearning cost +###*/ + +int32 DoLearnCost(Player* pPlayer) //tailor, alchemy +{ + return 200000; +} + +int32 DoHighUnlearnCost(Player* pPlayer) //tailor, alchemy +{ + return 1500000; +} + +int32 DoMedUnlearnCost(Player* pPlayer) //blacksmith, leatherwork +{ + uint32 level = pPlayer->getLevel(); + if (level < 51) + return 250000; + else if (level < 66) + return 500000; + else + return 1000000; +} + +int32 DoLowUnlearnCost(Player* pPlayer) //blacksmith +{ + uint32 level = pPlayer->getLevel(); + if (level < 66) + return 50000; + else + return 100000; +} + +/*### +# unlearning related profession spells +###*/ + +bool EquippedOk(Player* pPlayer, uint32 spellId) +{ + SpellEntry const* spell = GetSpellStore()->LookupEntry(spellId); + + if (!spell) + return false; + + for(uint8 i=0; i<3; ++i) + { + uint32 reqSpell = spell->EffectTriggerSpell[i]; + if (!reqSpell) + continue; + + Item* pItem; + for(uint8 j = EQUIPMENT_SLOT_START; j < EQUIPMENT_SLOT_END; j++) + { + pItem = pPlayer->GetItemByPos(INVENTORY_SLOT_BAG_0, j); + if (pItem) + if (pItem->GetProto()->RequiredSpell == reqSpell) + { + //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first + debug_log("TSCR: player attempt to unlearn spell %u, but item %u is equipped.",reqSpell,pItem->GetProto()->ItemId); + return false; + } + } + } + return true; +} + +void ProfessionUnlearnSpells(Player* pPlayer, uint32 type) +{ + switch (type) + { + case 36436: // S_UNLEARN_WEAPON + pPlayer->removeSpell(36125); // Light Earthforged Blade + pPlayer->removeSpell(36128); // Light Emberforged Hammer + pPlayer->removeSpell(36126); // Light Skyforged Axe + break; + case 36435: // S_UNLEARN_ARMOR + pPlayer->removeSpell(36122); // Earthforged Leggings + pPlayer->removeSpell(36129); // Heavy Earthforged Breastplate + pPlayer->removeSpell(36130); // Stormforged Hauberk + pPlayer->removeSpell(34533); // Breastplate of Kings + pPlayer->removeSpell(34529); // Nether Chain Shirt + pPlayer->removeSpell(34534); // Bulwark of Kings + pPlayer->removeSpell(36257); // Bulwark of the Ancient Kings + pPlayer->removeSpell(36256); // Embrace of the Twisting Nether + pPlayer->removeSpell(34530); // Twisting Nether Chain Shirt + pPlayer->removeSpell(36124); // Windforged Leggings + break; + case 36441: // S_UNLEARN_HAMMER + pPlayer->removeSpell(36262); // Dragonstrike + pPlayer->removeSpell(34546); // Dragonmaw + pPlayer->removeSpell(34545); // Drakefist Hammer + pPlayer->removeSpell(36136); // Lavaforged Warhammer + pPlayer->removeSpell(34547); // Thunder + pPlayer->removeSpell(34567); // Deep Thunder + pPlayer->removeSpell(36263); // Stormherald + pPlayer->removeSpell(36137); // Great Earthforged Hammer + break; + case 36439: // S_UNLEARN_AXE + pPlayer->removeSpell(36260); // Wicked Edge of the Planes + pPlayer->removeSpell(34562); // Black Planar Edge + pPlayer->removeSpell(34541); // The Planar Edge + pPlayer->removeSpell(36134); // Stormforged Axe + pPlayer->removeSpell(36135); // Skyforged Great Axe + pPlayer->removeSpell(36261); // Bloodmoon + pPlayer->removeSpell(34543); // Lunar Crescent + pPlayer->removeSpell(34544); // Mooncleaver + break; + case 36438: // S_UNLEARN_SWORD + pPlayer->removeSpell(36258); // Blazefury + pPlayer->removeSpell(34537); // Blazeguard + pPlayer->removeSpell(34535); // Fireguard + pPlayer->removeSpell(36131); // Windforged Rapier + pPlayer->removeSpell(36133); // Stoneforged Claymore + pPlayer->removeSpell(34538); // Lionheart Blade + pPlayer->removeSpell(34540); // Lionheart Champion + pPlayer->removeSpell(36259); // Lionheart Executioner + break; + case 36434: // S_UNLEARN_DRAGON + pPlayer->removeSpell(36076); // Dragonstrike Leggings + pPlayer->removeSpell(36079); // Golden Dragonstrike Breastplate + pPlayer->removeSpell(35576); // Ebon Netherscale Belt + pPlayer->removeSpell(35577); // Ebon Netherscale Bracers + pPlayer->removeSpell(35575); // Ebon Netherscale Breastplate + pPlayer->removeSpell(35582); // Netherstrike Belt + pPlayer->removeSpell(35584); // Netherstrike Bracers + pPlayer->removeSpell(35580); // Netherstrike Breastplate + break; + case 36328: // S_UNLEARN_ELEMENTAL + pPlayer->removeSpell(36074); // Blackstorm Leggings + pPlayer->removeSpell(36077); // Primalstorm Breastplate + pPlayer->removeSpell(35590); // Primalstrike Belt + pPlayer->removeSpell(35591); // Primalstrike Bracers + pPlayer->removeSpell(35589); // Primalstrike Vest + break; + case 36433: // S_UNLEARN_TRIBAL + pPlayer->removeSpell(35585); // Windhawk Hauberk + pPlayer->removeSpell(35587); // Windhawk Belt + pPlayer->removeSpell(35588); // Windhawk Bracers + pPlayer->removeSpell(36075); // Wildfeather Leggings + pPlayer->removeSpell(36078); // Living Crystal Breastplate + break; + case 41299: // S_UNLEARN_SPELLFIRE + pPlayer->removeSpell(26752); // Spellfire Belt + pPlayer->removeSpell(26753); // Spellfire Gloves + pPlayer->removeSpell(26754); // Spellfire Robe + break; + case 41558: // S_UNLEARN_MOONCLOTH + pPlayer->removeSpell(26760); // Primal Mooncloth Belt + pPlayer->removeSpell(26761); // Primal Mooncloth Shoulders + pPlayer->removeSpell(26762); // Primal Mooncloth Robe + break; + case 41559: // S_UNLEARN_SHADOWEAVE + pPlayer->removeSpell(26756); // Frozen Shadoweave Shoulders + pPlayer->removeSpell(26757); // Frozen Shadoweave Boots + pPlayer->removeSpell(26758); // Frozen Shadoweave Robe + break; + } +} + +/*### +# start menues alchemy +###*/ + +bool HasAlchemySpell(Player* pPlayer) +{ + if (pPlayer->HasSpell(S_TRANSMUTE) || pPlayer->HasSpell(S_ELIXIR) || pPlayer->HasSpell(S_POTION)) + return true; + return false; +} + +bool GossipHello_npc_prof_alchemy(Player* pPlayer, Creature* pCreature) +{ + 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) + { + if (pPlayer->GetQuestRewardStatus(10899) || pPlayer->GetQuestRewardStatus(10902) || pPlayer->GetQuestRewardStatus(10897)) + { + 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(pCreature->GetNpcTextId(), 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; + } +} + +void SendConfirmLearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) +{ + if (uiAction) + { + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +void SendConfirmUnlearn_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiAction) +{ + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +bool GossipSelect_npc_prof_alchemy(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + switch(uiSender) + { + 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; + } + return true; +} + +/*### +# start menues blacksmith +###*/ + +bool HasWeaponSub(Player* pPlayer) +{ + if (pPlayer->HasSpell(S_HAMMER) || pPlayer->HasSpell(S_AXE) || pPlayer->HasSpell(S_SWORD)) + return true; + return false; +} + +bool GossipHello_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature) +{ + 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) + { + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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->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->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->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->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->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->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->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->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) + { + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +void SendConfirmUnlearn_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiAction) +{ + if (uiAction) + { + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +bool GossipSelect_npc_prof_blacksmith(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + switch(uiSender) + { + 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; + } + 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 +###*/ + +enum +{ + NPC_ZAP = 14742, + NPC_JHORDY = 14743, + NPC_KABLAM = 21493, + NPC_SMILES = 21494, + + SPELL_LEARN_TO_EVERLOOK = 23490, + SPELL_LEARN_TO_GADGET = 23491, + SPELL_LEARN_TO_AREA52 = 36956, + SPELL_LEARN_TO_TOSHLEY = 36957, + + SPELL_TO_EVERLOOK = 23486, + SPELL_TO_GADGET = 23489, + SPELL_TO_AREA52 = 36954, + SPELL_TO_TOSHLEY = 36955, + + ITEM_GNOMISH_CARD = 10790, + ITEM_GOBLIN_CARD = 10791 +}; + +#define GOSSIP_ITEM_ZAP "[PH] Unknown" +#define GOSSIP_ITEM_JHORDY "I must build a beacon for this marvelous device!" +#define GOSSIP_ITEM_KABLAM "[PH] Unknown" +#define GOSSIP_ITEM_SMILES "[PH] Unknown" + +bool GossipHello_npc_engineering_tele_trinket(Player* pPlayer, Creature* pCreature) +{ + uint32 NpcTextId = 0; + std::string GossipItem; + bool CanLearn = false; + + if (pPlayer->HasSkill(SKILL_ENGINERING)) + { + switch(pCreature->GetEntry()) + { + case NPC_ZAP: + NpcTextId = 7249; + if (pPlayer->GetBaseSkillValue(SKILL_ENGINERING) >= 260 && pPlayer->HasSpell(S_GOBLIN)) + { + if (!pPlayer->HasSpell(SPELL_TO_EVERLOOK)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_ZAP; + } + 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)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_JHORDY; + } + 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)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_KABLAM; + } + 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)) + { + CanLearn = true; + GossipItem = GOSSIP_ITEM_SMILES; + } + else if (pPlayer->HasSpell(SPELL_TO_TOSHLEY)) + NpcTextId = 0; + } + 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 : pCreature->GetNpcTextId(), pCreature->GetGUID()); + 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(); + + 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) +{ + 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) + { + 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + return true; +} + +void SendActionMenu_npc_prof_leather(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; + //Unlearn Leather + case GOSSIP_ACTION_INFO_DEF + 1: + if (EquippedOk(pPlayer,S_UNLEARN_DRAGON)) + { + 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->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->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->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->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->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) + { + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +bool GossipSelect_npc_prof_leather(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + switch(uiSender) + { + 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; + } + return true; +} + +/*### +# start menues tailoring +###*/ + +bool HasTailorSpell(Player* pPlayer) +{ + if (pPlayer->HasSpell(S_MOONCLOTH) || pPlayer->HasSpell(S_SHADOWEAVE) || pPlayer->HasSpell(S_SPELLFIRE)) + return true; + return false; +} + +bool GossipHello_npc_prof_tailor(Player* pPlayer, Creature* pCreature) +{ + 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) + { + if (pPlayer->GetQuestRewardStatus(10831) || pPlayer->GetQuestRewardStatus(10832) || pPlayer->GetQuestRewardStatus(10833)) + { + 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + return true; +} + +void SendActionMenu_npc_prof_tailor(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 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)) + { + 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 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 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +void SendConfirmUnlearn_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiAction) +{ + 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), 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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + break; + } + } +} + +bool GossipSelect_npc_prof_tailor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + switch(uiSender) + { + 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; + } + 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; +}*/ + +/*### +# +###*/ + +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();*/ +} + diff --git a/src/bindings/scripts/scripts/world/npc_taxi.cpp b/src/bindings/scripts/scripts/world/npc_taxi.cpp new file mode 100644 index 00000000000..161b663fbb1 --- /dev/null +++ b/src/bindings/scripts/scripts/world/npc_taxi.cpp @@ -0,0 +1,262 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Npc_Taxi +SD%Complete: 0% +SDComment: To be used for taxi NPCs that are located globally. +SDCategory: NPCs +EndScriptData +*/ + +#include "precompiled.h" + +bool GossipHello_npc_taxi(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + switch(pCreature->GetEntry()) { + case 17435: // Azuremyst Isle - Susurrus + if (pPlayer->HasItemCount(23843,1,true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am ready.", 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, "I'm ready to fly! Take me up, dragon!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + break; + case 18725: // Old Hillsbrad Foothills - Brazen + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I am ready to go to Durnholde Keep.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + break; + case 29154: // Stormwind City - Thargold Ironwing + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I'd like to take a flight around Stormwind Harbor.", 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, "Fly me to Murketh and Shaadraz Gateways", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + + //Shatter Point + if (!pPlayer->GetQuestRewardStatus(10340)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Shatter Point", 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, "Fly me to The Abyssal Shelf", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + + //Go to the Front + if (pPlayer->GetQuestStatus(10382) != QUEST_STATUS_NONE && !pPlayer->GetQuestRewardStatus(10382)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Honor Point", 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, "Fly me to Murketh and Shaadraz Gateways", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + + //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, "Fly me to The Abyssal Shelf", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + + //Spinebreaker Post + if (pPlayer->GetQuestStatus(10242) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(10242)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Fly me to Spinebreaker Post", 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, "Fly me to Skettis please", 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, "Speaking of uiAction, I've been ordered to undertake an air strike.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + + if (pPlayer->GetQuestStatus(11542) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(11543) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I need to intercept the Dawnblade reinforcements.", 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_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, "Fly me to Manaforge Coruu please", 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, "Fly me to Ogri'la please", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 16); + break; + case 27575: // Dragonblight - Lord Afrasastrasz + // middle -> ground + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to take a flight to the ground, Lord Of Afrasastrasz.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 17); + // middle -> top + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "My Lord, I must go to the upper floor of the temple.", 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, "My Lord, I must go to the upper floor of the temple.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 19); + // ground -> middle + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Can you spare a drake to travel to Lord Of Afrasastrasz, in the middle of the temple?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 20); + break; + case 26949: // Dragonblight - Torastrasza + // top -> middle + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I would like to see Lord Of Afrasastrasz, in the middle of the temple.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + // top -> ground + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Yes, Please. I would like to return to the ground floor of the temple.", 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, "I need to fly to the Windrunner Official business!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + if (pPlayer->GetQuestStatus(11170) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "I need to commandeer a riding bat for special assignment for us.", 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_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+25); + break; + } + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + return true; +} + +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->CLOSE_GOSSIP_MENU(); + pPlayer->ActivateTaxiPathTo(534); //TaxiPath 534 + } + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->GetSession()->SendDoFlight(1149, 1041); + 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); + break; + case GOSSIP_ACTION_INFO_DEF + 25: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,42295,true); + break; + } + + 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(); +} diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp new file mode 100644 index 00000000000..64f89628528 --- /dev/null +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -0,0 +1,1965 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 .sourceforge.net/> + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Npcs_Special +SD%Complete: 100 +SDComment: To be used for special NPCs that are located globally. +SDCategory: NPCs +EndScriptData +*/ + +/* ContentData +npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell +npc_chicken_cluck 100% support for quest 3861 (Cluck!) +npc_dancing_flames 100% midsummer event NPC +npc_guardian 100% guardianAI used to prevent players from accessing off-limits areas. Not in use by SD2 +npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 +npc_injured_patient 100% patients for triage-quests (6622 and 6624) +npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 and 6624 (Triage) +npc_kingdom_of_dalaran_quests Misc NPC's gossip option related to quests 12791, 12794 and 12796 +npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy +npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 +npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given +npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap +EndContentData */ + +#include "precompiled.h" +#include "../npc/npc_escortAI.h" +#include "ObjectMgr.h" + +/*######## +# npc_air_force_bots +#########*/ + +enum SpawnType +{ + SPAWNTYPE_TRIPWIRE_ROOFTOP, // no warning, summon Creature at smaller range + SPAWNTYPE_ALARMBOT, // cast guards mark and summon npc - if player shows up with that buff duration < 5 seconds attack +}; + +struct SpawnAssociation +{ + uint32 m_uiThisCreatureEntry; + uint32 m_uiSpawnedCreatureEntry; + SpawnType m_SpawnType; +}; + +enum +{ + SPELL_GUARDS_MARK = 38067, + AURA_DURATION_TIME_LEFT = 5000 +}; + +const float RANGE_TRIPWIRE = 15.0f; +const float RANGE_GUARDS_MARK = 50.0f; + +SpawnAssociation m_aSpawnAssociations[] = +{ + {2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance) + {2615, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Horde) + {21974, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Area 52) + {21993, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Horde - Bat Rider) + {21996, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Alliance - Gryphon) + {21997, 21976, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Goblin - Area 52 - Zeppelin) + {21999, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Alliance) + {22001, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Horde) + {22002, 15242, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Horde) + {22003, 15241, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Ground (Alliance) + {22063, 21976, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Goblin - Area 52) + {22065, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Ethereal - Stormspire) + {22066, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Scryer - Dragonhawk) + {22068, 22064, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Ethereal - Stormspire) + {22069, 22064, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Stormspire) + {22070, 22067, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Scryer) + {22071, 22067, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Scryer) + {22078, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Aldor) + {22079, 22077, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Aldor - Gryphon) + {22080, 22077, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Aldor) + {22086, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Sporeggar) + {22087, 22085, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Sporeggar - Spore Bat) + {22088, 22085, SPAWNTYPE_TRIPWIRE_ROOFTOP}, //Air Force Trip Wire - Rooftop (Sporeggar) + {22090, 22089, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Toshley's Station - Flying Machine) + {22124, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Cenarion) + {22125, 22122, SPAWNTYPE_ALARMBOT}, //Air Force Guard Post (Cenarion - Stormcrow) + {22126, 22122, SPAWNTYPE_ALARMBOT} //Air Force Trip Wire - Rooftop (Cenarion Expedition) +}; + +struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI +{ + 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); + + for (uint8 i=0; iGetEntry()) + { + m_pSpawnAssoc = &m_aSpawnAssociations[i]; + break; + } + } + + if (!m_pSpawnAssoc) + error_db_log("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) + { + m_pSpawnAssoc = NULL; + error_db_log("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() { } + + Creature* SummonGuard() + { + Creature* pSummoned = m_creature->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + + if (pSummoned) + m_uiSpawnedGUID = pSummoned->GetGUID(); + else + { + error_db_log("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + m_pSpawnAssoc = NULL; + } + + return pSummoned; + } + + Creature* GetSummonedGuard() + { + Creature* pCreature = Unit::GetCreature(*m_creature, m_uiSpawnedGUID); + + if (pCreature && pCreature->isAlive()) + return pCreature; + + return NULL; + } + + void MoveInLineOfSight(Unit* pWho) + { + if (!m_pSpawnAssoc) + return; + + if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + { + Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; + + // airforce guards only spawn for players + if (!pPlayerTarget) + return; + + Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); + + // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup + if (!pLastSpawnedGuard) + m_uiSpawnedGUID = 0; + + switch(m_pSpawnAssoc->m_SpawnType) + { + case SPAWNTYPE_ALARMBOT: + { + if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) + return; + + Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0); + if (pMarkAura) + { + // the target wasn't able to move out of our range within 25 seconds + if (!pLastSpawnedGuard) + { + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + } + + if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT) + { + if (!pLastSpawnedGuard->getVictim()) + pLastSpawnedGuard->AI()->AttackStart(pWho); + } + } + else + { + if (!pLastSpawnedGuard) + pLastSpawnedGuard = SummonGuard(); + + if (!pLastSpawnedGuard) + return; + + pLastSpawnedGuard->CastSpell(pWho, SPELL_GUARDS_MARK, true); + } + break; + } + case SPAWNTYPE_TRIPWIRE_ROOFTOP: + { + if (!pWho->IsWithinDistInMap(m_creature, 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); + } + break; + } + } + } + } +}; + +CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) +{ + return new npc_air_force_botsAI(pCreature); +} + +/*######## +# npc_chicken_cluck +#########*/ + +#define EMOTE_HELLO -1070004 +#define EMOTE_CLUCK_TEXT -1070006 + +#define QUEST_CLUCK 3861 +#define FACTION_FRIENDLY 35 +#define FACTION_CHICKEN 31 + +struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI +{ + npc_chicken_cluckAI(Creature *c) : ScriptedAI(c) {} + + uint32 ResetFlagTimer; + + void Reset() + { + ResetFlagTimer = 120000; + m_creature->setFaction(FACTION_CHICKEN); + m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + } + + void EnterCombat(Unit *who) {} + + 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 (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) + { + if (ResetFlagTimer < diff) + { + EnterEvadeMode(); + return; + }else ResetFlagTimer -= diff; + } + + if (UpdateVictim()) + DoMeleeAttackIfReady(); + } + + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + switch(emote) + { + case TEXTEMOTE_CHICKEN: + if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) + { + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + m_creature->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_HELLO, m_creature); + } + break; + case TEXTEMOTE_CHEER: + if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) + { + m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + m_creature->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_CLUCK_TEXT, m_creature); + } + break; + } + } +}; + +CreatureAI* GetAI_npc_chicken_cluck(Creature* pCreature) +{ + return new npc_chicken_cluckAI(pCreature); +} + +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(); + + return true; +} + +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; +} + +/*###### +## npc_dancing_flames +######*/ + +#define SPELL_BRAZIER 45423 +#define SPELL_SEDUCTION 47057 +#define SPELL_FIERY_AURA 45427 + +struct TRINITY_DLL_DECL npc_dancing_flamesAI : public ScriptedAI +{ + npc_dancing_flamesAI(Creature *c) : ScriptedAI(c) {} + + bool active; + uint32 can_iteract; + + void Reset() + { + active = true; + can_iteract = 3500; + DoCast(m_creature,SPELL_BRAZIER,true); + DoCast(m_creature,SPELL_FIERY_AURA,false); + float x, y, z; + m_creature->GetPosition(x,y,z); + m_creature->Relocate(x,y,z + 0.94f); + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + WorldPacket data; //send update position to client + m_creature->BuildHeartBeatMsg(&data); + m_creature->SendMessageToSet(&data,true); + } + + void UpdateAI(const uint32 diff) + { + if (!active) + { + if (can_iteract <= diff){ + active = true; + can_iteract = 3500; + m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + }else can_iteract -= diff; + } + } + + void EnterCombat(Unit* who){} + + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + if (m_creature->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && m_creature->IsWithinDistInMap(pPlayer,30.0f)) + { + m_creature->SetInFront(pPlayer); + active = false; + + WorldPacket data; + m_creature->BuildHeartBeatMsg(&data); + m_creature->SendMessageToSet(&data,true); + switch(emote) + { + case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; + case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case TEXTEMOTE_BOW: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; + case TEXTEMOTE_JOKE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; + case TEXTEMOTE_DANCE: + { + if (!pPlayer->HasAura(SPELL_SEDUCTION)) + m_creature->CastSpell(pPlayer,SPELL_SEDUCTION,true); + } + break; + } + } + } +}; + +CreatureAI* GetAI_npc_dancing_flames(Creature* pCreature) +{ + return new npc_dancing_flamesAI(pCreature); +} + +/*###### +## Triage quest +######*/ + +#define SAY_DOC1 -1000201 +#define SAY_DOC2 -1000202 +#define SAY_DOC3 -1000203 + +#define DOCTOR_ALLIANCE 12939 +#define DOCTOR_HORDE 12920 +#define ALLIANCE_COORDS 7 +#define HORDE_COORDS 6 + +struct Location +{ + float x, y, z, o; +}; + +static Location AllianceCoords[]= +{ + {-3757.38, -4533.05, 14.16, 3.62}, // Top-far-right bunk as seen from entrance + {-3754.36, -4539.13, 14.16, 5.13}, // Top-far-left bunk + {-3749.54, -4540.25, 14.28, 3.34}, // Far-right bunk + {-3742.10, -4536.85, 14.28, 3.64}, // Right bunk near entrance + {-3755.89, -4529.07, 14.05, 0.57}, // Far-left bunk + {-3749.51, -4527.08, 14.07, 5.26}, // Mid-left bunk + {-3746.37, -4525.35, 14.16, 5.22}, // Left bunk near entrance +}; + +//alliance run to where +#define A_RUNTOX -3742.96 +#define A_RUNTOY -4531.52 +#define A_RUNTOZ 11.91 + +static Location HordeCoords[]= +{ + {-1013.75, -3492.59, 62.62, 4.34}, // Left, Behind + {-1017.72, -3490.92, 62.62, 4.34}, // Right, Behind + {-1015.77, -3497.15, 62.82, 4.34}, // Left, Mid + {-1019.51, -3495.49, 62.82, 4.34}, // Right, Mid + {-1017.25, -3500.85, 62.98, 4.34}, // Left, front + {-1020.95, -3499.21, 62.98, 4.34} // Right, Front +}; + +//horde run to where +#define H_RUNTOX -1016.44 +#define H_RUNTOY -3508.48 +#define H_RUNTOZ 62.96 + +const uint32 AllianceSoldierId[3] = +{ + 12938, // 12938 Injured Alliance Soldier + 12936, // 12936 Badly injured Alliance Soldier + 12937 // 12937 Critically injured Alliance Soldier +}; + +const uint32 HordeSoldierId[3] = +{ + 12923, //12923 Injured Soldier + 12924, //12924 Badly injured Soldier + 12925 //12925 Critically injured Soldier +}; + +/*###### +## npc_doctor (handles both Gustaf Vanhowzen and Gregory Victor) +######*/ + +struct TRINITY_DLL_DECL npc_doctorAI : public ScriptedAI +{ + npc_doctorAI(Creature *c) : ScriptedAI(c) {} + + uint64 PlayerGUID; + + uint32 SummonPatient_Timer; + uint32 SummonPatientCount; + uint32 PatientDiedCount; + uint32 PatientSavedCount; + + bool Event; + + std::list Patients; + std::vector Coordinates; + + void Reset() + { + PlayerGUID = 0; + + SummonPatient_Timer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; + + Patients.clear(); + Coordinates.clear(); + + Event = false; + + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void BeginEvent(Player* pPlayer); + void PatientDied(Location* Point); + void PatientSaved(Creature* soldier, Player* pPlayer, Location* Point); + void UpdateAI(const uint32 diff); + + void EnterCombat(Unit* who){} +}; + +/*##### +## npc_injured_patient (handles all the patients, no matter Horde or Alliance) +#####*/ + +struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI +{ + npc_injured_patientAI(Creature *c) : ScriptedAI(c) {} + + uint64 Doctorguid; + Location* Coord; + + void Reset() + { + Doctorguid = 0; + Coord = NULL; + + //no select + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + //no regen health + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + + //to make them lay with face down + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + + uint32 mobId = m_creature->GetEntry(); + + switch (mobId) + { //lower max health + case 12923: + case 12938: //Injured Soldier + m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.75)); + break; + case 12924: + case 12936: //Badly injured Soldier + m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.50)); + break; + case 12925: + case 12937: //Critically injured Soldier + m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.25)); + break; + } + } + + void EnterCombat(Unit* who){} + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->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(*m_creature, Doctorguid)) + CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord); + } + } + + //make not selectable + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + //regen health + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + + //stand up + m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + + switch(rand()%3) + { + case 0: DoScriptText(SAY_DOC1,m_creature); break; + case 1: DoScriptText(SAY_DOC2,m_creature); break; + case 2: DoScriptText(SAY_DOC3,m_creature); break; + } + + uint32 mobId = m_creature->GetEntry(); + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + + switch (mobId) + { + case 12923: + case 12924: + case 12925: + m_creature->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); + break; + case 12936: + case 12937: + case 12938: + m_creature->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); + break; + } + } + } + + void UpdateAI(const uint32 diff) + { + //lower HP on every world tick makes it a useful counter, not officlone though + if (m_creature->isAlive() && m_creature->GetHealth() > 6) + { + m_creature->SetHealth(uint32(m_creature->GetHealth()-5)); + } + + if (m_creature->isAlive() && m_creature->GetHealth() <= 6) + { + m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + m_creature->setDeathState(JUST_DIED); + m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, 32); + + if (Doctorguid) + { + if (Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid)) + CAST_AI(npc_doctorAI, Doctor->AI())->PatientDied(Coord); + } + } + } +}; + +CreatureAI* GetAI_npc_injured_patient(Creature* pCreature) +{ + return new npc_injured_patientAI (pCreature); +} + +/* +npc_doctor (continue) +*/ + +void npc_doctorAI::BeginEvent(Player* pPlayer) +{ + PlayerGUID = pPlayer->GetGUID(); + + SummonPatient_Timer = 10000; + SummonPatientCount = 0; + PatientDiedCount = 0; + PatientSavedCount = 0; + + switch(m_creature->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; + } + + Event = true; + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +} + +void npc_doctorAI::PatientDied(Location* Point) +{ + Player* pPlayer = Unit::GetPlayer(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; + } + + 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)) + { + ++PatientSavedCount; + + if (PatientSavedCount == 15) + { + if (!Patients.empty()) + { + std::list::iterator itr; + for(itr = Patients.begin(); itr != Patients.end(); ++itr) + { + if (Creature* Patient = Unit::GetCreature((*m_creature), *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 npc_doctorAI::UpdateAI(const uint32 diff) +{ + if (Event && SummonPatientCount >= 20) + { + Reset(); + return; + } + + if (Event) + { + if (SummonPatient_Timer < diff) + { + Creature* Patient = NULL; + Location* Point = NULL; + + if (Coordinates.empty()) + return; + + std::vector::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); + uint32 patientEntry = 0; + + switch(m_creature->GetEntry()) + { + case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; + case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; + default: + error_log("TSCR: Invalid entry for Triage doctor. Please check your database"); + return; + } + + Point = *itr; + + Patient = m_creature->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + + if (Patient) + { + //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) + Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + + Patients.push_back(Patient->GetGUID()); + CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = m_creature->GetGUID(); + + if (Point) + CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point; + + Coordinates.erase(itr); + } + SummonPatient_Timer = 10000; + SummonPatientCount++; + }else SummonPatient_Timer -= 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 +######*/ + +//TODO: get text for each NPC + +enum +{ + SPELL_LESSER_HEAL_R2 = 2052, + SPELL_FORTITUDE_R1 = 1243, + + QUEST_MOON = 5621, + QUEST_LIGHT_1 = 5624, + QUEST_LIGHT_2 = 5625, + QUEST_SPIRIT = 5648, + QUEST_DARKNESS = 5650, + + ENTRY_SHAYA = 12429, + ENTRY_ROBERTS = 12423, + ENTRY_DOLF = 12427, + ENTRY_KORJA = 12430, + ENTRY_DG_KEL = 12428, + + SAY_COMMON_HEALED = -1000164, + SAY_DG_KEL_THANKS = -1000165, + SAY_DG_KEL_GOODBYE = -1000166, + SAY_ROBERTS_THANKS = -1000167, + SAY_ROBERTS_GOODBYE = -1000168, + SAY_KORJA_THANKS = -1000169, + SAY_KORJA_GOODBYE = -1000170, + SAY_DOLF_THANKS = -1000171, + SAY_DOLF_GOODBYE = -1000172, + SAY_SHAYA_THANKS = -1000173, + SAY_SHAYA_GOODBYE = -1000174, +}; + +struct TRINITY_DLL_DECL npc_garments_of_questsAI : public npc_escortAI +{ + npc_garments_of_questsAI(Creature *c) : npc_escortAI(c) {Reset();} + + uint64 caster; + + bool bIsHealed; + bool bCanRun; + + uint32 RunAwayTimer; + + void Reset() + { + caster = 0; + + bIsHealed = false; + bCanRun = false; + + RunAwayTimer = 5000; + + m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); + //expect database to have RegenHealth=0 + m_creature->SetHealth(int(m_creature->GetMaxHealth()*0.7)); + } + + void EnterCombat(Unit *who) {} + + void SpellHit(Unit* pCaster, const SpellEntry *Spell) + { + if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) + { + //not while in combat + if (m_creature->isInCombat()) + return; + + //nothing to be done now + if (bIsHealed && bCanRun) + return; + + if (pCaster->GetTypeId() == TYPEID_PLAYER) + { + switch(m_creature->GetEntry()) + { + 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,m_creature,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,m_creature,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,m_creature,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,m_creature,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) + { + DoScriptText(SAY_DOLF_THANKS,m_creature,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,m_creature,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) + { + DoScriptText(SAY_KORJA_THANKS,m_creature,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,m_creature,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,m_creature,pCaster); + bCanRun = true; + } + else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + { + caster = pCaster->GetGUID(); + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + bIsHealed = true; + } + } + break; + } + + //give quest credit, not expect any special quest objectives + if (bCanRun) + CAST_PLR(pCaster)->TalkedToCreature(m_creature->GetEntry(),m_creature->GetGUID()); + } + } + } + + void WaypointReached(uint32 uiPoint) + { + } + + void UpdateAI(const uint32 diff) + { + if (bCanRun && !m_creature->isInCombat()) + { + if (RunAwayTimer <= diff) + { + if (Unit *pUnit = Unit::GetUnit(*m_creature,caster)) + { + switch(m_creature->GetEntry()) + { + case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,m_creature,pUnit); break; + case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,m_creature,pUnit); break; + case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,m_creature,pUnit); break; + case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit); break; + case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit); break; + } + + Start(false,true,true); + } + else + EnterEvadeMode(); //something went wrong + + RunAwayTimer = 30000; + }else RunAwayTimer -= diff; + } + + npc_escortAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_garments_of_quests(Creature* pCreature) +{ + npc_garments_of_questsAI* tempAI = new npc_garments_of_questsAI(pCreature); + + tempAI->FillPointMovementListForCreature(); + + return tempAI; +} + +/*###### +## npc_guardian +######*/ + +#define SPELL_DEATHTOUCH 5 + +struct TRINITY_DLL_DECL npc_guardianAI : public ScriptedAI +{ + npc_guardianAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void EnterCombat(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (m_creature->isAttackReady()) + { + m_creature->CastSpell(m_creature->getVictim(),SPELL_DEATHTOUCH, true); + m_creature->resetAttackTimer(); + } + } +}; + +CreatureAI* GetAI_npc_guardian(Creature* pCreature) +{ + return new npc_guardianAI (pCreature); +} + +/*###### +## npc_kingdom_of_dalaran_quests +######*/ + +enum +{ + SPELL_TELEPORT_DALARAN = 53360, + ITEM_KT_SIGNET = 39740, + QUEST_MAGICAL_KINGDOM_A = 12794, + QUEST_MAGICAL_KINGDOM_H = 12791, + QUEST_MAGICAL_KINGDOM_N = 12796 +}; + +#define GOSSIP_ITEM_TELEPORT_TO "I am ready to be teleported to Dalaran." + +bool GossipHello_npc_kingdom_of_dalaran_quests(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); + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), 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) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer,SPELL_TELEPORT_DALARAN,false); + } + return true; +} + +/*###### +## npc_mount_vendor +######*/ + +bool GossipHello_npc_mount_vendor(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(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(pCreature->GetNpcTextId(), pCreature->GetGUID()); + } + 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()); + + return true; +} + +/*###### +## npc_rogue_trainer +######*/ + +bool GossipHello_npc_rogue_trainer(Player* pPlayer, Creature* pCreature) +{ + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isTrainer()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_TEXT_TRAIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRAIN); + + if (pCreature->isCanTrainingAndResetTalentsOf(pPlayer)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "I wish to unlearn my talents", 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_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(5996, pCreature->GetGUID()); + } else + pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); + + return true; +} + +bool GossipSelect_npc_rogue_trainer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + 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; + } + return true; +} + +/*###### +## npc_sayge +######*/ + +#define SPELL_DMG 23768 //dmg +#define SPELL_RES 23769 //res +#define SPELL_ARM 23767 //arm +#define SPELL_SPI 23738 //spi +#define SPELL_INT 23766 //int +#define SPELL_STM 23737 //stm +#define SPELL_STR 23735 //str +#define SPELL_AGI 23736 //agi +#define SPELL_FORTUNE 23765 //faire fortune + +bool GossipHello_npc_sayge(Player* pPlayer, Creature* pCreature) +{ + 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 + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Yes", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(7339, pCreature->GetGUID()); + } + + return true; +} + +void SendAction_npc_sayge(Player* pPlayer, Creature* pCreature, uint32 uiAction) +{ + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Slay the Man", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Turn him over to liege", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Confiscate the corn", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let him go and have the corn", 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, "Execute your friend painfully", GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Execute your friend painlessly", GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let your friend go", 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, "Confront the diplomat", GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Show not so quiet defiance", GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Remain quiet", 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, "Speak against your brother openly", GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Help your brother in", GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Keep your brother out without letting him know", 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, "Take credit, keep gold", GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Take credit, share the gold", GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Let the knight take credit", 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, "Thanks", 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) + { + 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; + } + return true; +} + +struct TRINITY_DLL_DECL npc_steam_tonkAI : public ScriptedAI +{ + npc_steam_tonkAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit *who) {} + + void OnPossess(bool apply) + { + if (apply) + { + // Initialize the action bar without the melee attack command + m_creature->InitCharmInfo(); + m_creature->GetCharmInfo()->InitEmptyActionBar(false); + + m_creature->SetReactState(REACT_PASSIVE); + } + else + m_creature->SetReactState(REACT_AGGRESSIVE); + } + +}; + +CreatureAI* GetAI_npc_steam_tonk(Creature* pCreature) +{ + return new npc_steam_tonkAI(pCreature); +} + +#define SPELL_TONK_MINE_DETONATE 25099 + +struct TRINITY_DLL_DECL npc_tonk_mineAI : public ScriptedAI +{ + npc_tonk_mineAI(Creature *c) : ScriptedAI(c) + { + m_creature->SetReactState(REACT_PASSIVE); + } + + uint32 ExplosionTimer; + + void Reset() + { + ExplosionTimer = 3000; + } + + void EnterCombat(Unit *who) {} + void AttackStart(Unit *who) {} + void MoveInLineOfSight(Unit *who) {} + + void UpdateAI(const uint32 diff) + { + if (ExplosionTimer < diff) + { + m_creature->CastSpell(m_creature, SPELL_TONK_MINE_DETONATE, true); + m_creature->setDeathState(DEAD); // unsummon it + } else + ExplosionTimer -= diff; + } +}; + +CreatureAI* GetAI_npc_tonk_mine(Creature* pCreature) +{ + return new npc_tonk_mineAI(pCreature); +} + +/*#### +## npc_winter_reveler +####*/ + +bool ReceiveEmote_npc_winter_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) +{ + //TODO: check auralist. + if (pPlayer->HasAura(26218)) + return false; + + if (emote == TEXTEMOTE_KISS) + { + pCreature->CastSpell(pCreature, 26218, false); + pPlayer->CastSpell(pPlayer, 26218, false); + switch(rand()%3) + { + case 0: pCreature->CastSpell(pPlayer, 26207, false); break; + case 1: pCreature->CastSpell(pPlayer, 26206, false); break; + case 2: pCreature->CastSpell(pPlayer, 45036, false); break; + } + } + return true; +} + +/*#### +## npc_brewfest_reveler +####*/ + +bool ReceiveEmote_npc_brewfest_reveler(Player* pPlayer, Creature* pCreature, uint32 emote) +{ + if (emote == TEXTEMOTE_DANCE) + pCreature->CastSpell(pPlayer, 41586, false); + + return true; +} + +/*#### +## npc_snake_trap_serpents +####*/ + +#define SPELL_MIND_NUMBING_POISON 8692 //Viper +#define SPELL_DEADLY_POISON 34655 //Venomous Snake +#define SPELL_CRIPPLING_POISON 3409 //Viper + +#define VENOMOUS_SNAKE_TIMER 1200 +#define VIPER_TIMER 3000 + +#define C_VIPER 19921 + +#define RAND 5 + +struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI +{ + npc_snake_trap_serpentsAI(Creature *c) : ScriptedAI(c) {} + + uint32 SpellTimer; + bool IsViper; + bool Spawn; + + void EnterCombat(Unit *who) {} + + void Reset() + { + Spawn = true; + SpellTimer = 0; + + CreatureInfo const *Info = m_creature->GetCreatureInfo(); + + if (Info->Entry == C_VIPER) + IsViper = true; + else + IsViper = false; + + //We have to reload the states from db for summoned guardians + m_creature->SetMaxHealth(Info->maxhealth); + m_creature->SetHealth(Info->maxhealth); + m_creature->SetStatFloatValue(UNIT_FIELD_MINDAMAGE, Info->mindmg); + m_creature->SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, Info->maxdmg); + + //Add delta to make them not all hit the same time + uint32 delta = (rand() % 7) *100; + m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); + m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); + } + + //Redefined for random target selection: + void MoveInLineOfSight(Unit *who) + { + if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) + { + if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = m_creature->GetAttackDistance(who); + if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) + { + if (!(rand() % RAND)) + { + m_creature->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); + SpellTimer = (rand() % 10) * 100; + AttackStart(who); + } + } + } + } + + void UpdateAI(const uint32 diff) + { + 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 (!m_creature->getVictim() && m_creature->isSummon()) + if (Unit * Owner = CAST_SUM(m_creature)->GetSummoner()) + if (Owner->getAttackerForHelper()) + AttackStart(Owner->getAttackerForHelper()); + } + + if (!m_creature->getVictim()) + { + if (m_creature->isInCombat()) + DoStopAttack(); + return; + } + + if (SpellTimer < diff) + { + if (IsViper) //Viper + { + if (rand() % 3 == 0) //33% chance to cast + { + uint32 spell; + if (rand() % 2 == 0) + spell = SPELL_MIND_NUMBING_POISON; + else + spell = SPELL_CRIPPLING_POISON; + + DoCast(m_creature->getVictim(),spell); + } + + SpellTimer = VIPER_TIMER; + } + else //Venomous Snake + { + if (rand() % 10 < 8) //80% chance to cast + DoCast(m_creature->getVictim(),SPELL_DEADLY_POISON); + SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; + } + }else SpellTimer-=diff; + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_snake_trap_serpents(Creature* pCreature) +{ + return new npc_snake_trap_serpentsAI(pCreature); +} + +struct TRINITY_DLL_DECL mob_mojoAI : public ScriptedAI +{ + mob_mojoAI(Creature *c) : ScriptedAI(c) {Reset();} + uint32 hearts; + uint64 victimGUID; + void Reset() + { + victimGUID = 0; + hearts = 15000; + Unit* own = m_creature->GetOwner(); + if (own) + m_creature->GetMotionMaster()->MoveFollow(own,0,0); + } + void Aggro(Unit *who){} + void UpdateAI(const uint32 diff) + { + if (m_creature->HasAura(20372,0)) + { + if (heartsRemoveAurasDueToSpell(20372); + hearts = 15000; + }hearts-=diff; + } + } + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + m_creature->HandleEmoteCommand(emote); + Unit* own = m_creature->GetOwner(); + if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != pPlayer->GetTeam()) + return; + if (emote == TEXTEMOTE_KISS) + { + std::string whisp = ""; + switch (rand()%8) + { + case 0:whisp.append("Now that's what I call froggy-style!");break; + case 1:whisp.append("Your lily pad or mine?");break; + case 2:whisp.append("This won't take long, did it?");break; + case 3:whisp.append("I thought you'd never ask!");break; + case 4:whisp.append("I promise not to give you warts...");break; + case 5:whisp.append("Feelin' a little froggy, are ya?");break; + case 6: + whisp.append("Listen, "); + whisp.append(pPlayer->GetName()); + whisp.append(", I know of a little swamp not too far from here...."); + break; + case 7:whisp.append("There's just never enough Mojo to go around...");break; + } + m_creature->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); + if (victimGUID) + { + Player* victim = Unit::GetPlayer(victimGUID); + if (victim) + victim->RemoveAura(43906);//remove polymorph frog thing + } + m_creature->AddAura(43906,pPlayer);//add polymorph frog thing + victimGUID = pPlayer->GetGUID(); + m_creature->CastSpell(m_creature,20372,true);//tag.hearts + m_creature->GetMotionMaster()->MoveFollow(pPlayer,0,0); + hearts = 15000; + } + } +}; + +CreatureAI* GetAI_mob_mojo(Creature* pCreature) +{ + return new mob_mojoAI (pCreature); +} + +struct TRINITY_DLL_DECL npc_mirror_image : SpellCasterAI +{ + npc_mirror_image(Creature *c) : SpellCasterAI(c) {} + + void InitializeAI() + { + SpellCasterAI::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, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE); + } + } +}; + +CreatureAI* GetAI_npc_mirror_image(Creature* pCreature) +{ + return new npc_mirror_image (pCreature); +} + +struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : SpellCasterAI +{ + npc_ebon_gargoyleAI(Creature *c) : SpellCasterAI(c) {} + + int despawnTimer; + + void InitializeAI() + { + SpellCasterAI::InitializeAI(); + Unit * owner = me->GetOwner(); + if (!owner) + return; + // Not needed to be despawned now + despawnTimer = 0; + // Find victim of Summon Gargoyle spell + std::list targets; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); + Trinity::UnitListSearcher searcher(m_creature, targets, u_check); + m_creature->VisitNearbyObject(30, searcher); + for(std::list::iterator iter = targets.begin(); iter != targets.end(); ++iter) + if((*iter)->GetAura(49206,owner->GetGUID())) + { + me->Attack((*iter),false); + break; + } + } + + void JustDied(Unit *killer) + { + // Stop Feeding Gargoyle when it dies + if (Unit *owner = me->GetOwner()) + owner->RemoveAurasDueToSpell(50514); + } + + // 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(m_creature, 54661, true); + me->SetReactState(REACT_PASSIVE); + + // Fly Away + me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE); + me->SetSpeed(MOVE_FLIGHT, 0.25f, true); + me->SetSpeed(MOVE_RUN, 0.25f, true); + float x = me->GetPositionX() + 10 * cos(me->GetOrientation()); + float y = me->GetPositionY() + 10 * sin(me->GetOrientation()); + float z = me->GetPositionZ() + 25; + me->GetMotionMaster()->MovePoint(0, x, y, z); + + // Despawn as soon as possible + despawnTimer = 4 * IN_MILISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (despawnTimer > 0) + { + if (despawnTimer > diff) + despawnTimer -= diff; + else + { + me->ForcedDespawn(); + } + return; + } + SpellCasterAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature) +{ + return new npc_ebon_gargoyleAI (pCreature); +} + +//TODO: 30% Attackdamage check for Lightwell +struct TRINITY_DLL_DECL npc_lightwellAI : public PassiveAI +{ + npc_lightwellAI(Creature *c) : PassiveAI(c) {} + + //uint32 desummon_timer; + + void Reset() + { + //desummon_timer = 180000; + m_creature->CastSpell(m_creature, 59907, false); // Spell for Lightwell Charges + } + + /* + void UpdateAI(const uint32 diff) + { + if (desummon_timer < diff) + { + m_creature->Kill(m_creature); + }else desummon_timer -= diff; + + if (!m_creature->HasAura(59907)) + { + m_creature->Kill(m_creature); + } + } + */ +}; + +CreatureAI* GetAI_npc_lightwellAI(Creature* pCreature) +{ + return new npc_lightwellAI (pCreature); +} + +struct TRINITY_DLL_DECL npc_training_dummy : Scripted_NoMovementAI +{ + npc_training_dummy(Creature *c) : Scripted_NoMovementAI(c) {} + + uint32 ResetTimer; + void Reset() + { + m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave + m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); + ResetTimer = 10000; + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + ResetTimer = 10000; + damage = 0; + } + + void EnterCombat(Unit *who){return;} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) + m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + if (ResetTimer <= diff) + { + EnterEvadeMode(); + ResetTimer = 10000; + }else ResetTimer -= diff; + return; + } + void MoveInLineOfSight(Unit *who){return;} +}; + +CreatureAI* GetAI_npc_training_dummy(Creature* pCreature) +{ + return new npc_training_dummy (pCreature); +} + +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_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->pReceiveEmote = &ReceiveEmote_npc_winter_reveler; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_brewfest_reveler"; + //newscript->pReceiveEmote = &ReceiveEmote_npc_brewfest_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(); +} + -- cgit v1.2.3