diff options
-rw-r--r-- | sql/trinityscript_script_texts.sql | 8 | ||||
-rw-r--r-- | sql/updates/1312_world.sql | 17 | ||||
-rw-r--r-- | sql/world_scripts_full.sql | 5 | ||||
-rw-r--r-- | src/bindings/scripts/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/bindings/scripts/Makefile.am | 2 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 10 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp | 210 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_keep.h | 26 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp | 231 |
9 files changed, 511 insertions, 0 deletions
diff --git a/sql/trinityscript_script_texts.sql b/sql/trinityscript_script_texts.sql index 7cea5a58cbf..33899984e6b 100644 --- a/sql/trinityscript_script_texts.sql +++ b/sql/trinityscript_script_texts.sql @@ -301,6 +301,14 @@ INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`, -- -1 034 000 STOCKADES -- -1 036 000 DEADMINES +-- -1 574 000 UTGARDE KEEP +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1574000, 'Your blood is mine!',13221,1,0,'keleseth SAY_AGGRO'), +(-1574001, 'Darkness waits',13223,1,0, 'keleseth SAY_KILL'), +(-1574002, 'I join... the night.',13225,1,0, 'keleseth SAY_DEATH'), +(-1574003, 'Not so fast.',13222,1,0, 'keleseth SAY_FROST_TOMB'), +(-1574004, 'Aranal, lidel! Their fate shall be yours!',13224,1,0, 'keleseth SAY_SKELETONS'); + -- -1 043 000 WAILING CAVERNS -- -1 047 000 RAZORFEN KRAUL diff --git a/sql/updates/1312_world.sql b/sql/updates/1312_world.sql new file mode 100644 index 00000000000..f865914dd85 --- /dev/null +++ b/sql/updates/1312_world.sql @@ -0,0 +1,17 @@ +UPDATE `creature_template` SET `scriptname` = 'boss_keleseth' WHERE `entry` = '23953'; +UPDATE `creature_template` SET `scriptname` = 'mob_frost_tomb' WHERE `entry` = '23965'; +UPDATE `instance_template` SET `script`='instance_utgarde_keep' WHERE `map`= '574'; + +INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES +(-1574000, 'Your blood is mine!',13221,1,0,'keleseth SAY_AGGRO'), +(-1574001, 'Darkness waits',13223,1,0, 'keleseth SAY_KILL'), +(-1574002, 'I join... the night.',13225,1,0, 'keleseth SAY_DEATH'), +(-1574003, 'Not so fast.',13222,1,0, 'keleseth SAY_FROST_TOMB'), +(-1574004, 'Aranal, lidel! Their fate shall be yours!',13224,1,0, 'keleseth SAY_SKELETONS'); + +-- DB Data for testing +-- REPLACE INTO `creature_template` (`entry`, `heroic_entry`, `modelid_A`, `modelid_A2`, `modelid_H`, `modelid_H2`, `name`, `subname`, `IconName`, `minlevel`, `maxlevel`, `minhealth`, `maxhealth`, `minmana`, `maxmana`, `armor`, `faction_A`, `faction_H`, `npcflag`, `speed`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `baseattacktime`, `rangeattacktime`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `class`, `race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `PetSpellDataId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `RacialLeader`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES +-- (23953, 0, 25338, 0, 25338, 0, 'Prinz Keleseth', NULL, NULL, 70, 80, 192200, 417056, 0, 0, 6700, 16, 16, 2, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 6, 76, 23953, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 0, 0, 0, 'boss_keleseth'), +-- (23965, 0, 25865, 0, 25865, 0, 'Frost Tomb', NULL, NULL, 70, 80, 7345, 10465, 0, 0, 6700, 16, 16, 0, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 0, 0, 0, 'mob_frost_tomb'), +-- (23970, 0, 27651, 0, 27651, 0, 'Vrykul Skeleton', NULL, NULL, 70, 80, 7345, 10465, 0, 0, 6700, 16, 16, 0, 1, 1, 0, 445, 1200, 0, 58, 2000, 2200, 0, 0, 0, 0, 0, 0, 0, 1, 2, 100, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 3, 3, 0, 716, 0, 0, '0'); + diff --git a/sql/world_scripts_full.sql b/sql/world_scripts_full.sql index 142795f3556..1df5fabea18 100644 --- a/sql/world_scripts_full.sql +++ b/sql/world_scripts_full.sql @@ -900,6 +900,11 @@ UPDATE `creature_template` SET `ScriptName`='npc_lady_sylvanas_windrunner' WHERE UPDATE `creature_template` SET `ScriptName`='npc_highborne_lamenter' WHERE `entry`=21628; UPDATE `creature_template` SET `ScriptName`='npc_parqual_fintallas' WHERE `entry`=4488; +/* UTGARDE KEEP */ +UPDATE `creature_template` SET `scriptname` = 'boss_keleseth' WHERE `entry` = '23953'; +UPDATE `creature_template` SET `scriptname` = 'mob_frost_tomb' WHERE `entry` = '23965'; +UPDATE `instance_template` SET `script`='instance_utgarde_keep' WHERE `map`= '574'; + /* WAILING CAVERNS */ /* WESTERN PLAGUELANDS */ diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 519ed0973b8..e482940a280 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -347,6 +347,8 @@ SET(trinityscript_LIB_SRCS scripts/zone/uldaman/uldaman.cpp scripts/zone/undercity/undercity.cpp scripts/zone/ungoro_crater/ungoro_crater.cpp + scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp + scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.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/Makefile.am b/src/bindings/scripts/Makefile.am index 3aaa1e3bc7a..0e1890ac869 100644 --- a/src/bindings/scripts/Makefile.am +++ b/src/bindings/scripts/Makefile.am @@ -380,6 +380,8 @@ scripts/zone/uldaman/boss_ironaya.cpp \ scripts/zone/uldaman/uldaman.cpp \ scripts/zone/undercity/undercity.cpp \ scripts/zone/ungoro_crater/ungoro_crater.cpp \ +scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp \ +scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.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 5ae8442eb4e..ad69effdb3d 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -569,6 +569,11 @@ extern void AddSC_undercity(); extern void AddSC_ungoro_crater(); //Upper blackrock spire + +//Utgarde Keep +extern void AddSC_boss_keleseth(); +extern void AddSC_instance_utgarde_keep() + //Wailing caverns //Western plaguelands @@ -1779,6 +1784,11 @@ void ScriptsInit() AddSC_ungoro_crater(); //Upper blackrock spire + + //Utgarde Keep + AddSC_boss_keleseth(); + AddSC_instance_utgarde_keep() + //Wailing caverns //Western plaguelands diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp new file mode 100644 index 00000000000..460581eff57 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp @@ -0,0 +1,210 @@ +/* + * 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 + */ + +/* ScriptData +SDName: Boss_Prince_Keleseth +SD%Complete: 80 +SDComment: Normal and Heroic Support. Needs Prince Movements, Needs skeletons resurrection, Needs adjustments to blizzlike timers, Needs adjustments to use spell though. Needs Shadowbolt +SDCategory: Utgarde Keep +EndScriptData */ + +#include "precompiled.h" +#include "def_keep.h" + +#define SPELL_SHADOWBOLT 43667 +#define SPELL_SHADOWBOLT_HEROIC 59389 +#define SPELL_FROST_TOMB 48400 +#define SPELL_FROST_TOMB_SUMMON 42714 +#define CREATURE_FROSTTOMB 23965 +#define CREATURE_SKELETON 23970 + +#define SAY_AGGRO -1574000 +#define SAY_KILL -1574001 +#define SAY_DEATH -1574002 +#define SAY_FROST_TOMB -1574003 +#define SAY_SKELETONS -1574004 + +#define SKELETONSPAWN_Z 42.8668 + +float SkeletonSpawnPoint[5][5]= +{ + {156.2559, 259.2093}, + {156.2559, 259.2093}, + {156.2559, 259.2093}, + {156.2559, 259.2093}, + {156.2559, 259.2093}, +}; + +struct TRINITY_DLL_DECL mob_frost_tombAI : public ScriptedAI +{ + mob_frost_tombAI(Creature *c) : ScriptedAI(c) + { + Reset(); + } + + uint64 SacrificeGUID; + + void Reset() + { + SacrificeGUID = 0; + } + + void Aggro(Unit* who) {} + void AttackStart(Unit* who) {} + void MoveInLineOfSight(Unit* who) {} + + void JustDied(Unit *killer) + { + if(SacrificeGUID) + { + Unit* Sacrifice = Unit::GetUnit((*m_creature),SacrificeGUID); + if(Sacrifice) + Sacrifice->RemoveAurasDueToSpell(SPELL_FROST_TOMB); + } + } +}; + +struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI +{ + boss_kelesethAI(Creature *c) : ScriptedAI(c) + { + pInstance = ((ScriptedInstance*)c->GetInstanceData()); + Reset(); + Heroic = c->GetMap()->IsHeroic(); + } + + ScriptedInstance* pInstance; + + uint32 FrostTombTimer; + uint32 SummonSkeletonsTimer; + uint32 ShadowboltTimer; + bool Skeletons; + bool Heroic; + + void Reset() + { + ShadowboltTimer = 0; + Skeletons = false; + + ResetTimer(); + + if(pInstance) + pInstance->SetData(DATA_PRINCEKELESETH, NOT_STARTED); + } + + void KilledUnit(Unit *victim) + { + if(victim == m_creature) + return; + + DoScriptText(SAY_KILL, m_creature); + } + + void JustDied(Unit* killer) + { + if(pInstance) + pInstance->SetData(DATA_PRINCEKELESETH, DONE); + + DoScriptText(SAY_DEATH, m_creature); + } + + void Aggro(Unit* who) + { + if(pInstance) + pInstance->SetData(DATA_PRINCEKELESETH, IN_PROGRESS); + + DoScriptText(SAY_AGGRO, m_creature); + DoZoneInCombat(); + } + + void ResetTimer(uint32 inc = 0) + { + SummonSkeletonsTimer = 5000 + inc; + FrostTombTimer = 28000 + inc; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if(ShadowboltTimer < diff) + { + Unit* target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); + if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) + m_creature->CastSpell(target, Heroic ? SPELL_SHADOWBOLT:SPELL_SHADOWBOLT_HEROIC, true); + ShadowboltTimer = 2000; + }else ShadowboltTimer -= diff; + + if((SummonSkeletonsTimer < diff) && !Skeletons) + { + DoScriptText(SAY_SKELETONS, m_creature); + for(uint8 i = 0; i < 5; ++i) + { + Creature* Skeleton = m_creature->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_MANUAL_DESPAWN,0); + } + Skeletons = true; + }else SummonSkeletonsTimer -= diff; + + if(FrostTombTimer < diff) + { + Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1); + if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER) + { + DoCast(target, SAY_FROST_TOMB, true); + Creature* Chains = m_creature->SummonCreature(CREATURE_FROSTTOMB, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 20000); + if(Chains) + { + ((mob_frost_tombAI*)Chains->AI())->SacrificeGUID = target->GetGUID(); + Chains->CastSpell(target, SPELL_FROST_TOMB, true); + + DoScriptText(SAY_FROST_TOMB, m_creature); + + FrostTombTimer = 15000; + } + } + }else FrostTombTimer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_frost_tomb(Creature *_Creature) +{ + return new mob_frost_tombAI(_Creature); +} + +CreatureAI* GetAI_boss_keleseth(Creature *_Creature) +{ + return new boss_kelesethAI (_Creature); +} + +void AddSC_boss_keleseth() +{ + Script *newscript; + + newscript = new Script; + newscript->Name="boss_keleseth"; + newscript->GetAI = &GetAI_boss_keleseth; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "mob_frost_tomb"; + newscript->GetAI = &GetAI_mob_frost_tomb; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_keep.h b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_keep.h new file mode 100644 index 00000000000..4161c725fb2 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/def_keep.h @@ -0,0 +1,26 @@ +/* + * 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 + */ + +#ifndef DEF_KEEP_H +#define DEF_KEEP_H + +#define DATA_PRINCEKELESETH 1 +#define DATA_DALRON 2 +#define DATA_SKARVALD 3 +#define DATA_INGVAR 4 +#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 new file mode 100644 index 00000000000..77672143f24 --- /dev/null +++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp @@ -0,0 +1,231 @@ +/* + * 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 + */ + +/* ScriptData +SDName: Instance_Utgarde_Keep +SD%Complete: 0 +SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Utgarde Keep Scripts +SDCategory: Utgarde Keep +EndScriptData */ + +#include "precompiled.h" +#include "def_keep.h" + +#define ENCOUNTERS 4 + +/* Utgarde Keep encounters: +0 - Prince Keleseth +1 - Skarvald +2 - Dalronn +3 - Ingvar the Plunderer +*/ + +struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance +{ + instance_utgarde_keep(Map *Map) : ScriptedInstance(Map) {Initialize();}; + + uint64 Keleseth; + uint64 Skarvald; + uint64 Dalronn; + uint64 Ingvar; + + bool IsBossDied[2]; + + uint32 Encounters[ENCOUNTERS]; + std::string str_data; + + void Initialize() + { + Keleseth = 0; + Skarvald = 0; + Dalronn =0; + Ingvar =0; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + Encounters[i] = NOT_STARTED; + } + + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if(Encounters[i] == IN_PROGRESS) return true; + + return false; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + debug_log("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void HandleGameObject(uint64 guid, uint32 state) + { + Player *player = GetPlayerInMap(); + + if (!player || !guid) + { + debug_log("TSCR: Utgarde Keep: HandleGameObject fail"); + return; + } + + if (GameObject *go = GameObject::GetGameObject(*player,guid)) + go->SetGoState(state); + } + + void OnCreatureCreate(Creature *creature, uint32 creature_entry) + { + switch(creature->GetEntry()) + { + case 23953: Keleseth = creature->GetGUID(); break; + case 24200: Dalronn = creature->GetGUID(); break; + case 24201: Skarvald = creature->GetGUID(); break; + case 23954: Ingvar = creature->GetGUID(); break; + } + } + + void OnObjectCreate(GameObject* go) + { + switch(go->GetEntry()) + { + //door and object id + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_PRINCEKELESETH: return Keleseth; + case DATA_DALRON: return Dalronn; + case DATA_SKARVALD: return Skarvald; + case DATA_INGVAR: return Ingvar; + } + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_PRINCEKELESETH: + if(data == DONE) + { + //HandleGameObject(doorname, 0); + } + Encounters[0] = data;break; + case DATA_DALRON: + if(data == DONE) + { + //HandleGameObject(doorname, 0); + } + Encounters[1] = data; break; + case DATA_SKARVALD: + if(data == DONE) + { + //HandleGameObject(doorname, 0); + } + Encounters[2] = data; break; + case DATA_INGVAR: + if(data == DONE) + { + //HandleGameObject(doorname, 0); + } + Encounters[3] = data; break; + } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounters[0] << " " << Encounters[1] << " " + << Encounters[2] << " " << Encounters[3]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_PRINCEKELESETH: return Encounters[0]; + case DATA_DALRON: return Encounters[1]; + case DATA_SKARVALD: return Encounters[2]; + case DATA_INGVAR: return Encounters[3]; + } + + return 0; + } + + const char* Save() + { + return str_data.c_str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] + >> Encounters[3]; + + for(uint8 i = 0; i < ENCOUNTERS; ++i) + if (Encounters[i] == IN_PROGRESS) + Encounters[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } +}; + +InstanceData* GetInstanceData_instance_utgarde_keep(Map* map) +{ + return new instance_utgarde_keep(map); +} + +void AddSC_instance_utgarde_keep() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_utgarde_keep"; + newscript->GetInstanceData = &GetInstanceData_instance_utgarde_keep; + newscript->RegisterSelf(); +} |