diff options
-rw-r--r-- | sql/scripts/world_script_texts.sql | 10 | ||||
-rw-r--r-- | sql/scripts/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/9026_world_script_texts.sql | 7 | ||||
-rw-r--r-- | sql/updates/9026_world_scriptname.sql | 2 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 312 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp | 318 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h | 36 |
7 files changed, 605 insertions, 81 deletions
diff --git a/sql/scripts/world_script_texts.sql b/sql/scripts/world_script_texts.sql index 84e05311494..e713441824c 100644 --- a/sql/scripts/world_script_texts.sql +++ b/sql/scripts/world_script_texts.sql @@ -1,4 +1,4 @@ --- Up to TC2 5408 +-- Up to TC2 5408 -- -- trinityscript_script_texts.sql Contains data for table `script_texts` mainly used in C++ parts. -- valid entries for table are between -1000000 and -1999999 @@ -303,7 +303,7 @@ INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1` (10181,-1000358,'Look out! We''re under attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'KAYA_AMBUSH'), (17900,-1000359,'Thank you for helping me. I know my way back from here.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0,'KAYA_END'), (17969,-1000360,'The strands of LIFE have been severed! The Dreamers must be avenged!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,' ysondre SAY_AGGRO'), - (17969,-1000361,'Come forth, ye Dreamers � and claim your vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,' ysondre SAY_SUMMONDRUIDS'), + (17969,-1000361,'Come forth, ye Dreamers and claim your vengeance!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,1,0,0,' ysondre SAY_SUMMONDRUIDS'), (17969,-1000362,'Let''s go $N. I am ready to reach Whitereach Post.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_START'), (17969,-1000363,'Now this looks familiar. If we keep heading east, I think we can... Ahh, Wyvern on the attack!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_WYVERN'), (17969,-1000364,'Thanks a bunch... I can find my way back to Whitereach Post from here. Be sure to talk with Motega Firemane; perhaps you can keep him from sending me home.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,1,0,'paoka SAY_COMPLETE'), @@ -629,6 +629,10 @@ INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1` (3974,-1189021,'Release the hounds!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,5841,1,0,0,'loksey SAY_AGGRO'), -- -1 209 000 ZUL'FARRAK + ('7607','-1209000','Oh no! Here they come!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Weegli Blastfuse SAY_WEEGLI_OHNO'), + ('7607','-1209001','OK. Here I go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Weegli Blastfuse SAY_WEEGLI_OK_I_GO'), + ('7604','-1209002','Placeholder 1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Sergeant Bly SAY_1'), + ('7604','-1209003','Placeholder 2',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Sergeant Bly SAY_2'); -- -1 229 000 BLACKROCK SPIRE @@ -3059,7 +3063,7 @@ INSERT INTO `script_texts` (`npc_entry`,`entry`,`content_default`,`content_loc1` (29173,-1609283,'%s collapses.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Darion Mograine'), (29173,-1609284,'%s charges towards the Lich King, Ashbringer in hand and strikes the Lich King.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'Highlord Tirion Fordring'), (29173,-1609285,'%s disappears. Tirion walks over to where Darion lay',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,'The Lich King'), - (29173,-1609286,'Light washes over the chapel the Light of Dawn is uncovered.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), + (29173,-1609286,'Light washes over the chapel ? the Light of Dawn is uncovered.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,2,0,0,''), (25504, -1750040, 'My father''s aura is quite strong, he cannot be far. Could you be a doll and fight off the monsters wandering throught the mist?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), (25504, -1750041, 'Watch out for the monsters!Which way should we go first? Let''s try this way...',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), (25504, -1750042, 'What could this be?',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,0,0, 'npc_mootoo_the_younger'), diff --git a/sql/scripts/world_scripts_full.sql b/sql/scripts/world_scripts_full.sql index 44a522a1b1a..505d6bff892 100644 --- a/sql/scripts/world_scripts_full.sql +++ b/sql/scripts/world_scripts_full.sql @@ -1607,6 +1607,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_weegli_blastfuse' WHERE `entry` UPDATE `gameobject_template` SET `ScriptName`='go_shallow_grave' WHERE `entry` IN (128308,128403); INSERT IGNORE INTO `areatrigger_scripts` (`entry`,`ScriptName`) VALUES(962, 'at_zumrah'); UPDATE `gameobject_template` SET `ScriptName`='go_table_theka' WHERE `entry`=142715; +UPDATE `gameobject_template` SET `ScriptName`='go_troll_cage' WHERE `entry`>= 141070 AND `entry`< 141075; UPDATE `instance_template` SET `script`='instance_zulfarrak' WHERE `map`=209; /* ZUL'GURUB */ diff --git a/sql/updates/9026_world_script_texts.sql b/sql/updates/9026_world_script_texts.sql new file mode 100644 index 00000000000..bb73438c3a3 --- /dev/null +++ b/sql/updates/9026_world_script_texts.sql @@ -0,0 +1,7 @@ +-- script texts
+delete from script_texts where npc_entry in (7607,7604);
+insert into `script_texts` (`npc_entry`, `entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`, `sound`, `type`, `language`, `emote`, `comment`) values
+('7607','-1209000','Oh no! Here they come!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Weegli Blastfuse SAY_WEEGLI_OHNO'),
+('7607','-1209001','OK. Here I go.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Weegli Blastfuse SAY_WEEGLI_OK_I_GO'),
+('7604','-1209002','Placeholder 1',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Sergeant Bly SAY_1'),
+('7604','-1209003','Placeholder 2',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','1','0','Sergeant Bly SAY_2');
diff --git a/sql/updates/9026_world_scriptname.sql b/sql/updates/9026_world_scriptname.sql new file mode 100644 index 00000000000..2f1be0f46da --- /dev/null +++ b/sql/updates/9026_world_scriptname.sql @@ -0,0 +1,2 @@ +-- script names
+update gameobject_template set scriptName = 'go_troll_cage' where entry >= 141070 and entry < 141075;
diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 458111e464e..f4aec47a78a 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -16,14 +16,94 @@ */ #include "ScriptPCH.h" +#include "zulfarrak.h" #define NPC_GAHZRILLA 7273 +#define PATH_ADDS 81553 + +int const pyramidSpawnTotal = 54; +/* list of wave spawns: 0 = wave ID, 1 = creature id, 2 = x, 3 = y +no z coordinat b/c they're all the same */ +float pyramidSpawns [pyramidSpawnTotal][4] = { + {1,7789,1894.64,1206.29}, + {1,7787,1890.08,1218.68}, + {1,8876,1883.76,1222.3}, + {1,7789,1874.18,1221.24}, + {1,7787,1892.28,1225.49}, + {1,7788,1889.94,1212.21}, + {1,7787,1879.02,1223.06}, + {1,7789,1874.45,1204.44}, + {1,8876,1898.23,1217.97}, + {1,7787,1882.07,1225.7}, + {1,8877,1896.46,1205.62}, + {1,7787,1886.97,1225.86}, + {1,7787,1894.72,1221.91}, + {1,7787,1883.5,1218.25}, + {1,7787,1886.93,1221.4}, + {1,8876,1889.82,1222.51}, + {1,7788,1893.07,1215.26}, + {1,7788,1878.57,1214.16}, + {1,7788,1883.74,1212.35}, + {1,8877,1877,1207.27}, + {1,8877,1873.63,1204.65}, + {1,8876,1877.4,1216.41}, + {1,8877,1899.63,1202.52}, + {2,7789,1902.83,1223.41}, + {2,8876,1889.82,1222.51}, + {2,7787,1883.5,1218.25}, + {2,7788,1883.74,1212.35}, + {2,8877,1877,1207.27}, + {2,7787,1890.08,1218.68}, + {2,7789,1894.64,1206.29}, + {2,8876,1877.4,1216.41}, + {2,7787,1892.28,1225.49}, + {2,7788,1893.07,1215.26}, + {2,8877,1896.46,1205.62}, + {2,7789,1874.45,1204.44}, + {2,7789,1874.18,1221.24}, + {2,7787,1879.02,1223.06}, + {2,8876,1898.23,1217.97}, + {2,7787,1882.07,1225.7}, + {2,8877,1873.63,1204.65}, + {2,7787,1886.97,1225.86}, + {2,7788,1878.57,1214.16}, + {2,7787,1894.72,1221.91}, + {2,7787,1886.93,1221.4}, + {2,8876,1883.76,1222.3}, + {2,7788,1889.94,1212.21}, + {2,8877,1899.63,1202.52}, + {3,7788,1878.57,1214.16}, + {3,7787,1894.72,1221.91}, + {3,7787,1886.93,1221.4}, + {3,8876,1883.76,1222.3}, + {3,7788,1889.94,1212.21}, + {3,7275,1889.23,1207.72}, + {3,7796,1879.77,1207.96} +}; + +float Spawnsway[2][3] = +{ + {1884.86,1228.62,9}, + {1887.53,1263,41} +}; struct instance_zulfarrak : public ScriptedInstance { instance_zulfarrak(Map* pMap) : ScriptedInstance(pMap) {Initialize();} uint32 GahzRillaEncounter; + uint64 ZumrahGUID; + uint64 BlyGUID; + uint64 WeegliGUID; + uint64 OroGUID; + uint64 RavenGUID; + uint64 MurtaGUID; + uint64 EndDoorGUID; + uint32 PyramidPhase; + uint32 major_wave_Timer; + uint32 minor_wave_Timer; + uint32 addGroupSize; + uint32 waypoint; void Initialize() { @@ -32,12 +112,234 @@ struct instance_zulfarrak : public ScriptedInstance void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - if (pCreature->GetEntry() == NPC_GAHZRILLA) + switch (pCreature->GetEntry()) + { + case ENTRY_ZUMRAH: + ZumrahGUID = pCreature->GetGUID(); + break; + case ENTRY_BLY: + BlyGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE); // starts out passive (in a cage) + break; + case ENTRY_RAVEN: + RavenGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_ORO: + OroGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_WEEGLI: + WeegliGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_MURTA: + MurtaGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case NPC_GAHZRILLA: + if (GahzRillaEncounter >= IN_PROGRESS) + pCreature->DisappearAndDie(); + else + GahzRillaEncounter = IN_PROGRESS; + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) + { + switch(pGo->GetEntry()) + { + case GO_END_DOOR: + EndDoorGUID = pGo->GetGUID(); + break; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case EVENT_PYRAMID: + return PyramidPhase; + } + return 0; + } + + uint64 GetData64(uint32 data) + { + switch(data) + { + case ENTRY_ZUMRAH: + return ZumrahGUID; + case ENTRY_BLY: + return BlyGUID; + case ENTRY_RAVEN: + return RavenGUID; + case ENTRY_ORO: + return OroGUID; + case ENTRY_WEEGLI: + return WeegliGUID; + case ENTRY_MURTA: + return MurtaGUID; + case GO_END_DOOR: + return EndDoorGUID; + } + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case EVENT_PYRAMID: + PyramidPhase=data; + break; + }; + } + + virtual void Update(uint32 diff) + { + switch (PyramidPhase) + { + case PYRAMID_NOT_STARTED: + case PYRAMID_KILLED_ALL_TROLLS: + break; + case PYRAMID_ARRIVED_AT_STAIR: + SpawnPyramidWave(1); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_1); + major_wave_Timer=120000; + minor_wave_Timer=0; + addGroupSize=2; + break; + case PYRAMID_WAVE_1: + if (IsWaveAllDead()) + { + SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_2); + major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff + } + else + if (minor_wave_Timer<diff) + { + SendAddsUpStairs(addGroupSize++); + minor_wave_Timer=10000; + } + else + minor_wave_Timer -= diff; + break; + case PYRAMID_PRE_WAVE_2: + if (major_wave_Timer<diff) + { + // beginning 2nd wave! + SpawnPyramidWave(2); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_2); + minor_wave_Timer = 0; + addGroupSize=2; + } + else + major_wave_Timer -= diff; + break; + case PYRAMID_WAVE_2: + if (IsWaveAllDead()) + { + SpawnPyramidWave(3); + SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_3); + major_wave_Timer = 5000; //give NPCs time to return to their home spots + } + else + if (minor_wave_Timer<diff) + { + SendAddsUpStairs(addGroupSize++); + minor_wave_Timer=10000; + } + else + minor_wave_Timer -= diff; + break; + case PYRAMID_PRE_WAVE_3: + if (major_wave_Timer<diff) + { + // move NPCs to bottom of stair + MoveNPCIfAlive(ENTRY_BLY,1887.92,1228.179,9.98,4.78); + MoveNPCIfAlive(ENTRY_MURTA,1891.57,1228.68,9.69,4.78); + MoveNPCIfAlive(ENTRY_ORO,1897.23,1228.34,9.43,4.78); + MoveNPCIfAlive(ENTRY_RAVEN,1883.68,1227.95,9.543,4.78); + MoveNPCIfAlive(ENTRY_WEEGLI,1878.02,1227.65,9.485,4.78); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_3); + } + else + major_wave_Timer -= diff; + break; + case PYRAMID_WAVE_3: + if (IsWaveAllDead()) // move NPCS to their final positions + { + SetData(EVENT_PYRAMID,PYRAMID_KILLED_ALL_TROLLS); + MoveNPCIfAlive(ENTRY_BLY,1883.82,1200.83,8.87,1.32); + MoveNPCIfAlive(ENTRY_MURTA,1891.83,1201.45,8.87,1.32); + MoveNPCIfAlive(ENTRY_ORO,1894.50,1204.40,8.87,1.32); + MoveNPCIfAlive(ENTRY_RAVEN,1874.11,1206.17,8.87,1.32); + MoveNPCIfAlive(ENTRY_WEEGLI,1877.52,1199.63,8.87,1.32); + } + break; + }; + } + + std::list<uint64> addsAtBase,movedadds; + + void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o) + { + if (Creature* npc = instance->GetCreature(GetData64(entry))) + { + if (npc->isAlive()) + { + npc->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + npc->GetMotionMaster()->MovePoint(1,x,y,z); + npc->SetHomePosition(x,y,z,o); + } + } + } + + void SpawnPyramidWave(uint32 wave){ + for (int i = 0; i < pyramidSpawnTotal; i++) + { + if (pyramidSpawns[i][0] == (float)wave) + { + Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87, 0}; + TempSummon* ts = instance->SummonCreature(pyramidSpawns[i][1],pos); + ts->GetMotionMaster()->MoveRandom(10); + addsAtBase.push_back(ts->GetGUID()); + } + } + } + + bool IsWaveAllDead(){ + for(std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) + { + if (Creature* add = instance->GetCreature((*itr))) + { + if (add->isAlive()) + return false; + } + } + for(std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) + { + if (Creature* add = instance->GetCreature(((*itr)))) + { + if (add->isAlive()) + return false; + } + } + return true; + } + + void SendAddsUpStairs(uint32 count) + { + //pop a add from list, send him up the stairs... + for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++) { - if (GahzRillaEncounter >= IN_PROGRESS) - pCreature->DisappearAndDie(); - else - GahzRillaEncounter = IN_PROGRESS; + Creature* add = instance->GetCreature(*addsAtBase.begin()); + add->GetMotionMaster()->MovePath(PATH_ADDS,false); + movedadds.push_back(add->GetGUID()); + addsAtBase.erase(addsAtBase.begin()); } } }; diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 2b02146a6dc..0ab4034200d 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -29,30 +29,48 @@ npc_weegli_blastfuse EndContentData */ #include "ScriptPCH.h" +#include "zulfarrak.h" /*###### ## npc_sergeant_bly ######*/ -#define FACTION_HOSTILE 14 -#define FACTION_FRIENDLY 35 +enum blyAndCrewFactions +{ + FACTION_HOSTILE = 14, + FACTION_FRIENDLY = 35, //while in cages (so the trolls won't attack them while they're caged) + FACTION_FREED = 250 //after release (so they'll be hostile towards trolls) +}; + +enum blySays +{ + SAY_1 = -1209002, + SAY_2 = -1209003 +}; -#define SPELL_SHIELD_BASH 11972 -#define SPELL_REVENGE 12170 +enum blySpells +{ + SPELL_SHIELD_BASH = 11972, + SPELL_REVENGE = 12170 +}; #define GOSSIP_BLY "[PH] In that case, I will take my reward!" struct npc_sergeant_blyAI : public ScriptedAI { - npc_sergeant_blyAI(Creature *c) : ScriptedAI(c) + npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature) { - //pInstance = c->GetInstanceData(); + pInstance = pCreature->GetInstanceData(); + postGossipStep = 0; } - //ScriptedInstance* pInstance; + ScriptedInstance* pInstance; + uint32 postGossipStep; + uint32 Text_Timer; uint32 ShieldBash_Timer; uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->getVictim() dodge, parry or block attack. Trinity support required. + uint64 PlayerGUID; void Reset() { @@ -60,25 +78,44 @@ struct npc_sergeant_blyAI : public ScriptedAI Revenge_Timer = 8000; me->setFaction(FACTION_FRIENDLY); - - /*if (pInstance) - pInstance->SetData(0, NOT_STARTED);*/ - } - - void EnterCombat(Unit * /*who*/) - { - /*if (pInstance) - pInstance->SetData(0, IN_PROGRESS);*/ - } - - void JustDied(Unit * /*victim*/) - { - /*if (pInstance) - pInstance->SetData(0, DONE);*/ } void UpdateAI(const uint32 diff) { + if (postGossipStep>0 && postGossipStep<4) + { + if (Text_Timer<diff) + { + switch (postGossipStep) + { + case 1: + //weegli doesn't fight - he goes & blows up the door + if (Creature* pWeegli = pInstance->instance->GetCreature(pInstance->GetData64(ENTRY_WEEGLI))) + pWeegli->AI()->DoAction(); + DoScriptText(SAY_1,me); + Text_Timer = 5000; + break; + case 2: + DoScriptText(SAY_2,me); + Text_Timer = 5000; + break; + case 3: + me->setFaction(FACTION_HOSTILE); + if (Player* pTarget = Player::GetPlayer(PlayerGUID)) + AttackStart(pTarget); + + if (pInstance) + { + switchFactionIfAlive(pInstance, ENTRY_RAVEN); + switchFactionIfAlive(pInstance, ENTRY_ORO); + switchFactionIfAlive(pInstance, ENTRY_MURTA); + } + } + postGossipStep++; + } + else Text_Timer -= diff; + } + if (!UpdateVictim()) return; @@ -86,17 +123,35 @@ struct npc_sergeant_blyAI : public ScriptedAI { DoCast(me->getVictim(), SPELL_SHIELD_BASH); ShieldBash_Timer = 15000; - } else ShieldBash_Timer -= diff; + } + else + ShieldBash_Timer -= diff; if (Revenge_Timer <= diff) { DoCast(me->getVictim(), SPELL_REVENGE); Revenge_Timer = 10000; - } else Revenge_Timer -= diff; + } + else + Revenge_Timer -= diff; DoMeleeAttackIfReady(); } + + void DoAction(const int32 param) + { + postGossipStep=1; + Text_Timer = 0; + } + + void switchFactionIfAlive(ScriptedInstance* pInstance,uint32 entry) + { + if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) + if (crew->isAlive()) + crew->setFaction(FACTION_HOSTILE); + } }; + CreatureAI* GetAI_npc_sergeant_bly(Creature* pCreature) { return new npc_sergeant_blyAI (pCreature); @@ -104,49 +159,99 @@ CreatureAI* GetAI_npc_sergeant_bly(Creature* pCreature) bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature) { - /*if (pInstance->GetData(0) == DONE) - {*/ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID()); - /*} - else if (pInstance->GetData(0) == IN_PROGRESS) - pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID());*/ - - return true; + if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) + { + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_KILLED_ALL_TROLLS) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID()); + } + else + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_NOT_STARTED) + pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID()); + return true; + } + return false; } -bool GossipSelect_npc_sergeant_bly(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +bool GossipSelect_npc_sergeant_bly(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_sergeant_blyAI, pCreature->AI())->AttackStart(pPlayer); + CAST_AI(npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + pCreature->AI()->DoAction(); } return true; } /*###### ++## go_troll_cage ++######*/ + +void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y, float z) +{ + if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) + { + crew->SetReactState(REACT_AGGRESSIVE); + crew->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + crew->SetHomePosition(x,y,z,0); + crew->GetMotionMaster()->MovePoint(1,x,y,z); + crew->setFaction(FACTION_FREED); + } +} + +bool GOHello_go_troll_cage(Player* pPlayer, GameObject* pGo) +{ + if (ScriptedInstance* pInstance = pGo->GetInstanceData()) + { + pInstance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN); + //set bly & co to aggressive & start moving to top of stairs + initBlyCrewMember(pInstance,ENTRY_BLY,1884.99,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_RAVEN,1882.5,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_ORO,1886.47,1270.68,41.68); + initBlyCrewMember(pInstance,ENTRY_WEEGLI,1890,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_MURTA,1891.19,1272.03,41.60); + } + return false; +} + +/*###### ## npc_weegli_blastfuse ######*/ -#define SPELL_BOMB 8858 -#define SPELL_GOBLIN_LAND_MINE 21688 -#define SPELL_SHOOT 6660 -#define SPELL_WEEGLIS_BARREL 10772 +enum weegliSpells +{ + SPELL_BOMB = 8858, + SPELL_GOBLIN_LAND_MINE = 21688, + SPELL_SHOOT = 6660, + SPELL_WEEGLIS_BARREL = 10772 +}; + +enum weegliSays +{ + SAY_WEEGLI_OHNO = -1209000, + SAY_WEEGLI_OK_I_GO = -1209001 +}; #define GOSSIP_WEEGLI "[PH] Please blow up the door." struct npc_weegli_blastfuseAI : public ScriptedAI { - npc_weegli_blastfuseAI(Creature *c) : ScriptedAI(c) + npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature) { - //pInstance = c->GetInstanceData(); + pInstance = pCreature->GetInstanceData(); + destroyingDoor=false; + Bomb_Timer = 10000; + LandMine_Timer = 30000; } - //ScriptedInstance* pInstance; + uint32 Bomb_Timer; + uint32 LandMine_Timer; + bool destroyingDoor; + ScriptedInstance* pInstance; void Reset() { @@ -154,10 +259,9 @@ struct npc_weegli_blastfuseAI : public ScriptedAI pInstance->SetData(0, NOT_STARTED);*/ } - void EnterCombat(Unit * /*who*/) + void AttackStart(Unit *victim) { - /*if (pInstance) - pInstance->SetData(0, IN_PROGRESS);*/ + AttackStartCaster(victim,10);//keep back & toss bombs/shoot } void JustDied(Unit * /*victim*/) @@ -166,12 +270,66 @@ struct npc_weegli_blastfuseAI : public ScriptedAI pInstance->SetData(0, DONE);*/ } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; - DoMeleeAttackIfReady(); + if (Bomb_Timer < diff) + { + DoCast(me->getVictim(),SPELL_BOMB); + Bomb_Timer = 10000; + } + else + Bomb_Timer -= diff; + + if (me->isAttackReady() && !me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(),SPELL_SHOOT); + me->SetSheath(SHEATH_STATE_RANGED); + } + else + { + me->SetSheath(SHEATH_STATE_MELEE); + DoMeleeAttackIfReady(); + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (pInstance) + { + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN) + { + pInstance->SetData(EVENT_PYRAMID,PYRAMID_ARRIVED_AT_STAIR); + DoScriptText(SAY_WEEGLI_OHNO,me); + me->SetHomePosition(1882.69,1272.28,41.87,0); + } + else + if (destroyingDoor) + { + pInstance->DoUseDoorOrButton(pInstance->GetData64(GO_END_DOOR)); + //TODO: leave the area... + me->ForcedDespawn(); + }; + } + } + + void DoAction(const int32 param) + { + DestroyDoor(); + } + + void DestroyDoor() + { + if (me->isAlive()) + { + me->setFaction(FACTION_FRIENDLY); + me->GetMotionMaster()->MovePoint(0, 1858.57,1146.35,14.745); + me->SetHomePosition(1858.57,1146.35,14.745,3.85); // in case he gets interrupted + DoScriptText(SAY_WEEGLI_OK_I_GO,me); + destroyingDoor=true; + } } }; CreatureAI* GetAI_npc_weegli_blastfuse(Creature* pCreature) @@ -181,25 +339,32 @@ CreatureAI* GetAI_npc_weegli_blastfuse(Creature* pCreature) bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature) { - //event not implemented yet, this is only placeholder for future developement - /*if (pInstance->GetData(0) == DONE) + if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID());//if event can proceed to end + switch (pInstance->GetData(EVENT_PYRAMID)) + { + case PYRAMID_KILLED_ALL_TROLLS: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID()); //if event can proceed to end + break; + case PYRAMID_NOT_STARTED: + pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started + break; + default: + pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID()); //if event are in progress + } + return true; } - else if (pInstance->GetData(0) == IN_PROGRESS) - pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID());//if event are in progress - else*/ - pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started - return true; + return false; } -bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) +bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { pPlayer->CLOSE_GOSSIP_MENU(); //here we make him run to door, set the charge and run away off to nowhere + pCreature->AI()->DoAction(); } return true; } @@ -208,14 +373,15 @@ bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* /*pCreature*/, ## go_shallow_grave ######*/ -enum { +enum +{ ZOMBIE = 7286, DEAD_HERO = 7276, ZOMBIE_CHANCE = 65, DEAD_HERO_CHANCE = 10 }; -bool GOHello_go_shallow_grave(Player* /*pPlayer*/, GameObject* pGo) +bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo) { // randomly summon a zombie or dead hero the first time a grave is used if (pGo->GetUseCount() == 0) @@ -223,8 +389,9 @@ bool GOHello_go_shallow_grave(Player* /*pPlayer*/, GameObject* pGo) uint32 randomchance = urand(0,100); if (randomchance < ZOMBIE_CHANCE) pGo->SummonCreature(ZOMBIE, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - else if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) - pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + else + if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) + pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); } pGo->AddUse(); return false; @@ -234,20 +401,20 @@ bool GOHello_go_shallow_grave(Player* /*pPlayer*/, GameObject* pGo) ## at_zumrah ######*/ -enum { +enum zumrahConsts +{ ZUMRAH_ID = 7271, ZUMRAH_HOSTILE_FACTION = 37 }; -bool AreaTrigger_at_zumrah(Player* pPlayer, const AreaTriggerEntry * /*at*/) +bool AreaTrigger_at_zumrah(Player* pPlayer,const AreaTriggerEntry *at) { - Creature* Zumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); + Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); - if (!Zumrah) + if (!pZumrah) return false; - Zumrah->setFaction(ZUMRAH_HOSTILE_FACTION); - Zumrah->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); return true; } @@ -256,21 +423,21 @@ void AddSC_zulfarrak() Script *newscript; newscript = new Script; - newscript->Name = "npc_sergeant_bly"; + newscript->Name="npc_sergeant_bly"; newscript->GetAI = &GetAI_npc_sergeant_bly; newscript->pGossipHello = &GossipHello_npc_sergeant_bly; newscript->pGossipSelect = &GossipSelect_npc_sergeant_bly; newscript->RegisterSelf(); newscript = new Script; - newscript->Name = "npc_weegli_blastfuse"; + newscript->Name="npc_weegli_blastfuse"; newscript->GetAI = &GetAI_npc_weegli_blastfuse; newscript->pGossipHello = &GossipHello_npc_weegli_blastfuse; newscript->pGossipSelect = &GossipSelect_npc_weegli_blastfuse; newscript->RegisterSelf(); newscript = new Script; - newscript->Name = "go_shallow_grave"; + newscript->Name="go_shallow_grave"; newscript->pGOHello = &GOHello_go_shallow_grave; newscript->RegisterSelf(); @@ -279,4 +446,9 @@ void AddSC_zulfarrak() newscript->pAreaTrigger = &AreaTrigger_at_zumrah; newscript->RegisterSelf(); + newscript = new Script; + newscript->Name = "go_troll_cage"; + newscript->pGOHello = &GOHello_go_troll_cage; + newscript->RegisterSelf(); + } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h new file mode 100644 index 00000000000..2fdd536b698 --- /dev/null +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> +* This program is free software licensed under GPL version 2 +* Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_ZF_H +#define DEF_ZF_H + + enum zfEntries + { + ENTRY_ZUMRAH = 7271, + ENTRY_BLY = 7604, + ENTRY_RAVEN = 7605, + ENTRY_ORO = 7606, + ENTRY_WEEGLI = 7607, + ENTRY_MURTA = 7608, + + GO_END_DOOR = 146084, + + EVENT_PYRAMID = 1, + EVENT_GAHZRILLA + }; + + enum zfPyramidPhases + { + PYRAMID_NOT_STARTED, //default + PYRAMID_CAGES_OPEN, //happens in GO hello for cages + PYRAMID_ARRIVED_AT_STAIR , //happens in Weegli's movementinform + PYRAMID_WAVE_1, + PYRAMID_PRE_WAVE_2, + PYRAMID_WAVE_2, + PYRAMID_PRE_WAVE_3, + PYRAMID_WAVE_3, + PYRAMID_KILLED_ALL_TROLLS, + }; + +#endif
\ No newline at end of file |