diff options
Diffstat (limited to 'src')
9 files changed, 261 insertions, 6 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 322593880f2..70fe9fbc12b 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -391,6 +391,7 @@ SET(trinityscript_LIB_SRCS scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h + scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am index 6efe72e082a..8d871dfcf25 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -388,6 +388,7 @@ scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp \ scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp \ scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp \ scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp \ +scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp \ scripts/zone/wailing_caverns/instance_wailing_caverns.cpp \ scripts/zone/western_plaguelands/western_plaguelands.cpp \ scripts/zone/westfall/westfall.cpp \ diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index ca11c38075c..c2fee40f477 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -567,6 +567,7 @@ extern void AddSC_boss_keleseth(); extern void AddSC_boss_skarvald_dalronn(); extern void AddSC_boss_ingvar_the_plunderer(); extern void AddSC_instance_utgarde_keep(); +extern void AddSC_utgarde_keep(); //Wailing caverns @@ -1498,6 +1499,7 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") AddSC_boss_skarvald_dalronn(); AddSC_boss_ingvar_the_plunderer(); AddSC_instance_utgarde_keep(); + AddSC_utgarde_keep(); //Wailing caverns diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj index e9b98f59799..ae0690f7a35 100644 --- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj +++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj @@ -755,6 +755,10 @@ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp" > </File> + <File + RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\utgarde_keep.cpp" + > + </File> </Filter> <Filter Name="Utgarde Pinnacle" diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 0e623b7959f..20a8b21c4b0 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -924,6 +924,10 @@ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp" > </File> + <File + RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\utgarde_keep.cpp" + > + </File> </Filter> <Filter Name="Utgarde Pinnacle" diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index 62033512632..398e54d6ec4 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2665,6 +2665,10 @@ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp" > </File> + <File + RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\utgarde_keep.cpp" + > + </File> </Filter> <Filter Name="Utgarde Pinnacle" diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h index ec416e5729a..b630e156564 100644 --- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h @@ -28,4 +28,8 @@ #define DATA_SKARVALD_DALRONN_EVENT 5 #define DATA_INGVAR_EVENT 7 +#define EVENT_FORGE_1 8 +#define EVENT_FORGE_2 9 +#define EVENT_FORGE_3 10 + #endif diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp index d1cf7ad33bc..d6f5828d295 100644 --- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp @@ -28,6 +28,18 @@ EndScriptData */ #define ENCOUNTERS 3 +#define ENTRY_BELLOW_1 186688 +#define ENTRY_BELLOW_2 186689 +#define ENTRY_BELLOW_3 186690 + +#define ENTRY_FORGEFIRE_1 186692 +#define ENTRY_FORGEFIRE_2 186693 +#define ENTRY_FORGEFIRE_3 186691 + +#define ENTRY_GLOWING_ANVIL_1 186609 +#define ENTRY_GLOWING_ANVIL_2 186610 +#define ENTRY_GLOWING_ANVIL_3 186611 + /* Utgarde Keep encounters: 0 - Prince Keleseth 1 - Skarvald Dalronn @@ -43,6 +55,10 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance uint64 Dalronn; uint64 Ingvar; + uint64 forge_bellow[3]; + uint64 forge_fire[3]; + uint64 forge_anvil[3]; + uint32 Encounters[ENCOUNTERS]; std::string str_data; @@ -53,6 +69,13 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance Dalronn =0; Ingvar =0; + for(uint8 i= 0; i < 3; i++) + { + forge_bellow[i] = 0; + forge_fire[i] = 0; + forge_anvil[i] = 0; + } + for(uint8 i = 0; i < ENCOUNTERS; ++i) Encounters[i] = NOT_STARTED; } @@ -95,10 +118,19 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance void OnObjectCreate(GameObject* go) { - //switch(go->GetEntry()) - //{ + switch(go->GetEntry()) + { //door and object id - //} + case ENTRY_BELLOW_1: forge_bellow[0] = go->GetGUID(); break; + case ENTRY_BELLOW_2: forge_bellow[1] = go->GetGUID(); break; + case ENTRY_BELLOW_3: forge_bellow[2] = go->GetGUID(); break; + case ENTRY_FORGEFIRE_1: forge_fire[0] = go->GetGUID(); break; + case ENTRY_FORGEFIRE_2: forge_fire[1] = go->GetGUID(); break; + case ENTRY_FORGEFIRE_3: forge_fire[2] = go->GetGUID(); break; + case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = go->GetGUID(); break; + case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = go->GetGUID(); break; + case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = go->GetGUID(); break; + } } uint64 GetData64(uint32 identifier) @@ -123,21 +155,64 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance { //HandleGameObject(doorname, 0); } - Encounters[0] = data;break; + Encounters[0] = data; + break; case DATA_SKARVALD_DALRONN_EVENT: if(data == DONE) { //HandleGameObject(doorname, 0); } - Encounters[1] = data; break; + Encounters[1] = data; + break; case DATA_INGVAR_EVENT: if(data == DONE) { //HandleGameObject(doorname, 0); } - Encounters[2] = data; break; + Encounters[2] = data; + break; + case EVENT_FORGE_1: + if(data == NOT_STARTED) + { + HandleGameObject(forge_bellow[0],false); + HandleGameObject(forge_fire[0],false); + HandleGameObject(forge_anvil[0],false); + }else + { + HandleGameObject(forge_bellow[0],true); + HandleGameObject(forge_fire[0],true); + HandleGameObject(forge_anvil[0],true); + } + break; + case EVENT_FORGE_2: + if(data == NOT_STARTED) + { + HandleGameObject(forge_bellow[1],false); + HandleGameObject(forge_fire[1],false); + HandleGameObject(forge_anvil[1],false); + }else + { + HandleGameObject(forge_bellow[1],true); + HandleGameObject(forge_fire[1],true); + HandleGameObject(forge_anvil[1],true); + } + break; + case EVENT_FORGE_3: + if(data == NOT_STARTED) + { + HandleGameObject(forge_bellow[2],false); + HandleGameObject(forge_fire[2],false); + HandleGameObject(forge_anvil[2],false); + }else + { + HandleGameObject(forge_bellow[2],true); + HandleGameObject(forge_fire[2],true); + HandleGameObject(forge_anvil[2],true); + } + break; } + if (data == DONE) { SaveToDB(); diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp new file mode 100644 index 00000000000..3c2b898653d --- /dev/null +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/utgarde_keep.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2009 Trinity <http://www.trinitycore.org/> + * + * 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 + */ + +#include "precompiled.h" +#include "def_utgarde_keep.h" + +uint32 entry_search[3] = +{ + 186609, + 186610, + 186611 +}; + +struct TRINITY_DLL_DECL npc_dragonflayer_forge_masterAI : public ScriptedAI +{ + npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + fm_Type = 0; + } + + ScriptedInstance* pInstance; + uint8 fm_Type; + + void Reset() + { + if(fm_Type == 0) fm_Type = GetForgeMasterType(); + CheckForge(); + } + + void CheckForge() + { + if(pInstance) + { + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,m_creature->isAlive() ? NOT_STARTED : DONE); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,m_creature->isAlive() ? NOT_STARTED : DONE); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,m_creature->isAlive() ? NOT_STARTED : DONE); + break; + } + } + } + + void JustDied(Unit *killer) + { + if(fm_Type == 0) fm_Type = GetForgeMasterType(); + if(pInstance) + { + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,DONE); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,DONE); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,DONE); + break; + } + } + } + + void EnterCombat(Unit *who) + { + if(fm_Type == 0) fm_Type = GetForgeMasterType(); + if(pInstance) + { + switch(fm_Type) + { + case 1: + pInstance->SetData(EVENT_FORGE_1,IN_PROGRESS); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,IN_PROGRESS); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,IN_PROGRESS); + break; + } + } + m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); + } + + uint8 GetForgeMasterType() + { + float diff = 30.0f; + int near_f = 0; + + for(int i = 0; i < 3 ; i++) + { + GameObject* temp; + temp = FindGameObject(entry_search[i],30,m_creature); + if(temp) + { + if(diff > m_creature->GetDistance2d(temp)) + { + near_f = i + 1; + diff = m_creature->GetDistance2d(temp); + + } + } + } + + switch (near_f) + { + case 1: return 1; + case 2: return 2; + case 3: return 3; + default: return 0; + } + } + + void UpdateAI(const uint32 diff) + { + if(fm_Type == 0) + fm_Type = GetForgeMasterType(); + + if(!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_npc_dragonflayer_forge_master(Creature *_Creature) +{ + return new npc_dragonflayer_forge_masterAI(_Creature); +} + +void AddSC_utgarde_keep() +{ + Script *newscript; + + newscript = new Script; + newscript->Name="npc_dragonflayer_forge_master"; + newscript->GetAI = GetAI_npc_dragonflayer_forge_master; + newscript->RegisterSelf(); +}
\ No newline at end of file |