mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
*Add script for Utgard Keep - Forge Master (Forge Fire Event)
--HG-- branch : trunk
This commit is contained in:
1
sql/updates/3120_world_scripts.sql
Normal file
1
sql/updates/3120_world_scripts.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `creature_template` SET `ScriptName`='npc_dragonflayer_forge_master' WHERE `entry` = 24079;
|
||||
@@ -962,6 +962,7 @@ UPDATE `creature_template` SET `ScriptName`= 'boss_dalronn_the_controller' WHERE
|
||||
UPDATE `creature_template` SET `ScriptName`='boss_ingvar_the_plunderer' WHERE `entry`=23954;
|
||||
UPDATE `creature_template` SET `ScriptName`='mob_annhylde_the_caller' WHERE `entry`=24068;
|
||||
UPDATE `creature_template` SET `ScriptName`='mob_ingvar_throw_dummy' WHERE `entry`=23997;
|
||||
UPDATE `creature_template` SET `ScriptName`='npc_dragonflayer_forge_master' WHERE `entry` = 24079;
|
||||
|
||||
/* WAILING CAVERNS */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user