From 485aab1186f0672eb96a012f4c4b0bdcd444efb8 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Fri, 14 Aug 2009 17:14:08 +0200 Subject: Merge [SD2] r1261 Add GO script to complete lyceum event in BRD. Patch by Turok Some minor cleanup. r1262 Apply SD2 code style to example scripts. Patch by DasBlub r1263 Remove AI for some of the npc's in tomb of seven event (BRD). Note that ACID is required for event to work properly (set instance data). Patch by Turok r1264 Fix typo in filename in previous commit. r1265 Added support for quest 2742 --HG-- branch : trunk --- src/bindings/scripts/CMakeLists.txt | 1 + src/bindings/scripts/ScriptMgr.cpp | 4 + src/bindings/scripts/VC80/80ScriptDev2.vcproj | 4 + src/bindings/scripts/VC90/90ScriptDev2.vcproj | 4 + .../scripts/scripts/examples/example_creature.cpp | 238 +++++---- .../scripts/scripts/examples/example_escort.cpp | 263 +++++----- .../scripts/examples/example_gossip_codebox.cpp | 33 +- .../scripts/scripts/examples/example_misc.cpp | 15 +- .../zone/blackrock_depths/blackrock_depths.cpp | 47 +- .../zone/blackrock_depths/boss_tomb_of_seven.cpp | 584 +-------------------- .../scripts/zone/hinterlands/hinterlands.cpp | 234 +++++++++ .../zone/terokkar_forest/terokkar_forest.cpp | 4 +- 12 files changed, 588 insertions(+), 843 deletions(-) create mode 100644 src/bindings/scripts/scripts/zone/hinterlands/hinterlands.cpp (limited to 'src/bindings/scripts') diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index ff2195eb91a..abb674d0650 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -186,6 +186,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/hellfire_citadel/shattered_halls/boss_warchief_kargath_bladefist.cpp scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp + scripts/zone/hinterlands/hinterlands.cpp scripts/zone/ironforge/ironforge.cpp scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp scripts/zone/karazhan/boss_curator.cpp diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index bff3043ac31..9c6ca874357 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -326,6 +326,8 @@ extern void AddSC_hellfire_peninsula(); //Hillsbrad Foothills //Hinterlands +extern void AddSC_hinterlands(); + //Ironforge extern void AddSC_ironforge(); @@ -1252,6 +1254,8 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Hillsbrad Foothills //Hinterlands + AddSC_hinterlands(); + //Ironforge AddSC_ironforge(); diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 9917fb31336..55241f0486d 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1191,6 +1191,10 @@ + + + + HandleEmoteCommand(uiTextEmote); + + switch(uiTextEmote) + { + case TEXTEMOTE_DANCE: + DoScriptText(SAY_DANCE, m_creature); + break; + case TEXTEMOTE_SALUTE: + DoScriptText(SAY_SALUTE, m_creature); + break; + } + } + //*** HANDLED FUNCTION *** //Update AI is called Every single map update (roughly once every 100ms if a player is within the grid) - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { //Out of combat timers if (!m_creature->getVictim()) { //Random Say timer - if (Say_Timer < diff) + if (m_uiSay_Timer < uiDiff) { //Random switch between 5 outcomes switch (rand()%5) @@ -120,15 +141,19 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI case 4: DoScriptText(SAY_RANDOM_4, m_creature); break; } - Say_Timer = 45000; //Say something agian in 45 seconds - }else Say_Timer -= diff; + m_uiSay_Timer = 45000; //Say something agian in 45 seconds + } + else + m_uiSay_Timer -= uiDiff; //Rebuff timer - if (Rebuff_Timer < diff) + if (m_uiRebuff_Timer < uiDiff) { - DoCast(m_creature,SPELL_BUFF); - Rebuff_Timer = 900000; //Rebuff agian in 15 minutes - }else Rebuff_Timer -= diff; + DoCast(m_creature, SPELL_BUFF); + m_uiRebuff_Timer = 900000; //Rebuff agian in 15 minutes + } + else + m_uiRebuff_Timer -= uiDiff; } //Return since we have no target @@ -136,72 +161,70 @@ struct TRINITY_DLL_DECL example_creatureAI : public ScriptedAI return; //Spell 1 timer - if (Spell_1_Timer < diff) + if (m_uiSpell_1_Timer < uiDiff) { //Cast spell one on our current target. if (rand()%50 > 10) - DoCast(m_creature->getVictim(),SPELL_ONE_ALT); - else if (m_creature->IsWithinDist(m_creature->getVictim(), 25)) - DoCast(m_creature->getVictim(),SPELL_ONE); + DoCast(m_creature->getVictim(), SPELL_ONE_ALT); + else if (m_creature->IsWithinDist(m_creature->getVictim(), 25.0f)) + DoCast(m_creature->getVictim(), SPELL_ONE); - Spell_1_Timer = 5000; - }else Spell_1_Timer -= diff; + m_uiSpell_1_Timer = 5000; + } + else + m_uiSpell_1_Timer -= uiDiff; //Spell 2 timer - if (Spell_2_Timer < diff) - { - //Cast spell one on our current target. - DoCast(m_creature->getVictim(),SPELL_TWO); - - Spell_2_Timer = 37000; - }else Spell_2_Timer -= diff; - - //Spell 3 timer - if (Phase > 1) - if (Spell_3_Timer < diff) + if (m_uiSpell_2_Timer < uiDiff) { //Cast spell one on our current target. - DoCast(m_creature->getVictim(),SPELL_THREE); - - Spell_3_Timer = 19000; - }else Spell_3_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_TWO); + m_uiSpell_2_Timer = 37000; + } + else + m_uiSpell_2_Timer -= uiDiff; //Beserk timer - if (Phase > 1) - if (Beserk_Timer < diff) + if (m_uiPhase > 1) { - //Say our line then cast uber death spell - DoScriptText(SAY_BESERK, m_creature, m_creature->getVictim()); - DoCast(m_creature->getVictim(),SPELL_BESERK); + //Spell 3 timer + if (m_uiSpell_3_Timer < uiDiff) + { + //Cast spell one on our current target. + DoCast(m_creature->getVictim(), SPELL_THREE); - //Cast our beserk spell agian in 12 seconds if we didn't kill everyone - Beserk_Timer = 12000; - }else Beserk_Timer -= diff; + m_uiSpell_3_Timer = 19000; + } + else + m_uiSpell_3_Timer -= uiDiff; - //Phase timer - if (Phase == 1) - if (Phase_Timer < diff) + if (m_uiBeserk_Timer < uiDiff) + { + //Say our line then cast uber death spell + DoScriptText(SAY_BESERK, m_creature, m_creature->getVictim()); + DoCast(m_creature->getVictim(), SPELL_BESERK); + + //Cast our beserk spell agian in 12 seconds if we didn't kill everyone + m_uiBeserk_Timer = 12000; + } + else + m_uiBeserk_Timer -= uiDiff; + } + else if (m_uiPhase == 1) //Phase timer { - //Go to next phase - Phase++; - DoScriptText(SAY_PHASE, m_creature); - DoCast(m_creature,SPELL_ENRAGE); - }else Phase_Timer -= diff; + if (m_uiPhase_Timer < uiDiff) + { + //Go to next phase + ++m_uiPhase; + DoScriptText(SAY_PHASE, m_creature); + DoCast(m_creature, SPELL_ENRAGE); + } + else + m_uiPhase_Timer -= uiDiff; + } DoMeleeAttackIfReady(); } - - //Our Recive emote function - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - m_creature->HandleEmoteCommand(emote); - - if (emote == TEXTEMOTE_DANCE) - DoScriptText(SAY_DANCE, m_creature); - - if (emote == TEXTEMOTE_SALUTE) - DoScriptText(SAY_SALUTE, m_creature); - } }; //This is the GetAI method used by all scripts that involve AI @@ -212,22 +235,15 @@ CreatureAI* GetAI_example_creature(Creature* pCreature) } //This function is called when the player clicks an option on the gossip menu -void SendDefaultMenu_example_creature(Player* pPlayer, Creature* pCreature, uint32 action) +bool GossipSelect_example_creature(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - if (action == GOSSIP_ACTION_INFO_DEF + 1) //Fight time + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { + pPlayer->CLOSE_GOSSIP_MENU(); //Set our faction to hostile twoards all - pCreature->setFaction(24); - pCreature->Attack(pPlayer, true); - pPlayer->PlayerTalkClass->CloseGossip(); + pCreature->setFaction(FACTION_WORGEN); + pCreature->AI()->AttackStart(pPlayer); } -} - -//This function is called when the player clicks an option on the gossip menu -bool GossipSelect_example_creature(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) -{ - if (sender == GOSSIP_SENDER_MAIN) - SendDefaultMenu_example_creature(pPlayer, pCreature, action); return true; } @@ -235,19 +251,17 @@ bool GossipSelect_example_creature(Player* pPlayer, Creature* pCreature, uint32 //This function is called when the player opens the gossip menu bool GossipHello_example_creature(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); return true; } //This is the actual function called only once durring InitScripts() //It must define all handled functions that are to be run in this script -//For example if you want this Script to handle Emotes you must include -//newscript->ReciveEmote = My_Emote_Function; void AddSC_example_creature() { - Script *newscript; + Script* newscript; newscript = new Script; newscript->Name = "example_creature"; diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index bef0f7a2781..5d897a8183d 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -24,18 +24,27 @@ EndScriptData */ #include "precompiled.h" #include "../npc/npc_escortAI.h" -#define SAY_AGGRO1 -1999910 -#define SAY_AGGRO2 -1999911 -#define SAY_WP_1 -1999912 -#define SAY_WP_2 -1999913 -#define SAY_WP_3 -1999914 -#define SAY_WP_4 -1999915 -#define SAY_DEATH_1 -1999916 -#define SAY_DEATH_2 -1999917 -#define SAY_DEATH_3 -1999918 -#define SAY_SPELL -1999919 -#define SAY_RAND_1 -1999920 -#define SAY_RAND_2 -1999921 +enum +{ + NPC_FELBOAR = 21878, + + SPELL_DEATH_COIL = 33130, + SPELL_ELIXIR_OF_FORTITUDE = 3593, + SPELL_BLUE_FIREWORK = 11540, + + SAY_AGGRO1 = -1999910, + SAY_AGGRO2 = -1999911, + SAY_WP_1 = -1999912, + SAY_WP_2 = -1999913, + SAY_WP_3 = -1999914, + SAY_WP_4 = -1999915, + SAY_DEATH_1 = -1999916, + SAY_DEATH_2 = -1999917, + SAY_DEATH_3 = -1999918, + SAY_SPELL = -1999919, + SAY_RAND_1 = -1999920, + SAY_RAND_2 = -1999921 +}; #define GOSSIP_ITEM_1 "Click to Test Escort(Attack, Run)" #define GOSSIP_ITEM_2 "Click to Test Escort(NoAttack, Walk)" @@ -43,178 +52,180 @@ EndScriptData */ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { - public: + // CreatureAI functions + example_escortAI(Creature* pCreature) : npc_escortAI(pCreature) { } - // CreatureAI functions - example_escortAI(Creature *c) : npc_escortAI(c) {Reset();} + uint32 m_uiDeathCoilTimer; + uint32 m_uiChatTimer; - uint32 DeathCoilTimer; - uint32 ChatTimer; + void JustSummoned(Creature* pSummoned) + { + pSummoned->AI()->AttackStart(m_creature); + } - // Pure Virtual Functions - void WaypointReached(uint32 i) + // Pure Virtual Functions (Have to be implemented) + void WaypointReached(uint32 uiWP) + { + switch (uiWP) { - switch (i) - { - case 1: - DoScriptText(SAY_WP_1, m_creature); - break; - - case 3: - { - DoScriptText(SAY_WP_2, m_creature); - Creature* temp = m_creature->SummonCreature(21878, m_creature->GetPositionX()+5, m_creature->GetPositionY()+7, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); - if (temp) - temp->AI()->AttackStart(m_creature); - } + case 1: + DoScriptText(SAY_WP_1, m_creature); break; - - case 4: + case 3: + DoScriptText(SAY_WP_2, m_creature); + m_creature->SummonCreature(NPC_FELBOAR, m_creature->GetPositionX()+5.0f, m_creature->GetPositionY()+7.0f, m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); + break; + case 4: + if (Unit* pTmpPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) { - Unit* temp = Unit::GetUnit(*m_creature, PlayerGUID); - if (temp) - { - //temp is the target of the text - DoScriptText(SAY_WP_3, m_creature, temp); - //temp is the source of the text - DoScriptText(SAY_WP_4, temp); - } + //pTmpPlayer is the target of the text + DoScriptText(SAY_WP_3, m_creature, pTmpPlayer); + //pTmpPlayer is the source of the text + DoScriptText(SAY_WP_4, pTmpPlayer); } break; - } } + } - void EnterCombat(Unit* who) + void EnterCombat(Unit* pWho) + { + if (IsBeingEscorted) { - if (IsBeingEscorted) - { - if (Unit* temp = Unit::GetUnit(*m_creature, PlayerGUID)) - DoScriptText(SAY_AGGRO1, m_creature, temp); - } - else DoScriptText(SAY_AGGRO2, m_creature); + if (Unit* pTemp = Unit::GetUnit(*m_creature, PlayerGUID)) + DoScriptText(SAY_AGGRO1, m_creature, pTemp); } + else + DoScriptText(SAY_AGGRO2, m_creature); + } - void Reset() - { - DeathCoilTimer = 4000; - ChatTimer = 4000; - } + void Reset() + { + m_uiDeathCoilTimer = 4000; + m_uiChatTimer = 4000; + } - void JustDied(Unit* killer) + void JustDied(Unit* pKiller) + { + if (IsBeingEscorted) { - if (IsBeingEscorted) + if (Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID)) { - Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID); - //killer = m_creature when player got to far from creature - if (killer == m_creature) + // not a likely case, code here for the sake of example + if (pKiller == m_creature) { - //This is actually a whisper. You control the text type in database - if (pTemp) - DoScriptText(SAY_DEATH_1, m_creature, pTemp); + DoScriptText(SAY_DEATH_1, m_creature, pTemp); } - else if (pTemp) DoScriptText(SAY_DEATH_2, m_creature, pTemp); + else + DoScriptText(SAY_DEATH_2, m_creature, pTemp); } - else DoScriptText(SAY_DEATH_3, m_creature); } + else + DoScriptText(SAY_DEATH_3, m_creature); + } - void UpdateAI(const uint32 diff) - { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); + void UpdateAI(const uint32 uiDiff) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(uiDiff); - //Combat check - if (m_creature->getVictim()) + //Combat check + if (m_creature->getVictim()) + { + if (m_uiDeathCoilTimer < uiDiff) { - if (DeathCoilTimer < diff) - { - DoScriptText(SAY_SPELL, m_creature); - m_creature->CastSpell(m_creature->getVictim(), 33130, false); - - DeathCoilTimer = 4000; - }else DeathCoilTimer -= diff; + DoScriptText(SAY_SPELL, m_creature); + m_creature->CastSpell(m_creature->getVictim(), SPELL_DEATH_COIL, false); + m_uiDeathCoilTimer = 4000; } - else if (!m_creature->isInCombat()) + else + m_uiDeathCoilTimer -= uiDiff; + } + else + { + //Out of combat but being escorted + if (IsBeingEscorted) { - //Out of combat but being escorted - if (IsBeingEscorted) - if (ChatTimer < diff) + if (m_uiChatTimer < uiDiff) { - if (m_creature->HasAura(3593)) + if (m_creature->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0)) { DoScriptText(SAY_RAND_1, m_creature); - m_creature->CastSpell(m_creature, 11540, false); - }else + m_creature->CastSpell(m_creature, SPELL_BLUE_FIREWORK, false); + } + else { DoScriptText(SAY_RAND_2, m_creature); - m_creature->CastSpell(m_creature, 3593, false); + m_creature->CastSpell(m_creature, SPELL_ELIXIR_OF_FORTITUDE, false); } - ChatTimer = 12000; - }else ChatTimer -= diff; + m_uiChatTimer = 12000; + } + else + m_uiChatTimer -= uiDiff; } } + } }; CreatureAI* GetAI_example_escort(Creature* pCreature) { - example_escortAI* testAI = new example_escortAI(pCreature); - - testAI->AddWaypoint(0, 1231, -4419, 23); - testAI->AddWaypoint(1, 1198, -4440, 23, 0); - testAI->AddWaypoint(2, 1208, -4392, 23); - testAI->AddWaypoint(3, 1231, -4419, 23, 5000); - testAI->AddWaypoint(4, 1208, -4392, 23, 5000); - - return testAI; + example_escortAI* pTestAI = new example_escortAI(pCreature); + + // this should be done over the db table scriptdev2.script_waypoint + // when using the db, you have to call this line instead of the ->AddWaypoint(): + // pTestAI->FillPointMovementListForCreature(); + pTestAI->AddWaypoint(0, 1231.0f, -4419.0f, 23.0f); + pTestAI->AddWaypoint(1, 1198.0f, -4440.0f, 23.0f); + pTestAI->AddWaypoint(2, 1208.0f, -4392.0f, 23.0f); + pTestAI->AddWaypoint(3, 1231.0f, -4419.0f, 23.0f, 5000); + pTestAI->AddWaypoint(4, 1208.0f, -4392.0f, 23.0f, 5000); + + return pTestAI; } bool GossipHello_example_escort(Player* pPlayer, Creature* pCreature) { pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->prepareGossipMenu(pPlayer,0); + pCreature->prepareGossipMenu(pPlayer, 0); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); pCreature->sendPreparedGossip(pPlayer); + return true; } -bool GossipSelect_example_escort(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) +bool GossipSelect_example_escort(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 uiAction) { npc_escortAI* pEscortAI = CAST_AI(example_escortAI, pCreature->AI()); - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pEscortAI) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - - return true; // prevent mangos core handling - } - - if (action == GOSSIP_ACTION_INFO_DEF+2) + switch(uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pEscortAI) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - - return true; // prevent mangos core handling + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + + if (pEscortAI) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + + if (pEscortAI) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + + if (pEscortAI) + pEscortAI->Start(false, true, pPlayer->GetGUID()); + break; + default: + return false; // nothing defined -> trinity core handling } - if (action == GOSSIP_ACTION_INFO_DEF+3) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pEscortAI) - pEscortAI->Start(false, true, pPlayer->GetGUID()); - - return true; // prevent mangos core handling - } - return false; + return true; // no default handling -> prevent trinity core handling } void AddSC_example_escort() diff --git a/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp b/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp index 105a3c9527e..50ddf9d3202 100644 --- a/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp +++ b/src/bindings/scripts/scripts/examples/example_gossip_codebox.cpp @@ -24,9 +24,15 @@ EndScriptData */ #include "precompiled.h" #include -#define SAY_NOT_INTERESTED -1999922 -#define SAY_WRONG -1999923 -#define SAY_CORRECT -1999924 +enum +{ + SPELL_POLYMORPH = 12826, + SPELL_MARK_OF_THE_WILD = 26990, + + SAY_NOT_INTERESTED = -1999922, + SAY_WRONG = -1999923, + SAY_CORRECT = -1999924 +}; #define GOSSIP_ITEM_1 "A quiz: what's your name?" #define GOSSIP_ITEM_2 "I'm not interested" @@ -38,46 +44,51 @@ bool GossipHello_example_gossip_codebox(Player* pPlayer, Creature* pCreature) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); + return true; } //This function is called when the player clicks an option on the gossip menubool -bool GossipSelect_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action) +bool GossipSelect_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - if (action == GOSSIP_ACTION_INFO_DEF+2) + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) { DoScriptText(SAY_NOT_INTERESTED, pCreature); pPlayer->CLOSE_GOSSIP_MENU(); } + return true; } -bool GossipSelectWithCode_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* sCode) +bool GossipSelectWithCode_example_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) { - if (sender == GOSSIP_SENDER_MAIN) + if (uiSender == GOSSIP_SENDER_MAIN) { - if (action == GOSSIP_ACTION_INFO_DEF+1) + switch (uiAction) { + case GOSSIP_ACTION_INFO_DEF+1: if (std::strcmp(sCode, pPlayer->GetName())!=0) { DoScriptText(SAY_WRONG, pCreature); - pCreature->CastSpell(pPlayer, 12826, true); + pCreature->CastSpell(pPlayer, SPELL_POLYMORPH, true); } else { DoScriptText(SAY_CORRECT, pCreature); - pCreature->CastSpell(pPlayer, 26990, true); + pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD, true); } pPlayer->CLOSE_GOSSIP_MENU(); + return true; } } + return false; } void AddSC_example_gossip_codebox() { - Script *newscript; + Script* newscript; newscript = new Script; newscript->Name = "example_gossip_codebox"; diff --git a/src/bindings/scripts/scripts/examples/example_misc.cpp b/src/bindings/scripts/scripts/examples/example_misc.cpp index da2933a133c..1bb1a7a0b9a 100644 --- a/src/bindings/scripts/scripts/examples/example_misc.cpp +++ b/src/bindings/scripts/scripts/examples/example_misc.cpp @@ -23,30 +23,33 @@ EndScriptData */ #include "precompiled.h" -#define SAY_HI -1999925 +enum +{ + SAY_HI = -1999925 +}; -bool AT_example_areatrigger(Player* pPlayer, AreaTriggerEntry *at) +bool AT_example_areatrigger(Player* pPlayer, AreaTriggerEntry *pAt) { DoScriptText(SAY_HI, pPlayer); return true; } extern void LoadDatabase(); -bool ItemUse_example_item(Player* pPlayer, Item* _Item, SpellCastTargets const& targets) +bool ItemUse_example_item(Player* pPlayer, Item* pItem, SpellCastTargets const& scTargets) { LoadDatabase(); return true; } -bool GOHello_example_go_teleporter(Player* pPlayer, GameObject* _GO) +bool GOHello_example_go_teleporter(Player* pPlayer, GameObject* pGo) { - pPlayer->TeleportTo(0, 1807.07f,336.105f,70.3975f,0.0f); + pPlayer->TeleportTo(0, 1807.07f, 336.105f, 70.3975f, 0.0f); return false; } void AddSC_example_misc() { - Script *newscript; + Script* newscript; newscript = new Script; newscript->Name = "example_areatrigger"; diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp index d4acbcccbc6..1825c8825b8 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp @@ -23,6 +23,7 @@ SDCategory: Blackrock Depths EndScriptData */ /* ContentData +go_shadowforge_brazier at_ring_of_law npc_grimstone mob_phalanx @@ -39,11 +40,34 @@ EndContentData */ #include "../../npc/npc_escortAI.h" #include "def_blackrock_depths.h" -#define C_GRIMSTONE 10096 -#define C_THELDREN 16059 +/*###### ++## go_shadowforge_brazier ++######*/ + +bool GOHello_go_shadowforge_brazier(Player* pPlayer, GameObject* pGo) +{ + if (ScriptedInstance* pInstance = (ScriptedInstance*)pGo->GetInstanceData()) + { + if (pInstance->GetData(TYPE_LYCEUM) == IN_PROGRESS) + pInstance->SetData(TYPE_LYCEUM, DONE); + else + pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS); + } + return false; +} + +/*###### +## npc_grimstone +######*/ -//4 or 6 in total? 1+2+1 / 2+2+2 / 3+3. Depending on this, code should be changed. -#define MOB_AMOUNT 4 +enum +{ + NPC_GRIMSTONE = 10096, + NPC_THELDREN = 16059, + + //4 or 6 in total? 1+2+1 / 2+2+2 / 3+3. Depending on this, code should be changed. + MAX_MOB_AMOUNT = 4 +}; uint32 RingMob[]= { @@ -69,13 +93,13 @@ bool AreaTrigger_at_ring_of_law(Player* pPlayer, AreaTriggerEntry *at) { ScriptedInstance* pInstance = (pPlayer->GetInstanceData()); - if (pInstance) + if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) { if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) return false; pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); - pPlayer->SummonCreature(C_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + pPlayer->SummonCreature(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); return false; } @@ -119,7 +143,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI MobCount = 0; MobDeath_Timer = 0; - for(uint8 i = 0; i < MOB_AMOUNT; ++i) + for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) RingMobGUID[i] = 0; RingBossGUID = 0; @@ -135,7 +159,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI ++MobCount; - if (MobCount == MOB_AMOUNT) + if (MobCount == MAX_MOB_AMOUNT) MobDeath_Timer = 2500; } @@ -212,7 +236,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI return; } - for(uint8 i = 0; i < MOB_AMOUNT; ++i) + for(uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) { Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]); if (mob && !mob->isAlive() && mob->isDead()) @@ -1212,6 +1236,11 @@ void AddSC_blackrock_depths() { Script *newscript; + newscript = new Script; + newscript->Name = "go_shadowforge_brazier"; + newscript->pGOHello = &GOHello_go_shadowforge_brazier; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name = "at_ring_of_law"; newscript->pAreaTrigger = &AreaTrigger_at_ring_of_law; diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp index a9c3d1d9ebd..bec4e4a3ec7 100644 --- a/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp +++ b/src/bindings/scripts/scripts/zone/blackrock_depths/boss_tomb_of_seven.cpp @@ -26,566 +26,22 @@ EndScriptData */ enum { - SPELL_SUNDERARMOR = 11971, - SPELL_SHIELDBLOCK = 12169, - SPELL_STRIKE = 15580 + SPELL_SMELT_DARK_IRON = 14891, + SPELL_LEARN_SMELT = 14894, + QUEST_SPECTRAL_CHALICE = 4083, + SKILLPOINT_MIN = 230 }; -struct TRINITY_DLL_DECL boss_angerrelAI : public ScriptedAI -{ - boss_angerrelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 SunderArmor_Timer; - uint32 ShieldBlock_Timer; - uint32 Strike_Timer; - - void Reset() - { - SunderArmor_Timer = 8000; - ShieldBlock_Timer = 15000; - Strike_Timer = 12000; - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //SunderArmor_Timer - if (SunderArmor_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SUNDERARMOR); - SunderArmor_Timer = 28000; - }else SunderArmor_Timer -= diff; - - //ShieldBlock_Timer - if (ShieldBlock_Timer < diff) - { - DoCast(m_creature,SPELL_SHIELDBLOCK); - ShieldBlock_Timer = 25000; - }else ShieldBlock_Timer -= diff; - - //Strike_Timer - if (Strike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_STRIKE); - Strike_Timer = 10000; - }else Strike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_angerrel(Creature* pCreature) -{ - return new boss_angerrelAI (pCreature); -} - -enum -{ - SPELL_SINISTERSTRIKE = 15581, - SPELL_BACKSTAB = 15582, - SPELL_GOUGE = 12540 -}; - -struct TRINITY_DLL_DECL boss_doperelAI : public ScriptedAI -{ - boss_doperelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 SinisterStrike_Timer; - uint32 BackStab_Timer; - uint32 Gouge_Timer; - - void Reset() - { - SinisterStrike_Timer = 8000; - BackStab_Timer = 12000; - Gouge_Timer = 6000; - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //SinisterStrike_Timer - if (SinisterStrike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_SINISTERSTRIKE); - SinisterStrike_Timer = 7000; - }else SinisterStrike_Timer -= diff; - - //BackStab_Timer - if (BackStab_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_BACKSTAB); - BackStab_Timer = 6000; - }else BackStab_Timer -= diff; - - //Gouge_Timer - if (Gouge_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_GOUGE); - Gouge_Timer = 8000; - }else Gouge_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_doperel(Creature* pCreature) -{ - return new boss_doperelAI (pCreature); -} - -enum -{ - SPELL_SHADOWBOLT = 15232, - SPELL_MANABURN = 14033, - SPELL_SHADOWSHIELD = 12040 -}; - -struct TRINITY_DLL_DECL boss_haterelAI : public ScriptedAI -{ - boss_haterelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 ShadowBolt_Timer; - uint32 ManaBurn_Timer; - uint32 ShadowShield_Timer; - uint32 Strike_Timer; - - void Reset() - { - ShadowBolt_Timer = 15000; - ManaBurn_Timer = 3000; - ShadowShield_Timer = 8000; - Strike_Timer = 12000; - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //ShadowBolt_Timer - if (ShadowBolt_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_SHADOWBOLT); - ShadowBolt_Timer = 7000; - }else ShadowBolt_Timer -= diff; - - //ManaBurn_Timer - if (ManaBurn_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_MANABURN); - - ManaBurn_Timer = 13000; - }else ManaBurn_Timer -= diff; - - //ShadowShield_Timer - if (ShadowShield_Timer < diff) - { - DoCast(m_creature,SPELL_SHADOWSHIELD); - ShadowShield_Timer = 25000; - }else ShadowShield_Timer -= diff; - - //Strike_Timer - if (Strike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_STRIKE); - Strike_Timer = 10000; - }else Strike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_haterel(Creature* pCreature) -{ - return new boss_haterelAI (pCreature); -} - -enum -{ - SPELL_MINDBLAST = 15587, - SPELL_HEAL = 15586, - SPELL_PRAYEROFHEALING = 15585, - SPELL_SHIELD = 11974 -}; - -struct TRINITY_DLL_DECL boss_vilerelAI : public ScriptedAI -{ - boss_vilerelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 MindBlast_Timer; - uint32 Heal_Timer; - uint32 PrayerOfHealing_Timer; - uint32 Shield_Timer; - - void Reset() - { - MindBlast_Timer = 10000; - Heal_Timer = 35000; - PrayerOfHealing_Timer = 25000; - Shield_Timer = 3000; - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //MindBlast_Timer - if (MindBlast_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_MINDBLAST); - MindBlast_Timer = 7000; - }else MindBlast_Timer -= diff; - - //Heal_Timer - if (Heal_Timer < diff) - { - DoCast(m_creature,SPELL_HEAL); - Heal_Timer = 20000; - }else Heal_Timer -= diff; - - //PrayerOfHealing_Timer - if (PrayerOfHealing_Timer < diff) - { - DoCast(m_creature,SPELL_PRAYEROFHEALING); - PrayerOfHealing_Timer = 30000; - }else PrayerOfHealing_Timer -= diff; - - //Shield_Timer - if (Shield_Timer < diff) - { - DoCast(m_creature,SPELL_SHIELD); - Shield_Timer = 30000; - }else Shield_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_vilerel(Creature* pCreature) -{ - return new boss_vilerelAI (pCreature); -} - -enum -{ - SPELL_FROSTBOLT = 12675, - SPELL_FROSTARMOR = 12544, //This is actually a buff he gives himself - SPELL_CONEOFCOLD = 15244, - SPELL_FROSTNOVA = 12674, - SPELL_FROSTWARD = 15044 -}; - -struct TRINITY_DLL_DECL boss_seethrelAI : public ScriptedAI -{ - boss_seethrelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 FrostArmor_Timer; - uint32 Frostbolt_Timer; - uint32 ConeofCold_Timer; - uint32 FrostNova_Timer; - uint32 FrostWard_Timer; - - void Reset() - { - FrostArmor_Timer = 2000; - Frostbolt_Timer = 6000; - ConeofCold_Timer = 18000; - FrostNova_Timer = 12000; - FrostWard_Timer = 25000; - - m_creature->CastSpell(m_creature,SPELL_FROSTARMOR,true); - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //FrostArmor_Timer - if (FrostArmor_Timer < diff) - { - DoCast(m_creature, SPELL_FROSTARMOR); - FrostArmor_Timer = 180000; - }else FrostArmor_Timer -= diff; - - //Frostbolt_Timer - if (Frostbolt_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); - Frostbolt_Timer = 15000; - }else Frostbolt_Timer -= diff; - - //ConeofCold_Timer - if (ConeofCold_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_CONEOFCOLD); - - ConeofCold_Timer = 22000; - }else ConeofCold_Timer -= diff; - - //FrostNova_Timer - if (FrostNova_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FROSTNOVA); - FrostNova_Timer = 14000; - }else FrostNova_Timer -= diff; - - //FrostWard_Timer - if (FrostWard_Timer < diff) - { - DoCast(m_creature,SPELL_FROSTWARD); - FrostWard_Timer = 68000; - }else FrostWard_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_seethrel(Creature* pCreature) -{ - return new boss_seethrelAI (pCreature); -} - -enum -{ - SPELL_HAMSTRING = 9080, - SPELL_CLEAVE = 40504, - SPELL_MORTALSTRIKE = 13737 -}; - -struct TRINITY_DLL_DECL boss_gloomrelAI : public ScriptedAI -{ - boss_gloomrelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 Hamstring_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - - void Reset() - { - Hamstring_Timer = 19000; - Cleave_Timer = 6000; - MortalStrike_Timer = 10000; - - m_creature->setFaction(FACTION_FRIEND); - } - - void EnterCombat(Unit *who) - { - } - - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - if (m_creature->isAlive()) - m_creature->GetMotionMaster()->MoveTargetedHome(); - m_creature->SetLootRecipient(NULL); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER, 0); - } - - void JustDied(Unit *who) - { - if (pInstance) - pInstance->SetData(DATA_GHOSTKILL, 1); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Hamstring_Timer - if (Hamstring_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_HAMSTRING); - Hamstring_Timer = 14000; - }else Hamstring_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); - Cleave_Timer = 8000; - }else Cleave_Timer -= diff; - - //MortalStrike_Timer - if (MortalStrike_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_MORTALSTRIKE); - MortalStrike_Timer = 12000; - }else MortalStrike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_gloomrel(Creature* pCreature) -{ - return new boss_gloomrelAI (pCreature); -} - #define GOSSIP_ITEM_TEACH_1 "Teach me the art of smelting dark iron" #define GOSSIP_ITEM_TEACH_2 "Continue..." #define GOSSIP_ITEM_TRIBUTE "I want to pay tribute" bool GossipHello_boss_gloomrel(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestRewardStatus(4083) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= 230 && !pPlayer->HasSpell(14891)) + if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= SKILLPOINT_MIN && !pPlayer->HasSpell(SPELL_SMELT_DARK_IRON)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (pPlayer->GetQuestRewardStatus(4083) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= 230) + if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= SKILLPOINT_MIN) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID()); @@ -602,7 +58,7 @@ bool GossipSelect_boss_gloomrel(Player* pPlayer, Creature* pCreature, uint32 sen break; case GOSSIP_ACTION_INFO_DEF+11: pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 14894, false); + pCreature->CastSpell(pPlayer, SPELL_LEARN_SMELT, false); break; case GOSSIP_ACTION_INFO_DEF+2: pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "[PH] Continue...", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); @@ -777,34 +233,8 @@ void AddSC_boss_tomb_of_seven() { Script *newscript; - newscript = new Script; - newscript->Name = "boss_angerrel"; - newscript->GetAI = &GetAI_boss_angerrel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_doperel"; - newscript->GetAI = &GetAI_boss_doperel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_haterel"; - newscript->GetAI = &GetAI_boss_haterel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_vilerel"; - newscript->GetAI = &GetAI_boss_vilerel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_seethrel"; - newscript->GetAI = &GetAI_boss_seethrel; - newscript->RegisterSelf(); - newscript = new Script; newscript->Name = "boss_gloomrel"; - newscript->GetAI = &GetAI_boss_gloomrel; newscript->pGossipHello = &GossipHello_boss_gloomrel; newscript->pGossipSelect = &GossipSelect_boss_gloomrel; newscript->RegisterSelf(); diff --git a/src/bindings/scripts/scripts/zone/hinterlands/hinterlands.cpp b/src/bindings/scripts/scripts/zone/hinterlands/hinterlands.cpp new file mode 100644 index 00000000000..f5014844809 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/hinterlands/hinterlands.cpp @@ -0,0 +1,234 @@ +/* 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: Hinterlands +SD%Complete: 100 +SDComment: Quest support: 2742 +SDCategory: The Hinterlands +EndScriptData */ + +/* ContentData +npc_rinji +EndContentData */ + +#include "precompiled.h" +#include "../../npc/npc_escortAI.h" + +/*###### +## npc_rinji +######*/ + +enum +{ + SAY_RIN_FREE = -1000403, + SAY_RIN_BY_OUTRUNNER = -1000404, + SAY_RIN_HELP_1 = -1000405, + SAY_RIN_HELP_2 = -1000406, + SAY_RIN_COMPLETE = -1000407, + SAY_RIN_PROGRESS_1 = -1000408, + SAY_RIN_PROGRESS_2 = -1000409, + + QUEST_RINJI_TRAPPED = 2742, + NPC_RANGER = 2694, + NPC_OUTRUNNER = 2691, + GO_RINJI_CAGE = 142036 +}; + +struct Location +{ + float m_fX, m_fY, m_fZ; +}; + +Location m_afAmbushSpawn[] = +{ + {191.296204, -2839.329346, 107.388}, + {70.972466, -2848.674805, 109.459} +}; + +Location m_afAmbushMoveTo[] = +{ + {166.630386, -2824.780273, 108.153}, + {70.886589, -2874.335449, 116.675} +}; + +struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI +{ + npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; + } + + bool m_bIsByOutrunner; + uint32 m_uiPostEventCount; + uint32 m_uiPostEventTimer; + int m_iSpawnId; + + void Reset() + { + m_uiPostEventCount = 0; + m_uiPostEventTimer = 3000; + } + + void JustRespawned() + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; + + npc_escortAI::JustRespawned(); + } + + void EnterCombat(Unit* pWho) + { + if (IsBeingEscorted) + { + if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) + { + DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); + m_bIsByOutrunner = true; + } + + if (rand()%4) + return; + + //only if attacked and escorter is not in combat? + switch(rand()%2) + { + case 0: DoScriptText(SAY_RIN_HELP_1, m_creature); break; + case 1: DoScriptText(SAY_RIN_HELP_2, m_creature); break; + } + } + } + + void DoSpawnAmbush(bool bFirst) + { + if (!bFirst) + m_iSpawnId = 1; + + m_creature->SummonCreature(NPC_RANGER, + m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, + TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + + for(int i = 0; i < 2; ++i) + { + m_creature->SummonCreature(NPC_OUTRUNNER, + m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, + TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + } + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); + } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 1: + DoScriptText(SAY_RIN_FREE, m_creature, pPlayer); + break; + case 7: + DoSpawnAmbush(true); + break; + case 13: + DoSpawnAmbush(false); + break; + case 17: + DoScriptText(SAY_RIN_COMPLETE, m_creature, pPlayer); + pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, m_creature); + SetRun(); + m_uiPostEventCount = 1; + break; + } + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (IsBeingEscorted && m_uiPostEventCount && !m_creature->getVictim()) + { + if (m_uiPostEventTimer < uiDiff) + { + m_uiPostEventTimer = 3000; + + if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + { + switch(m_uiPostEventCount) + { + case 1: + DoScriptText(SAY_RIN_PROGRESS_1, m_creature, pPlayer); + ++m_uiPostEventCount; + break; + case 2: + DoScriptText(SAY_RIN_PROGRESS_2, m_creature, pPlayer); + m_uiPostEventCount = 0; + break; + } + } + else + { + m_creature->ForcedDespawn(); + return; + } + } + else + m_uiPostEventTimer -= uiDiff; + } + } +}; + +bool QuestAccept_npc_rinji(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) + { + if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) + pGo->UseDoorOrButton(); + + if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinjiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return true; +} + +CreatureAI* GetAI_npc_rinji(Creature* pCreature) +{ + npc_rinjiAI* pTempAI = new npc_rinjiAI(pCreature); + + pTempAI->FillPointMovementListForCreature(); + + return (CreatureAI*)pTempAI; +} + +void AddSC_hinterlands() +{ + Script* newscript; + + newscript = new Script; + newscript->Name = "npc_rinji"; + newscript->GetAI = &GetAI_npc_rinji; + newscript->pQuestAccept = &QuestAccept_npc_rinji; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp index 38e4f274513..2cf024a66b7 100644 --- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp @@ -663,12 +663,12 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI } }; -bool QuestAccept_npc_akuno(Player* player, Creature* pCreature, Quest const* pQuest) +bool QuestAccept_npc_akuno(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if(pQuest->GetQuestId() == QUEST_NPC_AKUNO) { if (npc_akunoAI* pEscortAI = CAST_AI(npc_akunoAI, pCreature->AI())) - pEscortAI->Start(false,true,player->GetGUID()); + pEscortAI->Start(false, true, pPlayer->GetGUID()); } return true; } -- cgit v1.2.3