From 590199d8e17405a0717eaf2e2d39f0d671b6f844 Mon Sep 17 00:00:00 2001 From: azazel Date: Sun, 8 Aug 2010 22:54:58 +0600 Subject: [PATCH] * Rename InstanceData to InstanceScript * Rename *mgr to their new names in scripts project * Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker. --HG-- branch : trunk rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h --- .../game/AI/EventAI/CreatureEventAI.cpp | 6 +- .../game/AI/ScriptedAI/ScriptedCreature.cpp | 2 +- .../game/AI/ScriptedAI/ScriptedCreature.h | 6 +- .../game/AI/ScriptedAI/ScriptedInstance.h | 2 +- .../game/Achievements/AchievementMgr.cpp | 4 +- src/server/game/Chat/Commands/Level3.cpp | 6 +- src/server/game/Conditions/ConditionMgr.cpp | 6 +- .../game/Entities/Creature/Creature.cpp | 2 +- .../game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Entities/Object/Object.cpp | 6 +- src/server/game/Entities/Object/Object.h | 4 +- src/server/game/Instances/InstanceSaveMgr.cpp | 4 +- .../{InstanceData.cpp => InstanceScript.cpp} | 54 +- .../{InstanceData.h => InstanceScript.h} | 12 +- src/server/game/Maps/Map.cpp | 4 +- src/server/game/Maps/Map.h | 6 +- src/server/game/Maps/MapManager.cpp | 2 +- src/server/game/Scripting/ScriptMgr.cpp | 4 +- src/server/game/Scripting/ScriptMgr.h | 8 +- .../Server/Protocol/Handlers/MiscHandler.cpp | 2 +- .../Server/Protocol/Handlers/NPCHandler.cpp | 2 +- src/server/scripts/Custom/custom_example.cpp | 80 +- .../scripts/Custom/custom_gossip_codebox.cpp | 94 +- src/server/scripts/Custom/test.cpp | 99 +- .../BlackrockDepths/blackrock_depths.cpp | 1950 +++++----- .../boss_ambassador_flamelash.cpp | 91 +- .../BlackrockDepths/boss_anubshiah.cpp | 125 +- .../boss_emperor_dagran_thaurissan.cpp | 117 +- .../boss_general_angerforge.cpp | 157 +- .../boss_gorosh_the_dervish.cpp | 77 +- .../BlackrockDepths/boss_grizzle.cpp | 89 +- .../boss_high_interrogator_gerstahn.cpp | 111 +- .../BlackrockDepths/boss_magmus.cpp | 97 +- .../boss_moira_bronzebeard.cpp | 93 +- .../BlackrockDepths/boss_tomb_of_seven.cpp | 369 +- .../instance_blackrock_depths.cpp | 729 ++-- .../BlackrockSpire/boss_drakkisath.cpp | 108 +- .../BlackrockSpire/boss_gyth.cpp | 294 +- .../BlackrockSpire/boss_halycon.cpp | 98 +- .../BlackrockSpire/boss_highlord_omokk.cpp | 158 +- .../BlackrockSpire/boss_mother_smolderweb.cpp | 86 +- .../boss_overlord_wyrmthalak.cpp | 142 +- .../boss_pyroguard_emberseer.cpp | 92 +- .../boss_quartermaster_zigris.cpp | 82 +- .../BlackrockSpire/boss_rend_blackhand.cpp | 92 +- .../boss_shadow_hunter_voshgajin.cpp | 98 +- .../BlackrockSpire/boss_the_beast.cpp | 94 +- .../BlackrockSpire/boss_warmaster_voone.cpp | 140 +- .../boss_broodlord_lashlayer.cpp | 118 +- .../BlackwingLair/boss_chromaggus.cpp | 440 +-- .../BlackwingLair/boss_ebonroc.cpp | 120 +- .../BlackwingLair/boss_firemaw.cpp | 104 +- .../BlackwingLair/boss_flamegor.cpp | 100 +- .../BlackwingLair/boss_nefarian.cpp | 302 +- .../BlackwingLair/boss_razorgore.cpp | 144 +- .../BlackwingLair/boss_vaelastrasz.cpp | 411 ++- .../BlackwingLair/boss_victor_nefarius.cpp | 527 +-- .../Deadmines/boss_mr_smite.cpp | 247 +- .../EasternKingdoms/Deadmines/deadmines.cpp | 42 +- .../Deadmines/instance_deadmines.cpp | 6 +- .../EasternKingdoms/Gnomeregan/gnomeregan.cpp | 889 ++--- .../Gnomeregan/instance_gnomeregan.cpp | 220 +- .../EasternKingdoms/Karazhan/boss_curator.cpp | 243 +- .../Karazhan/boss_maiden_of_virtue.cpp | 148 +- .../Karazhan/boss_midnight.cpp | 481 +-- .../EasternKingdoms/Karazhan/boss_moroes.cpp | 1146 +++--- .../Karazhan/boss_netherspite.cpp | 520 +-- .../Karazhan/boss_nightbane.cpp | 604 ++-- .../Karazhan/boss_prince_malchezaar.cpp | 883 ++--- .../Karazhan/boss_shade_of_aran.cpp | 871 ++--- .../Karazhan/boss_terestian_illhoof.cpp | 615 ++-- .../EasternKingdoms/Karazhan/bosses_opera.cpp | 2212 ++++++------ .../Karazhan/instance_karazhan.cpp | 460 +-- .../EasternKingdoms/Karazhan/karazhan.cpp | 881 ++--- .../boss_felblood_kaelthas.cpp | 1051 +++--- .../boss_priestess_delrissa.cpp | 1645 +++++---- .../MagistersTerrace/boss_selin_fireheart.cpp | 580 +-- .../MagistersTerrace/boss_vexallus.cpp | 283 +- .../instance_magisters_terrace.cpp | 293 +- .../MagistersTerrace/magisters_terrace.cpp | 208 +- .../MoltenCore/boss_baron_geddon.cpp | 108 +- .../EasternKingdoms/MoltenCore/boss_garr.cpp | 190 +- .../MoltenCore/boss_gehennas.cpp | 94 +- .../MoltenCore/boss_golemagg.cpp | 260 +- .../MoltenCore/boss_lucifron.cpp | 90 +- .../MoltenCore/boss_magmadar.cpp | 106 +- .../MoltenCore/boss_majordomo_executus.cpp | 130 +- .../MoltenCore/boss_ragnaros.cpp | 344 +- .../MoltenCore/boss_shazzrah.cpp | 142 +- .../MoltenCore/boss_sulfuron_harbinger.cpp | 284 +- .../MoltenCore/instance_molten_core.cpp | 428 +-- .../MoltenCore/molten_core.cpp | 60 +- .../ScarletEnclave/chapter1.cpp | 1484 ++++---- .../ScarletEnclave/chapter2.cpp | 1464 ++++---- .../ScarletEnclave/chapter5.cpp | 2585 ++++++------- .../ScarletEnclave/the_scarlet_enclave.cpp | 155 +- .../ScarletMonastery/boss_arcanist_doan.cpp | 140 +- .../boss_azshir_the_sleepless.cpp | 100 +- .../boss_bloodmage_thalnos.cpp | 130 +- .../boss_headless_horseman.cpp | 1364 +++---- .../ScarletMonastery/boss_herod.cpp | 203 +- .../boss_high_inquisitor_fairbanks.cpp | 154 +- .../boss_houndmaster_loksey.cpp | 60 +- .../boss_interrogator_vishas.cpp | 128 +- .../boss_mograine_and_whitemane.cpp | 512 +-- .../ScarletMonastery/boss_scorn.cpp | 104 +- .../instance_scarlet_monastery.cpp | 206 +- .../Scholomance/boss_darkmaster_gandling.cpp | 328 +- .../boss_death_knight_darkreaver.cpp | 45 +- .../boss_doctor_theolen_krastinov.cpp | 126 +- .../Scholomance/boss_illucia_barov.cpp | 148 +- .../Scholomance/boss_instructor_malicia.cpp | 206 +- .../Scholomance/boss_jandice_barov.cpp | 263 +- .../Scholomance/boss_kormok.cpp | 156 +- .../Scholomance/boss_lord_alexei_barov.cpp | 106 +- .../Scholomance/boss_lorekeeper_polkelt.cpp | 134 +- .../Scholomance/boss_ras_frostwhisper.cpp | 146 +- .../Scholomance/boss_the_ravenian.cpp | 132 +- .../Scholomance/boss_vectus.cpp | 100 +- .../Scholomance/instance_scholomance.cpp | 182 +- .../instance_shadowfang_keep.cpp | 406 +-- .../ShadowfangKeep/shadowfang_keep.cpp | 240 +- .../Stratholme/boss_baron_rivendare.cpp | 188 +- .../Stratholme/boss_baroness_anastari.cpp | 170 +- .../Stratholme/boss_cannon_master_willey.cpp | 256 +- .../Stratholme/boss_dathrohan_balnazzar.cpp | 262 +- .../Stratholme/boss_magistrate_barthilas.cpp | 152 +- .../Stratholme/boss_maleki_the_pallid.cpp | 126 +- .../Stratholme/boss_nerubenkan.cpp | 148 +- .../Stratholme/boss_order_of_silver_hand.cpp | 177 +- .../Stratholme/boss_postmaster_malown.cpp | 186 +- .../Stratholme/boss_ramstein_the_gorger.cpp | 108 +- .../Stratholme/boss_timmy_the_cruel.cpp | 80 +- .../Stratholme/instance_stratholme.cpp | 750 ++-- .../EasternKingdoms/Stratholme/stratholme.cpp | 339 +- .../SunkenTemple/instance_sunken_temple.cpp | 315 +- .../SunkenTemple/sunken_temple.cpp | 55 +- .../SunwellPlateau/boss_brutallus.cpp | 512 +-- .../SunwellPlateau/boss_eredar_twins.cpp | 1278 +++---- .../SunwellPlateau/boss_felmyst.cpp | 871 ++--- .../SunwellPlateau/boss_kalecgos.cpp | 1271 +++---- .../SunwellPlateau/boss_kiljaeden.cpp | 2107 +++++------ .../SunwellPlateau/boss_muru.cpp | 1018 +++--- .../instance_sunwell_plateau.cpp | 467 +-- .../Uldaman/boss_archaedas.cpp | 16 +- .../Uldaman/instance_uldaman.cpp | 6 +- .../EasternKingdoms/ZulAman/boss_akilzon.cpp | 25 +- .../EasternKingdoms/ZulAman/boss_halazzi.cpp | 4 +- .../EasternKingdoms/ZulAman/boss_hexlord.cpp | 12 +- .../EasternKingdoms/ZulAman/boss_janalai.cpp | 71 +- .../EasternKingdoms/ZulAman/boss_nalorakk.cpp | 4 +- .../EasternKingdoms/ZulAman/boss_zuljin.cpp | 4 +- .../ZulAman/instance_zulaman.cpp | 6 +- .../EasternKingdoms/ZulAman/zulaman.cpp | 6 +- .../EasternKingdoms/ZulGurub/boss_arlokk.cpp | 6 +- .../EasternKingdoms/ZulGurub/boss_hakkar.cpp | 4 +- .../EasternKingdoms/ZulGurub/boss_jeklik.cpp | 8 +- .../EasternKingdoms/ZulGurub/boss_jindo.cpp | 4 +- .../ZulGurub/boss_mandokir.cpp | 8 +- .../EasternKingdoms/ZulGurub/boss_marli.cpp | 7 +- .../EasternKingdoms/ZulGurub/boss_thekal.cpp | 12 +- .../EasternKingdoms/ZulGurub/boss_venoxis.cpp | 4 +- .../ZulGurub/instance_zulgurub.cpp | 6 +- .../scripts/EasternKingdoms/blasted_lands.cpp | 189 +- .../scripts/EasternKingdoms/boss_kruul.cpp | 193 +- .../EasternKingdoms/burning_steppes.cpp | 184 +- .../scripts/EasternKingdoms/dun_morogh.cpp | 94 +- .../scripts/EasternKingdoms/duskwood.cpp | 136 +- .../EasternKingdoms/eastern_plaguelands.cpp | 218 +- .../scripts/EasternKingdoms/elwynn_forest.cpp | 94 +- .../EasternKingdoms/eversong_woods.cpp | 918 ++--- .../scripts/EasternKingdoms/ghostlands.cpp | 305 +- .../scripts/EasternKingdoms/hinterlands.cpp | 433 +-- .../scripts/EasternKingdoms/ironforge.cpp | 89 +- .../EasternKingdoms/isle_of_queldanas.cpp | 160 +- .../scripts/EasternKingdoms/loch_modan.cpp | 103 +- .../EasternKingdoms/redridge_mountains.cpp | 230 +- .../scripts/EasternKingdoms/searing_gorge.cpp | 197 +- .../EasternKingdoms/silvermoon_city.cpp | 93 +- .../EasternKingdoms/silverpine_forest.cpp | 469 +-- .../EasternKingdoms/stormwind_city.cpp | 972 ++--- .../EasternKingdoms/stranglethorn_vale.cpp | 130 +- .../EasternKingdoms/tirisfal_glades.cpp | 244 +- .../scripts/EasternKingdoms/undercity.cpp | 289 +- .../EasternKingdoms/western_plaguelands.cpp | 520 +-- .../scripts/EasternKingdoms/westfall.cpp | 345 +- .../scripts/EasternKingdoms/wetlands.cpp | 184 +- .../scripts/Examples/example_escort.cpp | 2 +- .../BlackfathomDeeps/blackfathom_deeps.cpp | 346 +- .../BlackfathomDeeps/boss_aku_mai.cpp | 110 +- .../BlackfathomDeeps/boss_gelihast.cpp | 96 +- .../Kalimdor/BlackfathomDeeps/boss_kelris.cpp | 118 +- .../instance_blackfathom_deeps.cpp | 363 +- .../BattleForMountHyjal/boss_anetheron.cpp | 482 +-- .../BattleForMountHyjal/boss_archimonde.cpp | 956 ++--- .../BattleForMountHyjal/boss_azgalor.cpp | 424 +-- .../BattleForMountHyjal/boss_kazrogal.cpp | 293 +- .../boss_rage_winterchill.cpp | 277 +- .../BattleForMountHyjal/hyjal.cpp | 382 +- .../BattleForMountHyjal/hyjalAI.cpp | 2 +- .../BattleForMountHyjal/hyjalAI.h | 2 +- .../BattleForMountHyjal/hyjal_trash.cpp | 1761 ++++----- .../BattleForMountHyjal/hyjal_trash.h | 2 +- .../BattleForMountHyjal/instance_hyjal.cpp | 476 +-- .../CullingOfStratholme/boss_epoch.cpp | 174 +- .../CullingOfStratholme/boss_infinite.cpp | 80 +- .../CullingOfStratholme/boss_mal_ganis.cpp | 348 +- .../CullingOfStratholme/boss_meathook.cpp | 146 +- .../CullingOfStratholme/boss_salramm.cpp | 178 +- .../culling_of_stratholme.cpp | 1926 +++++----- .../instance_culling_of_stratholme.cpp | 399 ++- .../CavernsOfTime/DarkPortal/boss_aeonus.cpp | 164 +- .../DarkPortal/boss_chrono_lord_deja.cpp | 192 +- .../DarkPortal/boss_temporus.cpp | 184 +- .../CavernsOfTime/DarkPortal/dark_portal.cpp | 558 +-- .../DarkPortal/instance_dark_portal.cpp | 479 +-- .../boss_captain_skarloc.cpp | 186 +- .../boss_epoch_hunter.cpp | 154 +- .../boss_leutenant_drake.cpp | 171 +- .../instance_old_hillsbrad.cpp | 342 +- .../EscapeFromDurnholdeKeep/old_hillsbrad.cpp | 926 ++--- .../Maraudon/boss_celebras_the_cursed.cpp | 102 +- .../Kalimdor/Maraudon/boss_landslide.cpp | 104 +- .../Kalimdor/Maraudon/boss_noxxion.cpp | 162 +- .../Maraudon/boss_princess_theradras.cpp | 120 +- .../Kalimdor/OnyxiasLair/boss_onyxia.cpp | 710 ++-- .../OnyxiasLair/instance_onyxias_lair.cpp | 393 +- .../boss_amnennar_the_coldbringer.cpp | 146 +- .../RazorfenDowns/instance_razorfen_downs.cpp | 314 +- .../Kalimdor/RazorfenDowns/razorfen_downs.cpp | 170 +- .../RazorfenKraul/instance_razorfen_kraul.cpp | 109 +- .../Kalimdor/RazorfenKraul/razorfen_kraul.cpp | 256 +- .../Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp | 140 +- .../Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp | 62 +- .../RuinsOfAhnQiraj/boss_kurinnaxx.cpp | 180 +- .../Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp | 184 +- .../RuinsOfAhnQiraj/boss_ossirian.cpp | 61 +- .../Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp | 61 +- .../instance_ruins_of_ahnqiraj.cpp | 317 +- .../TempleOfAhnQiraj/boss_bug_trio.cpp | 552 +-- .../Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 1927 +++++----- .../TempleOfAhnQiraj/boss_fankriss.cpp | 298 +- .../TempleOfAhnQiraj/boss_huhuran.cpp | 190 +- .../Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp | 178 +- .../TempleOfAhnQiraj/boss_sartura.cpp | 441 +-- .../Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp | 436 +-- .../TempleOfAhnQiraj/boss_twinemperors.cpp | 352 +- .../instance_temple_of_ahnqiraj.cpp | 230 +- .../mob_anubisath_sentinel.cpp | 400 +-- .../instance_wailing_caverns.cpp | 191 +- .../WailingCaverns/wailing_caverns.cpp | 586 +-- .../Kalimdor/ZulFarrak/instance_zulfarrak.cpp | 445 +-- .../scripts/Kalimdor/ZulFarrak/zulfarrak.cpp | 628 ++-- src/server/scripts/Kalimdor/azshara.cpp | 639 ++-- .../scripts/Kalimdor/azuremyst_isle.cpp | 1078 +++--- .../scripts/Kalimdor/bloodmyst_isle.cpp | 165 +- src/server/scripts/Kalimdor/boss_azuregos.cpp | 210 +- src/server/scripts/Kalimdor/darkshore.cpp | 475 +-- src/server/scripts/Kalimdor/desolace.cpp | 338 +- src/server/scripts/Kalimdor/durotar.cpp | 100 +- .../scripts/Kalimdor/dustwallow_marsh.cpp | 467 +-- src/server/scripts/Kalimdor/felwood.cpp | 82 +- src/server/scripts/Kalimdor/feralas.cpp | 239 +- src/server/scripts/Kalimdor/moonglade.cpp | 751 ++-- src/server/scripts/Kalimdor/mulgore.cpp | 326 +- src/server/scripts/Kalimdor/orgrimmar.cpp | 374 +- src/server/scripts/Kalimdor/silithus.cpp | 1442 ++++---- .../scripts/Kalimdor/stonetalon_mountains.cpp | 170 +- src/server/scripts/Kalimdor/tanaris.cpp | 864 ++--- src/server/scripts/Kalimdor/teldrassil.cpp | 105 +- src/server/scripts/Kalimdor/the_barrens.cpp | 935 ++--- .../scripts/Kalimdor/thousand_needles.cpp | 537 +-- src/server/scripts/Kalimdor/thunder_bluff.cpp | 161 +- src/server/scripts/Kalimdor/ungoro_crater.cpp | 464 +-- src/server/scripts/Kalimdor/winterspring.cpp | 196 +- .../AzjolNerub/AzjolNerub/boss_anubarak.cpp | 4 +- .../AzjolNerub/AzjolNerub/boss_hadronox.cpp | 4 +- .../boss_krikthir_the_gatewatcher.cpp | 4 +- .../AzjolNerub/instance_azjol_nerub.cpp | 8 +- .../AzjolNerub/ahnkahet/boss_amanitar.cpp | 4 +- .../AzjolNerub/ahnkahet/boss_elder_nadox.cpp | 8 +- .../ahnkahet/boss_herald_volazj.cpp | 4 +- .../ahnkahet/boss_jedoga_shadowseeker.cpp | 12 +- .../ahnkahet/boss_prince_taldaram.cpp | 10 +- .../AzjolNerub/ahnkahet/instance_ahnkahet.cpp | 8 +- .../boss_argent_challenge.cpp | 767 ++-- .../TrialOfTheChampion/boss_black_knight.cpp | 484 +-- .../boss_grand_champions.cpp | 1549 ++++---- .../instance_trial_of_the_champion.cpp | 533 +-- .../trial_of_the_champion.cpp | 815 +++-- .../Northrend/DraktharonKeep/boss_dred.cpp | 12 +- .../Northrend/DraktharonKeep/boss_novos.cpp | 12 +- .../DraktharonKeep/boss_tharon_ja.cpp | 4 +- .../DraktharonKeep/boss_trollgore.cpp | 4 +- .../instance_drak_tharon_keep.cpp | 8 +- .../ForgeOfSouls/boss_bronjahm.cpp | 8 +- .../ForgeOfSouls/boss_devourer_of_souls.cpp | 4 +- .../ForgeOfSouls/forge_of_souls.cpp | 8 +- .../ForgeOfSouls/instance_forge_of_souls.cpp | 8 +- .../HallsOfReflection/boss_falric.cpp | 157 +- .../HallsOfReflection/boss_marwyn.cpp | 147 +- .../HallsOfReflection/halls_of_reflection.cpp | 1467 ++++---- .../HallsOfReflection/halls_of_reflection.h | 10 +- .../instance_halls_of_reflection.cpp | 627 ++-- .../PitOfSaron/boss_forgemaster_garfrost.cpp | 245 +- .../PitOfSaron/boss_krickandick.cpp | 648 ++-- .../PitOfSaron/boss_scourgelord_tyrannus.cpp | 332 +- .../PitOfSaron/instance_pit_of_saron.cpp | 381 +- .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 1753 ++++----- .../Gundrak/boss_drakkari_colossus.cpp | 486 +-- .../scripts/Northrend/Gundrak/boss_eck.cpp | 227 +- .../Northrend/Gundrak/boss_gal_darah.cpp | 392 +- .../Northrend/Gundrak/boss_moorabi.cpp | 214 +- .../Northrend/Gundrak/boss_slad_ran.cpp | 328 +- .../Northrend/Gundrak/instance_gundrak.cpp | 987 ++--- .../Northrend/Naxxramas/boss_anubrekhan.cpp | 235 +- .../Northrend/Naxxramas/boss_faerlina.cpp | 266 +- .../Naxxramas/boss_four_horsemen.cpp | 556 +-- .../Northrend/Naxxramas/boss_gluth.cpp | 164 +- .../Northrend/Naxxramas/boss_gothik.cpp | 780 ++-- .../Northrend/Naxxramas/boss_grobbulus.cpp | 180 +- .../Northrend/Naxxramas/boss_heigan.cpp | 169 +- .../Northrend/Naxxramas/boss_kelthuzad.cpp | 830 ++--- .../Northrend/Naxxramas/boss_loatheb.cpp | 122 +- .../Northrend/Naxxramas/boss_maexxna.cpp | 215 +- .../scripts/Northrend/Naxxramas/boss_noth.cpp | 253 +- .../Northrend/Naxxramas/boss_patchwerk.cpp | 171 +- .../Northrend/Naxxramas/boss_razuvious.cpp | 133 +- .../Northrend/Naxxramas/boss_sapphiron.cpp | 573 ++- .../Northrend/Naxxramas/boss_thaddius.cpp | 511 +-- .../Naxxramas/instance_naxxramas.cpp | 427 +-- .../Nexus/EyeOfEternity/boss_malygos.cpp | 132 +- .../instance_eye_of_eternity.cpp | 27 +- .../Northrend/Nexus/Nexus/boss_anomalus.cpp | 307 +- .../Nexus/Nexus/boss_keristrasza.cpp | 354 +- .../Nexus/Nexus/boss_magus_telestra.cpp | 498 +-- .../Northrend/Nexus/Nexus/boss_ormorok.cpp | 444 +-- .../Nexus/Nexus/commander_kolurg.cpp | 50 +- .../Nexus/Nexus/commander_stoutbeard.cpp | 58 +- .../Northrend/Nexus/Nexus/instance_nexus.cpp | 391 +- .../Northrend/Nexus/Oculus/boss_drakos.cpp | 281 +- .../Northrend/Nexus/Oculus/boss_eregos.cpp | 80 +- .../Northrend/Nexus/Oculus/boss_urom.cpp | 464 +-- .../Northrend/Nexus/Oculus/boss_varos.cpp | 96 +- .../Nexus/Oculus/instance_oculus.cpp | 289 +- .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 221 +- .../ObsidianSanctum/boss_sartharion.cpp | 2061 +++++------ .../instance_obsidian_sanctum.cpp | 187 +- .../HallsOfLightning/boss_bjarngrim.cpp | 583 +-- .../Ulduar/HallsOfLightning/boss_ionar.cpp | 555 +-- .../Ulduar/HallsOfLightning/boss_loken.cpp | 270 +- .../Ulduar/HallsOfLightning/boss_volkhan.cpp | 661 ++-- .../instance_halls_of_lightning.cpp | 389 +- .../Ulduar/HallsOfStone/boss_krystallus.cpp | 230 +- .../HallsOfStone/boss_maiden_of_grief.cpp | 198 +- .../Ulduar/HallsOfStone/boss_sjonnir.cpp | 402 ++- .../Ulduar/HallsOfStone/halls_of_stone.cpp | 1139 +++--- .../HallsOfStone/instance_halls_of_stone.cpp | 451 +-- .../Northrend/Ulduar/ulduar/boss_algalon.cpp | 505 +-- .../Ulduar/ulduar/boss_assembly_of_iron.cpp | 815 ++--- .../Northrend/Ulduar/ulduar/boss_auriaya.cpp | 115 +- .../Ulduar/ulduar/boss_flame_leviathan.cpp | 1998 ++++++----- .../Northrend/Ulduar/ulduar/boss_freya.cpp | 85 +- .../Northrend/Ulduar/ulduar/boss_hodir.cpp | 80 +- .../Northrend/Ulduar/ulduar/boss_ignis.cpp | 147 +- .../Northrend/Ulduar/ulduar/boss_kologarn.cpp | 195 +- .../Ulduar/ulduar/boss_razorscale.cpp | 509 +-- .../Northrend/Ulduar/ulduar/boss_thorim.cpp | 89 +- .../Northrend/Ulduar/ulduar/boss_xt002.cpp | 1086 +++--- .../Ulduar/ulduar/instance_ulduar.cpp | 687 ++-- .../Ulduar/ulduar/ulduar_teleporter.cpp | 113 +- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 582 +-- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 552 +-- .../UtgardeKeep/boss_skarvald_dalronn.cpp | 549 +-- .../UtgardeKeep/instance_utgarde_keep.cpp | 445 +-- .../UtgardeKeep/UtgardeKeep/utgarde_keep.cpp | 210 +- .../UtgardePinnacle/boss_palehoof.cpp | 1214 +++---- .../UtgardePinnacle/boss_skadi.cpp | 574 +-- .../UtgardePinnacle/boss_svala.cpp | 590 +-- .../UtgardePinnacle/boss_ymiron.cpp | 524 +-- .../UtgardePinnacle/instance_pinnacle.cpp | 25 +- .../VaultOfArchavon/boss_archavon.cpp | 273 +- .../Northrend/VaultOfArchavon/boss_emalon.cpp | 323 +- .../VaultOfArchavon/boss_koralon.cpp | 263 +- .../VaultOfArchavon/boss_toravon.cpp | 387 +- .../instance_vault_of_archavon.cpp | 231 +- .../Northrend/VioletHold/boss_cyanigosa.cpp | 180 +- .../Northrend/VioletHold/boss_erekem.cpp | 445 +-- .../Northrend/VioletHold/boss_ichoron.cpp | 589 +-- .../Northrend/VioletHold/boss_lavanthor.cpp | 226 +- .../Northrend/VioletHold/boss_moragg.cpp | 192 +- .../Northrend/VioletHold/boss_xevozz.cpp | 437 +-- .../Northrend/VioletHold/boss_zuramat.cpp | 228 +- .../VioletHold/instance_violet_hold.cpp | 1301 +++---- .../Northrend/VioletHold/violet_hold.cpp | 1602 +++++---- .../scripts/Northrend/borean_tundra.cpp | 4 +- src/server/scripts/Northrend/dragonblight.cpp | 2 +- .../scripts/Northrend/grizzly_hills.cpp | 2 +- .../scripts/Northrend/sholazar_basin.cpp | 2 +- src/server/scripts/Northrend/storm_peaks.cpp | 2 +- src/server/scripts/Northrend/zuldrak.cpp | 2 +- .../scripts/OutdoorPvP/OutdoorPvPEP.cpp | 36 +- .../scripts/OutdoorPvP/OutdoorPvPHP.cpp | 8 +- .../scripts/OutdoorPvP/OutdoorPvPNA.cpp | 14 +- .../scripts/OutdoorPvP/OutdoorPvPSI.cpp | 8 +- .../scripts/OutdoorPvP/OutdoorPvPTF.cpp | 8 +- .../scripts/OutdoorPvP/OutdoorPvPZM.cpp | 26 +- .../AuchenaiCrypts/boss_exarch_maladaar.cpp | 451 +-- .../boss_shirrak_the_dead_watcher.cpp | 295 +- .../ManaTombs/boss_nexusprince_shaffar.cpp | 461 +-- .../Auchindoun/ManaTombs/boss_pandemonius.cpp | 146 +- .../SethekkHalls/boss_darkweaver_syth.cpp | 572 +-- .../SethekkHalls/boss_tailonking_ikiss.cpp | 272 +- .../SethekkHalls/instance_sethekk_halls.cpp | 88 +- .../boss_ambassador_hellmaw.cpp | 252 +- .../boss_blackheart_the_inciter.cpp | 194 +- .../boss_grandmaster_vorpil.cpp | 463 +-- .../ShadowLabyrinth/boss_murmur.cpp | 282 +- .../instance_shadow_labyrinth.cpp | 314 +- .../Outland/BlackTemple/black_temple.cpp | 48 +- .../Outland/BlackTemple/boss_bloodboil.cpp | 468 +-- .../Outland/BlackTemple/boss_illidan.cpp | 3182 +++++++++-------- .../BlackTemple/boss_mother_shahraz.cpp | 388 +- .../BlackTemple/boss_reliquary_of_souls.cpp | 1077 +++--- .../BlackTemple/boss_shade_of_akama.cpp | 1297 +++---- .../Outland/BlackTemple/boss_supremus.cpp | 408 +-- .../BlackTemple/boss_teron_gorefiend.cpp | 860 ++--- .../BlackTemple/boss_warlord_najentus.cpp | 300 +- .../Outland/BlackTemple/illidari_council.cpp | 1176 +++--- .../BlackTemple/instance_black_temple.cpp | 538 +-- .../boss_fathomlord_karathress.cpp | 1107 +++--- .../boss_hydross_the_unstable.cpp | 528 +-- .../SerpentShrine/boss_lady_vashj.cpp | 1601 +++++---- .../boss_leotheras_the_blind.cpp | 1251 +++---- .../SerpentShrine/boss_lurker_below.cpp | 733 ++-- .../boss_morogrim_tidewalker.cpp | 462 +-- .../SerpentShrine/instance_serpent_shrine.cpp | 615 ++-- .../SteamVault/boss_hydromancer_thespia.cpp | 228 +- .../SteamVault/boss_mekgineer_steamrigger.cpp | 340 +- .../SteamVault/boss_warlord_kalithresh.cpp | 282 +- .../SteamVault/instance_steam_vault.cpp | 325 +- .../underbog/boss_hungarfen.cpp | 196 +- .../underbog/boss_the_black_stalker.cpp | 247 +- .../scripts/Outland/GruulsLair/boss_gruul.cpp | 338 +- .../GruulsLair/boss_high_king_maulgar.cpp | 1165 +++--- .../GruulsLair/instance_gruuls_lair.cpp | 272 +- .../BloodFurnace/boss_broggok.cpp | 4 +- .../BloodFurnace/boss_kelidan_the_breaker.cpp | 4 +- .../BloodFurnace/boss_the_maker.cpp | 4 +- .../BloodFurnace/instance_blood_furnace.cpp | 6 +- .../instance_hellfire_ramparts.cpp | 6 +- .../MagtheridonsLair/boss_magtheridon.cpp | 10 +- .../instance_magtheridons_lair.cpp | 6 +- .../ShatteredHalls/boss_nethekurse.cpp | 10 +- .../ShatteredHalls/boss_warbringer_omrogg.cpp | 6 +- .../instance_shattered_halls.cpp | 6 +- .../Outland/TempestKeep/Eye/boss_alar.cpp | 8 +- .../TempestKeep/Eye/boss_astromancer.cpp | 8 +- .../Outland/TempestKeep/Eye/boss_kaelthas.cpp | 10 +- .../TempestKeep/Eye/boss_void_reaver.cpp | 4 +- .../TempestKeep/Eye/instance_the_eye.cpp | 6 +- .../Mechanar/boss_nethermancer_sepethrea.cpp | 8 +- .../boss_pathaleon_the_calculator.cpp | 4 +- .../Mechanar/instance_mechanar.cpp | 6 +- .../Outland/TempestKeep/arcatraz/arcatraz.cpp | 8 +- .../arcatraz/boss_harbinger_skyriss.cpp | 6 +- .../arcatraz/instance_arcatraz.cpp | 6 +- .../scripts/Outland/blades_edge_mountains.cpp | 661 ++-- .../scripts/Outland/boss_doomlord_kazzak.cpp | 202 +- .../scripts/Outland/boss_doomwalker.cpp | 218 +- .../scripts/Outland/hellfire_peninsula.cpp | 632 ++-- src/server/scripts/Outland/nagrand.cpp | 1230 +++---- src/server/scripts/Outland/netherstorm.cpp | 1344 +++---- .../scripts/Outland/shadowmoon_valley.cpp | 2564 ++++++------- src/server/scripts/Outland/shattrath_city.cpp | 900 ++--- .../scripts/Outland/terokkar_forest.cpp | 893 ++--- src/server/scripts/Outland/zangarmarsh.cpp | 24 +- .../scripts/PrecompiledHeaders/ScriptPCH.h | 2 +- src/server/scripts/Spells/spell_paladin.cpp | 14 +- src/server/scripts/Spells/spell_priest.cpp | 14 +- src/server/scripts/World/go_scripts.cpp | 2 +- src/server/scripts/World/npcs_special.cpp | 6 +- 482 files changed, 84476 insertions(+), 82697 deletions(-) rename src/server/game/Instances/{InstanceData.cpp => InstanceScript.cpp} (83%) rename src/server/game/Instances/{InstanceData.h => InstanceScript.h} (84%) diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 308d4cd7c69..4d8f5f5398b 100644 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -29,7 +29,7 @@ #include "GameEventMgr.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "SpellMgr.h" #include "CreatureAIImpl.h" #include "ConditionMgr.h" @@ -708,7 +708,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_SET_INST_DATA: { - InstanceData* pInst = (InstanceData*)me->GetInstanceData(); + InstanceScript* pInst = (InstanceScript*)me->GetInstanceScript(); if (!pInst) { sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, me->GetEntry()); @@ -727,7 +727,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 return; } - InstanceData* pInst = (InstanceData*)me->GetInstanceData(); + InstanceScript* pInst = (InstanceScript*)me->GetInstanceScript(); if (!pInst) { sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, me->GetEntry()); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index c3b132026a1..34bcfdd2a38 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -513,7 +513,7 @@ void Scripted_NoMovementAI::AttackStart(Unit* pWho) } BossAI::BossAI(Creature *c, uint32 id) : ScriptedAI(c) -, bossId(id), summons(me), instance(c->GetInstanceData()) +, bossId(id), summons(me), instance(c->GetInstanceScript()) , boundary(instance ? instance->GetBossBoundary(id) : NULL) { } diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index a7a30f88148..d5ae414a31e 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -11,7 +11,7 @@ #include "Creature.h" #include "CreatureAI.h" #include "CreatureAIImpl.h" -#include "InstanceData.h" +#include "InstanceScript.h" #define SCRIPT_CAST_TYPE dynamic_cast @@ -24,7 +24,7 @@ #define GET_SPELL(a) (const_cast(GetSpellStore()->LookupEntry(a))) -class InstanceData; +class InstanceScript; class SummonList : public std::list { @@ -250,7 +250,7 @@ struct BossAI : public ScriptedAI const uint32 bossId; EventMap events; SummonList summons; - InstanceData * const instance; + InstanceScript * const instance; const BossBoundaryMap * const boundary; void JustSummoned(Creature *summon); diff --git a/src/server/game/AI/ScriptedAI/ScriptedInstance.h b/src/server/game/AI/ScriptedAI/ScriptedInstance.h index b1790661b22..5b7d8b67b44 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedInstance.h +++ b/src/server/game/AI/ScriptedAI/ScriptedInstance.h @@ -5,7 +5,7 @@ #ifndef SC_INSTANCE_H #define SC_INSTANCE_H -#include "InstanceData.h" +#include "InstanceScript.h" #include "Map.h" #define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 800bf80aaab..24f041bb661 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -38,7 +38,7 @@ #include "Battleground.h" #include "BattlegroundAB.h" #include "Map.h" -#include "InstanceData.h" +#include "InstanceScript.h" namespace Trinity { @@ -344,7 +344,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT, criteria_id, map->GetId()); return false; } - InstanceData* data = ((InstanceMap*)map)->GetInstanceData(); + InstanceScript* data = ((InstanceMap*)map)->GetInstanceScript(); if (!data) { sLog.outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script", diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 3b27218e606..89cb9526867 100644 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -50,7 +50,7 @@ #include "ItemEnchantmentMgr.h" #include "BattlegroundMgr.h" #include "InstanceSaveMgr.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "CreatureEventAIMgr.h" #include "SpellAuraEffects.h" #include "DBCEnums.h" @@ -6576,14 +6576,14 @@ bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/) return false; } - if (!((InstanceMap*)map)->GetInstanceData()) + if (!((InstanceMap*)map)->GetInstanceScript()) { PSendSysMessage("Map has no instance data."); SetSentErrorMessage(true); return false; } - ((InstanceMap*)map)->GetInstanceData()->SaveToDB(); + ((InstanceMap*)map)->GetInstanceScript()->SaveToDB(); return true; } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index ee7a662e608..8bb94456300 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -26,7 +26,7 @@ #include "GameEventMgr.h" #include "ObjectMgr.h" #include "ProgressBar.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "ConditionMgr.h" #include "ScriptMgr.h" @@ -119,8 +119,8 @@ bool Condition::Meets(Player * player, Unit* targetOverride) case CONDITION_INSTANCE_DATA: { Map *map = player->GetMap(); - if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceData()) - condMeets = ((InstanceMap*)map)->GetInstanceData()->GetData(mConditionValue1) == mConditionValue2; + if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceScript()) + condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(mConditionValue1) == mConditionValue2; break; } case CONDITION_SPELL_SCRIPT_TARGET: diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 2007aa8cff1..c096aaaa9ca 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -37,7 +37,7 @@ #include "CreatureAISelector.h" #include "Formulas.h" #include "WaypointMovementGenerator.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "BattlegroundMgr.h" #include "Util.h" #include "GridNotifiers.h" diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3d190bccb5f..61ac5bdd2c8 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -34,7 +34,7 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "Battleground.h" #include "Util.h" #include "OutdoorPvPMgr.h" diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 477f06ba21b..5901ad7caa1 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1251,10 +1251,10 @@ void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const GetBaseMap()->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ); } -InstanceData* WorldObject::GetInstanceData() +InstanceScript* WorldObject::GetInstanceScript() { Map *map = GetMap(); - return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceData() : NULL; + return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceScript() : NULL; } float WorldObject::GetDistanceZ(const WorldObject* obj) const @@ -1844,7 +1844,7 @@ void WorldObject::SetZoneScript() if (Map *map = FindMap()) { if (map->IsDungeon()) - m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceData(); + m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript(); else if (!map->IsBattlegroundOrArena()) m_zoneScript = sOutdoorPvPMgr.GetZoneScript(GetZoneId()); } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index af501823d4a..d148787aa28 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -108,7 +108,7 @@ class WorldSession; class Creature; class Player; class UpdateMask; -class InstanceData; +class InstanceScript; class GameObject; class TempSummon; class Vehicle; @@ -599,7 +599,7 @@ class WorldObject : public Object, public WorldLocation uint32 GetAreaId() const; void GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const; - InstanceData* GetInstanceData(); + InstanceScript* GetInstanceScript(); const char* GetName() const { return m_name.c_str(); } void SetName(const std::string& newname) { m_name=newname; } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 86b148edfa1..9e3e6eaa07f 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -37,7 +37,7 @@ #include "ObjectMgr.h" #include "World.h" #include "Group.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "ProgressBar.h" @@ -169,7 +169,7 @@ void InstanceSave::SaveToDB() if (map) { ASSERT(map->IsDungeon()); - if (InstanceData *iData = ((InstanceMap*)map)->GetInstanceData()) + if (InstanceScript *iData = ((InstanceMap*)map)->GetInstanceScript()) { data = iData->GetSaveData(); if (!data.empty()) diff --git a/src/server/game/Instances/InstanceData.cpp b/src/server/game/Instances/InstanceScript.cpp similarity index 83% rename from src/server/game/Instances/InstanceData.cpp rename to src/server/game/Instances/InstanceScript.cpp index 7408efe97e5..e5258c0fedd 100644 --- a/src/server/game/Instances/InstanceData.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "InstanceData.h" +#include "InstanceScript.h" #include "DatabaseEnv.h" #include "Map.h" #include "Player.h" @@ -27,7 +27,7 @@ #include "CreatureAI.h" #include "Log.h" -void InstanceData::SaveToDB() +void InstanceScript::SaveToDB() { std::string data = GetSaveData(); if (data.empty()) @@ -36,17 +36,17 @@ void InstanceData::SaveToDB() CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId()); } -void InstanceData::HandleGameObject(uint64 GUID, bool open, GameObject *go) +void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject *go) { if (!go) go = instance->GetGameObject(GUID); if (go) go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); else - sLog.outDebug("TSCR: InstanceData: HandleGameObject failed"); + sLog.outDebug("TSCR: InstanceScript: HandleGameObject failed"); } -bool InstanceData::IsEncounterInProgress() const +bool InstanceScript::IsEncounterInProgress() const { for (std::vector::const_iterator itr = bosses.begin(); itr != bosses.end(); ++itr) if (itr->state == IN_PROGRESS) @@ -55,7 +55,7 @@ bool InstanceData::IsEncounterInProgress() const return false; } -void InstanceData::LoadMinionData(const MinionData *data) +void InstanceScript::LoadMinionData(const MinionData *data) { while (data->entry) { @@ -64,10 +64,10 @@ void InstanceData::LoadMinionData(const MinionData *data) ++data; } - sLog.outDebug("InstanceData::LoadMinionData: %u minions loaded.", doors.size()); + sLog.outDebug("InstanceScript::LoadMinionData: %u minions loaded.", doors.size()); } -void InstanceData::LoadDoorData(const DoorData *data) +void InstanceScript::LoadDoorData(const DoorData *data) { while (data->entry) { @@ -76,10 +76,10 @@ void InstanceData::LoadDoorData(const DoorData *data) ++data; } - sLog.outDebug("InstanceData::LoadDoorData: %u doors loaded.", doors.size()); + sLog.outDebug("InstanceScript::LoadDoorData: %u doors loaded.", doors.size()); } -void InstanceData::UpdateMinionState(Creature *minion, EncounterState state) +void InstanceScript::UpdateMinionState(Creature *minion, EncounterState state) { switch (state) { @@ -98,7 +98,7 @@ void InstanceData::UpdateMinionState(Creature *minion, EncounterState state) } } -void InstanceData::UpdateDoorState(GameObject *door) +void InstanceScript::UpdateDoorState(GameObject *door) { DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry()); DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry()); @@ -130,7 +130,7 @@ void InstanceData::UpdateDoorState(GameObject *door) //sLog.outError("Door %u is %s.", door->GetEntry(), open ? "opened" : "closed"); } -void InstanceData::AddDoor(GameObject *door, bool add) +void InstanceScript::AddDoor(GameObject *door, bool add) { DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry()); DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry()); @@ -173,7 +173,7 @@ void InstanceData::AddDoor(GameObject *door, bool add) UpdateDoorState(door); } -void InstanceData::AddMinion(Creature *minion, bool add) +void InstanceScript::AddMinion(Creature *minion, bool add) { MinionInfoMap::iterator itr = minions.find(minion->GetEntry()); if (itr == minions.end()) @@ -185,7 +185,7 @@ void InstanceData::AddMinion(Creature *minion, bool add) itr->second.bossInfo->minion.erase(minion); } -bool InstanceData::SetBossState(uint32 id, EncounterState state) +bool InstanceScript::SetBossState(uint32 id, EncounterState state) { if (id < bosses.size()) { @@ -222,7 +222,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state) return false; } -std::string InstanceData::LoadBossState(const char * data) +std::string InstanceScript::LoadBossState(const char * data) { if (!data) return NULL; @@ -238,7 +238,7 @@ std::string InstanceData::LoadBossState(const char * data) return loadStream.str(); } -std::string InstanceData::GetBossSaveData() +std::string InstanceScript::GetBossSaveData() { std::ostringstream saveStream; for (std::vector::iterator i = bosses.begin(); i != bosses.end(); ++i) @@ -246,7 +246,7 @@ std::string InstanceData::GetBossSaveData() return saveStream.str(); } -void InstanceData::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState) +void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState) { if (!uiGuid) return; @@ -267,7 +267,7 @@ void InstanceData::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bo } } -void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn) +void InstanceScript::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn) { if (GameObject* pGo = instance->GetGameObject(uiGuid)) { @@ -283,7 +283,7 @@ void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn) } } -void InstanceData::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) +void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) { Map::PlayerList const& lPlayers = instance->GetPlayers(); @@ -298,7 +298,7 @@ void InstanceData::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) } // Send Notify to all players in instance -void InstanceData::DoSendNotifyToInstance(const char *format, ...) +void InstanceScript::DoSendNotifyToInstance(const char *format, ...) { InstanceMap::PlayerList const &PlayerList = instance->GetPlayers(); InstanceMap::PlayerList::const_iterator i; @@ -311,7 +311,7 @@ void InstanceData::DoSendNotifyToInstance(const char *format, ...) } // Complete Achievement for all players in instance -void InstanceData::DoCompleteAchievement(uint32 achievement) +void InstanceScript::DoCompleteAchievement(uint32 achievement) { AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievement); Map::PlayerList const &PlayerList = instance->GetPlayers(); @@ -329,7 +329,7 @@ void InstanceData::DoCompleteAchievement(uint32 achievement) } // Update Achievement Criteria for all players in instance -void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time) +void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time) { Map::PlayerList const &PlayerList = instance->GetPlayers(); @@ -340,7 +340,7 @@ void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, ui } // Start timed achievement for all players in instance -void InstanceData::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) +void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { Map::PlayerList const &PlayerList = instance->GetPlayers(); @@ -351,7 +351,7 @@ void InstanceData::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, u } // Stop timed achievement for all players in instance -void InstanceData::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) +void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { Map::PlayerList const &PlayerList = instance->GetPlayers(); @@ -362,7 +362,7 @@ void InstanceData::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, ui } // Remove Auras due to Spell on all players in instance -void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell) +void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell) { Map::PlayerList const &PlayerList = instance->GetPlayers(); @@ -372,9 +372,9 @@ void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell) pPlayer->RemoveAurasDueToSpell(spell); } -bool InstanceData::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/) +bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/) { - sLog.outError("Achievement system call InstanceData::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", + sLog.outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", instance->GetId(),criteria_id); return false; } diff --git a/src/server/game/Instances/InstanceData.h b/src/server/game/Instances/InstanceScript.h similarity index 84% rename from src/server/game/Instances/InstanceData.h rename to src/server/game/Instances/InstanceScript.h index eb2c781aa91..874c0382346 100644 --- a/src/server/game/Instances/InstanceData.h +++ b/src/server/game/Instances/InstanceScript.h @@ -26,6 +26,12 @@ //#include "GameObject.h" //#include "Map.h" +#define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA_COMPLETE sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA(a) sLog.outDebug("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) +#define OUT_LOAD_INST_DATA_COMPLETE sLog.outDebug("TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL sLog.outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) + class Map; class Unit; class Player; @@ -110,12 +116,12 @@ struct MinionInfo typedef std::multimap DoorInfoMap; typedef std::map MinionInfoMap; -class InstanceData : public ZoneScript +class InstanceScript : public ZoneScript { public: - explicit InstanceData(Map *map) : instance(map) {} - virtual ~InstanceData() {} + explicit InstanceScript(Map *map) : instance(map) {} + virtual ~InstanceScript() {} Map *instance; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index fb83f3ac260..069ea97ab10 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -25,7 +25,7 @@ #include "Log.h" #include "GridStates.h" #include "CellImpl.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "Map.h" #include "GridNotifiersImpl.h" #include "Config.h" @@ -2266,7 +2266,7 @@ bool InstanceMap::CanEnter(Player *player) // cannot enter while an encounter is in progress on raids /*Group *pGroup = player->GetGroup(); if (!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/ - if (IsRaid() && GetInstanceData() && GetInstanceData()->IsEncounterInProgress()) + if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress()) { player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); return false; diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 592e56a6f49..e9ae54b9535 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -39,7 +39,7 @@ class Unit; class WorldPacket; -class InstanceData; +class InstanceScript; class Group; class InstanceSave; class Object; @@ -592,7 +592,7 @@ class InstanceMap : public Map void CreateInstanceData(bool load); bool Reset(uint8 method); uint32 GetScriptId() { return i_script_id; } - InstanceData* GetInstanceData() { return i_data; } + InstanceScript* GetInstanceScript() { return i_data; } void PermBindAllPlayers(Player *player); void UnloadAll(); bool CanEnter(Player* player); @@ -606,7 +606,7 @@ class InstanceMap : public Map private: bool m_resetAfterUnload; bool m_unloadWhenEmpty; - InstanceData* i_data; + InstanceScript* i_data; uint32 i_script_id; }; diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index eeafda9b8b0..a4036cfc299 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -26,7 +26,7 @@ #include "Transport.h" #include "GridDefines.h" #include "MapInstanced.h" -#include "InstanceData.h" +#include "InstanceScript.h" #include "DestinationHolderImp.h" #include "Config.h" #include "World.h" diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index dea75f25ff4..d2277f3a07a 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -593,12 +593,12 @@ void ScriptMgr::OnMapUpdate(Map* map, uint32 diff) #undef SCR_MAP_BGN #undef SCR_MAP_END -InstanceData* ScriptMgr::CreateInstanceData(InstanceMap* map) +InstanceScript* ScriptMgr::CreateInstanceData(InstanceMap* map) { ASSERT(map); GET_SCRIPT_RET(InstanceMapScript, map->GetScriptId(), tmpscript, NULL); - return tmpscript->GetInstanceData(map); + return tmpscript->GetInstanceScript(map); } bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex, Item* target) diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 28936e93f46..f644cbd2adf 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -40,7 +40,7 @@ class Player; class Creature; class CreatureAI; -class InstanceData; +class InstanceScript; class SpellScript; class Quest; class Item; @@ -421,8 +421,8 @@ class InstanceMapScript : public ScriptObject, public MapScript bool IsDatabaseBound() const { return true; } - // Gets an InstanceData object for this instance. - virtual InstanceData* GetInstanceData(InstanceMap* map) const { return NULL; } + // Gets an InstanceScript object for this instance. + virtual InstanceScript* GetInstanceScript(InstanceMap* map) const { return NULL; } }; class BattlegroundMapScript : public ScriptObject, public MapScript @@ -852,7 +852,7 @@ class ScriptMgr public: /* InstanceMapScript */ - InstanceData* CreateInstanceData(InstanceMap* map); + InstanceScript* CreateInstanceData(InstanceMap* map); public: /* ItemScript */ diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index 85217117461..b5f37c96e6d 100644 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -49,7 +49,7 @@ #include "DBCEnums.h" #include "ScriptMgr.h" #include "MapManager.h" -#include "InstanceData.h" +#include "InstanceScript.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp index ac767d0e55d..c46f2128cc9 100644 --- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp @@ -384,7 +384,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) } else { - if (!Script->GossipSelect (_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction (option))) + if (!Script->OnGossipSelect (_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction (option))) unit->OnGossipSelect (_player, option); } }*/ diff --git a/src/server/scripts/Custom/custom_example.cpp b/src/server/scripts/Custom/custom_example.cpp index d922dfed0aa..61b1f4e9229 100644 --- a/src/server/scripts/Custom/custom_example.cpp +++ b/src/server/scripts/Custom/custom_example.cpp @@ -211,11 +211,46 @@ struct TRINITY_DLL_DECL custom_exampleAI : public ScriptedAI }; //This is the GetAI method used by all scripts that involve AI -//It is called every time a new Creature using this script is created -CreatureAI* GetAI_custom_example(Creature* pCreature) +//It is called every time a new Creature using this script is created class custom_example : public CreatureScript { - return new custom_exampleAI (pCreature); -} +public: + custom_example() : CreatureScript("custom_example") { } + + bool ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32 emote) + { + pCreature->HandleEmoteCommand(emote); + + if (emote == TEXTEMOTE_DANCE) + ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_DANCE,LANG_UNIVERSAL,NULL); + + if (emote == TEXTEMOTE_SALUTE) + ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_SALUTE,LANG_UNIVERSAL,NULL); + + return true; + } + + bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + { + if (uiSender == GOSSIP_SENDER_MAIN) + SendDefaultMenu(pPlayer, pCreature, uiAction); + + return true; + } + + bool GossipHello(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()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) + { + return new custom_exampleAI (pCreature); + } + +}; //This function is called when the player clicks an option on the gossip menu void SendDefaultMenu_custom_example(Player* pPlayer, Creature* pCreature, uint32 uiAction) @@ -230,36 +265,10 @@ void SendDefaultMenu_custom_example(Player* pPlayer, Creature* pCreature, uint32 } //This function is called when the player clicks an option on the gossip menu -bool GossipSelect_custom_example(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - SendDefaultMenu_custom_example(pPlayer, pCreature, uiAction); - - return true; -} //This function is called when the player opens the gossip menu -bool GossipHello_custom_example(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()); - - return true; -} //Our Recive emote function -bool ReceiveEmote_custom_example(Player* pPlayer, Creature* pCreature, uint32 emote) -{ - pCreature->HandleEmoteCommand(emote); - - if (emote == TEXTEMOTE_DANCE) - ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_DANCE,LANG_UNIVERSAL,NULL); - - if (emote == TEXTEMOTE_SALUTE) - ((custom_exampleAI*)_Creature->AI())->DoSay(SAY_SALUTE,LANG_UNIVERSAL,NULL); - - 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 @@ -267,14 +276,5 @@ bool ReceiveEmote_custom_example(Player* pPlayer, Creature* pCreature, uint32 em //newscript->ReciveEmote = My_Emote_Function; void AddSC_custom_example() { - Script *newscript; - - newscript = new Script; - newscript->Name="custom_example"; - newscript->GetAI = &GetAI_custom_example; - newscript->pGossipHello = &GossipHello_custom_example; - newscript->pGossipSelect = &GossipSelect_custom_example; - newscript->pReceiveEmote = &ReceiveEmote_custom_example; - newscript->RegisterSelf(); + new custom_example(); } - diff --git a/src/server/scripts/Custom/custom_gossip_codebox.cpp b/src/server/scripts/Custom/custom_gossip_codebox.cpp index e7dd58f0a33..6b1dd91fabb 100644 --- a/src/server/scripts/Custom/custom_gossip_codebox.cpp +++ b/src/server/scripts/Custom/custom_gossip_codebox.cpp @@ -33,59 +33,59 @@ EndScriptData */ #define SAY_WRONG "Wrong!" #define SAY_RIGHT "You're right, you are allowed to see my inner secrets." -//This function is called when the player opens the gossip menubool -bool GossipHello_custom_gossip_codebox(Player* pPlayer, Creature* pCreature) +//This function is called when the player opens the gossip menubool class custom_gossip_codebox : public GameObjectScript { - pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); +public: + custom_gossip_codebox() : GameObjectScript("custom_gossip_codebox") { } - pPlayer->PlayerTalkClass->SendGossipMenu(907, pCreature->GetGUID()); - return true; -} + bool GossipSelectWithCode(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) + { + if (uiSender == GOSSIP_SENDER_MAIN) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + if (std::strcmp(sCode, pPlayer->GetName())!=0) + { + pCreature->Say(SAY_WRONG, LANG_UNIVERSAL, 0); + pCreature->CastSpell(pPlayer, 12826, true); + } + else + { + pCreature->Say(SAY_RIGHT, LANG_UNIVERSAL, 0); + pCreature->CastSpell(pPlayer, 26990, true); + } + pPlayer->CLOSE_GOSSIP_MENU(); + return true; + } + } + return false; + } + + bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pCreature->Say(SAY_NOT_INTERESTED, LANG_UNIVERSAL, 0); + pPlayer->CLOSE_GOSSIP_MENU(); + } + return true; + } + + bool GossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM_EXTENDED(0, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1, "", 0, true); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, 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_custom_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pCreature->Say(SAY_NOT_INTERESTED, LANG_UNIVERSAL, 0); - pPlayer->CLOSE_GOSSIP_MENU(); - } - return true; -} -bool GossipSelectWithCode_custom_gossip_codebox(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction, const char* sCode) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - { - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - if (std::strcmp(sCode, pPlayer->GetName())!=0) - { - pCreature->Say(SAY_WRONG, LANG_UNIVERSAL, 0); - pCreature->CastSpell(pPlayer, 12826, true); - } - else - { - pCreature->Say(SAY_RIGHT, LANG_UNIVERSAL, 0); - pCreature->CastSpell(pPlayer, 26990, true); - } - pPlayer->CLOSE_GOSSIP_MENU(); - return true; - } - } - return false; -} void AddSC_custom_gossip_codebox() { - Script *newscript; - - newscript = new Script; - newscript->Name="custom_gossip_codebox"; - newscript->pGossipHello = &GossipHello_custom_gossip_codebox; - newscript->pGossipSelect = &GossipSelect_custom_gossip_codebox; - newscript->pGossipSelectWithCode = &GossipSelectWithCode_custom_gossip_codebox; - newscript->RegisterSelf(); + new custom_gossip_codebox(); } - diff --git a/src/server/scripts/Custom/test.cpp b/src/server/scripts/Custom/test.cpp index 0e841d450ba..024b06fff0e 100644 --- a/src/server/scripts/Custom/test.cpp +++ b/src/server/scripts/Custom/test.cpp @@ -152,69 +152,70 @@ struct TRINITY_DLL_DECL npc_testAI : public npc_escortAI } } }; - -CreatureAI* GetAI_test(Creature* pCreature) + class test : public CreatureScript { - npc_testAI* testAI = new npc_testAI(pCreature); +public: + test() : CreatureScript("test") { } - 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 (CreatureAI*)testAI; -} - -bool GossipHello_npc_test(Player* pPlayer, Creature* pCreature) -{ - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->prepareGossipMenu(pPlayer,0); - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - - pCreature->sendPreparedGossip(pPlayer); - return true; -} - -bool GossipSelect_npc_test(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool GossipSelect_npc(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(true, true, pPlayer->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + ((npc_escortAI*)(pCreature->AI()))->Start(true, true, pPlayer->GetGUID()); - return true; // prevent Trinity core handling + return true; // prevent Trinity core handling + } + + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + + return true; // prevent Trinity core handling + } + + if (uiAction == GOSSIP_ACTION_INFO_DEF+3) + { + pPlayer->CLOSE_GOSSIP_MENU(); + ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + + return true; // prevent Trinity core handling + } + return false; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + bool GossipHello_npc(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pCreature->prepareGossipMenu(pPlayer,0); - return true; // prevent Trinity core handling + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TEXT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + + pCreature->sendPreparedGossip(pPlayer); + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+3) + CreatureAI* GetAI(Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - ((npc_escortAI*)(pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + npcAI* testAI = new npcAI(pCreature); - return true; // prevent Trinity core handling + 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 (CreatureAI*)testAI; } - return false; -} + +}; + + void AddSC_test() { - Script *newscript; - newscript = new Script; - newscript->Name="test"; - newscript->GetAI = &GetAI_test; - newscript->pGossipHello = &GossipHello_npc_test; - newscript->pGossipSelect = &GossipSelect_npc_test; - newscript->RegisterSelf(); + new test(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 6b8d17b3f55..f2ac2705829 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -43,23 +43,29 @@ EndContentData */ /*###### +## go_shadowforge_brazier +######*/ - -bool GOHello_go_shadowforge_brazier(Player* /*pPlayer*/, GameObject* pGo) + class go_shadowforge_brazier : public GameObjectScript { - if (ScriptedInstance* pInstance = pGo->GetInstanceData()) +public: + go_shadowforge_brazier() : GameObjectScript("go_shadowforge_brazier") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) { - if (pInstance->GetData(TYPE_LYCEUM) == IN_PROGRESS) - pInstance->SetData(TYPE_LYCEUM, DONE); - else - pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS); - // If used brazier open linked doors (North or South) - if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N)) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_N), true); - else if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S)) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_S), true); + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_LYCEUM) == IN_PROGRESS) + pInstance->SetData(TYPE_LYCEUM, DONE); + else + pInstance->SetData(TYPE_LYCEUM, IN_PROGRESS); + // If used brazier open linked doors (North or South) + if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_N)) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_N), true); + else if (pGo->GetGUID() == pInstance->GetData64(DATA_SF_BRAZIER_S)) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GOLEM_DOOR_S), true); + } + return false; } - return false; -} + +}; /*###### ## npc_grimstone @@ -93,21 +99,27 @@ uint32 RingBoss[]= 9031, // Anub'shiah 9032, // Hedrum }; - -bool AreaTrigger_at_ring_of_law(Player* pPlayer, const AreaTriggerEntry * /*at*/) + class at_ring_of_law : public AreaTriggerScript { - if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) +public: + at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (pInstance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || pInstance->GetData(TYPE_RING_OF_LAW) == DONE) + if (InstanceScript* pInstance = pPlayer->GetInstanceScript()) + { + 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(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); + return false; - - pInstance->SetData(TYPE_RING_OF_LAW,IN_PROGRESS); - pPlayer->SummonCreature(NPC_GRIMSTONE,625.559,-205.618,-52.735,2.609,TEMPSUMMON_DEAD_DESPAWN,0); - + } return false; } - return false; -} + +}; /*###### ## npc_grimstone @@ -123,228 +135,235 @@ enum GrimstoneTexts SCRIPT_TEXT6 = -1000005 }; -//TODO: implement quest part of event (different end boss) -struct npc_grimstoneAI : public npc_escortAI +//TODO: implement quest part of event (different end boss) class npc_grimstone : public CreatureScript { - npc_grimstoneAI(Creature *c) : npc_escortAI(c) +public: + npc_grimstone() : CreatureScript("npc_grimstone") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - MobSpawnId = rand()%6; + return new npc_grimstoneAI(pCreature); } - ScriptedInstance* pInstance; - - uint8 EventPhase; - uint32 Event_Timer; - - uint8 MobSpawnId; - uint8 MobCount; - uint32 MobDeath_Timer; - - uint64 RingMobGUID[4]; - uint64 RingBossGUID; - - bool CanWalk; - - void Reset() + struct npc_grimstoneAI : public npc_escortAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - EventPhase = 0; - Event_Timer = 1000; - - MobCount = 0; - MobDeath_Timer = 0; - - for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) - RingMobGUID[i] = 0; - - RingBossGUID = 0; - - CanWalk = false; - } - - //TODO: move them to center - void SummonRingMob() - { - if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) - RingMobGUID[MobCount] = tmp->GetGUID(); - - ++MobCount; - - if (MobCount == MAX_MOB_AMOUNT) - MobDeath_Timer = 2500; - } - - //TODO: move them to center - void SummonRingBoss() - { - if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) - RingBossGUID = tmp->GetGUID(); - - MobDeath_Timer = 2500; - } - - void WaypointReached(uint32 i) - { - switch(i) + npc_grimstoneAI(Creature *c) : npc_escortAI(c) { - case 0: - DoScriptText(SCRIPT_TEXT1, me);//2 - CanWalk = false; - Event_Timer = 5000; - break; - case 1: - DoScriptText(SCRIPT_TEXT2, me);//4 - CanWalk = false; - Event_Timer = 5000; - break; - case 2: - CanWalk = false; - break; - case 3: - DoScriptText(SCRIPT_TEXT3, me);//5 - break; - case 4: - DoScriptText(SCRIPT_TEXT4, me);//6 - CanWalk = false; - Event_Timer = 5000; - break; - case 5: - if (pInstance) - { - pInstance->SetData(TYPE_RING_OF_LAW,DONE); - sLog.outDebug("TSCR: npc_grimstone: event reached end and set complete."); - } - break; + pInstance = c->GetInstanceScript(); + MobSpawnId = rand()%6; } - } - void HandleGameObject(uint32 id, bool open) - { - pInstance->HandleGameObject(pInstance->GetData64(id), open); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + uint8 EventPhase; + uint32 Event_Timer; - if (MobDeath_Timer) + uint8 MobSpawnId; + uint8 MobCount; + uint32 MobDeath_Timer; + + uint64 RingMobGUID[4]; + uint64 RingBossGUID; + + bool CanWalk; + + void Reset() { - if (MobDeath_Timer <= diff) - { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + EventPhase = 0; + Event_Timer = 1000; + + MobCount = 0; + MobDeath_Timer = 0; + + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + RingMobGUID[i] = 0; + + RingBossGUID = 0; + + CanWalk = false; + } + + //TODO: move them to center + void SummonRingMob() + { + if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0)) + RingMobGUID[MobCount] = tmp->GetGUID(); + + ++MobCount; + + if (MobCount == MAX_MOB_AMOUNT) MobDeath_Timer = 2500; + } - if (RingBossGUID) + //TODO: move them to center + void SummonRingBoss() + { + if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0)) + RingBossGUID = tmp->GetGUID(); + + MobDeath_Timer = 2500; + } + + void WaypointReached(uint32 i) + { + switch(i) + { + case 0: + DoScriptText(SCRIPT_TEXT1, me);//2 + CanWalk = false; + Event_Timer = 5000; + break; + case 1: + DoScriptText(SCRIPT_TEXT2, me);//4 + CanWalk = false; + Event_Timer = 5000; + break; + case 2: + CanWalk = false; + break; + case 3: + DoScriptText(SCRIPT_TEXT3, me);//5 + break; + case 4: + DoScriptText(SCRIPT_TEXT4, me);//6 + CanWalk = false; + Event_Timer = 5000; + break; + case 5: + if (pInstance) { - Creature *boss = Unit::GetCreature(*me,RingBossGUID); - if (boss && !boss->isAlive() && boss->isDead()) - { - RingBossGUID = 0; - Event_Timer = 5000; - MobDeath_Timer = 0; - return; - } - return; + pInstance->SetData(TYPE_RING_OF_LAW,DONE); + sLog.outDebug("TSCR: npc_grimstone: event reached end and set complete."); } + break; + } + } - for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + void HandleGameObject(uint32 id, bool open) + { + pInstance->HandleGameObject(pInstance->GetData64(id), open); + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (MobDeath_Timer) + { + if (MobDeath_Timer <= diff) { - Creature *mob = Unit::GetCreature(*me,RingMobGUID[i]); - if (mob && !mob->isAlive() && mob->isDead()) - { - RingMobGUID[i] = 0; - --MobCount; + MobDeath_Timer = 2500; - //seems all are gone, so set timer to continue and discontinue this - if (!MobCount) + if (RingBossGUID) + { + Creature *boss = Unit::GetCreature(*me,RingBossGUID); + if (boss && !boss->isAlive() && boss->isDead()) { + RingBossGUID = 0; Event_Timer = 5000; MobDeath_Timer = 0; + return; + } + return; + } + + for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i) + { + Creature *mob = Unit::GetCreature(*me,RingMobGUID[i]); + if (mob && !mob->isAlive() && mob->isDead()) + { + RingMobGUID[i] = 0; + --MobCount; + + //seems all are gone, so set timer to continue and discontinue this + if (!MobCount) + { + Event_Timer = 5000; + MobDeath_Timer = 0; + } } } - } - } else MobDeath_Timer -= diff; - } + } else MobDeath_Timer -= diff; + } - if (Event_Timer) - { - if (Event_Timer <= diff) + if (Event_Timer) { - switch(EventPhase) + if (Event_Timer <= diff) { - case 0: - DoScriptText(SCRIPT_TEXT5, me);//1 - HandleGameObject(DATA_ARENA4, false); - Start(false, false); - CanWalk = true; - Event_Timer = 0; - break; - case 1: - CanWalk = true; - Event_Timer = 0; - break; - case 2: - Event_Timer = 2000; - break; - case 3: - HandleGameObject(DATA_ARENA1, true); - Event_Timer = 3000; - break; - case 4: - CanWalk = true; - me->SetVisibility(VISIBILITY_OFF); - SummonRingMob(); - Event_Timer = 8000; - break; - case 5: - SummonRingMob(); - SummonRingMob(); - Event_Timer = 8000; - break; - case 6: - SummonRingMob(); - Event_Timer = 0; - break; - case 7: - me->SetVisibility(VISIBILITY_ON); - HandleGameObject(DATA_ARENA1, false); - DoScriptText(SCRIPT_TEXT6, me);//4 - CanWalk = true; - Event_Timer = 0; - break; - case 8: - HandleGameObject(DATA_ARENA2, true); - Event_Timer = 5000; - break; - case 9: - me->SetVisibility(VISIBILITY_OFF); - SummonRingBoss(); - Event_Timer = 0; - break; - case 10: - //if quest, complete - HandleGameObject(DATA_ARENA2, false); - HandleGameObject(DATA_ARENA3, true); - HandleGameObject(DATA_ARENA4, true); - CanWalk = true; - Event_Timer = 0; - break; - } - ++EventPhase; - } else Event_Timer -= diff; - } + switch(EventPhase) + { + case 0: + DoScriptText(SCRIPT_TEXT5, me);//1 + HandleGameObject(DATA_ARENA4, false); + Start(false, false); + CanWalk = true; + Event_Timer = 0; + break; + case 1: + CanWalk = true; + Event_Timer = 0; + break; + case 2: + Event_Timer = 2000; + break; + case 3: + HandleGameObject(DATA_ARENA1, true); + Event_Timer = 3000; + break; + case 4: + CanWalk = true; + me->SetVisibility(VISIBILITY_OFF); + SummonRingMob(); + Event_Timer = 8000; + break; + case 5: + SummonRingMob(); + SummonRingMob(); + Event_Timer = 8000; + break; + case 6: + SummonRingMob(); + Event_Timer = 0; + break; + case 7: + me->SetVisibility(VISIBILITY_ON); + HandleGameObject(DATA_ARENA1, false); + DoScriptText(SCRIPT_TEXT6, me);//4 + CanWalk = true; + Event_Timer = 0; + break; + case 8: + HandleGameObject(DATA_ARENA2, true); + Event_Timer = 5000; + break; + case 9: + me->SetVisibility(VISIBILITY_OFF); + SummonRingBoss(); + Event_Timer = 0; + break; + case 10: + //if quest, complete + HandleGameObject(DATA_ARENA2, false); + HandleGameObject(DATA_ARENA3, true); + HandleGameObject(DATA_ARENA4, true); + CanWalk = true; + Event_Timer = 0; + break; + } + ++EventPhase; + } else Event_Timer -= diff; + } + + if (CanWalk) + npc_escortAI::UpdateAI(diff); + } + }; - if (CanWalk) - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_grimstone(Creature* pCreature) -{ - return new npc_grimstoneAI(pCreature); -} /*###### ## mob_phalanx @@ -356,59 +375,66 @@ enum PhalanxSpells SPELL_FIREBALLVOLLEY = 22425, SPELL_MIGHTYBLOW = 14099 }; - -struct mob_phalanxAI : public ScriptedAI + class mob_phalanx : public CreatureScript { - mob_phalanxAI(Creature *c) : ScriptedAI(c) {} +public: + mob_phalanx() : CreatureScript("mob_phalanx") { } - uint32 ThunderClap_Timer; - uint32 FireballVolley_Timer; - uint32 MightyBlow_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ThunderClap_Timer = 12000; - FireballVolley_Timer =0; - MightyBlow_Timer = 15000; + return new mob_phalanxAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_phalanxAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + mob_phalanxAI(Creature *c) : ScriptedAI(c) {} - //ThunderClap_Timer - if (ThunderClap_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - ThunderClap_Timer = 10000; - } else ThunderClap_Timer -= diff; + uint32 ThunderClap_Timer; + uint32 FireballVolley_Timer; + uint32 MightyBlow_Timer; - //FireballVolley_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + void Reset() { - if (FireballVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); - FireballVolley_Timer = 15000; - } else FireballVolley_Timer -= diff; + ThunderClap_Timer = 12000; + FireballVolley_Timer =0; + MightyBlow_Timer = 15000; } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 10000; - } else MightyBlow_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //ThunderClap_Timer + if (ThunderClap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + ThunderClap_Timer = 10000; + } else ThunderClap_Timer -= diff; + + //FireballVolley_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + if (FireballVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); + FireballVolley_Timer = 15000; + } else FireballVolley_Timer -= diff; + } + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 10000; + } else MightyBlow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_phalanx(Creature* pCreature) -{ - return new mob_phalanxAI (pCreature); -} /*###### ## npc_kharan_mighthammer @@ -431,73 +457,80 @@ enum KharamQuests #define GOSSIP_ITEM_KHARAN_8 "Continue with your story please." #define GOSSIP_ITEM_KHARAN_9 "Indeed." #define GOSSIP_ITEM_KHARAN_10 "The door is open, Kharan. You are a free man." - -bool GossipHello_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature) + class npc_kharan_mighthammer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_kharan_mighthammer() : CreatureScript("npc_kharan_mighthammer") { } - if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - if (pPlayer->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - - if (pPlayer->GetTeam() == HORDE) - pPlayer->SEND_GOSSIP_MENU(2473, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2474, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_kharan_mighthammer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(2475, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(2476, pCreature->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(2475, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(2476, pCreature->GetGUID()); + break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(2477, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(2478, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(2479, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - pPlayer->SEND_GOSSIP_MENU(2480, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); - pPlayer->SEND_GOSSIP_MENU(2481, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+8: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - pPlayer->SEND_GOSSIP_MENU(2482, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+9: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->GetTeam() == HORDE) - pPlayer->AreaExploredOrEventHappens(QUEST_4001); - else - pPlayer->AreaExploredOrEventHappens(QUEST_4342); - break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(2477, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(2478, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(2479, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->SEND_GOSSIP_MENU(2480, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8); + pPlayer->SEND_GOSSIP_MENU(2481, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+8: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); + pPlayer->SEND_GOSSIP_MENU(2482, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+9: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->GetTeam() == HORDE) + pPlayer->AreaExploredOrEventHappens(QUEST_4001); + else + pPlayer->AreaExploredOrEventHappens(QUEST_4342); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_4001) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + if (pPlayer->GetQuestStatus(4342) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KHARAN_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + + if (pPlayer->GetTeam() == HORDE) + pPlayer->SEND_GOSSIP_MENU(2473, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2474, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_lokhtos_darkbargainer @@ -521,42 +554,49 @@ enum LokhtosSpells #define GOSSIP_ITEM_SHOW_ACCESS "Show me what I have access to, Lothos." #define GOSSIP_ITEM_GET_CONTRACT "Get Thorium Brotherhood Contract" - -bool GossipHello_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature) + class npc_lokhtos_darkbargainer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lokhtos_darkbargainer() : CreatureScript("npc_lokhtos_darkbargainer") { } - if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && - !pPlayer->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && - pPlayer->HasItemCount(ITEM_SULFURON_INGOT, 1)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); + } + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - if (pPlayer->GetReputationRank(59) < REP_FRIENDLY) - pPlayer->SEND_GOSSIP_MENU(3673, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(3677, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lokhtos_darkbargainer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_CREATE_THORIUM_BROTHERHOOD_CONTRACT_DND, false); - } - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetReputationRank(59) >= REP_FRIENDLY) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (pPlayer->GetQuestRewardStatus(QUEST_A_BINDING_CONTRACT) != 1 && + !pPlayer->HasItemCount(ITEM_THRORIUM_BROTHERHOOD_CONTRACT, 1, true) && + pPlayer->HasItemCount(ITEM_SULFURON_INGOT, 1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GET_CONTRACT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + } + + if (pPlayer->GetReputationRank(59) < REP_FRIENDLY) + pPlayer->SEND_GOSSIP_MENU(3673, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(3677, pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_dughal_stormwing @@ -570,89 +610,98 @@ enum DughalQuests #define SAY_DUGHAL_FREE "Thank you, $N! I'm free!!!" #define GOSSIP_DUGHAL "You're free, Dughal! Get out of here!" -/* -struct npc_dughal_stormwingAI : public npc_escortAI +/* class npc_dughal_stormwing : public CreatureScript { - npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) {} +public: + npc_dughal_stormwing() : CreatureScript("npc_dughal_stormwing") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { - switch(i) - { - case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); - break; - } + npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature); + + dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); + dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); + dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); + + return dughal_stormwingAI; } - void EnterCombat(Unit* who) {} - void Reset() {} - - void JustDied(Unit* killer) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - if (IsBeingEscorted && killer == me) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); } + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED) + if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2846, pCreature->GetGUID()); } - else - { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + return true; } + + struct npc_dughal_stormwingAI : public npc_escortAI + { + npc_dughal_stormwingAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + switch(i) + { + case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + break; + } + } + + void EnterCombat(Unit* who) {} + void Reset() {} + + void JustDied(Unit* killer) + { + if (IsBeingEscorted && killer == me) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED); + } + } + + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_dughal_stormwing(Creature* pCreature) -{ - npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature); - dughal_stormwingAI->AddWaypoint(0, 280.42,-82.86, -77.12,0); - dughal_stormwingAI->AddWaypoint(1, 287.64,-87.01, -76.79,0); - dughal_stormwingAI->AddWaypoint(2, 354.63,-64.95, -67.53,0); - - return dughal_stormwingAI; -} -bool GossipHello_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2846, pCreature->GetGUID()); - } - return true; -} - -bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); - } - return true; -} */ /*###### ## npc_marshal_windsor @@ -670,148 +719,156 @@ bool GossipSelect_npc_dughal_stormwing(Player* pPlayer, Creature* pCreature, uin #define MOB_ENTRY_REGINALD_WINDSOR 9682 Player* pPlayerStart; -/* -struct npc_marshal_windsorAI : public npc_escortAI +/* class npc_marshal_windsor : public CreatureScript { - npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) +public: + npc_marshal_windsor() : CreatureScript("npc_marshal_windsor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature); + + marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); + marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); + marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); + marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); + marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); + marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); + marshal_windsorAI->AddWaypoint(6, 296.18,-94.30, -74.08,0); + marshal_windsorAI->AddWaypoint(7, 294.57,-93.11, -74.08,0); + marshal_windsorAI->AddWaypoint(8, 314.31,-74.31, -76.09,0); + marshal_windsorAI->AddWaypoint(9, 360.22,-62.93, -66.77,0); + marshal_windsorAI->AddWaypoint(10, 383.38,-69.40, -63.25,0); + marshal_windsorAI->AddWaypoint(11, 389.99,-67.86, -62.57,0); + marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); + marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); + marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); + marshal_windsorAI->AddWaypoint(15, 407.65,-51.86, -63.96,0); + marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); + marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); + marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); + marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); + + return marshal_windsorAI; } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { - switch(i) - { - case 1: - me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 10: - me->setFaction(534); - break; - case 12: - me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); - break; - case 13: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 14: - pInstance->SetData(DATA_GATE_SR,0); - me->setFaction(11); - break; - case 16: - me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); - break; - case 17: - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK - break; - case 18: - pInstance->SetData(DATA_GATE_SC,0); - break; - case 19: - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); - pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); - break; - } - } - - void EnterCombat(Unit* who) - { - switch (urand(0,2)) - { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; - } - } - - void Reset() {} - - void JustDied(Unit *slayer) - { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); - } - - void UpdateAI(const uint32 diff) - { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) - SetEscortPaused(false); - if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED) + if (quest->GetQuestId() == 4322) + {PlayerStart = player; + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) { - me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); + pCreature->setFaction(11); } - if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) - { - me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + } - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED) - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - else - { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + return false; } + + struct npc_marshal_windsorAI : public npc_escortAI + { + npc_marshal_windsorAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + } + + void WaypointReached(uint32 i) + { + switch(i) + { + case 1: + me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 10: + me->setFaction(534); + break; + case 12: + me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS); + break; + case 13: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 14: + pInstance->SetData(DATA_GATE_SR,0); + me->setFaction(11); + break; + case 16: + me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID); + break; + case 17: + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK + break; + case 18: + pInstance->SetData(DATA_GATE_SC,0); + break; + case 19: + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0); + pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED); + break; + } + } + + void EnterCombat(Unit* who) + { + switch (urand(0,2)) + { + case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; + case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; + case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; + } + } + + void Reset() {} + + void JustDied(Unit *slayer) + { + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); + } + + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + SetEscortPaused(false); + if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED) + { + me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START); + } + if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) + { + me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED); + } + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_marshal_windsor(Creature* pCreature) -{ - npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature); - marshal_windsorAI->AddWaypoint(0, 316.336,-225.528, -77.7258,7000); - marshal_windsorAI->AddWaypoint(1, 316.336,-225.528, -77.7258,2000); - marshal_windsorAI->AddWaypoint(2, 322.96,-207.13, -77.87,0); - marshal_windsorAI->AddWaypoint(3, 281.05,-172.16, -75.12,0); - marshal_windsorAI->AddWaypoint(4, 272.19,-139.14, -70.61,0); - marshal_windsorAI->AddWaypoint(5, 283.62,-116.09, -70.21,0); - marshal_windsorAI->AddWaypoint(6, 296.18,-94.30, -74.08,0); - marshal_windsorAI->AddWaypoint(7, 294.57,-93.11, -74.08,0); - marshal_windsorAI->AddWaypoint(8, 314.31,-74.31, -76.09,0); - marshal_windsorAI->AddWaypoint(9, 360.22,-62.93, -66.77,0); - marshal_windsorAI->AddWaypoint(10, 383.38,-69.40, -63.25,0); - marshal_windsorAI->AddWaypoint(11, 389.99,-67.86, -62.57,0); - marshal_windsorAI->AddWaypoint(12, 400.98,-72.01, -62.31,0); - marshal_windsorAI->AddWaypoint(13, 404.22,-62.30, -63.50,2300); - marshal_windsorAI->AddWaypoint(14, 404.22,-62.30, -63.50,1500); - marshal_windsorAI->AddWaypoint(15, 407.65,-51.86, -63.96,0); - marshal_windsorAI->AddWaypoint(16, 403.61,-51.71, -63.92,1000); - marshal_windsorAI->AddWaypoint(17, 403.61,-51.71, -63.92,2000); - marshal_windsorAI->AddWaypoint(18, 403.61,-51.71, -63.92,1000); - marshal_windsorAI->AddWaypoint(19, 403.61,-51.71, -63.92,0); - - return marshal_windsorAI; -} - -bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - if (quest->GetQuestId() == 4322) - {PlayerStart = player; - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_IN_PROGRESS); - pCreature->setFaction(11); - } - - } - return false; -} */ /*###### ## npc_marshal_reginald_windsor @@ -835,289 +892,305 @@ bool QuestAccept_npc_marshal_windsor(Player* pPlayer, Creature* pCreature, Quest #define MOB_ENTRY_CREST_KILLER 9680 int wp = 0; -/* -struct npc_marshal_reginald_windsorAI : public npc_escortAI +/* class npc_marshal_reginald_windsor : public CreatureScript { - npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) +public: + npc_marshal_reginald_windsor() : CreatureScript("npc_marshal_reginald_windsor") { } + + CreatureAI* GetAI(Creature* pCreature) const { + npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature); + + marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); + marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); + marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); + marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); + marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); + marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); + marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); + marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); + marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); + marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); + marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); + marshal_reginald_windsorAI->AddWaypoint(12, 635.06,-153.25, -70.32,3000); + marshal_reginald_windsorAI->AddWaypoint(13, 635.06,-153.25, -70.32,1500); + marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); + marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); + marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); + marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); + marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); + marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); + marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); + marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); + marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); + marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); + marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); + marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); + marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); + marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); + marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); + marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); + marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); + marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); + marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); + marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); + + return marshal_reginald_windsorAI; } - void WaypointReached(uint32 i) + struct npc_marshal_reginald_windsorAI : public npc_escortAI { - wp=i; - switch(i) + npc_marshal_reginald_windsorAI(Creature *c) : npc_escortAI(c) { - case 0: - me->setFaction(11); - me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 1: - me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 7: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 8: - me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 11: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 12: - me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 13: - me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 20: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 21: - me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); - break; - case 23: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); - IsOnHold=true; - break; - case 24: - me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); - break; - case 31: - me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); - break; - case 32: - me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); - PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); - pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); - break; } - } - void MoveInLineOfSight(Unit *who) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; - - if (who->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE) + wp=i; + switch(i) { - float Radius = 10.0; - if (me->IsWithinDistInMap(who, Radius)) + case 0: + me->setFaction(11); + me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 1: + me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 7: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 8: + me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 11: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 12: + me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 13: + me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 20: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 21: + me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID); + break; + case 23: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID); + IsOnHold=true; + break; + case 24: + me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID); + break; + case 31: + me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID); + break; + case 32: + me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID); + PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me); + pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED); + break; + } + } + + void MoveInLineOfSight(Unit *who) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE) { - SetEscortPaused(false); - Start(true, false, who->GetGUID()); + float Radius = 10.0; + if (me->IsWithinDistInMap(who, Radius)) + { + SetEscortPaused(false); + Start(true, false, who->GetGUID()); + } } } } - } - void EnterCombat(Unit* who) + void EnterCombat(Unit* who) + { + switch (urand(0,2)) + { + case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; + case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; + case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; + } + } + void Reset() {} + + void JustDied(Unit *slayer) { - switch (urand(0,2)) + pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); + } + + void UpdateAI(const uint32 diff) { - case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break; - case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break; - case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break; + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if (wp == 7) + { + if (!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_JAZ,1); + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS) + { + SetEscortPaused(false); + pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); + } + } + else if (wp == 11) + { + if (!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_SHILL,1); + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS) + { + pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); + SetEscortPaused(false); + } + } + else if (wp == 20) + { + if (!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) + { + pInstance->SetData(DATA_CREATURE_CREST,1); + me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); + } + if (pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS) + { + SetEscortPaused(false); + pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); + } + } + if (pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); + npc_escortAI::UpdateAI(diff); } - } - void Reset() {} + }; - void JustDied(Unit *slayer) - { - pInstance->SetData(DATA_QUEST_JAIL_BREAK,ENCOUNTER_STATE_FAILED); - } - - void UpdateAI(const uint32 diff) - { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if (wp == 7) - { - if (!pInstance->GetData(DATA_GATE_J) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_JAZ,1); - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_IN_PROGRESS); - } - if (pInstance->GetData(DATA_CREATURE_JAZ) && pInstance->GetData(DATA_CREATURE_OGRABISI) && pInstance->GetData(DATA_JAZ) == ENCOUNTER_STATE_IN_PROGRESS) - { - SetEscortPaused(false); - pInstance->SetData(DATA_JAZ,ENCOUNTER_STATE_ENDED); - } - } - else if (wp == 11) - { - if (!pInstance->GetData(DATA_GATE_S) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_SHILL,1); - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_IN_PROGRESS); - } - if (pInstance->GetData(DATA_CREATURE_SHILL) && pInstance->GetData(DATA_SHILL) == ENCOUNTER_STATE_IN_PROGRESS) - { - pInstance->SetData(DATA_SHILL,ENCOUNTER_STATE_ENDED); - SetEscortPaused(false); - } - } - else if (wp == 20) - { - if (!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED) - { - pInstance->SetData(DATA_CREATURE_CREST,1); - me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID); - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS); - } - if (pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS) - { - SetEscortPaused(false); - pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_ENDED); - } - } - if (pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED) SetEscortPaused(false); - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature* pCreature) -{ - npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature); - - marshal_reginald_windsorAI->AddWaypoint(0, 403.61,-52.71, -63.92,4000); - marshal_reginald_windsorAI->AddWaypoint(1, 403.61,-52.71, -63.92,4000); - marshal_reginald_windsorAI->AddWaypoint(2, 406.33,-54.87, -63.95,0); - marshal_reginald_windsorAI->AddWaypoint(3, 407.99,-73.91, -62.26,0); - marshal_reginald_windsorAI->AddWaypoint(4, 557.03,-119.71, -61.83,0); - marshal_reginald_windsorAI->AddWaypoint(5, 573.40,-124.39, -65.07,0); - marshal_reginald_windsorAI->AddWaypoint(6, 593.91,-130.29, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(7, 593.21,-132.16, -69.25,0); - marshal_reginald_windsorAI->AddWaypoint(8, 593.21,-132.16, -69.25,3000); - marshal_reginald_windsorAI->AddWaypoint(9, 622.81,-135.55, -71.92,0); - marshal_reginald_windsorAI->AddWaypoint(10, 634.68,-151.29, -70.32,0); - marshal_reginald_windsorAI->AddWaypoint(11, 635.06,-153.25, -70.32,0); - marshal_reginald_windsorAI->AddWaypoint(12, 635.06,-153.25, -70.32,3000); - marshal_reginald_windsorAI->AddWaypoint(13, 635.06,-153.25, -70.32,1500); - marshal_reginald_windsorAI->AddWaypoint(14, 655.25,-172.39, -73.72,0); - marshal_reginald_windsorAI->AddWaypoint(15, 654.79,-226.30, -83.06,0); - marshal_reginald_windsorAI->AddWaypoint(16, 622.85,-268.85, -83.96,0); - marshal_reginald_windsorAI->AddWaypoint(17, 579.45,-275.56, -80.44,0); - marshal_reginald_windsorAI->AddWaypoint(18, 561.19,-266.85, -75.59,0); - marshal_reginald_windsorAI->AddWaypoint(19, 547.91,-253.92, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(20, 549.20,-252.40, -70.34,0); - marshal_reginald_windsorAI->AddWaypoint(21, 549.20,-252.40, -70.34,4000); - marshal_reginald_windsorAI->AddWaypoint(22, 555.33,-269.16, -74.40,0); - marshal_reginald_windsorAI->AddWaypoint(23, 554.31,-270.88, -74.40,0); - marshal_reginald_windsorAI->AddWaypoint(24, 554.31,-270.88, -74.40,4000); - marshal_reginald_windsorAI->AddWaypoint(25, 536.10,-249.60, -67.47,0); - marshal_reginald_windsorAI->AddWaypoint(26, 520.94,-216.65, -59.28,0); - marshal_reginald_windsorAI->AddWaypoint(27, 505.99,-148.74, -62.17,0); - marshal_reginald_windsorAI->AddWaypoint(28, 484.21,-56.24, -62.43,0); - marshal_reginald_windsorAI->AddWaypoint(29, 470.39,-6.01, -70.10,0); - marshal_reginald_windsorAI->AddWaypoint(30, 451.27,30.85, -70.07,0); - marshal_reginald_windsorAI->AddWaypoint(31, 452.45,29.85, -70.37,1500); - marshal_reginald_windsorAI->AddWaypoint(32, 452.45,29.85, -70.37,7000); - marshal_reginald_windsorAI->AddWaypoint(33, 452.45,29.85, -70.37,10000); - marshal_reginald_windsorAI->AddWaypoint(34, 451.27,31.85, -70.07,0); - - return marshal_reginald_windsorAI; -} */ /*###### ## npc_tobias_seecher ######*/ #define SAY_TOBIAS_FREE "Thank you! I will run for safety immediately!" -/* -struct npc_tobias_seecherAI : public npc_escortAI +/* class npc_tobias_seecher : public CreatureScript { - npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} +public: + npc_tobias_seecher() : CreatureScript("npc_tobias_seecher") { } - void EnterCombat(Unit* who) {} - void Reset() {} - - void JustDied(Unit* killer) + CreatureAI* GetAI(Creature* pCreature) const { - if (IsBeingEscorted && killer == me) - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); - } + npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature); + + tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); + tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); + tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); + tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); + tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); + + return tobias_seecherAI; } - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - switch(i) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; - case 2: - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; - case 4: - me->SetVisibility(VISIBILITY_OFF); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_escort::npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); } + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; - if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED) + if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2847, pCreature->GetGUID()); } - else - { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - npc_escortAI::UpdateAI(diff); + return true; } + + struct npc_tobias_seecherAI : public npc_escortAI + { + npc_tobias_seecherAI(Creature *c) :npc_escortAI(c) {} + + void EnterCombat(Unit* who) {} + void Reset() {} + + void JustDied(Unit* killer) + { + if (IsBeingEscorted && killer == me) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + } + } + + void WaypointReached(uint32 i) + { + switch(i) + { + case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break; + case 2: + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break; + case 4: + me->SetVisibility(VISIBILITY_OFF); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return; + if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + else + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_tobias_seecher(Creature* pCreature) -{ - npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature); - tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27); - tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68); - tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04); - tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34); - tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34); - return tobias_seecherAI; -} - -bool GossipHello_npc_tobias_seecher(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Get out of here, Tobias, you're free!", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2847, pCreature->GetGUID()); - } - return true; -} - -bool GossipSelect_npc_tobias_seecher(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, true, pPlayer->GetGUID()); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_IN_PROGRESS); - } - return true; -} */ /*###### @@ -1138,201 +1211,154 @@ enum RocknotQuests { QUEST_ALE = 4295 }; - -struct npc_rocknotAI : public npc_escortAI + class npc_rocknot : public CreatureScript { - npc_rocknotAI(Creature *c) : npc_escortAI(c) +public: + npc_rocknot() : CreatureScript("npc_rocknot") { } + + bool ChooseReward(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*item*/) { - pInstance = c->GetInstanceData(); - } + InstanceScript* pInstance = pCreature->GetInstanceScript(); - ScriptedInstance* pInstance; - - uint32 BreakKeg_Timer; - uint32 BreakDoor_Timer; - - void Reset() - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; - - BreakKeg_Timer = 0; - BreakDoor_Timer = 0; - } - - void DoGo(uint32 id, uint32 state) - { - if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(id))) - pGo->SetGoState((GOState)state); - } - - void WaypointReached(uint32 i) - { if (!pInstance) - return; + return true; - switch(i) + if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) + return true; + + if (_Quest->GetQuestId() == QUEST_ALE) { - case 1: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 2: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 3: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - break; - case 4: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - break; - case 5: - me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - BreakKeg_Timer = 2000; - break; + if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) + pInstance->SetData(TYPE_BAR,IN_PROGRESS); + + pInstance->SetData(TYPE_BAR,SPECIAL); + + //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress + if (pInstance->GetData(TYPE_BAR) == SPECIAL) + { + DoScriptText(SAY_GOT_BEER, pCreature); + pCreature->CastSpell(pCreature,SPELL_DRUNKEN_RAGE,false); + if (npc_escortAI* pEscortAI = CAST_AI(npc_rocknot::npc_rocknotAI, pCreature->AI())) + pEscortAI->Start(false, false); + } } + + return true; } - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (!pInstance) - return; - - if (BreakKeg_Timer) - { - if (BreakKeg_Timer <= diff) - { - DoGo(DATA_GO_BAR_KEG,0); - BreakKeg_Timer = 0; - BreakDoor_Timer = 1000; - } else BreakKeg_Timer -= diff; - } - - if (BreakDoor_Timer) - { - if (BreakDoor_Timer <= diff) - { - DoGo(DATA_GO_BAR_DOOR,2); - DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future - //spell by trap has effect61, this indicate the bar go hostile - - if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX))) - tmp->setFaction(14); - - //for later, this event(s) has alot more to it. - //optionally, DONE can trigger bar to go hostile. - pInstance->SetData(TYPE_BAR,DONE); - - BreakDoor_Timer = 0; - } else BreakDoor_Timer -= diff; - } - - npc_escortAI::UpdateAI(diff); + return new npc_rocknotAI(pCreature); } + + struct npc_rocknotAI : public npc_escortAI + { + npc_rocknotAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 BreakKeg_Timer; + uint32 BreakDoor_Timer; + + void Reset() + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + BreakKeg_Timer = 0; + BreakDoor_Timer = 0; + } + + void DoGo(uint32 id, uint32 state) + { + if (GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(id))) + pGo->SetGoState((GOState)state); + } + + void WaypointReached(uint32 i) + { + if (!pInstance) + return; + + switch(i) + { + case 1: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 2: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 3: + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + break; + case 4: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + break; + case 5: + me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + BreakKeg_Timer = 2000; + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (BreakKeg_Timer) + { + if (BreakKeg_Timer <= diff) + { + DoGo(DATA_GO_BAR_KEG,0); + BreakKeg_Timer = 0; + BreakDoor_Timer = 1000; + } else BreakKeg_Timer -= diff; + } + + if (BreakDoor_Timer) + { + if (BreakDoor_Timer <= diff) + { + DoGo(DATA_GO_BAR_DOOR,2); + DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future + //spell by trap has effect61, this indicate the bar go hostile + + if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX))) + tmp->setFaction(14); + + //for later, this event(s) has alot more to it. + //optionally, DONE can trigger bar to go hostile. + pInstance->SetData(TYPE_BAR,DONE); + + BreakDoor_Timer = 0; + } else BreakDoor_Timer -= diff; + } + + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_rocknot(Creature* pCreature) -{ - return new npc_rocknotAI(pCreature); -} - -bool ChooseReward_npc_rocknot(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*item*/) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - - if (!pInstance) - return true; - - if (pInstance->GetData(TYPE_BAR) == DONE || pInstance->GetData(TYPE_BAR) == SPECIAL) - return true; - - if (_Quest->GetQuestId() == QUEST_ALE) - { - if (pInstance->GetData(TYPE_BAR) != IN_PROGRESS) - pInstance->SetData(TYPE_BAR,IN_PROGRESS); - - pInstance->SetData(TYPE_BAR,SPECIAL); - - //keep track of amount in instance script, returns SPECIAL if amount ok and event in progress - if (pInstance->GetData(TYPE_BAR) == SPECIAL) - { - DoScriptText(SAY_GOT_BEER, pCreature); - pCreature->CastSpell(pCreature,SPELL_DRUNKEN_RAGE,false); - if (npc_escortAI* pEscortAI = CAST_AI(npc_rocknotAI, pCreature->AI())) - pEscortAI->Start(false, false); - } - } - - return true; -} - /*###### ## ######*/ 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; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_grimstone"; - newscript->GetAI = &GetAI_npc_grimstone; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_phalanx"; - newscript->GetAI = &GetAI_mob_phalanx; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kharan_mighthammer"; - newscript->pGossipHello = &GossipHello_npc_kharan_mighthammer; - newscript->pGossipSelect = &GossipSelect_npc_kharan_mighthammer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lokhtos_darkbargainer"; - newscript->pGossipHello = &GossipHello_npc_lokhtos_darkbargainer; - newscript->pGossipSelect = &GossipSelect_npc_lokhtos_darkbargainer; - newscript->RegisterSelf(); -/* - newscript = new Script; - newscript->Name = "npc_dughal_stormwing"; - newscript->pGossipHello = &GossipHello_npc_dughal_stormwing; - newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing; - newscript->GetAI = &GetAI_npc_dughal_stormwing; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tobias_seecher"; - newscript->pGossipHello = &GossipHello_npc_tobias_seecher; - newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher; - newscript->GetAI = &GetAI_npc_tobias_seecher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marshal_windsor"; - newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor; - newscript->GetAI = &GetAI_npc_marshal_windsor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marshal_reginald_windsor"; - newscript->GetAI = &GetAI_npc_marshal_reginald_windsor; - newscript->RegisterSelf(); -*/ - newscript = new Script; - newscript->Name = "npc_rocknot"; - newscript->GetAI = &GetAI_npc_rocknot; - newscript->pChooseReward = &ChooseReward_npc_rocknot; - newscript->RegisterSelf(); + new go_shadowforge_brazier(); + new at_ring_of_law(); + new npc_grimstone(); + new mob_phalanx(); + new npc_kharan_mighthammer(); + new npc_lokhtos_darkbargainer(); + new npc_dughal_stormwing(); + new npc_tobias_seecher(); + new npc_marshal_windsor(); + new npc_marshal_reginald_windsor(); + new npc_rocknot(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp index df77770a410..70a9e3b1ef3 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_ambassador_flamelash.cpp @@ -29,65 +29,68 @@ enum Spells { SPELL_FIREBLAST = 15573 }; - -struct boss_ambassador_flamelashAI : public ScriptedAI + class boss_ambassador_flamelash : public CreatureScript { - boss_ambassador_flamelashAI(Creature *c) : ScriptedAI(c) {} +public: + boss_ambassador_flamelash() : CreatureScript("boss_ambassador_flamelash") { } - uint32 FireBlast_Timer; - uint32 Spirit_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireBlast_Timer = 2000; - Spirit_Timer = 24000; + return new boss_ambassador_flamelashAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void SummonSpirits(Unit* victim) + struct boss_ambassador_flamelashAI : public ScriptedAI { - if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Spirit->AI()->AttackStart(victim); - } + boss_ambassador_flamelashAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FireBlast_Timer; + uint32 Spirit_Timer; - //FireBlast_Timer - if (FireBlast_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FIREBLAST); - FireBlast_Timer = 7000; - } else FireBlast_Timer -= diff; + FireBlast_Timer = 2000; + Spirit_Timer = 24000; + } - //Spirit_Timer - if (Spirit_Timer <= diff) + void EnterCombat(Unit * /*who*/) {} + + void SummonSpirits(Unit* victim) { - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); - SummonSpirits(me->getVictim()); + if (Creature *Spirit = DoSpawnCreature(9178, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + Spirit->AI()->AttackStart(victim); + } - Spirit_Timer = 30000; - } else Spirit_Timer -= diff; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //FireBlast_Timer + if (FireBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBLAST); + FireBlast_Timer = 7000; + } else FireBlast_Timer -= diff; + + //Spirit_Timer + if (Spirit_Timer <= diff) + { + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + SummonSpirits(me->getVictim()); + + Spirit_Timer = 30000; + } else Spirit_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ambassador_flamelash(Creature* pCreature) -{ - return new boss_ambassador_flamelashAI (pCreature); -} void AddSC_boss_ambassador_flamelash() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ambassador_flamelash"; - newscript->GetAI = &GetAI_boss_ambassador_flamelash; - newscript->RegisterSelf(); + new boss_ambassador_flamelash(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp index e8277d9e931..b3aabeee20d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_anubshiah.cpp @@ -33,86 +33,89 @@ enum Spells SPELL_DEMONARMOR = 11735, SPELL_ENVELOPINGWEB = 15471 }; - -struct boss_anubshiahAI : public ScriptedAI + class boss_anubshiah : public CreatureScript { - boss_anubshiahAI(Creature *c) : ScriptedAI(c) {} +public: + boss_anubshiah() : CreatureScript("boss_anubshiah") { } - uint32 ShadowBolt_Timer; - uint32 CurseOfTongues_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - uint32 EnvelopingWeb_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowBolt_Timer = 7000; - CurseOfTongues_Timer = 24000; - CurseOfWeakness_Timer = 12000; - DemonArmor_Timer = 3000; - EnvelopingWeb_Timer = 16000; + return new boss_anubshiahAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_anubshiahAI : public ScriptedAI { - } + boss_anubshiahAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowBolt_Timer; + uint32 CurseOfTongues_Timer; + uint32 CurseOfWeakness_Timer; + uint32 DemonArmor_Timer; + uint32 EnvelopingWeb_Timer; - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWBOLT); ShadowBolt_Timer = 7000; - } else ShadowBolt_Timer -= diff; + CurseOfTongues_Timer = 24000; + CurseOfWeakness_Timer = 12000; + DemonArmor_Timer = 3000; + EnvelopingWeb_Timer = 16000; + } - //CurseOfTongues_Timer - if (CurseOfTongues_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CURSEOFTONGUES); - CurseOfTongues_Timer = 18000; - } else CurseOfTongues_Timer -= diff; + } - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) - { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 7000; + } else ShadowBolt_Timer -= diff; - //EnvelopingWeb_Timer - if (EnvelopingWeb_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_ENVELOPINGWEB); - EnvelopingWeb_Timer = 12000; - } else EnvelopingWeb_Timer -= diff; + //CurseOfTongues_Timer + if (CurseOfTongues_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CURSEOFTONGUES); + CurseOfTongues_Timer = 18000; + } else CurseOfTongues_Timer -= diff; + + //CurseOfWeakness_Timer + if (CurseOfWeakness_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + CurseOfWeakness_Timer = 45000; + } else CurseOfWeakness_Timer -= diff; + + //DemonArmor_Timer + if (DemonArmor_Timer <= diff) + { + DoCast(me, SPELL_DEMONARMOR); + DemonArmor_Timer = 300000; + } else DemonArmor_Timer -= diff; + + //EnvelopingWeb_Timer + if (EnvelopingWeb_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_ENVELOPINGWEB); + EnvelopingWeb_Timer = 12000; + } else EnvelopingWeb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anubshiah(Creature* pCreature) -{ - return new boss_anubshiahAI (pCreature); -} void AddSC_boss_anubshiah() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anubshiah"; - newscript->GetAI = &GetAI_boss_anubshiah; - newscript->RegisterSelf(); + new boss_anubshiah(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp index d177e3c97ac..83722d057bd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_emperor_dagran_thaurissan.cpp @@ -36,78 +36,81 @@ enum Spells SPELL_HANDOFTHAURISSAN = 17492, SPELL_AVATAROFFLAME = 15636 }; - -struct boss_draganthaurissanAI : public ScriptedAI + class boss_emperor_dagran_thaurissan : public CreatureScript { - boss_draganthaurissanAI(Creature *c) : ScriptedAI(c) {} +public: + boss_emperor_dagran_thaurissan() : CreatureScript("boss_emperor_dagran_thaurissan") { } - uint32 HandOfThaurissan_Timer; - uint32 AvatarOfFlame_Timer; - //uint32 Counter; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HandOfThaurissan_Timer = 4000; - AvatarOfFlame_Timer = 25000; - //Counter= 0; + return new boss_draganthaurissanAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_draganthaurissanAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - me->CallForHelp(VISIBLE_RANGE); - } + boss_draganthaurissanAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + uint32 HandOfThaurissan_Timer; + uint32 AvatarOfFlame_Timer; + //uint32 Counter; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (HandOfThaurissan_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_HANDOFTHAURISSAN); + HandOfThaurissan_Timer = 4000; + AvatarOfFlame_Timer = 25000; + //Counter= 0; + } - //3 Hands of Thaurissan will be casted - //if (Counter < 3) - //{ - // HandOfThaurissan_Timer = 1000; - // ++Counter; - //} - //else - //{ - HandOfThaurissan_Timer = 5000; - //Counter = 0; - //} - } else HandOfThaurissan_Timer -= diff; - - //AvatarOfFlame_Timer - if (AvatarOfFlame_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_AVATAROFFLAME); - AvatarOfFlame_Timer = 18000; - } else AvatarOfFlame_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + me->CallForHelp(VISIBLE_RANGE); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (HandOfThaurissan_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_HANDOFTHAURISSAN); + + //3 Hands of Thaurissan will be casted + //if (Counter < 3) + //{ + // HandOfThaurissan_Timer = 1000; + // ++Counter; + //} + //else + //{ + HandOfThaurissan_Timer = 5000; + //Counter = 0; + //} + } else HandOfThaurissan_Timer -= diff; + + //AvatarOfFlame_Timer + if (AvatarOfFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AVATAROFFLAME); + AvatarOfFlame_Timer = 18000; + } else AvatarOfFlame_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_draganthaurissan(Creature* pCreature) -{ - return new boss_draganthaurissanAI (pCreature); -} void AddSC_boss_draganthaurissan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_emperor_dagran_thaurissan"; - newscript->GetAI = &GetAI_boss_draganthaurissan; - newscript->RegisterSelf(); + new boss_emperor_dagran_thaurissan(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp index 0c50893633b..407bf26b005 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_general_angerforge.cpp @@ -31,104 +31,107 @@ enum Spells SPELL_HAMSTRING = 9080, SPELL_CLEAVE = 20691 }; - -struct boss_general_angerforgeAI : public ScriptedAI + class boss_general_angerforge : public CreatureScript { - boss_general_angerforgeAI(Creature *c) : ScriptedAI(c) {} +public: + boss_general_angerforge() : CreatureScript("boss_general_angerforge") { } - uint32 MightyBlow_Timer; - uint32 HamString_Timer; - uint32 Cleave_Timer; - uint32 Adds_Timer; - bool Medics; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MightyBlow_Timer = 8000; - HamString_Timer = 12000; - Cleave_Timer = 16000; - Adds_Timer = 0; - Medics = false; + return new boss_general_angerforgeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_general_angerforgeAI : public ScriptedAI { - } + boss_general_angerforgeAI(Creature *c) : ScriptedAI(c) {} - void SummonAdds(Unit* victim) - { - if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedAdd->AI()->AttackStart(victim); - } + uint32 MightyBlow_Timer; + uint32 HamString_Timer; + uint32 Cleave_Timer; + uint32 Adds_Timer; + bool Medics; - void SummonMedics(Unit* victim) - { - if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMedic->AI()->AttackStart(victim); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 18000; - } else MightyBlow_Timer -= diff; + MightyBlow_Timer = 8000; + HamString_Timer = 12000; + Cleave_Timer = 16000; + Adds_Timer = 0; + Medics = false; + } - //HamString_Timer - if (HamString_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamString_Timer = 15000; - } else HamString_Timer -= diff; + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void SummonAdds(Unit* victim) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 9000; - } else Cleave_Timer -= diff; + if (Creature *SummonedAdd = DoSpawnCreature(8901, irand(-14,14), irand(-14,14), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedAdd->AI()->AttackStart(victim); + } - //Adds_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 21) + void SummonMedics(Unit* victim) { - if (Adds_Timer <= diff) + if (Creature *SummonedMedic = DoSpawnCreature(8894, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMedic->AI()->AttackStart(victim); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) { - // summon 3 Adds every 25s - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 18000; + } else MightyBlow_Timer -= diff; - Adds_Timer = 25000; - } else Adds_Timer -= diff; + //HamString_Timer + if (HamString_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamString_Timer = 15000; + } else HamString_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 9000; + } else Cleave_Timer -= diff; + + //Adds_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 21) + { + if (Adds_Timer <= diff) + { + // summon 3 Adds every 25s + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + + Adds_Timer = 25000; + } else Adds_Timer -= diff; + } + + //Summon Medics + if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21) + { + SummonMedics(me->getVictim()); + SummonMedics(me->getVictim()); + Medics = true; + } + + DoMeleeAttackIfReady(); } + }; - //Summon Medics - if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21) - { - SummonMedics(me->getVictim()); - SummonMedics(me->getVictim()); - Medics = true; - } - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_general_angerforge(Creature* pCreature) -{ - return new boss_general_angerforgeAI (pCreature); -} void AddSC_boss_general_angerforge() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_general_angerforge"; - newscript->GetAI = &GetAI_boss_general_angerforge; - newscript->RegisterSelf(); + new boss_general_angerforge(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp index 718278d3720..12465f77955 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_gorosh_the_dervish.cpp @@ -30,57 +30,60 @@ enum Spells SPELL_WHIRLWIND = 15589, SPELL_MORTALSTRIKE = 24573 }; - -struct boss_gorosh_the_dervishAI : public ScriptedAI + class boss_gorosh_the_dervish : public CreatureScript { - boss_gorosh_the_dervishAI(Creature *c) : ScriptedAI(c) {} +public: + boss_gorosh_the_dervish() : CreatureScript("boss_gorosh_the_dervish") { } - uint32 WhirlWind_Timer; - uint32 MortalStrike_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 12000; - MortalStrike_Timer = 22000; + return new boss_gorosh_the_dervishAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_gorosh_the_dervishAI : public ScriptedAI { - } + boss_gorosh_the_dervishAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WhirlWind_Timer; + uint32 MortalStrike_Timer; - //WhirlWind_Timer - if (WhirlWind_Timer <= diff) + void Reset() { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind_Timer = 15000; - } else WhirlWind_Timer -= diff; + WhirlWind_Timer = 12000; + MortalStrike_Timer = 22000; + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //WhirlWind_Timer + if (WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + WhirlWind_Timer = 15000; + } else WhirlWind_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 15000; + } else MortalStrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gorosh_the_dervish(Creature* pCreature) -{ - return new boss_gorosh_the_dervishAI (pCreature); -} void AddSC_boss_gorosh_the_dervish() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gorosh_the_dervish"; - newscript->GetAI = &GetAI_boss_gorosh_the_dervish; - newscript->RegisterSelf(); + new boss_gorosh_the_dervish(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp index f369e4d645a..bd06e6a2eb1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_grizzle.cpp @@ -35,62 +35,65 @@ enum Spells SPELL_GROUNDTREMOR = 6524, SPELL_FRENZY = 28371 }; - -struct boss_grizzleAI : public ScriptedAI + class boss_grizzle : public CreatureScript { - boss_grizzleAI(Creature *c) : ScriptedAI(c) {} +public: + boss_grizzle() : CreatureScript("boss_grizzle") { } - uint32 GroundTremor_Timer; - uint32 Frenzy_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - GroundTremor_Timer = 12000; - Frenzy_Timer =0; + return new boss_grizzleAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_grizzleAI : public ScriptedAI { - } + boss_grizzleAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 GroundTremor_Timer; + uint32 Frenzy_Timer; - //GroundTremor_Timer - if (GroundTremor_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_GROUNDTREMOR); - GroundTremor_Timer = 8000; - } else GroundTremor_Timer -= diff; - - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) - { - if (Frenzy_Timer <= diff) - { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); - - Frenzy_Timer = 15000; - } else Frenzy_Timer -= diff; + GroundTremor_Timer = 12000; + Frenzy_Timer =0; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //GroundTremor_Timer + if (GroundTremor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUNDTREMOR); + GroundTremor_Timer = 8000; + } else GroundTremor_Timer -= diff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + if (Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + Frenzy_Timer = 15000; + } else Frenzy_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_grizzle(Creature* pCreature) -{ - return new boss_grizzleAI (pCreature); -} void AddSC_boss_grizzle() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grizzle"; - newscript->GetAI = &GetAI_boss_grizzle; - newscript->RegisterSelf(); + new boss_grizzle(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp index 53df13eee1f..4b8ba9e6825 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_high_interrogator_gerstahn.cpp @@ -32,77 +32,80 @@ enum Spells SPELL_PSYCHICSCREAM = 8122, SPELL_SHADOWSHIELD = 22417 }; - -struct boss_high_interrogator_gerstahnAI : public ScriptedAI + class boss_high_interrogator_gerstahn : public CreatureScript { - boss_high_interrogator_gerstahnAI(Creature *c) : ScriptedAI(c) {} +public: + boss_high_interrogator_gerstahn() : CreatureScript("boss_high_interrogator_gerstahn") { } - uint32 ShadowWordPain_Timer; - uint32 ManaBurn_Timer; - uint32 PsychicScream_Timer; - uint32 ShadowShield_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowWordPain_Timer = 4000; - ManaBurn_Timer = 14000; - PsychicScream_Timer = 32000; - ShadowShield_Timer = 8000; + return new boss_high_interrogator_gerstahnAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_high_interrogator_gerstahnAI : public ScriptedAI { - } + boss_high_interrogator_gerstahnAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowWordPain_Timer; + uint32 ManaBurn_Timer; + uint32 PsychicScream_Timer; + uint32 ShadowShield_Timer; - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 7000; - } else ShadowWordPain_Timer -= diff; + ShadowWordPain_Timer = 4000; + ManaBurn_Timer = 14000; + PsychicScream_Timer = 32000; + ShadowShield_Timer = 8000; + } - //ManaBurn_Timer - if (ManaBurn_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MANABURN); - ManaBurn_Timer = 10000; - } else ManaBurn_Timer -= diff; + } - //PsychicScream_Timer - if (PsychicScream_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_PSYCHICSCREAM); - PsychicScream_Timer = 30000; - } else PsychicScream_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //ShadowShield_Timer - if (ShadowShield_Timer <= diff) - { - DoCast(me, SPELL_SHADOWSHIELD); - ShadowShield_Timer = 25000; - } else ShadowShield_Timer -= diff; + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 7000; + } else ShadowWordPain_Timer -= diff; + + //ManaBurn_Timer + if (ManaBurn_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MANABURN); + ManaBurn_Timer = 10000; + } else ManaBurn_Timer -= diff; + + //PsychicScream_Timer + if (PsychicScream_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PSYCHICSCREAM); + PsychicScream_Timer = 30000; + } else PsychicScream_Timer -= diff; + + //ShadowShield_Timer + if (ShadowShield_Timer <= diff) + { + DoCast(me, SPELL_SHADOWSHIELD); + ShadowShield_Timer = 25000; + } else ShadowShield_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_high_interrogator_gerstahn(Creature* pCreature) -{ - return new boss_high_interrogator_gerstahnAI (pCreature); -} void AddSC_boss_high_interrogator_gerstahn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_high_interrogator_gerstahn"; - newscript->GetAI = &GetAI_boss_high_interrogator_gerstahn; - newscript->RegisterSelf(); + new boss_high_interrogator_gerstahn(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp index bc0181bbb9a..cba80b82515 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_magmus.cpp @@ -35,66 +35,69 @@ enum eEnums { DATA_THRONE_DOOR = 24 // not id or guid of doors but number of enum in blackrock_depths.h }; - -struct boss_magmusAI : public ScriptedAI + class boss_magmus : public CreatureScript { - boss_magmusAI(Creature *c) : ScriptedAI(c) {} +public: + boss_magmus() : CreatureScript("boss_magmus") { } - uint32 FieryBurst_Timer; - uint32 WarStomp_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FieryBurst_Timer = 5000; - WarStomp_Timer =0; + return new boss_magmusAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_magmusAI : public ScriptedAI { - } + boss_magmusAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FieryBurst_Timer; + uint32 WarStomp_Timer; - //FieryBurst_Timer - if (FieryBurst_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FIERYBURST); - FieryBurst_Timer = 6000; - } else FieryBurst_Timer -= diff; - - //WarStomp_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 51) - { - if (WarStomp_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = 8000; - } else WarStomp_Timer -= diff; + FieryBurst_Timer = 5000; + WarStomp_Timer =0; } - DoMeleeAttackIfReady(); - } - // When he die open door to last chamber - void JustDied(Unit *who) - { - if (ScriptedInstance* pInstance = who->GetInstanceData()) - pInstance->HandleGameObject(pInstance->GetData64(DATA_THRONE_DOOR), true); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //FieryBurst_Timer + if (FieryBurst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIERYBURST); + FieryBurst_Timer = 6000; + } else FieryBurst_Timer -= diff; + + //WarStomp_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = 8000; + } else WarStomp_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + // When he die open door to last chamber + void JustDied(Unit *who) + { + if (InstanceScript* pInstance = who->GetInstanceScript()) + pInstance->HandleGameObject(pInstance->GetData64(DATA_THRONE_DOOR), true); + } + }; + }; -CreatureAI* GetAI_boss_magmus(Creature* pCreature) -{ - return new boss_magmusAI (pCreature); -} void AddSC_boss_magmus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magmus"; - newscript->GetAI = &GetAI_boss_magmus; - newscript->RegisterSelf(); + new boss_magmus(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp index fe81ad5eeac..fd45bfddf9d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_moira_bronzebeard.cpp @@ -34,67 +34,70 @@ enum Spells SPELL_SHADOWWORDPAIN = 10894, SPELL_SMITE = 10934 }; - -struct boss_moira_bronzebeardAI : public ScriptedAI + class boss_moira_bronzebeard : public CreatureScript { - boss_moira_bronzebeardAI(Creature *c) : ScriptedAI(c) {} +public: + boss_moira_bronzebeard() : CreatureScript("boss_moira_bronzebeard") { } - uint32 Heal_Timer; - uint32 MindBlast_Timer; - uint32 ShadowWordPain_Timer; - uint32 Smite_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Heal_Timer = 12000; //These times are probably wrong - MindBlast_Timer = 16000; - ShadowWordPain_Timer = 2000; - Smite_Timer = 8000; + return new boss_moira_bronzebeardAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_moira_bronzebeardAI : public ScriptedAI { - } + boss_moira_bronzebeardAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Heal_Timer; + uint32 MindBlast_Timer; + uint32 ShadowWordPain_Timer; + uint32 Smite_Timer; - //MindBlast_Timer - if (MindBlast_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_MINDBLAST); - MindBlast_Timer = 14000; - } else MindBlast_Timer -= diff; + Heal_Timer = 12000; //These times are probably wrong + MindBlast_Timer = 16000; + ShadowWordPain_Timer = 2000; + Smite_Timer = 8000; + } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 18000; - } else ShadowWordPain_Timer -= diff; + } - //Smite_Timer - if (Smite_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SMITE); - Smite_Timer = 10000; - } else Smite_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //MindBlast_Timer + if (MindBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + MindBlast_Timer = 14000; + } else MindBlast_Timer -= diff; + + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 18000; + } else ShadowWordPain_Timer -= diff; + + //Smite_Timer + if (Smite_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SMITE); + Smite_Timer = 10000; + } else Smite_Timer -= diff; + + } + }; - } }; -CreatureAI* GetAI_boss_moira_bronzebeard(Creature* pCreature) -{ - return new boss_moira_bronzebeardAI (pCreature); -} void AddSC_boss_moira_bronzebeard() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_moira_bronzebeard"; - newscript->GetAI = &GetAI_boss_moira_bronzebeard; - newscript->RegisterSelf(); + new boss_moira_bronzebeard(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index ac1795d5e43..9b1183b9d6f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -46,46 +46,53 @@ enum Misc #define GOSSIP_ITEM_TEACH_2 "Continue..." #define GOSSIP_ITEM_TEACH_3 "[PH] Continue..." #define GOSSIP_ITEM_TRIBUTE "I want to pay tribute" - -bool GossipHello_boss_gloomrel(Player* pPlayer, Creature* pCreature) + class boss_gloomrel : public CreatureScript { - if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_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); +public: + boss_gloomrel() : CreatureScript("boss_gloomrel") { } - if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_boss_gloomrel(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(2606, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_LEARN_SMELT, false); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(2604, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->CLOSE_GOSSIP_MENU(); - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - //are 5 minutes expected? go template may have data to despawn when used at quest - pInstance->DoRespawnGameObject(pInstance->GetData64(DATA_GO_CHALICE),MINUTE*5); - } - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(2606, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_LEARN_SMELT, false); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEACH_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(2604, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->CLOSE_GOSSIP_MENU(); + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + //are 5 minutes expected? go template may have data to despawn when used at quest + pInstance->DoRespawnGameObject(pInstance->GetData64(DATA_GO_CHALICE),MINUTE*5); + } + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestRewardStatus(QUEST_SPECTRAL_CHALICE) == 1 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_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(QUEST_SPECTRAL_CHALICE) == 0 && pPlayer->GetSkillValue(SKILL_MINING) >= DATA_SKILLPOINT_MIN) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TRIBUTE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; + enum DoomrelSpells { @@ -96,161 +103,155 @@ enum DoomrelSpells SPELL_SUMMON_VOIDWALKERS = 15092 }; -struct boss_doomrelAI : public ScriptedAI -{ - boss_doomrelAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 ShadowVolley_Timer; - uint32 Immolate_Timer; - uint32 CurseOfWeakness_Timer; - uint32 DemonArmor_Timer; - bool Voidwalkers; - - void Reset() - { - ShadowVolley_Timer = 10000; - Immolate_Timer = 18000; - CurseOfWeakness_Timer = 5000; - DemonArmor_Timer = 16000; - Voidwalkers = false; - - me->setFaction(FACTION_FRIEND); - - // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - - if (pInstance) - if (pInstance->GetData(DATA_GHOSTKILL) >= 7) - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - else - me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - - void EnterCombat(Unit * /*who*/) - { - } - - void EnterEvadeMode() - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->LoadCreaturesAddon(); - if (me->isAlive()) - me->GetMotionMaster()->MoveTargetedHome(); - me->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; - - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 12000; - } else ShadowVolley_Timer -= diff; - - //Immolate_Timer - if (Immolate_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMMOLATE); - - Immolate_Timer = 25000; - } else Immolate_Timer -= diff; - - //CurseOfWeakness_Timer - if (CurseOfWeakness_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - CurseOfWeakness_Timer = 45000; - } else CurseOfWeakness_Timer -= diff; - - //DemonArmor_Timer - if (DemonArmor_Timer <= diff) - { - DoCast(me, SPELL_DEMONARMOR); - DemonArmor_Timer = 300000; - } else DemonArmor_Timer -= diff; - - //Summon Voidwalkers - if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51) - { - DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); - Voidwalkers = true; - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_doomrel(Creature* pCreature) -{ - return new boss_doomrelAI (pCreature); -} - #define GOSSIP_ITEM_CHALLENGE "Your bondage is at an end, Doom'rel. I challenge you!" #define GOSSIP_SELECT_DOOMREL "[PH] Continue..." - -bool GossipHello_boss_doomrel(Player* pPlayer, Creature* pCreature) + class boss_doomrel : public CreatureScript { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2601, pCreature->GetGUID()); +public: + boss_doomrel() : CreatureScript("boss_doomrel") { } - return true; -} - -bool GossipSelect_boss_doomrel(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2605, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - //start event here - pCreature->setFaction(FACTION_HOSTILE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pCreature->AI()->AttackStart(pPlayer); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance) - pInstance->SetData64(DATA_EVENSTARTER,pPlayer->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_DOOMREL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2605, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + //start event here + pCreature->setFaction(FACTION_HOSTILE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pCreature->AI()->AttackStart(pPlayer); + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance) + pInstance->SetData64(DATA_EVENSTARTER,pPlayer->GetGUID()); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_CHALLENGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2601, pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_doomrelAI (pCreature); + } + + struct boss_doomrelAI : public ScriptedAI + { + boss_doomrelAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + uint32 ShadowVolley_Timer; + uint32 Immolate_Timer; + uint32 CurseOfWeakness_Timer; + uint32 DemonArmor_Timer; + bool Voidwalkers; + + void Reset() + { + ShadowVolley_Timer = 10000; + Immolate_Timer = 18000; + CurseOfWeakness_Timer = 5000; + DemonArmor_Timer = 16000; + Voidwalkers = false; + + me->setFaction(FACTION_FRIEND); + + // was set before event start, so set again + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + + if (pInstance) + if (pInstance->GetData(DATA_GHOSTKILL) >= 7) + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + else + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void EnterEvadeMode() + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->LoadCreaturesAddon(); + if (me->isAlive()) + me->GetMotionMaster()->MoveTargetedHome(); + me->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; + + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); + ShadowVolley_Timer = 12000; + } else ShadowVolley_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = 25000; + } else Immolate_Timer -= diff; + + //CurseOfWeakness_Timer + if (CurseOfWeakness_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + CurseOfWeakness_Timer = 45000; + } else CurseOfWeakness_Timer -= diff; + + //DemonArmor_Timer + if (DemonArmor_Timer <= diff) + { + DoCast(me, SPELL_DEMONARMOR); + DemonArmor_Timer = 300000; + } else DemonArmor_Timer -= diff; + + //Summon Voidwalkers + if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true); + Voidwalkers = true; + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_tomb_of_seven() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gloomrel"; - newscript->pGossipHello = &GossipHello_boss_gloomrel; - newscript->pGossipSelect = &GossipSelect_boss_gloomrel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_doomrel"; - newscript->GetAI = &GetAI_boss_doomrel; - newscript->pGossipHello = &GossipHello_boss_doomrel; - newscript->pGossipSelect = &GossipSelect_boss_doomrel; - newscript->RegisterSelf(); + new boss_gloomrel(); + new boss_doomrel(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index 9be222e8bb2..ab238d8ebef 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -74,389 +74,392 @@ enum eEnums GO_SPECTRAL_CHALICE = 164869, GO_CHEST_SEVEN = 169243 }; - -struct instance_blackrock_depths : public ScriptedInstance + class instance_blackrock_depths : public InstanceMapScript { - instance_blackrock_depths(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_blackrock_depths() : InstanceMapScript("instance_blackrock_depths") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 EmperorGUID; - uint64 PhalanxGUID; - uint64 MagmusGUID; - - uint64 GoArena1GUID; - uint64 GoArena2GUID; - uint64 GoArena3GUID; - uint64 GoArena4GUID; - uint64 GoShadowLockGUID; - uint64 GoShadowMechGUID; - uint64 GoShadowGiantGUID; - uint64 GoShadowDummyGUID; - uint64 GoBarKegGUID; - uint64 GoBarKegTrapGUID; - uint64 GoBarDoorGUID; - uint64 GoTombEnterGUID; - uint64 GoTombExitGUID; - uint64 GoLyceumGUID; - uint64 GoSFSGUID; - uint64 GoSFNGUID; - uint64 GoGolemNGUID; - uint64 GoGolemSGUID; - uint64 GoThroneGUID; - uint64 GoChestGUID; - - uint32 BarAleCount; - uint32 GhostKillCount; - uint64 TombBossGUIDs[7]; - uint64 TombEventStarterGUID; - uint32 TombTimer; - uint32 TombEventCounter; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - EmperorGUID = 0; - PhalanxGUID = 0; - MagmusGUID = 0; - - GoArena1GUID = 0; - GoArena2GUID = 0; - GoArena3GUID = 0; - GoArena4GUID = 0; - GoShadowLockGUID = 0; - GoShadowMechGUID = 0; - GoShadowGiantGUID = 0; - GoShadowDummyGUID = 0; - GoBarKegGUID = 0; - GoBarKegTrapGUID = 0; - GoBarDoorGUID = 0; - GoTombEnterGUID = 0; - GoTombExitGUID = 0; - GoLyceumGUID = 0; - GoSFSGUID = 0; - GoSFNGUID = 0; - GoGolemNGUID = 0; - GoGolemSGUID = 0; - GoThroneGUID = 0; - GoChestGUID = 0; - - BarAleCount = 0; - GhostKillCount = 0; - TombEventStarterGUID = 0; - TombTimer = TIMER_TOMBOFTHESEVEN; - TombEventCounter = 0; - - for (uint8 i = 0; i < 7; ++i) - TombBossGUIDs[i] = 0; + return new instance_blackrock_depths_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_blackrock_depths_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_blackrock_depths_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + uint64 EmperorGUID; + uint64 PhalanxGUID; + uint64 MagmusGUID; + + uint64 GoArena1GUID; + uint64 GoArena2GUID; + uint64 GoArena3GUID; + uint64 GoArena4GUID; + uint64 GoShadowLockGUID; + uint64 GoShadowMechGUID; + uint64 GoShadowGiantGUID; + uint64 GoShadowDummyGUID; + uint64 GoBarKegGUID; + uint64 GoBarKegTrapGUID; + uint64 GoBarDoorGUID; + uint64 GoTombEnterGUID; + uint64 GoTombExitGUID; + uint64 GoLyceumGUID; + uint64 GoSFSGUID; + uint64 GoSFNGUID; + uint64 GoGolemNGUID; + uint64 GoGolemSGUID; + uint64 GoThroneGUID; + uint64 GoChestGUID; + + uint32 BarAleCount; + uint32 GhostKillCount; + uint64 TombBossGUIDs[7]; + uint64 TombEventStarterGUID; + uint32 TombTimer; + uint32 TombEventCounter; + + void Initialize() { - case NPC_EMPEROR: EmperorGUID = pCreature->GetGUID(); break; - case NPC_PHALANX: PhalanxGUID = pCreature->GetGUID(); break; - case NPC_DOOMREL: TombBossGUIDs[0] = pCreature->GetGUID(); break; - case NPC_DOPEREL: TombBossGUIDs[1] = pCreature->GetGUID(); break; - case NPC_HATEREL: TombBossGUIDs[2] = pCreature->GetGUID(); break; - case NPC_VILEREL: TombBossGUIDs[3] = pCreature->GetGUID(); break; - case NPC_SEETHREL: TombBossGUIDs[4] = pCreature->GetGUID(); break; - case NPC_GLOOMREL: TombBossGUIDs[5] = pCreature->GetGUID(); break; - case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break; - case NPC_MAGMUS: - MagmusGUID = pCreature->GetGUID(); - if (!pCreature->isAlive()) - HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + EmperorGUID = 0; + PhalanxGUID = 0; + MagmusGUID = 0; + + GoArena1GUID = 0; + GoArena2GUID = 0; + GoArena3GUID = 0; + GoArena4GUID = 0; + GoShadowLockGUID = 0; + GoShadowMechGUID = 0; + GoShadowGiantGUID = 0; + GoShadowDummyGUID = 0; + GoBarKegGUID = 0; + GoBarKegTrapGUID = 0; + GoBarDoorGUID = 0; + GoTombEnterGUID = 0; + GoTombExitGUID = 0; + GoLyceumGUID = 0; + GoSFSGUID = 0; + GoSFNGUID = 0; + GoGolemNGUID = 0; + GoGolemSGUID = 0; + GoThroneGUID = 0; + GoChestGUID = 0; + + BarAleCount = 0; + GhostKillCount = 0; + TombEventStarterGUID = 0; + TombTimer = TIMER_TOMBOFTHESEVEN; + TombEventCounter = 0; + + for (uint8 i = 0; i < 7; ++i) + TombBossGUIDs[i] = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_ARENA1: GoArena1GUID = pGo->GetGUID(); break; - case GO_ARENA2: GoArena2GUID = pGo->GetGUID(); break; - case GO_ARENA3: GoArena3GUID = pGo->GetGUID(); break; - case GO_ARENA4: GoArena4GUID = pGo->GetGUID(); break; - case GO_SHADOW_LOCK: GoShadowLockGUID = pGo->GetGUID(); break; - case GO_SHADOW_MECHANISM: GoShadowMechGUID = pGo->GetGUID(); break; - case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = pGo->GetGUID(); break; - case GO_SHADOW_DUMMY: GoShadowDummyGUID = pGo->GetGUID(); break; - case GO_BAR_KEG_SHOT: GoBarKegGUID = pGo->GetGUID(); break; - case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = pGo->GetGUID(); break; - case GO_BAR_DOOR: GoBarDoorGUID = pGo->GetGUID(); break; - case GO_TOMB_ENTER: GoTombEnterGUID = pGo->GetGUID(); break; - case GO_TOMB_EXIT: - GoTombExitGUID = pGo->GetGUID(); + switch(pCreature->GetEntry()) + { + case NPC_EMPEROR: EmperorGUID = pCreature->GetGUID(); break; + case NPC_PHALANX: PhalanxGUID = pCreature->GetGUID(); break; + case NPC_DOOMREL: TombBossGUIDs[0] = pCreature->GetGUID(); break; + case NPC_DOPEREL: TombBossGUIDs[1] = pCreature->GetGUID(); break; + case NPC_HATEREL: TombBossGUIDs[2] = pCreature->GetGUID(); break; + case NPC_VILEREL: TombBossGUIDs[3] = pCreature->GetGUID(); break; + case NPC_SEETHREL: TombBossGUIDs[4] = pCreature->GetGUID(); break; + case NPC_GLOOMREL: TombBossGUIDs[5] = pCreature->GetGUID(); break; + case NPC_ANGERREL: TombBossGUIDs[6] = pCreature->GetGUID(); break; + case NPC_MAGMUS: + MagmusGUID = pCreature->GetGUID(); + if (!pCreature->isAlive()) + HandleGameObject(GetData64(DATA_THRONE_DOOR), true); // if Magmus is dead open door to last boss + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_ARENA1: GoArena1GUID = pGo->GetGUID(); break; + case GO_ARENA2: GoArena2GUID = pGo->GetGUID(); break; + case GO_ARENA3: GoArena3GUID = pGo->GetGUID(); break; + case GO_ARENA4: GoArena4GUID = pGo->GetGUID(); break; + case GO_SHADOW_LOCK: GoShadowLockGUID = pGo->GetGUID(); break; + case GO_SHADOW_MECHANISM: GoShadowMechGUID = pGo->GetGUID(); break; + case GO_SHADOW_GIANT_DOOR: GoShadowGiantGUID = pGo->GetGUID(); break; + case GO_SHADOW_DUMMY: GoShadowDummyGUID = pGo->GetGUID(); break; + case GO_BAR_KEG_SHOT: GoBarKegGUID = pGo->GetGUID(); break; + case GO_BAR_KEG_TRAP: GoBarKegTrapGUID = pGo->GetGUID(); break; + case GO_BAR_DOOR: GoBarDoorGUID = pGo->GetGUID(); break; + case GO_TOMB_ENTER: GoTombEnterGUID = pGo->GetGUID(); break; + case GO_TOMB_EXIT: + GoTombExitGUID = pGo->GetGUID(); + if (GhostKillCount >= 7) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case GO_LYCEUM: GoLyceumGUID = pGo->GetGUID(); break; + case GO_SF_S: GoSFSGUID = pGo->GetGUID(); break; + case GO_SF_N: GoSFNGUID = pGo->GetGUID(); break; + case GO_GOLEM_ROOM_N: GoGolemNGUID = pGo->GetGUID(); break; + case GO_GOLEM_ROOM_S: GoGolemSGUID = pGo->GetGUID(); break; + case GO_THRONE_ROOM: GoThroneGUID = pGo->GetGUID(); break; + case GO_CHEST_SEVEN: GoChestGUID = pGo->GetGUID(); break; + } + } + + void SetData64(uint32 type, uint64 data) + { + sLog.outDebug("TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data %u)", type, data); + + switch(type) + { + case DATA_EVENSTARTER: + TombEventStarterGUID = data; + if (!TombEventStarterGUID) + TombOfSevenReset();//reset + else + TombOfSevenStart();//start + break; + } + } + + void SetData(uint32 type, uint32 data) + { + sLog.outDebug("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + + switch(type) + { + case TYPE_RING_OF_LAW: + m_auiEncounter[0] = data; + break; + case TYPE_VAULT: + m_auiEncounter[1] = data; + break; + case TYPE_BAR: + if (data == SPECIAL) + ++BarAleCount; + else + m_auiEncounter[2] = data; + break; + case TYPE_TOMB_OF_SEVEN: + m_auiEncounter[3] = data; + break; + case TYPE_LYCEUM: + m_auiEncounter[4] = data; + break; + case TYPE_IRON_HALL: + m_auiEncounter[5] = data; + break; + case DATA_GHOSTKILL: + GhostKillCount += data; + break; + } + + if (data == DONE || GhostKillCount >= 7) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << GhostKillCount; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_RING_OF_LAW: + return m_auiEncounter[0]; + case TYPE_VAULT: + return m_auiEncounter[1]; + case TYPE_BAR: + if (m_auiEncounter[2] == IN_PROGRESS && BarAleCount == 3) + return SPECIAL; + else + return m_auiEncounter[2]; + case TYPE_TOMB_OF_SEVEN: + return m_auiEncounter[3]; + case TYPE_LYCEUM: + return m_auiEncounter[4]; + case TYPE_IRON_HALL: + return m_auiEncounter[5]; + case DATA_GHOSTKILL: + return GhostKillCount; + } + return 0; + } + + uint64 GetData64(uint32 data) + { + switch(data) + { + case DATA_EMPEROR: + return EmperorGUID; + case DATA_PHALANX: + return PhalanxGUID; + case DATA_ARENA1: + return GoArena1GUID; + case DATA_ARENA2: + return GoArena2GUID; + case DATA_ARENA3: + return GoArena3GUID; + case DATA_ARENA4: + return GoArena4GUID; + case DATA_GO_BAR_KEG: + return GoBarKegGUID; + case DATA_GO_BAR_KEG_TRAP: + return GoBarKegTrapGUID; + case DATA_GO_BAR_DOOR: + return GoBarDoorGUID; + case DATA_EVENSTARTER: + return TombEventStarterGUID; + case DATA_SF_BRAZIER_N: + return GoSFNGUID; + case DATA_SF_BRAZIER_S: + return GoSFSGUID; + case DATA_THRONE_DOOR: + return GoThroneGUID; + case DATA_GOLEM_DOOR_N: + return GoGolemNGUID; + case DATA_GOLEM_DOOR_S: + return GoGolemSGUID; + } + return 0; + } + + std::string GetSaveData() + { + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> GhostKillCount; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + if (GhostKillCount > 0 && GhostKillCount < 7) + GhostKillCount = 0;//reset tomb of seven event if (GhostKillCount >= 7) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case GO_LYCEUM: GoLyceumGUID = pGo->GetGUID(); break; - case GO_SF_S: GoSFSGUID = pGo->GetGUID(); break; - case GO_SF_N: GoSFNGUID = pGo->GetGUID(); break; - case GO_GOLEM_ROOM_N: GoGolemNGUID = pGo->GetGUID(); break; - case GO_GOLEM_ROOM_S: GoGolemSGUID = pGo->GetGUID(); break; - case GO_THRONE_ROOM: GoThroneGUID = pGo->GetGUID(); break; - case GO_CHEST_SEVEN: GoChestGUID = pGo->GetGUID(); break; - } - } + GhostKillCount = 7; - void SetData64(uint32 type, uint64 data) - { - sLog.outDebug("TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data %u)", type, data); - - switch(type) - { - case DATA_EVENSTARTER: - TombEventStarterGUID = data; - if (!TombEventStarterGUID) - TombOfSevenReset();//reset - else - TombOfSevenStart();//start - break; - } - } - - void SetData(uint32 type, uint32 data) - { - sLog.outDebug("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); - - switch(type) - { - case TYPE_RING_OF_LAW: - m_auiEncounter[0] = data; - break; - case TYPE_VAULT: - m_auiEncounter[1] = data; - break; - case TYPE_BAR: - if (data == SPECIAL) - ++BarAleCount; - else - m_auiEncounter[2] = data; - break; - case TYPE_TOMB_OF_SEVEN: - m_auiEncounter[3] = data; - break; - case TYPE_LYCEUM: - m_auiEncounter[4] = data; - break; - case TYPE_IRON_HALL: - m_auiEncounter[5] = data; - break; - case DATA_GHOSTKILL: - GhostKillCount += data; - break; + OUT_LOAD_INST_DATA_COMPLETE; } - if (data == DONE || GhostKillCount >= 7) + void TombOfSevenEvent() { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << GhostKillCount; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_RING_OF_LAW: - return m_auiEncounter[0]; - case TYPE_VAULT: - return m_auiEncounter[1]; - case TYPE_BAR: - if (m_auiEncounter[2] == IN_PROGRESS && BarAleCount == 3) - return SPECIAL; - else - return m_auiEncounter[2]; - case TYPE_TOMB_OF_SEVEN: - return m_auiEncounter[3]; - case TYPE_LYCEUM: - return m_auiEncounter[4]; - case TYPE_IRON_HALL: - return m_auiEncounter[5]; - case DATA_GHOSTKILL: - return GhostKillCount; - } - return 0; - } - - uint64 GetData64(uint32 data) - { - switch(data) - { - case DATA_EMPEROR: - return EmperorGUID; - case DATA_PHALANX: - return PhalanxGUID; - case DATA_ARENA1: - return GoArena1GUID; - case DATA_ARENA2: - return GoArena2GUID; - case DATA_ARENA3: - return GoArena3GUID; - case DATA_ARENA4: - return GoArena4GUID; - case DATA_GO_BAR_KEG: - return GoBarKegGUID; - case DATA_GO_BAR_KEG_TRAP: - return GoBarKegTrapGUID; - case DATA_GO_BAR_DOOR: - return GoBarDoorGUID; - case DATA_EVENSTARTER: - return TombEventStarterGUID; - case DATA_SF_BRAZIER_N: - return GoSFNGUID; - case DATA_SF_BRAZIER_S: - return GoSFSGUID; - case DATA_THRONE_DOOR: - return GoThroneGUID; - case DATA_GOLEM_DOOR_N: - return GoGolemNGUID; - case DATA_GOLEM_DOOR_S: - return GoGolemSGUID; - } - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> GhostKillCount; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - if (GhostKillCount > 0 && GhostKillCount < 7) - GhostKillCount = 0;//reset tomb of seven event - if (GhostKillCount >= 7) - GhostKillCount = 7; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - void TombOfSevenEvent() - { - if (GhostKillCount < 7 && TombBossGUIDs[TombEventCounter]) - { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) + if (GhostKillCount < 7 && TombBossGUIDs[TombEventCounter]) { - boss->setFaction(FACTION_HOSTILE); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - if (Unit *pTarget = boss->SelectNearestTarget(500)) - boss->AI()->AttackStart(pTarget); - } - } - } - - void TombOfSevenReset() - { - HandleGameObject(GoTombExitGUID,false);//event reseted, close exit door - HandleGameObject(GoTombEnterGUID,true);//event reseted, open entrance door - for (uint8 i = 0; i < 7; ++i) - { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) - { - if (!boss->isAlive()) - {//do not call EnterEvadeMode(), it will create infinit loops - boss->Respawn(); - boss->RemoveAllAuras(); - boss->DeleteThreatList(); - boss->CombatStop(true); - boss->LoadCreaturesAddon(); - boss->GetMotionMaster()->MoveTargetedHome(); - boss->SetLootRecipient(NULL); - } - boss->setFaction(FACTION_FRIEND); - } - } - GhostKillCount = 0; - TombEventStarterGUID = 0; - TombEventCounter = 0; - TombTimer = TIMER_TOMBOFTHESEVEN; - SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); - } - - void TombOfSevenStart() - { - HandleGameObject(GoTombExitGUID,false);//event started, close exit door - HandleGameObject(GoTombEnterGUID,false);//event started, close entrance door - SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS); - } - - void TombOfSevenEnd() - { - DoRespawnGameObject(GoChestGUID,DAY); - HandleGameObject(GoTombExitGUID,true);//event done, open exit door - HandleGameObject(GoTombEnterGUID,true);//event done, open entrance door - TombEventStarterGUID = 0; - SetData(TYPE_TOMB_OF_SEVEN, DONE); - } - void Update(uint32 diff) - { - if (TombEventStarterGUID && GhostKillCount < 7) - { - if (TombTimer <= diff) - { - TombTimer = TIMER_TOMBOFTHESEVEN; - ++TombEventCounter; - TombOfSevenEvent(); - // Check Killed bosses - for (uint8 i = 0; i < 7; ++i) + if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) { - if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) - { - if (!boss->isAlive()) - { - GhostKillCount = i+1; - } - } + boss->setFaction(FACTION_HOSTILE); + boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + if (Unit *pTarget = boss->SelectNearestTarget(500)) + boss->AI()->AttackStart(pTarget); } - } else TombTimer -= diff; + } } - if (GhostKillCount >= 7 && TombEventStarterGUID) - TombOfSevenEnd(); - } + + void TombOfSevenReset() + { + HandleGameObject(GoTombExitGUID,false);//event reseted, close exit door + HandleGameObject(GoTombEnterGUID,true);//event reseted, open entrance door + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) + { + if (!boss->isAlive()) + {//do not call EnterEvadeMode(), it will create infinit loops + boss->Respawn(); + boss->RemoveAllAuras(); + boss->DeleteThreatList(); + boss->CombatStop(true); + boss->LoadCreaturesAddon(); + boss->GetMotionMaster()->MoveTargetedHome(); + boss->SetLootRecipient(NULL); + } + boss->setFaction(FACTION_FRIEND); + } + } + GhostKillCount = 0; + TombEventStarterGUID = 0; + TombEventCounter = 0; + TombTimer = TIMER_TOMBOFTHESEVEN; + SetData(TYPE_TOMB_OF_SEVEN, NOT_STARTED); + } + + void TombOfSevenStart() + { + HandleGameObject(GoTombExitGUID,false);//event started, close exit door + HandleGameObject(GoTombEnterGUID,false);//event started, close entrance door + SetData(TYPE_TOMB_OF_SEVEN, IN_PROGRESS); + } + + void TombOfSevenEnd() + { + DoRespawnGameObject(GoChestGUID,DAY); + HandleGameObject(GoTombExitGUID,true);//event done, open exit door + HandleGameObject(GoTombEnterGUID,true);//event done, open entrance door + TombEventStarterGUID = 0; + SetData(TYPE_TOMB_OF_SEVEN, DONE); + } + void Update(uint32 diff) + { + if (TombEventStarterGUID && GhostKillCount < 7) + { + if (TombTimer <= diff) + { + TombTimer = TIMER_TOMBOFTHESEVEN; + ++TombEventCounter; + TombOfSevenEvent(); + // Check Killed bosses + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* boss = instance->GetCreature(TombBossGUIDs[i])) + { + if (!boss->isAlive()) + { + GhostKillCount = i+1; + } + } + } + } else TombTimer -= diff; + } + if (GhostKillCount >= 7 && TombEventStarterGUID) + TombOfSevenEnd(); + } + }; + }; -InstanceData* GetInstanceData_instance_blackrock_depths(Map* pMap) -{ - return new instance_blackrock_depths(pMap); -} void AddSC_instance_blackrock_depths() - { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_blackrock_depths"; - newscript->GetInstanceData = &GetInstanceData_instance_blackrock_depths; - newscript->RegisterSelf(); - } +{ + new instance_blackrock_depths(); +} diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp index 612201efa1c..9d8abe0da9b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp @@ -29,76 +29,78 @@ EndScriptData */ #define SPELL_CLEAVE 20691 #define SPELL_CONFLIGURATION 16805 #define SPELL_THUNDERCLAP 15548 //Not sure if right ID. 23931 would be a harder possibility. - -struct boss_drakkisathAI : public ScriptedAI + class boss_drakkisath : public CreatureScript { - boss_drakkisathAI(Creature *c) : ScriptedAI(c) {} +public: + boss_drakkisath() : CreatureScript("boss_drakkisath") { } - uint32 FireNova_Timer; - uint32 Cleave_Timer; - uint32 Confliguration_Timer; - uint32 Thunderclap_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireNova_Timer = 6000; - Cleave_Timer = 8000; - Confliguration_Timer = 15000; - Thunderclap_Timer = 17000; + return new boss_drakkisathAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_drakkisathAI : public ScriptedAI { - } + boss_drakkisathAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FireNova_Timer; + uint32 Cleave_Timer; + uint32 Confliguration_Timer; + uint32 Thunderclap_Timer; - //FireNova_Timer - if (FireNova_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FIRENOVA); - FireNova_Timer = 10000; - } else FireNova_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); + FireNova_Timer = 6000; Cleave_Timer = 8000; - } else Cleave_Timer -= diff; + Confliguration_Timer = 15000; + Thunderclap_Timer = 17000; + } - //Confliguration_Timer - if (Confliguration_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CONFLIGURATION); - Confliguration_Timer = 18000; - } else Confliguration_Timer -= diff; + } - //Thunderclap_Timer - if (Thunderclap_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 20000; - } else Thunderclap_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 10000; + } else FireNova_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 8000; + } else Cleave_Timer -= diff; + + //Confliguration_Timer + if (Confliguration_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONFLIGURATION); + Confliguration_Timer = 18000; + } else Confliguration_Timer -= diff; + + //Thunderclap_Timer + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 20000; + } else Thunderclap_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_drakkisath(Creature* pCreature) -{ - return new boss_drakkisathAI (pCreature); -} void AddSC_boss_drakkisath() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_drakkisath"; - newscript->GetAI = &GetAI_boss_drakkisath; - newscript->RegisterSelf(); + new boss_drakkisath(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp index 676115b0595..98ff410b90f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp @@ -28,180 +28,182 @@ EndScriptData */ #define SPELL_CORROSIVEACID 20667 #define SPELL_FREEZE 18763 #define SPELL_FLAMEBREATH 20712 - -struct boss_gythAI : public ScriptedAI + class boss_gyth : public CreatureScript { - boss_gythAI(Creature *c) : ScriptedAI(c) {} +public: + boss_gyth() : CreatureScript("boss_gyth") { } - uint32 Aggro_Timer; - uint32 Dragons_Timer; - uint32 Orc_Timer; - uint32 CorrosiveAcid_Timer; - uint32 Freeze_Timer; - uint32 Flamebreath_Timer; - uint32 Line1Count; - uint32 Line2Count; - - bool Event; - bool SummonedDragons; - bool SummonedOrcs; - bool SummonedRend; - bool bAggro; - bool RootSelf; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Dragons_Timer = 3000; - Orc_Timer = 60000; - Aggro_Timer = 60000; - CorrosiveAcid_Timer = 8000; - Freeze_Timer = 11000; - Flamebreath_Timer = 4000; - Event = false; - SummonedDragons = false; - SummonedOrcs= false; - SummonedRend = false; - bAggro = false; - RootSelf = false; - - // how many times should the two lines of summoned creatures be spawned - // min 2 x 2, max 7 lines of attack in total - Line1Count = rand() % 4 + 2; - if (Line1Count < 5) - Line2Count = rand() % (5 - Line1Count) + 2; - else - Line2Count = 2; - - //Invisible for event start - me->SetDisplayId(11686); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return new boss_gythAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_gythAI : public ScriptedAI { - } + boss_gythAI(Creature *c) : ScriptedAI(c) {} - void SummonCreatureWithRandomTarget(uint32 creatureId) - { - Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000); - if (Summoned) + uint32 Aggro_Timer; + uint32 Dragons_Timer; + uint32 Orc_Timer; + uint32 CorrosiveAcid_Timer; + uint32 Freeze_Timer; + uint32 Flamebreath_Timer; + uint32 Line1Count; + uint32 Line2Count; + + bool Event; + bool SummonedDragons; + bool SummonedOrcs; + bool SummonedRend; + bool bAggro; + bool RootSelf; + + void Reset() { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - Summoned->AddThreat(pTarget, 1.0f); - } - } + Dragons_Timer = 3000; + Orc_Timer = 60000; + Aggro_Timer = 60000; + CorrosiveAcid_Timer = 8000; + Freeze_Timer = 11000; + Flamebreath_Timer = 4000; + Event = false; + SummonedDragons = false; + SummonedOrcs= false; + SummonedRend = false; + bAggro = false; + RootSelf = false; - void UpdateAI(const uint32 diff) - { - //char buf[200]; + // how many times should the two lines of summoned creatures be spawned + // min 2 x 2, max 7 lines of attack in total + Line1Count = rand() % 4 + 2; + if (Line1Count < 5) + Line2Count = rand() % (5 - Line1Count) + 2; + else + Line2Count = 2; - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!RootSelf) - { - //me->m_canMove = true; - DoCast(me, 33356); - RootSelf = true; + //Invisible for event start + me->SetDisplayId(11686); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - if (!bAggro && Line1Count == 0 && Line2Count == 0) + void EnterCombat(Unit * /*who*/) { - if (Aggro_Timer <= diff) - { - bAggro = true; - // Visible now! - me->SetDisplayId(9723); - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } else Aggro_Timer -= diff; } - // Summon Dragon pack. 2 Dragons and 3 Whelps - if (!bAggro && !SummonedRend && Line1Count > 0) + void SummonCreatureWithRandomTarget(uint32 creatureId) { - if (Dragons_Timer <= diff) + Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000); + if (Summoned) { - SummonCreatureWithRandomTarget(10372); - SummonCreatureWithRandomTarget(10372); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - Line1Count = Line1Count - 1; - Dragons_Timer = 60000; - } else Dragons_Timer -= diff; + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + Summoned->AddThreat(pTarget, 1.0f); + } } - //Summon Orc pack. 1 Orc Handler 1 Elite Dragonkin and 3 Whelps - if (!bAggro && !SummonedRend && Line1Count == 0 && Line2Count > 0) + void UpdateAI(const uint32 diff) { - if (Orc_Timer <= diff) - { - SummonCreatureWithRandomTarget(10447); - SummonCreatureWithRandomTarget(10317); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - SummonCreatureWithRandomTarget(10442); - Line2Count = Line2Count - 1; - Orc_Timer = 60000; - } else Orc_Timer -= diff; - } + //char buf[200]; - // we take part in the fight - if (bAggro) - { - // CorrosiveAcid_Timer - if (CorrosiveAcid_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CORROSIVEACID); - CorrosiveAcid_Timer = 7000; - } else CorrosiveAcid_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - // Freeze_Timer - if (Freeze_Timer <= diff) + if (!RootSelf) { - DoCast(me->getVictim(), SPELL_FREEZE); - Freeze_Timer = 16000; - } else Freeze_Timer -= diff; - - // Flamebreath_Timer - if (Flamebreath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAMEBREATH); - Flamebreath_Timer = 10500; - } else Flamebreath_Timer -= diff; - - //Summon Rend - if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11 - && me->GetHealth() > 0) - { - //summon Rend and Change model to normal Gyth - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - //Gyth model - me->SetDisplayId(9806); - me->SummonCreature(10429, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000); - SummonedRend = true; + //me->m_canMove = true; + DoCast(me, 33356); + RootSelf = true; } - DoMeleeAttackIfReady(); - } // end if Aggro - } + if (!bAggro && Line1Count == 0 && Line2Count == 0) + { + if (Aggro_Timer <= diff) + { + bAggro = true; + // Visible now! + me->SetDisplayId(9723); + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } else Aggro_Timer -= diff; + } + + // Summon Dragon pack. 2 Dragons and 3 Whelps + if (!bAggro && !SummonedRend && Line1Count > 0) + { + if (Dragons_Timer <= diff) + { + SummonCreatureWithRandomTarget(10372); + SummonCreatureWithRandomTarget(10372); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + Line1Count = Line1Count - 1; + Dragons_Timer = 60000; + } else Dragons_Timer -= diff; + } + + //Summon Orc pack. 1 Orc Handler 1 Elite Dragonkin and 3 Whelps + if (!bAggro && !SummonedRend && Line1Count == 0 && Line2Count > 0) + { + if (Orc_Timer <= diff) + { + SummonCreatureWithRandomTarget(10447); + SummonCreatureWithRandomTarget(10317); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + SummonCreatureWithRandomTarget(10442); + Line2Count = Line2Count - 1; + Orc_Timer = 60000; + } else Orc_Timer -= diff; + } + + // we take part in the fight + if (bAggro) + { + // CorrosiveAcid_Timer + if (CorrosiveAcid_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVEACID); + CorrosiveAcid_Timer = 7000; + } else CorrosiveAcid_Timer -= diff; + + // Freeze_Timer + if (Freeze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FREEZE); + Freeze_Timer = 16000; + } else Freeze_Timer -= diff; + + // Flamebreath_Timer + if (Flamebreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREATH); + Flamebreath_Timer = 10500; + } else Flamebreath_Timer -= diff; + + //Summon Rend + if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11 + && me->GetHealth() > 0) + { + //summon Rend and Change model to normal Gyth + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + //Gyth model + me->SetDisplayId(9806); + me->SummonCreature(10429, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000); + SummonedRend = true; + } + + DoMeleeAttackIfReady(); + } // end if Aggro + } + }; + }; -CreatureAI* GetAI_boss_gyth(Creature* pCreature) -{ - return new boss_gythAI (pCreature); -} void AddSC_boss_gyth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gyth"; - newscript->GetAI = &GetAI_boss_gyth; - newscript->RegisterSelf(); + new boss_gyth(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp index 679ec4d37a0..03776a564b1 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp @@ -32,67 +32,69 @@ EndScriptData */ #define ADD_1Y -324.961395 #define ADD_1Z 64.401443 #define ADD_1O 3.124724 - -struct boss_halyconAI : public ScriptedAI + class boss_halycon : public CreatureScript { - boss_halyconAI(Creature *c) : ScriptedAI(c) {} +public: + boss_halycon() : CreatureScript("boss_halycon") { } - uint32 CrowdPummel_Timer; - uint32 MightyBlow_Timer; - bool Summoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CrowdPummel_Timer = 8000; - MightyBlow_Timer = 14000; - Summoned = false; + return new boss_halyconAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_halyconAI : public ScriptedAI { - } + boss_halyconAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 CrowdPummel_Timer; + uint32 MightyBlow_Timer; + bool Summoned; - //CrowdPummel_Timer - if (CrowdPummel_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CROWDPUMMEL); - CrowdPummel_Timer = 14000; - } else CrowdPummel_Timer -= diff; - - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 10000; - } else MightyBlow_Timer -= diff; - - //Summon Gizrul - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25) - { - me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); - Summoned = true; + CrowdPummel_Timer = 8000; + MightyBlow_Timer = 14000; + Summoned = false; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //CrowdPummel_Timer + if (CrowdPummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CROWDPUMMEL); + CrowdPummel_Timer = 14000; + } else CrowdPummel_Timer -= diff; + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 10000; + } else MightyBlow_Timer -= diff; + + //Summon Gizrul + if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25) + { + me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000); + Summoned = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_halycon(Creature* pCreature) -{ - return new boss_halyconAI (pCreature); -} void AddSC_boss_halycon() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_halycon"; - newscript->GetAI = &GetAI_boss_halycon; - newscript->RegisterSelf(); + new boss_halycon(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp index 1b40580572b..759cafb0a0f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp @@ -32,103 +32,105 @@ EndScriptData */ #define SPELL_SUNDERARMOR 24317 #define SPELL_KNOCKAWAY 20686 #define SPELL_SLOW 22356 - -struct boss_highlordomokkAI : public ScriptedAI + class boss_highlord_omokk : public CreatureScript { - boss_highlordomokkAI(Creature *c) : ScriptedAI(c) {} +public: + boss_highlord_omokk() : CreatureScript("boss_highlord_omokk") { } - uint32 WarStomp_Timer; - uint32 Cleave_Timer; - uint32 Strike_Timer; - uint32 Rend_Timer; - uint32 SunderArmor_Timer; - uint32 KnockAway_Timer; - uint32 Slow_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WarStomp_Timer = 15000; - Cleave_Timer = 6000; - Strike_Timer = 10000; - Rend_Timer = 14000; - SunderArmor_Timer = 2000; - KnockAway_Timer = 18000; - Slow_Timer = 24000; + return new boss_highlordomokkAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_highlordomokkAI : public ScriptedAI { - } + boss_highlordomokkAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WarStomp_Timer; + uint32 Cleave_Timer; + uint32 Strike_Timer; + uint32 Rend_Timer; + uint32 SunderArmor_Timer; + uint32 KnockAway_Timer; + uint32 Slow_Timer; - //WarStomp_Timer - if (WarStomp_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = 14000; - } else WarStomp_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 8000; - } else Cleave_Timer -= diff; - - //Strike_Timer - if (Strike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_STRIKE); + WarStomp_Timer = 15000; + Cleave_Timer = 6000; Strike_Timer = 10000; - } else Strike_Timer -= diff; + Rend_Timer = 14000; + SunderArmor_Timer = 2000; + KnockAway_Timer = 18000; + Slow_Timer = 24000; + } - //Rend_Timer - if (Rend_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_REND); - Rend_Timer = 18000; - } else Rend_Timer -= diff; + } - //SunderArmor_Timer - if (SunderArmor_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SUNDERARMOR); - SunderArmor_Timer = 25000; - } else SunderArmor_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //KnockAway_Timer - if (KnockAway_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 12000; - } else KnockAway_Timer -= diff; + //WarStomp_Timer + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = 14000; + } else WarStomp_Timer -= diff; - //Slow_Timer - if (Slow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SLOW); - Slow_Timer = 18000; - } else Slow_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 8000; + } else Cleave_Timer -= diff; + + //Strike_Timer + if (Strike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STRIKE); + Strike_Timer = 10000; + } else Strike_Timer -= diff; + + //Rend_Timer + if (Rend_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REND); + Rend_Timer = 18000; + } else Rend_Timer -= diff; + + //SunderArmor_Timer + if (SunderArmor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDERARMOR); + SunderArmor_Timer = 25000; + } else SunderArmor_Timer -= diff; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 12000; + } else KnockAway_Timer -= diff; + + //Slow_Timer + if (Slow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SLOW); + Slow_Timer = 18000; + } else Slow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_highlordomokk(Creature* pCreature) -{ - return new boss_highlordomokkAI (pCreature); -} void AddSC_boss_highlordomokk() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_highlord_omokk"; - newscript->GetAI = &GetAI_boss_highlordomokk; - newscript->RegisterSelf(); + new boss_highlord_omokk(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp index 1f7d9d1dd18..8b41258ed0f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp @@ -28,62 +28,64 @@ EndScriptData */ #define SPELL_CRYSTALIZE 16104 #define SPELL_MOTHERSMILK 16468 #define SPELL_SUMMON_SPIRE_SPIDERLING 16103 - -struct boss_mothersmolderwebAI : public ScriptedAI + class boss_mother_smolderweb : public CreatureScript { - boss_mothersmolderwebAI(Creature *c) : ScriptedAI(c) {} +public: + boss_mother_smolderweb() : CreatureScript("boss_mother_smolderweb") { } - uint32 Crystalize_Timer; - uint32 MothersMilk_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Crystalize_Timer = 20000; - MothersMilk_Timer = 10000; + return new boss_mothersmolderwebAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) + struct boss_mothersmolderwebAI : public ScriptedAI { - if (me->GetHealth() <= damage) - DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true); - } + boss_mothersmolderwebAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Crystalize_Timer; + uint32 MothersMilk_Timer; - //Crystalize_Timer - if (Crystalize_Timer <= diff) + void Reset() { - DoCast(me, SPELL_CRYSTALIZE); - Crystalize_Timer = 15000; - } else Crystalize_Timer -= diff; + Crystalize_Timer = 20000; + MothersMilk_Timer = 10000; + } - //MothersMilk_Timer - if (MothersMilk_Timer <= diff) + void EnterCombat(Unit * /*who*/) {} + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - DoCast(me, SPELL_MOTHERSMILK); - MothersMilk_Timer = urand(5000,12500); - } else MothersMilk_Timer -= diff; + if (me->GetHealth() <= damage) + DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Crystalize_Timer + if (Crystalize_Timer <= diff) + { + DoCast(me, SPELL_CRYSTALIZE); + Crystalize_Timer = 15000; + } else Crystalize_Timer -= diff; + + //MothersMilk_Timer + if (MothersMilk_Timer <= diff) + { + DoCast(me, SPELL_MOTHERSMILK); + MothersMilk_Timer = urand(5000,12500); + } else MothersMilk_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_mothersmolderweb(Creature* pCreature) -{ - return new boss_mothersmolderwebAI (pCreature); -} void AddSC_boss_mothersmolderweb() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_mother_smolderweb"; - newscript->GetAI = &GetAI_boss_mothersmolderweb; - newscript->RegisterSelf(); + new boss_mother_smolderweb(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp index dd93ef85325..a1b87b42280 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -39,90 +39,92 @@ EndScriptData */ #define ADD_2Y -511.896942 #define ADD_2Z 88.195160 #define ADD_2O 4.613114 - -struct boss_overlordwyrmthalakAI : public ScriptedAI + class boss_overlord_wyrmthalak : public CreatureScript { - boss_overlordwyrmthalakAI(Creature *c) : ScriptedAI(c) {} +public: + boss_overlord_wyrmthalak() : CreatureScript("boss_overlord_wyrmthalak") { } - uint32 BlastWave_Timer; - uint32 Shout_Timer; - uint32 Cleave_Timer; - uint32 Knockaway_Timer; - bool Summoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BlastWave_Timer = 20000; - Shout_Timer = 2000; - Cleave_Timer = 6000; - Knockaway_Timer = 12000; - Summoned = false; + return new boss_overlordwyrmthalakAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_overlordwyrmthalakAI : public ScriptedAI { - } + boss_overlordwyrmthalakAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 BlastWave_Timer; + uint32 Shout_Timer; + uint32 Cleave_Timer; + uint32 Knockaway_Timer; + bool Summoned; - //BlastWave_Timer - if (BlastWave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_BLASTWAVE); BlastWave_Timer = 20000; - } else BlastWave_Timer -= diff; - - //Shout_Timer - if (Shout_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHOUT); - Shout_Timer = 10000; - } else Shout_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; - - //Knockaway_Timer - if (Knockaway_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - Knockaway_Timer = 14000; - } else Knockaway_Timer -= diff; - - //Summon two Beserks - if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true); - - if (Creature *SummonedCreature = me->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000)) - SummonedCreature->AI()->AttackStart(pTarget); - if (Creature *SummonedCreature = me->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000)) - SummonedCreature->AI()->AttackStart(pTarget); - Summoned = true; + Shout_Timer = 2000; + Cleave_Timer = 6000; + Knockaway_Timer = 12000; + Summoned = false; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //BlastWave_Timer + if (BlastWave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + BlastWave_Timer = 20000; + } else BlastWave_Timer -= diff; + + //Shout_Timer + if (Shout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOUT); + Shout_Timer = 10000; + } else Shout_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //Knockaway_Timer + if (Knockaway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + Knockaway_Timer = 14000; + } else Knockaway_Timer -= diff; + + //Summon two Beserks + if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true); + + if (Creature *SummonedCreature = me->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000)) + SummonedCreature->AI()->AttackStart(pTarget); + if (Creature *SummonedCreature = me->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000)) + SummonedCreature->AI()->AttackStart(pTarget); + Summoned = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_overlordwyrmthalak(Creature* pCreature) -{ - return new boss_overlordwyrmthalakAI (pCreature); -} void AddSC_boss_overlordwyrmthalak() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_overlord_wyrmthalak"; - newscript->GetAI = &GetAI_boss_overlordwyrmthalak; - newscript->RegisterSelf(); + new boss_overlord_wyrmthalak(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 267a590a307..eb9b52cb06a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_FIRENOVA 23462 #define SPELL_FLAMEBUFFET 23341 #define SPELL_PYROBLAST 17274 - -struct boss_pyroguard_emberseerAI : public ScriptedAI + class boss_pyroguard_emberseer : public CreatureScript { - boss_pyroguard_emberseerAI(Creature *c) : ScriptedAI(c) {} +public: + boss_pyroguard_emberseer() : CreatureScript("boss_pyroguard_emberseer") { } - uint32 FireNova_Timer; - uint32 FlameBuffet_Timer; - uint32 PyroBlast_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireNova_Timer = 6000; - FlameBuffet_Timer = 3000; - PyroBlast_Timer = 14000; + return new boss_pyroguard_emberseerAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_pyroguard_emberseerAI : public ScriptedAI { - } + boss_pyroguard_emberseerAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 FireNova_Timer; + uint32 FlameBuffet_Timer; + uint32 PyroBlast_Timer; - //FireNova_Timer - if (FireNova_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FIRENOVA); FireNova_Timer = 6000; - } else FireNova_Timer -= diff; + FlameBuffet_Timer = 3000; + PyroBlast_Timer = 14000; + } - //FlameBuffet_Timer - if (FlameBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FLAMEBUFFET); - FlameBuffet_Timer = 14000; - } else FlameBuffet_Timer -= diff; + } - //PyroBlast_Timer - if (PyroBlast_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_PYROBLAST); - PyroBlast_Timer = 15000; - } else PyroBlast_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 6000; + } else FireNova_Timer -= diff; + + //FlameBuffet_Timer + if (FlameBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBUFFET); + FlameBuffet_Timer = 14000; + } else FlameBuffet_Timer -= diff; + + //PyroBlast_Timer + if (PyroBlast_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_PYROBLAST); + PyroBlast_Timer = 15000; + } else PyroBlast_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_pyroguard_emberseer(Creature* pCreature) -{ - return new boss_pyroguard_emberseerAI (pCreature); -} void AddSC_boss_pyroguard_emberseer() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_pyroguard_emberseer"; - newscript->GetAI = &GetAI_boss_pyroguard_emberseer; - newscript->RegisterSelf(); + new boss_pyroguard_emberseer(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp index 4d46394a536..a8e2794cb46 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp @@ -29,60 +29,62 @@ EndScriptData */ #define SPELL_STUNBOMB 16497 #define SPELL_HEALING_POTION 15504 #define SPELL_HOOKEDNET 15609 - -struct boss_quatermasterzigrisAI : public ScriptedAI + class quartermaster_zigris : public CreatureScript { - boss_quatermasterzigrisAI(Creature *c) : ScriptedAI(c) {} +public: + quartermaster_zigris() : CreatureScript("quartermaster_zigris") { } - uint32 Shoot_Timer; - uint32 StunBomb_Timer; - //uint32 HelingPotion_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Shoot_Timer = 1000; - StunBomb_Timer = 16000; - //HelingPotion_Timer = 25000; + return new boss_quatermasterzigrisAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_quatermasterzigrisAI : public ScriptedAI { - } + boss_quatermasterzigrisAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Shoot_Timer; + uint32 StunBomb_Timer; + //uint32 HelingPotion_Timer; - //Shoot_Timer - if (Shoot_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHOOT); - Shoot_Timer = 500; - } else Shoot_Timer -= diff; + Shoot_Timer = 1000; + StunBomb_Timer = 16000; + //HelingPotion_Timer = 25000; + } - //StunBomb_Timer - if (StunBomb_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_STUNBOMB); - StunBomb_Timer = 14000; - } else StunBomb_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Shoot_Timer + if (Shoot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOOT); + Shoot_Timer = 500; + } else Shoot_Timer -= diff; + + //StunBomb_Timer + if (StunBomb_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STUNBOMB); + StunBomb_Timer = 14000; + } else StunBomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_quatermasterzigris(Creature* pCreature) -{ - return new boss_quatermasterzigrisAI (pCreature); -} void AddSC_boss_quatermasterzigris() { - Script *newscript; - newscript = new Script; - newscript->Name = "quartermaster_zigris"; - newscript->GetAI = &GetAI_boss_quatermasterzigris; - newscript->RegisterSelf(); + new quartermaster_zigris(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp index 4973246df79..95791197c9a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp @@ -28,67 +28,69 @@ EndScriptData */ #define SPELL_WHIRLWIND 26038 #define SPELL_CLEAVE 20691 #define SPELL_THUNDERCLAP 23931 //Not sure if he cast this spell - -struct boss_rend_blackhandAI : public ScriptedAI + class boss_rend_blackhand : public CreatureScript { - boss_rend_blackhandAI(Creature *c) : ScriptedAI(c) {} +public: + boss_rend_blackhand() : CreatureScript("boss_rend_blackhand") { } - uint32 WhirlWind_Timer; - uint32 Cleave_Timer; - uint32 Thunderclap_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 20000; - Cleave_Timer = 5000; - Thunderclap_Timer = 9000; + return new boss_rend_blackhandAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_rend_blackhandAI : public ScriptedAI { - } + boss_rend_blackhandAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WhirlWind_Timer; + uint32 Cleave_Timer; + uint32 Thunderclap_Timer; - //WhirlWind_Timer - if (WhirlWind_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_WHIRLWIND); - WhirlWind_Timer = 18000; - } else WhirlWind_Timer -= diff; + WhirlWind_Timer = 20000; + Cleave_Timer = 5000; + Thunderclap_Timer = 9000; + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 10000; - } else Cleave_Timer -= diff; + } - //Thunderclap_Timer - if (Thunderclap_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - Thunderclap_Timer = 16000; - } else Thunderclap_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //WhirlWind_Timer + if (WhirlWind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLWIND); + WhirlWind_Timer = 18000; + } else WhirlWind_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 10000; + } else Cleave_Timer -= diff; + + //Thunderclap_Timer + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 16000; + } else Thunderclap_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rend_blackhand(Creature* pCreature) -{ - return new boss_rend_blackhandAI (pCreature); -} void AddSC_boss_rend_blackhand() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rend_blackhand"; - newscript->GetAI = &GetAI_boss_rend_blackhand; - newscript->RegisterSelf(); + new boss_rend_blackhand(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp index b3470b43e21..5afe8585f9e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_CURSEOFBLOOD 24673 #define SPELL_HEX 16708 #define SPELL_CLEAVE 20691 - -struct boss_shadowvoshAI : public ScriptedAI + class boss_shadow_hunter_voshgajin : public CreatureScript { - boss_shadowvoshAI(Creature *c) : ScriptedAI(c) {} +public: + boss_shadow_hunter_voshgajin() : CreatureScript("boss_shadow_hunter_voshgajin") { } - uint32 CurseOfBlood_Timer; - uint32 Hex_Timer; - uint32 Cleave_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfBlood_Timer = 2000; - Hex_Timer = 8000; - Cleave_Timer = 14000; - - //DoCast(me, SPELL_ICEARMOR, true); + return new boss_shadowvoshAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - - void UpdateAI(const uint32 diff) + struct boss_shadowvoshAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_shadowvoshAI(Creature *c) : ScriptedAI(c) {} - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) + uint32 CurseOfBlood_Timer; + uint32 Hex_Timer; + uint32 Cleave_Timer; + + void Reset() { - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); - CurseOfBlood_Timer = 45000; - } else CurseOfBlood_Timer -= diff; + CurseOfBlood_Timer = 2000; + Hex_Timer = 8000; + Cleave_Timer = 14000; - //Hex_Timer - if (Hex_Timer <= diff) + //DoCast(me, SPELL_ICEARMOR, true); + } + + void EnterCombat(Unit * /*who*/){} + + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HEX); - Hex_Timer = 15000; - } else Hex_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + CurseOfBlood_Timer = 45000; + } else CurseOfBlood_Timer -= diff; + + //Hex_Timer + if (Hex_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HEX); + Hex_Timer = 15000; + } else Hex_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shadowvosh(Creature* pCreature) -{ - return new boss_shadowvoshAI (pCreature); -} void AddSC_boss_shadowvosh() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shadow_hunter_voshgajin"; - newscript->GetAI = &GetAI_boss_shadowvosh; - newscript->RegisterSelf(); + new boss_shadow_hunter_voshgajin(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp index 4af0dbc3a73..53abc0d1d65 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_FLAMEBREAK 16785 #define SPELL_IMMOLATE 20294 #define SPELL_TERRIFYINGROAR 14100 - -struct boss_thebeastAI : public ScriptedAI + class boss_the_beast : public CreatureScript { - boss_thebeastAI(Creature *c) : ScriptedAI(c) {} +public: + boss_the_beast() : CreatureScript("boss_the_beast") { } - uint32 Flamebreak_Timer; - uint32 Immolate_Timer; - uint32 TerrifyingRoar_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Flamebreak_Timer = 12000; - Immolate_Timer = 3000; - TerrifyingRoar_Timer = 23000; + return new boss_thebeastAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_thebeastAI : public ScriptedAI { - } + boss_thebeastAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Flamebreak_Timer; + uint32 Immolate_Timer; + uint32 TerrifyingRoar_Timer; - //Flamebreak_Timer - if (Flamebreak_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FLAMEBREAK); - Flamebreak_Timer = 10000; - } else Flamebreak_Timer -= diff; + Flamebreak_Timer = 12000; + Immolate_Timer = 3000; + TerrifyingRoar_Timer = 23000; + } - //Immolate_Timer - if (Immolate_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMMOLATE); - Immolate_Timer = 8000; - } else Immolate_Timer -= diff; + } - //TerrifyingRoar_Timer - if (TerrifyingRoar_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_TERRIFYINGROAR); - TerrifyingRoar_Timer = 20000; - } else TerrifyingRoar_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //Flamebreak_Timer + if (Flamebreak_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREAK); + Flamebreak_Timer = 10000; + } else Flamebreak_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMMOLATE); + Immolate_Timer = 8000; + } else Immolate_Timer -= diff; + + //TerrifyingRoar_Timer + if (TerrifyingRoar_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFYINGROAR); + TerrifyingRoar_Timer = 20000; + } else TerrifyingRoar_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_thebeast(Creature* pCreature) -{ - return new boss_thebeastAI (pCreature); -} void AddSC_boss_thebeast() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_the_beast"; - newscript->GetAI = &GetAI_boss_thebeast; - newscript->RegisterSelf(); + new boss_the_beast(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp index 7e05dec67cf..b0c7cd81f7a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp @@ -31,94 +31,96 @@ EndScriptData */ #define SPELL_MORTALSTRIKE 16856 #define SPELL_PUMMEL 15615 #define SPELL_THROWAXE 16075 - -struct boss_warmastervooneAI : public ScriptedAI + class boss_warmaster_voone : public CreatureScript { - boss_warmastervooneAI(Creature *c) : ScriptedAI(c) {} +public: + boss_warmaster_voone() : CreatureScript("boss_warmaster_voone") { } - uint32 Snapkick_Timer; - uint32 Cleave_Timer; - uint32 Uppercut_Timer; - uint32 MortalStrike_Timer; - uint32 Pummel_Timer; - uint32 ThrowAxe_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Snapkick_Timer = 8000; - Cleave_Timer = 14000; - Uppercut_Timer = 20000; - MortalStrike_Timer = 12000; - Pummel_Timer = 32000; - ThrowAxe_Timer = 1000; + return new boss_warmastervooneAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_warmastervooneAI : public ScriptedAI { - } + boss_warmastervooneAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Snapkick_Timer; + uint32 Cleave_Timer; + uint32 Uppercut_Timer; + uint32 MortalStrike_Timer; + uint32 Pummel_Timer; + uint32 ThrowAxe_Timer; - //Snapkick_Timer - if (Snapkick_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SNAPKICK); - Snapkick_Timer = 6000; - } else Snapkick_Timer -= diff; + Snapkick_Timer = 8000; + Cleave_Timer = 14000; + Uppercut_Timer = 20000; + MortalStrike_Timer = 12000; + Pummel_Timer = 32000; + ThrowAxe_Timer = 1000; + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 12000; - } else Cleave_Timer -= diff; + } - //Uppercut_Timer - if (Uppercut_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 14000; - } else Uppercut_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000; - } else MortalStrike_Timer -= diff; + //Snapkick_Timer + if (Snapkick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SNAPKICK); + Snapkick_Timer = 6000; + } else Snapkick_Timer -= diff; - //Pummel_Timer - if (Pummel_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PUMMEL); - Pummel_Timer = 16000; - } else Pummel_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 12000; + } else Cleave_Timer -= diff; - //ThrowAxe_Timer - if (ThrowAxe_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_THROWAXE); - ThrowAxe_Timer = 8000; - } else ThrowAxe_Timer -= diff; + //Uppercut_Timer + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 14000; + } else Uppercut_Timer -= diff; + + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 10000; + } else MortalStrike_Timer -= diff; + + //Pummel_Timer + if (Pummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PUMMEL); + Pummel_Timer = 16000; + } else Pummel_Timer -= diff; + + //ThrowAxe_Timer + if (ThrowAxe_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THROWAXE); + ThrowAxe_Timer = 8000; + } else ThrowAxe_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_warmastervoone(Creature* pCreature) -{ - return new boss_warmastervooneAI (pCreature); -} void AddSC_boss_warmastervoone() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_warmaster_voone"; - newscript->GetAI = &GetAI_boss_warmastervoone; - newscript->RegisterSelf(); + new boss_warmaster_voone(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp index 33e0ff49e5a..131e1cd88d9 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_broodlord_lashlayer.cpp @@ -32,83 +32,85 @@ EndScriptData */ #define SPELL_BLASTWAVE 23331 #define SPELL_MORTALSTRIKE 24573 #define SPELL_KNOCKBACK 25778 - -struct boss_broodlordAI : public ScriptedAI + class boss_broodlord : public CreatureScript { - boss_broodlordAI(Creature *c) : ScriptedAI(c) {} +public: + boss_broodlord() : CreatureScript("boss_broodlord") { } - uint32 Cleave_Timer; - uint32 BlastWave_Timer; - uint32 MortalStrike_Timer; - uint32 KnockBack_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cleave_Timer = 8000; //These times are probably wrong - BlastWave_Timer = 12000; - MortalStrike_Timer = 20000; - KnockBack_Timer = 30000; + return new boss_broodlordAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_broodlordAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - } + boss_broodlordAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Cleave_Timer; + uint32 BlastWave_Timer; + uint32 MortalStrike_Timer; + uint32 KnockBack_Timer; - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + Cleave_Timer = 8000; //These times are probably wrong + BlastWave_Timer = 12000; + MortalStrike_Timer = 20000; + KnockBack_Timer = 30000; + } - // BlastWave - if (BlastWave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_BLASTWAVE); - BlastWave_Timer = urand(8000,16000); - } else BlastWave_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + } - //MortalStrike_Timer - if (MortalStrike_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = urand(25000,35000); - } else MortalStrike_Timer -= diff; + if (!UpdateVictim()) + return; - if (KnockBack_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKBACK); - //Drop 50% aggro - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-50); + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; - KnockBack_Timer = urand(15000,30000); - } else KnockBack_Timer -= diff; + // BlastWave + if (BlastWave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + BlastWave_Timer = urand(8000,16000); + } else BlastWave_Timer -= diff; - if (EnterEvadeIfOutOfCombatArea(diff)) - DoScriptText(SAY_LEASH, me); + //MortalStrike_Timer + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = urand(25000,35000); + } else MortalStrike_Timer -= diff; + + if (KnockBack_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKBACK); + //Drop 50% aggro + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-50); + + KnockBack_Timer = urand(15000,30000); + } else KnockBack_Timer -= diff; + + if (EnterEvadeIfOutOfCombatArea(diff)) + DoScriptText(SAY_LEASH, me); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_broodlord(Creature* pCreature) -{ - return new boss_broodlordAI (pCreature); -} void AddSC_boss_broodlord() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_broodlord"; - newscript->GetAI = &GetAI_boss_broodlord; - newscript->RegisterSelf(); + new boss_broodlord(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index bc0e451932f..8c61db1c49c 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -58,246 +58,248 @@ enum Spells SPELL_FRENZY = 28371, //The frenzy spell may be wrong SPELL_ENRAGE = 28747 }; - -struct boss_chromaggusAI : public ScriptedAI + class boss_chromaggus : public CreatureScript { - boss_chromaggusAI(Creature *c) : ScriptedAI(c) +public: + boss_chromaggus() : CreatureScript("boss_chromaggus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - //Select the 2 breaths that we are going to use until despawned - //5 possiblities for the first breath, 4 for the second, 20 total possiblites - //This way we don't end up casting 2 of the same breath - //TL TL would be stupid - switch (urand(0,19)) - { - //B1 - Incin - case 0: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 1: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 2: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 3: - Breath1_Spell = SPELL_INCINERATE; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - TL - case 4: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_INCINERATE; - break; - case 5: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 6: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 7: - Breath1_Spell = SPELL_TIMELAPSE; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Acid - case 8: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_INCINERATE; - break; - case 9: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 10: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - case 11: - Breath1_Spell = SPELL_CORROSIVEACID; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Ignite - case 12: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_INCINERATE; - break; - case 13: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 14: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 15: - Breath1_Spell = SPELL_IGNITEFLESH; - Breath2_Spell = SPELL_FROSTBURN; - break; - - //B1 - Frost - case 16: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_INCINERATE; - break; - case 17: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_TIMELAPSE; - break; - case 18: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_CORROSIVEACID; - break; - case 19: - Breath1_Spell = SPELL_FROSTBURN; - Breath2_Spell = SPELL_IGNITEFLESH; - break; - }; - - EnterEvadeMode(); + return new boss_chromaggusAI (pCreature); } - uint32 Breath1_Spell; - uint32 Breath2_Spell; - uint32 CurrentVurln_Spell; - - uint32 Shimmer_Timer; - uint32 Breath1_Timer; - uint32 Breath2_Timer; - uint32 Affliction_Timer; - uint32 Frenzy_Timer; - bool Enraged; - - void Reset() + struct boss_chromaggusAI : public ScriptedAI { - CurrentVurln_Spell = 0; //We use this to store our last vulnerabilty spell so we can remove it later - - Shimmer_Timer = 0; //Time till we change vurlnerabilites - Breath1_Timer = 30000; //First breath is 30 seconds - Breath2_Timer = 60000; //Second is 1 minute so that we can alternate - Affliction_Timer = 10000; //This is special - 5 seconds means that we cast this on 1 player every 5 sconds - Frenzy_Timer = 15000; - - Enraged = false; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Shimmer_Timer Timer - if (Shimmer_Timer <= diff) + boss_chromaggusAI(Creature *c) : ScriptedAI(c) { - //Remove old vulnerabilty spell - if (CurrentVurln_Spell) - me->RemoveAurasDueToSpell(CurrentVurln_Spell); - - //Cast new random vulnerabilty on self - uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, - SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); - - DoCast(me, spell); - CurrentVurln_Spell = spell; - - DoScriptText(EMOTE_SHIMMER, me); - Shimmer_Timer = 45000; - } else Shimmer_Timer -= diff; - - //Breath1_Timer - if (Breath1_Timer <= diff) - { - DoCast(me->getVictim(), Breath1_Spell); - Breath1_Timer = 60000; - } else Breath1_Timer -= diff; - - //Breath2_Timer - if (Breath2_Timer <= diff) - { - DoCast(me->getVictim(), Breath2_Spell); - Breath2_Timer = 60000; - } else Breath2_Timer -= diff; - - //Affliction_Timer - if (Affliction_Timer <= diff) - { - std::list threatlist = me->getThreatManager().getThreatList(); - for (std::list::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) + //Select the 2 breaths that we are going to use until despawned + //5 possiblities for the first breath, 4 for the second, 20 total possiblites + //This way we don't end up casting 2 of the same breath + //TL TL would be stupid + switch (urand(0,19)) { - Unit* pUnit; - if ((*i) && (*i)->getSource()) + //B1 - Incin + case 0: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 1: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 2: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 3: + Breath1_Spell = SPELL_INCINERATE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - TL + case 4: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_INCINERATE; + break; + case 5: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 6: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 7: + Breath1_Spell = SPELL_TIMELAPSE; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Acid + case 8: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_INCINERATE; + break; + case 9: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 10: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + case 11: + Breath1_Spell = SPELL_CORROSIVEACID; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Ignite + case 12: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_INCINERATE; + break; + case 13: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 14: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 15: + Breath1_Spell = SPELL_IGNITEFLESH; + Breath2_Spell = SPELL_FROSTBURN; + break; + + //B1 - Frost + case 16: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_INCINERATE; + break; + case 17: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_TIMELAPSE; + break; + case 18: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_CORROSIVEACID; + break; + case 19: + Breath1_Spell = SPELL_FROSTBURN; + Breath2_Spell = SPELL_IGNITEFLESH; + break; + }; + + EnterEvadeMode(); + } + + uint32 Breath1_Spell; + uint32 Breath2_Spell; + uint32 CurrentVurln_Spell; + + uint32 Shimmer_Timer; + uint32 Breath1_Timer; + uint32 Breath2_Timer; + uint32 Affliction_Timer; + uint32 Frenzy_Timer; + bool Enraged; + + void Reset() + { + CurrentVurln_Spell = 0; //We use this to store our last vulnerabilty spell so we can remove it later + + Shimmer_Timer = 0; //Time till we change vurlnerabilites + Breath1_Timer = 30000; //First breath is 30 seconds + Breath2_Timer = 60000; //Second is 1 minute so that we can alternate + Affliction_Timer = 10000; //This is special - 5 seconds means that we cast this on 1 player every 5 sconds + Frenzy_Timer = 15000; + + Enraged = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Shimmer_Timer Timer + if (Shimmer_Timer <= diff) + { + //Remove old vulnerabilty spell + if (CurrentVurln_Spell) + me->RemoveAurasDueToSpell(CurrentVurln_Spell); + + //Cast new random vulnerabilty on self + uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY, + SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY); + + DoCast(me, spell); + CurrentVurln_Spell = spell; + + DoScriptText(EMOTE_SHIMMER, me); + Shimmer_Timer = 45000; + } else Shimmer_Timer -= diff; + + //Breath1_Timer + if (Breath1_Timer <= diff) + { + DoCast(me->getVictim(), Breath1_Spell); + Breath1_Timer = 60000; + } else Breath1_Timer -= diff; + + //Breath2_Timer + if (Breath2_Timer <= diff) + { + DoCast(me->getVictim(), Breath2_Spell); + Breath2_Timer = 60000; + } else Breath2_Timer -= diff; + + //Affliction_Timer + if (Affliction_Timer <= diff) + { + std::list threatlist = me->getThreatManager().getThreatList(); + for (std::list::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) { - pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit) + Unit* pUnit; + if ((*i) && (*i)->getSource()) { - //Cast affliction - DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, - SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); - - //Chromatic mutation if target is effected by all afflictions - if (pUnit->HasAura(SPELL_BROODAF_BLUE) - && pUnit->HasAura(SPELL_BROODAF_BLACK) - && pUnit->HasAura(SPELL_BROODAF_RED) - && pUnit->HasAura(SPELL_BROODAF_BRONZE) - && pUnit->HasAura(SPELL_BROODAF_GREEN)) + pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit) { - //pTarget->RemoveAllAuras(); - //DoCast(pTarget, SPELL_CHROMATIC_MUT_1); + //Cast affliction + DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, + SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); - //Chromatic mutation is causing issues - //Assuming it is caused by a lack of core support for Charm - //So instead we instant kill our target + //Chromatic mutation if target is effected by all afflictions + if (pUnit->HasAura(SPELL_BROODAF_BLUE) + && pUnit->HasAura(SPELL_BROODAF_BLACK) + && pUnit->HasAura(SPELL_BROODAF_RED) + && pUnit->HasAura(SPELL_BROODAF_BRONZE) + && pUnit->HasAura(SPELL_BROODAF_GREEN)) + { + //pTarget->RemoveAllAuras(); + //DoCast(pTarget, SPELL_CHROMATIC_MUT_1); - //WORKAROUND - if (pUnit->GetTypeId() == TYPEID_PLAYER) - pUnit->CastSpell(pUnit, 5, false); + //Chromatic mutation is causing issues + //Assuming it is caused by a lack of core support for Charm + //So instead we instant kill our target + + //WORKAROUND + if (pUnit->GetTypeId() == TYPEID_PLAYER) + pUnit->CastSpell(pUnit, 5, false); + } } } } + + Affliction_Timer = 10000; + } else Affliction_Timer -= diff; + + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_FRENZY, me); + Frenzy_Timer = urand(10000,15000); + } else Frenzy_Timer -= diff; + + //Enrage if not already enraged and below 20% + if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; } - Affliction_Timer = 10000; - } else Affliction_Timer -= diff; - - //Frenzy_Timer - if (Frenzy_Timer <= diff) - { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_FRENZY, me); - Frenzy_Timer = urand(10000,15000); - } else Frenzy_Timer -= diff; - - //Enrage if not already enraged and below 20% - if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_chromaggus(Creature* pCreature) -{ - return new boss_chromaggusAI (pCreature); -} void AddSC_boss_chromaggus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_chromaggus"; - newscript->GetAI = &GetAI_boss_chromaggus; - newscript->RegisterSelf(); + new boss_chromaggus(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp index 1eeb7b3a6ae..22f425d7be4 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_ebonroc.cpp @@ -29,78 +29,80 @@ EndScriptData */ #define SPELL_WINGBUFFET 18500 #define SPELL_SHADOWOFEBONROC 23340 #define SPELL_HEAL 41386 //Thea Heal spell of his Shadow - -struct boss_ebonrocAI : public ScriptedAI + class boss_ebonroc : public CreatureScript { - boss_ebonrocAI(Creature *c) : ScriptedAI(c) {} +public: + boss_ebonroc() : CreatureScript("boss_ebonroc") { } - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 ShadowOfEbonroc_Timer; - uint32 Heal_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 15000; //These times are probably wrong - WingBuffet_Timer = 30000; - ShadowOfEbonroc_Timer = 45000; - Heal_Timer = 1000; + return new boss_ebonrocAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ebonrocAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_ebonrocAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 ShadowOfEbonroc_Timer; + uint32 Heal_Timer; - //Shadowflame Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = urand(12000,15000); - } else ShadowFlame_Timer -= diff; - - //Wing Buffet Timer - if (WingBuffet_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; - - //Shadow of Ebonroc Timer - if (ShadowOfEbonroc_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWOFEBONROC); - ShadowOfEbonroc_Timer = urand(25000,350000); - } else ShadowOfEbonroc_Timer -= diff; - - if (me->getVictim()->HasAura(SPELL_SHADOWOFEBONROC)) - { - if (Heal_Timer <= diff) - { - DoCast(me, SPELL_HEAL); - Heal_Timer = urand(1000,3000); - } else Heal_Timer -= diff; + ShadowFlame_Timer = 15000; //These times are probably wrong + WingBuffet_Timer = 30000; + ShadowOfEbonroc_Timer = 45000; + Heal_Timer = 1000; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Shadowflame Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = urand(12000,15000); + } else ShadowFlame_Timer -= diff; + + //Wing Buffet Timer + if (WingBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WINGBUFFET); + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //Shadow of Ebonroc Timer + if (ShadowOfEbonroc_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWOFEBONROC); + ShadowOfEbonroc_Timer = urand(25000,350000); + } else ShadowOfEbonroc_Timer -= diff; + + if (me->getVictim()->HasAura(SPELL_SHADOWOFEBONROC)) + { + if (Heal_Timer <= diff) + { + DoCast(me, SPELL_HEAL); + Heal_Timer = urand(1000,3000); + } else Heal_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_ebonroc(Creature* pCreature) -{ - return new boss_ebonrocAI (pCreature); -} void AddSC_boss_ebonroc() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ebonroc"; - newscript->GetAI = &GetAI_boss_ebonroc; - newscript->RegisterSelf(); + new boss_ebonroc(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp index a9142a2049b..79952f76bf4 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_firemaw.cpp @@ -28,70 +28,72 @@ EndScriptData */ #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FLAMEBUFFET 23341 - -struct boss_firemawAI : public ScriptedAI + class boss_firemaw : public CreatureScript { - boss_firemawAI(Creature *c) : ScriptedAI(c) {} +public: + boss_firemaw() : CreatureScript("boss_firemaw") { } - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 FlameBuffet_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 30000; //These times are probably wrong - WingBuffet_Timer = 24000; - FlameBuffet_Timer = 5000; + return new boss_firemawAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_firemawAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_firemawAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 FlameBuffet_Timer; - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = urand(15000,18000); - } else ShadowFlame_Timer -= diff; - - //WingBuffet_Timer - if (WingBuffet_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-75); - - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; - - //FlameBuffet_Timer - if (FlameBuffet_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAMEBUFFET); + ShadowFlame_Timer = 30000; //These times are probably wrong + WingBuffet_Timer = 24000; FlameBuffet_Timer = 5000; - } else FlameBuffet_Timer -= diff; + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = urand(15000,18000); + } else ShadowFlame_Timer -= diff; + + //WingBuffet_Timer + if (WingBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WINGBUFFET); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-75); + + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //FlameBuffet_Timer + if (FlameBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBUFFET); + FlameBuffet_Timer = 5000; + } else FlameBuffet_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_firemaw(Creature* pCreature) -{ - return new boss_firemawAI (pCreature); -} void AddSC_boss_firemaw() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_firemaw"; - newscript->GetAI = &GetAI_boss_firemaw; - newscript->RegisterSelf(); + new boss_firemaw(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp index 32fc2d52b37..4653e87e4de 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_flamegor.cpp @@ -30,71 +30,73 @@ EndScriptData */ #define SPELL_SHADOWFLAME 22539 #define SPELL_WINGBUFFET 23339 #define SPELL_FRENZY 23342 //This spell periodically triggers fire nova - -struct boss_flamegorAI : public ScriptedAI + class boss_flamegor : public CreatureScript { - boss_flamegorAI(Creature *c) : ScriptedAI(c) {} +public: + boss_flamegor() : CreatureScript("boss_flamegor") { } - uint32 ShadowFlame_Timer; - uint32 WingBuffet_Timer; - uint32 Frenzy_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 21000; //These times are probably wrong - WingBuffet_Timer = 35000; - Frenzy_Timer = 10000; + return new boss_flamegorAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_flamegorAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_flamegorAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ShadowFlame_Timer; + uint32 WingBuffet_Timer; + uint32 Frenzy_Timer; - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = 15000 + rand()%7000; - } else ShadowFlame_Timer -= diff; + ShadowFlame_Timer = 21000; //These times are probably wrong + WingBuffet_Timer = 35000; + Frenzy_Timer = 10000; + } - //WingBuffet_Timer - if (WingBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WINGBUFFET); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-75); + DoZoneInCombat(); + } - WingBuffet_Timer = 25000; - } else WingBuffet_Timer -= diff; - - //Frenzy_Timer - if (Frenzy_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_FRENZY); - Frenzy_Timer = urand(8000, 10000); - } else Frenzy_Timer -= diff; + if (!UpdateVictim()) + return; + + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = 15000 + rand()%7000; + } else ShadowFlame_Timer -= diff; + + //WingBuffet_Timer + if (WingBuffet_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WINGBUFFET); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-75); + + WingBuffet_Timer = 25000; + } else WingBuffet_Timer -= diff; + + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_FRENZY); + Frenzy_Timer = urand(8000, 10000); + } else Frenzy_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_flamegor(Creature* pCreature) -{ - return new boss_flamegorAI (pCreature); -} void AddSC_boss_flamegor() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_flamegor"; - newscript->GetAI = &GetAI_boss_flamegor; - newscript->RegisterSelf(); + new boss_flamegor(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp index b78c999e0e5..4618b98c55e 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_nefarian.cpp @@ -59,175 +59,177 @@ EndScriptData */ #define SPELL_WARLOCK 23427 //infernals #define SPELL_HUNTER 23436 //bow broke #define SPELL_ROGUE 23414 //Paralise - -struct boss_nefarianAI : public ScriptedAI + class boss_nefarian : public CreatureScript { - boss_nefarianAI(Creature *c) : ScriptedAI(c) {} +public: + boss_nefarian() : CreatureScript("boss_nefarian") { } - uint32 ShadowFlame_Timer; - uint32 BellowingRoar_Timer; - uint32 VeilOfShadow_Timer; - uint32 Cleave_Timer; - uint32 TailLash_Timer; - uint32 ClassCall_Timer; - bool Phase3; - - uint32 DespawnTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowFlame_Timer = 12000; //These times are probably wrong - BellowingRoar_Timer = 30000; - VeilOfShadow_Timer = 15000; - Cleave_Timer = 7000; - TailLash_Timer = 10000; - ClassCall_Timer = 35000; //35-40 seconds - Phase3 = false; - - DespawnTimer = 5000; + return new boss_nefarianAI (pCreature); } - void KilledUnit(Unit* Victim) + struct boss_nefarianAI : public ScriptedAI { - if (rand()%5) - return; + boss_nefarianAI(Creature *c) : ScriptedAI(c) {} - DoScriptText(SAY_SLAY, me, Victim); - } + uint32 ShadowFlame_Timer; + uint32 BellowingRoar_Timer; + uint32 VeilOfShadow_Timer; + uint32 Cleave_Timer; + uint32 TailLash_Timer; + uint32 ClassCall_Timer; + bool Phase3; - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 DespawnTimer; - void EnterCombat(Unit * who) - { - DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), me); - - DoCast(who, SPELL_SHADOWFLAME_INITIAL); - DoZoneInCombat(); - } - - void UpdateAI(const uint32 diff) - { - if (DespawnTimer <= diff) + void Reset() { - if (!UpdateVictim()) - me->ForcedDespawn(); - DespawnTimer = 5000; - } else DespawnTimer -= diff; - - if (!UpdateVictim()) - return; - - //ShadowFlame_Timer - if (ShadowFlame_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWFLAME); - ShadowFlame_Timer = 12000; - } else ShadowFlame_Timer -= diff; - - //BellowingRoar_Timer - if (BellowingRoar_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BELLOWINGROAR); + ShadowFlame_Timer = 12000; //These times are probably wrong BellowingRoar_Timer = 30000; - } else BellowingRoar_Timer -= diff; - - //VeilOfShadow_Timer - if (VeilOfShadow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_VEILOFSHADOW); VeilOfShadow_Timer = 15000; - } else VeilOfShadow_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); Cleave_Timer = 7000; - } else Cleave_Timer -= diff; - - //TailLash_Timer - if (TailLash_Timer <= diff) - { - //Cast NYI since we need a better check for behind target - //DoCast(me->getVictim(), SPELL_TAILLASH); - TailLash_Timer = 10000; - } else TailLash_Timer -= diff; + ClassCall_Timer = 35000; //35-40 seconds + Phase3 = false; - //ClassCall_Timer - if (ClassCall_Timer <= diff) - { - //Cast a random class call - //On official it is based on what classes are currently on the hostil list - //but we can't do that yet so just randomly call one - - switch (urand(0,8)) - { - case 0: - DoScriptText(SAY_MAGE, me); - DoCast(me, SPELL_MAGE); - break; - case 1: - DoScriptText(SAY_WARRIOR, me); - DoCast(me, SPELL_WARRIOR); - break; - case 2: - DoScriptText(SAY_DRUID, me); - DoCast(me, SPELL_DRUID); - break; - case 3: - DoScriptText(SAY_PRIEST, me); - DoCast(me, SPELL_PRIEST); - break; - case 4: - DoScriptText(SAY_PALADIN, me); - DoCast(me, SPELL_PALADIN); - break; - case 5: - DoScriptText(SAY_SHAMAN, me); - DoCast(me, SPELL_SHAMAN); - break; - case 6: - DoScriptText(SAY_WARLOCK, me); - DoCast(me, SPELL_WARLOCK); - break; - case 7: - DoScriptText(SAY_HUNTER, me); - DoCast(me, SPELL_HUNTER); - break; - case 8: - DoScriptText(SAY_ROGUE, me); - DoCast(me, SPELL_ROGUE); - break; - } - - ClassCall_Timer = 35000 + (rand() % 5000); - } else ClassCall_Timer -= diff; - - //Phase3 begins when we are below X health - if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) - { - Phase3 = true; - DoScriptText(SAY_RAISE_SKELETONS, me); + DespawnTimer = 5000; } - DoMeleeAttackIfReady(); - } + void KilledUnit(Unit* Victim) + { + if (rand()%5) + return; + + DoScriptText(SAY_SLAY, me, Victim); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void EnterCombat(Unit * who) + { + DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), me); + + DoCast(who, SPELL_SHADOWFLAME_INITIAL); + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + if (DespawnTimer <= diff) + { + if (!UpdateVictim()) + me->ForcedDespawn(); + DespawnTimer = 5000; + } else DespawnTimer -= diff; + + if (!UpdateVictim()) + return; + + //ShadowFlame_Timer + if (ShadowFlame_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWFLAME); + ShadowFlame_Timer = 12000; + } else ShadowFlame_Timer -= diff; + + //BellowingRoar_Timer + if (BellowingRoar_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BELLOWINGROAR); + BellowingRoar_Timer = 30000; + } else BellowingRoar_Timer -= diff; + + //VeilOfShadow_Timer + if (VeilOfShadow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VEILOFSHADOW); + VeilOfShadow_Timer = 15000; + } else VeilOfShadow_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //TailLash_Timer + if (TailLash_Timer <= diff) + { + //Cast NYI since we need a better check for behind target + //DoCast(me->getVictim(), SPELL_TAILLASH); + + TailLash_Timer = 10000; + } else TailLash_Timer -= diff; + + //ClassCall_Timer + if (ClassCall_Timer <= diff) + { + //Cast a random class call + //On official it is based on what classes are currently on the hostil list + //but we can't do that yet so just randomly call one + + switch (urand(0,8)) + { + case 0: + DoScriptText(SAY_MAGE, me); + DoCast(me, SPELL_MAGE); + break; + case 1: + DoScriptText(SAY_WARRIOR, me); + DoCast(me, SPELL_WARRIOR); + break; + case 2: + DoScriptText(SAY_DRUID, me); + DoCast(me, SPELL_DRUID); + break; + case 3: + DoScriptText(SAY_PRIEST, me); + DoCast(me, SPELL_PRIEST); + break; + case 4: + DoScriptText(SAY_PALADIN, me); + DoCast(me, SPELL_PALADIN); + break; + case 5: + DoScriptText(SAY_SHAMAN, me); + DoCast(me, SPELL_SHAMAN); + break; + case 6: + DoScriptText(SAY_WARLOCK, me); + DoCast(me, SPELL_WARLOCK); + break; + case 7: + DoScriptText(SAY_HUNTER, me); + DoCast(me, SPELL_HUNTER); + break; + case 8: + DoScriptText(SAY_ROGUE, me); + DoCast(me, SPELL_ROGUE); + break; + } + + ClassCall_Timer = 35000 + (rand() % 5000); + } else ClassCall_Timer -= diff; + + //Phase3 begins when we are below X health + if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20) + { + Phase3 = true; + DoScriptText(SAY_RAISE_SKELETONS, me); + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_nefarian(Creature* pCreature) -{ - return new boss_nefarianAI (pCreature); -} void AddSC_boss_nefarian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nefarian"; - newscript->GetAI = &GetAI_boss_nefarian; - newscript->RegisterSelf(); + new boss_nefarian(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp index 59c4d2a6730..4a7d25ccb75 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_razorgore.cpp @@ -36,92 +36,94 @@ EndScriptData */ #define SPELL_WARSTOMP 24375 #define SPELL_FIREBALLVOLLEY 22425 #define SPELL_CONFLAGRATION 23023 - -struct boss_razorgoreAI : public ScriptedAI + class boss_razorgore : public CreatureScript { - boss_razorgoreAI(Creature *c) : ScriptedAI(c) {} +public: + boss_razorgore() : CreatureScript("boss_razorgore") { } - uint32 Cleave_Timer; - uint32 WarStomp_Timer; - uint32 FireballVolley_Timer; - uint32 Conflagration_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cleave_Timer = 15000; //These times are probably wrong - WarStomp_Timer = 35000; - FireballVolley_Timer = 7000; - Conflagration_Timer = 12000; + return new boss_razorgoreAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_razorgoreAI : public ScriptedAI { - DoZoneInCombat(); - } + boss_razorgoreAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 Cleave_Timer; + uint32 WarStomp_Timer; + uint32 FireballVolley_Timer; + uint32 Conflagration_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = urand(7000,10000); - } else Cleave_Timer -= diff; - - //WarStomp_Timer - if (WarStomp_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WARSTOMP); - WarStomp_Timer = urand(15000,25000); - } else WarStomp_Timer -= diff; - - //FireballVolley_Timer - if (FireballVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); - FireballVolley_Timer = urand(12000,15000); - } else FireballVolley_Timer -= diff; - - //Conflagration_Timer - if (Conflagration_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CONFLAGRATION); - //We will remove this threat reduction and add an aura check. - - //if (DoGetThreat(me->getVictim())) - //DoModifyThreatPercent(me->getVictim(),-50); - + Cleave_Timer = 15000; //These times are probably wrong + WarStomp_Timer = 35000; + FireballVolley_Timer = 7000; Conflagration_Timer = 12000; - } else Conflagration_Timer -= diff; + } - // Aura Check. If the gamer is affected by confliguration we attack a random gamer. - if (me->getVictim() && me->getVictim()->HasAura(SPELL_CONFLAGRATION)) - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - me->TauntApply(pTarget); + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = urand(7000,10000); + } else Cleave_Timer -= diff; + + //WarStomp_Timer + if (WarStomp_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WARSTOMP); + WarStomp_Timer = urand(15000,25000); + } else WarStomp_Timer -= diff; + + //FireballVolley_Timer + if (FireballVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY); + FireballVolley_Timer = urand(12000,15000); + } else FireballVolley_Timer -= diff; + + //Conflagration_Timer + if (Conflagration_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONFLAGRATION); + //We will remove this threat reduction and add an aura check. + + //if (DoGetThreat(me->getVictim())) + //DoModifyThreatPercent(me->getVictim(),-50); + + Conflagration_Timer = 12000; + } else Conflagration_Timer -= diff; + + // Aura Check. If the gamer is affected by confliguration we attack a random gamer. + if (me->getVictim() && me->getVictim()->HasAura(SPELL_CONFLAGRATION)) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + me->TauntApply(pTarget); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_razorgore(Creature* pCreature) -{ - return new boss_razorgoreAI (pCreature); -} void AddSC_boss_razorgore() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razorgore"; - newscript->GetAI = &GetAI_boss_razorgore; - newscript->RegisterSelf(); + new boss_razorgore(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp index bba4cac82f1..3f2c1643b72 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_vaelastrasz.cpp @@ -39,226 +39,225 @@ EndScriptData */ #define SPELL_TAILSWIPE 15847 #define SPELL_BURNINGADRENALINE 23620 #define SPELL_CLEAVE 20684 //Chain cleave is most likely named something different and contains a dummy effect - -struct boss_vaelAI : public ScriptedAI + class boss_vaelastrasz : public CreatureScript { - boss_vaelAI(Creature *c) : ScriptedAI(c) +public: + boss_vaelastrasz() : CreatureScript("boss_vaelastrasz") { } + + void SendDefaultMenu(Player* pPlayer, Creature* pCreature, uint32 uiAction) { - c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - c->setFaction(35); - c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - uint64 PlayerGUID; - uint32 SpeechTimer; - uint32 SpeechNum; - uint32 Cleave_Timer; - uint32 FlameBreath_Timer; - uint32 FireNova_Timer; - uint32 BurningAdrenalineCaster_Timer; - uint32 BurningAdrenalineTank_Timer; - uint32 TailSwipe_Timer; - bool HasYelled; - bool DoingSpeech; - - void Reset() - { - PlayerGUID = 0; - SpeechTimer = 0; - SpeechNum = 0; - Cleave_Timer = 8000; //These times are probably wrong - FlameBreath_Timer = 11000; - BurningAdrenalineCaster_Timer = 15000; - BurningAdrenalineTank_Timer = 45000; - FireNova_Timer = 5000; - TailSwipe_Timer = 20000; - HasYelled = false; - DoingSpeech = false; - } - - void BeginSpeech(Unit *pTarget) - { - //Stand up and begin speach - PlayerGUID = pTarget->GetGUID(); - - //10 seconds - DoScriptText(SAY_LINE1, me); - - SpeechTimer = 10000; - SpeechNum = 0; - DoingSpeech = true; - - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - } - - void KilledUnit(Unit * victim) - { - if (rand()%5) - return; - - DoScriptText(SAY_KILLTARGET, me, victim); - } - - void EnterCombat(Unit * /*who*/) - { - DoCast(me, SPELL_ESSENCEOFTHERED); - DoZoneInCombat(); - me->SetHealth(int(me->GetMaxHealth()*.3)); - } - - void UpdateAI(const uint32 diff) - { - //Speech - if (DoingSpeech) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time { - if (SpeechTimer <= diff) - { - switch (SpeechNum) - { - case 0: - //16 seconds till next line - DoScriptText(SAY_LINE2, me); - SpeechTimer = 16000; - ++SpeechNum; - break; - case 1: - //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" - DoScriptText(SAY_LINE3, me); - SpeechTimer = 10000; - ++SpeechNum; - break; - case 2: - me->setFaction(103); - if (PlayerGUID && Unit::GetUnit((*me),PlayerGUID)) - { - AttackStart(Unit::GetUnit((*me),PlayerGUID)); - DoCast(me, SPELL_ESSENCEOFTHERED); - } - SpeechTimer = 0; - DoingSpeech = false; - break; - } - } else SpeechTimer -= diff; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(boss_vaelastrasz::boss_vaelAI, pCreature->AI())->BeginSpeech(pPlayer); + } + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + { + if (uiSender == GOSSIP_SENDER_MAIN) + SendDefaultMenu(pPlayer, pCreature, uiAction); + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(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; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_vaelAI (pCreature); + } + + struct boss_vaelAI : public ScriptedAI + { + boss_vaelAI(Creature *c) : ScriptedAI(c) + { + c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + c->setFaction(35); + c->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - //Return since we have no target - if (!UpdateVictim()) - return; + uint64 PlayerGUID; + uint32 SpeechTimer; + uint32 SpeechNum; + uint32 Cleave_Timer; + uint32 FlameBreath_Timer; + uint32 FireNova_Timer; + uint32 BurningAdrenalineCaster_Timer; + uint32 BurningAdrenalineTank_Timer; + uint32 TailSwipe_Timer; + bool HasYelled; + bool DoingSpeech; - // Yell if hp lower than 15% - if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled) + void Reset() { - DoScriptText(SAY_HALFLIFE, me); - HasYelled = true; - } - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 15000; - } else Cleave_Timer -= diff; - - //FlameBreath_Timer - if (FlameBreath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAMEBREATH); - FlameBreath_Timer = urand(4000,8000); - } else FlameBreath_Timer -= diff; - - //BurningAdrenalineCaster_Timer - if (BurningAdrenalineCaster_Timer <= diff) - { - Unit *pTarget = NULL; - - uint8 i = 0; - while (i < 3) // max 3 tries to get a random target with power_mana - { - ++i; - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); //not aggro leader - if (pTarget && pTarget->getPowerType() == POWER_MANA) - i = 3; - } - if (pTarget) // cast on self (see below) - pTarget->CastSpell(pTarget,SPELL_BURNINGADRENALINE,1); - + PlayerGUID = 0; + SpeechTimer = 0; + SpeechNum = 0; + Cleave_Timer = 8000; //These times are probably wrong + FlameBreath_Timer = 11000; BurningAdrenalineCaster_Timer = 15000; - } else BurningAdrenalineCaster_Timer -= diff; - - //BurningAdrenalineTank_Timer - if (BurningAdrenalineTank_Timer <= diff) - { - // have the victim cast the spell on himself otherwise the third effect aura will be applied - // to Vael instead of the player - me->getVictim()->CastSpell(me->getVictim(),SPELL_BURNINGADRENALINE,1); - BurningAdrenalineTank_Timer = 45000; - } else BurningAdrenalineTank_Timer -= diff; - - //FireNova_Timer - if (FireNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FIRENOVA); FireNova_Timer = 5000; - } else FireNova_Timer -= diff; - - //TailSwipe_Timer - if (TailSwipe_Timer <= diff) - { - //Only cast if we are behind - /*if (!me->HasInArc(M_PI, me->getVictim())) - { - DoCast(me->getVictim(), SPELL_TAILSWIPE); - }*/ - TailSwipe_Timer = 20000; - } else TailSwipe_Timer -= diff; + HasYelled = false; + DoingSpeech = false; + } + + void BeginSpeech(Unit *pTarget) + { + //Stand up and begin speach + PlayerGUID = pTarget->GetGUID(); + + //10 seconds + DoScriptText(SAY_LINE1, me); + + SpeechTimer = 10000; + SpeechNum = 0; + DoingSpeech = true; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void KilledUnit(Unit * victim) + { + if (rand()%5) + return; + + DoScriptText(SAY_KILLTARGET, me, victim); + } + + void EnterCombat(Unit * /*who*/) + { + DoCast(me, SPELL_ESSENCEOFTHERED); + DoZoneInCombat(); + me->SetHealth(int(me->GetMaxHealth()*.3)); + } + + void UpdateAI(const uint32 diff) + { + //Speech + if (DoingSpeech) + { + if (SpeechTimer <= diff) + { + switch (SpeechNum) + { + case 0: + //16 seconds till next line + DoScriptText(SAY_LINE2, me); + SpeechTimer = 16000; + ++SpeechNum; + break; + case 1: + //This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!" + DoScriptText(SAY_LINE3, me); + SpeechTimer = 10000; + ++SpeechNum; + break; + case 2: + me->setFaction(103); + if (PlayerGUID && Unit::GetUnit((*me),PlayerGUID)) + { + AttackStart(Unit::GetUnit((*me),PlayerGUID)); + DoCast(me, SPELL_ESSENCEOFTHERED); + } + SpeechTimer = 0; + DoingSpeech = false; + break; + } + } else SpeechTimer -= diff; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + // Yell if hp lower than 15% + if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled) + { + DoScriptText(SAY_HALFLIFE, me); + HasYelled = true; + } + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 15000; + } else Cleave_Timer -= diff; + + //FlameBreath_Timer + if (FlameBreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMEBREATH); + FlameBreath_Timer = urand(4000,8000); + } else FlameBreath_Timer -= diff; + + //BurningAdrenalineCaster_Timer + if (BurningAdrenalineCaster_Timer <= diff) + { + Unit *pTarget = NULL; + + uint8 i = 0; + while (i < 3) // max 3 tries to get a random target with power_mana + { + ++i; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); //not aggro leader + if (pTarget && pTarget->getPowerType() == POWER_MANA) + i = 3; + } + if (pTarget) // cast on self (see below) + pTarget->CastSpell(pTarget,SPELL_BURNINGADRENALINE,1); + + BurningAdrenalineCaster_Timer = 15000; + } else BurningAdrenalineCaster_Timer -= diff; + + //BurningAdrenalineTank_Timer + if (BurningAdrenalineTank_Timer <= diff) + { + // have the victim cast the spell on himself otherwise the third effect aura will be applied + // to Vael instead of the player + me->getVictim()->CastSpell(me->getVictim(),SPELL_BURNINGADRENALINE,1); + + BurningAdrenalineTank_Timer = 45000; + } else BurningAdrenalineTank_Timer -= diff; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 5000; + } else FireNova_Timer -= diff; + + //TailSwipe_Timer + if (TailSwipe_Timer <= diff) + { + //Only cast if we are behind + /*if (!me->HasInArc(M_PI, me->getVictim())) + { + DoCast(me->getVictim(), SPELL_TAILSWIPE); + }*/ + + TailSwipe_Timer = 20000; + } else TailSwipe_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -void SendDefaultMenu_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(boss_vaelAI, pCreature->AI())->BeginSpeech(pPlayer); - } -} - -bool GossipSelect_boss_vael(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiSender == GOSSIP_SENDER_MAIN) - SendDefaultMenu_boss_vael(pPlayer, pCreature, uiAction); - - return true; -} - -bool GossipHello_boss_vael(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(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; -} - -CreatureAI* GetAI_boss_vael(Creature* pCreature) -{ - return new boss_vaelAI (pCreature); -} - void AddSC_boss_vael() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_vaelastrasz"; - newscript->GetAI = &GetAI_boss_vael; - newscript->pGossipHello = &GossipHello_boss_vael; - newscript->pGossipSelect = &GossipSelect_boss_vael; - newscript->RegisterSelf(); + new boss_vaelastrasz(); } - diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index d6a31cda4af..1c5afd1793b 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -68,320 +68,321 @@ EndScriptData */ //and allow players to start the event over //If nefarian dies then he will kill himself then he will kill himself in his hiding place //To prevent players from doing the event twice - -struct boss_victor_nefariusAI : public ScriptedAI + class boss_victor_nefarius : public CreatureScript { - boss_victor_nefariusAI(Creature *c) : ScriptedAI(c) +public: + boss_victor_nefarius() : CreatureScript("boss_victor_nefarius") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - NefarianGUID = 0; - switch (urand(0,19)) + switch (uiAction) { - case 0: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(7198, pCreature->GetGUID()); break; - case 1: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(7199, pCreature->GetGUID()); break; - case 2: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 3: - DrakType1 = CREATURE_BRONZE_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 4: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 5: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; - break; - case 6: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 7: - DrakType1 = CREATURE_BLUE_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 8: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 9: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 10: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 11: - DrakType1 = CREATURE_RED_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 12: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 13: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 14: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; - break; - case 15: - DrakType1 = CREATURE_GREEN_DRAKANOID; - DrakType2 = CREATURE_BLACK_DRAKANOID; - break; - case 16: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_BRONZE_DRAKANOID; - break; - case 17: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_BLUE_DRAKANOID; - break; - case 18: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_GREEN_DRAKANOID; - break; - case 19: - DrakType1 = CREATURE_BLACK_DRAKANOID; - DrakType2 = CREATURE_RED_DRAKANOID; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + DoScriptText(SAY_GAMESBEGIN_1, pCreature); + CAST_AI(boss_victor_nefarius::boss_victor_nefariusAI, pCreature->AI())->BeginEvent(pPlayer); break; } + return true; } - uint32 SpawnedAdds; - uint32 AddSpawnTimer; - uint32 ShadowBoltTimer; - uint32 FearTimer; - uint32 MindControlTimer; - uint32 ResetTimer; - uint32 DrakType1; - uint32 DrakType2; - uint64 NefarianGUID; - uint32 NefCheckTime; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - SpawnedAdds = 0; - AddSpawnTimer = 10000; - ShadowBoltTimer = 5000; - FearTimer = 8000; - ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier - NefarianGUID = 0; - NefCheckTime = 2000; - - me->SetUInt32Value(UNIT_NPC_FLAGS,1); - me->setFaction(35); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1 , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(7134, pCreature->GetGUID()); + return true; } - void BeginEvent(Player *pTarget) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_GAMESBEGIN_2, me); + return new boss_victor_nefariusAI (pCreature); + } - //Trinity::Singleton::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); - /* - list ::const_iterator i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); - - for (i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); i != sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().end(); ++i) + struct boss_victor_nefariusAI : public ScriptedAI + { + boss_victor_nefariusAI(Creature *c) : ScriptedAI(c) { - AttackStart((*i)); + NefarianGUID = 0; + switch (urand(0,19)) + { + case 0: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 1: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 2: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 3: + DrakType1 = CREATURE_BRONZE_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 4: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 5: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 6: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 7: + DrakType1 = CREATURE_BLUE_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 8: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 9: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 10: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 11: + DrakType1 = CREATURE_RED_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 12: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 13: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 14: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + case 15: + DrakType1 = CREATURE_GREEN_DRAKANOID; + DrakType2 = CREATURE_BLACK_DRAKANOID; + break; + case 16: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_BRONZE_DRAKANOID; + break; + case 17: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_BLUE_DRAKANOID; + break; + case 18: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_GREEN_DRAKANOID; + break; + case 19: + DrakType1 = CREATURE_BLACK_DRAKANOID; + DrakType2 = CREATURE_RED_DRAKANOID; + break; + } } - */ - me->SetUInt32Value(UNIT_NPC_FLAGS,0); - me->setFaction(103); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - AttackStart(pTarget); - } - void EnterCombat(Unit * /*who*/) - { - } + uint32 SpawnedAdds; + uint32 AddSpawnTimer; + uint32 ShadowBoltTimer; + uint32 FearTimer; + uint32 MindControlTimer; + uint32 ResetTimer; + uint32 DrakType1; + uint32 DrakType2; + uint64 NefarianGUID; + uint32 NefCheckTime; - void MoveInLineOfSight(Unit *who) - { - //We simply use this function to find players until we can use pMap->GetPlayers() - - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) + void Reset() { - //Add them to our threat list - me->AddThreat(who, 0.0f); + SpawnedAdds = 0; + AddSpawnTimer = 10000; + ShadowBoltTimer = 5000; + FearTimer = 8000; + ResetTimer = 900000; //On official it takes him 15 minutes(900 seconds) to reset. We are only doing 1 minute to make testing easier + NefarianGUID = 0; + NefCheckTime = 2000; + + me->SetUInt32Value(UNIT_NPC_FLAGS,1); + me->setFaction(35); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Only do this if we haven't spawned nef yet - if (SpawnedAdds < 42) + void BeginEvent(Player *pTarget) { - //ShadowBoltTimer - if (ShadowBoltTimer <= diff) + DoScriptText(SAY_GAMESBEGIN_2, me); + + //Trinity::Singleton::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); + /* + list ::const_iterator i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); + + for (i = sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().begin(); i != sMapMgr.GetMap(me->GetMapId(), me)->GetPlayers().end(); ++i) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SHADOWBOLT); + AttackStart((*i)); + } + */ + me->SetUInt32Value(UNIT_NPC_FLAGS,0); + me->setFaction(103); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + AttackStart(pTarget); + } - ShadowBoltTimer = urand(3000,10000); - } else ShadowBoltTimer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - //FearTimer - if (FearTimer <= diff) + void MoveInLineOfSight(Unit *who) + { + //We simply use this function to find players until we can use pMap->GetPlayers() + + if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_FEAR); + //Add them to our threat list + me->AddThreat(who, 0.0f); + } + } - FearTimer = 10000 + (rand()%10000); - } else FearTimer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; - //Add spawning mechanism - if (AddSpawnTimer <= diff) + //Only do this if we haven't spawned nef yet + if (SpawnedAdds < 42) { - //Spawn 2 random types of creatures at the 2 locations - uint32 CreatureID; - Creature* Spawned = NULL; - Unit *pTarget = NULL; - - //1 in 3 chance it will be a chromatic - if (urand(0,2) == 0) - CreatureID = CREATURE_CHROMATIC_DRAKANOID; - else - CreatureID = DrakType1; - - ++SpawnedAdds; - - //Spawn Creature and force it to start attacking a random target - Spawned = me->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Spawned) + //ShadowBoltTimer + if (ShadowBoltTimer <= diff) { - Spawned->AI()->AttackStart(pTarget); - Spawned->setFaction(103); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SHADOWBOLT); - //1 in 3 chance it will be a chromatic - if (urand(0,2) == 0) - CreatureID = CREATURE_CHROMATIC_DRAKANOID; - else - CreatureID = DrakType2; + ShadowBoltTimer = urand(3000,10000); + } else ShadowBoltTimer -= diff; - ++SpawnedAdds; - - Spawned = me->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Spawned) + //FearTimer + if (FearTimer <= diff) { - Spawned->AI()->AttackStart(pTarget); - Spawned->setFaction(103); - } + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_FEAR); - //Begin phase 2 by spawning Nefarian and what not - if (SpawnedAdds >= 42) + FearTimer = 10000 + (rand()%10000); + } else FearTimer -= diff; + + //Add spawning mechanism + if (AddSpawnTimer <= diff) { - //Teleport Victor Nefarius way out of the map - //sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0); + //Spawn 2 random types of creatures at the 2 locations + uint32 CreatureID; + Creature* Spawned = NULL; + Unit *pTarget = NULL; - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); + //1 in 3 chance it will be a chromatic + if (urand(0,2) == 0) + CreatureID = CREATURE_CHROMATIC_DRAKANOID; + else + CreatureID = DrakType1; - //Root self - DoCast(me, 33356); + ++SpawnedAdds; - //Make super invis - DoCast(me, 8149); - - //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) - DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z); - me->addUnitState(UNIT_STAT_FLEEING); - - //Spawn nef and have him attack a random target - Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); + //Spawn Creature and force it to start attacking a random target + Spawned = me->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget && Nefarian) + if (pTarget && Spawned) { - Nefarian->AI()->AttackStart(pTarget); - Nefarian->setFaction(103); - NefarianGUID = Nefarian->GetGUID(); + Spawned->AI()->AttackStart(pTarget); + Spawned->setFaction(103); } - else sLog.outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); - } - AddSpawnTimer = 4000; - } else AddSpawnTimer -= diff; - } - else if (NefarianGUID) - { - if (NefCheckTime <= diff) + //1 in 3 chance it will be a chromatic + if (urand(0,2) == 0) + CreatureID = CREATURE_CHROMATIC_DRAKANOID; + else + CreatureID = DrakType2; + + ++SpawnedAdds; + + Spawned = me->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget && Spawned) + { + Spawned->AI()->AttackStart(pTarget); + Spawned->setFaction(103); + } + + //Begin phase 2 by spawning Nefarian and what not + if (SpawnedAdds >= 42) + { + //Teleport Victor Nefarius way out of the map + //sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0); + + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + + //Root self + DoCast(me, 33356); + + //Make super invis + DoCast(me, 8149); + + //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) + DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z); + me->addUnitState(UNIT_STAT_FLEEING); + + //Spawn nef and have him attack a random target + Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget && Nefarian) + { + Nefarian->AI()->AttackStart(pTarget); + Nefarian->setFaction(103); + NefarianGUID = Nefarian->GetGUID(); + } + else sLog.outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly."); + } + + AddSpawnTimer = 4000; + } else AddSpawnTimer -= diff; + } + else if (NefarianGUID) { - Unit* Nefarian = Unit::GetCreature((*me),NefarianGUID); - - //If nef is dead then we die to so the players get out of combat - //and cannot repeat the event - if (!Nefarian || !Nefarian->isAlive()) + if (NefCheckTime <= diff) { - NefarianGUID = 0; - me->ForcedDespawn(); - } + Unit* Nefarian = Unit::GetCreature((*me),NefarianGUID); - NefCheckTime = 2000; - } else NefCheckTime -= diff; + //If nef is dead then we die to so the players get out of combat + //and cannot repeat the event + if (!Nefarian || !Nefarian->isAlive()) + { + NefarianGUID = 0; + me->ForcedDespawn(); + } + + NefCheckTime = 2000; + } else NefCheckTime -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_victor_nefarius(Creature* pCreature) -{ - return new boss_victor_nefariusAI (pCreature); -} -bool GossipHello_boss_victor_nefarius(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1 , GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(7134, pCreature->GetGUID()); - return true; -} -bool GossipSelect_boss_victor_nefarius(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(7198, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(7199, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - DoScriptText(SAY_GAMESBEGIN_1, pCreature); - CAST_AI(boss_victor_nefariusAI, pCreature->AI())->BeginEvent(pPlayer); - break; - } - return true; -} void AddSC_boss_victor_nefarius() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_victor_nefarius"; - newscript->GetAI = &GetAI_boss_victor_nefarius; - newscript->pGossipHello = &GossipHello_boss_victor_nefarius; - newscript->pGossipSelect = &GossipSelect_boss_victor_nefarius; - newscript->RegisterSelf(); + new boss_victor_nefarius(); } - diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 77fb826e9dd..ad8be719660 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -36,146 +36,149 @@ enum eSpels SAY_AGGRO = -1036001 }; - -struct boss_mr_smiteAI : public ScriptedAI + class boss_mr_smite : public CreatureScript { - boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_mr_smite() : CreatureScript("boss_mr_smite") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_mr_smiteAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiTrashTimer; - uint32 uiSlamTimer; - uint32 uiNimbleReflexesTimer; - - uint8 uiHealth; - - uint32 uiPhase; - uint32 uiTimer; - - void Reset() + struct boss_mr_smiteAI : public ScriptedAI { - uiTrashTimer = urand(5000,9000); - uiSlamTimer = 9000; - uiNimbleReflexesTimer = urand(15500,31600); - - uiHealth = 0; - - uiPhase = 0; - uiTimer = 0; - - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - } - - bool bCheckChances() - { - uint32 uiChances = urand(0,99); - if (uiChances <= 15) - return false; - else - return true; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - /*START ACID-AI*/ - if (uiTrashTimer <= uiDiff) + boss_mr_smiteAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (bCheckChances()) - DoCast(me, SPELL_TRASH); - uiTrashTimer = urand(6000,15500); - } else uiTrashTimer -= uiDiff; - - if (uiSlamTimer <= uiDiff) - { - if (bCheckChances()) - DoCast(me->getVictim(), SPELL_SMITE_SLAM); - uiSlamTimer = 11000; - } else uiSlamTimer -= uiDiff; - - if (uiNimbleReflexesTimer <= uiDiff) - { - if (bCheckChances()) - DoCast(me, SPELL_NIMBLE_REFLEXES); - uiNimbleReflexesTimer = urand(27300,60100); - } else uiNimbleReflexesTimer -= uiDiff; - /*END ACID-AI*/ - - if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33) - { - ++uiHealth; - DoCastAOE(SPELL_SMITE_STOMP,false); - SetCombatMovement(false); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST))) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ()); - } + pInstance = pCreature->GetInstanceScript(); } - if (uiPhase) + InstanceScript* pInstance; + + uint32 uiTrashTimer; + uint32 uiSlamTimer; + uint32 uiNimbleReflexesTimer; + + uint8 uiHealth; + + uint32 uiPhase; + uint32 uiTimer; + + void Reset() { - if (uiTimer <= uiDiff) + uiTrashTimer = urand(5000,9000); + uiSlamTimer = 9000; + uiNimbleReflexesTimer = urand(15500,31600); + + uiHealth = 0; + + uiPhase = 0; + uiTimer = 0; + + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + } + + bool bCheckChances() + { + uint32 uiChances = urand(0,99); + if (uiChances <= 15) + return false; + else + return true; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + /*START ACID-AI*/ + if (uiTrashTimer <= uiDiff) { - switch(uiPhase) - { - case 1: - me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? - uiTimer = 1000; - uiPhase = 2; - break; - case 2: - if (uiHealth == 1) - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); - else - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - uiTimer = 500; - uiPhase = 3; - break; - case 3: - SetCombatMovement(true); - me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); - uiPhase = 0; - break; + if (bCheckChances()) + DoCast(me, SPELL_TRASH); + uiTrashTimer = urand(6000,15500); + } else uiTrashTimer -= uiDiff; - } - } else uiTimer -= uiDiff; + if (uiSlamTimer <= uiDiff) + { + if (bCheckChances()) + DoCast(me->getVictim(), SPELL_SMITE_SLAM); + uiSlamTimer = 11000; + } else uiSlamTimer -= uiDiff; + + if (uiNimbleReflexesTimer <= uiDiff) + { + if (bCheckChances()) + DoCast(me, SPELL_NIMBLE_REFLEXES); + uiNimbleReflexesTimer = urand(27300,60100); + } else uiNimbleReflexesTimer -= uiDiff; + /*END ACID-AI*/ + + if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33) + { + ++uiHealth; + DoCastAOE(SPELL_SMITE_STOMP,false); + SetCombatMovement(false); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST))) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ()); + } + } + + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work? + uiTimer = 1000; + uiPhase = 2; + break; + case 2: + if (uiHealth == 1) + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + else + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + uiTimer = 500; + uiPhase = 3; + break; + case 3: + SetCombatMovement(true); + me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance); + uiPhase = 0; + break; + + } + } else uiTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + uiTimer = 1500; + uiPhase = 1; + } - uiTimer = 1500; - uiPhase = 1; - } + }; }; -CreatureAI* GetAI_boss_mr_smite(Creature* pCreature) -{ - return new boss_mr_smiteAI (pCreature); -} void AddSC_boss_mr_smite() { - Script* newscript; - newscript = new Script; - newscript->Name = "boss_mr_smite"; - newscript->GetAI = &GetAI_boss_mr_smite; - newscript->RegisterSelf(); + new boss_mr_smite(); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index 0540ae7194d..a94f264d96b 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -30,33 +30,35 @@ EndScriptData */ /*##### # item_Defias_Gunpowder #####*/ - -bool ItemUse_item_defias_gunpowder(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) + class item_defias_gunpowder : public ItemScript { - ScriptedInstance *pInstance = pPlayer->GetInstanceData(); +public: + item_defias_gunpowder() : ItemScript("item_defias_gunpowder") { } - if (!pInstance) + bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets) { - pPlayer->GetSession()->SendNotification("Instance script not initialized"); + InstanceScript *pInstance = pPlayer->GetInstanceScript(); + + if (!pInstance) + { + pPlayer->GetSession()->SendNotification("Instance script not initialized"); + return true; + } + if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED) + return false; + if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && + targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) + { + pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); + } + + pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); return true; } - if (pInstance->GetData(EVENT_STATE)!= CANNON_NOT_USED) - return false; - if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && - targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) - { - pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED); - } - pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true); - return true; -} +}; void AddSC_deadmines() { - Script *newscript; - newscript = new Script; - newscript->Name = "item_defias_gunpowder"; - newscript->pItemUse = &ItemUse_item_defias_gunpowder; - newscript->RegisterSelf(); + new item_defias_gunpowder(); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 4d5c11fa9f5..1a0686cfc3f 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -51,9 +51,9 @@ class instance_deadmines : public InstanceMapScript { } - struct instance_deadmines_InstanceMapScript : public ScriptedInstance + struct instance_deadmines_InstanceMapScript : public InstanceScript { - instance_deadmines_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; + instance_deadmines_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; uint64 FactoryDoorGUID; uint64 IronCladDoorGUID; @@ -251,7 +251,7 @@ class instance_deadmines : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_deadmines_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 776515891e4..3c85cc8b415 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -84,509 +84,514 @@ const Position SpawnPosition[] = {-495.240,-90.808,-149.493,3.238}, {-494.195,-89.553,-149.131,3.254} }; - -struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI + class npc_blastmaster_emi_shortfuse : public CreatureScript { - npc_blastmaster_emi_shortfuseAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_blastmaster_emi_shortfuse() : CreatureScript("npc_blastmaster_emi_shortfuse") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); - pCreature->RestoreFaction(); - Reset(); + return new npc_blastmaster_emi_shortfuseAI(pCreature); } - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiTimer; - - std::list SummonList; - std::list GoSummonList; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - uiTimer = 0; - uiPhase = 0; + if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuse::npc_blastmaster_emi_shortfuseAI, pCreature->AI())) + pEscortAI->Start(true, false,pPlayer->GetGUID()); - RestoreAll(); + pCreature->setFaction(pPlayer->getFaction()); + pCreature->AI()->SetData(1,0); - SummonList.clear(); - GoSummonList.clear(); + pPlayer->CLOSE_GOSSIP_MENU(); } + return true; } - void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - uiTimer = uiTimerStep; - if (bNextStep) - ++uiPhase; - else - uiPhase = uiPhaseStep; + InstanceScript* pInstance = pCreature->GetInstanceScript(); + + if (pInstance && pInstance->GetData(TYPE_EVENT) == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_EMI, pCreature->GetGUID()); + + return true; } - void CaveDestruction(bool bBool) + struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI { - if (GoSummonList.empty()) - return; - - for (std::list::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) + npc_blastmaster_emi_shortfuseAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) - { - if (pGo) - { - if (Creature *trigger = pGo->SummonTrigger(pGo->GetPositionX(), pGo->GetPositionY(),pGo->GetPositionZ(), 0, 1)) - { - //visual effects are not working! ¬¬ - trigger->CastSpell(trigger,11542,true); - trigger->CastSpell(trigger,35470,true); - } - pGo->RemoveFromWorld(); - //pGo->CastSpell(me,12158); makes all die?! - } - } + pInstance = pCreature->GetInstanceScript(); + pCreature->RestoreFaction(); + Reset(); } - if (bBool) - { - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,false,pGo); - }else - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,false,pGo); - } + InstanceScript* pInstance; - void SetInFace(bool bBool) - { - if (!pInstance) - return; + uint8 uiPhase; + uint32 uiTimer; - if (bBool) + std::list SummonList; + std::list GoSummonList; + + void Reset() { - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - me->SetFacingToObject(pGo); - }else - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - me->SetFacingToObject(pGo); - } + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + uiTimer = 0; + uiPhase = 0; - void RestoreAll() - { - if (!pInstance) - return; + RestoreAll(); - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,false,pGo); + SummonList.clear(); + GoSummonList.clear(); + } + } - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,false,pGo); + void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + { + uiTimer = uiTimerStep; + if (bNextStep) + ++uiPhase; + else + uiPhase = uiPhaseStep; + } + + void CaveDestruction(bool bBool) + { + if (GoSummonList.empty()) + return; - if (!GoSummonList.empty()) for (std::list::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { - if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) - pGo->RemoveFromWorld(); + if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) + { + if (pGo) + { + if (Creature *trigger = pGo->SummonTrigger(pGo->GetPositionX(), pGo->GetPositionY(),pGo->GetPositionZ(), 0, 1)) + { + //visual effects are not working! ¬¬ + trigger->CastSpell(trigger,11542,true); + trigger->CastSpell(trigger,35470,true); + } + pGo->RemoveFromWorld(); + //pGo->CastSpell(me,12158); makes all die?! + } + } } - if (!SummonList.empty()) - for (std::list::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) - { - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - { - if (pSummon->isAlive()) - pSummon->DisappearAndDie(); - else - pSummon->RemoveCorpse(); - } - } - } + if (bBool) + { + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,false,pGo); + }else + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,false,pGo); + } - void AggroAllPlayers(Creature* pTemp) - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - - if (PlList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + void SetInFace(bool bBool) { - if (Player* pPlayer = i->getSource()) - { - if (pPlayer->isGameMaster()) - continue; + if (!pInstance) + return; - if (pPlayer->isAlive()) + if (bBool) + { + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + me->SetFacingToObject(pGo); + }else + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + me->SetFacingToObject(pGo); + } + + void RestoreAll() + { + if (!pInstance) + return; + + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,false,pGo); + + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,false,pGo); + + if (!GoSummonList.empty()) + for (std::list::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { - pTemp->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(pTemp); - pTemp->AddThreat(pPlayer, 0.0f); + if (GameObject* pGo = GameObject::GetGameObject(*me, *itr)) + pGo->RemoveFromWorld(); + } + + if (!SummonList.empty()) + for (std::list::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + { + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + { + if (pSummon->isAlive()) + pSummon->DisappearAndDie(); + else + pSummon->RemoveCorpse(); + } + } + } + + void AggroAllPlayers(Creature* pTemp) + { + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + { + if (Player* pPlayer = i->getSource()) + { + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + { + pTemp->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(pTemp); + pTemp->AddThreat(pPlayer, 0.0f); + } } } } - } - void WaypointReached(uint32 uiPoint) - { - //just in case - if (GetPlayerForEscort()) - if (me->getFaction() != GetPlayerForEscort()->getFaction()) - me->setFaction(GetPlayerForEscort()->getFaction()); - - switch(uiPoint) + void WaypointReached(uint32 uiPoint) { - case 3: - SetEscortPaused(true); - NextStep(2000,false,3); - break; - case 7: - SetEscortPaused(true); - NextStep(2000,false,4); - break; - case 9: - NextStep(1000,false,8); - break; - case 10: - NextStep(25000,false,10); - break; - case 11: - SetEscortPaused(true); - SetInFace(true); - NextStep(1000,false,11); - break; - case 12: - NextStep(25000,false,18); - break; - case 13: - Summon(7); - NextStep(25000,false,19); - break; - case 14: - SetInFace(false); - DoScriptText(SAY_BLASTMASTER_26,me); - SetEscortPaused(true); - NextStep(5000,false,20); - break; - } - } + //just in case + if (GetPlayerForEscort()) + if (me->getFaction() != GetPlayerForEscort()->getFaction()) + me->setFaction(GetPlayerForEscort()->getFaction()); - void SetData(uint32 uiI,uint32 uiValue) - { - switch(uiI) - { - case 1: - SetEscortPaused(true); - DoScriptText(SAY_BLASTMASTER_0,me); - NextStep(1500,true); - break; - case 2: - if (!pInstance) - return; - - switch(uiValue) - { - case 1: - pInstance->SetData(TYPE_EVENT, IN_PROGRESS); - break; - case 2: - pInstance->SetData(TYPE_EVENT, DONE); - NextStep(5000,false,22); - break; - } - break; - } - } - - void Summon(uint8 uiCase) - { - switch(uiCase) - { - case 1: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; - case 2: - if (GameObject* pGo = me->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! - } - Summon(3); - break; - case 3: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_19,me); - break; - case 4: - if (GameObject* pGo = me->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - } - break; - case 5: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - DoScriptText(SAY_BLASTMASTER_15,me); - break; - case 6: - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; - case 7: - if (GameObject* pGo = me->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! - Summon(6); - } - break; - case 8: - if (GameObject* pGo = me->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000)) - { - GoSummonList.push_back(pGo->GetGUID()); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! - } - break; - case 9: - if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) - DoScriptText(SAY_GRUBBIS,pGrubbis); - me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); - break; - } - } - - void UpdateEscortAI(const uint32 uiDiff) - { - if (uiPhase) - { - if (uiTimer <= uiDiff) + switch(uiPoint) { - switch(uiPhase) - { - case 1: - DoScriptText(SAY_BLASTMASTER_1,me); - NextStep(1500,true); - break; - case 2: - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 3: - DoScriptText(SAY_BLASTMASTER_2,me); - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 4: - DoScriptText(SAY_BLASTMASTER_3,me); - NextStep(3000,true); - break; - case 5: - DoScriptText(SAY_BLASTMASTER_4,me); - NextStep(3000,true); - break; - case 6: - SetInFace(true); - DoScriptText(SAY_BLASTMASTER_5,me); - Summon(1); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - pInstance->HandleGameObject(NULL,true,pGo); - NextStep(3000,true); - break; - case 7: - DoScriptText(SAY_BLASTMASTER_6,me); - SetEscortPaused(false); - NextStep(0,false,0); - break; - case 8: - me->HandleEmoteCommand(EMOTE_STATE_WORK); - NextStep(25000,true); - break; - case 9: - Summon(2); - NextStep(0,false); - break; - case 10: - Summon(4); - NextStep(0,false); - break; - case 11: - DoScriptText(SAY_BLASTMASTER_17,me); - NextStep(5000,true); - break; - case 12: - DoScriptText(SAY_BLASTMASTER_18,me); - NextStep(5000,true); - break; - case 13: - DoScriptText(SAY_BLASTMASTER_20,me); - CaveDestruction(true); - NextStep(8000,true); - break; - case 14: - DoScriptText(SAY_BLASTMASTER_21,me); - NextStep(8500,true); - break; - case 15: - DoScriptText(SAY_BLASTMASTER_22,me); - NextStep(2000,true); - break; - case 16: - DoScriptText(SAY_BLASTMASTER_23,me); - SetInFace(false); - if (pInstance) - if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) - pInstance->HandleGameObject(NULL,true,pGo); - NextStep(2000,true); - break; - case 17: - SetEscortPaused(false); - DoScriptText(SAY_BLASTMASTER_24,me); + case 3: + SetEscortPaused(true); + NextStep(2000,false,3); + break; + case 7: + SetEscortPaused(true); + NextStep(2000,false,4); + break; + case 9: + NextStep(1000,false,8); + break; + case 10: + NextStep(25000,false,10); + break; + case 11: + SetEscortPaused(true); + SetInFace(true); + NextStep(1000,false,11); + break; + case 12: + NextStep(25000,false,18); + break; + case 13: + Summon(7); + NextStep(25000,false,19); + break; + case 14: + SetInFace(false); + DoScriptText(SAY_BLASTMASTER_26,me); + SetEscortPaused(true); + NextStep(5000,false,20); + break; + } + } + + void SetData(uint32 uiI,uint32 uiValue) + { + switch(uiI) + { + case 1: + SetEscortPaused(true); + DoScriptText(SAY_BLASTMASTER_0,me); + NextStep(1500,true); + break; + case 2: + if (!pInstance) + return; + + switch(uiValue) + { + case 1: + pInstance->SetData(TYPE_EVENT, IN_PROGRESS); + break; + case 2: + pInstance->SetData(TYPE_EVENT, DONE); + NextStep(5000,false,22); + break; + } + break; + } + } + + void Summon(uint8 uiCase) + { + switch(uiCase) + { + case 1: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + case 2: + if (GameObject* pGo = me->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + } + Summon(3); + break; + case 3: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + DoScriptText(SAY_BLASTMASTER_19,me); + break; + case 4: + if (GameObject* pGo = me->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + } + break; + case 5: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + DoScriptText(SAY_BLASTMASTER_15,me); + break; + case 6: + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + case 7: + if (GameObject* pGo = me->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! Summon(6); - NextStep(0,false); - break; - case 18: - Summon(7); - NextStep(0,false); - break; - case 19: - SetInFace(false); - Summon(8); - DoScriptText(SAY_BLASTMASTER_25,me); - NextStep(0,false); - break; - case 20: - DoScriptText(SAY_BLASTMASTER_27,me); - NextStep(2000,true); - break; - case 21: - Summon(9); - NextStep(0,false); - break; - case 22: - CaveDestruction(false); - DoScriptText(SAY_BLASTMASTER_20,me); - NextStep(0,false); - break; - } - } else uiTimer -= uiDiff; + } + break; + case 8: + if (GameObject* pGo = me->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000)) + { + GoSummonList.push_back(pGo->GetGUID()); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it! + } + break; + case 9: + if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) + DoScriptText(SAY_GRUBBIS,pGrubbis); + me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); + break; + } } - if (!UpdateVictim()) - return; + void UpdateEscortAI(const uint32 uiDiff) + { + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + DoScriptText(SAY_BLASTMASTER_1,me); + NextStep(1500,true); + break; + case 2: + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 3: + DoScriptText(SAY_BLASTMASTER_2,me); + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 4: + DoScriptText(SAY_BLASTMASTER_3,me); + NextStep(3000,true); + break; + case 5: + DoScriptText(SAY_BLASTMASTER_4,me); + NextStep(3000,true); + break; + case 6: + SetInFace(true); + DoScriptText(SAY_BLASTMASTER_5,me); + Summon(1); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + pInstance->HandleGameObject(NULL,true,pGo); + NextStep(3000,true); + break; + case 7: + DoScriptText(SAY_BLASTMASTER_6,me); + SetEscortPaused(false); + NextStep(0,false,0); + break; + case 8: + me->HandleEmoteCommand(EMOTE_STATE_WORK); + NextStep(25000,true); + break; + case 9: + Summon(2); + NextStep(0,false); + break; + case 10: + Summon(4); + NextStep(0,false); + break; + case 11: + DoScriptText(SAY_BLASTMASTER_17,me); + NextStep(5000,true); + break; + case 12: + DoScriptText(SAY_BLASTMASTER_18,me); + NextStep(5000,true); + break; + case 13: + DoScriptText(SAY_BLASTMASTER_20,me); + CaveDestruction(true); + NextStep(8000,true); + break; + case 14: + DoScriptText(SAY_BLASTMASTER_21,me); + NextStep(8500,true); + break; + case 15: + DoScriptText(SAY_BLASTMASTER_22,me); + NextStep(2000,true); + break; + case 16: + DoScriptText(SAY_BLASTMASTER_23,me); + SetInFace(false); + if (pInstance) + if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT))) + pInstance->HandleGameObject(NULL,true,pGo); + NextStep(2000,true); + break; + case 17: + SetEscortPaused(false); + DoScriptText(SAY_BLASTMASTER_24,me); + Summon(6); + NextStep(0,false); + break; + case 18: + Summon(7); + NextStep(0,false); + break; + case 19: + SetInFace(false); + Summon(8); + DoScriptText(SAY_BLASTMASTER_25,me); + NextStep(0,false); + break; + case 20: + DoScriptText(SAY_BLASTMASTER_27,me); + NextStep(2000,true); + break; + case 21: + Summon(9); + NextStep(0,false); + break; + case 22: + CaveDestruction(false); + DoScriptText(SAY_BLASTMASTER_20,me); + NextStep(0,false); + break; + } + } else uiTimer -= uiDiff; + } - DoMeleeAttackIfReady(); - } + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustSummoned(Creature* pSummon) + { + SummonList.push_back(pSummon->GetGUID()); + AggroAllPlayers(pSummon); + } + }; - void JustSummoned(Creature* pSummon) - { - SummonList.push_back(pSummon->GetGUID()); - AggroAllPlayers(pSummon); - } }; -CreatureAI* GetAI_npc_blastmaster_emi_shortfuse(Creature* pCreature) + + + class boss_grubbis : public CreatureScript { - return new npc_blastmaster_emi_shortfuseAI(pCreature); -} +public: + boss_grubbis() : CreatureScript("boss_grubbis") { } -bool GossipHello_npc_blastmaster_emi_shortfuse(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - - if (pInstance && pInstance->GetData(TYPE_EVENT) == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_EMI, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_blastmaster_emi_shortfuse(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + CreatureAI* GetAI(Creature* pCreature) const { - if (npc_escortAI* pEscortAI = CAST_AI(npc_blastmaster_emi_shortfuseAI, pCreature->AI())) - pEscortAI->Start(true, false,pPlayer->GetGUID()); - - pCreature->setFaction(pPlayer->getFaction()); - pCreature->AI()->SetData(1,0); - - pPlayer->CLOSE_GOSSIP_MENU(); - } - return true; -} - -struct boss_grubbisAI : public ScriptedAI -{ - boss_grubbisAI(Creature* pCreature) : ScriptedAI(pCreature) - { - SetDataSummoner(); + return new boss_grubbisAI(pCreature); } - void SetDataSummoner() + struct boss_grubbisAI : public ScriptedAI { - if (!me->isSummon()) - return; + boss_grubbisAI(Creature* pCreature) : ScriptedAI(pCreature) + { + SetDataSummoner(); + } - if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) - CAST_CRE(pSummon)->AI()->SetData(2,1); - } + void SetDataSummoner() + { + if (!me->isSummon()) + return; - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; + if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) + CAST_CRE(pSummon)->AI()->SetData(2,1); + } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; - void JustDied(Unit* /*pKiller*/) - { - if (!me->isSummon()) - return; + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (!me->isSummon()) + return; + + if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) + CAST_CRE(pSummon)->AI()->SetData(2,2); + } + }; - if (Unit* pSummon = CAST_SUM(me)->GetSummoner()) - CAST_CRE(pSummon)->AI()->SetData(2,2); - } }; -CreatureAI* GetAI_boss_grubbis(Creature* pCreature) -{ - return new boss_grubbisAI(pCreature); -} void AddSC_gnomeregan() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_blastmaster_emi_shortfuse"; - newscript->pGossipHello = &GossipHello_npc_blastmaster_emi_shortfuse; - newscript->pGossipSelect = &GossipSelect_npc_blastmaster_emi_shortfuse; - newscript->GetAI = &GetAI_npc_blastmaster_emi_shortfuse; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_grubbis"; - newscript->GetAI = &GetAI_boss_grubbis; - newscript->RegisterSelf(); + new npc_blastmaster_emi_shortfuse(); + new boss_grubbis(); } diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index c678fc55140..90fbd5e3451 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -19,122 +19,124 @@ #include "gnomeregan.h" #define MAX_ENCOUNTER 1 - -struct instance_gnomeregan : public ScriptedInstance + class instance_gnomeregan : public InstanceMapScript { - instance_gnomeregan(Map* pMap) : ScriptedInstance(pMap) +public: + instance_gnomeregan() : InstanceMapScript("instance_gnomeregan") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - Initialize(); + return new instance_gnomeregan_InstanceMapScript(pMap); + } + + struct instance_gnomeregan_InstanceMapScript : public InstanceScript + { + instance_gnomeregan_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + Initialize(); + }; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint64 uiCaveInLeftGUID; + uint64 uiCaveInRightGUID; + + uint64 uiBastmasterEmiShortfuseGUID; + + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + uiCaveInLeftGUID = 0; + uiCaveInRightGUID = 0; + + uiBastmasterEmiShortfuseGUID = 0; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0]; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + + OUT_LOAD_INST_DATA_COMPLETE; + } + + void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) + { + switch(pCreature->GetEntry()) + { + case NPC_BLASTMASTER_EMI_SHORTFUSE: uiBastmasterEmiShortfuseGUID = pCreature->GetGUID(); break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) + { + switch(pGo->GetEntry()) + { + case GO_CAVE_IN_LEFT: + uiCaveInLeftGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) + HandleGameObject(NULL,false,pGo); + break; + case GO_CAVE_IN_RIGHT: + uiCaveInRightGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) + HandleGameObject(NULL,false,pGo); + break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_EVENT: + m_auiEncounter[0] = uiData; + if (uiData == DONE) + SaveToDB(); + break; + } + } + + uint32 GetData(uint32 uiType, uint32 /*uiData*/) + { + switch(uiType) + { + case TYPE_EVENT: return m_auiEncounter[0]; + } + } + + uint64 GetData64(uint32 uiType) + { + switch(uiType) + { + case DATA_GO_CAVE_IN_LEFT: return uiCaveInLeftGUID; + case DATA_GO_CAVE_IN_RIGHT: return uiCaveInRightGUID; + case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID; + } + + return 0; + } }; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 uiCaveInLeftGUID; - uint64 uiCaveInRightGUID; - - uint64 uiBastmasterEmiShortfuseGUID; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - uiCaveInLeftGUID = 0; - uiCaveInRightGUID = 0; - - uiBastmasterEmiShortfuseGUID = 0; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } - - OUT_LOAD_INST_DATA_COMPLETE; - } - - void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) - { - switch(pCreature->GetEntry()) - { - case NPC_BLASTMASTER_EMI_SHORTFUSE: uiBastmasterEmiShortfuseGUID = pCreature->GetGUID(); break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) - { - switch(pGo->GetEntry()) - { - case GO_CAVE_IN_LEFT: - uiCaveInLeftGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(NULL,false,pGo); - break; - case GO_CAVE_IN_RIGHT: - uiCaveInRightGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE || m_auiEncounter[0] == NOT_STARTED) - HandleGameObject(NULL,false,pGo); - break; - } - } - - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) - { - case TYPE_EVENT: - m_auiEncounter[0] = uiData; - if (uiData == DONE) - SaveToDB(); - break; - } - } - - uint32 GetData(uint32 uiType, uint32 /*uiData*/) - { - switch(uiType) - { - case TYPE_EVENT: return m_auiEncounter[0]; - } - } - - uint64 GetData64(uint32 uiType) - { - switch(uiType) - { - case DATA_GO_CAVE_IN_LEFT: return uiCaveInLeftGUID; - case DATA_GO_CAVE_IN_RIGHT: return uiCaveInRightGUID; - case DATA_NPC_BASTMASTER_EMI_SHORTFUSE: return uiBastmasterEmiShortfuseGUID; - } - - return 0; - } }; -InstanceData* GetInstanceData_instance_gnomeregan(Map* pMap) -{ - return new instance_gnomeregan(pMap); -} void AddSC_instance_gnomeregan() { - Script* newscript; - - newscript = new Script; - newscript->Name = "instance_gnomeregan"; - newscript->GetInstanceData = &GetInstanceData_instance_gnomeregan; - newscript->RegisterSelf(); + new instance_gnomeregan(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp index ce6d4158fd7..519f0f00021 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_curator.cpp @@ -42,157 +42,160 @@ EndScriptData */ #define SPELL_EVOCATION 30254 #define SPELL_ENRAGE 30403 //Arcane Infusion: Transforms Curator and adds damage. #define SPELL_BERSERK 26662 - -struct boss_curatorAI : public ScriptedAI + class boss_curator : public CreatureScript { - boss_curatorAI(Creature *c) : ScriptedAI(c) {} +public: + boss_curator() : CreatureScript("boss_curator") { } - uint32 AddTimer; - uint32 HatefulBoltTimer; - uint32 BerserkTimer; - - bool Enraged; - bool Evocating; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AddTimer = 10000; - HatefulBoltTimer = 15000; //This time may be wrong - BerserkTimer = 720000; //12 minutes - Enraged = false; - Evocating = false; - - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); + return new boss_curatorAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_curatorAI : public ScriptedAI { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); - } + boss_curatorAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 AddTimer; + uint32 HatefulBoltTimer; + uint32 BerserkTimer; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + bool Enraged; + bool Evocating; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //always decrease BerserkTimer - if (BerserkTimer <= diff) + void Reset() { - //if evocate, then break evocate + AddTimer = 10000; + HatefulBoltTimer = 15000; //This time may be wrong + BerserkTimer = 720000; //12 minutes + Enraged = false; + Evocating = false; + + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //always decrease BerserkTimer + if (BerserkTimer <= diff) + { + //if evocate, then break evocate + if (Evocating) + { + if (me->HasAura(SPELL_EVOCATION)) + me->RemoveAurasDueToSpell(SPELL_EVOCATION); + + Evocating = false; + } + + //may not be correct SAY (generic hard enrage) + DoScriptText(SAY_ENRAGE, me); + + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_BERSERK); + + //don't know if he's supposed to do summon/evocate after hard enrage (probably not) + Enraged = true; + } else BerserkTimer -= diff; + if (Evocating) { + //not supposed to do anything while evocate if (me->HasAura(SPELL_EVOCATION)) - me->RemoveAurasDueToSpell(SPELL_EVOCATION); - - Evocating = false; + return; + else + Evocating = false; } - //may not be correct SAY (generic hard enrage) - DoScriptText(SAY_ENRAGE, me); - - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_BERSERK); - - //don't know if he's supposed to do summon/evocate after hard enrage (probably not) - Enraged = true; - } else BerserkTimer -= diff; - - if (Evocating) - { - //not supposed to do anything while evocate - if (me->HasAura(SPELL_EVOCATION)) - return; - else - Evocating = false; - } - - if (!Enraged) - { - if (AddTimer <= diff) + if (!Enraged) { - //Summon Astral Flare - Creature* AstralFlare = DoSpawnCreature(17096, rand()%37, rand()%37, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - - if (AstralFlare && pTarget) + if (AddTimer <= diff) { - AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); - AstralFlare->AI()->AttackStart(pTarget); - } + //Summon Astral Flare + Creature* AstralFlare = DoSpawnCreature(17096, rand()%37, rand()%37, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - //Reduce Mana by 10% of max health - if (int32 mana = me->GetMaxPower(POWER_MANA)) - { - mana /= 10; - me->ModifyPower(POWER_MANA, -mana); - - //if this get's us below 10%, then we evocate (the 10th should be summoned now) - if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) + if (AstralFlare && pTarget) { - DoScriptText(SAY_EVOCATE, me); - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_EVOCATION); - Evocating = true; - //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected - return; + AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); + AstralFlare->AI()->AttackStart(pTarget); } - else + + //Reduce Mana by 10% of max health + if (int32 mana = me->GetMaxPower(POWER_MANA)) { - if (urand(0,1) == 0) + mana /= 10; + me->ModifyPower(POWER_MANA, -mana); + + //if this get's us below 10%, then we evocate (the 10th should be summoned now) + if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) { - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + DoScriptText(SAY_EVOCATE, me); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_EVOCATION); + Evocating = true; + //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected + return; + } + else + { + if (urand(0,1) == 0) + { + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + } } } + + AddTimer = 10000; + } else AddTimer -= diff; + + if (me->GetHealth()*100 / me->GetMaxHealth() <= 15) + { + Enraged = true; + DoCast(me, SPELL_ENRAGE); + DoScriptText(SAY_ENRAGE, me); } - - AddTimer = 10000; - } else AddTimer -= diff; - - if (me->GetHealth()*100 / me->GetMaxHealth() <= 15) - { - Enraged = true; - DoCast(me, SPELL_ENRAGE); - DoScriptText(SAY_ENRAGE, me); } + + if (HatefulBoltTimer <= diff) + { + if (Enraged) + HatefulBoltTimer = 7000; + else + HatefulBoltTimer = 15000; + + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) + DoCast(pTarget, SPELL_HATEFUL_BOLT); + + } else HatefulBoltTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (HatefulBoltTimer <= diff) - { - if (Enraged) - HatefulBoltTimer = 7000; - else - HatefulBoltTimer = 15000; - - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) - DoCast(pTarget, SPELL_HATEFUL_BOLT); - - } else HatefulBoltTimer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_curator(Creature* pCreature) -{ - return new boss_curatorAI (pCreature); -} void AddSC_boss_curator() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_curator"; - newscript->GetAI = &GetAI_boss_curator; - newscript->RegisterSelf(); + new boss_curator(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp index 19b6b203d4c..8a3989747e6 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_maiden_of_virtue.cpp @@ -38,103 +38,105 @@ EndScriptData */ #define SPELL_HOLYWRATH 32445 #define SPELL_HOLYGROUND 29512 #define SPELL_BERSERK 26662 - -struct boss_maiden_of_virtueAI : public ScriptedAI + class boss_maiden_of_virtue : public CreatureScript { - boss_maiden_of_virtueAI(Creature *c) : ScriptedAI(c) {} +public: + boss_maiden_of_virtue() : CreatureScript("boss_maiden_of_virtue") { } - uint32 Repentance_Timer; - uint32 Holyfire_Timer; - uint32 Holywrath_Timer; - uint32 Holyground_Timer; - uint32 Enrage_Timer; - - bool Enraged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Repentance_Timer = 25000+(rand()%15000); - Holyfire_Timer = 8000+(rand()%17000); - Holywrath_Timer = 15000+(rand()%10000); - Holyground_Timer = 3000; - Enrage_Timer = 600000; - - Enraged = false; + return new boss_maiden_of_virtueAI (pCreature); } - void KilledUnit(Unit* /*Victim*/) + struct boss_maiden_of_virtueAI : public ScriptedAI { - if (urand(0,1) == 0) - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } + boss_maiden_of_virtueAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 Repentance_Timer; + uint32 Holyfire_Timer; + uint32 Holywrath_Timer; + uint32 Holyground_Timer; + uint32 Enrage_Timer; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + bool Enraged; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Enrage_Timer < diff && !Enraged) + void Reset() { - DoCast(me, SPELL_BERSERK, true); - Enraged = true; - } else Enrage_Timer -= diff; + Repentance_Timer = 25000+(rand()%15000); + Holyfire_Timer = 8000+(rand()%17000); + Holywrath_Timer = 15000+(rand()%10000); + Holyground_Timer = 3000; + Enrage_Timer = 600000; - if (Holyground_Timer <= diff) + Enraged = false; + } + + void KilledUnit(Unit* /*Victim*/) { - DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all - Holyground_Timer = 3000; - } else Holyground_Timer -= diff; + if (urand(0,1) == 0) + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } - if (Repentance_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_REPENTANCE); - DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), me); + DoScriptText(SAY_DEATH, me); + } - Repentance_Timer = urand(25000,35000); //A little randomness on that spell - } else Repentance_Timer -= diff; - - if (Holyfire_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HOLYFIRE); + DoScriptText(SAY_AGGRO, me); + } - Holyfire_Timer = urand(8000,23000); //Anywhere from 8 to 23 seconds, good luck having several of those in a row! - } else Holyfire_Timer -= diff; - - if (Holywrath_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_HOLYWRATH); + if (!UpdateVictim()) + return; - Holywrath_Timer = urand(20000,25000); //20-30 secs sounds nice - } else Holywrath_Timer -= diff; + if (Enrage_Timer < diff && !Enraged) + { + DoCast(me, SPELL_BERSERK, true); + Enraged = true; + } else Enrage_Timer -= diff; - DoMeleeAttackIfReady(); - } + if (Holyground_Timer <= diff) + { + DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all + Holyground_Timer = 3000; + } else Holyground_Timer -= diff; + + if (Repentance_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REPENTANCE); + DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), me); + + Repentance_Timer = urand(25000,35000); //A little randomness on that spell + } else Repentance_Timer -= diff; + + if (Holyfire_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HOLYFIRE); + + Holyfire_Timer = urand(8000,23000); //Anywhere from 8 to 23 seconds, good luck having several of those in a row! + } else Holyfire_Timer -= diff; + + if (Holywrath_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_HOLYWRATH); + + Holywrath_Timer = urand(20000,25000); //20-30 secs sounds nice + } else Holywrath_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + }; }; -CreatureAI* GetAI_boss_maiden_of_virtue(Creature* pCreature) -{ - return new boss_maiden_of_virtueAI (pCreature); -} void AddSC_boss_maiden_of_virtue() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_maiden_of_virtue"; - newscript->GetAI = &GetAI_boss_maiden_of_virtue; - newscript->RegisterSelf(); + new boss_maiden_of_virtue(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 939a5a1684a..603e2bfb65c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -45,268 +45,271 @@ EndScriptData */ //Attumen (TODO: Use the summoning spell instead of Creature id. It works , but is not convenient for us) #define SUMMON_ATTUMEN 15550 - -struct boss_midnightAI : public ScriptedAI + class boss_attumen : public CreatureScript { - boss_midnightAI(Creature *c) : ScriptedAI(c) {} +public: + boss_attumen() : CreatureScript("boss_attumen") { } - uint64 Attumen; - uint8 Phase; - uint32 Mount_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Phase = 1; - Attumen = 0; - Mount_Timer = 0; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_ON); + return new boss_attumenAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void KilledUnit(Unit * /*victim*/) + struct boss_attumenAI : public ScriptedAI { - if (Phase == 2) + boss_attumenAI(Creature *c) : ScriptedAI(c) { - if (Unit *pUnit = Unit::GetUnit(*me, Attumen)) - DoScriptText(SAY_MIDNIGHT_KILL, pUnit); - } - } + Phase = 1; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95) - { - Phase = 2; - if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) - { - Attumen = pAttumen->GetGUID(); - pAttumen->AI()->AttackStart(me->getVictim()); - SetMidnight(pAttumen, me->GetGUID()); - DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen); - } - } - else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25) - { - if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) - Mount(pAttumen); - } - else if (Phase == 3) - { - if (Mount_Timer) - { - if (Mount_Timer <= diff) - { - Mount_Timer = 0; - me->SetVisibility(VISIBILITY_OFF); - me->GetMotionMaster()->MoveIdle(); - if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) - { - pAttumen->SetDisplayId(MOUNTED_DISPLAYID); - pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pAttumen->getVictim()) - { - pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); - pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); - } - pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); - } - } else Mount_Timer -= diff; - } - } - - if (Phase != 3) - DoMeleeAttackIfReady(); - } - - void Mount(Unit *pAttumen) - { - DoScriptText(SAY_MOUNT, pAttumen); - Phase = 3; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - float angle = me->GetAngle(pAttumen); - float distance = me->GetDistance2d(pAttumen); - float newX = me->GetPositionX() + cos(angle)*(distance/2) ; - float newY = me->GetPositionY() + sin(angle)*(distance/2) ; - float newZ = 50; - //me->Relocate(newX,newY,newZ,angle); - //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); - distance += 10; - newX = me->GetPositionX() + cos(angle)*(distance/2) ; - newY = me->GetPositionY() + sin(angle)*(distance/2) ; - pAttumen->GetMotionMaster()->Clear(); - pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); - //pAttumen->Relocate(newX,newY,newZ,-angle); - //pAttumen->SendMonsterMove(newX, newY, newZ, 0, true, 1000); - Mount_Timer = 1000; - } - - void SetMidnight(Creature *, uint64); //Below .. -}; - -CreatureAI* GetAI_boss_midnight(Creature* pCreature) -{ - return new boss_midnightAI(pCreature); -} - -struct boss_attumenAI : public ScriptedAI -{ - boss_attumenAI(Creature *c) : ScriptedAI(c) - { - Phase = 1; - - CleaveTimer = urand(10000,15000); - CurseTimer = 30000; - RandomYellTimer = urand(30000,60000); //Occasionally yell - ChargeTimer = 20000; - ResetTimer = 0; - } - - uint64 Midnight; - uint8 Phase; - uint32 CleaveTimer; - uint32 CurseTimer; - uint32 RandomYellTimer; - uint32 ChargeTimer; //only when mounted - uint32 ResetTimer; - - void Reset() - { - ResetTimer = 2000; - } - - void EnterCombat(Unit* /*who*/) {} - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - if (Unit *pMidnight = Unit::GetUnit(*me, Midnight)) - pMidnight->Kill(pMidnight); - } - - void UpdateAI(const uint32 diff) - { - if (ResetTimer) - { - if (ResetTimer <= diff) - { - ResetTimer = 0; - Unit *pMidnight = Unit::GetUnit(*me, Midnight); - if (pMidnight) - { - pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pMidnight->SetVisibility(VISIBILITY_ON); - } - Midnight = 0; - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); - } - } else ResetTimer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) - return; - - if (CleaveTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWCLEAVE); CleaveTimer = urand(10000,15000); - } else CleaveTimer -= diff; - - if (CurseTimer <= diff) - { - DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); CurseTimer = 30000; - } else CurseTimer -= diff; - - if (RandomYellTimer <= diff) - { - DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), me); - RandomYellTimer = urand(30000,60000); - } else RandomYellTimer -= diff; - - if (me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) - { - if (ChargeTimer <= diff) - { - Unit *pTarget = NULL; - std::list t_list = me->getThreatManager().getThreatList(); - std::vector target_list; - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && !pTarget->IsWithinDist(me, ATTACK_DISTANCE, false)) - target_list.push_back(pTarget); - pTarget = NULL; - } - if (target_list.size()) - pTarget = *(target_list.begin()+rand()%target_list.size()); - - DoCast(pTarget, SPELL_BERSERKER_CHARGE); - ChargeTimer = 20000; - } else ChargeTimer -= diff; + RandomYellTimer = urand(30000,60000); //Occasionally yell + ChargeTimer = 20000; + ResetTimer = 0; } - else + + uint64 Midnight; + uint8 Phase; + uint32 CleaveTimer; + uint32 CurseTimer; + uint32 RandomYellTimer; + uint32 ChargeTimer; //only when mounted + uint32 ResetTimer; + + void Reset() { - if ((me->GetHealth()*100)/me->GetMaxHealth() < 25) + ResetTimer = 2000; + } + + void EnterCombat(Unit* /*who*/) {} + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + if (Unit *pMidnight = Unit::GetUnit(*me, Midnight)) + pMidnight->Kill(pMidnight); + } + + void UpdateAI(const uint32 diff); + + void SpellHit(Unit * /*source*/, const SpellEntry *spell) + { + if (spell->Mechanic == MECHANIC_DISARM) + DoScriptText(SAY_DISARMED, me); + } + }; + +}; + class boss_midnight : public CreatureScript +{ +public: + boss_midnight() : CreatureScript("boss_midnight") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_midnightAI(pCreature); + } + + struct boss_midnightAI : public ScriptedAI + { + boss_midnightAI(Creature *c) : ScriptedAI(c) {} + + uint64 Attumen; + uint8 Phase; + uint32 Mount_Timer; + + void Reset() + { + Phase = 1; + Attumen = 0; + Mount_Timer = 0; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_ON); + } + + void EnterCombat(Unit* /*who*/) {} + + void KilledUnit(Unit * /*victim*/) + { + if (Phase == 2) { - Creature *pMidnight = Unit::GetCreature(*me, Midnight); - if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) - { - CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(me); - me->SetHealth(pMidnight->GetHealth()); - DoResetThreat(); - } + if (Unit *pUnit = Unit::GetUnit(*me, Attumen)) + DoScriptText(SAY_MIDNIGHT_KILL, pUnit); } } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95) + { + Phase = 2; + if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000)) + { + Attumen = pAttumen->GetGUID(); + pAttumen->AI()->AttackStart(me->getVictim()); + SetMidnight(pAttumen, me->GetGUID()); + DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen); + } + } + else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25) + { + if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) + Mount(pAttumen); + } + else if (Phase == 3) + { + if (Mount_Timer) + { + if (Mount_Timer <= diff) + { + Mount_Timer = 0; + me->SetVisibility(VISIBILITY_OFF); + me->GetMotionMaster()->MoveIdle(); + if (Unit *pAttumen = Unit::GetUnit(*me, Attumen)) + { + pAttumen->SetDisplayId(MOUNTED_DISPLAYID); + pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pAttumen->getVictim()) + { + pAttumen->GetMotionMaster()->MoveChase(pAttumen->getVictim()); + pAttumen->SetUInt64Value(UNIT_FIELD_TARGET, pAttumen->getVictim()->GetGUID()); + } + pAttumen->SetFloatValue(OBJECT_FIELD_SCALE_X,1); + } + } else Mount_Timer -= diff; + } + } + + if (Phase != 3) + DoMeleeAttackIfReady(); + } + + void Mount(Unit *pAttumen) + { + DoScriptText(SAY_MOUNT, pAttumen); + Phase = 3; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + float angle = me->GetAngle(pAttumen); + float distance = me->GetDistance2d(pAttumen); + float newX = me->GetPositionX() + cos(angle)*(distance/2) ; + float newY = me->GetPositionY() + sin(angle)*(distance/2) ; + float newZ = 50; + //me->Relocate(newX,newY,newZ,angle); + //me->SendMonsterMove(newX, newY, newZ, 0, true, 1000); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, newX, newY, newZ); + distance += 10; + newX = me->GetPositionX() + cos(angle)*(distance/2) ; + newY = me->GetPositionY() + sin(angle)*(distance/2) ; + pAttumen->GetMotionMaster()->Clear(); + pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ); + //pAttumen->Relocate(newX,newY,newZ,-angle); + //pAttumen->SendMonsterMove(newX, newY, newZ, 0, true, 1000); + Mount_Timer = 1000; + } + + void SetMidnight(Creature *pAttumen, uint64 value) + { + CAST_AI(boss_attumen::boss_attumenAI, pAttumen->AI())->Midnight = value; + } }; - void SpellHit(Unit * /*source*/, const SpellEntry *spell) - { - if (spell->Mechanic == MECHANIC_DISARM) - DoScriptText(SAY_DISARMED, me); - } }; -void boss_midnightAI::SetMidnight(Creature *pAttumen, uint64 value) +void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) { - CAST_AI(boss_attumenAI, pAttumen->AI())->Midnight = value; + if (ResetTimer) + { + if (ResetTimer <= diff) + { + ResetTimer = 0; + Unit *pMidnight = Unit::GetUnit(*me, Midnight); + if (pMidnight) + { + pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pMidnight->SetVisibility(VISIBILITY_ON); + } + Midnight = 0; + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + } + } else ResetTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE)) + return; + + if (CleaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWCLEAVE); + CleaveTimer = urand(10000,15000); + } else CleaveTimer -= diff; + + if (CurseTimer <= diff) + { + DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + CurseTimer = 30000; + } else CurseTimer -= diff; + + if (RandomYellTimer <= diff) + { + DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), me); + RandomYellTimer = urand(30000,60000); + } else RandomYellTimer -= diff; + + if (me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID) + { + if (ChargeTimer <= diff) + { + Unit *pTarget = NULL; + std::list t_list = me->getThreatManager().getThreatList(); + std::vector target_list; + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && !pTarget->IsWithinDist(me, ATTACK_DISTANCE, false)) + target_list.push_back(pTarget); + pTarget = NULL; + } + if (target_list.size()) + pTarget = *(target_list.begin()+rand()%target_list.size()); + + DoCast(pTarget, SPELL_BERSERKER_CHARGE); + ChargeTimer = 20000; + } else ChargeTimer -= diff; + } + else + { + if ((me->GetHealth()*100)/me->GetMaxHealth() < 25) + { + Creature *pMidnight = Unit::GetCreature(*me, Midnight); + if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT) + { + CAST_AI(boss_midnight::boss_midnightAI, (pMidnight->AI()))->Mount(me); + me->SetHealth(pMidnight->GetHealth()); + DoResetThreat(); + } + } + } + + DoMeleeAttackIfReady(); } -CreatureAI* GetAI_boss_attumen(Creature* pCreature) -{ - return new boss_attumenAI (pCreature); -} void AddSC_boss_attumen() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_attumen"; - newscript->GetAI = &GetAI_boss_attumen; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_midnight"; - newscript->GetAI = &GetAI_boss_midnight; - newscript->RegisterSelf(); + new boss_attumen(); + new boss_midnight(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index fc46d027d07..4c3606cd7e1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -59,254 +59,265 @@ const uint32 Adds[6]= 19875, 19876, }; - -struct boss_moroesAI : public ScriptedAI + class boss_moroes : public CreatureScript { - boss_moroesAI(Creature *c) : ScriptedAI(c) +public: + boss_moroes() : CreatureScript("boss_moroes") { } + + CreatureAI* GetAI(Creature* pCreature) const { - for (uint8 i = 0; i < 4; ++i) - { - AddId[i] = 0; - } - pInstance = c->GetInstanceData(); + return new boss_moroesAI (pCreature); } - ScriptedInstance *pInstance; - - uint64 AddGUID[4]; - - uint32 Vanish_Timer; - uint32 Blind_Timer; - uint32 Gouge_Timer; - uint32 Wait_Timer; - uint32 CheckAdds_Timer; - uint32 AddId[4]; - - bool InVanish; - bool Enrage; - - void Reset() + struct boss_moroesAI : public ScriptedAI { - Vanish_Timer = 30000; - Blind_Timer = 35000; - Gouge_Timer = 23000; - Wait_Timer = 0; - CheckAdds_Timer = 5000; - - Enrage = false; - InVanish = false; - if (me->GetHealth() > 0) - { - SpawnAdds(); - } - - if (pInstance) - pInstance->SetData(TYPE_MOROES, NOT_STARTED); - } - - void StartEvent() - { - if (pInstance) - pInstance->SetData(TYPE_MOROES, IN_PROGRESS); - - DoZoneInCombat(); - } - - void EnterCombat(Unit* /*who*/) - { - StartEvent(); - - DoScriptText(SAY_AGGRO, me); - AddsAttack(); - DoZoneInCombat(); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); - } - - void JustDied(Unit* /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(TYPE_MOROES, DONE); - - DeSpawnAdds(); - - //remove aura from spell Garrote when Moroes dies - if (pInstance) - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); - } - - void SpawnAdds() - { - DeSpawnAdds(); - if (isAddlistEmpty()) - { - Creature *pCreature = NULL; - std::vector AddList; - - for (uint8 i = 0; i < 6; ++i) - AddList.push_back(Adds[i]); - - while (AddList.size() > 4) - AddList.erase((AddList.begin())+(rand()%AddList.size())); - - uint8 i = 0; - for (std::vector::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr) - { - uint32 entry = *itr; - - pCreature = me->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - if (pCreature) - { - AddGUID[i] = pCreature->GetGUID(); - AddId[i] = entry; - } - ++i; - } - }else + boss_moroesAI(Creature *c) : ScriptedAI(c) { for (uint8 i = 0; i < 4; ++i) { - Creature *pCreature = me->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - if (pCreature) + AddId[i] = 0; + } + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint64 AddGUID[4]; + + uint32 Vanish_Timer; + uint32 Blind_Timer; + uint32 Gouge_Timer; + uint32 Wait_Timer; + uint32 CheckAdds_Timer; + uint32 AddId[4]; + + bool InVanish; + bool Enrage; + + void Reset() + { + Vanish_Timer = 30000; + Blind_Timer = 35000; + Gouge_Timer = 23000; + Wait_Timer = 0; + CheckAdds_Timer = 5000; + + Enrage = false; + InVanish = false; + if (me->GetHealth() > 0) + { + SpawnAdds(); + } + + if (pInstance) + pInstance->SetData(TYPE_MOROES, NOT_STARTED); + } + + void StartEvent() + { + if (pInstance) + pInstance->SetData(TYPE_MOROES, IN_PROGRESS); + + DoZoneInCombat(); + } + + void EnterCombat(Unit* /*who*/) + { + StartEvent(); + + DoScriptText(SAY_AGGRO, me); + AddsAttack(); + DoZoneInCombat(); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); + } + + void JustDied(Unit* /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_MOROES, DONE); + + DeSpawnAdds(); + + //remove aura from spell Garrote when Moroes dies + if (pInstance) + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_GARROTE); + } + + void SpawnAdds() + { + DeSpawnAdds(); + if (isAddlistEmpty()) + { + Creature *pCreature = NULL; + std::vector AddList; + + for (uint8 i = 0; i < 6; ++i) + AddList.push_back(Adds[i]); + + while (AddList.size() > 4) + AddList.erase((AddList.begin())+(rand()%AddList.size())); + + uint8 i = 0; + for (std::vector::const_iterator itr = AddList.begin(); itr != AddList.end(); ++itr) { - AddGUID[i] = pCreature->GetGUID(); + uint32 entry = *itr; + + pCreature = me->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + if (pCreature) + { + AddGUID[i] = pCreature->GetGUID(); + AddId[i] = entry; + } + ++i; + } + }else + { + for (uint8 i = 0; i < 4; ++i) + { + Creature *pCreature = me->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + if (pCreature) + { + AddGUID[i] = pCreature->GetGUID(); + } } } } - } - bool isAddlistEmpty() - { - for (uint8 i = 0; i < 4; ++i) + bool isAddlistEmpty() { - if (AddId[i] == 0) - return true; - } - return false; - } - - void DeSpawnAdds() - { - for (uint8 i = 0; i < 4 ; ++i) - { - Creature* Temp = NULL; - if (AddGUID[i]) + for (uint8 i = 0; i < 4; ++i) { - Temp = Creature::GetCreature((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) - Temp->DisappearAndDie(); + if (AddId[i] == 0) + return true; } + return false; } - } - void AddsAttack() - { - for (uint8 i = 0; i < 4; ++i) + void DeSpawnAdds() { - Creature* Temp = NULL; - if (AddGUID[i]) + for (uint8 i = 0; i < 4 ; ++i) { - Temp = Creature::GetCreature((*me),AddGUID[i]); - if (Temp && Temp->isAlive()) + Creature* Temp = NULL; + if (AddGUID[i]) { - Temp->AI()->AttackStart(me->getVictim()); - DoZoneInCombat(Temp); - } else - EnterEvadeMode(); + Temp = Creature::GetCreature((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + Temp->DisappearAndDie(); + } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (pInstance && !pInstance->GetData(TYPE_MOROES)) - { - EnterEvadeMode(); - return; - } - - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30) - { - DoCast(me, SPELL_FRENZY); - Enrage = true; - } - - if (CheckAdds_Timer <= diff) + void AddsAttack() { for (uint8 i = 0; i < 4; ++i) { Creature* Temp = NULL; if (AddGUID[i]) { - Temp = Unit::GetCreature((*me),AddGUID[i]); + Temp = Creature::GetCreature((*me),AddGUID[i]); if (Temp && Temp->isAlive()) - if (!Temp->getVictim()) - Temp->AI()->AttackStart(me->getVictim()); + { + Temp->AI()->AttackStart(me->getVictim()); + DoZoneInCombat(Temp); + } else + EnterEvadeMode(); } } - CheckAdds_Timer = 5000; - } else CheckAdds_Timer -= diff; + } - if (!Enrage) + void UpdateAI(const uint32 diff) { - //Cast Vanish, then Garrote random victim - if (Vanish_Timer <= diff) - { - DoCast(me, SPELL_VANISH); - InVanish = true; - Vanish_Timer = 30000; - Wait_Timer = 5000; - } else Vanish_Timer -= diff; + if (!UpdateVictim()) + return; - if (Gouge_Timer <= diff) + if (pInstance && !pInstance->GetData(TYPE_MOROES)) { - DoCastVictim(SPELL_GOUGE); - Gouge_Timer = 40000; - } else Gouge_Timer -= diff; + EnterEvadeMode(); + return; + } - if (Blind_Timer <= diff) + if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30) { - std::list pTargets; - SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true); - for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) - if (!me->IsWithinMeleeRange(*i)) + DoCast(me, SPELL_FRENZY); + Enrage = true; + } + + if (CheckAdds_Timer <= diff) + { + for (uint8 i = 0; i < 4; ++i) + { + Creature* Temp = NULL; + if (AddGUID[i]) { - DoCast(*i, SPELL_BLIND); - break; + Temp = Unit::GetCreature((*me),AddGUID[i]); + if (Temp && Temp->isAlive()) + if (!Temp->getVictim()) + Temp->AI()->AttackStart(me->getVictim()); } - Blind_Timer = 40000; - } else Blind_Timer -= diff; - } + } + CheckAdds_Timer = 5000; + } else CheckAdds_Timer -= diff; - if (InVanish) - { - if (Wait_Timer <= diff) + if (!Enrage) { - DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), me); + //Cast Vanish, then Garrote random victim + if (Vanish_Timer <= diff) + { + DoCast(me, SPELL_VANISH); + InVanish = true; + Vanish_Timer = 30000; + Wait_Timer = 5000; + } else Vanish_Timer -= diff; - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - pTarget->CastSpell(pTarget, SPELL_GARROTE,true); + if (Gouge_Timer <= diff) + { + DoCastVictim(SPELL_GOUGE); + Gouge_Timer = 40000; + } else Gouge_Timer -= diff; - InVanish = false; - } else Wait_Timer -= diff; + if (Blind_Timer <= diff) + { + std::list pTargets; + SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true); + for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) + if (!me->IsWithinMeleeRange(*i)) + { + DoCast(*i, SPELL_BLIND); + break; + } + Blind_Timer = 40000; + } else Blind_Timer -= diff; + } + + if (InVanish) + { + if (Wait_Timer <= diff) + { + DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), me); + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + pTarget->CastSpell(pTarget, SPELL_GARROTE,true); + + InVanish = false; + } else Wait_Timer -= diff; + } + + if (!InVanish) + DoMeleeAttackIfReady(); } + }; - if (!InVanish) - DoMeleeAttackIfReady(); - } }; struct boss_moroes_guestAI : public ScriptedAI { - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 GuestGUID[4]; @@ -315,7 +326,7 @@ struct boss_moroes_guestAI : public ScriptedAI for (uint8 i = 0; i < 4; ++i) GuestGUID[i] = 0; - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } void Reset() @@ -335,7 +346,7 @@ struct boss_moroes_guestAI : public ScriptedAI { for (uint8 i = 0; i < 4; ++i) { - uint64 GUID = CAST_AI(boss_moroesAI, Moroes->AI())->AddGUID[i]; + uint64 GUID = CAST_AI(boss_moroes::boss_moroesAI, Moroes->AI())->AddGUID[i]; if (GUID) GuestGUID[i] = GUID; } @@ -369,419 +380,420 @@ struct boss_moroes_guestAI : public ScriptedAI #define SPELL_SWPAIN 34441 #define SPELL_SHADOWFORM 29406 -struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI -{ - //Shadow Priest - boss_baroness_dorothea_millstipeAI(Creature *c) : boss_moroes_guestAI(c) {} - - uint32 ManaBurn_Timer; - uint32 MindFlay_Timer; - uint32 ShadowWordPain_Timer; - - void Reset() - { - ManaBurn_Timer = 7000; - MindFlay_Timer = 1000; - ShadowWordPain_Timer = 6000; - - DoCast(me, SPELL_SHADOWFORM, true); - - boss_moroes_guestAI::Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - boss_moroes_guestAI::UpdateAI(diff); - - if (MindFlay_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MINDFLY); - MindFlay_Timer = 12000; // 3 sec channeled - } else MindFlay_Timer -= diff; - - if (ManaBurn_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (pTarget->getPowerType() == POWER_MANA) - DoCast(pTarget, SPELL_MANABURN); - ManaBurn_Timer = 5000; // 3 sec cast - } else ManaBurn_Timer -= diff; - - if (ShadowWordPain_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - DoCast(pTarget, SPELL_SWPAIN); - ShadowWordPain_Timer = 7000; - } - } else ShadowWordPain_Timer -= diff; - } -}; - #define SPELL_HAMMEROFJUSTICE 13005 #define SPELL_JUDGEMENTOFCOMMAND 29386 #define SPELL_SEALOFCOMMAND 29385 -struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI -{ - //Retr Pally - boss_baron_rafe_dreugerAI(Creature *c) : boss_moroes_guestAI(c){} - - uint32 HammerOfJustice_Timer; - uint32 SealOfCommand_Timer; - uint32 JudgementOfCommand_Timer; - - void Reset() - { - HammerOfJustice_Timer = 1000; - SealOfCommand_Timer = 7000; - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - - boss_moroes_guestAI::Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - boss_moroes_guestAI::UpdateAI(diff); - - if (SealOfCommand_Timer <= diff) - { - DoCast(me, SPELL_SEALOFCOMMAND); - SealOfCommand_Timer = 32000; - JudgementOfCommand_Timer = 29000; - } else SealOfCommand_Timer -= diff; - - if (JudgementOfCommand_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_JUDGEMENTOFCOMMAND); - JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; - } else JudgementOfCommand_Timer -= diff; - - if (HammerOfJustice_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); - HammerOfJustice_Timer = 12000; - } else HammerOfJustice_Timer -= diff; - } -}; - #define SPELL_DISPELMAGIC 15090 //Self or other guest+Moroes #define SPELL_GREATERHEAL 29564 //Self or other guest+Moroes #define SPELL_HOLYFIRE 29563 #define SPELL_PWSHIELD 29408 -struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI -{ - //Holy Priest - boss_lady_catriona_von_indiAI(Creature *c) : boss_moroes_guestAI(c) {} - - uint32 DispelMagic_Timer; - uint32 GreaterHeal_Timer; - uint32 HolyFire_Timer; - uint32 PowerWordShield_Timer; - - void Reset() - { - DispelMagic_Timer = 11000; - GreaterHeal_Timer = 1500; - HolyFire_Timer = 5000; - PowerWordShield_Timer = 1000; - - AcquireGUID(); - - boss_moroes_guestAI::Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - boss_moroes_guestAI::UpdateAI(diff); - - if (PowerWordShield_Timer <= diff) - { - DoCast(me, SPELL_PWSHIELD); - PowerWordShield_Timer = 15000; - } else PowerWordShield_Timer -= diff; - - if (GreaterHeal_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); - - DoCast(pTarget, SPELL_GREATERHEAL); - GreaterHeal_Timer = 17000; - } else GreaterHeal_Timer -= diff; - - if (HolyFire_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HOLYFIRE); - HolyFire_Timer = 22000; - } else HolyFire_Timer -= diff; - - if (DispelMagic_Timer <= diff) - { - if (Unit *pTarget = RAND(SelectGuestTarget(), SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) - DoCast(pTarget, SPELL_DISPELMAGIC); - - DispelMagic_Timer = 25000; - } else DispelMagic_Timer -= diff; - } -}; - #define SPELL_CLEANSE 29380 //Self or other guest+Moroes #define SPELL_GREATERBLESSOFMIGHT 29381 //Self or other guest+Moroes #define SPELL_HOLYLIGHT 29562 //Self or other guest+Moroes #define SPELL_DIVINESHIELD 41367 -struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI -{ - //Holy Pally - boss_lady_keira_berrybuckAI(Creature *c) : boss_moroes_guestAI(c) {} - - uint32 Cleanse_Timer; - uint32 GreaterBless_Timer; - uint32 HolyLight_Timer; - uint32 DivineShield_Timer; - - void Reset() - { - Cleanse_Timer = 13000; - GreaterBless_Timer = 1000; - HolyLight_Timer = 7000; - DivineShield_Timer = 31000; - - AcquireGUID(); - - boss_moroes_guestAI::Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - boss_moroes_guestAI::UpdateAI(diff); - - if (DivineShield_Timer <= diff) - { - DoCast(me, SPELL_DIVINESHIELD); - DivineShield_Timer = 31000; - } else DivineShield_Timer -= diff; - - if (HolyLight_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); - - DoCast(pTarget, SPELL_HOLYLIGHT); - HolyLight_Timer = 10000; - } else HolyLight_Timer -= diff; - - if (GreaterBless_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); - - DoCast(pTarget, SPELL_GREATERBLESSOFMIGHT); - - GreaterBless_Timer = 50000; - } else GreaterBless_Timer -= diff; - - if (Cleanse_Timer <= diff) - { - Unit *pTarget = SelectGuestTarget(); - - DoCast(pTarget, SPELL_CLEANSE); - - Cleanse_Timer = 10000; - } else Cleanse_Timer -= diff; - } -}; - #define SPELL_HAMSTRING 9080 #define SPELL_MORTALSTRIKE 29572 #define SPELL_WHIRLWIND 29573 -struct boss_lord_robin_darisAI : public boss_moroes_guestAI -{ - //Arms Warr - boss_lord_robin_darisAI(Creature *c) : boss_moroes_guestAI(c) {} - - uint32 Hamstring_Timer; - uint32 MortalStrike_Timer; - uint32 WhirlWind_Timer; - - void Reset() - { - Hamstring_Timer = 7000; - MortalStrike_Timer = 10000; - WhirlWind_Timer = 21000; - - boss_moroes_guestAI::Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - boss_moroes_guestAI::UpdateAI(diff); - - if (Hamstring_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - Hamstring_Timer = 12000; - } else Hamstring_Timer -= diff; - - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 18000; - } else MortalStrike_Timer -= diff; - - if (WhirlWind_Timer <= diff) - { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind_Timer = 21000; - } else WhirlWind_Timer -= diff; - } -}; - #define SPELL_DISARM 8379 #define SPELL_HEROICSTRIKE 29567 #define SPELL_SHIELDBASH 11972 #define SPELL_SHIELDWALL 29390 - -struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI + class boss_baroness_dorothea_millstipe : public CreatureScript { - //Arms Warr - boss_lord_crispin_ferenceAI(Creature *c) : boss_moroes_guestAI(c) {} +public: + boss_baroness_dorothea_millstipe() : CreatureScript("boss_baroness_dorothea_millstipe") { } - uint32 Disarm_Timer; - uint32 HeroicStrike_Timer; - uint32 ShieldBash_Timer; - uint32 ShieldWall_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Disarm_Timer = 6000; - HeroicStrike_Timer = 10000; - ShieldBash_Timer = 8000; - ShieldWall_Timer = 4000; - - boss_moroes_guestAI::Reset(); + return new boss_baroness_dorothea_millstipeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI { - if (!UpdateVictim()) - return; + //Shadow Priest + boss_baroness_dorothea_millstipeAI(Creature *c) : boss_moroes_guestAI(c) {} - boss_moroes_guestAI::UpdateAI(diff); + uint32 ManaBurn_Timer; + uint32 MindFlay_Timer; + uint32 ShadowWordPain_Timer; - if (Disarm_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_DISARM); - Disarm_Timer = 12000; - } else Disarm_Timer -= diff; + ManaBurn_Timer = 7000; + MindFlay_Timer = 1000; + ShadowWordPain_Timer = 6000; - if (HeroicStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HEROICSTRIKE); - HeroicStrike_Timer = 10000; - } else HeroicStrike_Timer -= diff; + DoCast(me, SPELL_SHADOWFORM, true); - if (ShieldBash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHIELDBASH); - ShieldBash_Timer = 13000; - } else ShieldBash_Timer -= diff; + boss_moroes_guestAI::Reset(); + } - if (ShieldWall_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_SHIELDWALL); - ShieldWall_Timer = 21000; - } else ShieldWall_Timer -= diff; - } + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (MindFlay_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MINDFLY); + MindFlay_Timer = 12000; // 3 sec channeled + } else MindFlay_Timer -= diff; + + if (ManaBurn_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (pTarget->getPowerType() == POWER_MANA) + DoCast(pTarget, SPELL_MANABURN); + ManaBurn_Timer = 5000; // 3 sec cast + } else ManaBurn_Timer -= diff; + + if (ShadowWordPain_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoCast(pTarget, SPELL_SWPAIN); + ShadowWordPain_Timer = 7000; + } + } else ShadowWordPain_Timer -= diff; + } + }; + }; - -CreatureAI* GetAI_boss_moroes(Creature* pCreature) + class boss_baron_rafe_dreuger : public CreatureScript { - return new boss_moroesAI (pCreature); -} +public: + boss_baron_rafe_dreuger() : CreatureScript("boss_baron_rafe_dreuger") { } -CreatureAI* GetAI_baroness_dorothea_millstipe(Creature* pCreature) -{ - return new boss_baroness_dorothea_millstipeAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_baron_rafe_dreugerAI (pCreature); + } -CreatureAI* GetAI_baron_rafe_dreuger(Creature* pCreature) -{ - return new boss_baron_rafe_dreugerAI (pCreature); -} + struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI + { + //Retr Pally + boss_baron_rafe_dreugerAI(Creature *c) : boss_moroes_guestAI(c){} -CreatureAI* GetAI_lady_catriona_von_indi(Creature* pCreature) -{ - return new boss_lady_catriona_von_indiAI (pCreature); -} + uint32 HammerOfJustice_Timer; + uint32 SealOfCommand_Timer; + uint32 JudgementOfCommand_Timer; -CreatureAI* GetAI_lady_keira_berrybuck(Creature* pCreature) -{ - return new boss_lady_keira_berrybuckAI (pCreature); -} + void Reset() + { + HammerOfJustice_Timer = 1000; + SealOfCommand_Timer = 7000; + JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; -CreatureAI* GetAI_lord_robin_daris(Creature* pCreature) -{ - return new boss_lord_robin_darisAI (pCreature); -} + boss_moroes_guestAI::Reset(); + } -CreatureAI* GetAI_lord_crispin_ference(Creature* pCreature) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (SealOfCommand_Timer <= diff) + { + DoCast(me, SPELL_SEALOFCOMMAND); + SealOfCommand_Timer = 32000; + JudgementOfCommand_Timer = 29000; + } else SealOfCommand_Timer -= diff; + + if (JudgementOfCommand_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_JUDGEMENTOFCOMMAND); + JudgementOfCommand_Timer = SealOfCommand_Timer + 29000; + } else JudgementOfCommand_Timer -= diff; + + if (HammerOfJustice_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); + HammerOfJustice_Timer = 12000; + } else HammerOfJustice_Timer -= diff; + } + }; + +}; + class boss_lady_catriona_von_indi : public CreatureScript { - return new boss_lord_crispin_ferenceAI (pCreature); -} +public: + boss_lady_catriona_von_indi() : CreatureScript("boss_lady_catriona_von_indi") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lady_catriona_von_indiAI (pCreature); + } + + struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI + { + //Holy Priest + boss_lady_catriona_von_indiAI(Creature *c) : boss_moroes_guestAI(c) {} + + uint32 DispelMagic_Timer; + uint32 GreaterHeal_Timer; + uint32 HolyFire_Timer; + uint32 PowerWordShield_Timer; + + void Reset() + { + DispelMagic_Timer = 11000; + GreaterHeal_Timer = 1500; + HolyFire_Timer = 5000; + PowerWordShield_Timer = 1000; + + AcquireGUID(); + + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (PowerWordShield_Timer <= diff) + { + DoCast(me, SPELL_PWSHIELD); + PowerWordShield_Timer = 15000; + } else PowerWordShield_Timer -= diff; + + if (GreaterHeal_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); + + DoCast(pTarget, SPELL_GREATERHEAL); + GreaterHeal_Timer = 17000; + } else GreaterHeal_Timer -= diff; + + if (HolyFire_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HOLYFIRE); + HolyFire_Timer = 22000; + } else HolyFire_Timer -= diff; + + if (DispelMagic_Timer <= diff) + { + if (Unit *pTarget = RAND(SelectGuestTarget(), SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) + DoCast(pTarget, SPELL_DISPELMAGIC); + + DispelMagic_Timer = 25000; + } else DispelMagic_Timer -= diff; + } + }; + +}; + class boss_lady_keira_berrybuck : public CreatureScript +{ +public: + boss_lady_keira_berrybuck() : CreatureScript("boss_lady_keira_berrybuck") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lady_keira_berrybuckAI (pCreature); + } + + struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI + { + //Holy Pally + boss_lady_keira_berrybuckAI(Creature *c) : boss_moroes_guestAI(c) {} + + uint32 Cleanse_Timer; + uint32 GreaterBless_Timer; + uint32 HolyLight_Timer; + uint32 DivineShield_Timer; + + void Reset() + { + Cleanse_Timer = 13000; + GreaterBless_Timer = 1000; + HolyLight_Timer = 7000; + DivineShield_Timer = 31000; + + AcquireGUID(); + + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (DivineShield_Timer <= diff) + { + DoCast(me, SPELL_DIVINESHIELD); + DivineShield_Timer = 31000; + } else DivineShield_Timer -= diff; + + if (HolyLight_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); + + DoCast(pTarget, SPELL_HOLYLIGHT); + HolyLight_Timer = 10000; + } else HolyLight_Timer -= diff; + + if (GreaterBless_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); + + DoCast(pTarget, SPELL_GREATERBLESSOFMIGHT); + + GreaterBless_Timer = 50000; + } else GreaterBless_Timer -= diff; + + if (Cleanse_Timer <= diff) + { + Unit *pTarget = SelectGuestTarget(); + + DoCast(pTarget, SPELL_CLEANSE); + + Cleanse_Timer = 10000; + } else Cleanse_Timer -= diff; + } + }; + +}; + class boss_lord_robin_daris : public CreatureScript +{ +public: + boss_lord_robin_daris() : CreatureScript("boss_lord_robin_daris") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lord_robin_darisAI (pCreature); + } + + struct boss_lord_robin_darisAI : public boss_moroes_guestAI + { + //Arms Warr + boss_lord_robin_darisAI(Creature *c) : boss_moroes_guestAI(c) {} + + uint32 Hamstring_Timer; + uint32 MortalStrike_Timer; + uint32 WhirlWind_Timer; + + void Reset() + { + Hamstring_Timer = 7000; + MortalStrike_Timer = 10000; + WhirlWind_Timer = 21000; + + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (Hamstring_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + Hamstring_Timer = 12000; + } else Hamstring_Timer -= diff; + + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 18000; + } else MortalStrike_Timer -= diff; + + if (WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + WhirlWind_Timer = 21000; + } else WhirlWind_Timer -= diff; + } + }; + +}; + class boss_lord_crispin_ference : public CreatureScript +{ +public: + boss_lord_crispin_ference() : CreatureScript("boss_lord_crispin_ference") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lord_crispin_ferenceAI (pCreature); + } + + struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI + { + //Arms Warr + boss_lord_crispin_ferenceAI(Creature *c) : boss_moroes_guestAI(c) {} + + uint32 Disarm_Timer; + uint32 HeroicStrike_Timer; + uint32 ShieldBash_Timer; + uint32 ShieldWall_Timer; + + void Reset() + { + Disarm_Timer = 6000; + HeroicStrike_Timer = 10000; + ShieldBash_Timer = 8000; + ShieldWall_Timer = 4000; + + boss_moroes_guestAI::Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_moroes_guestAI::UpdateAI(diff); + + if (Disarm_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DISARM); + Disarm_Timer = 12000; + } else Disarm_Timer -= diff; + + if (HeroicStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HEROICSTRIKE); + HeroicStrike_Timer = 10000; + } else HeroicStrike_Timer -= diff; + + if (ShieldBash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHIELDBASH); + ShieldBash_Timer = 13000; + } else ShieldBash_Timer -= diff; + + if (ShieldWall_Timer <= diff) + { + DoCast(me, SPELL_SHIELDWALL); + ShieldWall_Timer = 21000; + } else ShieldWall_Timer -= diff; + } + }; + +}; void AddSC_boss_moroes() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_moroes"; - newscript->GetAI = &GetAI_boss_moroes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_baroness_dorothea_millstipe"; - newscript->GetAI = &GetAI_baroness_dorothea_millstipe; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_baron_rafe_dreuger"; - newscript->GetAI = &GetAI_baron_rafe_dreuger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lady_catriona_von_indi"; - newscript->GetAI = &GetAI_lady_catriona_von_indi; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lady_keira_berrybuck"; - newscript->GetAI = &GetAI_lady_keira_berrybuck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lord_robin_daris"; - newscript->GetAI = &GetAI_lord_robin_daris; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lord_crispin_ference"; - newscript->GetAI = &GetAI_lord_crispin_ference; - newscript->RegisterSelf(); + new boss_moroes(); + new boss_baroness_dorothea_millstipe(); + new boss_baron_rafe_dreuger(); + new boss_lady_catriona_von_indi(); + new boss_lady_keira_berrybuck(); + new boss_lord_robin_daris(); + new boss_lord_crispin_ference(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 2b287ad261f..f6088360c75 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -57,283 +57,285 @@ const uint32 PortalBeam[3] = {30465,30464,30463}; const uint32 PlayerBuff[3] = {30421,30422,30423}; const uint32 NetherBuff[3] = {30466,30467,30468}; const uint32 PlayerDebuff[3] = {38637,38638,38639}; - -struct boss_netherspiteAI : public ScriptedAI + class boss_netherspite : public CreatureScript { - boss_netherspiteAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); +public: + boss_netherspite() : CreatureScript("boss_netherspite") { } - for (int i=0; i<3; ++i) + CreatureAI* GetAI(Creature *pCreature) + { + return new boss_netherspiteAI(pCreature); + } + + struct boss_netherspiteAI : public ScriptedAI + { + boss_netherspiteAI(Creature* c) : ScriptedAI(c) { - PortalGUID[i] = 0; - BeamTarget[i] = 0; - BeamerGUID[i] = 0; - } - } + pInstance = c->GetInstanceScript(); - ScriptedInstance* pInstance; - - bool PortalPhase; - bool Berserk; - uint32 PhaseTimer; // timer for phase switching - uint32 VoidZoneTimer; - uint32 NetherInfusionTimer; // berserking timer - uint32 NetherbreathTimer; - uint32 EmpowermentTimer; - uint32 PortalTimer; // timer for beam checking - uint64 PortalGUID[3]; // guid's of portals - uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals - uint64 BeamTarget[3]; // guid's of portals' current targets - - bool IsBetween(WorldObject* u1, WorldObject *pTarget, WorldObject* u2) // the in-line checker - { - if (!u1 || !u2 || !pTarget) - return false; - - float xn, yn, xp, yp, xh, yh; - xn = u1->GetPositionX(); - yn = u1->GetPositionY(); - xp = u2->GetPositionX(); - yp = u2->GetPositionY(); - xh = pTarget->GetPositionX(); - yh = pTarget->GetPositionY(); - - // check if target is between (not checking distance from the beam yet) - if (dist(xn,yn,xh,yh) >= dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh) >= dist(xn,yn,xp,yp)) - return false; - // check distance from the beam - return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f); - } - - float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance - { - return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); - } - - void Reset() - { - Berserk = false; - NetherInfusionTimer = 540000; - VoidZoneTimer = 15000; - NetherbreathTimer = 3000; - - HandleDoors(true); - DestroyPortals(); - } - - void SummonPortals() - { - uint8 r = rand()%4; - uint8 pos[3]; - pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); - pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); - pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) - - for (int i=0; i<3; ++i) - if (Creature *portal = me->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000)) + for (int i=0; i<3; ++i) { - PortalGUID[i] = portal->GetGUID(); - portal->AddAura(PortalVisual[i], portal); + PortalGUID[i] = 0; + BeamTarget[i] = 0; + BeamerGUID[i] = 0; } - } - - void DestroyPortals() - { - for (int i=0; i<3; ++i) - { - if (Creature *portal = Unit::GetCreature(*me, PortalGUID[i])) - portal->DisappearAndDie(); - if (Creature *portal = Unit::GetCreature(*me, BeamerGUID[i])) - portal->DisappearAndDie(); - PortalGUID[i] = 0; - BeamTarget[i] = 0; } - } - void UpdatePortals() // Here we handle the beams' behavior - { - for (int j=0; j<3; ++j) // j = color - if (Creature *portal = Unit::GetCreature(*me, PortalGUID[j])) - { - // the one who's been casted upon before - Unit *current = Unit::GetUnit(*portal, BeamTarget[j]); - // temporary store for the best suitable beam reciever - Unit *pTarget = me; + InstanceScript* pInstance; - if (Map* map = me->GetMap()) - { - Map::PlayerList const& players = map->GetPlayers(); + bool PortalPhase; + bool Berserk; + uint32 PhaseTimer; // timer for phase switching + uint32 VoidZoneTimer; + uint32 NetherInfusionTimer; // berserking timer + uint32 NetherbreathTimer; + uint32 EmpowermentTimer; + uint32 PortalTimer; // timer for beam checking + uint64 PortalGUID[3]; // guid's of portals + uint64 BeamerGUID[3]; // guid's of auxiliary beaming portals + uint64 BeamTarget[3]; // guid's of portals' current targets - // get the best suitable target - for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) - { - Player* p = i->getSource(); - if (p && p->isAlive() // alive - && (!pTarget || pTarget->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best - && !p->HasAura(PlayerDebuff[j],0) // not exhausted - && !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam - && !p->HasAura(PlayerBuff[(j+2)%3],0) - && IsBetween(me, p, portal)) // on the beam - pTarget = p; - } - } - // buff the target - if (pTarget->GetTypeId() == TYPEID_PLAYER) - pTarget->AddAura(PlayerBuff[j], pTarget); - else - pTarget->AddAura(NetherBuff[j], pTarget); - // cast visual beam on the chosen target if switched - // simple target switching isn't working -> using BeamerGUID to cast (workaround) - if (!current || pTarget != current) - { - BeamTarget[j] = pTarget->GetGUID(); - // remove currently beaming portal - if (Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j])) - { - beamer->CastSpell(pTarget, PortalBeam[j], false); - beamer->DisappearAndDie(); - BeamerGUID[j] = 0; - } - // create new one and start beaming on the target - if (Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000)) - { - beamer->CastSpell(pTarget, PortalBeam[j], false); - BeamerGUID[j] = beamer->GetGUID(); - } - } - // aggro target if Red Beam - if (j == RED_PORTAL && me->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - me->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(me->getVictim())); - } - } - - void SwitchToPortalPhase() - { - me->RemoveAurasDueToSpell(SPELL_BANISH_ROOT); - me->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL); - SummonPortals(); - PhaseTimer = 60000; - PortalPhase = true; - PortalTimer = 10000; - EmpowermentTimer = 10000; - DoScriptText(EMOTE_PHASE_PORTAL,me); - } - - void SwitchToBanishPhase() - { - me->RemoveAurasDueToSpell(SPELL_EMPOWERMENT); - me->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA); - DoCast(me, SPELL_BANISH_VISUAL, true); - DoCast(me, SPELL_BANISH_ROOT, true); - DestroyPortals(); - PhaseTimer = 30000; - PortalPhase = false; - DoScriptText(EMOTE_PHASE_BANISH,me); - - for (int i=0; i<3; ++i) - me->RemoveAurasDueToSpell(NetherBuff[i]); - } - - void HandleDoors(bool open) // Massive Door switcher - { - if (GameObject *Door = GameObject::GetGameObject(*me, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0)) - Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); - } - - void EnterCombat(Unit * /*who*/) - { - HandleDoors(false); - SwitchToPortalPhase(); - } - - void JustDied(Unit* /*killer*/) - { - HandleDoors(true); - DestroyPortals(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - // Void Zone - if (VoidZoneTimer <= diff) + bool IsBetween(WorldObject* u1, WorldObject *pTarget, WorldObject* u2) // the in-line checker { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,45,true),SPELL_VOIDZONE,true); + if (!u1 || !u2 || !pTarget) + return false; + + float xn, yn, xp, yp, xh, yh; + xn = u1->GetPositionX(); + yn = u1->GetPositionY(); + xp = u2->GetPositionX(); + yp = u2->GetPositionY(); + xh = pTarget->GetPositionX(); + yh = pTarget->GetPositionY(); + + // check if target is between (not checking distance from the beam yet) + if (dist(xn,yn,xh,yh) >= dist(xn,yn,xp,yp) || dist(xp,yp,xh,yh) >= dist(xn,yn,xp,yp)) + return false; + // check distance from the beam + return (abs((xn-xp)*yh+(yp-yn)*xh-xn*yp+xp*yn)/dist(xn,yn,xp,yp) < 1.5f); + } + + float dist(float xa, float ya, float xb, float yb) // auxiliary method for distance + { + return sqrt((xa-xb)*(xa-xb) + (ya-yb)*(ya-yb)); + } + + void Reset() + { + Berserk = false; + NetherInfusionTimer = 540000; VoidZoneTimer = 15000; - } else VoidZoneTimer -= diff; + NetherbreathTimer = 3000; - // NetherInfusion Berserk - if (!Berserk && NetherInfusionTimer <= diff) - { - me->AddAura(SPELL_NETHER_INFUSION, me); - DoCast(me, SPELL_NETHERSPITE_ROAR); - Berserk = true; - } else NetherInfusionTimer -= diff; - - if (PortalPhase) // PORTAL PHASE - { - // Distribute beams and buffs - if (PortalTimer <= diff) - { - UpdatePortals(); - PortalTimer = 1000; - } else PortalTimer -= diff; - - // Empowerment & Nether Burn - if (EmpowermentTimer <= diff) - { - DoCast(me, SPELL_EMPOWERMENT); - me->AddAura(SPELL_NETHERBURN_AURA, me); - EmpowermentTimer = 90000; - } else EmpowermentTimer -= diff; - - if (PhaseTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - SwitchToBanishPhase(); - return; - } - } else PhaseTimer -= diff; - } - else // BANISH PHASE - { - // Netherbreath - if (NetherbreathTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true)) - DoCast(pTarget, SPELL_NETHERBREATH); - NetherbreathTimer = urand(5000,7000); - } else NetherbreathTimer -= diff; - - if (PhaseTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - SwitchToPortalPhase(); - return; - } - } else PhaseTimer -= diff; + HandleDoors(true); + DestroyPortals(); } - DoMeleeAttackIfReady(); - } + void SummonPortals() + { + uint8 r = rand()%4; + uint8 pos[3]; + pos[RED_PORTAL] = (r%2 ? (r>1 ? 2: 1): 0); + pos[GREEN_PORTAL] = (r%2 ? 0: (r>1 ? 2: 1)); + pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0) + + for (int i=0; i<3; ++i) + if (Creature *portal = me->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + PortalGUID[i] = portal->GetGUID(); + portal->AddAura(PortalVisual[i], portal); + } + } + + void DestroyPortals() + { + for (int i=0; i<3; ++i) + { + if (Creature *portal = Unit::GetCreature(*me, PortalGUID[i])) + portal->DisappearAndDie(); + if (Creature *portal = Unit::GetCreature(*me, BeamerGUID[i])) + portal->DisappearAndDie(); + PortalGUID[i] = 0; + BeamTarget[i] = 0; + } + } + + void UpdatePortals() // Here we handle the beams' behavior + { + for (int j=0; j<3; ++j) // j = color + if (Creature *portal = Unit::GetCreature(*me, PortalGUID[j])) + { + // the one who's been casted upon before + Unit *current = Unit::GetUnit(*portal, BeamTarget[j]); + // temporary store for the best suitable beam reciever + Unit *pTarget = me; + + if (Map* map = me->GetMap()) + { + Map::PlayerList const& players = map->GetPlayers(); + + // get the best suitable target + for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) + { + Player* p = i->getSource(); + if (p && p->isAlive() // alive + && (!pTarget || pTarget->GetDistance2d(portal)>p->GetDistance2d(portal)) // closer than current best + && !p->HasAura(PlayerDebuff[j],0) // not exhausted + && !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam + && !p->HasAura(PlayerBuff[(j+2)%3],0) + && IsBetween(me, p, portal)) // on the beam + pTarget = p; + } + } + // buff the target + if (pTarget->GetTypeId() == TYPEID_PLAYER) + pTarget->AddAura(PlayerBuff[j], pTarget); + else + pTarget->AddAura(NetherBuff[j], pTarget); + // cast visual beam on the chosen target if switched + // simple target switching isn't working -> using BeamerGUID to cast (workaround) + if (!current || pTarget != current) + { + BeamTarget[j] = pTarget->GetGUID(); + // remove currently beaming portal + if (Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j])) + { + beamer->CastSpell(pTarget, PortalBeam[j], false); + beamer->DisappearAndDie(); + BeamerGUID[j] = 0; + } + // create new one and start beaming on the target + if (Creature *beamer = portal->SummonCreature(PortalID[j],portal->GetPositionX(),portal->GetPositionY(),portal->GetPositionZ(),portal->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,60000)) + { + beamer->CastSpell(pTarget, PortalBeam[j], false); + BeamerGUID[j] = beamer->GetGUID(); + } + } + // aggro target if Red Beam + if (j == RED_PORTAL && me->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + me->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(me->getVictim())); + } + } + + void SwitchToPortalPhase() + { + me->RemoveAurasDueToSpell(SPELL_BANISH_ROOT); + me->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL); + SummonPortals(); + PhaseTimer = 60000; + PortalPhase = true; + PortalTimer = 10000; + EmpowermentTimer = 10000; + DoScriptText(EMOTE_PHASE_PORTAL,me); + } + + void SwitchToBanishPhase() + { + me->RemoveAurasDueToSpell(SPELL_EMPOWERMENT); + me->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA); + DoCast(me, SPELL_BANISH_VISUAL, true); + DoCast(me, SPELL_BANISH_ROOT, true); + DestroyPortals(); + PhaseTimer = 30000; + PortalPhase = false; + DoScriptText(EMOTE_PHASE_BANISH,me); + + for (int i=0; i<3; ++i) + me->RemoveAurasDueToSpell(NetherBuff[i]); + } + + void HandleDoors(bool open) // Massive Door switcher + { + if (GameObject *Door = GameObject::GetGameObject(*me, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0)) + Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); + } + + void EnterCombat(Unit * /*who*/) + { + HandleDoors(false); + SwitchToPortalPhase(); + } + + void JustDied(Unit* /*killer*/) + { + HandleDoors(true); + DestroyPortals(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + // Void Zone + if (VoidZoneTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,45,true),SPELL_VOIDZONE,true); + VoidZoneTimer = 15000; + } else VoidZoneTimer -= diff; + + // NetherInfusion Berserk + if (!Berserk && NetherInfusionTimer <= diff) + { + me->AddAura(SPELL_NETHER_INFUSION, me); + DoCast(me, SPELL_NETHERSPITE_ROAR); + Berserk = true; + } else NetherInfusionTimer -= diff; + + if (PortalPhase) // PORTAL PHASE + { + // Distribute beams and buffs + if (PortalTimer <= diff) + { + UpdatePortals(); + PortalTimer = 1000; + } else PortalTimer -= diff; + + // Empowerment & Nether Burn + if (EmpowermentTimer <= diff) + { + DoCast(me, SPELL_EMPOWERMENT); + me->AddAura(SPELL_NETHERBURN_AURA, me); + EmpowermentTimer = 90000; + } else EmpowermentTimer -= diff; + + if (PhaseTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + SwitchToBanishPhase(); + return; + } + } else PhaseTimer -= diff; + } + else // BANISH PHASE + { + // Netherbreath + if (NetherbreathTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,40,true)) + DoCast(pTarget, SPELL_NETHERBREATH); + NetherbreathTimer = urand(5000,7000); + } else NetherbreathTimer -= diff; + + if (PhaseTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + SwitchToPortalPhase(); + return; + } + } else PhaseTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_netherspite(Creature *pCreature) -{ - return new boss_netherspiteAI(pCreature); -} void AddSC_boss_netherspite() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_netherspite"; - newscript->GetAI = GetAI_boss_netherspite; - newscript->RegisterSelf(); + new boss_netherspite(); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index cb5d592b04f..b42830232ee 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -57,364 +57,366 @@ float IntroWay[8][3] = {-11140 , -1915 ,122}, {-11163 , -1903 ,91.473} }; - -struct boss_nightbaneAI : public ScriptedAI + class boss_nightbane : public CreatureScript { - boss_nightbaneAI(Creature* c) : ScriptedAI(c) +public: + boss_nightbane() : CreatureScript("boss_nightbane") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Intro = true; + return new boss_nightbaneAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 Phase; - - bool RainBones; - bool Skeletons; - - uint32 BellowingRoarTimer; - uint32 CharredEarthTimer; - uint32 DistractingAshTimer; - uint32 SmolderingBreathTimer; - uint32 TailSweepTimer; - uint32 RainofBonesTimer; - uint32 SmokingBlastTimer; - uint32 FireballBarrageTimer; - uint32 SearingCindersTimer; - - uint32 FlyCount; - uint32 FlyTimer; - - bool Intro; - bool Flying; - bool Movement; - - uint32 WaitTimer; - uint32 MovePhase; - - void Reset() + struct boss_nightbaneAI : public ScriptedAI { - BellowingRoarTimer = 30000; - CharredEarthTimer = 15000; - DistractingAshTimer = 20000; - SmolderingBreathTimer = 10000; - TailSweepTimer = 12000; - RainofBonesTimer = 10000; - SmokingBlastTimer = 20000; - FireballBarrageTimer = 13000; - SearingCindersTimer = 14000; - WaitTimer = 1000; - - Phase =1; - FlyCount = 0; - MovePhase = 0; - - me->SetSpeed(MOVE_RUN, 2.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->setActive(true); - - if (pInstance) + boss_nightbaneAI(Creature* c) : ScriptedAI(c) { - if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS) - me->DisappearAndDie(); - else - pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED); + pInstance = c->GetInstanceScript(); + Intro = true; } - HandleTerraceDoors(true); + InstanceScript* pInstance; - Flying = false; - Movement = false; + uint32 Phase; - if (!Intro) + bool RainBones; + bool Skeletons; + + uint32 BellowingRoarTimer; + uint32 CharredEarthTimer; + uint32 DistractingAshTimer; + uint32 SmolderingBreathTimer; + uint32 TailSweepTimer; + uint32 RainofBonesTimer; + uint32 SmokingBlastTimer; + uint32 FireballBarrageTimer; + uint32 SearingCindersTimer; + + uint32 FlyCount; + uint32 FlyTimer; + + bool Intro; + bool Flying; + bool Movement; + + uint32 WaitTimer; + uint32 MovePhase; + + void Reset() { - me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); - me->GetMotionMaster()->MoveTargetedHome(); - } - } + BellowingRoarTimer = 30000; + CharredEarthTimer = 15000; + DistractingAshTimer = 20000; + SmolderingBreathTimer = 10000; + TailSweepTimer = 12000; + RainofBonesTimer = 10000; + SmokingBlastTimer = 20000; + FireballBarrageTimer = 13000; + SearingCindersTimer = 14000; + WaitTimer = 1000; - void HandleTerraceDoors(bool open) - { - if (pInstance) - { - pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open); - pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); - } - } + Phase =1; + FlyCount = 0; + MovePhase = 0; - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS); + me->SetSpeed(MOVE_RUN, 2.0f); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->setActive(true); - HandleTerraceDoors(false); - me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); - } - - void AttackStart(Unit* who) - { - if (!Intro && !Flying) - ScriptedAI::AttackStart(who); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_NIGHTBANE, DONE); - - HandleTerraceDoors(true); - } - - void MoveInLineOfSight(Unit *who) - { - if (!Intro && !Flying) - ScriptedAI::MoveInLineOfSight(who); - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (Intro) - { - if (id >= 8) + if (pInstance) + { + if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS) + me->DisappearAndDie(); + else + pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED); + } + + HandleTerraceDoors(true); + + Flying = false; + Movement = false; + + if (!Intro) { - Intro = false; me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); - return; + me->GetMotionMaster()->MoveTargetedHome(); } - - WaitTimer = 1; } - if (Flying) + void HandleTerraceDoors(bool open) { - if (id == 0) + if (pInstance) { - me->MonsterTextEmote(EMOTE_BREATH, 0, true); - Flying = false; - Phase = 2; - return; + pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_1), open); + pInstance->HandleGameObject(pInstance->GetData64(DATA_MASTERS_TERRACE_DOOR_2), open); } - - if (id == 3) - { - MovePhase = 4; - WaitTimer = 1; - return; - } - - if (id == 8) - { - Flying = false; - Phase = 1; - Movement = true; - return; - } - - WaitTimer = 1; } - } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me->getVictim()); - } - - void TakeOff() - { - me->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); - - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - (*me).GetMotionMaster()->Clear(false); - (*me).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); - - Flying = true; - - FlyTimer = urand(45000,60000); //timer wrong between 45 and 60 seconds - ++FlyCount; - - RainofBonesTimer = 5000; //timer wrong (maybe) - RainBones = false; - Skeletons = false; - } - - void UpdateAI(const uint32 diff) - { - /* The timer for this was never setup apparently, not sure if the code works properly: - if (WaitTimer <= diff) + void EnterCombat(Unit * /*who*/) { + if (pInstance) + pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS); + + HandleTerraceDoors(false); + me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL); + } + + void AttackStart(Unit* who) + { + if (!Intro && !Flying) + ScriptedAI::AttackStart(who); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_NIGHTBANE, DONE); + + HandleTerraceDoors(true); + } + + void MoveInLineOfSight(Unit *who) + { + if (!Intro && !Flying) + ScriptedAI::MoveInLineOfSight(who); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + if (Intro) { - if (MovePhase >= 7) + if (id >= 8) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); - } - else - { - me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); - ++MovePhase; + Intro = false; + me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0); + return; } + + WaitTimer = 1; } + if (Flying) { - if (MovePhase >= 7) + if (id == 0) { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + me->MonsterTextEmote(EMOTE_BREATH, 0, true); + Flying = false; + Phase = 2; + return; } - else + + if (id == 3) { - me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); - ++MovePhase; + MovePhase = 4; + WaitTimer = 1; + return; } + + if (id == 8) + { + Flying = false; + Phase = 1; + Movement = true; + return; + } + + WaitTimer = 1; } - - WaitTimer = 0; - } else WaitTimer -= diff; - */ - - if (!UpdateVictim()) - return; - - if (Flying) - return; - - // Phase 1 "GROUND FIGHT" - if (Phase == 1) - { - if (Movement) - { - DoStartMovement(me->getVictim()); - Movement = false; - } - - if (BellowingRoarTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BELLOWING_ROAR); - BellowingRoarTimer = urand(30000,40000); - } else BellowingRoarTimer -= diff; - - if (SmolderingBreathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH); - SmolderingBreathTimer = 20000; - } else SmolderingBreathTimer -= diff; - - if (CharredEarthTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHARRED_EARTH); - CharredEarthTimer = 20000; - } else CharredEarthTimer -= diff; - - if (TailSweepTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (!me->HasInArc(M_PI, pTarget)) - DoCast(pTarget, SPELL_TAIL_SWEEP); - TailSweepTimer = 15000; - } else TailSweepTimer -= diff; - - if (SearingCindersTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SEARING_CINDERS); - SearingCindersTimer = 10000; - } else SearingCindersTimer -= diff; - - uint32 Prozent; - Prozent = (me->GetHealth()*100) / me->GetMaxHealth(); - - if (Prozent < 75 && FlyCount == 0) // first take off 75% - TakeOff(); - - if (Prozent < 50 && FlyCount == 1) // secound take off 50% - TakeOff(); - - if (Prozent < 25 && FlyCount == 2) // third take off 25% - TakeOff(); - - DoMeleeAttackIfReady(); } - //Phase 2 "FLYING FIGHT" - if (Phase == 2) + void JustSummoned(Creature *summoned) { - if (!RainBones) + summoned->AI()->AttackStart(me->getVictim()); + } + + void TakeOff() + { + me->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL); + + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + (*me).GetMotionMaster()->Clear(false); + (*me).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]); + + Flying = true; + + FlyTimer = urand(45000,60000); //timer wrong between 45 and 60 seconds + ++FlyCount; + + RainofBonesTimer = 5000; //timer wrong (maybe) + RainBones = false; + Skeletons = false; + } + + void UpdateAI(const uint32 diff) + { + /* The timer for this was never setup apparently, not sure if the code works properly: + if (WaitTimer <= diff) { - if (!Skeletons) + if (Intro) { - for (uint8 i = 0; i <= 3; ++i) + if (MovePhase >= 7) { - DoCast(me->getVictim(), SPELL_SUMMON_SKELETON); - Skeletons = true; + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + } + else + { + me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); + ++MovePhase; + } + } + if (Flying) + { + if (MovePhase >= 7) + { + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]); + } + else + { + me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]); + ++MovePhase; } } - if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 - { - DoCast(me->getVictim(), SPELL_RAIN_OF_BONES); - RainBones = true; - SmokingBlastTimer = 20000; - } else RainofBonesTimer -= diff; + WaitTimer = 0; + } else WaitTimer -= diff; + */ - if (DistractingAshTimer <= diff) + if (!UpdateVictim()) + return; + + if (Flying) + return; + + // Phase 1 "GROUND FIGHT" + if (Phase == 1) + { + if (Movement) + { + DoStartMovement(me->getVictim()); + Movement = false; + } + + if (BellowingRoarTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BELLOWING_ROAR); + BellowingRoarTimer = urand(30000,40000); + } else BellowingRoarTimer -= diff; + + if (SmolderingBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH); + SmolderingBreathTimer = 20000; + } else SmolderingBreathTimer -= diff; + + if (CharredEarthTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_DISTRACTING_ASH); - DistractingAshTimer = 2000; //timer wrong - } else DistractingAshTimer -= diff; + DoCast(pTarget, SPELL_CHARRED_EARTH); + CharredEarthTimer = 20000; + } else CharredEarthTimer -= diff; + + if (TailSweepTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!me->HasInArc(M_PI, pTarget)) + DoCast(pTarget, SPELL_TAIL_SWEEP); + TailSweepTimer = 15000; + } else TailSweepTimer -= diff; + + if (SearingCindersTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SEARING_CINDERS); + SearingCindersTimer = 10000; + } else SearingCindersTimer -= diff; + + uint32 Prozent; + Prozent = (me->GetHealth()*100) / me->GetMaxHealth(); + + if (Prozent < 75 && FlyCount == 0) // first take off 75% + TakeOff(); + + if (Prozent < 50 && FlyCount == 1) // secound take off 50% + TakeOff(); + + if (Prozent < 25 && FlyCount == 2) // third take off 25% + TakeOff(); + + DoMeleeAttackIfReady(); } - if (RainBones) + //Phase 2 "FLYING FIGHT" + if (Phase == 2) { - if (SmokingBlastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SMOKING_BLAST); - SmokingBlastTimer = 1500; //timer wrong - } else SmokingBlastTimer -= diff; + if (!RainBones) + { + if (!Skeletons) + { + for (uint8 i = 0; i <= 3; ++i) + { + DoCast(me->getVictim(), SPELL_SUMMON_SKELETON); + Skeletons = true; + } + } + + if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2 + { + DoCast(me->getVictim(), SPELL_RAIN_OF_BONES); + RainBones = true; + SmokingBlastTimer = 20000; + } else RainofBonesTimer -= diff; + + if (DistractingAshTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_DISTRACTING_ASH); + DistractingAshTimer = 2000; //timer wrong + } else DistractingAshTimer -= diff; + } + + if (RainBones) + { + if (SmokingBlastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SMOKING_BLAST); + SmokingBlastTimer = 1500; //timer wrong + } else SmokingBlastTimer -= diff; + } + + if (FireballBarrageTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) + DoCast(pTarget, SPELL_FIREBALL_BARRAGE); + FireballBarrageTimer = 20000; + } else FireballBarrageTimer -= diff; + + if (FlyTimer <= diff) //landing + { + me->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL); + + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); + + Flying = true; + } else FlyTimer -= diff; } - - if (FireballBarrageTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_FARTHEST, 0)) - DoCast(pTarget, SPELL_FIREBALL_BARRAGE); - FireballBarrageTimer = 20000; - } else FireballBarrageTimer -= diff; - - if (FlyTimer <= diff) //landing - { - me->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL); - - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]); - - Flying = true; - } else FlyTimer -= diff; } - } + }; + }; -CreatureAI* GetAI_boss_nightbane(Creature* pCreature) -{ - return new boss_nightbaneAI (pCreature); -} void AddSC_boss_nightbane() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nightbane"; - newscript->GetAI = &GetAI_boss_nightbane; - newscript->RegisterSelf(); + new boss_nightbane(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index aea8703f2f2..904c040722d 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -95,512 +95,513 @@ static InfernalPoint InfernalPoints[] = #define EQUIP_ID_AXE 33542 //Axes info -//---------Infernal code first -struct netherspite_infernalAI : public ScriptedAI +//---------Infernal code first class netherspite_infernal : public CreatureScript { - netherspite_infernalAI(Creature *c) : ScriptedAI(c) , - malchezaar(0), HellfireTimer(0), CleanupTimer(0), point(NULL) {} +public: + netherspite_infernal() : CreatureScript("netherspite_infernal") { } - uint32 HellfireTimer; - uint32 CleanupTimer; - uint32 malchezaar; - InfernalPoint *point; - - void Reset() {} - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (HellfireTimer) - if (HellfireTimer <= diff) + return new netherspite_infernalAI (pCreature); + } + + struct netherspite_infernalAI : public ScriptedAI + { + netherspite_infernalAI(Creature *c) : ScriptedAI(c) , + malchezaar(0), HellfireTimer(0), CleanupTimer(0), point(NULL) {} + + uint32 HellfireTimer; + uint32 CleanupTimer; + uint32 malchezaar; + InfernalPoint *point; + + void Reset() {} + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_HELLFIRE); - HellfireTimer = 0; + if (HellfireTimer) + if (HellfireTimer <= diff) + { + DoCast(me, SPELL_HELLFIRE); + HellfireTimer = 0; + } + else HellfireTimer -= diff; + + if (CleanupTimer) + if (CleanupTimer <= diff) + { + Cleanup(); + CleanupTimer = 0; + } else CleanupTimer -= diff; } - else HellfireTimer -= diff; - if (CleanupTimer) - if (CleanupTimer <= diff) + void KilledUnit(Unit *who) { - Cleanup(); - CleanupTimer = 0; - } else CleanupTimer -= diff; - } - - void KilledUnit(Unit *who) - { - Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); - if (pMalchezaar) - CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); - } - - void SpellHit(Unit * /*who*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_INFERNAL_RELAY) - { - me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - HellfireTimer = 4000; - CleanupTimer = 170000; + Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); + if (pMalchezaar) + CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); } - } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != malchezaar) - damage = 0; - } + void SpellHit(Unit * /*who*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_INFERNAL_RELAY) + { + me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + HellfireTimer = 4000; + CleanupTimer = 170000; + } + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetGUID() != malchezaar) + damage = 0; + } + + void Cleanup() + { + Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); + + if (pMalchezaar && pMalchezaar->isAlive()) + CAST_AI(boss_malchezaar::boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point); + } //below ... + }; - void Cleanup(); //below ... }; - -struct boss_malchezaarAI : public ScriptedAI + class boss_malchezaar : public CreatureScript { - boss_malchezaarAI(Creature *c) : ScriptedAI(c) +public: + boss_malchezaar() : CreatureScript("boss_malchezaar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_malchezaarAI (pCreature); } - ScriptedInstance *pInstance; - uint32 EnfeebleTimer; - uint32 EnfeebleResetTimer; - uint32 ShadowNovaTimer; - uint32 SWPainTimer; - uint32 SunderArmorTimer; - uint32 AmplifyDamageTimer; - uint32 Cleave_Timer; - uint32 InfernalTimer; - uint32 AxesTargetSwitchTimer; - uint32 InfernalCleanupTimer; - - std::vector infernals; - std::vector positions; - - uint64 axes[2]; - uint64 enfeeble_targets[5]; - uint64 enfeeble_health[5]; - - uint32 phase; - - void Reset() + struct boss_malchezaarAI : public ScriptedAI { - AxesCleanup(); - ClearWeapons(); - InfernalCleanup(); - positions.clear(); - - for (uint8 i = 0; i < 5; ++i) - enfeeble_targets[i] = 0; - - for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) - positions.push_back(&InfernalPoints[i]); - - EnfeebleTimer = 30000; - EnfeebleResetTimer = 38000; - ShadowNovaTimer = 35500; - SWPainTimer = 20000; - AmplifyDamageTimer = 5000; - Cleave_Timer = 8000; - InfernalTimer = 45000; - InfernalCleanupTimer = 47000; - AxesTargetSwitchTimer = urand(7500,20000); - SunderArmorTimer = urand(5000,10000); - phase = 1; - - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - AxesCleanup(); - ClearWeapons(); - InfernalCleanup(); - positions.clear(); - - for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) - positions.push_back(&InfernalPoints[i]); - - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in - } - - void InfernalCleanup() - { - //Infernal Cleanup - for (std::vector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) - if (Unit *pInfernal = Unit::GetUnit(*me, *itr)) - if (pInfernal->isAlive()) - { - pInfernal->SetVisibility(VISIBILITY_OFF); - pInfernal->setDeathState(JUST_DIED); - } - - infernals.clear(); - } - - void AxesCleanup() - { - for (uint8 i = 0; i < 2; ++i) + boss_malchezaarAI(Creature *c) : ScriptedAI(c) { - Unit *axe = Unit::GetUnit(*me, axes[i]); - if (axe && axe->isAlive()) - axe->Kill(axe); - axes[i] = 0; - } - } - - void ClearWeapons() - { - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - - //damage - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); - me->UpdateDamagePhysical(BASE_ATTACK); - } - - void EnfeebleHealthEffect() - { - const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); - if (!info) - return; - - std::list t_list = me->getThreatManager().getThreatList(); - std::vector targets; - - if (!t_list.size()) - return; - - //begin + 1, so we don't target the one with the highest threat - std::list::const_iterator itr = t_list.begin(); - std::advance(itr, 1); - for (; itr != t_list.end(); ++itr) //store the threat list in a different container - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - if (pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - targets.push_back(pTarget); - - //cut down to size if we have more than 5 targets - while (targets.size() > 5) - targets.erase(targets.begin()+rand()%targets.size()); - - uint32 i = 0; - for (std::vector::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) - if (Unit *pTarget = *iter) - { - enfeeble_targets[i] = pTarget->GetGUID(); - enfeeble_health[i] = pTarget->GetHealth(); - - pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID()); - pTarget->SetHealth(1); - } - } - - void EnfeebleResetHealth() - { - for (uint8 i = 0; i < 5; ++i) - { - Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]); - if (pTarget && pTarget->isAlive()) - pTarget->SetHealth(enfeeble_health[i]); - enfeeble_targets[i] = 0; - enfeeble_health[i] = 0; - } - } - - void SummonInfernal(const uint32 /*diff*/) - { - InfernalPoint *point = NULL; - Position pos; - if ((me->GetMapId() != 532) || positions.empty()) - me->GetRandomNearPosition(pos, 60); - else - { - std::vector::iterator itr = positions.begin()+rand()%positions.size(); - point = *itr; - positions.erase(itr); - pos.Relocate(point->x, point->y, INFERNAL_Z); + pInstance = c->GetInstanceScript(); } - Creature *Infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); + InstanceScript *pInstance; + uint32 EnfeebleTimer; + uint32 EnfeebleResetTimer; + uint32 ShadowNovaTimer; + uint32 SWPainTimer; + uint32 SunderArmorTimer; + uint32 AmplifyDamageTimer; + uint32 Cleave_Timer; + uint32 InfernalTimer; + uint32 AxesTargetSwitchTimer; + uint32 InfernalCleanupTimer; - if (Infernal) + std::vector infernals; + std::vector positions; + + uint64 axes[2]; + uint64 enfeeble_targets[5]; + uint64 enfeeble_health[5]; + + uint32 phase; + + void Reset() { - Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); - Infernal->setFaction(me->getFaction()); - if (point) - CAST_AI(netherspite_infernalAI, Infernal->AI())->point=point; - CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=me->GetGUID(); + AxesCleanup(); + ClearWeapons(); + InfernalCleanup(); + positions.clear(); - infernals.push_back(Infernal->GetGUID()); - DoCast(Infernal, SPELL_INFERNAL_RELAY); + for (uint8 i = 0; i < 5; ++i) + enfeeble_targets[i] = 0; + + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + positions.push_back(&InfernalPoints[i]); + + EnfeebleTimer = 30000; + EnfeebleResetTimer = 38000; + ShadowNovaTimer = 35500; + SWPainTimer = 20000; + AmplifyDamageTimer = 5000; + Cleave_Timer = 8000; + InfernalTimer = 45000; + InfernalCleanupTimer = 47000; + AxesTargetSwitchTimer = urand(7500,20000); + SunderArmorTimer = urand(5000,10000); + phase = 1; + + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); } - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that + void KilledUnit(Unit * /*victim*/) { - EnfeebleResetHealth(); - EnfeebleResetTimer = 0; - } else EnfeebleResetTimer -= diff; - - if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself - return; - - if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) - me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); - - if (phase == 1) - { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) - { - me->InterruptNonMeleeSpells(false); - - phase = 2; - - //animation - DoCast(me, SPELL_EQUIP_AXES); - - //text - DoScriptText(SAY_AXE_TOSS1, me); - - //passive thrash aura - DoCast(me, SPELL_THRASH_AURA, true); - - //models - SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); - - //damage - const CreatureInfo *cinfo = me->GetCreatureInfo(); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); - me->UpdateDamagePhysical(BASE_ATTACK); - - me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); - me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); - //Sigh, updating only works on main attack, do it manually .... - me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); - me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); - - me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); - } + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); } - else if (phase == 2) + + void JustDied(Unit * /*victim*/) { - if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) - { - InfernalTimer = 15000; + DoScriptText(SAY_DEATH, me); - phase = 3; + AxesCleanup(); + ClearWeapons(); + InfernalCleanup(); + positions.clear(); - ClearWeapons(); + for (uint8 i = 0; i < TOTAL_INFERNAL_POINTS; ++i) + positions.push_back(&InfernalPoints[i]); - //remove thrash - me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), true); + } - DoScriptText(SAY_AXE_TOSS2, me); + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - for (uint8 i = 0; i < 2; ++i) - { - Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - if (axe) + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in + } + + void InfernalCleanup() + { + //Infernal Cleanup + for (std::vector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr) + if (Unit *pInfernal = Unit::GetUnit(*me, *itr)) + if (pInfernal->isAlive()) { - axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - axe->setFaction(me->getFaction()); - axes[i] = axe->GetGUID(); - if (pTarget) - { - axe->AI()->AttackStart(pTarget); - //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly - // So we'll use a hack to add a lot of threat to our target - axe->AddThreat(pTarget, 10000000.0f); - } + pInfernal->SetVisibility(VISIBILITY_OFF); + pInfernal->setDeathState(JUST_DIED); } - } - if (ShadowNovaTimer > 35000) - ShadowNovaTimer = EnfeebleTimer + 5000; + infernals.clear(); + } + void AxesCleanup() + { + for (uint8 i = 0; i < 2; ++i) + { + Unit *axe = Unit::GetUnit(*me, axes[i]); + if (axe && axe->isAlive()) + axe->Kill(axe); + axes[i] = 0; + } + } + + void ClearWeapons() + { + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + + //damage + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); + me->UpdateDamagePhysical(BASE_ATTACK); + } + + void EnfeebleHealthEffect() + { + const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT); + if (!info) return; + + std::list t_list = me->getThreatManager().getThreatList(); + std::vector targets; + + if (!t_list.size()) + return; + + //begin + 1, so we don't target the one with the highest threat + std::list::const_iterator itr = t_list.begin(); + std::advance(itr, 1); + for (; itr != t_list.end(); ++itr) //store the threat list in a different container + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + targets.push_back(pTarget); + + //cut down to size if we have more than 5 targets + while (targets.size() > 5) + targets.erase(targets.begin()+rand()%targets.size()); + + uint32 i = 0; + for (std::vector::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) + if (Unit *pTarget = *iter) + { + enfeeble_targets[i] = pTarget->GetGUID(); + enfeeble_health[i] = pTarget->GetHealth(); + + pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID()); + pTarget->SetHealth(1); + } + } + + void EnfeebleResetHealth() + { + for (uint8 i = 0; i < 5; ++i) + { + Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]); + if (pTarget && pTarget->isAlive()) + pTarget->SetHealth(enfeeble_health[i]); + enfeeble_targets[i] = 0; + enfeeble_health[i] = 0; + } + } + + void SummonInfernal(const uint32 /*diff*/) + { + InfernalPoint *point = NULL; + Position pos; + if ((me->GetMapId() != 532) || positions.empty()) + me->GetRandomNearPosition(pos, 60); + else + { + std::vector::iterator itr = positions.begin()+rand()%positions.size(); + point = *itr; + positions.erase(itr); + pos.Relocate(point->x, point->y, INFERNAL_Z); } - if (SunderArmorTimer <= diff) + Creature *Infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000); + + if (Infernal) { - DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); - SunderArmorTimer = urand(10000,18000); + Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE); + Infernal->setFaction(me->getFaction()); + if (point) + CAST_AI(netherspite_infernal::netherspite_infernalAI, Infernal->AI())->point=point; + CAST_AI(netherspite_infernal::netherspite_infernalAI, Infernal->AI())->malchezaar=me->GetGUID(); - } else SunderArmorTimer -= diff; + infernals.push_back(Infernal->GetGUID()); + DoCast(Infernal, SPELL_INFERNAL_RELAY); + } - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = urand(6000,12000); - - } else Cleave_Timer -= diff; + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); } - else - { - if (AxesTargetSwitchTimer <= diff) - { - AxesTargetSwitchTimer = urand(7500,20000); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that + { + EnfeebleResetHealth(); + EnfeebleResetTimer = 0; + } else EnfeebleResetTimer -= diff; + + if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself + return; + + if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) + me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID()); + + if (phase == 1) + { + if ((me->GetHealth()*100) / me->GetMaxHealth() < 60) { + me->InterruptNonMeleeSpells(false); + + phase = 2; + + //animation + DoCast(me, SPELL_EQUIP_AXES); + + //text + DoScriptText(SAY_AXE_TOSS1, me); + + //passive thrash aura + DoCast(me, SPELL_THRASH_AURA, true); + + //models + SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); + + //damage + const CreatureInfo *cinfo = me->GetCreatureInfo(); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); + me->UpdateDamagePhysical(BASE_ATTACK); + + me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg); + me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg); + //Sigh, updating only works on main attack, do it manually .... + me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg); + me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg); + + me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100); + } + } + else if (phase == 2) + { + if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + { + InfernalTimer = 15000; + + phase = 3; + + ClearWeapons(); + + //remove thrash + me->RemoveAurasDueToSpell(SPELL_THRASH_AURA); + + DoScriptText(SAY_AXE_TOSS2, me); + + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); for (uint8 i = 0; i < 2; ++i) { - if (Unit *axe = Unit::GetUnit(*me, axes[i])) + Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (axe) { - if (axe->getVictim()) - DoModifyThreatPercent(axe->getVictim(), -100); + axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + axe->setFaction(me->getFaction()); + axes[i] = axe->GetGUID(); if (pTarget) - axe->AddThreat(pTarget, 1000000.0f); - //axe->getThreatManager().tauntFadeOut(axe->getVictim()); - //axe->getThreatManager().tauntApply(pTarget); + { + axe->AI()->AttackStart(pTarget); + //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly + // So we'll use a hack to add a lot of threat to our target + axe->AddThreat(pTarget, 10000000.0f); + } } } + + if (ShadowNovaTimer > 35000) + ShadowNovaTimer = EnfeebleTimer + 5000; + + return; } - } else AxesTargetSwitchTimer -= diff; - if (AmplifyDamageTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); - AmplifyDamageTimer = urand(20000,30000); - } else AmplifyDamageTimer -= diff; - } + if (SunderArmorTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); + SunderArmorTimer = urand(10000,18000); - //Time for global and double timers - if (InfernalTimer <= diff) - { - SummonInfernal(diff); - InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise - } else InfernalTimer -= diff; + } else SunderArmorTimer -= diff; - if (ShadowNovaTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWNOVA); - ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); - } else ShadowNovaTimer -= diff; + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = urand(6000,12000); - if (phase != 2) - { - if (SWPainTimer <= diff) - { - Unit *pTarget = NULL; - if (phase == 1) - pTarget = me->getVictim(); // the tank - else // anyone but the tank - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - - if (pTarget) - DoCast(pTarget, SPELL_SW_PAIN); - - SWPainTimer = 20000; - } else SWPainTimer -= diff; - } - - if (phase != 3) - { - if (EnfeebleTimer <= diff) - { - EnfeebleHealthEffect(); - EnfeebleTimer = 30000; - ShadowNovaTimer = 5000; - EnfeebleResetTimer = 9000; - } else EnfeebleTimer -= diff; - } - - if (phase == 2) - DoMeleeAttacksIfReady(); - else - DoMeleeAttackIfReady(); - } - - void DoMeleeAttacksIfReady() - { - if (me->IsWithinMeleeRange(me->getVictim()) && !me->IsNonMeleeSpellCasted(false)) - { - //Check for base attack - if (me->isAttackReady() && me->getVictim()) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + } else Cleave_Timer -= diff; } - //Check for offhand attack - if (me->isAttackReady(OFF_ATTACK) && me->getVictim()) + else { - me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK); - me->resetAttackTimer(OFF_ATTACK); + if (AxesTargetSwitchTimer <= diff) + { + AxesTargetSwitchTimer = urand(7500,20000); + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + for (uint8 i = 0; i < 2; ++i) + { + if (Unit *axe = Unit::GetUnit(*me, axes[i])) + { + if (axe->getVictim()) + DoModifyThreatPercent(axe->getVictim(), -100); + if (pTarget) + axe->AddThreat(pTarget, 1000000.0f); + //axe->getThreatManager().tauntFadeOut(axe->getVictim()); + //axe->getThreatManager().tauntApply(pTarget); + } + } + } + } else AxesTargetSwitchTimer -= diff; + + if (AmplifyDamageTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_AMPLIFY_DAMAGE); + AmplifyDamageTimer = urand(20000,30000); + } else AmplifyDamageTimer -= diff; + } + + //Time for global and double timers + if (InfernalTimer <= diff) + { + SummonInfernal(diff); + InfernalTimer = phase == 3 ? 14500 : 44500; // 15 secs in phase 3, 45 otherwise + } else InfernalTimer -= diff; + + if (ShadowNovaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWNOVA); + ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1); + } else ShadowNovaTimer -= diff; + + if (phase != 2) + { + if (SWPainTimer <= diff) + { + Unit *pTarget = NULL; + if (phase == 1) + pTarget = me->getVictim(); // the tank + else // anyone but the tank + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + + if (pTarget) + DoCast(pTarget, SPELL_SW_PAIN); + + SWPainTimer = 20000; + } else SWPainTimer -= diff; + } + + if (phase != 3) + { + if (EnfeebleTimer <= diff) + { + EnfeebleHealthEffect(); + EnfeebleTimer = 30000; + ShadowNovaTimer = 5000; + EnfeebleResetTimer = 9000; + } else EnfeebleTimer -= diff; + } + + if (phase == 2) + DoMeleeAttacksIfReady(); + else + DoMeleeAttackIfReady(); + } + + void DoMeleeAttacksIfReady() + { + if (me->IsWithinMeleeRange(me->getVictim()) && !me->IsNonMeleeSpellCasted(false)) + { + //Check for base attack + if (me->isAttackReady() && me->getVictim()) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + //Check for offhand attack + if (me->isAttackReady(OFF_ATTACK) && me->getVictim()) + { + me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK); + me->resetAttackTimer(OFF_ATTACK); + } } } - } - void Cleanup(Creature *infernal, InfernalPoint *point) - { - for (std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) - if (*itr == infernal->GetGUID()) + void Cleanup(Creature *infernal, InfernalPoint *point) { - infernals.erase(itr); - break; - } + for (std::vector::iterator itr = infernals.begin(); itr!= infernals.end(); ++itr) + if (*itr == infernal->GetGUID()) + { + infernals.erase(itr); + break; + } + + positions.push_back(point); + } + }; - positions.push_back(point); - } }; -void netherspite_infernalAI::Cleanup() -{ - Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar); - - if (pMalchezaar && pMalchezaar->isAlive()) - CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point); -} - -CreatureAI* GetAI_netherspite_infernal(Creature* pCreature) -{ - return new netherspite_infernalAI (pCreature); -} - -CreatureAI* GetAI_boss_malchezaar(Creature* pCreature) -{ - return new boss_malchezaarAI (pCreature); -} - void AddSC_boss_malchezaar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_malchezaar"; - newscript->GetAI = &GetAI_boss_malchezaar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "netherspite_infernal"; - newscript->GetAI = &GetAI_netherspite_infernal; - newscript->RegisterSelf(); + new boss_malchezaar(); + new netherspite_infernal(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 37ea79fefbe..d3d61abb0a0 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -80,492 +80,497 @@ enum SuperSpell SUPER_BLIZZARD, SUPER_AE, }; - -struct boss_aranAI : public ScriptedAI + class boss_shade_of_aran : public CreatureScript { - boss_aranAI(Creature *c) : ScriptedAI(c) +public: + boss_shade_of_aran() : CreatureScript("boss_shade_of_aran") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_aranAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 SecondarySpellTimer; - uint32 NormalCastTimer; - uint32 SuperCastTimer; - uint32 BerserkTimer; - uint32 CloseDoorTimer; // Don't close the door right on aggro in case some people are still entering. - - uint8 LastSuperSpell; - - uint32 FlameWreathTimer; - uint32 FlameWreathCheckTime; - uint64 FlameWreathTarget[3]; - float FWTargPosX[3]; - float FWTargPosY[3]; - - uint32 CurrentNormalSpell; - uint32 ArcaneCooldown; - uint32 FireCooldown; - uint32 FrostCooldown; - - uint32 DrinkInterruptTimer; - - bool ElementalsSpawned; - bool Drinking; - bool DrinkInturrupted; - - void Reset() + struct boss_aranAI : public ScriptedAI { - SecondarySpellTimer = 5000; - NormalCastTimer = 0; - SuperCastTimer = 35000; - BerserkTimer = 720000; - CloseDoorTimer = 15000; - - LastSuperSpell = rand()%3; - - FlameWreathTimer = 0; - FlameWreathCheckTime = 0; - - CurrentNormalSpell = 0; - ArcaneCooldown = 0; - FireCooldown = 0; - FrostCooldown = 0; - - DrinkInterruptTimer = 10000; - - ElementalsSpawned = false; - Drinking = false; - DrinkInturrupted = false; - - if (pInstance) + boss_aranAI(Creature *c) : ScriptedAI(c) { - // Not in progress - pInstance->SetData(TYPE_ARAN, NOT_STARTED); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); - } - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - { - pInstance->SetData(TYPE_ARAN, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); - } - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - - if (pInstance) - { - pInstance->SetData(TYPE_ARAN, IN_PROGRESS); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); - } - } - - void FlameWreathEffect() - { - std::vector targets; - std::list t_list = me->getThreatManager().getThreatList(); - - if (!t_list.size()) - return; - - //store the threat list in a different container - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //only on alive players - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - targets.push_back(pTarget); + pInstance = c->GetInstanceScript(); } - //cut down to size if we have more than 3 targets - while (targets.size() > 3) - targets.erase(targets.begin()+rand()%targets.size()); + InstanceScript* pInstance; - uint32 i = 0; - for (std::vector::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr) + uint32 SecondarySpellTimer; + uint32 NormalCastTimer; + uint32 SuperCastTimer; + uint32 BerserkTimer; + uint32 CloseDoorTimer; // Don't close the door right on aggro in case some people are still entering. + + uint8 LastSuperSpell; + + uint32 FlameWreathTimer; + uint32 FlameWreathCheckTime; + uint64 FlameWreathTarget[3]; + float FWTargPosX[3]; + float FWTargPosY[3]; + + uint32 CurrentNormalSpell; + uint32 ArcaneCooldown; + uint32 FireCooldown; + uint32 FrostCooldown; + + uint32 DrinkInterruptTimer; + + bool ElementalsSpawned; + bool Drinking; + bool DrinkInturrupted; + + void Reset() { - if (*itr) + SecondarySpellTimer = 5000; + NormalCastTimer = 0; + SuperCastTimer = 35000; + BerserkTimer = 720000; + CloseDoorTimer = 15000; + + LastSuperSpell = rand()%3; + + FlameWreathTimer = 0; + FlameWreathCheckTime = 0; + + CurrentNormalSpell = 0; + ArcaneCooldown = 0; + FireCooldown = 0; + FrostCooldown = 0; + + DrinkInterruptTimer = 10000; + + ElementalsSpawned = false; + Drinking = false; + DrinkInturrupted = false; + + if (pInstance) { - FlameWreathTarget[i] = (*itr)->GetGUID(); - FWTargPosX[i] = (*itr)->GetPositionX(); - FWTargPosY[i] = (*itr)->GetPositionY(); - DoCast((*itr), SPELL_FLAME_WREATH, true); - ++i; + // Not in progress + pInstance->SetData(TYPE_ARAN, NOT_STARTED); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (CloseDoorTimer) + void KilledUnit(Unit * /*victim*/) { - if (CloseDoorTimer <= diff) + DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - if (pInstance) + pInstance->SetData(TYPE_ARAN, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), true); + } + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + + if (pInstance) + { + pInstance->SetData(TYPE_ARAN, IN_PROGRESS); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); + } + } + + void FlameWreathEffect() + { + std::vector targets; + std::list t_list = me->getThreatManager().getThreatList(); + + if (!t_list.size()) + return; + + //store the threat list in a different container + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + //only on alive players + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + targets.push_back(pTarget); + } + + //cut down to size if we have more than 3 targets + while (targets.size() > 3) + targets.erase(targets.begin()+rand()%targets.size()); + + uint32 i = 0; + for (std::vector::const_iterator itr = targets.begin(); itr!= targets.end(); ++itr) + { + if (*itr) { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); - CloseDoorTimer = 0; + FlameWreathTarget[i] = (*itr)->GetGUID(); + FWTargPosX[i] = (*itr)->GetPositionX(); + FWTargPosY[i] = (*itr)->GetPositionY(); + DoCast((*itr), SPELL_FLAME_WREATH, true); + ++i; } - } else CloseDoorTimer -= diff; + } } - //Cooldowns for casts - if (ArcaneCooldown) + void UpdateAI(const uint32 diff) { - if (ArcaneCooldown >= diff) - ArcaneCooldown -= diff; - else ArcaneCooldown = 0; + if (!UpdateVictim()) + return; + + if (CloseDoorTimer) + { + if (CloseDoorTimer <= diff) + { + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false); + CloseDoorTimer = 0; + } + } else CloseDoorTimer -= diff; + } + + //Cooldowns for casts + if (ArcaneCooldown) + { + if (ArcaneCooldown >= diff) + ArcaneCooldown -= diff; + else ArcaneCooldown = 0; + } + + if (FireCooldown) + { + if (FireCooldown >= diff) + FireCooldown -= diff; + else FireCooldown = 0; + } + + if (FrostCooldown) + { + if (FrostCooldown >= diff) + FrostCooldown -= diff; + else FrostCooldown = 0; + } + + if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) + { + Drinking = true; + me->InterruptNonMeleeSpells(false); + + DoScriptText(SAY_DRINK, me); + + if (!DrinkInturrupted) + { + DoCast(me, SPELL_MASS_POLY, true); + DoCast(me, SPELL_CONJURE, false); + DoCast(me, SPELL_DRINK, false); + me->SetStandState(UNIT_STAND_STATE_SIT); + DrinkInterruptTimer = 10000; + } + } + + //Drink Interrupt + if (Drinking && DrinkInturrupted) + { + Drinking = false; + me->RemoveAurasDueToSpell(SPELL_DRINK); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000); + DoCast(me, SPELL_POTION, false); + } + + //Drink Interrupt Timer + if (Drinking && !DrinkInturrupted) + if (DrinkInterruptTimer >= diff) + DrinkInterruptTimer -= diff; + else + { + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_POTION, true); + DoCast(me, SPELL_AOE_PYROBLAST, false); + DrinkInturrupted = true; + Drinking = false; + } + + //Don't execute any more code if we are drinking + if (Drinking) + return; + + //Normal casts + if (NormalCastTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget) + return; + + uint32 Spells[3]; + uint8 AvailableSpells = 0; + + //Check for what spells are not on cooldown + if (!ArcaneCooldown) + { + Spells[AvailableSpells] = SPELL_ARCMISSLE; + ++AvailableSpells; + } + if (!FireCooldown) + { + Spells[AvailableSpells] = SPELL_FIREBALL; + ++AvailableSpells; + } + if (!FrostCooldown) + { + Spells[AvailableSpells] = SPELL_FROSTBOLT; + ++AvailableSpells; + } + + //If no available spells wait 1 second and try again + if (AvailableSpells) + { + CurrentNormalSpell = Spells[rand() % AvailableSpells]; + DoCast(pTarget, CurrentNormalSpell); + } + } + NormalCastTimer = 1000; + } else NormalCastTimer -= diff; + + if (SecondarySpellTimer <= diff) + { + switch (urand(0,1)) + { + case 0: + DoCast(me, SPELL_AOE_CS); + break; + case 1: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CHAINSOFICE); + break; + } + SecondarySpellTimer = urand(5000,20000); + } else SecondarySpellTimer -= diff; + + if (SuperCastTimer <= diff) + { + uint8 Available[2]; + + switch (LastSuperSpell) + { + case SUPER_AE: + Available[0] = SUPER_FLAME; + Available[1] = SUPER_BLIZZARD; + break; + case SUPER_FLAME: + Available[0] = SUPER_AE; + Available[1] = SUPER_BLIZZARD; + break; + case SUPER_BLIZZARD: + Available[0] = SUPER_FLAME; + Available[1] = SUPER_AE; + break; + } + + LastSuperSpell = Available[urand(0,1)]; + + switch (LastSuperSpell) + { + case SUPER_AE: + DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), me); + + DoCast(me, SPELL_BLINK_CENTER, true); + DoCast(me, SPELL_PLAYERPULL, true); + DoCast(me, SPELL_MASSSLOW, true); + DoCast(me, SPELL_AEXPLOSION, false); + break; + + case SUPER_FLAME: + DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), me); + + FlameWreathTimer = 20000; + FlameWreathCheckTime = 500; + + FlameWreathTarget[0] = 0; + FlameWreathTarget[1] = 0; + FlameWreathTarget[2] = 0; + + FlameWreathEffect(); + break; + + case SUPER_BLIZZARD: + DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), me); + + if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) + { + pSpawn->setFaction(me->getFaction()); + pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false); + } + break; + } + + SuperCastTimer = urand(35000,40000); + } else SuperCastTimer -= diff; + + if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + ElementalsSpawned = true; + + for (uint32 i = 0; i < 4; ++i) + { + if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) + { + pUnit->Attack(me->getVictim(), true); + pUnit->setFaction(me->getFaction()); + } + } + + DoScriptText(SAY_ELEMENTALS, me); + } + + if (BerserkTimer <= diff) + { + for (uint32 i = 0; i < 5; ++i) + { + if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + { + pUnit->Attack(me->getVictim(), true); + pUnit->setFaction(me->getFaction()); + } + } + + DoScriptText(SAY_TIMEOVER, me); + + BerserkTimer = 60000; + } else BerserkTimer -= diff; + + //Flame Wreath check + if (FlameWreathTimer) + { + if (FlameWreathTimer >= diff) + FlameWreathTimer -= diff; + else FlameWreathTimer = 0; + + if (FlameWreathCheckTime <= diff) + { + for (uint8 i = 0; i < 3; ++i) + { + if (!FlameWreathTarget[i]) + continue; + + Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]); + if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) + { + pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID()); + pUnit->CastSpell(pUnit, 11027, true); + FlameWreathTarget[i] = 0; + } + } + FlameWreathCheckTime = 500; + } else FlameWreathCheckTime -= diff; + } + + if (ArcaneCooldown && FireCooldown && FrostCooldown) + DoMeleeAttackIfReady(); } - if (FireCooldown) + void DamageTaken(Unit* /*pAttacker*/, uint32 &damage) { - if (FireCooldown >= diff) - FireCooldown -= diff; - else FireCooldown = 0; + if (!DrinkInturrupted && Drinking && damage) + DrinkInturrupted = true; } - if (FrostCooldown) + void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell) { - if (FrostCooldown >= diff) - FrostCooldown -= diff; - else FrostCooldown = 0; - } + //We only care about interrupt effects and only if they are durring a spell currently being casted + if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST && + Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST && + Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false)) + return; - if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20) - { - Drinking = true; + //Interrupt effect me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_DRINK, me); + //Normally we would set the cooldown equal to the spell duration + //but we do not have access to the DurationStore - if (!DrinkInturrupted) + switch (CurrentNormalSpell) { - DoCast(me, SPELL_MASS_POLY, true); - DoCast(me, SPELL_CONJURE, false); - DoCast(me, SPELL_DRINK, false); - me->SetStandState(UNIT_STAND_STATE_SIT); - DrinkInterruptTimer = 10000; + case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; + case SPELL_FIREBALL: FireCooldown = 5000; break; + case SPELL_FROSTBOLT: FrostCooldown = 5000; break; } } + }; - //Drink Interrupt - if (Drinking && DrinkInturrupted) - { - Drinking = false; - me->RemoveAurasDueToSpell(SPELL_DRINK); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000); - DoCast(me, SPELL_POTION, false); - } +}; + class mob_aran_elemental : public CreatureScript +{ +public: + mob_aran_elemental() : CreatureScript("mob_aran_elemental") { } - //Drink Interrupt Timer - if (Drinking && !DrinkInturrupted) - if (DrinkInterruptTimer >= diff) - DrinkInterruptTimer -= diff; - else - { - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_POTION, true); - DoCast(me, SPELL_AOE_PYROBLAST, false); - DrinkInturrupted = true; - Drinking = false; - } - - //Don't execute any more code if we are drinking - if (Drinking) - return; - - //Normal casts - if (NormalCastTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget) - return; - - uint32 Spells[3]; - uint8 AvailableSpells = 0; - - //Check for what spells are not on cooldown - if (!ArcaneCooldown) - { - Spells[AvailableSpells] = SPELL_ARCMISSLE; - ++AvailableSpells; - } - if (!FireCooldown) - { - Spells[AvailableSpells] = SPELL_FIREBALL; - ++AvailableSpells; - } - if (!FrostCooldown) - { - Spells[AvailableSpells] = SPELL_FROSTBOLT; - ++AvailableSpells; - } - - //If no available spells wait 1 second and try again - if (AvailableSpells) - { - CurrentNormalSpell = Spells[rand() % AvailableSpells]; - DoCast(pTarget, CurrentNormalSpell); - } - } - NormalCastTimer = 1000; - } else NormalCastTimer -= diff; - - if (SecondarySpellTimer <= diff) - { - switch (urand(0,1)) - { - case 0: - DoCast(me, SPELL_AOE_CS); - break; - case 1: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHAINSOFICE); - break; - } - SecondarySpellTimer = urand(5000,20000); - } else SecondarySpellTimer -= diff; - - if (SuperCastTimer <= diff) - { - uint8 Available[2]; - - switch (LastSuperSpell) - { - case SUPER_AE: - Available[0] = SUPER_FLAME; - Available[1] = SUPER_BLIZZARD; - break; - case SUPER_FLAME: - Available[0] = SUPER_AE; - Available[1] = SUPER_BLIZZARD; - break; - case SUPER_BLIZZARD: - Available[0] = SUPER_FLAME; - Available[1] = SUPER_AE; - break; - } - - LastSuperSpell = Available[urand(0,1)]; - - switch (LastSuperSpell) - { - case SUPER_AE: - DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), me); - - DoCast(me, SPELL_BLINK_CENTER, true); - DoCast(me, SPELL_PLAYERPULL, true); - DoCast(me, SPELL_MASSSLOW, true); - DoCast(me, SPELL_AEXPLOSION, false); - break; - - case SUPER_FLAME: - DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), me); - - FlameWreathTimer = 20000; - FlameWreathCheckTime = 500; - - FlameWreathTarget[0] = 0; - FlameWreathTarget[1] = 0; - FlameWreathTarget[2] = 0; - - FlameWreathEffect(); - break; - - case SUPER_BLIZZARD: - DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), me); - - if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000)) - { - pSpawn->setFaction(me->getFaction()); - pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false); - } - break; - } - - SuperCastTimer = urand(35000,40000); - } else SuperCastTimer -= diff; - - if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40) - { - ElementalsSpawned = true; - - for (uint32 i = 0; i < 4; ++i) - { - if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) - { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); - } - } - - DoScriptText(SAY_ELEMENTALS, me); - } - - if (BerserkTimer <= diff) - { - for (uint32 i = 0; i < 5; ++i) - { - if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); - } - } - - DoScriptText(SAY_TIMEOVER, me); - - BerserkTimer = 60000; - } else BerserkTimer -= diff; - - //Flame Wreath check - if (FlameWreathTimer) - { - if (FlameWreathTimer >= diff) - FlameWreathTimer -= diff; - else FlameWreathTimer = 0; - - if (FlameWreathCheckTime <= diff) - { - for (uint8 i = 0; i < 3; ++i) - { - if (!FlameWreathTarget[i]) - continue; - - Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]); - if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) - { - pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID()); - pUnit->CastSpell(pUnit, 11027, true); - FlameWreathTarget[i] = 0; - } - } - FlameWreathCheckTime = 500; - } else FlameWreathCheckTime -= diff; - } - - if (ArcaneCooldown && FireCooldown && FrostCooldown) - DoMeleeAttackIfReady(); - } - - void DamageTaken(Unit* /*pAttacker*/, uint32 &damage) + CreatureAI* GetAI(Creature* pCreature) const { - if (!DrinkInturrupted && Drinking && damage) - DrinkInturrupted = true; + return new water_elementalAI (pCreature); } - void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell) + struct water_elementalAI : public ScriptedAI { - //We only care about interrupt effects and only if they are durring a spell currently being casted - if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST && - Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false)) - return; + water_elementalAI(Creature *c) : ScriptedAI(c) {} - //Interrupt effect - me->InterruptNonMeleeSpells(false); + uint32 CastTimer; - //Normally we would set the cooldown equal to the spell duration - //but we do not have access to the DurationStore - - switch (CurrentNormalSpell) + void Reset() { - case SPELL_ARCMISSLE: ArcaneCooldown = 5000; break; - case SPELL_FIREBALL: FireCooldown = 5000; break; - case SPELL_FROSTBOLT: FrostCooldown = 5000; break; + CastTimer = 2000 + (rand()%3000); } - } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (CastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WATERBOLT); + CastTimer = urand(2000,5000); + } else CastTimer -= diff; + } + }; + }; -struct water_elementalAI : public ScriptedAI +// CONVERT TO ACID class mob_shadow_of_aran : public CreatureScript { - water_elementalAI(Creature *c) : ScriptedAI(c) {} +public: + mob_shadow_of_aran() : CreatureScript("mob_shadow_of_aran") { } - uint32 CastTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CastTimer = 2000 + (rand()%3000); + sLog.outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", pCreature->GetEntry()); + SimpleAI* ai = new SimpleAI (pCreature); + + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; + ai->Spell[0].Cooldown = 5000; + ai->Spell[0].First_Cast = 1000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + + ai->EnterEvadeMode(); + + return ai; } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (CastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WATERBOLT); - CastTimer = urand(2000,5000); - } else CastTimer -= diff; - } }; -CreatureAI* GetAI_boss_aran(Creature* pCreature) -{ - return new boss_aranAI (pCreature); -} - -CreatureAI* GetAI_water_elemental(Creature* pCreature) -{ - return new water_elementalAI (pCreature); -} - -// CONVERT TO ACID -CreatureAI* GetAI_shadow_of_aran(Creature* pCreature) -{ - sLog.outString("TSCR: Convert simpleAI script for Creature Entry %u to ACID", pCreature->GetEntry()); - SimpleAI* ai = new SimpleAI (pCreature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_SHADOW_PYRO; - ai->Spell[0].Cooldown = 5000; - ai->Spell[0].First_Cast = 1000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->EnterEvadeMode(); - - return ai; -} - void AddSC_boss_shade_of_aran() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shade_of_aran"; - newscript->GetAI = &GetAI_boss_aran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadow_of_aran"; - newscript->GetAI = &GetAI_shadow_of_aran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_aran_elemental"; - newscript->GetAI = &GetAI_water_elemental; - newscript->RegisterSelf(); + new boss_shade_of_aran(); + new mob_shadow_of_aran(); + new mob_aran_elemental(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index 039b517bd9b..cd8db6c5cfd 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -55,365 +55,374 @@ EndScriptData */ #define CREATURE_FIENDISHIMP 17267 #define CREATURE_PORTAL 17265 #define CREATURE_KILREK 17229 - -struct mob_kilrekAI : public ScriptedAI + class mob_kilrek : public CreatureScript { - mob_kilrekAI(Creature *c) : ScriptedAI(c) +public: + mob_kilrek() : CreatureScript("mob_kilrek") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_kilrekAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 TerestianGUID; - - uint32 AmplifyTimer; - - void Reset() + struct mob_kilrekAI : public ScriptedAI { - TerestianGUID = 0; - AmplifyTimer = 2000; - } - - void EnterCombat(Unit * /*who*/) - { - if (!pInstance) + mob_kilrekAI(Creature *c) : ScriptedAI(c) { - ERROR_INST_DATA(me); - return; + pInstance = c->GetInstanceScript(); } - } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) + InstanceScript* pInstance; + + uint64 TerestianGUID; + + uint32 AmplifyTimer; + + void Reset() { - uint64 TerestianGUID = pInstance->GetData64(DATA_TERESTIAN); - if (TerestianGUID) + TerestianGUID = 0; + AmplifyTimer = 2000; + } + + void EnterCombat(Unit * /*who*/) + { + if (!pInstance) { - Unit* Terestian = Unit::GetUnit((*me), TerestianGUID); - if (Terestian && Terestian->isAlive()) - DoCast(Terestian, SPELL_BROKEN_PACT, true); + ERROR_INST_DATA(me); + return; } - } else ERROR_INST_DATA(me); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (AmplifyTimer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_AMPLIFY_FLAMES); - - AmplifyTimer = urand(10000,20000); - } else AmplifyTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_demon_chainAI : public ScriptedAI -{ - mob_demon_chainAI(Creature *c) : ScriptedAI(c) {} - - uint64 SacrificeGUID; - - void Reset() - { - SacrificeGUID = 0; - } - - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void JustDied(Unit * /*killer*/) - { - if (SacrificeGUID) - { - Unit* Sacrifice = Unit::GetUnit((*me),SacrificeGUID); - if (Sacrifice) - Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); } - } -}; -struct mob_fiendish_portalAI : public PassiveAI -{ - mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(me){} - - SummonList summons; - - void Reset() - { - summons.DespawnAll(); - } - - void JustSummoned(Creature* summon) - { - summons.Summon(summon); - DoZoneInCombat(summon); - } - - void DespawnAllImp() - { - summons.DespawnAll(); - } -}; - -struct boss_terestianAI : public ScriptedAI -{ - boss_terestianAI(Creature *c) : ScriptedAI(c) - { - for (uint8 i = 0; i < 2; ++i) - PortalGUID[i] = 0; - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint64 PortalGUID[2]; - uint8 PortalsCount; - - uint32 SacrificeTimer; - uint32 ShadowboltTimer; - uint32 SummonTimer; - uint32 BerserkTimer; - - bool SummonedPortals; - bool Berserk; - - void Reset() - { - for (uint8 i = 0; i < 2; ++i) + void JustDied(Unit* /*Killer*/) { - if (PortalGUID[i]) + if (pInstance) { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i])) + uint64 TerestianGUID = pInstance->GetData64(DATA_TERESTIAN); + if (TerestianGUID) { - CAST_AI(mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); - pPortal->ForcedDespawn(); + Unit* Terestian = Unit::GetUnit((*me), TerestianGUID); + if (Terestian && Terestian->isAlive()) + DoCast(Terestian, SPELL_BROKEN_PACT, true); } - - PortalGUID[i] = 0; - } + } else ERROR_INST_DATA(me); } - PortalsCount = 0; - SacrificeTimer = 30000; - ShadowboltTimer = 5000; - SummonTimer = 10000; - BerserkTimer = 600000; - - SummonedPortals = false; - Berserk = false; - - if (pInstance) - pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED); - - me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); - - if (Minion* Kilrek = me->GetFirstMinion()) + void UpdateAI(const uint32 diff) { - if (!Kilrek->isAlive()) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (AmplifyTimer <= diff) { - Kilrek->UnSummon(); - DoCast(me, SPELL_SUMMON_IMP, true); - } + me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_AMPLIFY_FLAMES); + + AmplifyTimer = urand(10000,20000); + } else AmplifyTimer -= diff; + + DoMeleeAttackIfReady(); } - else DoCast(me, SPELL_SUMMON_IMP, true); + }; + +}; + class mob_demon_chain : public CreatureScript +{ +public: + mob_demon_chain() : CreatureScript("mob_demon_chain") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_demon_chainAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_demon_chainAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + mob_demon_chainAI(Creature *c) : ScriptedAI(c) {} - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_PORTAL) + uint64 SacrificeGUID; + + void Reset() { - PortalGUID[PortalsCount] = pSummoned->GetGUID(); - ++PortalsCount; - - if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) - { - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); - SummonedPortals = true; - } - } - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*killer*/) - { - for (uint8 i = 0; i < 2; ++i) - { - if (PortalGUID[i]) - { - if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i])) - pPortal->ForcedDespawn(); - - PortalGUID[i] = 0; - } + SacrificeGUID = 0; } - DoScriptText(SAY_DEATH, me); + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} - if (pInstance) - pInstance->SetData(TYPE_TERESTIAN, DONE); + void JustDied(Unit * /*killer*/) + { + if (SacrificeGUID) + { + Unit* Sacrifice = Unit::GetUnit((*me),SacrificeGUID); + if (Sacrifice) + Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE); + } + } + }; + +}; + class mob_fiendish_portal : public CreatureScript +{ +public: + mob_fiendish_portal() : CreatureScript("mob_fiendish_portal") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fiendish_portalAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_fiendish_portalAI : public PassiveAI { - if (!UpdateVictim()) - return; + mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(me){} - if (SacrificeTimer <= diff) + SummonList summons; + + void Reset() { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (pTarget && pTarget->isAlive()) - { - DoCast(pTarget, SPELL_SACRIFICE, true); - DoCast(pTarget, SPELL_SUMMON_DEMONCHAINS, true); - - if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000)) - { - CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID(); - Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); - DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me); - SacrificeTimer = 30000; - } - } - } else SacrificeTimer -= diff; - - if (ShadowboltTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); - ShadowboltTimer = 10000; - } else ShadowboltTimer -= diff; - - if (SummonTimer <= diff) - { - if (!PortalGUID[0]) - DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL, false); - - if (!PortalGUID[1]) - DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL_1, false); - - if (PortalGUID[0] && PortalGUID[1]) - { - if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0,1)])) - pPortal->CastSpell(me->getVictim(), SPELL_SUMMON_FIENDISIMP, false); - SummonTimer = 5000; - } - } else SummonTimer -= diff; - - if (!Berserk) - { - if (BerserkTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - Berserk = true; - } else BerserkTimer -= diff; + summons.DespawnAll(); } - DoMeleeAttackIfReady(); - } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + DoZoneInCombat(summon); + } + + void DespawnAllImp() + { + summons.DespawnAll(); + } + }; + }; #define SPELL_FIREBOLT 30050 // Blasts a target for 181-209 Fire damage. - -struct mob_fiendish_impAI : public ScriptedAI + class mob_fiendish_imp : public CreatureScript { - mob_fiendish_impAI(Creature *c) : ScriptedAI(c) {} +public: + mob_fiendish_imp() : CreatureScript("mob_fiendish_imp") { } - uint32 FireboltTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FireboltTimer = 2000; - - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + return new mob_fiendish_impAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct mob_fiendish_impAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + mob_fiendish_impAI(Creature *c) : ScriptedAI(c) {} - if (FireboltTimer <= diff) + uint32 FireboltTimer; + + void Reset() { - DoCast(me->getVictim(), SPELL_FIREBOLT); - FireboltTimer = 2200; - } else FireboltTimer -= diff; + FireboltTimer = 2000; + + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (FireboltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBOLT); + FireboltTimer = 2200; + } else FireboltTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; - -CreatureAI* GetAI_mob_kilrek(Creature* pCreature) + class boss_terestian_illhoof : public CreatureScript { - return new mob_kilrekAI (pCreature); -} +public: + boss_terestian_illhoof() : CreatureScript("boss_terestian_illhoof") { } -CreatureAI* GetAI_mob_fiendish_imp(Creature* pCreature) -{ - return new mob_fiendish_impAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_terestianAI (pCreature); + } -CreatureAI* GetAI_mob_fiendish_portal(Creature* pCreature) -{ - return new mob_fiendish_portalAI (pCreature); -} + struct boss_terestianAI : public ScriptedAI + { + boss_terestianAI(Creature *c) : ScriptedAI(c) + { + for (uint8 i = 0; i < 2; ++i) + PortalGUID[i] = 0; + pInstance = c->GetInstanceScript(); + } -CreatureAI* GetAI_boss_terestian_illhoof(Creature* pCreature) -{ - return new boss_terestianAI (pCreature); -} + InstanceScript *pInstance; -CreatureAI* GetAI_mob_demon_chain(Creature* pCreature) -{ - return new mob_demon_chainAI(pCreature); -} + uint64 PortalGUID[2]; + uint8 PortalsCount; + + uint32 SacrificeTimer; + uint32 ShadowboltTimer; + uint32 SummonTimer; + uint32 BerserkTimer; + + bool SummonedPortals; + bool Berserk; + + void Reset() + { + for (uint8 i = 0; i < 2; ++i) + { + if (PortalGUID[i]) + { + if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i])) + { + CAST_AI(mob_fiendish_portal::mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp(); + pPortal->ForcedDespawn(); + } + + PortalGUID[i] = 0; + } + } + + PortalsCount = 0; + SacrificeTimer = 30000; + ShadowboltTimer = 5000; + SummonTimer = 10000; + BerserkTimer = 600000; + + SummonedPortals = false; + Berserk = false; + + if (pInstance) + pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED); + + me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT); + + if (Minion* Kilrek = me->GetFirstMinion()) + { + if (!Kilrek->isAlive()) + { + Kilrek->UnSummon(); + DoCast(me, SPELL_SUMMON_IMP, true); + } + } + else DoCast(me, SPELL_SUMMON_IMP, true); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_PORTAL) + { + PortalGUID[PortalsCount] = pSummoned->GetGUID(); + ++PortalsCount; + + if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1) + { + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + SummonedPortals = true; + } + } + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*killer*/) + { + for (uint8 i = 0; i < 2; ++i) + { + if (PortalGUID[i]) + { + if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i])) + pPortal->ForcedDespawn(); + + PortalGUID[i] = 0; + } + } + + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_TERESTIAN, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (SacrificeTimer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + if (pTarget && pTarget->isAlive()) + { + DoCast(pTarget, SPELL_SACRIFICE, true); + DoCast(pTarget, SPELL_SUMMON_DEMONCHAINS, true); + + if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000)) + { + CAST_AI(mob_demon_chain::mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID(); + Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true); + DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me); + SacrificeTimer = 30000; + } + } + } else SacrificeTimer -= diff; + + if (ShadowboltTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_TOPAGGRO, 0), SPELL_SHADOW_BOLT); + ShadowboltTimer = 10000; + } else ShadowboltTimer -= diff; + + if (SummonTimer <= diff) + { + if (!PortalGUID[0]) + DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL, false); + + if (!PortalGUID[1]) + DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL_1, false); + + if (PortalGUID[0] && PortalGUID[1]) + { + if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0,1)])) + pPortal->CastSpell(me->getVictim(), SPELL_SUMMON_FIENDISIMP, false); + SummonTimer = 5000; + } + } else SummonTimer -= diff; + + if (!Berserk) + { + if (BerserkTimer <= diff) + { + DoCast(me, SPELL_BERSERK); + Berserk = true; + } else BerserkTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_terestian_illhoof() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_terestian_illhoof"; - newscript->GetAI = &GetAI_boss_terestian_illhoof; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fiendish_imp"; - newscript->GetAI = &GetAI_mob_fiendish_imp; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name= "mob_fiendish_portal"; - newscript->GetAI = &GetAI_mob_fiendish_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_kilrek"; - newscript->GetAI = &GetAI_mob_kilrek; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_demon_chain"; - newscript->GetAI = &GetAI_mob_demon_chain; - newscript->RegisterSelf(); + new boss_terestian_illhoof(); + new mob_fiendish_imp(); + new mob_fiendish_portal(); + new mob_kilrek(); + new mob_demon_chain(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 6498e48069a..6c6d46880a2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -88,7 +88,7 @@ EndScriptData */ #define CREATURE_CYCLONE 18412 #define CREATURE_CRONE 18168 -void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) +void SummonCroneIfReady(InstanceScript* pInstance, Creature* pCreature) { pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, SPECIAL); // Increment DeathCount @@ -101,599 +101,648 @@ void SummonCroneIfReady(ScriptedInstance* pInstance, Creature* pCreature) } } }; - -struct boss_dorotheeAI : public ScriptedAI + class boss_dorothee : public CreatureScript { - boss_dorotheeAI(Creature* c) : ScriptedAI(c) +public: + boss_dorothee() : CreatureScript("boss_dorothee") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_dorotheeAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 AggroTimer; - - uint32 WaterBoltTimer; - uint32 FearTimer; - uint32 SummonTitoTimer; - - bool SummonedTito; - bool TitoDied; - - void Reset() + struct boss_dorotheeAI : public ScriptedAI { - AggroTimer = 500; - - WaterBoltTimer = 5000; - FearTimer = 15000; - SummonTitoTimer = 47500; - - SummonedTito = false; - TitoDied = false; - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_DOROTHEE_AGGRO, me); - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void SummonTito(); // See below - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DOROTHEE_DEATH, me); - - if (pInstance) - SummonCroneIfReady(pInstance, me); - } - - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + boss_dorotheeAI(Creature* c) : ScriptedAI(c) { - if (AggroTimer <= diff) + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 AggroTimer; + + uint32 WaterBoltTimer; + uint32 FearTimer; + uint32 SummonTitoTimer; + + bool SummonedTito; + bool TitoDied; + + void Reset() + { + AggroTimer = 500; + + WaterBoltTimer = 5000; + FearTimer = 15000; + SummonTitoTimer = 47500; + + SummonedTito = false; + TitoDied = false; + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_DOROTHEE_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void SummonTito(); + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DOROTHEE_DEATH, me); + + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void UpdateAI(const uint32 diff) + { + if (AggroTimer) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } + + if (!UpdateVictim()) + return; + + if (WaterBoltTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT); + WaterBoltTimer = TitoDied ? 1500 : 5000; + } else WaterBoltTimer -= diff; + + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SCREAM); + FearTimer = 30000; + } else FearTimer -= diff; + + if (!SummonedTito) + { + if (SummonTitoTimer <= diff) + SummonTito(); + else SummonTitoTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - if (WaterBoltTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_WATERBOLT); - WaterBoltTimer = TitoDied ? 1500 : 5000; - } else WaterBoltTimer -= diff; - - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SCREAM); - FearTimer = 30000; - } else FearTimer -= diff; - - if (!SummonedTito) - { - if (SummonTitoTimer <= diff) - SummonTito(); - else SummonTitoTimer -= diff; - } - - DoMeleeAttackIfReady(); - } }; - -struct mob_titoAI : public ScriptedAI + class mob_tito : public CreatureScript { - mob_titoAI(Creature* c) : ScriptedAI(c) {} +public: + mob_tito() : CreatureScript("mob_tito") { } - uint64 DorotheeGUID; - uint32 YipTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DorotheeGUID = 0; - YipTimer = 10000; + return new mob_titoAI(pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void JustDied(Unit* /*killer*/) + struct mob_titoAI : public ScriptedAI { - if (DorotheeGUID) + mob_titoAI(Creature* c) : ScriptedAI(c) {} + + uint64 DorotheeGUID; + uint32 YipTimer; + + void Reset() { - Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID)); - if (Dorothee && Dorothee->isAlive()) + DorotheeGUID = 0; + YipTimer = 10000; + } + + void EnterCombat(Unit* /*who*/) {} + + void JustDied(Unit* /*killer*/) + { + if (DorotheeGUID) { - CAST_AI(boss_dorotheeAI, Dorothee->AI())->TitoDied = true; - DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID)); + if (Dorothee && Dorothee->isAlive()) + { + CAST_AI(boss_dorothee::boss_dorotheeAI, Dorothee->AI())->TitoDied = true; + DoScriptText(SAY_DOROTHEE_TITO_DEATH, Dorothee); + } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (YipTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_YIPPING); - YipTimer = 10000; - } else YipTimer -= diff; + if (!UpdateVictim()) + return; + + if (YipTimer <= diff) + { + DoCast(me->getVictim(), SPELL_YIPPING); + YipTimer = 10000; + } else YipTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -void boss_dorotheeAI::SummonTito() +void boss_dorothee::boss_dorotheeAI::SummonTito() { if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { DoScriptText(SAY_DOROTHEE_SUMMON, me); - CAST_AI(mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); + CAST_AI(mob_tito::mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID(); pTito->AI()->AttackStart(me->getVictim()); SummonedTito = true; TitoDied = false; } } - -struct boss_strawmanAI : public ScriptedAI + class boss_strawman : public CreatureScript { - boss_strawmanAI(Creature* c) : ScriptedAI(c) +public: + boss_strawman() : CreatureScript("boss_strawman") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_strawmanAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 AggroTimer; - uint32 BrainBashTimer; - uint32 BrainWipeTimer; - - void Reset() + struct boss_strawmanAI : public ScriptedAI { - AggroTimer = 13000; - BrainBashTimer = 5000; - BrainWipeTimer = 7000; - } - - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_STRAWMAN_AGGRO, me); - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) - { - if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) + boss_strawmanAI(Creature* c) : ScriptedAI(c) { - /* - if (not direct damage(aoe,dot)) - return; - */ - - DoCast(me, SPELL_BURNING_STRAW, true); + pInstance = c->GetInstanceScript(); } - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_STRAWMAN_DEATH, me); + InstanceScript* pInstance; - if (pInstance) - SummonCroneIfReady(pInstance, me); - } + uint32 AggroTimer; + uint32 BrainBashTimer; + uint32 BrainWipeTimer; - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_STRAWMAN_SLAY, me); - } - - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + void Reset() { - if (AggroTimer <= diff) + AggroTimer = 13000; + BrainBashTimer = 5000; + BrainWipeTimer = 7000; + } + + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_STRAWMAN_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) + { + if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + /* + if (not direct damage(aoe,dot)) + return; + */ + + DoCast(me, SPELL_BURNING_STRAW, true); + } } - if (!UpdateVictim()) - return; - - if (BrainBashTimer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_BRAIN_BASH); - BrainBashTimer = 15000; - } else BrainBashTimer -= diff; + DoScriptText(SAY_STRAWMAN_DEATH, me); - if (BrainWipeTimer <= diff) + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void KilledUnit(Unit* /*victim*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BRAIN_WIPE); - BrainWipeTimer = 20000; - } else BrainWipeTimer -= diff; + DoScriptText(SAY_STRAWMAN_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + if (AggroTimer) + { + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } + + if (!UpdateVictim()) + return; + + if (BrainBashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BRAIN_BASH); + BrainBashTimer = 15000; + } else BrainBashTimer -= diff; + + if (BrainWipeTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BRAIN_WIPE); + BrainWipeTimer = 20000; + } else BrainWipeTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; - -struct boss_tinheadAI : public ScriptedAI + class boss_tinhead : public CreatureScript { - boss_tinheadAI(Creature* c) : ScriptedAI(c) +public: + boss_tinhead() : CreatureScript("boss_tinhead") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_tinheadAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 AggroTimer; - uint32 CleaveTimer; - uint32 RustTimer; - - uint8 RustCount; - - void Reset() + struct boss_tinheadAI : public ScriptedAI { - AggroTimer = 15000; - CleaveTimer = 5000; - RustTimer = 30000; - - RustCount = 0; - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_TINHEAD_AGGRO, me); - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_TINHEAD_DEATH, me); - - if (pInstance) - SummonCroneIfReady(pInstance, me); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_TINHEAD_SLAY, me); - } - - void UpdateAI(const uint32 diff) - { - if (AggroTimer) + boss_tinheadAI(Creature* c) : ScriptedAI(c) { - if (AggroTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + pInstance = c->GetInstanceScript(); } - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (CleaveTimer <= diff) + uint32 AggroTimer; + uint32 CleaveTimer; + uint32 RustTimer; + + uint8 RustCount; + + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); + AggroTimer = 15000; CleaveTimer = 5000; - } else CleaveTimer -= diff; + RustTimer = 30000; - if (RustCount < 8) + RustCount = 0; + } + + void EnterCombat(Unit* /*who*/) { - if (RustTimer <= diff) + DoScriptText(SAY_TINHEAD_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_TINHEAD_DEATH, me); + + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_TINHEAD_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + if (AggroTimer) { - ++RustCount; - DoScriptText(EMOTE_RUST, me); - DoCast(me, SPELL_RUST); - RustTimer = 6000; - } else RustTimer -= diff; - } + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + if (!UpdateVictim()) + return; -struct boss_roarAI : public ScriptedAI -{ - boss_roarAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 AggroTimer; - uint32 MangleTimer; - uint32 ShredTimer; - uint32 ScreamTimer; - - void Reset() - { - AggroTimer = 20000; - MangleTimer = 5000; - ShredTimer = 10000; - ScreamTimer = 15000; - } - - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - ScriptedAI::AttackStart(who); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_ROAR_AGGRO, me); - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_ROAR_DEATH, me); - - if (pInstance) - SummonCroneIfReady(pInstance, me); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_ROAR_SLAY, me); - } - - void UpdateAI(const uint32 diff) - { - if (AggroTimer) - { - if (AggroTimer <= diff) + if (CleaveTimer <= diff) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer = 0; - } else AggroTimer -= diff; + DoCast(me->getVictim(), SPELL_CLEAVE); + CleaveTimer = 5000; + } else CleaveTimer -= diff; + + if (RustCount < 8) + { + if (RustTimer <= diff) + { + ++RustCount; + DoScriptText(EMOTE_RUST, me); + DoCast(me, SPELL_RUST); + RustTimer = 6000; + } else RustTimer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - if (MangleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_MANGLE); - MangleTimer = urand(5000,8000); - } else MangleTimer -= diff; - - if (ShredTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHRED); - ShredTimer = urand(10000,15000); - } else ShredTimer -= diff; - - if (ScreamTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FRIGHTENED_SCREAM); - ScreamTimer = urand(20000,30000); - } else ScreamTimer -= diff; - - DoMeleeAttackIfReady(); - } }; - -struct boss_croneAI : public ScriptedAI + class boss_roar : public CreatureScript { - boss_croneAI(Creature* c) : ScriptedAI(c) +public: + boss_roar() : CreatureScript("boss_roar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_roarAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 CycloneTimer; - uint32 ChainLightningTimer; - - void Reset() + struct boss_roarAI : public ScriptedAI { - CycloneTimer = 30000; - ChainLightningTimer = 10000; - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_CRONE_DEATH, me); - - if (pInstance) + boss_roarAI(Creature* c) : ScriptedAI(c) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + pInstance = c->GetInstanceScript(); } + + InstanceScript* pInstance; + + uint32 AggroTimer; + uint32 MangleTimer; + uint32 ShredTimer; + uint32 ScreamTimer; + + void Reset() + { + AggroTimer = 20000; + MangleTimer = 5000; + ShredTimer = 10000; + ScreamTimer = 15000; + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::AttackStart(who); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_ROAR_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_ROAR_DEATH, me); + + if (pInstance) + SummonCroneIfReady(pInstance, me); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_ROAR_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + if (AggroTimer) + { + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer = 0; + } else AggroTimer -= diff; + } + + if (!UpdateVictim()) + return; + + if (MangleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MANGLE); + MangleTimer = urand(5000,8000); + } else MangleTimer -= diff; + + if (ShredTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHRED); + ShredTimer = urand(10000,15000); + } else ShredTimer -= diff; + + if (ScreamTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FRIGHTENED_SCREAM); + ScreamTimer = urand(20000,30000); + } else ScreamTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_crone : public CreatureScript +{ +public: + boss_crone() : CreatureScript("boss_crone") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_croneAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_croneAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - if (CycloneTimer <= diff) + boss_croneAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 CycloneTimer; + uint32 ChainLightningTimer; + + void Reset() { - if (Creature* Cyclone = DoSpawnCreature(CREATURE_CYCLONE, urand(0,9), urand(0,9), 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) - Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_VISUAL, true); CycloneTimer = 30000; - } else CycloneTimer -= diff; + ChainLightningTimer = 10000; + } - if (ChainLightningTimer <= diff) + void JustReachedHome() { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightningTimer = 15000; - } else ChainLightningTimer -= diff; + me->ForcedDespawn(); + } - DoMeleeAttackIfReady(); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), me); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_CRONE_DEATH, me); + + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + if (CycloneTimer <= diff) + { + if (Creature* Cyclone = DoSpawnCreature(CREATURE_CYCLONE, urand(0,9), urand(0,9), 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000)) + Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_VISUAL, true); + CycloneTimer = 30000; + } else CycloneTimer -= diff; + + if (ChainLightningTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + ChainLightningTimer = 15000; + } else ChainLightningTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_cyclone : public CreatureScript +{ +public: + mob_cyclone() : CreatureScript("mob_cyclone") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_cycloneAI(pCreature); } + + struct mob_cycloneAI : public ScriptedAI + { + mob_cycloneAI(Creature* c) : ScriptedAI(c) {} + + uint32 MoveTimer; + + void Reset() + { + MoveTimer = 1000; + } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit* /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(SPELL_KNOCKBACK)) + DoCast(me, SPELL_KNOCKBACK, true); + + if (MoveTimer <= diff) + { + Position pos; + me->GetRandomNearPosition(pos, 10); + me->GetMotionMaster()->MovePoint(0, pos); + MoveTimer = urand(5000,8000); + } else MoveTimer -= diff; + } + }; + }; -struct mob_cycloneAI : public ScriptedAI -{ - mob_cycloneAI(Creature* c) : ScriptedAI(c) {} - uint32 MoveTimer; - void Reset() - { - MoveTimer = 1000; - } - void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) - { - } - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(SPELL_KNOCKBACK)) - DoCast(me, SPELL_KNOCKBACK, true); - if (MoveTimer <= diff) - { - Position pos; - me->GetRandomNearPosition(pos, 10); - me->GetMotionMaster()->MovePoint(0, pos); - MoveTimer = urand(5000,8000); - } else MoveTimer -= diff; - } -}; - -CreatureAI* GetAI_boss_dorothee(Creature* pCreature) -{ - return new boss_dorotheeAI(pCreature); -} - -CreatureAI* GetAI_boss_strawman(Creature* pCreature) -{ - return new boss_strawmanAI(pCreature); -} - -CreatureAI* GetAI_boss_tinhead(Creature* pCreature) -{ - return new boss_tinheadAI(pCreature); -} - -CreatureAI* GetAI_boss_roar(Creature* pCreature) -{ - return new boss_roarAI(pCreature); -} - -CreatureAI* GetAI_boss_crone(Creature* pCreature) -{ - return new boss_croneAI(pCreature); -} - -CreatureAI* GetAI_mob_tito(Creature* pCreature) -{ - return new mob_titoAI(pCreature); -} - -CreatureAI* GetAI_mob_cyclone(Creature* pCreature) -{ - return new mob_cycloneAI(pCreature); -} /**************************************/ /**** Opera Red Riding Hood Event ****/ @@ -714,146 +763,160 @@ CreatureAI* GetAI_mob_cyclone(Creature* pCreature) /**** The Wolf's Entry ****/ #define CREATURE_BIG_BAD_WOLF 17521 - -bool GossipHello_npc_grandmother(Player* pPlayer, Creature* pCreature) + class npc_grandmother : public CreatureScript { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GRANDMA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(8990, pCreature->GetGUID()); +public: + npc_grandmother() : CreatureScript("npc_grandmother") { } - return true; -} - -bool GossipSelect_npc_grandmother(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) - pBigBadWolf->AI()->AttackStart(pPlayer); - - pCreature->ForcedDespawn(); - } - - return true; -} - -struct boss_bigbadwolfAI : public ScriptedAI -{ - boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 ChaseTimer; - uint32 FearTimer; - uint32 SwipeTimer; - - uint64 HoodGUID; - float TempThreat; - - bool IsChasing; - - void Reset() - { - ChaseTimer = 30000; - FearTimer = 25000 + rand()%10000; - SwipeTimer = 5000; - - HoodGUID = 0; - TempThreat = 0; - - IsChasing = false; - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_WOLF_AGGRO, me); - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void JustDied(Unit* /*killer*/) - { - DoPlaySoundToSet(me, SOUND_WOLF_DEATH); - - if (pInstance) + if (uiAction == GOSSIP_ACTION_INFO_DEF) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + if (Creature* pBigBadWolf = pCreature->SummonCreature(CREATURE_BIG_BAD_WOLF, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + pBigBadWolf->AI()->AttackStart(pPlayer); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + pCreature->ForcedDespawn(); } + + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - - if (ChaseTimer <= diff) - { - if (!IsChasing) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - DoScriptText(SAY_WOLF_HOOD, me); - DoCast(pTarget, SPELL_LITTLE_RED_RIDING_HOOD, true); - TempThreat = DoGetThreat(pTarget); - if (TempThreat) - DoModifyThreatPercent(pTarget, -100); - HoodGUID = pTarget->GetGUID(); - me->AddThreat(pTarget, 1000000.0f); - ChaseTimer = 20000; - IsChasing = true; - } - } - else - { - IsChasing = false; - - if (Unit *pTarget = Unit::GetUnit((*me), HoodGUID)) - { - HoodGUID = 0; - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); - me->AddThreat(pTarget, TempThreat); - TempThreat = 0; - } - - ChaseTimer = 40000; - } - } else ChaseTimer -= diff; - - if (IsChasing) - return; - - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TERRIFYING_HOWL); - FearTimer = urand(25000,35000); - } else FearTimer -= diff; - - if (SwipeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WIDE_SWIPE); - SwipeTimer = urand(25000,30000); - } else SwipeTimer -= diff; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GRANDMA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(8990, pCreature->GetGUID()); + return true; } + }; -CreatureAI* GetAI_boss_bigbadwolf(Creature* pCreature) + class boss_bigbadwolf : public CreatureScript { - return new boss_bigbadwolfAI(pCreature); -} +public: + boss_bigbadwolf() : CreatureScript("boss_bigbadwolf") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_bigbadwolfAI(pCreature); + } + + struct boss_bigbadwolfAI : public ScriptedAI + { + boss_bigbadwolfAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 ChaseTimer; + uint32 FearTimer; + uint32 SwipeTimer; + + uint64 HoodGUID; + float TempThreat; + + bool IsChasing; + + void Reset() + { + ChaseTimer = 30000; + FearTimer = 25000 + rand()%10000; + SwipeTimer = 5000; + + HoodGUID = 0; + TempThreat = 0; + + IsChasing = false; + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_WOLF_AGGRO, me); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void JustDied(Unit* /*killer*/) + { + DoPlaySoundToSet(me, SOUND_WOLF_DEATH); + + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + + if (ChaseTimer <= diff) + { + if (!IsChasing) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_WOLF_HOOD, me); + DoCast(pTarget, SPELL_LITTLE_RED_RIDING_HOOD, true); + TempThreat = DoGetThreat(pTarget); + if (TempThreat) + DoModifyThreatPercent(pTarget, -100); + HoodGUID = pTarget->GetGUID(); + me->AddThreat(pTarget, 1000000.0f); + ChaseTimer = 20000; + IsChasing = true; + } + } + else + { + IsChasing = false; + + if (Unit *pTarget = Unit::GetUnit((*me), HoodGUID)) + { + HoodGUID = 0; + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + me->AddThreat(pTarget, TempThreat); + TempThreat = 0; + } + + ChaseTimer = 40000; + } + } else ChaseTimer -= diff; + + if (IsChasing) + return; + + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFYING_HOWL); + FearTimer = urand(25000,35000); + } else FearTimer -= diff; + + if (SwipeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WIDE_SWIPE); + SwipeTimer = urand(25000,30000); + } else SwipeTimer -= diff; + + } + }; + +}; + /**********************************************/ /******** Opera Romeo and Juliet Event *******/ @@ -927,211 +990,456 @@ void Resurrect(Creature *pTarget) else pTarget->GetMotionMaster()->Initialize(); }; - -struct boss_julianneAI : public ScriptedAI + class boss_julianne : public CreatureScript { - boss_julianneAI(Creature* c) : ScriptedAI(c) +public: + boss_julianne() : CreatureScript("boss_julianne") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - EntryYellTimer = 1000; - AggroYellTimer = 10000; - IsFakingDeath = false; + return new boss_julianneAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 EntryYellTimer; - uint32 AggroYellTimer; - - uint64 RomuloGUID; - - uint32 Phase; - - uint32 BlindingPassionTimer; - uint32 DevotionTimer; - uint32 EternalAffectionTimer; - uint32 PowerfulAttractionTimer; - uint32 SummonRomuloTimer; - uint32 ResurrectTimer; - uint32 DrinkPoisonTimer; - uint32 ResurrectSelfTimer; - - bool IsFakingDeath; - bool SummonedRomulo; - bool RomuloDead; - - void Reset() + struct boss_julianneAI : public ScriptedAI { - RomuloGUID = 0; - Phase = PHASE_JULIANNE; - - BlindingPassionTimer = 30000; - DevotionTimer = 15000; - EternalAffectionTimer = 25000; - PowerfulAttractionTimer = 5000; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - ResurrectSelfTimer = 0; - - if (IsFakingDeath) + boss_julianneAI(Creature* c) : ScriptedAI(c) { - Resurrect(me); + pInstance = c->GetInstanceScript(); + EntryYellTimer = 1000; + AggroYellTimer = 10000; IsFakingDeath = false; } - SummonedRomulo = false; - RomuloDead = false; - } + InstanceScript* pInstance; - void EnterCombat(Unit* /*who*/) {} + uint32 EntryYellTimer; + uint32 AggroYellTimer; - void AttackStart(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint64 RomuloGUID; - ScriptedAI::AttackStart(who); - } + uint32 Phase; - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 BlindingPassionTimer; + uint32 DevotionTimer; + uint32 EternalAffectionTimer; + uint32 PowerfulAttractionTimer; + uint32 SummonRomuloTimer; + uint32 ResurrectTimer; + uint32 DrinkPoisonTimer; + uint32 ResurrectSelfTimer; - ScriptedAI::MoveInLineOfSight(who); - } + bool IsFakingDeath; + bool SummonedRomulo; + bool RomuloDead; - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) - { - if (Spell->Id == SPELL_DRINK_POISON) + void Reset() { - DoScriptText(SAY_JULIANNE_DEATH01, me); - DrinkPoisonTimer = 2500; - } - } + RomuloGUID = 0; + Phase = PHASE_JULIANNE; - void DamageTaken(Unit* done_by, uint32 &damage); + BlindingPassionTimer = 30000; + DevotionTimer = 15000; + EternalAffectionTimer = 25000; + PowerfulAttractionTimer = 5000; + SummonRomuloTimer = 10000; + DrinkPoisonTimer = 0; + ResurrectSelfTimer = 0; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_JULIANNE_DEATH02, me); - - if (pInstance) - { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - } - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_JULIANNE_SLAY, me); - } - - void UpdateAI(const uint32 diff); -}; - -struct boss_romuloAI : public ScriptedAI -{ - boss_romuloAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - EntryYellTimer = 8000; - AggroYellTimer = 15000; - } - - ScriptedInstance* pInstance; - - uint64 JulianneGUID; - uint32 Phase; - - uint32 EntryYellTimer; - uint32 AggroYellTimer; - uint32 BackwardLungeTimer; - uint32 DaringTimer; - uint32 DeadlySwatheTimer; - uint32 PoisonThrustTimer; - uint32 ResurrectTimer; - - bool IsFakingDeath; - bool JulianneDead; - - void Reset() - { - JulianneGUID = 0; - Phase = PHASE_ROMULO; - - BackwardLungeTimer = 15000; - DaringTimer = 20000; - DeadlySwatheTimer = 25000; - PoisonThrustTimer = 10000; - ResurrectTimer = 10000; - - IsFakingDeath = false; - JulianneDead = false; - } - - void JustReachedHome() - { - me->ForcedDespawn(); - } - - void DamageTaken(Unit* done_by, uint32 &damage); - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_ROMULO_AGGRO, me); - if (JulianneGUID) - { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); - if (Julianne && Julianne->getVictim()) + if (IsFakingDeath) { - me->AddThreat(Julianne->getVictim(), 1.0f); - AttackStart(Julianne->getVictim()); + Resurrect(me); + IsFakingDeath = false; + } + + SummonedRomulo = false; + RomuloDead = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void AttackStart(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void SpellHit(Unit* /*caster*/, const SpellEntry *Spell) + { + if (Spell->Id == SPELL_DRINK_POISON) + { + DoScriptText(SAY_JULIANNE_DEATH01, me); + DrinkPoisonTimer = 2500; } } - } - void MoveInLineOfSight(Unit* who) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + void DamageTaken(Unit* /*done_by*/, uint32 &damage); - ScriptedAI::MoveInLineOfSight(who); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_ROMULO_DEATH, me); - - if (pInstance) + void JustDied(Unit* /*killer*/) { - pInstance->SetData(TYPE_OPERA, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + DoScriptText(SAY_JULIANNE_DEATH02, me); - if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) - pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } } - } - void KilledUnit(Unit* /*victim*/) + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_JULIANNE_SLAY, me); + } + + void UpdateAI(const uint32 diff); + }; + +}; + class boss_romulo : public CreatureScript +{ +public: + boss_romulo() : CreatureScript("boss_romulo") { } + + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_ROMULO_SLAY, me); + return new boss_romuloAI(pCreature); } - void UpdateAI(const uint32 diff); + struct boss_romuloAI : public ScriptedAI + { + boss_romuloAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + EntryYellTimer = 8000; + AggroYellTimer = 15000; + } + + InstanceScript* pInstance; + + uint64 JulianneGUID; + uint32 Phase; + + uint32 EntryYellTimer; + uint32 AggroYellTimer; + uint32 BackwardLungeTimer; + uint32 DaringTimer; + uint32 DeadlySwatheTimer; + uint32 PoisonThrustTimer; + uint32 ResurrectTimer; + + bool IsFakingDeath; + bool JulianneDead; + + void Reset() + { + JulianneGUID = 0; + Phase = PHASE_ROMULO; + + BackwardLungeTimer = 15000; + DaringTimer = 20000; + DeadlySwatheTimer = 25000; + PoisonThrustTimer = 10000; + ResurrectTimer = 10000; + + IsFakingDeath = false; + JulianneDead = false; + } + + void JustReachedHome() + { + me->ForcedDespawn(); + } + + void DamageTaken(Unit* /*done_by*/, uint32 &damage) + { + if (damage < me->GetHealth()) + return; + + //anything below only used if incoming damage will kill + + if (Phase == PHASE_ROMULO) + { + DoScriptText(SAY_ROMULO_DEATH, me); + PretendToDie(me); + IsFakingDeath = true; + Phase = PHASE_BOTH; + + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; + } + + damage = 0; + return; + } + + if (Phase == PHASE_BOTH) + { + if (JulianneDead) + { + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Julianne->GetMotionMaster()->Clear(); + Julianne->setDeathState(JUST_DIED); + Julianne->CombatStop(true); + Julianne->DeleteThreatList(); + Julianne->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + return; + } + + if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) + { + PretendToDie(me); + IsFakingDeath = true; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->RomuloDead = true; + damage = 0; + return; + } + } + + sLog.outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_ROMULO_AGGRO, me); + if (JulianneGUID) + { + Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + if (Julianne && Julianne->getVictim()) + { + me->AddThreat(Julianne->getVictim(), 1.0f); + AttackStart(Julianne->getVictim()); + } + } + } + + void MoveInLineOfSight(Unit* who) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_ROMULO_DEATH, me); + + if (pInstance) + { + pInstance->SetData(TYPE_OPERA, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORLEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_STAGEDOORRIGHT), true); + + if (GameObject* pSideEntrance = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR))) + pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + } + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_ROMULO_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim() || IsFakingDeath) + return; + + if (JulianneDead) + { + if (ResurrectTimer <= diff) + { + Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); + if (Julianne && CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath) + { + DoScriptText(SAY_ROMULO_RESURRECT, me); + Resurrect(Julianne); + CAST_AI(boss_julianne::boss_julianneAI, Julianne->AI())->IsFakingDeath = false; + JulianneDead = false; + ResurrectTimer = 10000; + } + } else ResurrectTimer -= diff; + } + + if (BackwardLungeTimer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); + if (pTarget && !me->HasInArc(M_PI, pTarget)) + { + DoCast(pTarget, SPELL_BACKWARD_LUNGE); + BackwardLungeTimer = urand(15000,30000); + } + } else BackwardLungeTimer -= diff; + + if (DaringTimer <= diff) + { + DoCast(me, SPELL_DARING); + DaringTimer = urand(20000,40000); + } else DaringTimer -= diff; + + if (DeadlySwatheTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_DEADLY_SWATHE); + DeadlySwatheTimer = urand(15000,25000); + } else DeadlySwatheTimer -= diff; + + if (PoisonThrustTimer <= diff) + { + DoCast(me->getVictim(), SPELL_POISON_THRUST); + PoisonThrustTimer = urand(10000,20000); + } else PoisonThrustTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -void boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) +void boss_julianne::boss_julianneAI::UpdateAI(const uint32 diff) +{ + if (EntryYellTimer) + { + if (EntryYellTimer <= diff) + { + DoScriptText(SAY_JULIANNE_ENTER, me); + EntryYellTimer = 0; + } else EntryYellTimer -= diff; + } + + if (AggroYellTimer) + { + if (AggroYellTimer <= diff) + { + DoScriptText(SAY_JULIANNE_AGGRO, me); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->setFaction(16); + AggroYellTimer = 0; + } else AggroYellTimer -= diff; + } + + if (DrinkPoisonTimer) + { + //will do this 2secs after spell hit. this is time to display visual as expected + if (DrinkPoisonTimer <= diff) + { + PretendToDie(me); + Phase = PHASE_ROMULO; + SummonRomuloTimer = 10000; + DrinkPoisonTimer = 0; + } else DrinkPoisonTimer -= diff; + } + + if (Phase == PHASE_ROMULO && !SummonedRomulo) + { + if (SummonRomuloTimer <= diff) + { + if (Creature* pRomulo = me->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + { + RomuloGUID = pRomulo->GetGUID(); + CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); + CAST_AI(boss_romulo::boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; + DoZoneInCombat(pRomulo); + + pRomulo->setFaction(16); + } + SummonedRomulo = true; + } else SummonRomuloTimer -= diff; + } + + if (ResurrectSelfTimer) + { + if (ResurrectSelfTimer <= diff) + { + Resurrect(me); + Phase = PHASE_BOTH; + IsFakingDeath = false; + + if (me->getVictim()) + AttackStart(me->getVictim()); + + ResurrectSelfTimer = 0; + ResurrectTimer = 1000; + } else ResurrectSelfTimer -= diff; + } + + if (!UpdateVictim() || IsFakingDeath) + return; + + if (RomuloDead) + { + if (ResurrectTimer <= diff) + { + Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); + if (Romulo && CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath) + { + DoScriptText(SAY_JULIANNE_RESURRECT, me); + Resurrect(Romulo); + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->IsFakingDeath = false; + RomuloDead = false; + ResurrectTimer = 10000; + } + } else ResurrectTimer -= diff; + } + + if (BlindingPassionTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BLINDING_PASSION); + BlindingPassionTimer = urand(30000,45000); + } else BlindingPassionTimer -= diff; + + if (DevotionTimer <= diff) + { + DoCast(me, SPELL_DEVOTION); + DevotionTimer = urand(15000,45000); + } else DevotionTimer -= diff; + + if (PowerfulAttractionTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_POWERFUL_ATTRACTION); + PowerfulAttractionTimer = urand(5000,30000); + } else PowerfulAttractionTimer -= diff; + + if (EternalAffectionTimer <= diff) + { + if (urand(0,1) && SummonedRomulo) + { + Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); + if (Romulo && Romulo->isAlive() && !RomuloDead) + DoCast(Romulo, SPELL_ETERNAL_AFFECTION); + } else DoCast(me, SPELL_ETERNAL_AFFECTION); + + EternalAffectionTimer = urand(45000,60000); + } else EternalAffectionTimer -= diff; + + DoMeleeAttackIfReady(); +} + +void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) { if (damage < me->GetHealth()) return; @@ -1184,8 +1492,8 @@ void boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) { PretendToDie(me); IsFakingDeath = true; - CAST_AI(boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; - CAST_AI(boss_romuloAI, Romulo->AI())->JulianneDead = true; + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000; + CAST_AI(boss_romulo::boss_romuloAI, Romulo->AI())->JulianneDead = true; damage = 0; return; } @@ -1193,304 +1501,18 @@ void boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) sLog.outError("TSCR: boss_julianneAI: DamageTaken reach end of code, that should not happen."); } -void boss_romuloAI::DamageTaken(Unit* /*done_by*/, uint32 &damage) -{ - if (damage < me->GetHealth()) - return; - - //anything below only used if incoming damage will kill - - if (Phase == PHASE_ROMULO) - { - DoScriptText(SAY_ROMULO_DEATH, me); - PretendToDie(me); - IsFakingDeath = true; - Phase = PHASE_BOTH; - - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) - { - CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true; - CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000; - } - - damage = 0; - return; - } - - if (Phase == PHASE_BOTH) - { - if (JulianneDead) - { - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) - { - Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Julianne->GetMotionMaster()->Clear(); - Julianne->setDeathState(JUST_DIED); - Julianne->CombatStop(true); - Julianne->DeleteThreatList(); - Julianne->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - return; - } - - if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID))) - { - PretendToDie(me); - IsFakingDeath = true; - CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000; - CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true; - damage = 0; - return; - } - } - - sLog.outError("TSCR: boss_romuloAI: DamageTaken reach end of code, that should not happen."); -} - -void boss_julianneAI::UpdateAI(const uint32 diff) -{ - if (EntryYellTimer) - { - if (EntryYellTimer <= diff) - { - DoScriptText(SAY_JULIANNE_ENTER, me); - EntryYellTimer = 0; - } else EntryYellTimer -= diff; - } - - if (AggroYellTimer) - { - if (AggroYellTimer <= diff) - { - DoScriptText(SAY_JULIANNE_AGGRO, me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(16); - AggroYellTimer = 0; - } else AggroYellTimer -= diff; - } - - if (DrinkPoisonTimer) - { - //will do this 2secs after spell hit. this is time to display visual as expected - if (DrinkPoisonTimer <= diff) - { - PretendToDie(me); - Phase = PHASE_ROMULO; - SummonRomuloTimer = 10000; - DrinkPoisonTimer = 0; - } else DrinkPoisonTimer -= diff; - } - - if (Phase == PHASE_ROMULO && !SummonedRomulo) - { - if (SummonRomuloTimer <= diff) - { - if (Creature* pRomulo = me->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) - { - RomuloGUID = pRomulo->GetGUID(); - CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID(); - CAST_AI(boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO; - DoZoneInCombat(pRomulo); - - pRomulo->setFaction(16); - } - SummonedRomulo = true; - } else SummonRomuloTimer -= diff; - } - - if (ResurrectSelfTimer) - { - if (ResurrectSelfTimer <= diff) - { - Resurrect(me); - Phase = PHASE_BOTH; - IsFakingDeath = false; - - if (me->getVictim()) - AttackStart(me->getVictim()); - - ResurrectSelfTimer = 0; - ResurrectTimer = 1000; - } else ResurrectSelfTimer -= diff; - } - - if (!UpdateVictim() || IsFakingDeath) - return; - - if (RomuloDead) - { - if (ResurrectTimer <= diff) - { - Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); - if (Romulo && CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath) - { - DoScriptText(SAY_JULIANNE_RESURRECT, me); - Resurrect(Romulo); - CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath = false; - RomuloDead = false; - ResurrectTimer = 10000; - } - } else ResurrectTimer -= diff; - } - - if (BlindingPassionTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BLINDING_PASSION); - BlindingPassionTimer = urand(30000,45000); - } else BlindingPassionTimer -= diff; - - if (DevotionTimer <= diff) - { - DoCast(me, SPELL_DEVOTION); - DevotionTimer = urand(15000,45000); - } else DevotionTimer -= diff; - - if (PowerfulAttractionTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_POWERFUL_ATTRACTION); - PowerfulAttractionTimer = urand(5000,30000); - } else PowerfulAttractionTimer -= diff; - - if (EternalAffectionTimer <= diff) - { - if (urand(0,1) && SummonedRomulo) - { - Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)); - if (Romulo && Romulo->isAlive() && !RomuloDead) - DoCast(Romulo, SPELL_ETERNAL_AFFECTION); - } else DoCast(me, SPELL_ETERNAL_AFFECTION); - - EternalAffectionTimer = urand(45000,60000); - } else EternalAffectionTimer -= diff; - - DoMeleeAttackIfReady(); -} - -void boss_romuloAI::UpdateAI(const uint32 diff) -{ - if (!UpdateVictim() || IsFakingDeath) - return; - - if (JulianneDead) - { - if (ResurrectTimer <= diff) - { - Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)); - if (Julianne && CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath) - { - DoScriptText(SAY_ROMULO_RESURRECT, me); - Resurrect(Julianne); - CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath = false; - JulianneDead = false; - ResurrectTimer = 10000; - } - } else ResurrectTimer -= diff; - } - - if (BackwardLungeTimer <= diff) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); - if (pTarget && !me->HasInArc(M_PI, pTarget)) - { - DoCast(pTarget, SPELL_BACKWARD_LUNGE); - BackwardLungeTimer = urand(15000,30000); - } - } else BackwardLungeTimer -= diff; - - if (DaringTimer <= diff) - { - DoCast(me, SPELL_DARING); - DaringTimer = urand(20000,40000); - } else DaringTimer -= diff; - - if (DeadlySwatheTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_DEADLY_SWATHE); - DeadlySwatheTimer = urand(15000,25000); - } else DeadlySwatheTimer -= diff; - - if (PoisonThrustTimer <= diff) - { - DoCast(me->getVictim(), SPELL_POISON_THRUST); - PoisonThrustTimer = urand(10000,20000); - } else PoisonThrustTimer -= diff; - - DoMeleeAttackIfReady(); -} - -CreatureAI* GetAI_boss_julianne(Creature* pCreature) -{ - return new boss_julianneAI(pCreature); -} - -CreatureAI* GetAI_boss_romulo(Creature* pCreature) -{ - return new boss_romuloAI(pCreature); -} void AddSC_bosses_opera() { - Script* newscript; - - // Oz - newscript = new Script; - newscript->GetAI = &GetAI_boss_dorothee; - newscript->Name = "boss_dorothee"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_strawman; - newscript->Name = "boss_strawman"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_tinhead; - newscript->Name = "boss_tinhead"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_roar; - newscript->Name = "boss_roar"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_crone; - newscript->Name = "boss_crone"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_tito; - newscript->Name = "mob_tito"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_cyclone; - newscript->Name = "mob_cyclone"; - newscript->RegisterSelf(); - - // Hood - newscript = new Script; - newscript->pGossipHello = &GossipHello_npc_grandmother; - newscript->pGossipSelect = &GossipSelect_npc_grandmother; - newscript->Name = "npc_grandmother"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_bigbadwolf; - newscript->Name = "boss_bigbadwolf"; - newscript->RegisterSelf(); - - // Romeo And Juliet - newscript = new Script; - newscript->GetAI = &GetAI_boss_julianne; - newscript->Name = "boss_julianne"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_romulo; - newscript->Name = "boss_romulo"; - newscript->RegisterSelf(); + new boss_dorothee(); + new boss_strawman(); + new boss_tinhead(); + new boss_roar(); + new boss_crone(); + new mob_tito(); + new mob_cyclone(); + new npc_grandmother(); + new boss_bigbadwolf(); + new boss_julianne(); + new boss_romulo(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 7a7039b94fe..5928cc434c8 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -42,269 +42,271 @@ EndScriptData */ 10 - Prince Malchezzar 11 - Nightbane */ - -struct instance_karazhan : public ScriptedInstance + class instance_karazhan : public InstanceMapScript { - instance_karazhan(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_karazhan() : InstanceMapScript("instance_karazhan") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string strSaveData; - - uint32 m_uiOperaEvent; - uint32 m_uiOzDeathCount; - - uint64 m_uiCurtainGUID; - uint64 m_uiStageDoorLeftGUID; - uint64 m_uiStageDoorRightGUID; - uint64 m_uiKilrekGUID; - uint64 m_uiTerestianGUID; - uint64 m_uiMoroesGUID; - uint64 m_uiLibraryDoor; // Door at Shade of Aran - uint64 m_uiMassiveDoor; // Door at Netherspite - uint64 m_uiSideEntranceDoor; // Side Entrance - uint64 m_uiGamesmansDoor; // Door before Chess - uint64 m_uiGamesmansExitDoor; // Door after Chess - uint64 m_uiNetherspaceDoor; // Door at Malchezaar - uint64 MastersTerraceDoor[2]; - uint64 ImageGUID; - uint64 DustCoveredChest; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. - m_uiOperaEvent = urand(1,3); - m_uiOzDeathCount = 0; - - m_uiCurtainGUID = 0; - m_uiStageDoorLeftGUID = 0; - m_uiStageDoorRightGUID = 0; - - m_uiKilrekGUID = 0; - m_uiTerestianGUID = 0; - m_uiMoroesGUID = 0; - - m_uiLibraryDoor = 0; - m_uiMassiveDoor = 0; - m_uiSideEntranceDoor = 0; - m_uiGamesmansDoor = 0; - m_uiGamesmansExitDoor = 0; - m_uiNetherspaceDoor = 0; - MastersTerraceDoor[0]= 0; - MastersTerraceDoor[1]= 0; - ImageGUID = 0; - DustCoveredChest = 0; + return new instance_karazhan_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_karazhan_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + instance_karazhan_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string strSaveData; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) + uint32 m_uiOperaEvent; + uint32 m_uiOzDeathCount; + + uint64 m_uiCurtainGUID; + uint64 m_uiStageDoorLeftGUID; + uint64 m_uiStageDoorRightGUID; + uint64 m_uiKilrekGUID; + uint64 m_uiTerestianGUID; + uint64 m_uiMoroesGUID; + uint64 m_uiLibraryDoor; // Door at Shade of Aran + uint64 m_uiMassiveDoor; // Door at Netherspite + uint64 m_uiSideEntranceDoor; // Side Entrance + uint64 m_uiGamesmansDoor; // Door before Chess + uint64 m_uiGamesmansExitDoor; // Door after Chess + uint64 m_uiNetherspaceDoor; // Door at Malchezaar + uint64 MastersTerraceDoor[2]; + uint64 ImageGUID; + uint64 DustCoveredChest; + + void Initialize() { - case 17229: m_uiKilrekGUID = pCreature->GetGUID(); break; - case 15688: m_uiTerestianGUID = pCreature->GetGUID(); break; - case 15687: m_uiMoroesGUID = pCreature->GetGUID(); break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. + m_uiOperaEvent = urand(1,3); + m_uiOzDeathCount = 0; + + m_uiCurtainGUID = 0; + m_uiStageDoorLeftGUID = 0; + m_uiStageDoorRightGUID = 0; + + m_uiKilrekGUID = 0; + m_uiTerestianGUID = 0; + m_uiMoroesGUID = 0; + + m_uiLibraryDoor = 0; + m_uiMassiveDoor = 0; + m_uiSideEntranceDoor = 0; + m_uiGamesmansDoor = 0; + m_uiGamesmansExitDoor = 0; + m_uiNetherspaceDoor = 0; + MastersTerraceDoor[0]= 0; + MastersTerraceDoor[1]= 0; + ImageGUID = 0; + DustCoveredChest = 0; } - } - void SetData(uint32 type, uint32 uiData) - { - switch (type) + bool IsEncounterInProgress() const { - case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; - case TYPE_MOROES: - if (m_auiEncounter[1] == DONE) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch (pCreature->GetEntry()) + { + case 17229: m_uiKilrekGUID = pCreature->GetGUID(); break; + case 15688: m_uiTerestianGUID = pCreature->GetGUID(); break; + case 15687: m_uiMoroesGUID = pCreature->GetGUID(); break; + } + } + + void SetData(uint32 type, uint32 uiData) + { + switch (type) + { + case TYPE_ATTUMEN: m_auiEncounter[0] = uiData; break; + case TYPE_MOROES: + if (m_auiEncounter[1] == DONE) + break; + m_auiEncounter[1] = uiData; break; - m_auiEncounter[1] = uiData; - break; - case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; - case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; - case TYPE_OPERA: m_auiEncounter[4] = uiData; break; - case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; - case TYPE_ARAN: m_auiEncounter[6] = uiData; break; - case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; - case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; - case TYPE_CHESS: - if (uiData == DONE) - DoRespawnGameObject(DustCoveredChest,DAY); - m_auiEncounter[9] = uiData; - break; - case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; - case TYPE_NIGHTBANE: - if (m_auiEncounter[11] != DONE) - m_auiEncounter[11] = uiData; - break; - case DATA_OPERA_OZ_DEATHCOUNT: - if (uiData == SPECIAL) - ++m_uiOzDeathCount; - else if (uiData == IN_PROGRESS) - m_uiOzDeathCount = 0; - break; + case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break; + case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break; + case TYPE_OPERA: m_auiEncounter[4] = uiData; break; + case TYPE_CURATOR: m_auiEncounter[5] = uiData; break; + case TYPE_ARAN: m_auiEncounter[6] = uiData; break; + case TYPE_TERESTIAN: m_auiEncounter[7] = uiData; break; + case TYPE_NETHERSPITE: m_auiEncounter[8] = uiData; break; + case TYPE_CHESS: + if (uiData == DONE) + DoRespawnGameObject(DustCoveredChest,DAY); + m_auiEncounter[9] = uiData; + break; + case TYPE_MALCHEZZAR: m_auiEncounter[10] = uiData; break; + case TYPE_NIGHTBANE: + if (m_auiEncounter[11] != DONE) + m_auiEncounter[11] = uiData; + break; + case DATA_OPERA_OZ_DEATHCOUNT: + if (uiData == SPECIAL) + ++m_uiOzDeathCount; + else if (uiData == IN_PROGRESS) + m_uiOzDeathCount = 0; + break; + } + + if (uiData == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " + << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; + + strSaveData = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - if (uiData == DONE) - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " - << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; - - strSaveData = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } - } - - void SetData64(uint32 identifier, uint64 data) - { - switch(identifier) + void SetData64(uint32 identifier, uint64 data) { - case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + switch(identifier) + { + case DATA_IMAGE_OF_MEDIVH: ImageGUID = data; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 183932: m_uiCurtainGUID = pGo->GetGUID(); break; - case 184278: - m_uiStageDoorLeftGUID = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case 184279: - m_uiStageDoorRightGUID = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case 184517: m_uiLibraryDoor = pGo->GetGUID(); break; - case 185521: m_uiMassiveDoor = pGo->GetGUID(); break; - case 184276: m_uiGamesmansDoor = pGo->GetGUID(); break; - case 184277: m_uiGamesmansExitDoor = pGo->GetGUID(); break; - case 185134: m_uiNetherspaceDoor = pGo->GetGUID(); break; - case 184274: MastersTerraceDoor[0] = pGo->GetGUID(); break; - case 184280: MastersTerraceDoor[1] = pGo->GetGUID(); break; - case 184275: - m_uiSideEntranceDoor = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - else - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); - break; - case 185119: DustCoveredChest = pGo->GetGUID(); break; + switch(pGo->GetEntry()) + { + case 183932: m_uiCurtainGUID = pGo->GetGUID(); break; + case 184278: + m_uiStageDoorLeftGUID = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case 184279: + m_uiStageDoorRightGUID = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case 184517: m_uiLibraryDoor = pGo->GetGUID(); break; + case 185521: m_uiMassiveDoor = pGo->GetGUID(); break; + case 184276: m_uiGamesmansDoor = pGo->GetGUID(); break; + case 184277: m_uiGamesmansExitDoor = pGo->GetGUID(); break; + case 185134: m_uiNetherspaceDoor = pGo->GetGUID(); break; + case 184274: MastersTerraceDoor[0] = pGo->GetGUID(); break; + case 184280: MastersTerraceDoor[1] = pGo->GetGUID(); break; + case 184275: + m_uiSideEntranceDoor = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + else + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); + break; + case 185119: DustCoveredChest = pGo->GetGUID(); break; + } + + switch(m_uiOperaEvent) + { + //TODO: Set Object visibilities for Opera based on performance + case EVENT_OZ: + break; + + case EVENT_HOOD: + break; + + case EVENT_RAJ: + break; + } } - switch(m_uiOperaEvent) + std::string GetSaveData() { - //TODO: Set Object visibilities for Opera based on performance - case EVENT_OZ: - break; - - case EVENT_HOOD: - break; - - case EVENT_RAJ: - break; - } - } - - std::string GetSaveData() - { - return strSaveData; - } - - uint32 GetData(uint32 uiData) - { - switch (uiData) - { - case TYPE_ATTUMEN: return m_auiEncounter[0]; - case TYPE_MOROES: return m_auiEncounter[1]; - case TYPE_MAIDEN: return m_auiEncounter[2]; - case TYPE_OPTIONAL_BOSS: return m_auiEncounter[3]; - case TYPE_OPERA: return m_auiEncounter[4]; - case TYPE_CURATOR: return m_auiEncounter[5]; - case TYPE_ARAN: return m_auiEncounter[6]; - case TYPE_TERESTIAN: return m_auiEncounter[7]; - case TYPE_NETHERSPITE: return m_auiEncounter[8]; - case TYPE_CHESS: return m_auiEncounter[9]; - case TYPE_MALCHEZZAR: return m_auiEncounter[10]; - case TYPE_NIGHTBANE: return m_auiEncounter[11]; - case DATA_OPERA_PERFORMANCE: return m_uiOperaEvent; - case DATA_OPERA_OZ_DEATHCOUNT: return m_uiOzDeathCount; - case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + return strSaveData; } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch (uiData) + uint32 GetData(uint32 uiData) { - case DATA_KILREK: return m_uiKilrekGUID; - case DATA_TERESTIAN: return m_uiTerestianGUID; - case DATA_MOROES: return m_uiMoroesGUID; - case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; - case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; - case DATA_GO_CURTAINS: return m_uiCurtainGUID; - case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; - case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; - case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; - case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; - case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; - case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; - case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; - case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + switch (uiData) + { + case TYPE_ATTUMEN: return m_auiEncounter[0]; + case TYPE_MOROES: return m_auiEncounter[1]; + case TYPE_MAIDEN: return m_auiEncounter[2]; + case TYPE_OPTIONAL_BOSS: return m_auiEncounter[3]; + case TYPE_OPERA: return m_auiEncounter[4]; + case TYPE_CURATOR: return m_auiEncounter[5]; + case TYPE_ARAN: return m_auiEncounter[6]; + case TYPE_TERESTIAN: return m_auiEncounter[7]; + case TYPE_NETHERSPITE: return m_auiEncounter[8]; + case TYPE_CHESS: return m_auiEncounter[9]; + case TYPE_MALCHEZZAR: return m_auiEncounter[10]; + case TYPE_NIGHTBANE: return m_auiEncounter[11]; + case DATA_OPERA_PERFORMANCE: return m_uiOperaEvent; + case DATA_OPERA_OZ_DEATHCOUNT: return m_uiOzDeathCount; + case DATA_IMAGE_OF_MEDIVH: return ImageGUID; + } + + return 0; } - return 0; - } - - void Load(const char* chrIn) - { - if (!chrIn) + uint64 GetData64(uint32 uiData) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch (uiData) + { + case DATA_KILREK: return m_uiKilrekGUID; + case DATA_TERESTIAN: return m_uiTerestianGUID; + case DATA_MOROES: return m_uiMoroesGUID; + case DATA_GO_STAGEDOORLEFT: return m_uiStageDoorLeftGUID; + case DATA_GO_STAGEDOORRIGHT: return m_uiStageDoorRightGUID; + case DATA_GO_CURTAINS: return m_uiCurtainGUID; + case DATA_GO_LIBRARY_DOOR: return m_uiLibraryDoor; + case DATA_GO_MASSIVE_DOOR: return m_uiMassiveDoor; + case DATA_GO_SIDE_ENTRANCE_DOOR: return m_uiSideEntranceDoor; + case DATA_GO_GAME_DOOR: return m_uiGamesmansDoor; + case DATA_GO_GAME_EXIT_DOOR: return m_uiGamesmansExitDoor; + case DATA_GO_NETHER_DOOR: return m_uiNetherspaceDoor; + case DATA_MASTERS_TERRACE_DOOR_1: return MastersTerraceDoor[0]; + case DATA_MASTERS_TERRACE_DOOR_2: return MastersTerraceDoor[1]; + } + + return 0; } - OUT_LOAD_INST_DATA(chrIn); - std::istringstream loadStream(chrIn); + void Load(const char* chrIn) + { + if (!chrIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(chrIn); + std::istringstream loadStream(chrIn); + + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] + >> m_auiEncounter[8] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] - >> m_auiEncounter[8] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_karazhan(Map* pMap) -{ - return new instance_karazhan(pMap); -} void AddSC_instance_karazhan() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_karazhan"; - newscript->GetInstanceData = &GetInstanceData_instance_karazhan; - newscript->RegisterSelf(); + new instance_karazhan(); } - diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 29e22d36047..fd5caf9295f 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -101,294 +101,302 @@ float Spawns[6][2]= #define SPAWN_Z 90.5 #define SPAWN_Y -1758 #define SPAWN_O 4.738 - -struct npc_barnesAI : public npc_escortAI + class npc_barnes : public CreatureScript { - npc_barnesAI(Creature* c) : npc_escortAI(c) +public: + npc_barnes() : CreatureScript("npc_barnes") { } + + struct npc_barnesAI : public npc_escortAI { - RaidWiped = false; - m_uiEventId = 0; - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint64 m_uiSpotlightGUID; - - uint32 TalkCount; - uint32 TalkTimer; - uint32 WipeTimer; - uint32 m_uiEventId; - - bool PerformanceReady; - bool RaidWiped; - - void Reset() - { - m_uiSpotlightGUID = 0; - - TalkCount = 0; - TalkTimer = 2000; - WipeTimer = 5000; - - PerformanceReady = false; - - if (pInstance) - m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE); - } - - void StartEvent() - { - if (!pInstance) - return; - - pInstance->SetData(TYPE_OPERA, IN_PROGRESS); - - //resets count for this event, in case earlier failed - if (m_uiEventId == EVENT_OZ) - pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS); - - Start(false, false); - } - - void EnterCombat(Unit* /*who*/) {} - - void WaypointReached(uint32 i) - { - if (!pInstance) - return; - - switch(i) + npc_barnesAI(Creature* c) : npc_escortAI(c) { - case 0: - DoCast(me, SPELL_TUXEDO, false); - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); - break; - case 4: - TalkCount = 0; - SetEscortPaused(true); - - if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT, - me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000)) - { - pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false); - m_uiSpotlightGUID = pSpotlight->GetGUID(); - } - break; - case 8: - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); - PerformanceReady = true; - break; - case 9: - PrepareEncounter(); - pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS)); - break; - } - } - - void Talk(uint32 count) - { - int32 text = 0; - - switch(m_uiEventId) - { - case EVENT_OZ: - if (OzDialogue[count].textid) - text = OzDialogue[count].textid; - if (OzDialogue[count].timer) - TalkTimer = OzDialogue[count].timer; - break; - - case EVENT_HOOD: - if (HoodDialogue[count].textid) - text = HoodDialogue[count].textid; - if (HoodDialogue[count].timer) - TalkTimer = HoodDialogue[count].timer; - break; - - case EVENT_RAJ: - if (RAJDialogue[count].textid) - text = RAJDialogue[count].textid; - if (RAJDialogue[count].timer) - TalkTimer = RAJDialogue[count].timer; - break; + RaidWiped = false; + m_uiEventId = 0; + pInstance = c->GetInstanceScript(); } - if (text) - DoScriptText(text, me); - } + InstanceScript* pInstance; - void PrepareEncounter() - { - sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); - uint8 index = 0; - uint8 count = 0; + uint64 m_uiSpotlightGUID; - switch(m_uiEventId) + uint32 TalkCount; + uint32 TalkTimer; + uint32 WipeTimer; + uint32 m_uiEventId; + + bool PerformanceReady; + bool RaidWiped; + + void Reset() { - case EVENT_OZ: - index = 0; - count = 4; - break; - case EVENT_HOOD: - index = 4; - count = index+1; - break; - case EVENT_RAJ: - index = 5; - count = index+1; - break; + m_uiSpotlightGUID = 0; + + TalkCount = 0; + TalkTimer = 2000; + WipeTimer = 5000; + + PerformanceReady = false; + + if (pInstance) + m_uiEventId = pInstance->GetData(DATA_OPERA_PERFORMANCE); } - for (; index < count; ++index) + void StartEvent() { - uint32 entry = ((uint32)Spawns[index][0]); - float PosX = Spawns[index][1]; + if (!pInstance) + return; - if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) + pInstance->SetData(TYPE_OPERA, IN_PROGRESS); + + //resets count for this event, in case earlier failed + if (m_uiEventId == EVENT_OZ) + pInstance->SetData(DATA_OPERA_OZ_DEATHCOUNT, IN_PROGRESS); + + Start(false, false); + } + + void EnterCombat(Unit* /*who*/) {} + + void WaypointReached(uint32 i) + { + if (!pInstance) + return; + + switch(i) { - // In case database has bad flags - pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + case 0: + DoCast(me, SPELL_TUXEDO, false); + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); + break; + case 4: + TalkCount = 0; + SetEscortPaused(true); + + if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT, + me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000)) + { + pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pSpotlight->CastSpell(pSpotlight, SPELL_SPOTLIGHT, false); + m_uiSpotlightGUID = pSpotlight->GetGUID(); + } + break; + case 8: + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT)); + PerformanceReady = true; + break; + case 9: + PrepareEncounter(); + pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_CURTAINS)); + break; } } - RaidWiped = false; - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (HasEscortState(STATE_ESCORT_PAUSED)) + void Talk(uint32 count) { - if (TalkTimer <= diff) + int32 text = 0; + + switch(m_uiEventId) { - if (TalkCount > 3) - { - if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID)) - pSpotlight->ForcedDespawn(); + case EVENT_OZ: + if (OzDialogue[count].textid) + text = OzDialogue[count].textid; + if (OzDialogue[count].timer) + TalkTimer = OzDialogue[count].timer; + break; - SetEscortPaused(false); - return; - } + case EVENT_HOOD: + if (HoodDialogue[count].textid) + text = HoodDialogue[count].textid; + if (HoodDialogue[count].timer) + TalkTimer = HoodDialogue[count].timer; + break; - Talk(TalkCount); - ++TalkCount; - } else TalkTimer -= diff; + case EVENT_RAJ: + if (RAJDialogue[count].textid) + text = RAJDialogue[count].textid; + if (RAJDialogue[count].timer) + TalkTimer = RAJDialogue[count].timer; + break; + } + + if (text) + DoScriptText(text, me); } - if (PerformanceReady) + void PrepareEncounter() { - if (!RaidWiped) + sLog.outDebug("TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + uint8 index = 0; + uint8 count = 0; + + switch(m_uiEventId) { - if (WipeTimer <= diff) + case EVENT_OZ: + index = 0; + count = 4; + break; + case EVENT_HOOD: + index = 4; + count = index+1; + break; + case EVENT_RAJ: + index = 5; + count = index+1; + break; + } + + for (; index < count; ++index) + { + uint32 entry = ((uint32)Spawns[index][0]); + float PosX = Spawns[index][1]; + + if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILLISECONDS)) { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) - return; + // In case database has bad flags + pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + } - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) - return; + RaidWiped = false; + } - RaidWiped = true; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + if (HasEscortState(STATE_ESCORT_PAUSED)) + { + if (TalkTimer <= diff) + { + if (TalkCount > 3) { - if (i->getSource()->isAlive() && !i->getSource()->isGameMaster()) - { - RaidWiped = false; - break; - } + if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID)) + pSpotlight->ForcedDespawn(); + + SetEscortPaused(false); + return; } - if (RaidWiped) + Talk(TalkCount); + ++TalkCount; + } else TalkTimer -= diff; + } + + if (PerformanceReady) + { + if (!RaidWiped) + { + if (WipeTimer <= diff) { + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) + return; + + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (PlayerList.isEmpty()) + return; + RaidWiped = true; - EnterEvadeMode(); - return; - } + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive() && !i->getSource()->isGameMaster()) + { + RaidWiped = false; + break; + } + } + + if (RaidWiped) + { + RaidWiped = true; + EnterEvadeMode(); + return; + } + + WipeTimer = 15000; + } else WipeTimer -= diff; + } - WipeTimer = 15000; - } else WipeTimer -= diff; } - } + }; + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI, pCreature->AI()); + + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->StartEvent(); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_OZ; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_HOOD; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pBarnesAI->m_uiEventId = EVENT_RAJ; + sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID()); + break; + } + + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + // Check for death of Moroes and if opera event is not done already + if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + if (pPlayer->isGameMaster()) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + } + + if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnes::npc_barnesAI,pCreature->AI())) + { + if (!pBarnesAI->RaidWiped) + pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID()); + + return true; + } + } + } + + pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_barnesAI(pCreature); + } + }; -CreatureAI* GetAI_npc_barnesAI(Creature* pCreature) -{ - return new npc_barnesAI(pCreature); -} -bool GossipHello_npc_barnes(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - // Check for death of Moroes and if opera event is not done already - if (pInstance->GetData(TYPE_MOROES) == DONE && pInstance->GetData(TYPE_OPERA) != DONE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - if (pPlayer->isGameMaster()) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, OZ_GM_GOSSIP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - } - - if (npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI,pCreature->AI())) - { - if (!pBarnesAI->RaidWiped) - pPlayer->SEND_GOSSIP_MENU(8970, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(8975, pCreature->GetGUID()); - - return true; - } - } - } - - pPlayer->SEND_GOSSIP_MENU(8978, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_barnes(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - npc_barnesAI* pBarnesAI = CAST_AI(npc_barnesAI, pCreature->AI()); - - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, OZ_GOSSIP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(8971, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->StartEvent(); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_OZ; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_OZ",pPlayer->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_HOOD; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_HOOD",pPlayer->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pBarnesAI->m_uiEventId = EVENT_RAJ; - sLog.outString("TSCR: player (GUID %i) manually set Opera event to EVENT_RAJ",pPlayer->GetGUID()); - break; - } - - return true; -} /*### # npc_berthold @@ -400,28 +408,35 @@ enum eBerthold }; #define GOSSIP_ITEM_TELEPORT "Teleport me to the Guardian's Library" - -bool GossipHello_npc_berthold(Player* pPlayer, Creature* pCreature) + class npc_berthold : public CreatureScript { - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) +public: + npc_berthold() : CreatureScript("npc_berthold") { } + + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - // Check if Shade of Aran event is done - if (pInstance->GetData(TYPE_ARAN) == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true); + + pPlayer->CLOSE_GOSSIP_MENU(); + return true; } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + // Check if Shade of Aran event is done + if (pInstance->GetData(TYPE_ARAN) == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + } -bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, true); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; - pPlayer->CLOSE_GOSSIP_MENU(); - return true; -} /*### # npc_image_of_medivh @@ -445,204 +460,194 @@ bool GossipSelect_npc_berthold(Player* pPlayer, Creature* /*pCreature*/, uint32 static float MedivPos[4] = {-11161.49,-1902.24,91.48,1.94}; static float ArcanagosPos[4] = {-11169.75,-1881.48,95.39,4.83}; - -struct npc_image_of_medivhAI : public ScriptedAI + class npc_image_of_medivh : public CreatureScript { - npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) +public: + npc_image_of_medivh() : CreatureScript("npc_image_of_medivh") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_image_of_medivhAI(pCreature); } - ScriptedInstance *pInstance; - - uint64 ArcanagosGUID; - - uint32 YellTimer; - uint32 Step; - uint32 FireMedivhTimer; - uint32 FireArcanagosTimer; - - bool EventStarted; - - void Reset() + struct npc_image_of_medivhAI : public ScriptedAI { - ArcanagosGUID = 0; - - if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) + npc_image_of_medivhAI(Creature* c) : ScriptedAI(c) { - pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); - (*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]); - Step = 0; - }else - { - me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) {} - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - if (id == 1) + InstanceScript *pInstance; + + uint64 ArcanagosGUID; + + uint32 YellTimer; + uint32 Step; + uint32 FireMedivhTimer; + uint32 FireArcanagosTimer; + + bool EventStarted; + + void Reset() { - StartEvent(); - me->SetOrientation(MedivPos[3]); - me->SetOrientation(MedivPos[3]); - } - } + ArcanagosGUID = 0; - void StartEvent() - { - Step = 1; - EventStarted = true; - Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); - if (!Arcanagos) - return; - ArcanagosGUID = Arcanagos->GetGUID(); - Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); - Arcanagos->SetOrientation(ArcanagosPos[3]); - me->SetOrientation(MedivPos[3]); - YellTimer = 10000; - } - - uint32 NextStep(uint32 Step) - { - Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); - Map* pMap = me->GetMap(); - switch(Step) - { - case 0: return 9999999; - case 1: - me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL); - return 10000; - case 2: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL); - return 20000; - case 3: - me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL); - return 10000; - case 4: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL); - return 20000; - case 5: - me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL); - return 20000; - case 6: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL); - return 10000; - case 7: - FireArcanagosTimer = 500; - return 5000; - case 8: - FireMedivhTimer = 500; - DoCast(me, SPELL_MANA_SHIELD); - return 10000; - case 9: - me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); - return 10000; - case 10: - if (arca) - DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); - return 1000; - case 11: - if (arca) - CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); - return 5000; - case 12: - arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); - arca->setActive(true); - arca->InterruptNonMeleeSpells(true); - arca->SetSpeed(MOVE_FLIGHT, 2.0f); - return 10000; - case 13: - me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); - return 10000; - case 14: - me->SetVisibility(VISIBILITY_OFF); - me->ClearInCombat(); - - if (pMap->IsDungeon()) + if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0) { - InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers(); - for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->isAlive()) - { - if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) - i->getSource()->CompleteQuest(9645); - } - } + pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); + (*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]); + Step = 0; + }else + { + me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } + } + void EnterCombat(Unit* /*who*/) {} + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + if (id == 1) + { + StartEvent(); + me->SetOrientation(MedivPos[3]); + me->SetOrientation(MedivPos[3]); } - return 50000; - case 15: - arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return 5000; - default : return 9999999; } - } - - void UpdateAI(const uint32 diff) - { - - if (YellTimer <= diff) + void StartEvent() { - if (EventStarted) - YellTimer = NextStep(Step++); - } else YellTimer -= diff; + Step = 1; + EventStarted = true; + Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); + if (!Arcanagos) + return; + ArcanagosGUID = Arcanagos->GetGUID(); + Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); + Arcanagos->SetOrientation(ArcanagosPos[3]); + me->SetOrientation(MedivPos[3]); + YellTimer = 10000; + } - if (Step >= 7 && Step <= 12) + uint32 NextStep(uint32 Step) { Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); - - if (FireArcanagosTimer <= diff) + Map* pMap = me->GetMap(); + switch(Step) { + case 0: return 9999999; + case 1: + me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL); + return 10000; + case 2: if (arca) - arca->CastSpell(me, SPELL_FIRE_BALL, false); - FireArcanagosTimer = 6000; - } else FireArcanagosTimer -= diff; + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL); + return 20000; + case 3: + me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL); + return 10000; + case 4: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL); + return 20000; + case 5: + me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL); + return 20000; + case 6: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL); + return 10000; + case 7: + FireArcanagosTimer = 500; + return 5000; + case 8: + FireMedivhTimer = 500; + DoCast(me, SPELL_MANA_SHIELD); + return 10000; + case 9: + me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false); + return 10000; + case 10: + if (arca) + DoCast(arca, SPELL_CONFLAGRATION_BLAST, false); + return 1000; + case 11: + if (arca) + CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL); + return 5000; + case 12: + arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47); + arca->setActive(true); + arca->InterruptNonMeleeSpells(true); + arca->SetSpeed(MOVE_FLIGHT, 2.0f); + return 10000; + case 13: + me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL); + return 10000; + case 14: + me->SetVisibility(VISIBILITY_OFF); + me->ClearInCombat(); + + if (pMap->IsDungeon()) + { + InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers(); + for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive()) + { + if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE) + i->getSource()->CompleteQuest(9645); + } + } + } + return 50000; + case 15: + arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return 5000; + default : return 9999999; + } - if (FireMedivhTimer <= diff) - { - if (arca) - DoCast(arca, SPELL_FIRE_BALL); - FireMedivhTimer = 5000; - } else FireMedivhTimer -= diff; } - } + + void UpdateAI(const uint32 diff) + { + + if (YellTimer <= diff) + { + if (EventStarted) + YellTimer = NextStep(Step++); + } else YellTimer -= diff; + + if (Step >= 7 && Step <= 12) + { + Unit* arca = Unit::GetUnit((*me),ArcanagosGUID); + + if (FireArcanagosTimer <= diff) + { + if (arca) + arca->CastSpell(me, SPELL_FIRE_BALL, false); + FireArcanagosTimer = 6000; + } else FireArcanagosTimer -= diff; + + if (FireMedivhTimer <= diff) + { + if (arca) + DoCast(arca, SPELL_FIRE_BALL); + FireMedivhTimer = 5000; + } else FireMedivhTimer -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_image_of_medivh(Creature* pCreature) -{ - return new npc_image_of_medivhAI(pCreature); -} void AddSC_karazhan() { - Script* newscript; - - newscript = new Script; - newscript->GetAI = &GetAI_npc_barnesAI; - newscript->Name = "npc_barnes"; - newscript->pGossipHello = &GossipHello_npc_barnes; - newscript->pGossipSelect = &GossipSelect_npc_barnes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_berthold"; - newscript->pGossipHello = &GossipHello_npc_berthold; - newscript->pGossipSelect = &GossipSelect_npc_berthold; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_image_of_medivh"; - newscript->GetAI = &GetAI_npc_image_of_medivh; - newscript->RegisterSelf(); + new npc_barnes(); + new npc_berthold(); + new npc_image_of_medivh(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 3f0cffbacaa..582add3c1c8 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -76,607 +76,620 @@ float KaelLocations[3][2]= }; #define LOCATION_Z -16.727455 - -struct boss_felblood_kaelthasAI : public ScriptedAI + class boss_felblood_kaelthas : public CreatureScript { - boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) +public: + boss_felblood_kaelthas() : CreatureScript("boss_felblood_kaelthas") { } + + CreatureAI* GetAI(Creature* c) { - pInstance = c->GetInstanceData(); + return new boss_felblood_kaelthasAI(c); } - ScriptedInstance* pInstance; - - uint32 FireballTimer; - uint32 PhoenixTimer; - uint32 FlameStrikeTimer; - uint32 CombatPulseTimer; - - //Heroic only - uint32 PyroblastTimer; - - uint32 GravityLapseTimer; - uint32 GravityLapsePhase; - // 0 = No Gravity Lapse - // 1 = Casting Gravity Lapse visual - // 2 = Teleported people to self - // 3 = Knocked people up in the air - // 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs. - - bool FirstGravityLapse; - bool HasTaunted; - - uint8 Phase; - // 0 = Not started - // 1 = Fireball; Summon Phoenix; Flamestrike - // 2 = Gravity Lapses - - void Reset() + struct boss_felblood_kaelthasAI : public ScriptedAI { - // TODO: Timers - FireballTimer = 0; - PhoenixTimer = 10000; - FlameStrikeTimer = 25000; - CombatPulseTimer = 0; - - PyroblastTimer = 60000; - - GravityLapseTimer = 0; - GravityLapsePhase = 0; - - FirstGravityLapse = true; - HasTaunted = false; - - Phase = 0; - - if (pInstance) + boss_felblood_kaelthasAI(Creature* c) : ScriptedAI(c) { - pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 FireballTimer; + uint32 PhoenixTimer; + uint32 FlameStrikeTimer; + uint32 CombatPulseTimer; + + //Heroic only + uint32 PyroblastTimer; + + uint32 GravityLapseTimer; + uint32 GravityLapsePhase; + // 0 = No Gravity Lapse + // 1 = Casting Gravity Lapse visual + // 2 = Teleported people to self + // 3 = Knocked people up in the air + // 4 = Applied an aura that allows them to fly, channeling visual, relased Arcane Orbs. + + bool FirstGravityLapse; + bool HasTaunted; + + uint8 Phase; + // 0 = Not started + // 1 = Fireball; Summon Phoenix; Flamestrike + // 2 = Gravity Lapses + + void Reset() + { + // TODO: Timers + FireballTimer = 0; + PhoenixTimer = 10000; + FlameStrikeTimer = 25000; + CombatPulseTimer = 0; + + PyroblastTimer = 60000; + + GravityLapseTimer = 0; + GravityLapsePhase = 0; + + FirstGravityLapse = true; + HasTaunted = false; + + Phase = 0; + + if (pInstance) + { + pInstance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED); + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); + // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) + // Small door opened after event are expected to be closed by default + } + } + + void JustDied(Unit * /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (!pInstance) + return; + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - } - } - - void JustDied(Unit * /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (!pInstance) - return; - - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), true); - // Open the encounter door - } - - void DamageTaken(Unit* /*done_by*/, uint32 &damage) - { - if (damage > me->GetHealth()) - RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. - } - - void EnterCombat(Unit * /*who*/) - { - if (!pInstance) - return; - - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false); - //Close the encounter door, open it in JustDied/Reset - } - - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && me->IsWithinDistInMap(who, 40.0)) - { - DoScriptText(SAY_AGGRO, me); - HasTaunted = true; + // Open the encounter door } - ScriptedAI::MoveInLineOfSight(who); - } - - void SetThreatList(Creature* SummonedUnit) - { - if (!SummonedUnit) - return; - - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + void DamageTaken(Unit* /*done_by*/, uint32 &damage) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) + if (damage > me->GetHealth()) + RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air. + } + + void EnterCombat(Unit * /*who*/) + { + if (!pInstance) + return; + + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_DOOR), false); + //Close the encounter door, open it in JustDied/Reset + } + + void MoveInLineOfSight(Unit *who) + { + if (!HasTaunted && me->IsWithinDistInMap(who, 40.0)) { - float threat = me->getThreatManager().getThreat(pUnit); - SummonedUnit->AddThreat(pUnit, threat); + DoScriptText(SAY_AGGRO, me); + HasTaunted = true; } - } - } - void TeleportPlayersToSelf() - { - float x = KaelLocations[0][0]; - float y = KaelLocations[0][1]; - me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f); - //me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); + ScriptedAI::MoveInLineOfSight(who); } - DoCast(me, SPELL_TELEPORT_CENTER, true); - } - void CastGravityLapseKnockUp() - { - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + void SetThreatList(Creature* SummonedUnit) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - // Knockback into the air - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); - } - } + if (!SummonedUnit) + return; - void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... - { - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + std::list& m_threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = m_threatlist.begin(); + for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { - // Also needs an exception in spell system. - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); - // Use packet hack - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); - data.append(pUnit->GetPackGUID()); - data << uint32(0); - pUnit->SendMessageToSet(&data, true); - } - } - } - - void RemoveGravityLapse() - { - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - { - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - - WorldPacket data(12); - data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); - data.append(pUnit->GetPackGUID()); - data << uint32(0); - pUnit->SendMessageToSet(&data, true); - } - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - switch(Phase) - { - case 0: - { - // *Heroic mode only: - if (IsHeroic()) + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) { - if (PyroblastTimer <= diff) - { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoCast(me, SPELL_SHOCK_BARRIER, true); - DoCast(me->getVictim(), SPELL_PYROBLAST); - PyroblastTimer = 60000; - } else PyroblastTimer -= diff; + float threat = me->getThreatManager().getThreat(pUnit); + SummonedUnit->AddThreat(pUnit, threat); } + } + } - if (FireballTimer <= diff) + void TeleportPlayersToSelf() + { + float x = KaelLocations[0][0]; + float y = KaelLocations[0][1]; + me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f); + //me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); + } + DoCast(me, SPELL_TELEPORT_CENTER, true); + } + + void CastGravityLapseKnockUp() + { + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + // Knockback into the air + pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); + } + } + + void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... + { + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) { - DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); - FireballTimer = urand(2000,6000); - } else FireballTimer -= diff; + // Also needs an exception in spell system. + pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); + // Use packet hack + WorldPacket data(12); + data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); + data.append(pUnit->GetPackGUID()); + data << uint32(0); + pUnit->SendMessageToSet(&data, true); + } + } + } - if (PhoenixTimer <= diff) + void RemoveGravityLapse() + { + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) { + pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); + pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + WorldPacket data(12); + data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); + data.append(pUnit->GetPackGUID()); + data << uint32(0); + pUnit->SendMessageToSet(&data, true); + } + } + } - uint8 random = urand(1,2); - float x = KaelLocations[random][0]; - float y = KaelLocations[random][1]; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - if (Phoenix) + switch(Phase) + { + case 0: + { + // *Heroic mode only: + if (IsHeroic()) { - Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); - SetThreatList(Phoenix); - Phoenix->AI()->AttackStart(pTarget); + if (PyroblastTimer <= diff) + { + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoCast(me, SPELL_SHOCK_BARRIER, true); + DoCast(me->getVictim(), SPELL_PYROBLAST); + PyroblastTimer = 60000; + } else PyroblastTimer -= diff; } - DoScriptText(SAY_PHOENIX, me); - - PhoenixTimer = 60000; - } else PhoenixTimer -= diff; - - if (FlameStrikeTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (FireballTimer <= diff) { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoCast(pTarget, SPELL_FLAMESTRIKE3, true); - DoScriptText(SAY_FLAMESTRIKE, me); + DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL); + FireballTimer = urand(2000,6000); + } else FireballTimer -= diff; + + if (PhoenixTimer <= diff) + { + + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + + uint8 random = urand(1,2); + float x = KaelLocations[random][0]; + float y = KaelLocations[random][1]; + + Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + if (Phoenix) + { + Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + SetThreatList(Phoenix); + Phoenix->AI()->AttackStart(pTarget); + } + + DoScriptText(SAY_PHOENIX, me); + + PhoenixTimer = 60000; + } else PhoenixTimer -= diff; + + if (FlameStrikeTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoCast(pTarget, SPELL_FLAMESTRIKE3, true); + DoScriptText(SAY_FLAMESTRIKE, me); + } + FlameStrikeTimer = urand(15000,25000); + } else FlameStrikeTimer -= diff; + + // Below 50% + if (me->GetMaxHealth() * 0.5 > me->GetHealth()) + { + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + GravityLapseTimer = 0; + GravityLapsePhase = 0; + Phase = 1; } - FlameStrikeTimer = urand(15000,25000); - } else FlameStrikeTimer -= diff; - // Below 50% - if (me->GetMaxHealth() * 0.5 > me->GetHealth()) - { - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - GravityLapseTimer = 0; - GravityLapsePhase = 0; - Phase = 1; + DoMeleeAttackIfReady(); } + break; - DoMeleeAttackIfReady(); - } - break; - - case 1: - { - if (GravityLapseTimer <= diff) + case 1: { - switch(GravityLapsePhase) + if (GravityLapseTimer <= diff) { - case 0: - if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse - { - DoScriptText(SAY_GRAVITY_LAPSE, me); - FirstGravityLapse = false; - - if (pInstance) + switch(GravityLapsePhase) + { + case 0: + if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse { - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true); - pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_RIGHT), true); - } - }else - { - DoScriptText(SAY_RECAST_GRAVITY, me); - } + DoScriptText(SAY_GRAVITY_LAPSE, me); + FirstGravityLapse = false; - DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); - GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell - GravityLapsePhase = 1; - break; - - case 1: - TeleportPlayersToSelf(); - GravityLapseTimer = 1000; - GravityLapsePhase = 2; - break; - - case 2: - CastGravityLapseKnockUp(); - GravityLapseTimer = 1000; - GravityLapsePhase = 3; - break; - - case 3: - CastGravityLapseFly(); - GravityLapseTimer = 30000; - GravityLapsePhase = 4; - - for (uint8 i = 0; i < 3; ++i) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); - if (Orb && pTarget) + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_LEFT), true); + pInstance->HandleGameObject(pInstance->GetData64(DATA_KAEL_STATUE_RIGHT), true); + } + }else { - Orb->SetSpeed(MOVE_RUN, 0.5f); - Orb->AddThreat(pTarget, 1000000.0f); - Orb->AI()->AttackStart(pTarget); + DoScriptText(SAY_RECAST_GRAVITY, me); } - } + DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL); + GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell + GravityLapsePhase = 1; + break; - DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); - break; + case 1: + TeleportPlayersToSelf(); + GravityLapseTimer = 1000; + GravityLapsePhase = 2; + break; - case 4: - me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_TIRED, me); - DoCast(me, SPELL_POWER_FEEDBACK); - RemoveGravityLapse(); - GravityLapseTimer = 10000; - GravityLapsePhase = 0; - break; - } - } else GravityLapseTimer -= diff; + case 2: + CastGravityLapseKnockUp(); + GravityLapseTimer = 1000; + GravityLapsePhase = 3; + break; + + case 3: + CastGravityLapseFly(); + GravityLapseTimer = 30000; + GravityLapsePhase = 4; + + for (uint8 i = 0; i < 3; ++i) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + Creature* Orb = DoSpawnCreature(CREATURE_ARCANE_SPHERE, 5, 5, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000); + if (Orb && pTarget) + { + Orb->SetSpeed(MOVE_RUN, 0.5f); + Orb->AddThreat(pTarget, 1000000.0f); + Orb->AI()->AttackStart(pTarget); + } + + } + + DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL); + break; + + case 4: + me->InterruptNonMeleeSpells(false); + DoScriptText(SAY_TIRED, me); + DoCast(me, SPELL_POWER_FEEDBACK); + RemoveGravityLapse(); + GravityLapseTimer = 10000; + GravityLapsePhase = 0; + break; + } + } else GravityLapseTimer -= diff; + } + break; } - break; } - } + }; + }; - -struct mob_felkael_flamestrikeAI : public ScriptedAI + class mob_felkael_flamestrike : public CreatureScript { - mob_felkael_flamestrikeAI(Creature *c) : ScriptedAI(c) +public: + mob_felkael_flamestrike() : CreatureScript("mob_felkael_flamestrike") { } + + CreatureAI* GetAI(Creature* c) { + return new mob_felkael_flamestrikeAI(c); } - uint32 FlameStrikeTimer; - - void Reset() + struct mob_felkael_flamestrikeAI : public ScriptedAI { - FlameStrikeTimer = 5000; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(14); - - DoCast(me, SPELL_FLAMESTRIKE2, true); - } - - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (FlameStrikeTimer <= diff) + mob_felkael_flamestrikeAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_FLAMESTRIKE1_NORMAL, true); - me->Kill(me); - } else FlameStrikeTimer -= diff; - } -}; - -struct mob_felkael_phoenixAI : public ScriptedAI -{ - mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint32 BurnTimer; - uint32 Death_Timer; - bool Rebirth; - bool FakeDeath; - - void Reset() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - DoCast(me, SPELL_PHOENIX_BURN, true); - BurnTimer = 2000; - Death_Timer = 3000; - Rebirth = false; - FakeDeath = false; - } - - void EnterCombat(Unit* /*who*/) {} - - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage < me->GetHealth()) - return; - - //Prevent glitch if in fake death - if (FakeDeath) - { - damage = 0; - return; - } - //Don't really die in all phases of Kael'Thas - if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0) - { - //prevent death - damage = 0; - FakeDeath = true; - me->InterruptNonMeleeSpells(false); - me->SetHealth(0); - me->StopMoving(); - me->ClearComboPointHolders(); - me->RemoveAllAurasOnDeath(); - me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); - me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); + uint32 FlameStrikeTimer; + + void Reset() + { + FlameStrikeTimer = 5000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->ClearAllReactives(); - me->SetUInt64Value(UNIT_FIELD_TARGET,0); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); + me->setFaction(14); - } + DoCast(me, SPELL_FLAMESTRIKE2, true); + } - } - - void JustDied(Unit* /*slayer*/) - { - me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - } - - void UpdateAI(const uint32 diff) - { - - //If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg. - if (FakeDeath) + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) { - if (!Rebirth) + if (FlameStrikeTimer <= diff) { - DoCast(me, SPELL_REBIRTH_DMG); - Rebirth = true; - } + DoCast(me, SPELL_FLAMESTRIKE1_NORMAL, true); + me->Kill(me); + } else FlameStrikeTimer -= diff; + } + }; - if (Rebirth) +}; + class mob_felkael_phoenix : public CreatureScript +{ +public: + mob_felkael_phoenix() : CreatureScript("mob_felkael_phoenix") { } + + CreatureAI* GetAI(Creature* c) + { + return new mob_felkael_phoenixAI(c); + } + + struct mob_felkael_phoenixAI : public ScriptedAI + { + mob_felkael_phoenixAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + uint32 BurnTimer; + uint32 Death_Timer; + bool Rebirth; + bool FakeDeath; + + void Reset() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + DoCast(me, SPELL_PHOENIX_BURN, true); + BurnTimer = 2000; + Death_Timer = 3000; + Rebirth = false; + FakeDeath = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage < me->GetHealth()) + return; + + //Prevent glitch if in fake death + if (FakeDeath) { + damage = 0; + return; - if (Death_Timer <= diff) - { - me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - me->DisappearAndDie(); - Rebirth = false; - } else Death_Timer -= diff; } + //Don't really die in all phases of Kael'Thas + if (pInstance && pInstance->GetData(DATA_KAELTHAS_EVENT) == 0) + { + //prevent death + damage = 0; + FakeDeath = true; + + me->InterruptNonMeleeSpells(false); + me->SetHealth(0); + me->StopMoving(); + me->ClearComboPointHolders(); + me->RemoveAllAurasOnDeath(); + me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false); + me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->ClearAllReactives(); + me->SetUInt64Value(UNIT_FIELD_TARGET,0); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + + } } - if (!UpdateVictim()) - return; - - if (BurnTimer <= diff) + void JustDied(Unit* /*slayer*/) { - //spell Burn should possible do this, but it doesn't, so do this for now. - uint16 dmg = urand(1650,2050); - me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false); - BurnTimer += 2000; - } BurnTimer -= diff; + me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + } - DoMeleeAttackIfReady(); - } -}; - -struct mob_felkael_phoenix_eggAI : public ScriptedAI -{ - mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {} - - uint32 HatchTimer; - - void Reset() - { - HatchTimer = 10000; - } - - void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (HatchTimer <= diff) + void UpdateAI(const uint32 diff) { - me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->Kill(me); - } else HatchTimer -= diff; - } -}; - -struct mob_arcane_sphereAI : public ScriptedAI -{ - mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) { Reset(); } - - uint32 DespawnTimer; - uint32 ChangeTargetTimer; - - void Reset() - { - DespawnTimer = 30000; - ChangeTargetTimer = urand(6000,12000); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->setFaction(14); - DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); - } - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (DespawnTimer <= diff) - me->Kill(me); - else - DespawnTimer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - if (ChangeTargetTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + //If we are fake death, we cast revbirth and after that we kill the phoenix to spawn the egg. + if (FakeDeath) { - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); + if (!Rebirth) + { + DoCast(me, SPELL_REBIRTH_DMG); + Rebirth = true; + } + + if (Rebirth) + { + + if (Death_Timer <= diff) + { + me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + me->DisappearAndDie(); + Rebirth = false; + } else Death_Timer -= diff; + } + } - ChangeTargetTimer = urand(5000,15000); - } else ChangeTargetTimer -= diff; + if (!UpdateVictim()) + return; + + if (BurnTimer <= diff) + { + //spell Burn should possible do this, but it doesn't, so do this for now. + uint16 dmg = urand(1650,2050); + me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false); + BurnTimer += 2000; + } BurnTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_felkael_phoenix_egg : public CreatureScript +{ +public: + mob_felkael_phoenix_egg() : CreatureScript("mob_felkael_phoenix_egg") { } + + CreatureAI* GetAI(Creature* c) + { + return new mob_felkael_phoenix_eggAI(c); } + + struct mob_felkael_phoenix_eggAI : public ScriptedAI + { + mob_felkael_phoenix_eggAI(Creature *c) : ScriptedAI(c) {} + + uint32 HatchTimer; + + void Reset() + { + HatchTimer = 10000; + } + + void EnterCombat(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (HatchTimer <= diff) + { + me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->Kill(me); + } else HatchTimer -= diff; + + } + }; + +}; + class mob_arcane_sphere : public CreatureScript +{ +public: + mob_arcane_sphere() : CreatureScript("mob_arcane_sphere") { } + + CreatureAI* GetAI(Creature* c) + { + return new mob_arcane_sphereAI(c); + } + + struct mob_arcane_sphereAI : public ScriptedAI + { + mob_arcane_sphereAI(Creature *c) : ScriptedAI(c) { Reset(); } + + uint32 DespawnTimer; + uint32 ChangeTargetTimer; + + void Reset() + { + DespawnTimer = 30000; + ChangeTargetTimer = urand(6000,12000); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->setFaction(14); + DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true); + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (DespawnTimer <= diff) + me->Kill(me); + else + DespawnTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (ChangeTargetTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + } + + ChangeTargetTimer = urand(5000,15000); + } else ChangeTargetTimer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_felblood_kaelthas(Creature* c) -{ - return new boss_felblood_kaelthasAI(c); -} -CreatureAI* GetAI_mob_arcane_sphere(Creature* c) -{ - return new mob_arcane_sphereAI(c); -} -CreatureAI* GetAI_mob_felkael_phoenix(Creature* c) -{ - return new mob_felkael_phoenixAI(c); -} -CreatureAI* GetAI_mob_felkael_phoenix_egg(Creature* c) -{ - return new mob_felkael_phoenix_eggAI(c); -} -CreatureAI* GetAI_mob_felkael_flamestrike(Creature* c) -{ - return new mob_felkael_flamestrikeAI(c); -} void AddSC_boss_felblood_kaelthas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_felblood_kaelthas"; - newscript->GetAI = &GetAI_boss_felblood_kaelthas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_arcane_sphere"; - newscript->GetAI = &GetAI_mob_arcane_sphere; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_phoenix"; - newscript->GetAI = &GetAI_mob_felkael_phoenix; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_phoenix_egg"; - newscript->GetAI = &GetAI_mob_felkael_phoenix_egg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felkael_flamestrike"; - newscript->GetAI = &GetAI_mob_felkael_flamestrike; - newscript->RegisterSelf(); + new boss_felblood_kaelthas(); + new mob_arcane_sphere(); + new mob_felkael_phoenix(); + new mob_felkael_phoenix_egg(); + new mob_felkael_flamestrike(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index bc4049bb1fb..1c0eb29c70c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -86,247 +86,254 @@ const uint32 m_auiAddEntries[] = 24553, //Apoko 24556, //Zelfan }; - -struct boss_priestess_delrissaAI : public ScriptedAI + class boss_priestess_delrissa : public CreatureScript { - boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) +public: + boss_priestess_delrissa() : CreatureScript("boss_priestess_delrissa") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); - LackeyEntryList.clear(); + return new boss_priestess_delrissaAI(pCreature); } - ScriptedInstance* pInstance; - - std::vector LackeyEntryList; - uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; - - uint8 PlayersKilled; - - uint32 HealTimer; - uint32 RenewTimer; - uint32 ShieldTimer; - uint32 SWPainTimer; - uint32 DispelTimer; - uint32 ResetTimer; - - void Reset() + struct boss_priestess_delrissaAI : public ScriptedAI { - PlayersKilled = 0; - - HealTimer = 15000; - RenewTimer = 10000; - ShieldTimer = 2000; - SWPainTimer = 5000; - DispelTimer = 7500; - ResetTimer = 5000; - - InitializeLackeys(); - } - - //this mean she at some point evaded - void JustReachedHome() - { - if (pInstance) - pInstance->SetData(DATA_DELRISSA_EVENT, FAIL); - } - - void EnterCombat(Unit* who) - { - DoScriptText(SAY_AGGRO, me); - - for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) - { - if (!pAdd->getVictim()) - { - who->SetInCombatWith(pAdd); - pAdd->AddThreat(who, 0.0f); - } - } + pInstance = c->GetInstanceScript(); + memset(&m_auiLackeyGUID, 0, sizeof(m_auiLackeyGUID)); + LackeyEntryList.clear(); } - if (pInstance) - pInstance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); - } + InstanceScript* pInstance; - void InitializeLackeys() - { - //can be called if Creature are dead, so avoid - if (!me->isAlive()) - return; + std::vector LackeyEntryList; + uint64 m_auiLackeyGUID[MAX_ACTIVE_LACKEY]; - uint8 j = 0; + uint8 PlayersKilled; - //it's empty, so first time - if (LackeyEntryList.empty()) + uint32 HealTimer; + uint32 RenewTimer; + uint32 ShieldTimer; + uint32 SWPainTimer; + uint32 DispelTimer; + uint32 ResetTimer; + + void Reset() { - //pre-allocate size for speed - LackeyEntryList.resize((sizeof(m_auiAddEntries) / sizeof(uint32))); + PlayersKilled = 0; - //fill vector array with entries from Creature array - for (uint8 i = 0; i < LackeyEntryList.size(); ++i) - LackeyEntryList[i] = m_auiAddEntries[i]; - - //remove random entries - while (LackeyEntryList.size() > MAX_ACTIVE_LACKEY) - LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); - - //summon all the remaining in vector - for (std::vector::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) - { - if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) - m_auiLackeyGUID[j] = pAdd->GetGUID(); - - ++j; - } - } - else - { - for (std::vector::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) - { - Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]); - - //object already removed, not exist - if (!pAdd) - { - if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) - m_auiLackeyGUID[j] = pAdd->GetGUID(); - } - ++j; - } - } - } - - void KilledUnit(Unit* victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - DoScriptText(PlayerDeath[PlayersKilled].id, me); - - if (PlayersKilled < 4) - ++PlayersKilled; - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (!pInstance) - return; - - if (pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY) - pInstance->SetData(DATA_DELRISSA_EVENT, DONE); - else - { - if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (ResetTimer <= diff) - { - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - if (me->GetPositionZ() >= z+10) - { - EnterEvadeMode(); - return; - } + HealTimer = 15000; + RenewTimer = 10000; + ShieldTimer = 2000; + SWPainTimer = 5000; + DispelTimer = 7500; ResetTimer = 5000; - } else ResetTimer -= diff; - if (HealTimer <= diff) + InitializeLackeys(); + } + + //this mean she at some point evaded + void JustReachedHome() { - uint32 health = me->GetHealth(); - Unit *pTarget = me; + if (pInstance) + pInstance->SetData(DATA_DELRISSA_EVENT, FAIL); + } + + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me); + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) { - if (pAdd->isAlive() && pAdd->GetHealth() < health) - pTarget = pAdd; + if (!pAdd->getVictim()) + { + who->SetInCombatWith(pAdd); + pAdd->AddThreat(who, 0.0f); + } } } - DoCast(pTarget, SPELL_FLASH_HEAL); - HealTimer = 15000; - } else HealTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS); + } - if (RenewTimer <= diff) + void InitializeLackeys() { - Unit *pTarget = me; + //can be called if Creature are dead, so avoid + if (!me->isAlive()) + return; - if (urand(0,1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) - if (pAdd->isAlive()) - pTarget = pAdd; + uint8 j = 0; - DoCast(pTarget, SPELL_RENEW_NORMAL); - RenewTimer = 5000; - } else RenewTimer -= diff; + //it's empty, so first time + if (LackeyEntryList.empty()) + { + //pre-allocate size for speed + LackeyEntryList.resize((sizeof(m_auiAddEntries) / sizeof(uint32))); - if (ShieldTimer <= diff) - { - Unit *pTarget = me; + //fill vector array with entries from Creature array + for (uint8 i = 0; i < LackeyEntryList.size(); ++i) + LackeyEntryList[i] = m_auiAddEntries[i]; - if (urand(0,1)) - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) - if (pAdd->isAlive() && !pAdd->HasAura(SPELL_SHIELD)) - pTarget = pAdd; + //remove random entries + while (LackeyEntryList.size() > MAX_ACTIVE_LACKEY) + LackeyEntryList.erase(LackeyEntryList.begin() + rand()%LackeyEntryList.size()); - DoCast(pTarget, SPELL_SHIELD); - ShieldTimer = 7500; - } else ShieldTimer -= diff; + //summon all the remaining in vector + for (std::vector::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + { + if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + m_auiLackeyGUID[j] = pAdd->GetGUID(); - if (DispelTimer <= diff) - { - Unit *pTarget = NULL; - bool friendly = false; - - if (urand(0,1)) - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + ++j; + } + } else { - friendly = true; + for (std::vector::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr) + { + Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]); + + //object already removed, not exist + if (!pAdd) + { + if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) + m_auiLackeyGUID[j] = pAdd->GetGUID(); + } + ++j; + } + } + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; + + DoScriptText(PlayerDeath[PlayersKilled].id, me); + + if (PlayersKilled < 4) + ++PlayersKilled; + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (!pInstance) + return; + + if (pInstance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY) + pInstance->SetData(DATA_DELRISSA_EVENT, DONE); + else + { + if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (ResetTimer <= diff) + { + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + if (me->GetPositionZ() >= z+10) + { + EnterEvadeMode(); + return; + } + ResetTimer = 5000; + } else ResetTimer -= diff; + + if (HealTimer <= diff) + { + uint32 health = me->GetHealth(); + Unit *pTarget = me; + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + { + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i])) + { + if (pAdd->isAlive() && pAdd->GetHealth() < health) + pTarget = pAdd; + } + } + + DoCast(pTarget, SPELL_FLASH_HEAL); + HealTimer = 15000; + } else HealTimer -= diff; + + if (RenewTimer <= diff) + { + Unit *pTarget = me; if (urand(0,1)) - pTarget = me; - else if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) if (pAdd->isAlive()) pTarget = pAdd; - } - if (pTarget) - DoCast(pTarget, SPELL_DISPEL_MAGIC); + DoCast(pTarget, SPELL_RENEW_NORMAL); + RenewTimer = 5000; + } else RenewTimer -= diff; - DispelTimer = 12000; - } else DispelTimer -= diff; + if (ShieldTimer <= diff) + { + Unit *pTarget = me; - if (SWPainTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SW_PAIN_NORMAL); + if (urand(0,1)) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (pAdd->isAlive() && !pAdd->HasAura(SPELL_SHIELD)) + pTarget = pAdd; - SWPainTimer = 10000; - } else SWPainTimer -= diff; + DoCast(pTarget, SPELL_SHIELD); + ShieldTimer = 7500; + } else ShieldTimer -= diff; + + if (DispelTimer <= diff) + { + Unit *pTarget = NULL; + bool friendly = false; + + if (urand(0,1)) + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + else + { + friendly = true; + + if (urand(0,1)) + pTarget = me; + else + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY])) + if (pAdd->isAlive()) + pTarget = pAdd; + } + + if (pTarget) + DoCast(pTarget, SPELL_DISPEL_MAGIC); + + DispelTimer = 12000; + } else DispelTimer -= diff; + + if (SWPainTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SW_PAIN_NORMAL); + + SWPainTimer = 10000; + } else SWPainTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_priestess_delrissa(Creature* pCreature) -{ - return new boss_priestess_delrissaAI(pCreature); -} enum eHealingPotion { @@ -338,12 +345,12 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI { boss_priestess_lackey_commonAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); memset(&m_auiLackeyGUIDs, 0, sizeof(m_auiLackeyGUIDs)); AcquireGUIDs(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 m_auiLackeyGUIDs[MAX_ACTIVE_LACKEY]; uint32 ResetThreatTimer; @@ -447,7 +454,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI if (Creature* Delrissa = (Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA)))) { for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) - m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; + m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissa::boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i]; } } @@ -476,93 +483,100 @@ enum eRogueSpells SPELL_BACKSTAB = 15657, SPELL_EVISCERATE = 27611 }; - -struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI + class boss_kagani_nightstrike : public CreatureScript { - //Rogue - boss_kagani_nightstrikeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_kagani_nightstrike() : CreatureScript("boss_kagani_nightstrike") { } - uint32 Gouge_Timer; - uint32 Kick_Timer; - uint32 Vanish_Timer; - uint32 Eviscerate_Timer; - uint32 Wait_Timer; - bool InVanish; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Gouge_Timer = 5500; - Kick_Timer = 7000; - Vanish_Timer = 2000; - Eviscerate_Timer = 6000; - Wait_Timer = 5000; - InVanish = false; - me->SetVisibility(VISIBILITY_ON); - - boss_priestess_lackey_commonAI::Reset(); + return new boss_kagani_nightstrikeAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Rogue + boss_kagani_nightstrikeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Gouge_Timer; + uint32 Kick_Timer; + uint32 Vanish_Timer; + uint32 Eviscerate_Timer; + uint32 Wait_Timer; + bool InVanish; - if (Vanish_Timer <= diff) + void Reset() { - DoCast(me, SPELL_VANISH); + Gouge_Timer = 5500; + Kick_Timer = 7000; + Vanish_Timer = 2000; + Eviscerate_Timer = 6000; + Wait_Timer = 5000; + InVanish = false; + me->SetVisibility(VISIBILITY_ON); - Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0); - - DoResetThreat(); - - if (pUnit) - me->AddThreat(pUnit, 1000.0f); - - InVanish = true; - Vanish_Timer = 30000; - Wait_Timer = 10000; - } else Vanish_Timer -= diff; - - if (InVanish) - { - if (Wait_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BACKSTAB, true); - DoCast(me->getVictim(), SPELL_KIDNEY_SHOT, true); - me->SetVisibility(VISIBILITY_ON); // ...? Hacklike - InVanish = false; - } else Wait_Timer -= diff; + boss_priestess_lackey_commonAI::Reset(); } - if (Gouge_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_GOUGE); - Gouge_Timer = 5500; - } else Gouge_Timer -= diff; + if (!UpdateVictim()) + return; - if (Kick_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KICK); - Kick_Timer = 7000; - } else Kick_Timer -= diff; + boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Eviscerate_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_EVISCERATE); - Eviscerate_Timer = 4000; - } else Eviscerate_Timer -= diff; + if (Vanish_Timer <= diff) + { + DoCast(me, SPELL_VANISH); + + Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0); + + DoResetThreat(); + + if (pUnit) + me->AddThreat(pUnit, 1000.0f); + + InVanish = true; + Vanish_Timer = 30000; + Wait_Timer = 10000; + } else Vanish_Timer -= diff; + + if (InVanish) + { + if (Wait_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BACKSTAB, true); + DoCast(me->getVictim(), SPELL_KIDNEY_SHOT, true); + me->SetVisibility(VISIBILITY_ON); // ...? Hacklike + InVanish = false; + } else Wait_Timer -= diff; + } + + if (Gouge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GOUGE); + Gouge_Timer = 5500; + } else Gouge_Timer -= diff; + + if (Kick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KICK); + Kick_Timer = 7000; + } else Kick_Timer -= diff; + + if (Eviscerate_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_EVISCERATE); + Eviscerate_Timer = 4000; + } else Eviscerate_Timer -= diff; + + if (!InVanish) + DoMeleeAttackIfReady(); + } + }; - if (!InVanish) - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kagani_nightstrike(Creature* pCreature) -{ - return new boss_kagani_nightstrikeAI(pCreature); -} enum eWarlockSpells { @@ -574,136 +588,148 @@ enum eWarlockSpells SPELL_IMP_FIREBALL = 44164, SPELL_SUMMON_IMP = 44163 }; - -struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI + class boss_ellris_duskhallow : public CreatureScript { - //Warlock - boss_ellris_duskhallowAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_ellris_duskhallow() : CreatureScript("boss_ellris_duskhallow") { } - uint32 Immolate_Timer; - uint32 Shadow_Bolt_Timer; - uint32 Seed_of_Corruption_Timer; - uint32 Curse_of_Agony_Timer; - uint32 Fear_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Immolate_Timer = 6000; - Shadow_Bolt_Timer = 3000; - Seed_of_Corruption_Timer = 2000; - Curse_of_Agony_Timer = 1000; - Fear_Timer = 10000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_ellris_duskhallowAI(pCreature); } - void EnterCombat(Unit* /*pWho*/) + struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI { - DoCast(me, SPELL_SUMMON_IMP); - } + //Warlock + boss_ellris_duskhallowAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Immolate_Timer; + uint32 Shadow_Bolt_Timer; + uint32 Seed_of_Corruption_Timer; + uint32 Curse_of_Agony_Timer; + uint32 Fear_Timer; - boss_priestess_lackey_commonAI::UpdateAI(diff); - - if (Immolate_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_IMMOLATE); Immolate_Timer = 6000; - } else Immolate_Timer -= diff; - - if (Shadow_Bolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - Shadow_Bolt_Timer = 5000; - } else Shadow_Bolt_Timer -= diff; - - if (Seed_of_Corruption_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); - - Seed_of_Corruption_Timer = 10000; - } else Seed_of_Corruption_Timer -= diff; - - if (Curse_of_Agony_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_CURSE_OF_AGONY); - - Curse_of_Agony_Timer = 13000; - } else Curse_of_Agony_Timer -= diff; - - if (Fear_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_FEAR); - + Shadow_Bolt_Timer = 3000; + Seed_of_Corruption_Timer = 2000; + Curse_of_Agony_Timer = 1000; Fear_Timer = 10000; - } else Fear_Timer -= diff; - DoMeleeAttackIfReady(); - } + boss_priestess_lackey_commonAI::Reset(); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoCast(me, SPELL_SUMMON_IMP); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Immolate_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMMOLATE); + Immolate_Timer = 6000; + } else Immolate_Timer -= diff; + + if (Shadow_Bolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + Shadow_Bolt_Timer = 5000; + } else Shadow_Bolt_Timer -= diff; + + if (Seed_of_Corruption_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); + + Seed_of_Corruption_Timer = 10000; + } else Seed_of_Corruption_Timer -= diff; + + if (Curse_of_Agony_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_CURSE_OF_AGONY); + + Curse_of_Agony_Timer = 13000; + } else Curse_of_Agony_Timer -= diff; + + if (Fear_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_FEAR); + + Fear_Timer = 10000; + } else Fear_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_ellris_duskhallow(Creature* pCreature) -{ - return new boss_ellris_duskhallowAI(pCreature); -} - enum eKickDown { SPELL_KNOCKDOWN = 11428, SPELL_SNAP_KICK = 46182 }; - -struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI + class boss_eramas_brightblaze : public CreatureScript { - //Monk - boss_eramas_brightblazeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_eramas_brightblaze() : CreatureScript("boss_eramas_brightblaze") { } - uint32 Knockdown_Timer; - uint32 Snap_Kick_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Knockdown_Timer = 6000; - Snap_Kick_Timer = 4500; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_eramas_brightblazeAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Monk + boss_eramas_brightblazeAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Knockdown_Timer; + uint32 Snap_Kick_Timer; - if (Knockdown_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); Knockdown_Timer = 6000; - } else Knockdown_Timer -= diff; + Snap_Kick_Timer = 4500; - if (Snap_Kick_Timer <= diff) + boss_priestess_lackey_commonAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SNAP_KICK); - Snap_Kick_Timer = 4500; - } else Snap_Kick_Timer -= diff; + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Knockdown_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + Knockdown_Timer = 6000; + } else Knockdown_Timer -= diff; + + if (Snap_Kick_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SNAP_KICK); + Snap_Kick_Timer = 4500; + } else Snap_Kick_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_eramas_brightblaze(Creature* pCreature) -{ - return new boss_eramas_brightblazeAI(pCreature); -} - enum eMageSpells { SPELL_POLYMORPH = 13323, @@ -714,120 +740,126 @@ enum eMageSpells SPELL_FROSTBOLT = 15043, SPELL_BLINK = 14514 }; - -struct boss_yazzaiAI : public boss_priestess_lackey_commonAI + class boss_yazzai : public CreatureScript { - //Mage - boss_yazzaiAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_yazzai() : CreatureScript("boss_yazzai") { } - bool HasIceBlocked; - - uint32 Polymorph_Timer; - uint32 Ice_Block_Timer; - uint32 Wait_Timer; - uint32 Blizzard_Timer; - uint32 Ice_Lance_Timer; - uint32 Cone_of_Cold_Timer; - uint32 Frostbolt_Timer; - uint32 Blink_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HasIceBlocked = false; - - Polymorph_Timer = 1000; - Ice_Block_Timer = 20000; - Wait_Timer = 10000; - Blizzard_Timer = 8000; - Ice_Lance_Timer = 12000; - Cone_of_Cold_Timer = 10000; - Frostbolt_Timer = 3000; - Blink_Timer = 8000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_yazzaiAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_yazzaiAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Mage + boss_yazzaiAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + bool HasIceBlocked; - if (Polymorph_Timer <= diff) + uint32 Polymorph_Timer; + uint32 Ice_Block_Timer; + uint32 Wait_Timer; + uint32 Blizzard_Timer; + uint32 Ice_Lance_Timer; + uint32 Cone_of_Cold_Timer; + uint32 Frostbolt_Timer; + uint32 Blink_Timer; + + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_POLYMORPH); - Polymorph_Timer = 20000; - } - } else Polymorph_Timer -= diff; + HasIceBlocked = false; - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked) - { - DoCast(me, SPELL_ICE_BLOCK); - HasIceBlocked = true; + Polymorph_Timer = 1000; + Ice_Block_Timer = 20000; + Wait_Timer = 10000; + Blizzard_Timer = 8000; + Ice_Lance_Timer = 12000; + Cone_of_Cold_Timer = 10000; + Frostbolt_Timer = 3000; + Blink_Timer = 8000; + + boss_priestess_lackey_commonAI::Reset(); } - if (Blizzard_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_BLIZZARD); + if (!UpdateVictim()) + return; - Blizzard_Timer = 8000; - } else Blizzard_Timer -= diff; + boss_priestess_lackey_commonAI::UpdateAI(diff); - if (Ice_Lance_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ICE_LANCE); - Ice_Lance_Timer = 12000; - } else Ice_Lance_Timer -= diff; - - if (Cone_of_Cold_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CONE_OF_COLD); - Cone_of_Cold_Timer = 10000; - } else Cone_of_Cold_Timer -= diff; - - if (Frostbolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 8000; - } else Frostbolt_Timer -= diff; - - if (Blink_Timer <= diff) - { - bool InMeleeRange = false; - std::list& t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (Polymorph_Timer <= diff) { - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - //if in melee range - if (pTarget->IsWithinDistInMap(me, 5)) - { - InMeleeRange = true; - break; - } + DoCast(pTarget, SPELL_POLYMORPH); + Polymorph_Timer = 20000; } + } else Polymorph_Timer -= diff; + + if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked) + { + DoCast(me, SPELL_ICE_BLOCK); + HasIceBlocked = true; } - //if anybody is in melee range than escape by blink - if (InMeleeRange) - DoCast(me, SPELL_BLINK); + if (Blizzard_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_BLIZZARD); - Blink_Timer = 8000; - } else Blink_Timer -= diff; + Blizzard_Timer = 8000; + } else Blizzard_Timer -= diff; + + if (Ice_Lance_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ICE_LANCE); + Ice_Lance_Timer = 12000; + } else Ice_Lance_Timer -= diff; + + if (Cone_of_Cold_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONE_OF_COLD); + Cone_of_Cold_Timer = 10000; + } else Cone_of_Cold_Timer -= diff; + + if (Frostbolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 8000; + } else Frostbolt_Timer -= diff; + + if (Blink_Timer <= diff) + { + bool InMeleeRange = false; + std::list& t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + { + //if in melee range + if (pTarget->IsWithinDistInMap(me, 5)) + { + InMeleeRange = true; + break; + } + } + } + + //if anybody is in melee range than escape by blink + if (InMeleeRange) + DoCast(me, SPELL_BLINK); + + Blink_Timer = 8000; + } else Blink_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_yazzai(Creature* pCreature) -{ - return new boss_yazzaiAI(pCreature); -} - enum eWarriorSpells { SPELL_INTERCEPT_STUN = 27577, @@ -838,109 +870,115 @@ enum eWarriorSpells SPELL_BATTLE_SHOUT = 27578, SPELL_MORTAL_STRIKE = 44268 }; - -struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI + class boss_warlord_salaris : public CreatureScript { - //Warrior - boss_warlord_salarisAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_warlord_salaris() : CreatureScript("boss_warlord_salaris") { } - uint32 Intercept_Stun_Timer; - uint32 Disarm_Timer; - uint32 Piercing_Howl_Timer; - uint32 Frightening_Shout_Timer; - uint32 Hamstring_Timer; - uint32 Mortal_Strike_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Intercept_Stun_Timer = 500; - Disarm_Timer = 6000; - Piercing_Howl_Timer = 10000; - Frightening_Shout_Timer = 18000; - Hamstring_Timer = 4500; - Mortal_Strike_Timer = 8000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_warlord_salarisAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI { - DoCast(me, SPELL_BATTLE_SHOUT); - } + //Warrior + boss_warlord_salarisAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Intercept_Stun_Timer; + uint32 Disarm_Timer; + uint32 Piercing_Howl_Timer; + uint32 Frightening_Shout_Timer; + uint32 Hamstring_Timer; + uint32 Mortal_Strike_Timer; - boss_priestess_lackey_commonAI::UpdateAI(diff); - - if (Intercept_Stun_Timer <= diff) + void Reset() { - bool InMeleeRange = false; - std::list& t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + Intercept_Stun_Timer = 500; + Disarm_Timer = 6000; + Piercing_Howl_Timer = 10000; + Frightening_Shout_Timer = 18000; + Hamstring_Timer = 4500; + Mortal_Strike_Timer = 8000; + + boss_priestess_lackey_commonAI::Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + DoCast(me, SPELL_BATTLE_SHOUT); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Intercept_Stun_Timer <= diff) { - if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + bool InMeleeRange = false; + std::list& t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - //if in melee range - if (pTarget->IsWithinDistInMap(me, ATTACK_DISTANCE)) + if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - InMeleeRange = true; - break; + //if in melee range + if (pTarget->IsWithinDistInMap(me, ATTACK_DISTANCE)) + { + InMeleeRange = true; + break; + } } } - } - //if nobody is in melee range than try to use Intercept - if (!InMeleeRange) + //if nobody is in melee range than try to use Intercept + if (!InMeleeRange) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_INTERCEPT_STUN); + } + + Intercept_Stun_Timer = 10000; + } else Intercept_Stun_Timer -= diff; + + if (Disarm_Timer <= diff) { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_INTERCEPT_STUN); - } + DoCast(me->getVictim(), SPELL_DISARM); + Disarm_Timer = 6000; + } else Disarm_Timer -= diff; - Intercept_Stun_Timer = 10000; - } else Intercept_Stun_Timer -= diff; + if (Hamstring_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + Hamstring_Timer = 4500; + } else Hamstring_Timer -= diff; - if (Disarm_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DISARM); - Disarm_Timer = 6000; - } else Disarm_Timer -= diff; + if (Mortal_Strike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + Mortal_Strike_Timer = 4500; + } else Mortal_Strike_Timer -= diff; - if (Hamstring_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - Hamstring_Timer = 4500; - } else Hamstring_Timer -= diff; + if (Piercing_Howl_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PIERCING_HOWL); + Piercing_Howl_Timer = 10000; + } else Piercing_Howl_Timer -= diff; - if (Mortal_Strike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - Mortal_Strike_Timer = 4500; - } else Mortal_Strike_Timer -= diff; + if (Frightening_Shout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); + Frightening_Shout_Timer = 18000; + } else Frightening_Shout_Timer -= diff; - if (Piercing_Howl_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PIERCING_HOWL); - Piercing_Howl_Timer = 10000; - } else Piercing_Howl_Timer -= diff; + DoMeleeAttackIfReady(); + } + }; - if (Frightening_Shout_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); - Frightening_Shout_Timer = 18000; - } else Frightening_Shout_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_warlord_salaris(Creature* pCreature) -{ - return new boss_warlord_salarisAI(pCreature); -} - enum eHunterSpells { SPELL_AIMED_SHOT = 44271, @@ -952,109 +990,115 @@ enum eHunterSpells NPC_SLIVER = 24552 }; - -struct boss_garaxxasAI : public boss_priestess_lackey_commonAI + class boss_garaxxas : public CreatureScript { - //Hunter - boss_garaxxasAI(Creature *c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } +public: + boss_garaxxas() : CreatureScript("boss_garaxxas") { } - uint64 m_uiPetGUID; - - uint32 Aimed_Shot_Timer; - uint32 Shoot_Timer; - uint32 Concussive_Shot_Timer; - uint32 Multi_Shot_Timer; - uint32 Wing_Clip_Timer; - uint32 Freezing_Trap_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Aimed_Shot_Timer = 6000; - Shoot_Timer = 2500; - Concussive_Shot_Timer = 8000; - Multi_Shot_Timer = 10000; - Wing_Clip_Timer = 4000; - Freezing_Trap_Timer = 15000; - - Unit* pPet = Unit::GetUnit(*me,m_uiPetGUID); - if (!pPet) - me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - - boss_priestess_lackey_commonAI::Reset(); + return new boss_garaxxasAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct boss_garaxxasAI : public boss_priestess_lackey_commonAI { - m_uiPetGUID = pSummoned->GetGUID(); - } + //Hunter + boss_garaxxasAI(Creature *c) : boss_priestess_lackey_commonAI(c) { m_uiPetGUID = 0; } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint64 m_uiPetGUID; - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Aimed_Shot_Timer; + uint32 Shoot_Timer; + uint32 Concussive_Shot_Timer; + uint32 Multi_Shot_Timer; + uint32 Wing_Clip_Timer; + uint32 Freezing_Trap_Timer; - if (me->IsWithinDistInMap(me->getVictim(), ATTACK_DISTANCE)) + void Reset() { - if (Wing_Clip_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WING_CLIP); - Wing_Clip_Timer = 4000; - } else Wing_Clip_Timer -= diff; + Aimed_Shot_Timer = 6000; + Shoot_Timer = 2500; + Concussive_Shot_Timer = 8000; + Multi_Shot_Timer = 10000; + Wing_Clip_Timer = 4000; + Freezing_Trap_Timer = 15000; - if (Freezing_Trap_Timer <= diff) - { - //attempt find go summoned from spell (casted by me) - GameObject* pGo = me->GetGameObject(SPELL_FREEZING_TRAP); + Unit* pPet = Unit::GetUnit(*me,m_uiPetGUID); + if (!pPet) + me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - //if we have a pGo, we need to wait (only one trap at a time) - if (pGo) - Freezing_Trap_Timer = 2500; - else + boss_priestess_lackey_commonAI::Reset(); + } + + void JustSummoned(Creature* pSummoned) + { + m_uiPetGUID = pSummoned->GetGUID(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (me->IsWithinDistInMap(me->getVictim(), ATTACK_DISTANCE)) + { + if (Wing_Clip_Timer <= diff) { - //if pGo does not exist, then we can cast - DoCast(me->getVictim(), SPELL_FREEZING_TRAP); - Freezing_Trap_Timer = 15000; - } - } else Freezing_Trap_Timer -= diff; + DoCast(me->getVictim(), SPELL_WING_CLIP); + Wing_Clip_Timer = 4000; + } else Wing_Clip_Timer -= diff; - DoMeleeAttackIfReady(); + if (Freezing_Trap_Timer <= diff) + { + //attempt find go summoned from spell (casted by me) + GameObject* pGo = me->GetGameObject(SPELL_FREEZING_TRAP); + + //if we have a pGo, we need to wait (only one trap at a time) + if (pGo) + Freezing_Trap_Timer = 2500; + else + { + //if pGo does not exist, then we can cast + DoCast(me->getVictim(), SPELL_FREEZING_TRAP); + Freezing_Trap_Timer = 15000; + } + } else Freezing_Trap_Timer -= diff; + + DoMeleeAttackIfReady(); + } + else + { + if (Concussive_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CONCUSSIVE_SHOT); + Concussive_Shot_Timer = 8000; + } else Concussive_Shot_Timer -= diff; + + if (Multi_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MULTI_SHOT); + Multi_Shot_Timer = 10000; + } else Multi_Shot_Timer -= diff; + + if (Aimed_Shot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AIMED_SHOT); + Aimed_Shot_Timer = 6000; + } else Aimed_Shot_Timer -= diff; + + if (Shoot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOOT); + Shoot_Timer = 2500; + } else Shoot_Timer -= diff; + } } - else - { - if (Concussive_Shot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CONCUSSIVE_SHOT); - Concussive_Shot_Timer = 8000; - } else Concussive_Shot_Timer -= diff; + }; - if (Multi_Shot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MULTI_SHOT); - Multi_Shot_Timer = 10000; - } else Multi_Shot_Timer -= diff; - - if (Aimed_Shot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_AIMED_SHOT); - Aimed_Shot_Timer = 6000; - } else Aimed_Shot_Timer -= diff; - - if (Shoot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHOOT); - Shoot_Timer = 2500; - } else Shoot_Timer -= diff; - } - } }; -CreatureAI* GetAI_garaxxas(Creature* pCreature) -{ - return new boss_garaxxasAI(pCreature); -} - enum Spells { SPELL_WINDFURY_TOTEM = 27621, @@ -1065,89 +1109,95 @@ enum Spells SPELL_FIRE_NOVA_TOTEM = 44257, SPELL_EARTHBIND_TOTEM = 15786 }; - -struct boss_apokoAI : public boss_priestess_lackey_commonAI + class boss_apoko : public CreatureScript { - //Shaman - boss_apokoAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_apoko() : CreatureScript("boss_apoko") { } - uint32 Totem_Timer; - uint8 Totem_Amount; - uint32 War_Stomp_Timer; - uint32 Purge_Timer; - uint32 Healing_Wave_Timer; - uint32 Frost_Shock_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Totem_Timer = 2000; - Totem_Amount = 1; - War_Stomp_Timer = 10000; - Purge_Timer = 8000; - Healing_Wave_Timer = 5000; - Frost_Shock_Timer = 7000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_apokoAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_apokoAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Shaman + boss_apokoAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Totem_Timer; + uint8 Totem_Amount; + uint32 War_Stomp_Timer; + uint32 Purge_Timer; + uint32 Healing_Wave_Timer; + uint32 Frost_Shock_Timer; - if (Totem_Timer <= diff) + void Reset() { - DoCast(me, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM)); - ++Totem_Amount; - Totem_Timer = Totem_Amount*2000; - } else Totem_Timer -= diff; - - if (War_Stomp_Timer <= diff) - { - DoCast(me, SPELL_WAR_STOMP); + Totem_Timer = 2000; + Totem_Amount = 1; War_Stomp_Timer = 10000; - } else War_Stomp_Timer -= diff; - - if (Purge_Timer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_PURGE); - - Purge_Timer = 15000; - } else Purge_Timer -= diff; - - if (Frost_Shock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - Frost_Shock_Timer = 7000; - } else Frost_Shock_Timer -= diff; - - if (Healing_Wave_Timer <= diff) - { - // std::vector::const_iterator itr = Group.begin() + rand()%Group.size(); - // uint64 guid = (*itr)->guid; - // if (guid) - // { - // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid); - // if (pAdd && pAdd->isAlive()) - // { - DoCast(me, SPELL_LESSER_HEALING_WAVE); + Purge_Timer = 8000; Healing_Wave_Timer = 5000; - // } - // } - } else Healing_Wave_Timer -= diff; + Frost_Shock_Timer = 7000; + + boss_priestess_lackey_commonAI::Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Totem_Timer <= diff) + { + DoCast(me, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM)); + ++Totem_Amount; + Totem_Timer = Totem_Amount*2000; + } else Totem_Timer -= diff; + + if (War_Stomp_Timer <= diff) + { + DoCast(me, SPELL_WAR_STOMP); + War_Stomp_Timer = 10000; + } else War_Stomp_Timer -= diff; + + if (Purge_Timer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_PURGE); + + Purge_Timer = 15000; + } else Purge_Timer -= diff; + + if (Frost_Shock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + Frost_Shock_Timer = 7000; + } else Frost_Shock_Timer -= diff; + + if (Healing_Wave_Timer <= diff) + { + // std::vector::const_iterator itr = Group.begin() + rand()%Group.size(); + // uint64 guid = (*itr)->guid; + // if (guid) + // { + // Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid); + // if (pAdd && pAdd->isAlive()) + // { + DoCast(me, SPELL_LESSER_HEALING_WAVE); + Healing_Wave_Timer = 5000; + // } + // } + } else Healing_Wave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_apoko(Creature* pCreature) -{ - return new boss_apokoAI(pCreature); -} - enum eEngineerSpells { SPELL_GOBLIN_DRAGON_GUN = 44272, @@ -1157,167 +1207,112 @@ enum eEngineerSpells SPELL_FEL_IRON_BOMB = 46024, SPELL_SHEEP_EXPLOSION = 44279 }; - -struct boss_zelfanAI : public boss_priestess_lackey_commonAI + class boss_zelfan : public CreatureScript { - //Engineer - boss_zelfanAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} +public: + boss_zelfan() : CreatureScript("boss_zelfan") { } - uint32 Goblin_Dragon_Gun_Timer; - uint32 Rocket_Launch_Timer; - uint32 Recombobulate_Timer; - uint32 High_Explosive_Sheep_Timer; - uint32 Fel_Iron_Bomb_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Goblin_Dragon_Gun_Timer = 20000; - Rocket_Launch_Timer = 7000; - Recombobulate_Timer = 4000; - High_Explosive_Sheep_Timer = 10000; - Fel_Iron_Bomb_Timer = 15000; - - boss_priestess_lackey_commonAI::Reset(); + return new boss_zelfanAI(pCreature); } - void UpdateAI(const uint32 diff) + struct boss_zelfanAI : public boss_priestess_lackey_commonAI { - if (!UpdateVictim()) - return; + //Engineer + boss_zelfanAI(Creature *c) : boss_priestess_lackey_commonAI(c) {} - boss_priestess_lackey_commonAI::UpdateAI(diff); + uint32 Goblin_Dragon_Gun_Timer; + uint32 Rocket_Launch_Timer; + uint32 Recombobulate_Timer; + uint32 High_Explosive_Sheep_Timer; + uint32 Fel_Iron_Bomb_Timer; - if (Goblin_Dragon_Gun_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_GOBLIN_DRAGON_GUN); - Goblin_Dragon_Gun_Timer = 10000; - } else Goblin_Dragon_Gun_Timer -= diff; - - if (Rocket_Launch_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ROCKET_LAUNCH); - Rocket_Launch_Timer = 9000; - } else Rocket_Launch_Timer -= diff; - - if (Fel_Iron_Bomb_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FEL_IRON_BOMB); + Goblin_Dragon_Gun_Timer = 20000; + Rocket_Launch_Timer = 7000; + Recombobulate_Timer = 4000; + High_Explosive_Sheep_Timer = 10000; Fel_Iron_Bomb_Timer = 15000; - } else Fel_Iron_Bomb_Timer -= diff; - if (Recombobulate_Timer <= diff) + boss_priestess_lackey_commonAI::Reset(); + } + + void UpdateAI(const uint32 diff) { - for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) + if (!UpdateVictim()) + return; + + boss_priestess_lackey_commonAI::UpdateAI(diff); + + if (Goblin_Dragon_Gun_Timer <= diff) { - if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) + DoCast(me->getVictim(), SPELL_GOBLIN_DRAGON_GUN); + Goblin_Dragon_Gun_Timer = 10000; + } else Goblin_Dragon_Gun_Timer -= diff; + + if (Rocket_Launch_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ROCKET_LAUNCH); + Rocket_Launch_Timer = 9000; + } else Rocket_Launch_Timer -= diff; + + if (Fel_Iron_Bomb_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEL_IRON_BOMB); + Fel_Iron_Bomb_Timer = 15000; + } else Fel_Iron_Bomb_Timer -= diff; + + if (Recombobulate_Timer <= diff) + { + for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) { - if (pAdd->IsPolymorphed()) + if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i])) { - DoCast(pAdd, SPELL_RECOMBOBULATE); - break; + if (pAdd->IsPolymorphed()) + { + DoCast(pAdd, SPELL_RECOMBOBULATE); + break; + } } } - } - Recombobulate_Timer = 2000; - } else Recombobulate_Timer -= diff; + Recombobulate_Timer = 2000; + } else Recombobulate_Timer -= diff; - if (High_Explosive_Sheep_Timer <= diff) - { - DoCast(me, SPELL_HIGH_EXPLOSIVE_SHEEP); - High_Explosive_Sheep_Timer = 65000; - } else High_Explosive_Sheep_Timer -= diff; + if (High_Explosive_Sheep_Timer <= diff) + { + DoCast(me, SPELL_HIGH_EXPLOSIVE_SHEEP); + High_Explosive_Sheep_Timer = 65000; + } else High_Explosive_Sheep_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; - -CreatureAI* GetAI_zelfan(Creature* pCreature) + /* class mob_high_explosive_sheep : public CreatureScript { - return new boss_zelfanAI(pCreature); -} +public: + mob_high_explosive_sheep() : CreatureScript("mob_high_explosive_sheep") { } -//struct mob_high_explosive_sheepAI : public ScriptedAI -//{ -// mob_high_explosive_sheepAI(Creature *c) : ScriptedAI(c) {} -// -// uint32 Explosion_Timer; -// -// void Reset() -// { -// Explosion_Timer = 60000; -// } -// -// void JustDied(Unit *Killer){} -// -// void EnterCombat(Unit * /*who*/){} -// -// void UpdateAI(const uint32 diff) -// { -// if (Explosion_Timer <= diff) -// { -// DoCast(me->getVictim(), SPELL_SHEEP_EXPLOSION); -// }else -// Explosion_Timer -= diff; -// } -//}; - -//CreatureAI* GetAI_mob_high_explosive_sheep(Creature* pCreature) -//{ -// return new mob_high_explosive_sheepAI (pCreature); -//}; + //CreatureAI* GetAI(Creature* pCreature) const + //{ + // return new mob_high_explosive_sheepAI (pCreature); + //}; +}; +*/ void AddSC_boss_priestess_delrissa() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_priestess_delrissa"; - newscript->GetAI = &GetAI_boss_priestess_delrissa; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_kagani_nightstrike"; - newscript->GetAI = &GetAI_boss_kagani_nightstrike; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_ellris_duskhallow"; - newscript->GetAI = &GetAI_ellris_duskhallow; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_eramas_brightblaze"; - newscript->GetAI = &GetAI_eramas_brightblaze; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_yazzai"; - newscript->GetAI = &GetAI_yazzai; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_warlord_salaris"; - newscript->GetAI = &GetAI_warlord_salaris; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_garaxxas"; - newscript->GetAI = &GetAI_garaxxas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_apoko"; - newscript->GetAI = &GetAI_apoko; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_zelfan"; - newscript->GetAI = &GetAI_zelfan; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "mob_high_explosive_sheep"; - newscript->GetAI = &GetAI_mob_high_explosive_sheep; - newscript->RegisterSelf();*/ + new boss_priestess_delrissa(); + new boss_kagani_nightstrike(); + new boss_ellris_duskhallow(); + new boss_eramas_brightblaze(); + new boss_yazzai(); + new boss_warlord_salaris(); + new boss_garaxxas(); + new boss_apoko(); + new boss_zelfan(); + // new mob_high_explosive_sheep(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 65acb074cea..f2ea2d25fbd 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -50,319 +50,323 @@ EndScriptData */ #define DATA_CRYSTALS 6 #define CREATURE_FEL_CRYSTAL 24722 - -struct boss_selin_fireheartAI : public ScriptedAI + class boss_selin_fireheart : public CreatureScript { - boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); +public: + boss_selin_fireheart() : CreatureScript("boss_selin_fireheart") { } - Crystals.clear(); - //GUIDs per instance is static, so we only need to load them once. - if (pInstance) + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_selin_fireheartAI (pCreature); + }; + + struct boss_selin_fireheartAI : public ScriptedAI + { + boss_selin_fireheartAI(Creature* c) : ScriptedAI(c) { - uint32 size = pInstance->GetData(DATA_FEL_CRYSTAL_SIZE); - for (uint8 i = 0; i < size; ++i) + pInstance = c->GetInstanceScript(); + + Crystals.clear(); + //GUIDs per instance is static, so we only need to load them once. + if (pInstance) { - uint64 guid = pInstance->GetData64(DATA_FEL_CRYSTAL); - sLog.outDebug("TSCR: Selin: Adding Fel Crystal %u to list", guid); - Crystals.push_back(guid); + uint32 size = pInstance->GetData(DATA_FEL_CRYSTAL_SIZE); + for (uint8 i = 0; i < size; ++i) + { + uint64 guid = pInstance->GetData64(DATA_FEL_CRYSTAL); + sLog.outDebug("TSCR: Selin: Adding Fel Crystal %u to list", guid); + Crystals.push_back(guid); + } } } - } - ScriptedInstance* pInstance; + InstanceScript* pInstance; - std::list Crystals; + std::list Crystals; - uint32 DrainLifeTimer; - uint32 DrainManaTimer; - uint32 FelExplosionTimer; - uint32 DrainCrystalTimer; - uint32 EmpowerTimer; + uint32 DrainLifeTimer; + uint32 DrainManaTimer; + uint32 FelExplosionTimer; + uint32 DrainCrystalTimer; + uint32 EmpowerTimer; - bool IsDraining; - bool DrainingCrystal; + bool IsDraining; + bool DrainingCrystal; - uint64 CrystalGUID; // This will help us create a pointer to the crystal we are draining. We store GUIDs, never units in case unit is deleted/offline (offline if player of course). + uint64 CrystalGUID; // This will help us create a pointer to the crystal we are draining. We store GUIDs, never units in case unit is deleted/offline (offline if player of course). - void Reset() - { - if (pInstance) + void Reset() { - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + if (pInstance) + { + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + { + //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); + Unit* pUnit = Unit::GetUnit(*me, *itr); + if (pUnit) + { + if (!pUnit->isAlive()) + CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc. + + // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. + pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + } + + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); + // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) + // Small door opened after event are expected to be closed by default + // Set Inst data for encounter + pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); + } else sLog.outError(ERROR_INST_DATA); + + DrainLifeTimer = 3000 + rand()%4000; + DrainManaTimer = DrainLifeTimer + 5000; + FelExplosionTimer = 2100; + DrainCrystalTimer = 10000 + rand()%5000; + DrainCrystalTimer = 20000 + rand()%5000; + EmpowerTimer = 10000; + + IsDraining = false; + DrainingCrystal = false; + CrystalGUID = 0; + } + + void SelectNearestCrystal() + { + if (Crystals.empty()) + return; + + //float ShortestDistance = 0; + CrystalGUID = 0; + Unit* pCrystal = NULL; + Unit* CrystalChosen = NULL; + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); - Unit* pUnit = Unit::GetUnit(*me, *itr); - if (pUnit) + pCrystal = NULL; + //pCrystal = Unit::GetUnit(*me, FelCrystals[i]); + pCrystal = Unit::GetUnit(*me, *itr); + if (pCrystal && pCrystal->isAlive()) { - if (!pUnit->isAlive()) - CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc. - - // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. - pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } - - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); - // Open the big encounter door. Close it in Aggro and open it only in JustDied(and here) - // Small door opened after event are expected to be closed by default - // Set Inst data for encounter - pInstance->SetData(DATA_SELIN_EVENT, NOT_STARTED); - } else sLog.outError(ERROR_INST_DATA); - - DrainLifeTimer = 3000 + rand()%4000; - DrainManaTimer = DrainLifeTimer + 5000; - FelExplosionTimer = 2100; - DrainCrystalTimer = 10000 + rand()%5000; - DrainCrystalTimer = 20000 + rand()%5000; - EmpowerTimer = 10000; - - IsDraining = false; - DrainingCrystal = false; - CrystalGUID = 0; - } - - void SelectNearestCrystal() - { - if (Crystals.empty()) - return; - - //float ShortestDistance = 0; - CrystalGUID = 0; - Unit* pCrystal = NULL; - Unit* CrystalChosen = NULL; - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for (std::list::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) - { - pCrystal = NULL; - //pCrystal = Unit::GetUnit(*me, FelCrystals[i]); - pCrystal = Unit::GetUnit(*me, *itr); - if (pCrystal && pCrystal->isAlive()) - { - // select nearest - if (!CrystalChosen || me->GetDistanceOrder(pCrystal, CrystalChosen, false)) - { - CrystalGUID = pCrystal->GetGUID(); - CrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell. - } - } - } - if (CrystalChosen) - { - DoScriptText(SAY_ENERGY, me); - DoScriptText(EMOTE_CRYSTAL, me); - - CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); - - float x, y, z; // coords that we move to, close to the crystal. - CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); - - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(1, x, y, z); - DrainingCrystal = true; - } - } - - void ShatterRemainingCrystals() - { - if (Crystals.empty()) - return; - - //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) - for (std::list::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) - { - //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i])); - Creature* pCrystal = Unit::GetCreature(*me, *itr); - if (pCrystal && pCrystal->isAlive()) - pCrystal->Kill(pCrystal); - } - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); - //Close the encounter door, open it in JustDied/Reset - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } - - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE && id == 1) - { - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); - if (CrystalChosen && CrystalChosen->isAlive()) - { - // Make the crystal attackable - // We also remove NON_ATTACKABLE in case the database has it set. - CrystalChosen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - CrystalChosen->CastSpell(me, SPELL_MANA_RAGE, true); - IsDraining = true; - } - else - { - // Make an error message in case something weird happened here - sLog.outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); - DrainingCrystal = false; - } - } - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (!pInstance) - return; - - pInstance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door - pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in - ShatterRemainingCrystals(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!DrainingCrystal) - { - uint32 maxPowerMana = me->GetMaxPower(POWER_MANA); - if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) - { - if (DrainLifeTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); - DrainLifeTimer = 10000; - } else DrainLifeTimer -= diff; - - // Heroic only - if (IsHeroic()) - { - if (DrainManaTimer <= diff) + // select nearest + if (!CrystalChosen || me->GetDistanceOrder(pCrystal, CrystalChosen, false)) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); - DrainManaTimer = 10000; - } else DrainManaTimer -= diff; - } - } - - if (FelExplosionTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me, SPELL_FEL_EXPLOSION); - FelExplosionTimer = 2000; - } - } else FelExplosionTimer -= diff; - - // If below 10% mana, start recharging - maxPowerMana = me->GetMaxPower(POWER_MANA); - if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) - { - if (DrainCrystalTimer <= diff) - { - SelectNearestCrystal(); - if (IsHeroic()) - DrainCrystalTimer = 10000 + rand()%5000; - else - DrainCrystalTimer = 20000 + rand()%5000; - } else DrainCrystalTimer -= diff; - } - - }else - { - if (IsDraining) - { - if (EmpowerTimer <= diff) - { - IsDraining = false; - DrainingCrystal = false; - - DoScriptText(SAY_EMPOWERED, me); - - Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); - if (CrystalChosen && CrystalChosen->isAlive()) - // Use Deal Damage to kill it, not setDeathState. - CrystalChosen->Kill(CrystalChosen); - - CrystalGUID = 0; - - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - } else EmpowerTimer -= diff; - } - } - - DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. - } -}; - -CreatureAI* GetAI_boss_selin_fireheart(Creature* pCreature) -{ - return new boss_selin_fireheartAI (pCreature); -}; - -struct mob_fel_crystalAI : public ScriptedAI -{ - mob_fel_crystalAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} - - void JustDied(Unit* /*killer*/) - { - if (ScriptedInstance* pInstance = me->GetInstanceData()) - { - Creature* Selin = (Unit::GetCreature(*me, pInstance->GetData64(DATA_SELIN))); - if (Selin && Selin->isAlive()) - { - if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID()) - { - // Set this to false if we are the Creature that Selin is draining so his AI flows properly - CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false; - CAST_AI(boss_selin_fireheartAI, Selin->AI())->IsDraining = false; - CAST_AI(boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000; - if (Selin->getVictim()) - { - Selin->AI()->AttackStart(Selin->getVictim()); - Selin->GetMotionMaster()->MoveChase(Selin->getVictim()); + CrystalGUID = pCrystal->GetGUID(); + CrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell. } } } - } else sLog.outError(ERROR_INST_DATA); - } + if (CrystalChosen) + { + DoScriptText(SAY_ENERGY, me); + DoScriptText(EMOTE_CRYSTAL, me); + + CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true); + + float x, y, z; // coords that we move to, close to the crystal. + CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE); + + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(1, x, y, z); + DrainingCrystal = true; + } + } + + void ShatterRemainingCrystals() + { + if (Crystals.empty()) + return; + + //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) + for (std::list::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) + { + //Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i])); + Creature* pCrystal = Unit::GetCreature(*me, *itr); + if (pCrystal && pCrystal->isAlive()) + pCrystal->Kill(pCrystal); + } + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false); + //Close the encounter door, open it in JustDied/Reset + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE && id == 1) + { + Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + if (CrystalChosen && CrystalChosen->isAlive()) + { + // Make the crystal attackable + // We also remove NON_ATTACKABLE in case the database has it set. + CrystalChosen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + CrystalChosen->CastSpell(me, SPELL_MANA_RAGE, true); + IsDraining = true; + } + else + { + // Make an error message in case something weird happened here + sLog.outError("TSCR: Selin Fireheart unable to drain crystal as the crystal is either dead or despawned"); + DrainingCrystal = false; + } + } + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (!pInstance) + return; + + pInstance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete! + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), true); // Open the encounter door + pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_DOOR), true); // Open the door leading further in + ShatterRemainingCrystals(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!DrainingCrystal) + { + uint32 maxPowerMana = me->GetMaxPower(POWER_MANA); + if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) + { + if (DrainLifeTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DRAIN_LIFE); + DrainLifeTimer = 10000; + } else DrainLifeTimer -= diff; + + // Heroic only + if (IsHeroic()) + { + if (DrainManaTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_DRAIN_MANA); + DrainManaTimer = 10000; + } else DrainManaTimer -= diff; + } + } + + if (FelExplosionTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_FEL_EXPLOSION); + FelExplosionTimer = 2000; + } + } else FelExplosionTimer -= diff; + + // If below 10% mana, start recharging + maxPowerMana = me->GetMaxPower(POWER_MANA); + if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10)) + { + if (DrainCrystalTimer <= diff) + { + SelectNearestCrystal(); + if (IsHeroic()) + DrainCrystalTimer = 10000 + rand()%5000; + else + DrainCrystalTimer = 20000 + rand()%5000; + } else DrainCrystalTimer -= diff; + } + + }else + { + if (IsDraining) + { + if (EmpowerTimer <= diff) + { + IsDraining = false; + DrainingCrystal = false; + + DoScriptText(SAY_EMPOWERED, me); + + Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID); + if (CrystalChosen && CrystalChosen->isAlive()) + // Use Deal Damage to kill it, not setDeathState. + CrystalChosen->Kill(CrystalChosen); + + CrystalGUID = 0; + + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } else EmpowerTimer -= diff; + } + } + + DoMeleeAttackIfReady(); // No need to check if we are draining crystal here, as the spell has a stun. + } + }; + }; -CreatureAI* GetAI_mob_fel_crystal(Creature* pCreature) + class mob_fel_crystal : public CreatureScript { - return new mob_fel_crystalAI (pCreature); +public: + mob_fel_crystal() : CreatureScript("mob_fel_crystal") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fel_crystalAI (pCreature); + }; + + struct mob_fel_crystalAI : public ScriptedAI + { + mob_fel_crystalAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + + void JustDied(Unit* /*killer*/) + { + if (InstanceScript* pInstance = me->GetInstanceScript()) + { + Creature* Selin = (Unit::GetCreature(*me, pInstance->GetData64(DATA_SELIN))); + if (Selin && Selin->isAlive()) + { + if (CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID()) + { + // Set this to false if we are the Creature that Selin is draining so his AI flows properly + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false; + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->IsDraining = false; + CAST_AI(boss_selin_fireheart::boss_selin_fireheartAI, Selin->AI())->EmpowerTimer = 10000; + if (Selin->getVictim()) + { + Selin->AI()->AttackStart(Selin->getVictim()); + Selin->GetMotionMaster()->MoveChase(Selin->getVictim()); + } + } + } + } else sLog.outError(ERROR_INST_DATA); + } + }; + }; + void AddSC_boss_selin_fireheart() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_selin_fireheart"; - newscript->GetAI = &GetAI_boss_selin_fireheart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fel_crystal"; - newscript->GetAI = &GetAI_mob_fel_crystal; - newscript->RegisterSelf(); + new boss_selin_fireheart(); + new mob_fel_crystal(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index c89c7683749..ad70057f5bd 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -58,171 +58,176 @@ enum eEnums INTERVAL_MODIFIER = 15, INTERVAL_SWITCH = 6 }; - -struct boss_vexallusAI : public ScriptedAI + class boss_vexallus : public CreatureScript { - boss_vexallusAI(Creature *c) : ScriptedAI(c) +public: + boss_vexallus() : CreatureScript("boss_vexallus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - } + return new boss_vexallusAI (pCreature); + }; - ScriptedInstance* pInstance; - - uint32 ChainLightningTimer; - uint32 ArcaneShockTimer; - uint32 OverloadTimer; - uint32 IntervalHealthAmount; - bool Enraged; - - void Reset() + struct boss_vexallusAI : public ScriptedAI { - ChainLightningTimer = 8000; - ArcaneShockTimer = 5000; - OverloadTimer = 1200; - IntervalHealthAmount = 1; - Enraged = false; - - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); - } - - void JustSummoned(Creature *summoned) - { - if (Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 0)) - summoned->GetMotionMaster()->MoveFollow(temp,0,0); - - //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok - summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,me->GetGUID()); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!Enraged) + boss_vexallusAI(Creature *c) : ScriptedAI(c) { - //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount))) + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 ChainLightningTimer; + uint32 ArcaneShockTimer; + uint32 OverloadTimer; + uint32 IntervalHealthAmount; + bool Enraged; + + void Reset() + { + ChainLightningTimer = 8000; + ArcaneShockTimer = 5000; + OverloadTimer = 1200; + IntervalHealthAmount = 1; + Enraged = false; + + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS); + } + + void JustSummoned(Creature *summoned) + { + if (Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 0)) + summoned->GetMotionMaster()->MoveFollow(temp,0,0); + + //spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok + summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,me->GetGUID()); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!Enraged) { - //increase amount, unless we're at 10%, then we switch and return - if (IntervalHealthAmount == INTERVAL_SWITCH) + //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount))) { - Enraged = true; - return; - } - else - ++IntervalHealthAmount; + //increase amount, unless we're at 10%, then we switch and return + if (IntervalHealthAmount == INTERVAL_SWITCH) + { + Enraged = true; + return; + } + else + ++IntervalHealthAmount; - DoScriptText(SAY_ENERGY, me); - DoScriptText(EMOTE_DISCHARGE_ENERGY, me); + DoScriptText(SAY_ENERGY, me); + DoScriptText(EMOTE_DISCHARGE_ENERGY, me); - if (IsHeroic()) - { - DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false); - DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false); - } - else - DoCast(me, SPELL_SUMMON_PURE_ENERGY, false); + if (IsHeroic()) + { + DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false); + DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false); + } + else + DoCast(me, SPELL_SUMMON_PURE_ENERGY, false); - //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core - me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); - - if (IsHeroic()) + //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); + + if (IsHeroic()) + me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); + } + + if (ChainLightningTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + + ChainLightningTimer = 8000; + } else ChainLightningTimer -= diff; + + if (ArcaneShockTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (pTarget) + DoCast(pTarget, SPELL_ARCANE_SHOCK); + + ArcaneShockTimer = 8000; + } else ArcaneShockTimer -= diff; + } + else + { + if (OverloadTimer <= diff) + { + DoCast(me->getVictim(), SPELL_OVERLOAD); + + OverloadTimer = 2000; + } else OverloadTimer -= diff; } - if (ChainLightningTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - - ChainLightningTimer = 8000; - } else ChainLightningTimer -= diff; - - if (ArcaneShockTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - if (pTarget) - DoCast(pTarget, SPELL_ARCANE_SHOCK); - - ArcaneShockTimer = 8000; - } else ArcaneShockTimer -= diff; + DoMeleeAttackIfReady(); } - else - { - if (OverloadTimer <= diff) - { - DoCast(me->getVictim(), SPELL_OVERLOAD); + }; - OverloadTimer = 2000; - } else OverloadTimer -= diff; - } - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_vexallus(Creature* pCreature) + class mob_pure_energy : public CreatureScript { - return new boss_vexallusAI (pCreature); -}; +public: + mob_pure_energy() : CreatureScript("mob_pure_energy") { } -struct mob_pure_energyAI : public ScriptedAI -{ - mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} - - void Reset() {} - - void JustDied(Unit* slayer) + CreatureAI* GetAI(Creature* pCreature) const { - if (Unit *temp = me->GetOwner()) + return new mob_pure_energyAI (pCreature); + }; + + struct mob_pure_energyAI : public ScriptedAI + { + mob_pure_energyAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void JustDied(Unit* slayer) { - if (temp && temp->isAlive()) - slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID()); + if (Unit *temp = me->GetOwner()) + { + if (temp && temp->isAlive()) + slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID()); + } } - } - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - void AttackStart(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + void AttackStart(Unit * /*who*/) {} + }; + }; -CreatureAI* GetAI_mob_pure_energy(Creature* pCreature) -{ - return new mob_pure_energyAI (pCreature); -}; void AddSC_boss_vexallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_vexallus"; - newscript->GetAI = &GetAI_boss_vexallus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pure_energy"; - newscript->GetAI = &GetAI_mob_pure_energy; - newscript->RegisterSelf(); + new boss_vexallus(); + new mob_pure_energy(); } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index ab1bf3b04d1..985466f4d8c 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -34,174 +34,175 @@ EndScriptData */ 2 - Priestess Delrissa 3 - Kael'thas Sunstrider */ - -struct instance_magisters_terrace : public ScriptedInstance + class instance_magisters_terrace : public InstanceMapScript { - instance_magisters_terrace(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_magisters_terrace() : InstanceMapScript("instance_magisters_terrace") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 DelrissaDeathCount; - - std::list FelCrystals; - std::list::const_iterator CrystalItr; - - uint64 SelinGUID; - uint64 DelrissaGUID; - uint64 VexallusDoorGUID; - uint64 SelinDoorGUID; - uint64 SelinEncounterDoorGUID; - uint64 DelrissaDoorGUID; - uint64 KaelDoorGUID; - uint64 KaelStatue[2]; - - bool InitializedItr; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - FelCrystals.clear(); - - DelrissaDeathCount = 0; - - SelinGUID = 0; - DelrissaGUID = 0; - VexallusDoorGUID = 0; - SelinDoorGUID = 0; - SelinEncounterDoorGUID = 0; - DelrissaDoorGUID = 0; - KaelDoorGUID = 0; - KaelStatue[0] = 0; - KaelStatue[1] = 0; - - InitializedItr = false; + return new instance_magisters_terrace_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_magisters_terrace_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - return false; - } + instance_magisters_terrace_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} - uint32 GetData(uint32 identifier) - { - switch(identifier) + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 DelrissaDeathCount; + + std::list FelCrystals; + std::list::const_iterator CrystalItr; + + uint64 SelinGUID; + uint64 DelrissaGUID; + uint64 VexallusDoorGUID; + uint64 SelinDoorGUID; + uint64 SelinEncounterDoorGUID; + uint64 DelrissaDoorGUID; + uint64 KaelDoorGUID; + uint64 KaelStatue[2]; + + bool InitializedItr; + + void Initialize() { - case DATA_SELIN_EVENT: return m_auiEncounter[0]; - case DATA_VEXALLUS_EVENT: return m_auiEncounter[1]; - case DATA_DELRISSA_EVENT: return m_auiEncounter[2]; - case DATA_KAELTHAS_EVENT: return m_auiEncounter[3]; - case DATA_DELRISSA_DEATH_COUNT: return DelrissaDeathCount; - case DATA_FEL_CRYSTAL_SIZE: return FelCrystals.size(); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + FelCrystals.clear(); + + DelrissaDeathCount = 0; + + SelinGUID = 0; + DelrissaGUID = 0; + VexallusDoorGUID = 0; + SelinDoorGUID = 0; + SelinEncounterDoorGUID = 0; + DelrissaDoorGUID = 0; + KaelDoorGUID = 0; + KaelStatue[0] = 0; + KaelStatue[1] = 0; + + InitializedItr = false; } - return 0; - } - void SetData(uint32 identifier, uint32 data) - { - switch(identifier) + bool IsEncounterInProgress() const { - case DATA_SELIN_EVENT: m_auiEncounter[0] = data; break; - case DATA_VEXALLUS_EVENT: - if (data == DONE) - DoUseDoorOrButton(VexallusDoorGUID); - m_auiEncounter[1] = data; - break; - case DATA_DELRISSA_EVENT: - if (data == DONE) - DoUseDoorOrButton(DelrissaDoorGUID); - if (data == IN_PROGRESS) - DelrissaDeathCount = 0; - m_auiEncounter[2] = data; - break; - case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; - - case DATA_DELRISSA_DEATH_COUNT: - if (data == SPECIAL) - ++DelrissaDeathCount; - else - DelrissaDeathCount = 0; - break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + return false; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + uint32 GetData(uint32 identifier) { - case 24723: SelinGUID = pCreature->GetGUID(); break; - case 24560: DelrissaGUID = pCreature->GetGUID(); break; - case 24722: FelCrystals.push_back(pCreature->GetGUID()); break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case 187896: VexallusDoorGUID = pGo->GetGUID(); break; - //SunwellRaid Gate 02 - case 187979: SelinDoorGUID = pGo->GetGUID(); break; - //Assembly Chamber Door - case 188065: SelinEncounterDoorGUID = pGo->GetGUID(); break; - case 187770: DelrissaDoorGUID = pGo->GetGUID(); break; - case 188064: KaelDoorGUID = pGo->GetGUID(); break; - case 188165: KaelStatue[0] = pGo->GetGUID(); break; - case 188166: KaelStatue[1] = pGo->GetGUID(); break; - } - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_SELIN: return SelinGUID; - case DATA_DELRISSA: return DelrissaGUID; - case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; - case DATA_SELIN_DOOR: return SelinDoorGUID; - case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; - case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; - case DATA_KAEL_DOOR: return KaelDoorGUID; - case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; - case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; - - case DATA_FEL_CRYSTAL: + switch(identifier) { - if (FelCrystals.empty()) - { - sLog.outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); - return 0; - } + case DATA_SELIN_EVENT: return m_auiEncounter[0]; + case DATA_VEXALLUS_EVENT: return m_auiEncounter[1]; + case DATA_DELRISSA_EVENT: return m_auiEncounter[2]; + case DATA_KAELTHAS_EVENT: return m_auiEncounter[3]; + case DATA_DELRISSA_DEATH_COUNT: return DelrissaDeathCount; + case DATA_FEL_CRYSTAL_SIZE: return FelCrystals.size(); + } + return 0; + } - if (!InitializedItr) - { - CrystalItr = FelCrystals.begin(); - InitializedItr = true; - } + void SetData(uint32 identifier, uint32 data) + { + switch(identifier) + { + case DATA_SELIN_EVENT: m_auiEncounter[0] = data; break; + case DATA_VEXALLUS_EVENT: + if (data == DONE) + DoUseDoorOrButton(VexallusDoorGUID); + m_auiEncounter[1] = data; + break; + case DATA_DELRISSA_EVENT: + if (data == DONE) + DoUseDoorOrButton(DelrissaDoorGUID); + if (data == IN_PROGRESS) + DelrissaDeathCount = 0; + m_auiEncounter[2] = data; + break; + case DATA_KAELTHAS_EVENT: m_auiEncounter[3] = data; break; - uint64 guid = *CrystalItr; - ++CrystalItr; - return guid; + case DATA_DELRISSA_DEATH_COUNT: + if (data == SPECIAL) + ++DelrissaDeathCount; + else + DelrissaDeathCount = 0; + break; } } - return 0; - } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 24723: SelinGUID = pCreature->GetGUID(); break; + case 24560: DelrissaGUID = pCreature->GetGUID(); break; + case 24722: FelCrystals.push_back(pCreature->GetGUID()); break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 187896: VexallusDoorGUID = pGo->GetGUID(); break; + //SunwellRaid Gate 02 + case 187979: SelinDoorGUID = pGo->GetGUID(); break; + //Assembly Chamber Door + case 188065: SelinEncounterDoorGUID = pGo->GetGUID(); break; + case 187770: DelrissaDoorGUID = pGo->GetGUID(); break; + case 188064: KaelDoorGUID = pGo->GetGUID(); break; + case 188165: KaelStatue[0] = pGo->GetGUID(); break; + case 188166: KaelStatue[1] = pGo->GetGUID(); break; + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_SELIN: return SelinGUID; + case DATA_DELRISSA: return DelrissaGUID; + case DATA_VEXALLUS_DOOR: return VexallusDoorGUID; + case DATA_SELIN_DOOR: return SelinDoorGUID; + case DATA_SELIN_ENCOUNTER_DOOR: return SelinEncounterDoorGUID; + case DATA_DELRISSA_DOOR: return DelrissaDoorGUID; + case DATA_KAEL_DOOR: return KaelDoorGUID; + case DATA_KAEL_STATUE_LEFT: return KaelStatue[0]; + case DATA_KAEL_STATUE_RIGHT: return KaelStatue[1]; + + case DATA_FEL_CRYSTAL: + { + if (FelCrystals.empty()) + { + sLog.outError("TSCR: Magisters Terrace: No Fel Crystals loaded in Inst Data"); + return 0; + } + + if (!InitializedItr) + { + CrystalItr = FelCrystals.begin(); + InitializedItr = true; + } + + uint64 guid = *CrystalItr; + ++CrystalItr; + return guid; + } + } + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_magisters_terrace(Map* pMap) -{ - return new instance_magisters_terrace(pMap); -} void AddSC_instance_magisters_terrace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_magisters_terrace"; - newscript->GetInstanceData = &GetInstanceData_instance_magisters_terrace; - newscript->RegisterSelf(); + new instance_magisters_terrace(); } - diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index f6f1631fa6a..71c6cb44117 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -50,127 +50,129 @@ const float afKaelLandPoint[] = {225.045, -276.236, -5.434}; #define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?" // This is friendly keal that appear after used Orb. -// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is -struct npc_kalecgosAI : public ScriptedAI +// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is class npc_kalecgos : public CreatureScript { - npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_kalecgos() : CreatureScript("npc_kalecgos") { } - uint32 m_uiTransformTimer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_uiTransformTimer = 0; - - // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here - if (me->GetEntry() != NPC_KAEL) - me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]); - } - - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE) - return; - - if (uiPointId == POINT_ID_LAND) - m_uiTransformTimer = MINUTE*IN_MILLISECONDS; - } - - // some targeting issues with the spell, so use this workaround as temporary solution - void DoWorkaroundForQuestCredit() - { - Map* pMap = me->GetMap(); - - if (!pMap || pMap->IsHeroic()) - return; - - Map::PlayerList const &lList = pMap->GetPlayers(); - - if (lList.isEmpty()) - return; - - SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT); - - for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) + switch(uiAction) { - if (Player* pPlayer = i->getSource()) + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(12500, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(12502, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(12606, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(12607, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID()); + break; + } + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_kalecgosAI(pCreature); + } + + struct npc_kalecgosAI : public ScriptedAI + { + npc_kalecgosAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + uint32 m_uiTransformTimer; + + void Reset() + { + m_uiTransformTimer = 0; + + // we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here + if (me->GetEntry() != NPC_KAEL) + me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]); + } + + void MovementInform(uint32 uiType, uint32 uiPointId) + { + if (uiType != POINT_MOTION_TYPE) + return; + + if (uiPointId == POINT_ID_LAND) + m_uiTransformTimer = MINUTE*IN_MILLISECONDS; + } + + // some targeting issues with the spell, so use this workaround as temporary solution + void DoWorkaroundForQuestCredit() + { + Map* pMap = me->GetMap(); + + if (!pMap || pMap->IsHeroic()) + return; + + Map::PlayerList const &lList = pMap->GetPlayers(); + + if (lList.isEmpty()) + return; + + SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT); + + for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i) { - if (pSpell && pSpell->EffectMiscValue[0]) - pPlayer->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0); + if (Player* pPlayer = i->getSource()) + { + if (pSpell && pSpell->EffectMiscValue[0]) + pPlayer->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0); + } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (m_uiTransformTimer) + void UpdateAI(const uint32 uiDiff) { - if (m_uiTransformTimer <= uiDiff) + if (m_uiTransformTimer) { - DoCast(me, SPELL_ORB_KILL_CREDIT, false); - DoWorkaroundForQuestCredit(); + if (m_uiTransformTimer <= uiDiff) + { + DoCast(me, SPELL_ORB_KILL_CREDIT, false); + DoWorkaroundForQuestCredit(); - // Transform and update entry, now ready for quest/read gossip - DoCast(me, SPELL_TRANSFORM_TO_KAEL, false); - me->UpdateEntry(NPC_KAEL); + // Transform and update entry, now ready for quest/read gossip + DoCast(me, SPELL_TRANSFORM_TO_KAEL, false); + me->UpdateEntry(NPC_KAEL); - m_uiTransformTimer = 0; - } else m_uiTransformTimer -= uiDiff; + m_uiTransformTimer = 0; + } else m_uiTransformTimer -= uiDiff; + } } - } + }; + }; -CreatureAI* GetAI_npc_kalecgos(Creature* pCreature) -{ - return new npc_kalecgosAI(pCreature); -} -bool GossipHello_npc_kalecgos(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(12498, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_kalecgos(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(12500, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(12502, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(12606, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAEL_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(12607, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->SEND_GOSSIP_MENU(12608, pCreature->GetGUID()); - break; - } - - return true; -} void AddSC_magisters_terrace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kalecgos"; - newscript->GetAI = &GetAI_npc_kalecgos; - newscript->pGossipHello = &GossipHello_npc_kalecgos; - newscript->pGossipSelect = &GossipSelect_npc_kalecgos; - newscript->RegisterSelf(); + new npc_kalecgos(); } diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp index 86894f75f73..95f4c7d4187 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp @@ -31,79 +31,81 @@ EndScriptData */ #define SPELL_IGNITEMANA 19659 #define SPELL_LIVINGBOMB 20475 #define SPELL_ARMAGEDDOM 20479 - -struct boss_baron_geddonAI : public ScriptedAI + class boss_baron_geddon : public CreatureScript { - boss_baron_geddonAI(Creature *c) : ScriptedAI(c) {} +public: + boss_baron_geddon() : CreatureScript("boss_baron_geddon") { } - uint32 Inferno_Timer; - uint32 IgniteMana_Timer; - uint32 LivingBomb_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Inferno_Timer = 45000; //These times are probably wrong - IgniteMana_Timer = 30000; - LivingBomb_Timer = 35000; + return new boss_baron_geddonAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_baron_geddonAI : public ScriptedAI { - } + boss_baron_geddonAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Inferno_Timer; + uint32 IgniteMana_Timer; + uint32 LivingBomb_Timer; - //If we are <2% hp cast Armageddom - if (me->GetHealth()*100 / me->GetMaxHealth() <= 2) + void Reset() { - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_ARMAGEDDOM); - DoScriptText(EMOTE_SERVICE, me); - return; + Inferno_Timer = 45000; //These times are probably wrong + IgniteMana_Timer = 30000; + LivingBomb_Timer = 35000; } - //Inferno_Timer - if (Inferno_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_INFERNO); - Inferno_Timer = 45000; - } else Inferno_Timer -= diff; + } - //IgniteMana_Timer - if (IgniteMana_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_IGNITEMANA); + if (!UpdateVictim()) + return; - IgniteMana_Timer = 30000; - } else IgniteMana_Timer -= diff; + //If we are <2% hp cast Armageddom + if (me->GetHealth()*100 / me->GetMaxHealth() <= 2) + { + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_ARMAGEDDOM); + DoScriptText(EMOTE_SERVICE, me); + return; + } - //LivingBomb_Timer - if (LivingBomb_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LIVINGBOMB); + //Inferno_Timer + if (Inferno_Timer <= diff) + { + DoCast(me, SPELL_INFERNO); + Inferno_Timer = 45000; + } else Inferno_Timer -= diff; - LivingBomb_Timer = 35000; - } else LivingBomb_Timer -= diff; + //IgniteMana_Timer + if (IgniteMana_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_IGNITEMANA); + + IgniteMana_Timer = 30000; + } else IgniteMana_Timer -= diff; + + //LivingBomb_Timer + if (LivingBomb_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LIVINGBOMB); + + LivingBomb_Timer = 35000; + } else LivingBomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_baron_geddon(Creature* pCreature) -{ - return new boss_baron_geddonAI (pCreature); -} void AddSC_boss_baron_geddon() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baron_geddon"; - newscript->GetAI = &GetAI_boss_baron_geddon; - newscript->RegisterSelf(); + new boss_baron_geddon(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp index 18eef567088..39c1a5aa031 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp @@ -33,113 +33,117 @@ EndScriptData */ //Add spells #define SPELL_ERUPTION 19497 #define SPELL_IMMOLATE 20294 - -struct boss_garrAI : public ScriptedAI + class boss_garr : public CreatureScript { - boss_garrAI(Creature *c) : ScriptedAI(c) {} +public: + boss_garr() : CreatureScript("boss_garr") { } - uint32 AntiMagicPulse_Timer; - uint32 MagmaShackles_Timer; - uint32 CheckAdds_Timer; - uint64 Add[8]; - bool Enraged[8]; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AntiMagicPulse_Timer = 25000; //These times are probably wrong - MagmaShackles_Timer = 15000; - CheckAdds_Timer = 2000; + return new boss_garrAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_garrAI : public ScriptedAI { - } + boss_garrAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 AntiMagicPulse_Timer; + uint32 MagmaShackles_Timer; + uint32 CheckAdds_Timer; + uint64 Add[8]; + bool Enraged[8]; - //AntiMagicPulse_Timer - if (AntiMagicPulse_Timer <= diff) + void Reset() { - DoCast(me, SPELL_ANTIMAGICPULSE); - AntiMagicPulse_Timer = 10000 + rand()%5000; - } else AntiMagicPulse_Timer -= diff; - - //MagmaShackles_Timer - if (MagmaShackles_Timer <= diff) - { - DoCast(me, SPELL_MAGMASHACKLES); - MagmaShackles_Timer = 8000 + rand()%4000; - } else MagmaShackles_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_fireswornAI : public ScriptedAI -{ - mob_fireswornAI(Creature *c) : ScriptedAI(c) {} - - uint32 Immolate_Timer; - - void Reset() - { - Immolate_Timer = 4000; //These times are probably wrong - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Immolate_Timer - if (Immolate_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_IMMOLATE); - - Immolate_Timer = urand(5000,10000); - } else Immolate_Timer -= diff; - - //Cast Erruption and let them die - if (me->GetHealth() <= me->GetMaxHealth() * 0.10) - { - DoCast(me->getVictim(), SPELL_ERUPTION); - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); + AntiMagicPulse_Timer = 25000; //These times are probably wrong + MagmaShackles_Timer = 15000; + CheckAdds_Timer = 2000; } - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_garr(Creature* pCreature) -{ - return new boss_garrAI (pCreature); -} + void EnterCombat(Unit * /*who*/) + { + } -CreatureAI* GetAI_mob_firesworn(Creature* pCreature) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //AntiMagicPulse_Timer + if (AntiMagicPulse_Timer <= diff) + { + DoCast(me, SPELL_ANTIMAGICPULSE); + AntiMagicPulse_Timer = 10000 + rand()%5000; + } else AntiMagicPulse_Timer -= diff; + + //MagmaShackles_Timer + if (MagmaShackles_Timer <= diff) + { + DoCast(me, SPELL_MAGMASHACKLES); + MagmaShackles_Timer = 8000 + rand()%4000; + } else MagmaShackles_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_firesworn : public CreatureScript { - return new mob_fireswornAI (pCreature); -} +public: + mob_firesworn() : CreatureScript("mob_firesworn") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fireswornAI (pCreature); + } + + struct mob_fireswornAI : public ScriptedAI + { + mob_fireswornAI(Creature *c) : ScriptedAI(c) {} + + uint32 Immolate_Timer; + + void Reset() + { + Immolate_Timer = 4000; //These times are probably wrong + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = urand(5000,10000); + } else Immolate_Timer -= diff; + + //Cast Erruption and let them die + if (me->GetHealth() <= me->GetMaxHealth() * 0.10) + { + DoCast(me->getVictim(), SPELL_ERUPTION); + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + } + + DoMeleeAttackIfReady(); + } + }; + +}; + void AddSC_boss_garr() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_garr"; - newscript->GetAI = &GetAI_boss_garr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_firesworn"; - newscript->GetAI = &GetAI_mob_firesworn; - newscript->RegisterSelf(); + new boss_garr(); + new mob_firesworn(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp index a2e3550b87b..07c1eb1f2d3 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp @@ -28,68 +28,70 @@ EndScriptData */ #define SPELL_SHADOWBOLT 19728 #define SPELL_RAINOFFIRE 19717 #define SPELL_GEHENNASCURSE 19716 - -struct boss_gehennasAI : public ScriptedAI + class boss_gehennas : public CreatureScript { - boss_gehennasAI(Creature *c) : ScriptedAI(c) {} +public: + boss_gehennas() : CreatureScript("boss_gehennas") { } - uint32 ShadowBolt_Timer; - uint32 RainOfFire_Timer; - uint32 GehennasCurse_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowBolt_Timer = 6000; - RainOfFire_Timer = 10000; - GehennasCurse_Timer = 12000; + return new boss_gehennasAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct boss_gehennasAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_gehennasAI(Creature *c) : ScriptedAI(c) {} - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + uint32 ShadowBolt_Timer; + uint32 RainOfFire_Timer; + uint32 GehennasCurse_Timer; + + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) - DoCast(pTarget, SPELL_SHADOWBOLT); + ShadowBolt_Timer = 6000; + RainOfFire_Timer = 10000; + GehennasCurse_Timer = 12000; + } - ShadowBolt_Timer = 7000; - } else ShadowBolt_Timer -= diff; + void EnterCombat(Unit * /*who*/) {} - //RainOfFire_Timer - if (RainOfFire_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_RAINOFFIRE); + if (!UpdateVictim()) + return; - RainOfFire_Timer = urand(4000,12000); - } else RainOfFire_Timer -= diff; + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) + DoCast(pTarget, SPELL_SHADOWBOLT); - //GehennasCurse_Timer - if (GehennasCurse_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_GEHENNASCURSE); - GehennasCurse_Timer = urand(22000,30000); - } else GehennasCurse_Timer -= diff; + ShadowBolt_Timer = 7000; + } else ShadowBolt_Timer -= diff; + + //RainOfFire_Timer + if (RainOfFire_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_RAINOFFIRE); + + RainOfFire_Timer = urand(4000,12000); + } else RainOfFire_Timer -= diff; + + //GehennasCurse_Timer + if (GehennasCurse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_GEHENNASCURSE); + GehennasCurse_Timer = urand(22000,30000); + } else GehennasCurse_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gehennas(Creature* pCreature) -{ - return new boss_gehennasAI (pCreature); -} void AddSC_boss_gehennas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gehennas"; - newscript->GetAI = &GetAI_boss_gehennas; - newscript->RegisterSelf(); + new boss_gehennas(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp index 5ad9768d567..b9739f93b6c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp @@ -38,163 +38,167 @@ enum eEnums EMOTE_LOWHP = -1409002, SPELL_MANGLE = 19820 }; - -struct boss_golemaggAI : public ScriptedAI + class boss_golemagg : public CreatureScript { - boss_golemaggAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_golemagg() : CreatureScript("boss_golemagg") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_golemaggAI (pCreature); } - ScriptedInstance* m_pInstance; - - uint32 m_uiPyroblastTimer; - uint32 m_uiEarthquakeTimer; - uint32 m_uiBuffTimer; - bool m_bEnraged; - - void Reset() + struct boss_golemaggAI : public ScriptedAI { - m_uiPyroblastTimer = 7*IN_MILLISECONDS; // These timers are probably wrong - m_uiEarthquakeTimer = 3*IN_MILLISECONDS; - m_uiBuffTimer = 2.5*IN_MILLISECONDS; - m_bEnraged = false; - - DoCast(me, SPELL_MAGMASPLASH, true); - } - - void JustDied(Unit* /*pKiller*/) - { - if (m_pInstance) - m_pInstance->SetData(DATA_GOLEMAGG_DEATH, 0); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //Pyroblast - if (m_uiPyroblastTimer <= uiDiff) + boss_golemaggAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_PYROBLAST); - - m_uiPyroblastTimer = 7*IN_MILLISECONDS; - } - else - m_uiPyroblastTimer -= uiDiff; - - // Enrage - if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10) - { - DoCast(me, SPELL_ENRAGE); - m_bEnraged = true; + m_pInstance = pCreature->GetInstanceScript(); } - // Earthquake - if (m_bEnraged) - { - if (m_uiEarthquakeTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_EARTHQUAKE); - m_uiEarthquakeTimer = 3*IN_MILLISECONDS; - } - else - m_uiEarthquakeTimer -= uiDiff; - } + InstanceScript* m_pInstance; - /* - // Golemagg's Trust - if (m_uiBuffTimer <= uidiff) + uint32 m_uiPyroblastTimer; + uint32 m_uiEarthquakeTimer; + uint32 m_uiBuffTimer; + bool m_bEnraged; + + void Reset() { - DoCast(me, SPELL_GOLEMAGG_TRUST); + m_uiPyroblastTimer = 7*IN_MILLISECONDS; // These timers are probably wrong + m_uiEarthquakeTimer = 3*IN_MILLISECONDS; m_uiBuffTimer = 2.5*IN_MILLISECONDS; + m_bEnraged = false; + + DoCast(me, SPELL_MAGMASPLASH, true); } - else - m_uiBuffTimer -= uiDiff; - */ - DoMeleeAttackIfReady(); - } -}; - -struct mob_core_ragerAI : public ScriptedAI -{ - mob_core_ragerAI(Creature *c) : ScriptedAI(c) - { - m_pInstance = c->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - - uint32 m_uiMangleTimer; - - void Reset() - { - m_uiMangleTimer = 7*IN_MILLISECONDS; // These times are probably wrong - } - - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (me->GetHealth()*100 < me->GetMaxHealth()*50) + void JustDied(Unit* /*pKiller*/) { if (m_pInstance) + m_pInstance->SetData(DATA_GOLEMAGG_DEATH, 0); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //Pyroblast + if (m_uiPyroblastTimer <= uiDiff) { - if (Creature* pGolemagg = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_GOLEMAGG))) + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_PYROBLAST); + + m_uiPyroblastTimer = 7*IN_MILLISECONDS; + } + else + m_uiPyroblastTimer -= uiDiff; + + // Enrage + if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10) + { + DoCast(me, SPELL_ENRAGE); + m_bEnraged = true; + } + + // Earthquake + if (m_bEnraged) + { + if (m_uiEarthquakeTimer <= uiDiff) { - if (pGolemagg->isAlive()) + DoCast(me->getVictim(), SPELL_EARTHQUAKE); + m_uiEarthquakeTimer = 3*IN_MILLISECONDS; + } + else + m_uiEarthquakeTimer -= uiDiff; + } + + /* + // Golemagg's Trust + if (m_uiBuffTimer <= uidiff) + { + DoCast(me, SPELL_GOLEMAGG_TRUST); + m_uiBuffTimer = 2.5*IN_MILLISECONDS; + } + else + m_uiBuffTimer -= uiDiff; + */ + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_core_rager : public CreatureScript +{ +public: + mob_core_rager() : CreatureScript("mob_core_rager") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_core_ragerAI (pCreature); + } + + struct mob_core_ragerAI : public ScriptedAI + { + mob_core_ragerAI(Creature *c) : ScriptedAI(c) + { + m_pInstance = c->GetInstanceScript(); + } + + InstanceScript* m_pInstance; + + uint32 m_uiMangleTimer; + + void Reset() + { + m_uiMangleTimer = 7*IN_MILLISECONDS; // These times are probably wrong + } + + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) + { + if (me->GetHealth()*100 < me->GetMaxHealth()*50) + { + if (m_pInstance) + { + if (Creature* pGolemagg = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_GOLEMAGG))) { - DoScriptText(EMOTE_LOWHP, me); - me->SetHealth(me->GetMaxHealth()); + if (pGolemagg->isAlive()) + { + DoScriptText(EMOTE_LOWHP, me); + me->SetHealth(me->GetMaxHealth()); + } + else + uiDamage = me->GetHealth(); } - else - uiDamage = me->GetHealth(); } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - // Mangle - if (m_uiMangleTimer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_MANGLE); - m_uiMangleTimer = 10*IN_MILLISECONDS; - } - else - m_uiMangleTimer -= uiDiff; + if (!UpdateVictim()) + return; + + // Mangle + if (m_uiMangleTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MANGLE); + m_uiMangleTimer = 10*IN_MILLISECONDS; + } + else + m_uiMangleTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_golemagg(Creature* pCreature) -{ - return new boss_golemaggAI (pCreature); -} -CreatureAI* GetAI_mob_core_rager(Creature* pCreature) -{ - return new mob_core_ragerAI (pCreature); -} void AddSC_boss_golemagg() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_golemagg"; - newscript->GetAI = &GetAI_boss_golemagg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_core_rager"; - newscript->GetAI = &GetAI_mob_core_rager; - newscript->RegisterSelf(); + new boss_golemagg(); + new mob_core_rager(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp index 761bfa97f81..45b15c7bebf 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp @@ -28,66 +28,68 @@ EndScriptData */ #define SPELL_IMPENDINGDOOM 19702 #define SPELL_LUCIFRONCURSE 19703 #define SPELL_SHADOWSHOCK 20603 - -struct boss_lucifronAI : public ScriptedAI + class boss_lucifron : public CreatureScript { - boss_lucifronAI(Creature *c) : ScriptedAI(c) {} +public: + boss_lucifron() : CreatureScript("boss_lucifron") { } - uint32 ImpendingDoom_Timer; - uint32 LucifronCurse_Timer; - uint32 ShadowShock_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ImpendingDoom_Timer = 10000; //Initial cast after 10 seconds so the debuffs alternate - LucifronCurse_Timer = 20000; //Initial cast after 20 seconds - ShadowShock_Timer = 6000; //6 seconds + return new boss_lucifronAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_lucifronAI : public ScriptedAI { - } + boss_lucifronAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ImpendingDoom_Timer; + uint32 LucifronCurse_Timer; + uint32 ShadowShock_Timer; - //Impending doom timer - if (ImpendingDoom_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_IMPENDINGDOOM); - ImpendingDoom_Timer = 20000; - } else ImpendingDoom_Timer -= diff; + ImpendingDoom_Timer = 10000; //Initial cast after 10 seconds so the debuffs alternate + LucifronCurse_Timer = 20000; //Initial cast after 20 seconds + ShadowShock_Timer = 6000; //6 seconds + } - //Lucifron's curse timer - if (LucifronCurse_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_LUCIFRONCURSE); - LucifronCurse_Timer = 15000; - } else LucifronCurse_Timer -= diff; + } - //Shadowshock - if (ShadowShock_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHADOWSHOCK); - ShadowShock_Timer = 6000; - } else ShadowShock_Timer -= diff; + if (!UpdateVictim()) + return; + + //Impending doom timer + if (ImpendingDoom_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMPENDINGDOOM); + ImpendingDoom_Timer = 20000; + } else ImpendingDoom_Timer -= diff; + + //Lucifron's curse timer + if (LucifronCurse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LUCIFRONCURSE); + LucifronCurse_Timer = 15000; + } else LucifronCurse_Timer -= diff; + + //Shadowshock + if (ShadowShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWSHOCK); + ShadowShock_Timer = 6000; + } else ShadowShock_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lucifron(Creature* pCreature) -{ - return new boss_lucifronAI (pCreature); -} void AddSC_boss_lucifron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lucifron"; - newscript->GetAI = &GetAI_boss_lucifron; - newscript->RegisterSelf(); + new boss_lucifron(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp index fd64e42fed1..785ee11066c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp @@ -32,71 +32,73 @@ EndScriptData */ #define SPELL_PANIC 19408 #define SPELL_LAVABOMB 19411 //This calls a dummy server side effect that isn't implemented yet #define SPELL_LAVABOMB_ALT 19428 //This is the spell that the lava bomb casts - -struct boss_magmadarAI : public ScriptedAI + class boss_magmadar : public CreatureScript { - boss_magmadarAI(Creature *c) : ScriptedAI(c) {} +public: + boss_magmadar() : CreatureScript("boss_magmadar") { } - uint32 Frenzy_Timer; - uint32 Panic_Timer; - uint32 Lavabomb_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Frenzy_Timer = 30000; - Panic_Timer = 20000; - Lavabomb_Timer = 12000; - - DoCast(me, SPELL_MAGMASPIT, true); + return new boss_magmadarAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_magmadarAI : public ScriptedAI { - } + boss_magmadarAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Frenzy_Timer; + uint32 Panic_Timer; + uint32 Lavabomb_Timer; - //Frenzy_Timer - if (Frenzy_Timer <= diff) + void Reset() { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_FRENZY); - Frenzy_Timer = 15000; - } else Frenzy_Timer -= diff; - - //Panic_Timer - if (Panic_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_PANIC); - Panic_Timer = 35000; - } else Panic_Timer -= diff; - - //Lavabomb_Timer - if (Lavabomb_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LAVABOMB_ALT); - + Frenzy_Timer = 30000; + Panic_Timer = 20000; Lavabomb_Timer = 12000; - } else Lavabomb_Timer -= diff; - DoMeleeAttackIfReady(); - } + DoCast(me, SPELL_MAGMASPIT, true); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Frenzy_Timer + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_FRENZY); + Frenzy_Timer = 15000; + } else Frenzy_Timer -= diff; + + //Panic_Timer + if (Panic_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_PANIC); + Panic_Timer = 35000; + } else Panic_Timer -= diff; + + //Lavabomb_Timer + if (Lavabomb_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LAVABOMB_ALT); + + Lavabomb_Timer = 12000; + } else Lavabomb_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_magmadar(Creature* pCreature) -{ - return new boss_magmadarAI (pCreature); -} void AddSC_boss_magmadar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magmadar"; - newscript->GetAI = &GetAI_boss_magmadar; - newscript->RegisterSelf(); + new boss_magmadar(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index 3b8bf20256d..4b4f2f5c784 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -52,85 +52,87 @@ EndScriptData */ #define ENTRY_FLAMEWALKER_HEALER 11663 #define ENTRY_FLAMEWALKER_ELITE 11664 - -struct boss_majordomoAI : public ScriptedAI + class boss_majordomo : public CreatureScript { - boss_majordomoAI(Creature *c) : ScriptedAI(c) {} +public: + boss_majordomo() : CreatureScript("boss_majordomo") { } - uint32 MagicReflection_Timer; - uint32 DamageReflection_Timer; - uint32 Blastwave_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MagicReflection_Timer = 30000; //Damage reflection first so we alternate - DamageReflection_Timer = 15000; - Blastwave_Timer = 10000; + return new boss_majordomoAI (pCreature); } - void KilledUnit(Unit* /*victim*/) + struct boss_majordomoAI : public ScriptedAI { - if (rand()%5) - return; + boss_majordomoAI(Creature *c) : ScriptedAI(c) {} - DoScriptText(SAY_SLAY, me); - } + uint32 MagicReflection_Timer; + uint32 DamageReflection_Timer; + uint32 Blastwave_Timer; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Cast Ageis if less than 50% hp - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + void Reset() { - DoCast(me, SPELL_AEGIS); + MagicReflection_Timer = 30000; //Damage reflection first so we alternate + DamageReflection_Timer = 15000; + Blastwave_Timer = 10000; } - //MagicReflection_Timer - // if (MagicReflection_Timer <= diff) - // { - // DoCast(me, SPELL_MAGICREFLECTION); - - //60 seconds until we should cast this agian - // MagicReflection_Timer = 30000; - // } else MagicReflection_Timer -= diff; - - //DamageReflection_Timer - // if (DamageReflection_Timer <= diff) - // { - // DoCast(me, SPELL_DAMAGEREFLECTION); - - //60 seconds until we should cast this agian - // DamageReflection_Timer = 30000; - // } else DamageReflection_Timer -= diff; - - //Blastwave_Timer - if (Blastwave_Timer <= diff) + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_BLASTWAVE); - Blastwave_Timer = 10000; - } else Blastwave_Timer -= diff; + if (rand()%5) + return; + + DoScriptText(SAY_SLAY, me); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Cast Ageis if less than 50% hp + if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + DoCast(me, SPELL_AEGIS); + } + + //MagicReflection_Timer + // if (MagicReflection_Timer <= diff) + // { + // DoCast(me, SPELL_MAGICREFLECTION); + + //60 seconds until we should cast this agian + // MagicReflection_Timer = 30000; + // } else MagicReflection_Timer -= diff; + + //DamageReflection_Timer + // if (DamageReflection_Timer <= diff) + // { + // DoCast(me, SPELL_DAMAGEREFLECTION); + + //60 seconds until we should cast this agian + // DamageReflection_Timer = 30000; + // } else DamageReflection_Timer -= diff; + + //Blastwave_Timer + if (Blastwave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BLASTWAVE); + Blastwave_Timer = 10000; + } else Blastwave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_majordomo(Creature* pCreature) -{ - return new boss_majordomoAI (pCreature); -} void AddSC_boss_majordomo() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_majordomo"; - newscript->GetAI = &GetAI_boss_majordomo; - newscript->RegisterSelf(); + new boss_majordomo(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp index fc7f9948f0a..7fc099546ed 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_ragnaros.cpp @@ -84,216 +84,218 @@ EndScriptData */ #define ADD_8Y -810.869385 #define ADD_8Z -229.683182 #define ADD_8O 4.693108 - -struct boss_ragnarosAI : public ScriptedAI + class boss_ragnaros : public CreatureScript { - boss_ragnarosAI(Creature *c) : ScriptedAI(c) +public: + boss_ragnaros() : CreatureScript("boss_ragnaros") { } + + CreatureAI* GetAI(Creature* pCreature) const { - SetCombatMovement(false); + return new boss_ragnarosAI (pCreature); } - uint32 WrathOfRagnaros_Timer; - uint32 HandOfRagnaros_Timer; - uint32 LavaBurst_Timer; - uint32 MagmaBurst_Timer; - uint32 ElementalFire_Timer; - uint32 Erruption_Timer; - uint32 Submerge_Timer; - uint32 Attack_Timer; - - bool HasYelledMagmaBurst; - bool HasSubmergedOnce; - bool WasBanished; - bool HasAura; - - void Reset() + struct boss_ragnarosAI : public ScriptedAI { - WrathOfRagnaros_Timer = 30000; - HandOfRagnaros_Timer = 25000; - LavaBurst_Timer = 10000; - MagmaBurst_Timer = 2000; - Erruption_Timer = 15000; - ElementalFire_Timer = 3000; - Submerge_Timer = 180000; - Attack_Timer = 90000; - HasYelledMagmaBurst = false; - HasSubmergedOnce = false; - WasBanished = false; - - DoCast(me, SPELL_MELTWEAPON, true); - HasAura = true; - } - - void KilledUnit(Unit* /*victim*/) - { - if (rand()%5) - return; - - DoScriptText(SAY_KILL, me); - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (WasBanished && Attack_Timer <= diff) + boss_ragnarosAI(Creature *c) : ScriptedAI(c) { - //Become unbanished again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_RAGEMERGE); - WasBanished = false; - } else if (WasBanished) - { - Attack_Timer -= diff; - //Do nothing while banished - return; + SetCombatMovement(false); } - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WrathOfRagnaros_Timer; + uint32 HandOfRagnaros_Timer; + uint32 LavaBurst_Timer; + uint32 MagmaBurst_Timer; + uint32 ElementalFire_Timer; + uint32 Erruption_Timer; + uint32 Submerge_Timer; + uint32 Attack_Timer; - //WrathOfRagnaros_Timer - if (WrathOfRagnaros_Timer <= diff) + bool HasYelledMagmaBurst; + bool HasSubmergedOnce; + bool WasBanished; + bool HasAura; + + void Reset() { - DoCast(me->getVictim(), SPELL_WRATHOFRAGNAROS); - - if (urand(0,1)) - DoScriptText(SAY_WRATH, me); - WrathOfRagnaros_Timer = 30000; - } else WrathOfRagnaros_Timer -= diff; - - //HandOfRagnaros_Timer - if (HandOfRagnaros_Timer <= diff) - { - DoCast(me, SPELL_HANDOFRAGNAROS); - - if (urand(0,1)) - DoScriptText(SAY_HAND, me); - HandOfRagnaros_Timer = 25000; - } else HandOfRagnaros_Timer -= diff; - - //LavaBurst_Timer - if (LavaBurst_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_LAVABURST); LavaBurst_Timer = 10000; - } else LavaBurst_Timer -= diff; + MagmaBurst_Timer = 2000; + Erruption_Timer = 15000; + ElementalFire_Timer = 3000; + Submerge_Timer = 180000; + Attack_Timer = 90000; + HasYelledMagmaBurst = false; + HasSubmergedOnce = false; + WasBanished = false; - //Erruption_Timer - if (LavaBurst_Timer <= diff) + DoCast(me, SPELL_MELTWEAPON, true); + HasAura = true; + } + + void KilledUnit(Unit* /*victim*/) { - DoCast(me->getVictim(), SPELL_ERRUPTION); - Erruption_Timer = urand(20000,45000); - } else Erruption_Timer -= diff; + if (rand()%5) + return; - //ElementalFire_Timer - if (ElementalFire_Timer <= diff) + DoScriptText(SAY_KILL, me); + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_ELEMENTALFIRE); - ElementalFire_Timer = urand(10000,14000); - } else ElementalFire_Timer -= diff; + } - //Submerge_Timer - if (!WasBanished && Submerge_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Creature spawning and ragnaros becomming unattackable - //is not very well supported in the core - //so added normaly spawning and banish workaround and attack again after 90 secs. - - me->InterruptNonMeleeSpells(false); - //Root self - DoCast(me, 23973); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); - - if (!HasSubmergedOnce) + if (WasBanished && Attack_Timer <= diff) { - DoScriptText(SAY_REINFORCEMENTS1, me); + //Become unbanished again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_RAGEMERGE); + WasBanished = false; + } else if (WasBanished) + { + Attack_Timer -= diff; + //Do nothing while banished + return; + } - // summon 10 elementals - for (uint8 i = 0; i < 9; ++i) + //Return since we have no target + if (!UpdateVictim()) + return; + + //WrathOfRagnaros_Timer + if (WrathOfRagnaros_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WRATHOFRAGNAROS); + + if (urand(0,1)) + DoScriptText(SAY_WRATH, me); + + WrathOfRagnaros_Timer = 30000; + } else WrathOfRagnaros_Timer -= diff; + + //HandOfRagnaros_Timer + if (HandOfRagnaros_Timer <= diff) + { + DoCast(me, SPELL_HANDOFRAGNAROS); + + if (urand(0,1)) + DoScriptText(SAY_HAND, me); + + HandOfRagnaros_Timer = 25000; + } else HandOfRagnaros_Timer -= diff; + + //LavaBurst_Timer + if (LavaBurst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LAVABURST); + LavaBurst_Timer = 10000; + } else LavaBurst_Timer -= diff; + + //Erruption_Timer + if (LavaBurst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ERRUPTION); + Erruption_Timer = urand(20000,45000); + } else Erruption_Timer -= diff; + + //ElementalFire_Timer + if (ElementalFire_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ELEMENTALFIRE); + ElementalFire_Timer = urand(10000,14000); + } else ElementalFire_Timer -= diff; + + //Submerge_Timer + if (!WasBanished && Submerge_Timer <= diff) + { + //Creature spawning and ragnaros becomming unattackable + //is not very well supported in the core + //so added normaly spawning and banish workaround and attack again after 90 secs. + + me->InterruptNonMeleeSpells(false); + //Root self + DoCast(me, 23973); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); + + if (!HasSubmergedOnce) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoScriptText(SAY_REINFORCEMENTS1, me); + + // summon 10 elementals + for (uint8 i = 0; i < 9; ++i) { - if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) - pSummoned->AI()->AttackStart(pTarget); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) + pSummoned->AI()->AttackStart(pTarget); + } } + + HasSubmergedOnce = true; + WasBanished = true; + DoCast(me, SPELL_RAGSUBMERGE); + Attack_Timer = 90000; + + } + else + { + DoScriptText(SAY_REINFORCEMENTS2, me); + + for (uint8 i = 0; i < 9; ++i) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) + pSummoned->AI()->AttackStart(pTarget); + } + } + + WasBanished = true; + DoCast(me, SPELL_RAGSUBMERGE); + Attack_Timer = 90000; } - HasSubmergedOnce = true; - WasBanished = true; - DoCast(me, SPELL_RAGSUBMERGE); - Attack_Timer = 90000; + Submerge_Timer = 180000; + } else Submerge_Timer -= diff; + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + //Make sure our attack is ready and we arn't currently casting + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } } else { - DoScriptText(SAY_REINFORCEMENTS2, me); - - for (uint8 i = 0; i < 9; ++i) + //MagmaBurst_Timer + if (MagmaBurst_Timer <= diff) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(me->getVictim(), SPELL_MAGMABURST); + + if (!HasYelledMagmaBurst) { - if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000)) - pSummoned->AI()->AttackStart(pTarget); + //Say our dialog + DoScriptText(SAY_MAGMABURST, me); + HasYelledMagmaBurst = true; } - } - WasBanished = true; - DoCast(me, SPELL_RAGSUBMERGE); - Attack_Timer = 90000; - } - - Submerge_Timer = 180000; - } else Submerge_Timer -= diff; - - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - //Make sure our attack is ready and we arn't currently casting - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + MagmaBurst_Timer = 2500; + } else MagmaBurst_Timer -= diff; } } - else - { - //MagmaBurst_Timer - if (MagmaBurst_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MAGMABURST); + }; - if (!HasYelledMagmaBurst) - { - //Say our dialog - DoScriptText(SAY_MAGMABURST, me); - HasYelledMagmaBurst = true; - } - - MagmaBurst_Timer = 2500; - } else MagmaBurst_Timer -= diff; - } - } }; -CreatureAI* GetAI_boss_ragnaros(Creature* pCreature) -{ - return new boss_ragnarosAI (pCreature); -} void AddSC_boss_ragnaros() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ragnaros"; - newscript->GetAI = &GetAI_boss_ragnaros; - newscript->RegisterSelf(); + new boss_ragnaros(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp index f2b6b4a99f8..4086935e7ae 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp @@ -29,95 +29,97 @@ EndScriptData */ #define SPELL_SHAZZRAHCURSE 19713 #define SPELL_DEADENMAGIC 19714 #define SPELL_COUNTERSPELL 19715 - -struct boss_shazzrahAI : public ScriptedAI + class boss_shazzrah : public CreatureScript { - boss_shazzrahAI(Creature *c) : ScriptedAI(c) {} +public: + boss_shazzrah() : CreatureScript("boss_shazzrah") { } - uint32 ArcaneExplosion_Timer; - uint32 ShazzrahCurse_Timer; - uint32 DeadenMagic_Timer; - uint32 Countspell_Timer; - uint32 Blink_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ArcaneExplosion_Timer = 6000; //These times are probably wrong - ShazzrahCurse_Timer = 10000; - DeadenMagic_Timer = 24000; - Countspell_Timer = 15000; - Blink_Timer = 30000; + return new boss_shazzrahAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_shazzrahAI : public ScriptedAI { - } + boss_shazzrahAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 ArcaneExplosion_Timer; + uint32 ShazzrahCurse_Timer; + uint32 DeadenMagic_Timer; + uint32 Countspell_Timer; + uint32 Blink_Timer; - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); - ArcaneExplosion_Timer = 5000 + rand()%4000; - } else ArcaneExplosion_Timer -= diff; + ArcaneExplosion_Timer = 6000; //These times are probably wrong + ShazzrahCurse_Timer = 10000; + DeadenMagic_Timer = 24000; + Countspell_Timer = 15000; + Blink_Timer = 30000; + } - //ShazzrahCurse_Timer - if (ShazzrahCurse_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHAZZRAHCURSE); + } - ShazzrahCurse_Timer = 25000 + rand()%5000; - } else ShazzrahCurse_Timer -= diff; - - //DeadenMagic_Timer - if (DeadenMagic_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_DEADENMAGIC); - DeadenMagic_Timer = 35000; - } else DeadenMagic_Timer -= diff; + if (!UpdateVictim()) + return; - //Countspell_Timer - if (Countspell_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_COUNTERSPELL); - Countspell_Timer = 16000 + rand()%4000; - } else Countspell_Timer -= diff; - - //Blink_Timer - if (Blink_Timer <= diff) - { - // Teleporting him to a random gamer and casting Arcane Explosion after that. - // Blink is not working cause of LoS System we need to do this hardcoded. - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true)) + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) { - DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); - DoCast(pTarget, SPELL_ARCANEEXPLOSION); - DoResetThreat(); - } + DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); + ArcaneExplosion_Timer = 5000 + rand()%4000; + } else ArcaneExplosion_Timer -= diff; - Blink_Timer = 45000; - } else Blink_Timer -= diff; + //ShazzrahCurse_Timer + if (ShazzrahCurse_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHAZZRAHCURSE); + + ShazzrahCurse_Timer = 25000 + rand()%5000; + } else ShazzrahCurse_Timer -= diff; + + //DeadenMagic_Timer + if (DeadenMagic_Timer <= diff) + { + DoCast(me, SPELL_DEADENMAGIC); + DeadenMagic_Timer = 35000; + } else DeadenMagic_Timer -= diff; + + //Countspell_Timer + if (Countspell_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_COUNTERSPELL); + Countspell_Timer = 16000 + rand()%4000; + } else Countspell_Timer -= diff; + + //Blink_Timer + if (Blink_Timer <= diff) + { + // Teleporting him to a random gamer and casting Arcane Explosion after that. + // Blink is not working cause of LoS System we need to do this hardcoded. + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true)) + { + DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + DoCast(pTarget, SPELL_ARCANEEXPLOSION); + DoResetThreat(); + } + + Blink_Timer = 45000; + } else Blink_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shazzrah(Creature* pCreature) -{ - return new boss_shazzrahAI (pCreature); -} void AddSC_boss_shazzrah() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shazzrah"; - newscript->GetAI = &GetAI_boss_shazzrah; - newscript->RegisterSelf(); + new boss_shazzrah(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp index 66d6d115b12..8c310115c05 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp @@ -36,172 +36,176 @@ EndScriptData */ #define SPELL_HEAL 19775 #define SPELL_SHADOWWORDPAIN 19776 #define SPELL_IMMOLATE 20294 - -struct boss_sulfuronAI : public ScriptedAI + class boss_sulfuron : public CreatureScript { - boss_sulfuronAI(Creature *c) : ScriptedAI(c) {} +public: + boss_sulfuron() : CreatureScript("boss_sulfuron") { } - uint32 Darkstrike_Timer; - uint32 DemoralizingShout_Timer; - uint32 Inspire_Timer; - uint32 Knockdown_Timer; - uint32 Flamespear_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Darkstrike_Timer=10000; //These times are probably wrong - DemoralizingShout_Timer = 15000; - Inspire_Timer = 13000; - Knockdown_Timer = 6000; - Flamespear_Timer = 2000; + return new boss_sulfuronAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_sulfuronAI : public ScriptedAI { - } + boss_sulfuronAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Darkstrike_Timer; + uint32 DemoralizingShout_Timer; + uint32 Inspire_Timer; + uint32 Knockdown_Timer; + uint32 Flamespear_Timer; - //DemoralizingShout_Timer - if (DemoralizingShout_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DemoralizingShout_Timer = 15000 + rand()%5000; - } else DemoralizingShout_Timer -= diff; + Darkstrike_Timer=10000; //These times are probably wrong + DemoralizingShout_Timer = 15000; + Inspire_Timer = 13000; + Knockdown_Timer = 6000; + Flamespear_Timer = 2000; + } - //Inspire_Timer - if (Inspire_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - Creature *pTarget = NULL; - std::list pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE); - if (!pList.empty()) - { - std::list::const_iterator i = pList.begin(); - advance(i, (rand()%pList.size())); - pTarget = (*i); - } + } - if (pTarget) - DoCast(pTarget, SPELL_INSPIRE); - - DoCast(me, SPELL_INSPIRE); - - Inspire_Timer = 20000 + rand()%6000; - } else Inspire_Timer -= diff; - - //Knockdown_Timer - if (Knockdown_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); - Knockdown_Timer = 12000 + rand()%3000; - } else Knockdown_Timer -= diff; - - //Flamespear_Timer - if (Flamespear_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_FLAMESPEAR); - - Flamespear_Timer = 12000 + rand()%4000; - } else Flamespear_Timer -= diff; - - //DarkStrike_Timer - if (Darkstrike_Timer <= diff) - { - DoCast(me, SPELL_DARKSTRIKE); - Darkstrike_Timer = 15000 + rand()%3000; - } else Darkstrike_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_flamewaker_priestAI : public ScriptedAI -{ - mob_flamewaker_priestAI(Creature *c) : ScriptedAI(c) {} - - uint32 Heal_Timer; - uint32 ShadowWordPain_Timer; - uint32 Immolate_Timer; - - void Reset() - { - Heal_Timer = 15000+rand()%15000; - ShadowWordPain_Timer = 2000; - Immolate_Timer = 8000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Casting Heal to Sulfuron or other Guards. - if (Heal_Timer <= diff) - { - Unit* pUnit = DoSelectLowestHpFriendly(60.0f, 1); - if (!pUnit) + if (!UpdateVictim()) return; - DoCast(pUnit, SPELL_HEAL); + //DemoralizingShout_Timer + if (DemoralizingShout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); + DemoralizingShout_Timer = 15000 + rand()%5000; + } else DemoralizingShout_Timer -= diff; - Heal_Timer = 15000+rand()%5000; - } else Heal_Timer -= diff; + //Inspire_Timer + if (Inspire_Timer <= diff) + { + Creature *pTarget = NULL; + std::list pList = DoFindFriendlyMissingBuff(45.0f,SPELL_INSPIRE); + if (!pList.empty()) + { + std::list::const_iterator i = pList.begin(); + advance(i, (rand()%pList.size())); + pTarget = (*i); + } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHADOWWORDPAIN); + if (pTarget) + DoCast(pTarget, SPELL_INSPIRE); - ShadowWordPain_Timer = 18000+rand()%8000; - } else ShadowWordPain_Timer -= diff; + DoCast(me, SPELL_INSPIRE); - //Immolate_Timer - if (Immolate_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + Inspire_Timer = 20000 + rand()%6000; + } else Inspire_Timer -= diff; - Immolate_Timer = 15000+rand()%10000; - } else Immolate_Timer -= diff; + //Knockdown_Timer + if (Knockdown_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + Knockdown_Timer = 12000 + rand()%3000; + } else Knockdown_Timer -= diff; - DoMeleeAttackIfReady(); + //Flamespear_Timer + if (Flamespear_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_FLAMESPEAR); + + Flamespear_Timer = 12000 + rand()%4000; + } else Flamespear_Timer -= diff; + + //DarkStrike_Timer + if (Darkstrike_Timer <= diff) + { + DoCast(me, SPELL_DARKSTRIKE); + Darkstrike_Timer = 15000 + rand()%3000; + } else Darkstrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_flamewaker_priest : public CreatureScript +{ +public: + mob_flamewaker_priest() : CreatureScript("mob_flamewaker_priest") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_flamewaker_priestAI (pCreature); } + + struct mob_flamewaker_priestAI : public ScriptedAI + { + mob_flamewaker_priestAI(Creature *c) : ScriptedAI(c) {} + + uint32 Heal_Timer; + uint32 ShadowWordPain_Timer; + uint32 Immolate_Timer; + + void Reset() + { + Heal_Timer = 15000+rand()%15000; + ShadowWordPain_Timer = 2000; + Immolate_Timer = 8000; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Casting Heal to Sulfuron or other Guards. + if (Heal_Timer <= diff) + { + Unit* pUnit = DoSelectLowestHpFriendly(60.0f, 1); + if (!pUnit) + return; + + DoCast(pUnit, SPELL_HEAL); + + Heal_Timer = 15000+rand()%5000; + } else Heal_Timer -= diff; + + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHADOWWORDPAIN); + + ShadowWordPain_Timer = 18000+rand()%8000; + } else ShadowWordPain_Timer -= diff; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = 15000+rand()%10000; + } else Immolate_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_sulfuron(Creature* pCreature) -{ - return new boss_sulfuronAI (pCreature); -} -CreatureAI* GetAI_mob_flamewaker_priest(Creature* pCreature) -{ - return new mob_flamewaker_priestAI (pCreature); -} void AddSC_boss_sulfuron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sulfuron"; - newscript->GetAI = &GetAI_boss_sulfuron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_flamewaker_priest"; - newscript->GetAI = &GetAI_mob_flamewaker_priest; - newscript->RegisterSelf(); + new boss_sulfuron(); + new mob_flamewaker_priest(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp index fb313fba3ae..64036906164 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp @@ -39,230 +39,232 @@ EndScriptData */ #define ID_DOMO 12018 #define ID_RAGNAROS 11502 #define ID_FLAMEWAKERPRIEST 11662 - -struct instance_molten_core : public ScriptedInstance + class instance_molten_core : public InstanceMapScript { - instance_molten_core(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_molten_core() : InstanceMapScript("instance_molten_core") { } - uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; - uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn, m_uiFirelordCacheGUID; - - //If all Bosses are dead. - bool IsBossDied[9]; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - void Initialize() + InstanceScript* GetInstance_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Lucifron = 0; - Magmadar = 0; - Gehennas = 0; - Garr = 0; - Geddon = 0; - Shazzrah = 0; - Sulfuron = 0; - Golemagg = 0; - Domo = 0; - Ragnaros = 0; - FlamewakerPriest = 0; - - RuneKoro = 0; - RuneZeth = 0; - RuneMazj = 0; - RuneTheri = 0; - RuneBlaz = 0; - RuneKress = 0; - RuneMohn = 0; - - m_uiFirelordCacheGUID = 0; - - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; - IsBossDied[3] = false; - IsBossDied[4] = false; - IsBossDied[5] = false; - IsBossDied[6] = false; - - IsBossDied[7] = false; - IsBossDied[8] = false; + return new instance_molten_core_InstanceMapScript (pMap); } - bool IsEncounterInProgress() const + struct instance_molten_core_InstanceMapScript : public InstanceScript { - return false; + instance_molten_core_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 Lucifron, Magmadar, Gehennas, Garr, Geddon, Shazzrah, Sulfuron, Golemagg, Domo, Ragnaros, FlamewakerPriest; + uint64 RuneKoro, RuneZeth, RuneMazj, RuneTheri, RuneBlaz, RuneKress, RuneMohn, m_uiFirelordCacheGUID; + + //If all Bosses are dead. + bool IsBossDied[9]; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Lucifron = 0; + Magmadar = 0; + Gehennas = 0; + Garr = 0; + Geddon = 0; + Shazzrah = 0; + Sulfuron = 0; + Golemagg = 0; + Domo = 0; + Ragnaros = 0; + FlamewakerPriest = 0; + + RuneKoro = 0; + RuneZeth = 0; + RuneMazj = 0; + RuneTheri = 0; + RuneBlaz = 0; + RuneKress = 0; + RuneMohn = 0; + + m_uiFirelordCacheGUID = 0; + + IsBossDied[0] = false; + IsBossDied[1] = false; + IsBossDied[2] = false; + IsBossDied[3] = false; + IsBossDied[4] = false; + IsBossDied[5] = false; + IsBossDied[6] = false; + + IsBossDied[7] = false; + IsBossDied[8] = false; + } + + bool IsEncounterInProgress() const + { + return false; + }; + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 176951: //Sulfuron + RuneKoro = pGo->GetGUID(); + break; + case 176952: //Geddon + RuneZeth = pGo->GetGUID(); + break; + case 176953: //Shazzrah + RuneMazj = pGo->GetGUID(); + break; + case 176954: //Golemagg + RuneTheri = pGo->GetGUID(); + break; + case 176955: //Garr + RuneBlaz = pGo->GetGUID(); + break; + case 176956: //Magmadar + RuneKress = pGo->GetGUID(); + break; + case 176957: //Gehennas + RuneMohn = pGo->GetGUID(); + break; + case 179703: + m_uiFirelordCacheGUID = pGo->GetGUID(); //when majordomo event == DONE DoRespawnGameObject(m_uiFirelordCacheGUID,); + break; + } + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch (pCreature->GetEntry()) + { + case ID_LUCIFRON: + Lucifron = pCreature->GetGUID(); + break; + + case ID_MAGMADAR: + Magmadar = pCreature->GetGUID(); + break; + + case ID_GEHENNAS: + Gehennas = pCreature->GetGUID(); + break; + + case ID_GARR: + Garr = pCreature->GetGUID(); + break; + + case ID_GEDDON: + Geddon = pCreature->GetGUID(); + break; + + case ID_SHAZZRAH: + Shazzrah = pCreature->GetGUID(); + break; + + case ID_SULFURON: + Sulfuron = pCreature->GetGUID(); + break; + + case ID_GOLEMAGG: + Golemagg = pCreature->GetGUID(); + break; + + case ID_DOMO: + Domo = pCreature->GetGUID(); + break; + + case ID_RAGNAROS: + Ragnaros = pCreature->GetGUID(); + break; + + case ID_FLAMEWAKERPRIEST: + FlamewakerPriest = pCreature->GetGUID(); + break; + } + } + + uint64 GetData64 (uint32 identifier) + { + switch(identifier) + { + case DATA_SULFURON: + return Sulfuron; + case DATA_GOLEMAGG: + return Golemagg; + + case DATA_FLAMEWAKERPRIEST: + return FlamewakerPriest; + } + + return 0; + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_LUCIFRONISDEAD: + if (IsBossDied[0]) + return 1; + break; + + case DATA_MAGMADARISDEAD: + if (IsBossDied[1]) + return 1; + break; + + case DATA_GEHENNASISDEAD: + if (IsBossDied[2]) + return 1; + break; + + case DATA_GARRISDEAD: + if (IsBossDied[3]) + return 1; + break; + + case DATA_GEDDONISDEAD: + if (IsBossDied[4]) + return 1; + break; + + case DATA_SHAZZRAHISDEAD: + if (IsBossDied[5]) + return 1; + break; + + case DATA_SULFURONISDEAD: + if (IsBossDied[6]) + return 1; + break; + + case DATA_GOLEMAGGISDEAD: + if (IsBossDied[7]) + return 1; + break; + + case DATA_MAJORDOMOISDEAD: + if (IsBossDied[8]) + return 1; + break; + } + + return 0; + } + + void SetData(uint32 type, uint32 /*data*/) + { + if (type == DATA_GOLEMAGG_DEATH) + IsBossDied[7] = true; + } }; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case 176951: //Sulfuron - RuneKoro = pGo->GetGUID(); - break; - case 176952: //Geddon - RuneZeth = pGo->GetGUID(); - break; - case 176953: //Shazzrah - RuneMazj = pGo->GetGUID(); - break; - case 176954: //Golemagg - RuneTheri = pGo->GetGUID(); - break; - case 176955: //Garr - RuneBlaz = pGo->GetGUID(); - break; - case 176956: //Magmadar - RuneKress = pGo->GetGUID(); - break; - case 176957: //Gehennas - RuneMohn = pGo->GetGUID(); - break; - case 179703: - m_uiFirelordCacheGUID = pGo->GetGUID(); //when majordomo event == DONE DoRespawnGameObject(m_uiFirelordCacheGUID,); - break; - } - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) - { - case ID_LUCIFRON: - Lucifron = pCreature->GetGUID(); - break; - - case ID_MAGMADAR: - Magmadar = pCreature->GetGUID(); - break; - - case ID_GEHENNAS: - Gehennas = pCreature->GetGUID(); - break; - - case ID_GARR: - Garr = pCreature->GetGUID(); - break; - - case ID_GEDDON: - Geddon = pCreature->GetGUID(); - break; - - case ID_SHAZZRAH: - Shazzrah = pCreature->GetGUID(); - break; - - case ID_SULFURON: - Sulfuron = pCreature->GetGUID(); - break; - - case ID_GOLEMAGG: - Golemagg = pCreature->GetGUID(); - break; - - case ID_DOMO: - Domo = pCreature->GetGUID(); - break; - - case ID_RAGNAROS: - Ragnaros = pCreature->GetGUID(); - break; - - case ID_FLAMEWAKERPRIEST: - FlamewakerPriest = pCreature->GetGUID(); - break; - } - } - - uint64 GetData64 (uint32 identifier) - { - switch(identifier) - { - case DATA_SULFURON: - return Sulfuron; - case DATA_GOLEMAGG: - return Golemagg; - - case DATA_FLAMEWAKERPRIEST: - return FlamewakerPriest; - } - - return 0; - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_LUCIFRONISDEAD: - if (IsBossDied[0]) - return 1; - break; - - case DATA_MAGMADARISDEAD: - if (IsBossDied[1]) - return 1; - break; - - case DATA_GEHENNASISDEAD: - if (IsBossDied[2]) - return 1; - break; - - case DATA_GARRISDEAD: - if (IsBossDied[3]) - return 1; - break; - - case DATA_GEDDONISDEAD: - if (IsBossDied[4]) - return 1; - break; - - case DATA_SHAZZRAHISDEAD: - if (IsBossDied[5]) - return 1; - break; - - case DATA_SULFURONISDEAD: - if (IsBossDied[6]) - return 1; - break; - - case DATA_GOLEMAGGISDEAD: - if (IsBossDied[7]) - return 1; - break; - - case DATA_MAJORDOMOISDEAD: - if (IsBossDied[8]) - return 1; - break; - } - - return 0; - } - - void SetData(uint32 type, uint32 /*data*/) - { - if (type == DATA_GOLEMAGG_DEATH) - IsBossDied[7] = true; - } }; -InstanceData* GetInstance_instance_molten_core(Map* pMap) -{ - return new instance_molten_core (pMap); -} void AddSC_instance_molten_core() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_molten_core"; - newscript->GetInstanceData = &GetInstance_instance_molten_core; - newscript->RegisterSelf(); + new instance_molten_core(); } - diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp index 5a77af76d63..bae4b1fe19c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp @@ -40,44 +40,44 @@ EndContentData */ #define SPELL_WITHERING_HEAT 19367 #define SPELL_ANCIENT_DESPAIR 19369 #define SPELL_ANCIENT_HYSTERIA 19372 - -CreatureAI* GetAI_mob_ancient_core_hound(Creature* pCreature) + class mob_ancient_core_hound : public CreatureScript { - SimpleAI *ai = new SimpleAI(pCreature); +public: + mob_ancient_core_hound() : CreatureScript("mob_ancient_core_hound") { } - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; - ai->Spell[0].Cooldown = 7000; - ai->Spell[0].First_Cast = 10000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + CreatureAI* GetAI(Creature* pCreature) const + { + SimpleAI *ai = new SimpleAI(pCreature); - uint32 RandDebuff = RAND(SPELL_GROUND_STOMP,SPELL_ANCIENT_DREAD,SPELL_CAUTERIZING_FLAMES, - SPELL_WITHERING_HEAT,SPELL_ANCIENT_DESPAIR,SPELL_ANCIENT_HYSTERIA); + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; + ai->Spell[0].Cooldown = 7000; + ai->Spell[0].First_Cast = 10000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->Spell[1].Enabled = true; - ai->Spell[1].Spell_Id = RandDebuff; - ai->Spell[1].Cooldown = 24000; - ai->Spell[1].First_Cast = 15000; - ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; + uint32 RandDebuff = RAND(SPELL_GROUND_STOMP,SPELL_ANCIENT_DREAD,SPELL_CAUTERIZING_FLAMES, + SPELL_WITHERING_HEAT,SPELL_ANCIENT_DESPAIR,SPELL_ANCIENT_HYSTERIA); - ai->Spell[2].Enabled = true; - ai->Spell[2].Spell_Id = SPELL_BITE; - ai->Spell[2].Cooldown = 6000; - ai->Spell[2].First_Cast = 4000; - ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; + ai->Spell[1].Enabled = true; + ai->Spell[1].Spell_Id = RandDebuff; + ai->Spell[1].Cooldown = 24000; + ai->Spell[1].First_Cast = 15000; + ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - ai->EnterEvadeMode(); + ai->Spell[2].Enabled = true; + ai->Spell[2].Spell_Id = SPELL_BITE; + ai->Spell[2].Cooldown = 6000; + ai->Spell[2].First_Cast = 4000; + ai->Spell[2].Cast_Target_Type = CAST_HOSTILE_TARGET; - return ai; -} + ai->EnterEvadeMode(); + + return ai; + } + +}; void AddSC_molten_core() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_ancient_core_hound"; - newscript->GetAI = &GetAI_mob_ancient_core_hound; - newscript->RegisterSelf(); + new mob_ancient_core_hound(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index f97b7faaec4..0345810478b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -89,220 +89,240 @@ enum UnworthyInitiatePhase PHASE_TO_ATTACK, PHASE_ATTACKING, }; - -struct npc_unworthy_initiateAI : public ScriptedAI + class npc_unworthy_initiate : public CreatureScript { - npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) +public: + npc_unworthy_initiate() : CreatureScript("npc_unworthy_initiate") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->SetReactState(REACT_PASSIVE); - if (!me->GetEquipmentId()) - if (const CreatureInfo *info = GetCreatureInfo(28406)) - if (info->equipmentId) - const_cast(me->GetCreatureInfo())->equipmentId = info->equipmentId; + return new npc_unworthy_initiateAI(pCreature); } - uint64 playerGUID; - UnworthyInitiatePhase phase; - uint32 wait_timer; - float anchorX, anchorY; - uint64 anchorGUID; - - EventMap events; - - void Reset() + struct npc_unworthy_initiateAI : public ScriptedAI { - anchorGUID = 0; - phase = PHASE_CHAINED; - events.Reset(); - me->setFaction(7); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); - me->LoadEquipment(0, true); - } + npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) + { + me->SetReactState(REACT_PASSIVE); + if (!me->GetEquipmentId()) + if (const CreatureInfo *info = GetCreatureInfo(28406)) + if (info->equipmentId) + const_cast(me->GetCreatureInfo())->equipmentId = info->equipmentId; + } - void EnterCombat(Unit * /*who*/) - { - events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); - events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - } + uint64 playerGUID; + UnworthyInitiatePhase phase; + uint32 wait_timer; + float anchorX, anchorY; + uint64 anchorGUID; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + EventMap events; - if (id == 1) + void Reset() + { + anchorGUID = 0; + phase = PHASE_CHAINED; + events.Reset(); + me->setFaction(7); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); + me->LoadEquipment(0, true); + } + + void EnterCombat(Unit * /*who*/) + { + events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); + events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) + { + wait_timer = 5000; + me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true); + + if (Player* starter = Unit::GetPlayer(*me, playerGUID)) + DoScriptText(say_event_attack[rand()%9], me, starter); + + phase = PHASE_TO_ATTACK; + } + } + + void EventStart(Creature* anchor, Player *pTarget) { wait_timer = 5000; - me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true); + phase = PHASE_TO_EQUIP; - if (Player* starter = Unit::GetPlayer(*me, playerGUID)) - DoScriptText(say_event_attack[rand()%9], me, starter); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); + me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); - phase = PHASE_TO_ATTACK; + float z; + anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f); + + playerGUID = pTarget->GetGUID(); + DoScriptText(say_event_start[rand()%8], me, pTarget); } - } - void EventStart(Creature* anchor, Player *pTarget) - { - wait_timer = 5000; - phase = PHASE_TO_EQUIP; - - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); - me->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); - - float z; - anchor->GetContactPoint(me, anchorX, anchorY, z, 1.0f); - - playerGUID = pTarget->GetGUID(); - DoScriptText(say_event_start[rand()%8], me, pTarget); - } - - void UpdateAI(const uint32 diff); -}; - -CreatureAI* GetAI_npc_unworthy_initiate(Creature* pCreature) -{ - return new npc_unworthy_initiateAI(pCreature); -} - -struct npc_unworthy_initiate_anchorAI : public PassiveAI -{ - npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} - - uint64 prisonerGUID; - - void SetGUID(const uint64 &guid, int32 /*id*/) - { - if (!prisonerGUID) - prisonerGUID = guid; - } - - uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } -}; - -void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) -{ - switch(phase) - { - case PHASE_CHAINED: - if (!anchorGUID) + void UpdateAI(const uint32 diff) { - if (Creature *anchor = me->FindNearestCreature(29521, 30)) + switch(phase) { - anchor->AI()->SetGUID(me->GetGUID()); - anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); - anchorGUID = anchor->GetGUID(); - } - else - sLog.outError("npc_unworthy_initiateAI: unable to find anchor!"); - - float dist = 99.0f; - GameObject *prison = NULL; - - for (uint8 i = 0; i < 12; ++i) - { - if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30)) + case PHASE_CHAINED: + if (!anchorGUID) { - if (me->IsWithinDist(temp_prison, dist, false)) + if (Creature *anchor = me->FindNearestCreature(29521, 30)) { - dist = me->GetDistance2d(temp_prison); - prison = temp_prison; + anchor->AI()->SetGUID(me->GetGUID()); + anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); + anchorGUID = anchor->GetGUID(); + } + else + sLog.outError("npc_unworthy_initiateAI: unable to find anchor!"); + + float dist = 99.0f; + GameObject *prison = NULL; + + for (uint8 i = 0; i < 12; ++i) + { + if (GameObject* temp_prison = me->FindNearestGameObject(acherus_soul_prison[i],30)) + { + if (me->IsWithinDist(temp_prison, dist, false)) + { + dist = me->GetDistance2d(temp_prison); + prison = temp_prison; + } + } + } + + if (prison) + prison->ResetDoorOrButton(); + else + sLog.outError("npc_unworthy_initiateAI: unable to find prison!"); + } + return; + case PHASE_TO_EQUIP: + if (wait_timer) + { + if (wait_timer > diff) + wait_timer -= diff; + else + { + me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); + //sLog.outDebug("npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); + phase = PHASE_EQUIPING; + wait_timer = 0; } } - } - - if (prison) - prison->ResetDoorOrButton(); - else - sLog.outError("npc_unworthy_initiateAI: unable to find prison!"); - } - return; - case PHASE_TO_EQUIP: - if (wait_timer) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); - //sLog.outDebug("npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); - phase = PHASE_EQUIPING; - wait_timer = 0; + return; + case PHASE_TO_ATTACK: + if (wait_timer) + { + if (wait_timer > diff) + wait_timer -= diff; + else + { + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + phase = PHASE_ATTACKING; + + if (Player *pTarget = Unit::GetPlayer(*me, playerGUID)) + me->AI()->AttackStart(pTarget); + wait_timer = 0; + } + } + return; + case PHASE_ATTACKING: + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ICY_TOUCH: + DoCast(me->getVictim(), SPELL_ICY_TOUCH); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); + break; + case EVENT_PLAGUE_STRIKE: + DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); + break; + case EVENT_BLOOD_STRIKE: + DoCast(me->getVictim(), SPELL_BLOOD_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); + break; + case EVENT_DEATH_COIL: + DoCast(me->getVictim(), SPELL_DEATH_COIL); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); + break; + } + } + + DoMeleeAttackIfReady(); } } - return; - case PHASE_TO_ATTACK: - if (wait_timer) - { - if (wait_timer > diff) - wait_timer -= diff; - else - { - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - phase = PHASE_ATTACKING; + }; - if (Player *pTarget = Unit::GetPlayer(*me, playerGUID)) - me->AI()->AttackStart(pTarget); - wait_timer = 0; - } - } - return; - case PHASE_ATTACKING: - if (!UpdateVictim()) - return; +}; - events.Update(diff); + class npc_unworthy_initiate_anchor : public CreatureScript +{ +public: + npc_unworthy_initiate_anchor() : CreatureScript("npc_unworthy_initiate_anchor") { } - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_ICY_TOUCH: - DoCast(me->getVictim(), SPELL_ICY_TOUCH); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); - break; - case EVENT_PLAGUE_STRIKE: - DoCast(me->getVictim(), SPELL_PLAGUE_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); - break; - case EVENT_BLOOD_STRIKE: - DoCast(me->getVictim(), SPELL_BLOOD_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); - break; - case EVENT_DEATH_COIL: - DoCast(me->getVictim(), SPELL_DEATH_COIL); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - break; - } - } - - DoMeleeAttackIfReady(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_unworthy_initiate_anchorAI(pCreature); } -} -CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature* pCreature) + struct npc_unworthy_initiate_anchorAI : public PassiveAI + { + npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} + + uint64 prisonerGUID; + + void SetGUID(const uint64 &guid, int32 /*id*/) + { + if (!prisonerGUID) + prisonerGUID = guid; + } + + uint64 GetGUID(int32 /*id*/) { return prisonerGUID; } + }; + +}; + + + + class go_acherus_soul_prison : public GameObjectScript { - return new npc_unworthy_initiate_anchorAI(pCreature); -} +public: + go_acherus_soul_prison() : GameObjectScript("go_acherus_soul_prison") { } -bool GOHello_go_acherus_soul_prison(Player* pPlayer, GameObject* pGo) -{ - if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) - if (uint64 prisonerGUID = anchor->AI()->GetGUID()) - if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) - CAST_AI(npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, pPlayer); + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) + if (uint64 prisonerGUID = anchor->AI()->GetGUID()) + if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) + CAST_AI(npc_unworthy_initiate::npc_unworthy_initiateAI, prisoner->AI())->EventStart(anchor, pPlayer); - return false; -} + return false; + } + +}; /*###### ## npc_death_knight_initiate @@ -335,154 +355,163 @@ int32 m_auiRandomSay[] = { SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I }; - -struct npc_death_knight_initiateAI : public CombatAI + class npc_death_knight_initiate : public CreatureScript { - npc_death_knight_initiateAI(Creature* pCreature) : CombatAI(pCreature) +public: + npc_death_knight_initiate() : CreatureScript("npc_death_knight_initiate") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_bIsDuelInProgress = false; - } - - bool lose; - uint64 m_uiDuelerGUID; - uint32 m_uiDuelTimer; - bool m_bIsDuelInProgress; - - void Reset() - { - lose = false; - me->RestoreFaction(); - CombatAI::Reset(); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - - m_uiDuelerGUID = 0; - m_uiDuelTimer = 5000; - m_bIsDuelInProgress = false; - } - - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL) + if (uiAction == GOSSIP_ACTION_INFO_DEF) { - m_uiDuelerGUID = pCaster->GetGUID(); - m_bIsDuelInProgress = true; - } - } + pPlayer->CLOSE_GOSSIP_MENU(); - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) - { - if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help - uiDamage = 0; - else if (uiDamage >= me->GetHealth()) + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; + + if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiate::npc_death_knight_initiateAI, pCreature->AI())) { - uiDamage = 0; + if (pInitiateAI->m_bIsDuelInProgress) + return true; + } - if (!lose) + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + + int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); + DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); + + pPlayer->CastSpell(pCreature, SPELL_DUEL, false); + pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) + { + if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) + return true; + + if (pPlayer->isInCombat() || pCreature->isInCombat()) + return true; + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature),pCreature->GetGUID()); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_death_knight_initiateAI(pCreature); + } + + struct npc_death_knight_initiateAI : public CombatAI + { + npc_death_knight_initiateAI(Creature* pCreature) : CombatAI(pCreature) + { + m_bIsDuelInProgress = false; + } + + bool lose; + uint64 m_uiDuelerGUID; + uint32 m_uiDuelTimer; + bool m_bIsDuelInProgress; + + void Reset() + { + lose = false; + me->RestoreFaction(); + CombatAI::Reset(); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); + + m_uiDuelerGUID = 0; + m_uiDuelTimer = 5000; + m_bIsDuelInProgress = false; + } + + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + { + if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL) + { + m_uiDuelerGUID = pCaster->GetGUID(); + m_bIsDuelInProgress = true; + } + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) + { + if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help + uiDamage = 0; + else if (uiDamage >= me->GetHealth()) { - pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); - pDoneBy->AttackStop(); - me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); - lose = true; - me->CastSpell(me, 7267, true); - me->RestoreFaction(); + uiDamage = 0; + + if (!lose) + { + pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); + pDoneBy->AttackStop(); + me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); + lose = true; + me->CastSpell(me, 7267, true); + me->RestoreFaction(); + } } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void UpdateAI(const uint32 uiDiff) { + if (!UpdateVictim()) + { + if (m_bIsDuelInProgress) + { + if (m_uiDuelTimer <= uiDiff) + { + me->setFaction(FACTION_HOSTILE); + + if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID)) + AttackStart(pUnit); + } + else + m_uiDuelTimer -= uiDiff; + } + return; + } + if (m_bIsDuelInProgress) { - if (m_uiDuelTimer <= uiDiff) + if (lose) { - me->setFaction(FACTION_HOSTILE); - - if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID)) - AttackStart(pUnit); + if (!me->HasAura(7267)) + EnterEvadeMode(); + return; } - else - m_uiDuelTimer -= uiDiff; - } - return; - } - - if (m_bIsDuelInProgress) - { - if (lose) - { - if (!me->HasAura(7267)) + else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER + && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) + { + me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg + me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); EnterEvadeMode(); - return; - } - else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER - && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) - { - me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg - me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); - EnterEvadeMode(); - return; + return; + } } + + // TODO: spells + + CombatAI::UpdateAI(uiDiff); } + }; - // TODO: spells - - CombatAI::UpdateAI(uiDiff); - } }; -CreatureAI* GetAI_npc_death_knight_initiate(Creature* pCreature) -{ - return new npc_death_knight_initiateAI(pCreature); -} -bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) - { - if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) - return true; - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature),pCreature->GetGUID()); - } - return true; -} - -bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) - { - if (pInitiateAI->m_bIsDuelInProgress) - return true; - } - - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - - int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); - DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); - - pPlayer->CastSpell(pCreature, SPELL_DUEL, false); - pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); - } - return true; -} /*###### ## npc_dark_rider_of_acherus @@ -490,78 +519,85 @@ bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature #define DESPAWN_HORSE 52267 #define SAY_DARK_RIDER "The realm of shadows awaits..." - -struct npc_dark_rider_of_acherusAI : public ScriptedAI + class npc_dark_rider_of_acherus : public CreatureScript { - npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} +public: + npc_dark_rider_of_acherus() : CreatureScript("npc_dark_rider_of_acherus") { } - uint32 PhaseTimer; - uint32 Phase; - bool Intro; - uint64 TargetGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PhaseTimer = 4000; - Phase = 0; - Intro = false; - TargetGUID = 0; + return new npc_dark_rider_of_acherusAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_dark_rider_of_acherusAI : public ScriptedAI { - if (!Intro || !TargetGUID) - return; + npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} - if (PhaseTimer <= diff) + uint32 PhaseTimer; + uint32 Phase; + bool Intro; + uint64 TargetGUID; + + void Reset() { - switch(Phase) + PhaseTimer = 4000; + Phase = 0; + Intro = false; + TargetGUID = 0; + } + + void UpdateAI(const uint32 diff) + { + if (!Intro || !TargetGUID) + return; + + if (PhaseTimer <= diff) { - case 0: - me->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0); - PhaseTimer = 5000; - Phase = 1; - break; - case 1: - if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) - DoCast(pTarget, DESPAWN_HORSE, true); - PhaseTimer = 3000; - Phase = 2; - break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - PhaseTimer = 2000; - Phase = 3; - break; - case 3: - me->ForcedDespawn(); - break; - default: - break; - } - } else PhaseTimer -= diff; + switch(Phase) + { + case 0: + me->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0); + PhaseTimer = 5000; + Phase = 1; + break; + case 1: + if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID)) + DoCast(pTarget, DESPAWN_HORSE, true); + PhaseTimer = 3000; + Phase = 2; + break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + PhaseTimer = 2000; + Phase = 3; + break; + case 3: + me->ForcedDespawn(); + break; + default: + break; + } + } else PhaseTimer -= diff; - } + } - void InitDespawnHorse(Unit *who) - { - if (!who) - return; + void InitDespawnHorse(Unit *who) + { + if (!who) + return; - TargetGUID = who->GetGUID(); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetSpeed(MOVE_RUN, 0.4f); - me->GetMotionMaster()->MoveChase(who); - me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); - Intro = true; - } + TargetGUID = who->GetGUID(); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetSpeed(MOVE_RUN, 0.4f); + me->GetMotionMaster()->MoveChase(who); + me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID); + Intro = true; + } + + }; }; -CreatureAI* GetAI_npc_dark_rider_of_acherus(Creature* pCreature) -{ - return new npc_dark_rider_of_acherusAI(pCreature); -} /*###### ## npc_salanar_the_horseman @@ -575,222 +611,250 @@ enum eSalanar CALL_DARK_RIDER = 52266, SPELL_EFFECT_OVERTAKE = 52349 }; - -struct npc_salanar_the_horsemanAI : public ScriptedAI + class npc_salanar_the_horseman : public CreatureScript { - npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} +public: + npc_salanar_the_horseman() : CreatureScript("npc_salanar_the_horseman") { } - void SpellHit(Unit *caster, const SpellEntry *spell) + CreatureAI* GetAI(Creature* pCreature) const { - if (spell->Id == DELIVER_STOLEN_HORSE) - { - if (caster->GetTypeId() == TYPEID_UNIT && caster->IsVehicle()) - { - if (Unit *charmer = caster->GetCharmer()) - { - charmer->RemoveAurasDueToSpell(EFFECT_STOLEN_HORSE); - caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - caster->setFaction(35); - DoCast(caster, CALL_DARK_RIDER, true); - if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15)) - CAST_AI(npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); - } - } - } + return new npc_salanar_the_horsemanAI(pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_salanar_the_horsemanAI : public ScriptedAI { - ScriptedAI::MoveInLineOfSight(who); + npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} - if (who->GetTypeId() == TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f)) + void SpellHit(Unit *caster, const SpellEntry *spell) { - if (Unit *charmer = who->GetCharmer()) + if (spell->Id == DELIVER_STOLEN_HORSE) { - if (charmer->GetTypeId() == TYPEID_PLAYER) + if (caster->GetTypeId() == TYPEID_UNIT && caster->IsVehicle()) { - // for quest Into the Realm of Shadows(12687) - if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) + if (Unit *charmer = caster->GetCharmer()) { - CAST_PLR(charmer)->GroupEventHappens(12687, me); - charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); - CAST_CRE(who)->ForcedDespawn(); - //CAST_CRE(who)->Respawn(true); + charmer->RemoveAurasDueToSpell(EFFECT_STOLEN_HORSE); + caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + caster->setFaction(35); + DoCast(caster, CALL_DARK_RIDER, true); + if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15)) + CAST_AI(npc_dark_rider_of_acherus::npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); } - - if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) - charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); } } } - } + + void MoveInLineOfSight(Unit *who) + { + ScriptedAI::MoveInLineOfSight(who); + + if (who->GetTypeId() == TYPEID_UNIT && who->IsVehicle() && me->IsWithinDistInMap(who, 5.0f)) + { + if (Unit *charmer = who->GetCharmer()) + { + if (charmer->GetTypeId() == TYPEID_PLAYER) + { + // for quest Into the Realm of Shadows(12687) + if (me->GetEntry() == 28788 && CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) + { + CAST_PLR(charmer)->GroupEventHappens(12687, me); + charmer->RemoveAurasDueToSpell(SPELL_EFFECT_OVERTAKE); + CAST_CRE(who)->ForcedDespawn(); + //CAST_CRE(who)->Respawn(true); + } + + if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) + charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); + } + } + } + } + }; + }; -CreatureAI* GetAI_npc_salanar_the_horseman(Creature* pCreature) -{ - return new npc_salanar_the_horsemanAI(pCreature); -} /*###### ## npc_ros_dark_rider ######*/ - -struct npc_ros_dark_riderAI : public ScriptedAI + class npc_ros_dark_rider : public CreatureScript { - npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} +public: + npc_ros_dark_rider() : CreatureScript("npc_ros_dark_rider") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - me->ExitVehicle(); + return new npc_ros_dark_riderAI(pCreature); } - void Reset() + struct npc_ros_dark_riderAI : public ScriptedAI { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - deathcharger->RestoreFaction(); - deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0)) - me->EnterVehicle(deathcharger); - } + npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit *killer) - { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) + void EnterCombat(Unit * /*who*/) { - deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathcharger->setFaction(2096); + me->ExitVehicle(); } - } + + void Reset() + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + deathcharger->RestoreFaction(); + deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (!me->GetVehicle() && deathcharger->IsVehicle() && deathcharger->GetVehicleKit()->HasEmptySeat(0)) + me->EnterVehicle(deathcharger); + } + + void JustDied(Unit *killer) + { + Creature* deathcharger = me->FindNearestCreature(28782, 30); + if (!deathcharger) return; + if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->IsVehicle()) + { + deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + deathcharger->setFaction(2096); + } + } + }; + }; -CreatureAI* GetAI_npc_ros_dark_rider(Creature* pCreature) -{ - return new npc_ros_dark_riderAI(pCreature); -} // correct way: 52312 52314 52555 ... enum SG { GHOULS = 28845, GHOSTS = 28846, -}; -struct npc_dkc1_gothikAI : public ScriptedAI +}; class npc_dkc1_gothik : public CreatureScript { - npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} +public: + npc_dkc1_gothik() : CreatureScript("npc_dkc1_gothik") { } - void MoveInLineOfSight(Unit *who) + CreatureAI* GetAI(Creature* pCreature) const { - ScriptedAI::MoveInLineOfSight(who); + return new npc_dkc1_gothikAI(pCreature); + } - if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) + struct npc_dkc1_gothikAI : public ScriptedAI + { + npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} + + void MoveInLineOfSight(Unit *who) { - if (Unit *owner = who->GetOwner()) - { - if (owner->GetTypeId() == TYPEID_PLAYER) - { - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) - { - //CAST_CRE(who)->CastSpell(owner, 52517, true); - CAST_PLR(owner)->KilledMonsterCredit(GHOULS, me->GetGUID()); - } - //Todo: Creatures must not be removed, but, must instead - // stand next to Gothik and be commanded into the pit - // and dig into the ground. - CAST_CRE(who)->ForcedDespawn(); + ScriptedAI::MoveInLineOfSight(who); - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) - owner->RemoveAllMinionsByEntry(GHOULS); + if (who->GetEntry() == GHOULS && me->IsWithinDistInMap(who, 10.0f)) + { + if (Unit *owner = who->GetOwner()) + { + if (owner->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) + { + //CAST_CRE(who)->CastSpell(owner, 52517, true); + CAST_PLR(owner)->KilledMonsterCredit(GHOULS, me->GetGUID()); + } + //Todo: Creatures must not be removed, but, must instead + // stand next to Gothik and be commanded into the pit + // and dig into the ground. + CAST_CRE(who)->ForcedDespawn(); + + if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE) + owner->RemoveAllMinionsByEntry(GHOULS); + } } } } - } + }; + }; -CreatureAI* GetAI_npc_dkc1_gothik(Creature* pCreature) + class npc_scarlet_ghoul : public CreatureScript { - return new npc_dkc1_gothikAI(pCreature); -} +public: + npc_scarlet_ghoul() : CreatureScript("npc_scarlet_ghoul") { } -struct npc_scarlet_ghoulAI : public ScriptedAI -{ - npc_scarlet_ghoulAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - // Ghouls should display their Birth Animation - // Crawling out of the ground - //DoCast(me, 35177, true); - //me->MonsterSay("Mommy?",LANG_UNIVERSAL,0); - me->SetReactState(REACT_DEFENSIVE); + return new npc_scarlet_ghoulAI(pCreature); } - void FindMinions(Unit *owner) + struct npc_scarlet_ghoulAI : public ScriptedAI { - std::list MinionList; - owner->GetAllMinionsByEntry(MinionList,GHOULS); - - if (!MinionList.empty()) + npc_scarlet_ghoulAI(Creature *c) : ScriptedAI(c) { - for (std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) - { - if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) - { - if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper()) - { - AttackStart(CAST_CRE(*itr)->getAttackerForHelper()); - } - } - } + // Ghouls should display their Birth Animation + // Crawling out of the ground + //DoCast(me, 35177, true); + //me->MonsterSay("Mommy?",LANG_UNIVERSAL,0); + me->SetReactState(REACT_DEFENSIVE); } - } - void UpdateAI(const uint32 /*diff*/) - { - if (!me->isInCombat()) + void FindMinions(Unit *owner) { - if (Unit *owner = me->GetOwner()) + std::list MinionList; + owner->GetAllMinionsByEntry(MinionList,GHOULS); + + if (!MinionList.empty()) { - if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat()) + for (std::list::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr) { - if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS) + if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID()) { - AttackStart(CAST_PLR(owner)->getAttackerForHelper()); - } - else - { - FindMinions(owner); + if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper()) + { + AttackStart(CAST_CRE(*itr)->getAttackerForHelper()); + } } } } } - if (!UpdateVictim()) - return; - - //ScriptedAI::UpdateAI(diff); - //Check if we have a current target - if (me->getVictim()->GetEntry() == GHOSTS) + void UpdateAI(const uint32 /*diff*/) { - if (me->isAttackReady()) + if (!me->isInCombat()) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) + if (Unit *owner = me->GetOwner()) { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat()) + { + if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS) + { + AttackStart(CAST_PLR(owner)->getAttackerForHelper()); + } + else + { + FindMinions(owner); + } + } + } + } + + if (!UpdateVictim()) + return; + + //ScriptedAI::UpdateAI(diff); + //Check if we have a current target + if (me->getVictim()->GetEntry() == GHOSTS) + { + if (me->isAttackReady()) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } } } } - } + }; + }; -CreatureAI* GetAI_npc_scarlet_ghoul(Creature* pCreature) -{ - return new npc_scarlet_ghoulAI(pCreature); -} /*#### ## npc_scarlet_miner_cart @@ -798,46 +862,53 @@ CreatureAI* GetAI_npc_scarlet_ghoul(Creature* pCreature) #define SPELL_CART_CHECK 54173 #define SPELL_CART_DRAG 52465 - -struct npc_scarlet_miner_cartAI : public PassiveAI + class npc_scarlet_miner_cart : public CreatureScript { - npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) +public: + npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } + + CreatureAI* GetAI(Creature *_Creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse + return new npc_scarlet_miner_cartAI(_Creature); } - uint64 minerGUID; - - void SetGUID(const uint64 &guid, int32 /*id*/) + struct npc_scarlet_miner_cartAI : public PassiveAI { - minerGUID = guid; - } - - void DoAction(const int32 /*param*/) - { - if (Creature *miner = Unit::GetCreature(*me, minerGUID)) + npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) { - // very bad visual effect - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); - me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); - me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // H0 is horse } - } - void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool apply) - { - if (!apply) + uint64 minerGUID; + + void SetGUID(const uint64 &guid, int32 /*id*/) + { + minerGUID = guid; + } + + void DoAction(const int32 /*param*/) + { if (Creature *miner = Unit::GetCreature(*me, minerGUID)) - miner->DisappearAndDie(); - } + { + // very bad visual effect + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); + me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); + me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + } + } + + void PassengerBoarded(Unit * /*who*/, int8 /*seatId*/, bool apply) + { + if (!apply) + if (Creature *miner = Unit::GetCreature(*me, minerGUID)) + miner->DisappearAndDie(); + } + }; + }; -CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) -{ - return new npc_scarlet_miner_cartAI(_Creature); -} /*#### ## npc_scarlet_miner @@ -845,234 +916,183 @@ CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) #define SAY_SCARLET_MINER1 "Where'd this come from? I better get this down to the ships before the foreman sees it!" #define SAY_SCARLET_MINER2 "Now I can have a rest!" - -struct npc_scarlet_minerAI : public npc_escortAI + class npc_scarlet_miner : public CreatureScript { - npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) +public: + npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } + + CreatureAI* GetAI(Creature *_Creature) { - me->SetReactState(REACT_PASSIVE); + return new npc_scarlet_minerAI(_Creature); } - uint32 IntroTimer; - uint32 IntroPhase; - uint64 carGUID; - - void Reset() + struct npc_scarlet_minerAI : public npc_escortAI { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; - } - - void InitWaypoint() - { - AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); - AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); - AddWaypoint(3, 2306.561279, -5901.738281, 91.792419); - AddWaypoint(4, 2300.098389, -5912.618652, 86.014885); - AddWaypoint(5, 2294.142090, -5927.274414, 75.316849); - AddWaypoint(6, 2286.984375, -5944.955566, 63.714966); - AddWaypoint(7, 2280.001709, -5961.186035, 54.228283); - AddWaypoint(8, 2259.389648, -5974.197754, 42.359348); - AddWaypoint(9, 2242.882812, -5984.642578, 32.827850); - AddWaypoint(10, 2217.265625, -6028.959473, 7.675705); - AddWaypoint(11, 2202.595947, -6061.325684, 5.882018); - AddWaypoint(12, 2188.974609, -6080.866699, 3.370027); - - if (urand(0,1)) + npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) { - AddWaypoint(13, 2176.483887, -6110.407227, 1.855181); - AddWaypoint(14, 2172.516602, -6146.752441, 1.074235); - AddWaypoint(15, 2138.918457, -6158.920898, 1.342926); - AddWaypoint(16, 2129.866699, -6174.107910, 4.380779); - AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); + me->SetReactState(REACT_PASSIVE); } - else + + uint32 IntroTimer; + uint32 IntroPhase; + uint64 carGUID; + + void Reset() { - AddWaypoint(13, 2184.190186, -6166.447266, 0.968877); - AddWaypoint(14, 2234.265625, -6163.741211, 0.916021); - AddWaypoint(15, 2268.071777, -6158.750977, 1.822252); - AddWaypoint(16, 2270.028320, -6176.505859, 6.340538); - AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; } - } - void InitCartQuest(Player *who) - { - carGUID = who->GetVehicleBase()->GetGUID(); - InitWaypoint(); - Start(false, false, who->GetGUID()); - SetDespawnAtFar(false); - } - - void WaypointReached(uint32 i) - { - switch (i) + void InitWaypoint() { - case 1: - if (Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - } - me->MonsterSay(SAY_SCARLET_MINER1,LANG_UNIVERSAL,NULL); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - case 17: - if (Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->SendMonsterStop(); - //this make player fall under ground, dunno why - //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->RemoveAura(SPELL_CART_DRAG); - } - me->MonsterSay(SAY_SCARLET_MINER2,LANG_UNIVERSAL,NULL); - break; - default: - break; - } - } + AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); + AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); + AddWaypoint(3, 2306.561279, -5901.738281, 91.792419); + AddWaypoint(4, 2300.098389, -5912.618652, 86.014885); + AddWaypoint(5, 2294.142090, -5927.274414, 75.316849); + AddWaypoint(6, 2286.984375, -5944.955566, 63.714966); + AddWaypoint(7, 2280.001709, -5961.186035, 54.228283); + AddWaypoint(8, 2259.389648, -5974.197754, 42.359348); + AddWaypoint(9, 2242.882812, -5984.642578, 32.827850); + AddWaypoint(10, 2217.265625, -6028.959473, 7.675705); + AddWaypoint(11, 2202.595947, -6061.325684, 5.882018); + AddWaypoint(12, 2188.974609, -6080.866699, 3.370027); - void UpdateAI(const uint32 diff) - { - if (IntroPhase) - { - if (IntroTimer <= diff) + if (urand(0,1)) { - if (IntroPhase == 1) - { - if (Creature *car = Unit::GetCreature(*me, carGUID)) - DoCast(car, SPELL_CART_DRAG); - IntroTimer = 800; - IntroPhase = 2; - } - else - { - if (Creature *car = Unit::GetCreature(*me, carGUID)) - car->AI()->DoAction(); - IntroPhase = 0; - } - } else IntroTimer-=diff; + AddWaypoint(13, 2176.483887, -6110.407227, 1.855181); + AddWaypoint(14, 2172.516602, -6146.752441, 1.074235); + AddWaypoint(15, 2138.918457, -6158.920898, 1.342926); + AddWaypoint(16, 2129.866699, -6174.107910, 4.380779); + AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); + } + else + { + AddWaypoint(13, 2184.190186, -6166.447266, 0.968877); + AddWaypoint(14, 2234.265625, -6163.741211, 0.916021); + AddWaypoint(15, 2268.071777, -6158.750977, 1.822252); + AddWaypoint(16, 2270.028320, -6176.505859, 6.340538); + AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); + } } - npc_escortAI::UpdateAI(diff); - } + + void InitCartQuest(Player *who) + { + carGUID = who->GetVehicleBase()->GetGUID(); + InitWaypoint(); + Start(false, false, who->GetGUID()); + SetDespawnAtFar(false); + } + + void WaypointReached(uint32 i) + { + switch (i) + { + case 1: + if (Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + } + me->MonsterSay(SAY_SCARLET_MINER1,LANG_UNIVERSAL,NULL); + SetRun(true); + IntroTimer = 4000; + IntroPhase = 1; + break; + case 17: + if (Unit *car = Unit::GetCreature(*me, carGUID)) + { + me->SetInFront(car); + me->SendMovementFlagUpdate(); + car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->SendMonsterStop(); + //this make player fall under ground, dunno why + //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); + car->RemoveAura(SPELL_CART_DRAG); + } + me->MonsterSay(SAY_SCARLET_MINER2,LANG_UNIVERSAL,NULL); + break; + default: + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (IntroPhase) + { + if (IntroTimer <= diff) + { + if (IntroPhase == 1) + { + if (Creature *car = Unit::GetCreature(*me, carGUID)) + DoCast(car, SPELL_CART_DRAG); + IntroTimer = 800; + IntroPhase = 2; + } + else + { + if (Creature *car = Unit::GetCreature(*me, carGUID)) + car->AI()->DoAction(); + IntroPhase = 0; + } + } else IntroTimer-=diff; + } + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_scarlet_miner(Creature *_Creature) -{ - return new npc_scarlet_minerAI(_Creature); -} /*###### ## go_inconspicuous_mine_car ######*/ #define SPELL_CART_SUMM 52463 - -bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* /*pGO*/) + class go_inconspicuous_mine_car : public GameObjectScript { - if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) +public: + go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { } + + bool OnGossipHello(Player* pPlayer, GameObject* /*pGO*/) { - // Hack Why Trinity Dont Support Custom Summon Location - if (Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) + if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) { - pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); - if (Creature *car = pPlayer->GetVehicleCreatureBase()) + // Hack Why Trinity Dont Support Custom Summon Location + if (Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) { - if (car->GetEntry() == 28817) + pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); + if (Creature *car = pPlayer->GetVehicleCreatureBase()) { - car->AI()->SetGUID(miner->GetGUID()); - CAST_AI(npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car vehicle entry is not correct."); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car player is not on the vehicle."); - } else sLog.outError("TSCR: GOHello_go_inconspicuous_mine_car Scarlet Miner cant be found by script."); + if (car->GetEntry() == 28817) + { + car->AI()->SetGUID(miner->GetGUID()); + CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); + } else sLog.outError("TSCR: OnGossipHello vehicle entry is not correct."); + } else sLog.outError("TSCR: OnGossipHello player is not on the vehicle."); + } else sLog.outError("TSCR: OnGossipHello Scarlet Miner cant be found by script."); + } + return true; } - return true; -} + +}; // npc 28912 quest 17217 boss 29001 mob 29007 go 191092 void AddSC_the_scarlet_enclave_c1() { - Script *newscript; - - // 12848 The Endless Hunger - newscript = new Script; - newscript->Name = "npc_unworthy_initiate"; - newscript->GetAI = &GetAI_npc_unworthy_initiate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_unworthy_initiate_anchor"; - newscript->GetAI = &GetAI_npc_unworthy_initiate_anchor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_acherus_soul_prison"; - newscript->pGOHello = &GOHello_go_acherus_soul_prison; - newscript->RegisterSelf(); - - // Death's Challenge - newscript = new Script; - newscript->Name = "npc_death_knight_initiate"; - newscript->GetAI = &GetAI_npc_death_knight_initiate; - newscript->pGossipHello = &GossipHello_npc_death_knight_initiate; - newscript->pGossipSelect = &GossipSelect_npc_death_knight_initiate; - newscript->RegisterSelf(); - - // 12680 Grand Theft Palomino - newscript = new Script; - newscript->Name = "npc_salanar_the_horseman"; - newscript->GetAI = &GetAI_npc_salanar_the_horseman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dark_rider_of_acherus"; - newscript->GetAI = &GetAI_npc_dark_rider_of_acherus; - newscript->RegisterSelf(); - - // 12687 Into the Realm of Shadows - newscript = new Script; - newscript->Name = "npc_ros_dark_rider"; - newscript->GetAI = &GetAI_npc_ros_dark_rider; - newscript->RegisterSelf(); - - // 12698 The Gift That Keeps On Giving - newscript = new Script; - newscript->Name = "npc_dkc1_gothik"; - newscript->GetAI = &GetAI_npc_dkc1_gothik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_scarlet_ghoul"; - newscript->GetAI = &GetAI_npc_scarlet_ghoul; - newscript->RegisterSelf(); - - // Massacre At Light's Point - newscript = new Script; - newscript->Name = "npc_scarlet_miner"; - newscript->GetAI = &GetAI_npc_scarlet_miner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_scarlet_miner_cart"; - newscript->GetAI = &GetAI_npc_scarlet_miner_cart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_inconspicuous_mine_car"; - newscript->pGOHello = &GOHello_go_inconspicuous_mine_car; - newscript->RegisterSelf(); + new npc_unworthy_initiate(); + new npc_unworthy_initiate_anchor(); + new go_acherus_soul_prison(); + new npc_death_knight_initiate(); + new npc_salanar_the_horseman(); + new npc_dark_rider_of_acherus(); + new npc_ros_dark_rider(); + new npc_dkc1_gothik(); + new npc_scarlet_ghoul(); + new npc_scarlet_miner(); + new npc_scarlet_miner_cart(); + new go_inconspicuous_mine_car(); } - -/* -DELETE FROM `script_texts` WHERE `entry` IN(-1609301, -1609302); -INSERT INTO `script_texts` (`entry`,`content_default`,`type`,`language`,`emote`,`comment`) VALUES -(-1609301, 'Come, weakling! Strike me down!', 0, 0, 0, 'SAY_DEATH_RIDER_FINAL'), -(-1609302, '%s rears up, beckoning you to ride it.', 2, 0, 0, 'SAY_DEATH_CHARGER'); -*/ diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 4f8729bacf4..d7a7942fd3b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -43,96 +43,103 @@ enum win_friends SAY_PERSUADED6 = -1609519, SPELL_PERSUASIVE_STRIKE = 52781 }; - -struct npc_crusade_persuadedAI : public ScriptedAI + class npc_crusade_persuaded : public CreatureScript { - npc_crusade_persuadedAI(Creature *pCreature) : ScriptedAI(pCreature) {} +public: + npc_crusade_persuaded() : CreatureScript("npc_crusade_persuaded") { } - uint32 uiSpeech_timer; - uint32 uiSpeech_counter; - uint64 uiPlayerGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiSpeech_timer = 0; - uiSpeech_counter = 0; - uiPlayerGUID = 0; - me->SetReactState(REACT_AGGRESSIVE); - me->RestoreFaction(); + return new npc_crusade_persuadedAI (pCreature); } - void SpellHit(Unit *caster, const SpellEntry *spell) + struct npc_crusade_persuadedAI : public ScriptedAI { - if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) + npc_crusade_persuadedAI(Creature *pCreature) : ScriptedAI(pCreature) {} + + uint32 uiSpeech_timer; + uint32 uiSpeech_counter; + uint64 uiPlayerGUID; + + void Reset() { - if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE) + uiSpeech_timer = 0; + uiSpeech_counter = 0; + uiPlayerGUID = 0; + me->SetReactState(REACT_AGGRESSIVE); + me->RestoreFaction(); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) { - uiPlayerGUID = caster->GetGUID(); - uiSpeech_timer = 1000; - uiSpeech_counter = 1; - me->setFaction(caster->getFaction()); - me->CombatStop(true); - me->GetMotionMaster()->MoveIdle(); - me->SetReactState(REACT_PASSIVE); - DoCastAOE(58111, true); + if (CAST_PLR(caster)->GetQuestStatus(12720) == QUEST_STATUS_INCOMPLETE) + { + uiPlayerGUID = caster->GetGUID(); + uiSpeech_timer = 1000; + uiSpeech_counter = 1; + me->setFaction(caster->getFaction()); + me->CombatStop(true); + me->GetMotionMaster()->MoveIdle(); + me->SetReactState(REACT_PASSIVE); + DoCastAOE(58111, true); - DoScriptText(RAND(SAY_PERSUADE1,SAY_PERSUADE2,SAY_PERSUADE3, - SAY_PERSUADE4,SAY_PERSUADE5,SAY_PERSUADE6, - SAY_PERSUADE7), caster); + DoScriptText(RAND(SAY_PERSUADE1,SAY_PERSUADE2,SAY_PERSUADE3, + SAY_PERSUADE4,SAY_PERSUADE5,SAY_PERSUADE6, + SAY_PERSUADE7), caster); - DoScriptText(RAND(SAY_CRUSADER1,SAY_CRUSADER2,SAY_CRUSADER3, - SAY_CRUSADER4,SAY_CRUSADER5,SAY_CRUSADER6), me); + DoScriptText(RAND(SAY_CRUSADER1,SAY_CRUSADER2,SAY_CRUSADER3, + SAY_CRUSADER4,SAY_CRUSADER5,SAY_CRUSADER6), me); + } } } - } - void UpdateAI(const uint32 diff) - { - if (uiSpeech_counter) + void UpdateAI(const uint32 diff) { - if (uiSpeech_timer <= diff) + if (uiSpeech_counter) { - Player* pPlayer = Unit::GetPlayer(*me, uiPlayerGUID); - if (!pPlayer) + if (uiSpeech_timer <= diff) { - EnterEvadeMode(); - return; - } - - switch(uiSpeech_counter) - { - case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; - case 2: DoScriptText(SAY_PERSUADED2, me); uiSpeech_timer = 8000; break; - case 3: DoScriptText(SAY_PERSUADED3, me); uiSpeech_timer = 8000; break; - case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break; - case 5: DoScriptText(SAY_PERSUADED5, pPlayer); uiSpeech_timer = 8000; break; - case 6: DoScriptText(SAY_PERSUADED6, me); - pPlayer->Kill(me); - //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiSpeech_counter = 0; - pPlayer->GroupEventHappens(12720, me); + Player* pPlayer = Unit::GetPlayer(*me, uiPlayerGUID); + if (!pPlayer) + { + EnterEvadeMode(); return; - } + } - ++uiSpeech_counter; - DoCastAOE(58111, true); - } else uiSpeech_timer -= diff; + switch(uiSpeech_counter) + { + case 1: DoScriptText(SAY_PERSUADED1, me); uiSpeech_timer = 8000; break; + case 2: DoScriptText(SAY_PERSUADED2, me); uiSpeech_timer = 8000; break; + case 3: DoScriptText(SAY_PERSUADED3, me); uiSpeech_timer = 8000; break; + case 4: DoScriptText(SAY_PERSUADED4, me); uiSpeech_timer = 8000; break; + case 5: DoScriptText(SAY_PERSUADED5, pPlayer); uiSpeech_timer = 8000; break; + case 6: DoScriptText(SAY_PERSUADED6, me); + pPlayer->Kill(me); + //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiSpeech_counter = 0; + pPlayer->GroupEventHappens(12720, me); + return; + } - return; + ++uiSpeech_counter; + DoCastAOE(58111, true); + } else uiSpeech_timer -= diff; + + return; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_crusade_persuaded(Creature* pCreature) -{ - return new npc_crusade_persuadedAI (pCreature); -} /*###### ## npc_koltira_deathweaver @@ -164,168 +171,176 @@ enum eKoltira //NPC_DEATH_KNIGHT_MOUNT = 29201, MODEL_DEATH_KNIGHT_MOUNT = 25278 }; - -struct npc_koltira_deathweaverAI : public npc_escortAI + class npc_koltira_deathweaver : public CreatureScript { - npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) - { - me->SetReactState(REACT_DEFENSIVE); - } +public: + npc_koltira_deathweaver() : CreatureScript("npc_koltira_deathweaver") { } - uint32 m_uiWave; - uint32 m_uiWave_Timer; - uint64 m_uiValrothGUID; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + if (pQuest->GetQuestId() == QUEST_BREAKOUT) { - m_uiWave = 0; - m_uiWave_Timer = 3000; - m_uiValrothGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->LoadEquipment(0, true); - me->RemoveAura(SPELL_ANTI_MAGIC_ZONE); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaver::npc_koltira_deathweaverAI,pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); } + return true; } - void WaypointReached(uint32 uiPointId) + CreatureAI* GetAI(Creature* pCreature) const { - switch(uiPointId) - { - case 0: - DoScriptText(SAY_BREAKOUT1, me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - break; - case 1: - me->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case 2: - me->SetStandState(UNIT_STAND_STATE_STAND); - //me->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not - DoCast(me, SPELL_KOLTIRA_TRANSFORM); - me->LoadEquipment(me->GetEquipmentId()); - break; - case 3: - SetEscortPaused(true); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_BREAKOUT2, me); - DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up - break; - case 4: - SetRun(true); - break; - case 9: - me->Mount(MODEL_DEATH_KNIGHT_MOUNT); - break; - case 10: - me->Unmount(); - break; - } + return new npc_koltira_deathweaverAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct npc_koltira_deathweaverAI : public npc_escortAI { - if (Player* pPlayer = GetPlayerForEscort()) + npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) { - pSummoned->AI()->AttackStart(pPlayer); + me->SetReactState(REACT_DEFENSIVE); } - if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) - m_uiValrothGUID = pSummoned->GetGUID(); + uint32 m_uiWave; + uint32 m_uiWave_Timer; + uint64 m_uiValrothGUID; - pSummoned->AddThreat(me, 0.0f); - pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - void SummonAcolyte(uint32 uiAmount) - { - for (uint32 i = 0; i < uiAmount; ++i) - me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - } - - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - - if (HasEscortState(STATE_ESCORT_PAUSED)) + void Reset() { - if (m_uiWave_Timer <= uiDiff) + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - switch(m_uiWave) - { - case 0: - DoScriptText(SAY_BREAKOUT3, me); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 1: - DoScriptText(SAY_BREAKOUT4, me); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 2: - DoScriptText(SAY_BREAKOUT5, me); - SummonAcolyte(4); - m_uiWave_Timer = 20000; - break; - case 3: - DoScriptText(SAY_BREAKOUT6, me); - me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - m_uiWave_Timer = 1000; - break; - case 4: - { - Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID); - - if (!pTemp || !pTemp->isAlive()) - { - DoScriptText(SAY_BREAKOUT8, me); - m_uiWave_Timer = 5000; - } - else - { - m_uiWave_Timer = 2500; - return; //return, we don't want m_uiWave to increment now - } - break; - } - case 5: - DoScriptText(SAY_BREAKOUT9, me); - me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); - // i do not know why the armor will also be removed - m_uiWave_Timer = 2500; - break; - case 6: - DoScriptText(SAY_BREAKOUT10, me); - SetEscortPaused(false); - break; - } - - ++m_uiWave; + m_uiWave = 0; + m_uiWave_Timer = 3000; + m_uiValrothGUID = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->LoadEquipment(0, true); + me->RemoveAura(SPELL_ANTI_MAGIC_ZONE); } - else - m_uiWave_Timer -= uiDiff; } - } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + DoScriptText(SAY_BREAKOUT1, me); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + break; + case 1: + me->SetStandState(UNIT_STAND_STATE_KNEEL); + break; + case 2: + me->SetStandState(UNIT_STAND_STATE_STAND); + //me->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not + DoCast(me, SPELL_KOLTIRA_TRANSFORM); + me->LoadEquipment(me->GetEquipmentId()); + break; + case 3: + SetEscortPaused(true); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_BREAKOUT2, me); + DoCast(me, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up + break; + case 4: + SetRun(true); + break; + case 9: + me->Mount(MODEL_DEATH_KNIGHT_MOUNT); + break; + case 10: + me->Unmount(); + break; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (Player* pPlayer = GetPlayerForEscort()) + { + pSummoned->AI()->AttackStart(pPlayer); + } + + if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) + m_uiValrothGUID = pSummoned->GetGUID(); + + pSummoned->AddThreat(me, 0.0f); + pSummoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + void SummonAcolyte(uint32 uiAmount) + { + for (uint32 i = 0; i < uiAmount; ++i) + me->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (HasEscortState(STATE_ESCORT_PAUSED)) + { + if (m_uiWave_Timer <= uiDiff) + { + switch(m_uiWave) + { + case 0: + DoScriptText(SAY_BREAKOUT3, me); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 1: + DoScriptText(SAY_BREAKOUT4, me); + SummonAcolyte(3); + m_uiWave_Timer = 20000; + break; + case 2: + DoScriptText(SAY_BREAKOUT5, me); + SummonAcolyte(4); + m_uiWave_Timer = 20000; + break; + case 3: + DoScriptText(SAY_BREAKOUT6, me); + me->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + m_uiWave_Timer = 1000; + break; + case 4: + { + Creature* pTemp = Unit::GetCreature(*me, m_uiValrothGUID); + + if (!pTemp || !pTemp->isAlive()) + { + DoScriptText(SAY_BREAKOUT8, me); + m_uiWave_Timer = 5000; + } + else + { + m_uiWave_Timer = 2500; + return; //return, we don't want m_uiWave to increment now + } + break; + } + case 5: + DoScriptText(SAY_BREAKOUT9, me); + me->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); + // i do not know why the armor will also be removed + m_uiWave_Timer = 2500; + break; + case 6: + DoScriptText(SAY_BREAKOUT10, me); + SetEscortPaused(false); + break; + } + + ++m_uiWave; + } + else + m_uiWave_Timer -= uiDiff; + } + } + }; + }; -CreatureAI* GetAI_npc_koltira_deathweaver(Creature* pCreature) -{ - return new npc_koltira_deathweaverAI(pCreature); -} -bool QuestAccept_npc_koltira_deathweaver(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_BREAKOUT) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaverAI,pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - } - return true; -} //Scarlet courier enum ScarletCourierEnum @@ -336,77 +351,84 @@ enum ScarletCourierEnum GO_INCONSPICUOUS_TREE = 191144, NPC_SCARLET_COURIER = 29076 }; - -struct mob_scarlet_courierAI : public ScriptedAI + class mob_scarlet_courier : public CreatureScript { - mob_scarlet_courierAI(Creature *pCreature) : ScriptedAI(pCreature) {} +public: + mob_scarlet_courier() : CreatureScript("mob_scarlet_courier") { } - uint32 uiStage; - uint32 uiStage_timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->Mount(14338); // not sure about this id - uiStage = 1; - uiStage_timer = 3000; + return new mob_scarlet_courierAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_scarlet_courierAI : public ScriptedAI { - DoScriptText(SAY_TREE2, me); - me->Unmount(); - uiStage = 0; - } + mob_scarlet_courierAI(Creature *pCreature) : ScriptedAI(pCreature) {} - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + uint32 uiStage; + uint32 uiStage_timer; - if (id == 1) - uiStage = 2; - } - - void UpdateAI(const uint32 diff) - { - if (uiStage && !me->isInCombat()) + void Reset() { - if (uiStage_timer <= diff) - { - switch(uiStage) - { - case 1: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) - { - DoScriptText(SAY_TREE1, me); - float x, y, z; - tree->GetContactPoint(me, x, y, z); - me->GetMotionMaster()->MovePoint(1, x, y, z); - } - break; - case 2: - if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) - if (Unit *unit = tree->GetOwner()) - AttackStart(unit); - break; - } - uiStage_timer = 3000; - uiStage = 0; - } else uiStage_timer -= diff; + me->Mount(14338); // not sure about this id + uiStage = 1; + uiStage_timer = 3000; } - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_TREE2, me); + me->Unmount(); + uiStage = 0; + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) + uiStage = 2; + } + + void UpdateAI(const uint32 diff) + { + if (uiStage && !me->isInCombat()) + { + if (uiStage_timer <= diff) + { + switch(uiStage) + { + case 1: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) + { + DoScriptText(SAY_TREE1, me); + float x, y, z; + tree->GetContactPoint(me, x, y, z); + me->GetMotionMaster()->MovePoint(1, x, y, z); + } + break; + case 2: + if (GameObject* tree = me->FindNearestGameObject(GO_INCONSPICUOUS_TREE, 40.0f)) + if (Unit *unit = tree->GetOwner()) + AttackStart(unit); + break; + } + uiStage_timer = 3000; + uiStage = 0; + } else uiStage_timer -= diff; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_scarlet_courier(Creature* pCreature) -{ - return new mob_scarlet_courierAI (pCreature); -} //Koltira & Valroth- Breakout @@ -423,71 +445,78 @@ enum valroth SPELL_VALROTH_SMITE = 52926, SPELL_SUMMON_VALROTH_REMAINS = 52929 }; - -struct mob_high_inquisitor_valrothAI : public ScriptedAI + class mob_high_inquisitor_valroth : public CreatureScript { - mob_high_inquisitor_valrothAI(Creature *pCreature) : ScriptedAI(pCreature) {} +public: + mob_high_inquisitor_valroth() : CreatureScript("mob_high_inquisitor_valroth") { } - uint32 uiRenew_timer; - uint32 uiInquisitor_Penance_timer; - uint32 uiValroth_Smite_timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiRenew_timer = 1000; - uiInquisitor_Penance_timer = 2000; - uiValroth_Smite_timer = 1000; + return new mob_high_inquisitor_valrothAI (pCreature); } - void EnterCombat(Unit* who) + struct mob_high_inquisitor_valrothAI : public ScriptedAI { - DoScriptText(SAY_VALROTH2, me); - DoCast(who, SPELL_VALROTH_SMITE); - } + mob_high_inquisitor_valrothAI(Creature *pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 diff) - { - if (uiRenew_timer <= diff) + uint32 uiRenew_timer; + uint32 uiInquisitor_Penance_timer; + uint32 uiValroth_Smite_timer; + + void Reset() { - Shout(); - DoCast(me, SPELL_RENEW); - uiRenew_timer = 1000 + rand()%5000; - } else uiRenew_timer -= diff; + uiRenew_timer = 1000; + uiInquisitor_Penance_timer = 2000; + uiValroth_Smite_timer = 1000; + } - if (uiInquisitor_Penance_timer <= diff) + void EnterCombat(Unit* who) { - Shout(); - DoCast(me->getVictim(), SPELL_INQUISITOR_PENANCE); - uiInquisitor_Penance_timer = 2000 + rand()%5000; - } else uiInquisitor_Penance_timer -= diff; + DoScriptText(SAY_VALROTH2, me); + DoCast(who, SPELL_VALROTH_SMITE); + } - if (uiValroth_Smite_timer <= diff) + void UpdateAI(const uint32 diff) { - Shout(); - DoCast(me->getVictim(), SPELL_VALROTH_SMITE); - uiValroth_Smite_timer = 1000 + rand()%5000; - } else uiValroth_Smite_timer -= diff; + if (uiRenew_timer <= diff) + { + Shout(); + DoCast(me, SPELL_RENEW); + uiRenew_timer = 1000 + rand()%5000; + } else uiRenew_timer -= diff; - DoMeleeAttackIfReady(); - } + if (uiInquisitor_Penance_timer <= diff) + { + Shout(); + DoCast(me->getVictim(), SPELL_INQUISITOR_PENANCE); + uiInquisitor_Penance_timer = 2000 + rand()%5000; + } else uiInquisitor_Penance_timer -= diff; - void Shout() - { - if (rand()%100 < 15) - DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me); - } + if (uiValroth_Smite_timer <= diff) + { + Shout(); + DoCast(me->getVictim(), SPELL_VALROTH_SMITE); + uiValroth_Smite_timer = 1000 + rand()%5000; + } else uiValroth_Smite_timer -= diff; + + DoMeleeAttackIfReady(); + } + + void Shout() + { + if (rand()%100 < 15) + DoScriptText(RAND(SAY_VALROTH3,SAY_VALROTH4,SAY_VALROTH5), me); + } + + void JustDied(Unit* killer) + { + DoScriptText(SAY_VALROTH6, me); + killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true); + } + }; - void JustDied(Unit* killer) - { - DoScriptText(SAY_VALROTH6, me); - killer->CastSpell(me, SPELL_SUMMON_VALROTH_REMAINS, true); - } }; -CreatureAI* GetAI_mob_high_inquisitor_valroth(Creature* pCreature) -{ - return new mob_high_inquisitor_valrothAI (pCreature); -} /*###### ## npc_a_special_surprise @@ -552,443 +581,412 @@ enum SpecialSurprise NPC_PLAGUEFIST = 29053 }; - -struct npc_a_special_surpriseAI : public ScriptedAI + class npc_a_special_surprise : public CreatureScript { - npc_a_special_surpriseAI(Creature *pCreature) : ScriptedAI(pCreature) {} +public: + npc_a_special_surprise() : CreatureScript("npc_a_special_surprise") { } - uint32 ExecuteSpeech_Timer; - uint32 ExecuteSpeech_Counter; - uint64 PlayerGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ExecuteSpeech_Timer = 0; - ExecuteSpeech_Counter = 0; - PlayerGUID = 0; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new npc_a_special_surpriseAI(pCreature); } - bool MeetQuestCondition(Unit* pPlayer) + struct npc_a_special_surpriseAI : public ScriptedAI { - switch(me->GetEntry()) + npc_a_special_surpriseAI(Creature *pCreature) : ScriptedAI(pCreature) {} + + uint32 ExecuteSpeech_Timer; + uint32 ExecuteSpeech_Counter; + uint64 PlayerGUID; + + void Reset() { - case 29061: // Ellen Stanbridge - if (CAST_PLR(pPlayer)->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29072: // Kug Ironjaw - if (CAST_PLR(pPlayer)->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29067: // Donovan Pulfrost - if (CAST_PLR(pPlayer)->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29065: // Yazmina Oakenthorn - if (CAST_PLR(pPlayer)->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29071: // Antoine Brack - if (CAST_PLR(pPlayer)->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29032: // Malar Bravehorn - if (CAST_PLR(pPlayer)->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29068: // Goby Blastenheimer - if (CAST_PLR(pPlayer)->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29073: // Iggy Darktusk - if (CAST_PLR(pPlayer)->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29074: // Lady Eonys - if (CAST_PLR(pPlayer)->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) - return true; - break; - case 29070: // Valok the Righteous - if (CAST_PLR(pPlayer)->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) - return true; - break; + ExecuteSpeech_Timer = 0; + ExecuteSpeech_Counter = 0; + PlayerGUID = 0; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } - return false; - } - - void MoveInLineOfSight(Unit* pWho) - { - if (PlayerGUID || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(me, INTERACTION_DISTANCE)) - return; - - if (MeetQuestCondition(pWho)) - PlayerGUID = pWho->GetGUID(); - } - - void UpdateAI(const uint32 diff) - { - if (PlayerGUID && !me->getVictim() && me->isAlive()) + bool MeetQuestCondition(Unit* pPlayer) { - if (ExecuteSpeech_Timer <= diff) + switch(me->GetEntry()) { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - - if (!pPlayer) - { - Reset(); - return; - } - - //TODO: simplify text's selection - - switch(pPlayer->getRace()) - { - case RACE_HUMAN: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_5, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_7, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_6, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_ORC: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_6, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_7, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_8, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_8, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_DWARF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_2, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_2, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_3, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_2, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_5, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_2, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_3, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_NIGHTELF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_6, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_2, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_7, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_UNDEAD_PLAYER: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_3, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_4, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_3, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_1, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_3, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_4, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_TAUREN: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_5, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_8, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_9, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_9, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_GNOME: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_4, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_4, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_6, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_5, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_TROLL: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_3, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_7, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_2, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_6, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_9, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_10, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_4, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_10, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_BLOODELF: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; - //case 5: //unknown - case 6: DoScriptText(SAY_EXEC_THINK_3, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_1, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - case RACE_DRAENEI: - switch(ExecuteSpeech_Counter) - { - case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; - case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; - case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; - case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; - case 4: DoScriptText(SAY_EXEC_RECOG_2, me, pPlayer); break; - case 5: DoScriptText(SAY_EXEC_NOREM_1, me, pPlayer); break; - case 6: DoScriptText(SAY_EXEC_THINK_4, me, pPlayer); break; - case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; - case 8: - if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) - DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); - break; - case 9: - DoScriptText(SAY_EXEC_TIME_2, me, pPlayer); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - break; - case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; - case 11: - DoScriptText(EMOTE_DIES, me); - me->setDeathState(JUST_DIED); - me->SetHealth(0); - return; - } - break; - } - - if (ExecuteSpeech_Counter >= 9) - ExecuteSpeech_Timer = 15000; - else - ExecuteSpeech_Timer = 7000; - - ++ExecuteSpeech_Counter; + case 29061: // Ellen Stanbridge + if (CAST_PLR(pPlayer)->GetQuestStatus(12742) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29072: // Kug Ironjaw + if (CAST_PLR(pPlayer)->GetQuestStatus(12748) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29067: // Donovan Pulfrost + if (CAST_PLR(pPlayer)->GetQuestStatus(12744) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29065: // Yazmina Oakenthorn + if (CAST_PLR(pPlayer)->GetQuestStatus(12743) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29071: // Antoine Brack + if (CAST_PLR(pPlayer)->GetQuestStatus(12750) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29032: // Malar Bravehorn + if (CAST_PLR(pPlayer)->GetQuestStatus(12739) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29068: // Goby Blastenheimer + if (CAST_PLR(pPlayer)->GetQuestStatus(12745) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29073: // Iggy Darktusk + if (CAST_PLR(pPlayer)->GetQuestStatus(12749) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29074: // Lady Eonys + if (CAST_PLR(pPlayer)->GetQuestStatus(12747) == QUEST_STATUS_INCOMPLETE) + return true; + break; + case 29070: // Valok the Righteous + if (CAST_PLR(pPlayer)->GetQuestStatus(12746) == QUEST_STATUS_INCOMPLETE) + return true; + break; } - else - ExecuteSpeech_Timer -= diff; + + return false; } - } + + void MoveInLineOfSight(Unit* pWho) + { + if (PlayerGUID || pWho->GetTypeId() != TYPEID_PLAYER || !pWho->IsWithinDist(me, INTERACTION_DISTANCE)) + return; + + if (MeetQuestCondition(pWho)) + PlayerGUID = pWho->GetGUID(); + } + + void UpdateAI(const uint32 diff) + { + if (PlayerGUID && !me->getVictim() && me->isAlive()) + { + if (ExecuteSpeech_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + + if (!pPlayer) + { + Reset(); + return; + } + + //TODO: simplify text's selection + + switch(pPlayer->getRace()) + { + case RACE_HUMAN: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_5, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_7, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_6, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_ORC: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_6, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_7, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_8, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_8, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_DWARF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_2, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_2, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_3, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_2, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_5, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_2, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_3, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_NIGHTELF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_5, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_6, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_2, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_7, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_UNDEAD_PLAYER: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_3, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_4, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_3, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_1, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_3, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_4, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_TAUREN: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_5, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_8, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_9, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_9, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_GNOME: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_4, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_4, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_6, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_5, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_TROLL: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_3, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_7, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_2, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_6, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_9, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_10, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_4, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_10, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_BLOODELF: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_1, me, pPlayer); break; + //case 5: //unknown + case 6: DoScriptText(SAY_EXEC_THINK_3, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_1, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + case RACE_DRAENEI: + switch(ExecuteSpeech_Counter) + { + case 0: DoScriptText(SAY_EXEC_START_1, me, pPlayer); break; + case 1: me->SetStandState(UNIT_STAND_STATE_STAND); break; + case 2: DoScriptText(SAY_EXEC_PROG_1, me, pPlayer); break; + case 3: DoScriptText(SAY_EXEC_NAME_1, me, pPlayer); break; + case 4: DoScriptText(SAY_EXEC_RECOG_2, me, pPlayer); break; + case 5: DoScriptText(SAY_EXEC_NOREM_1, me, pPlayer); break; + case 6: DoScriptText(SAY_EXEC_THINK_4, me, pPlayer); break; + case 7: DoScriptText(SAY_EXEC_LISTEN_1, me, pPlayer); break; + case 8: + if (Creature* Plaguefist = GetClosestCreatureWithEntry(me, NPC_PLAGUEFIST, 85.0f)) + DoScriptText(SAY_PLAGUEFIST, Plaguefist, pPlayer); + break; + case 9: + DoScriptText(SAY_EXEC_TIME_2, me, pPlayer); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + break; + case 10: DoScriptText(SAY_EXEC_WAITING, me, pPlayer); break; + case 11: + DoScriptText(EMOTE_DIES, me); + me->setDeathState(JUST_DIED); + me->SetHealth(0); + return; + } + break; + } + + if (ExecuteSpeech_Counter >= 9) + ExecuteSpeech_Timer = 15000; + else + ExecuteSpeech_Timer = 7000; + + ++ExecuteSpeech_Counter; + } + else + ExecuteSpeech_Timer -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature) -{ - return new npc_a_special_surpriseAI(pCreature); -} void AddSC_the_scarlet_enclave_c2() { - Script *newscript; - - // How to win friends and influence enemies - newscript = new Script; - newscript->Name = "npc_crusade_persuaded"; - newscript->GetAI = &GetAI_npc_crusade_persuaded; - newscript->RegisterSelf(); - - // Ambush At The Overlook - newscript = new Script; - newscript->Name = "mob_scarlet_courier"; - newscript->GetAI = &GetAI_mob_scarlet_courier; - newscript->RegisterSelf(); - - // 12727 Bloody Breakout - newscript = new Script; - newscript->Name = "npc_koltira_deathweaver"; - newscript->GetAI = &GetAI_npc_koltira_deathweaver; - newscript->pQuestAccept = &QuestAccept_npc_koltira_deathweaver; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_high_inquisitor_valroth"; - newscript->GetAI = &GetAI_mob_high_inquisitor_valroth; - newscript->RegisterSelf(); - - // A Special Suprise - newscript = new Script; - newscript->Name = "npc_a_special_surprise"; - newscript->GetAI = &GetAI_npc_a_special_surprise; - newscript->RegisterSelf(); + new npc_crusade_persuaded(); + new mob_scarlet_courier(); + new npc_koltira_deathweaver(); + new mob_high_inquisitor_valroth(); + new npc_a_special_surprise(); } - -/* --- Bloody Breakout -UPDATE `creature_template` SET `ScriptName`='npc_koltira_deathweaver' WHERE `entry`='28912'; -UPDATE `creature_template` SET `ScriptName`='mob_high_inquisitor_valroth',minmana=6489,maxmana=6489,unit_flags=32768 WHERE `entry`='29001'; -UPDATE `creature_template` SET `ScriptName`='mob_eventai', `AIName`='EventAI',minmana=1020,maxmana=1058,unit_flags=32768 WHERE (`entry`='29007'); -DELETE FROM creature_ai_scripts WHERE id BETWEEN 90030 AND 90033; -INSERT INTO `creature_ai_scripts` VALUES ('90030', '29007', '0', '0', '100', '1', '1000', '4000', '1000', '4000', '11', '15498', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Holy Smite'); -INSERT INTO `creature_ai_scripts` VALUES ('90031', '29007', '0', '0', '100', '1', '1000', '10000', '20000', '21000', '11', '34809', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Holy Fury'); -INSERT INTO `creature_ai_scripts` VALUES ('90032', '29007', '0', '0', '100', '1', '1000', '5000', '1000', '5000', '11', '19725', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte - Turn Undead'); -INSERT INTO `creature_ai_scripts` VALUES ('90033', '29007', '4', '0', '100', '0', '0', '0', '0', '0', '11', '15498', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'Crimson Acolyte aggro'); -*/ diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 621dea1b84f..8d97daa1557 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -282,1402 +282,1407 @@ static Locations LightofDawnLoc[]= {2272.709, -5255.552, 78.226, 0}, // 28 Lich king kicked {2273.972, -5257.676, 78.862, 0} // 29 Lich king moves forward }; - -struct npc_highlord_darion_mograineAI : public npc_escortAI + class npc_highlord_darion_mograine : public CreatureScript { - npc_highlord_darion_mograineAI(Creature *pCreature) : npc_escortAI(pCreature) +public: + npc_highlord_darion_mograine() : CreatureScript("npc_highlord_darion_mograine") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - Reset(); - } - - bool bIsBattle; - uint32 uiStep; - uint32 uiPhase_timer; - uint32 uiFight_duration; - uint32 uiTotal_dawn; - uint32 uiTotal_scourge; - uint32 uiSummon_counter; - - // Darion Mograine - uint32 uiAnti_magic_zone; - uint32 uiDeath_strike; - uint32 uiDeath_embrace; - uint32 uiIcy_touch; - uint32 uiUnholy_blight; - uint32 uiFight_speech; - uint32 uiSpawncheck; - uint32 uiTargetcheck; - - // Dawn - uint64 uiTirionGUID; - uint64 uiAlexandrosGUID; - uint64 uiDarionGUID; - uint64 uiKorfaxGUID; - uint64 uiMaxwellGUID; - uint64 uiEligorGUID; - uint64 uiRayneGUID; - uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; - uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; - - // Death - uint64 uiKoltiraGUID; - uint64 uiOrbazGUID; - uint64 uiThassarianGUID; - uint64 uiLichKingGUID; - uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; - uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; - uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; - uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; - - void Reset() - { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + switch (uiAction) { - bIsBattle = false; - uiStep = 0; - uiPhase_timer = 3000; - uiFight_duration = 300000; // 5 minutes - uiTotal_dawn = ENCOUNTER_TOTAL_DAWN; - uiTotal_scourge = ENCOUNTER_TOTAL_SCOURGE; - uiSummon_counter = 0; - - uiAnti_magic_zone = urand(1000,6000); - uiDeath_strike = urand(5000,10000); - uiDeath_embrace = urand(5000,10000); - uiIcy_touch = urand(5000,10000); - uiUnholy_blight = urand(5000,10000); - - uiFight_speech = 15000; - uiSpawncheck = 1000; - uiTargetcheck = 10000; - - me->SetStandState(UNIT_STAND_STATE_STAND); - me->Mount(25279); - me->SetVisibility(VISIBILITY_ON); - - UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 0); - //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); - UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiRayneGUID)) - pTemp->setDeathState(JUST_DIED); - - uiTirionGUID = NULL; - uiKorfaxGUID = NULL; - uiMaxwellGUID = NULL; - uiEligorGUID = NULL; - uiRayneGUID = NULL; - - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiDefenderGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiEarthshatterGUID[i] = 0; - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->setDeathState(JUST_DIED); - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->setDeathState(JUST_DIED); - - uiKoltiraGUID = NULL; - uiOrbazGUID = NULL; - uiThassarianGUID = NULL; - uiLichKingGUID = NULL; - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiAbominationGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiBehemothGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiGhoulGUID[i] = 0; - } - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - { - if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) - pTemp->setDeathState(JUST_DIED); - uiWarriorGUID[i] = 0; - } + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, pCreature->AI())->uiStep = 1; + CAST_AI(npc_highlord_darion_mograine::npc_highlord_darion_mograineAI, pCreature->AI())->Start(true, false, pPlayer->GetGUID()); + break; } + return true; } - void AttackStart(Unit* who) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!who) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (who == me) - return; + if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (me->Attack(who, true)) + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_highlord_darion_mograineAI(pCreature); + } + + struct npc_highlord_darion_mograineAI : public npc_escortAI + { + npc_highlord_darion_mograineAI(Creature *pCreature) : npc_escortAI(pCreature) { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + Reset(); } - } - void MoveInLineOfSight(Unit* who) - { - if (!who) - return; + bool bIsBattle; + uint32 uiStep; + uint32 uiPhase_timer; + uint32 uiFight_duration; + uint32 uiTotal_dawn; + uint32 uiTotal_scourge; + uint32 uiSummon_counter; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) - if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) - AttackStart(who); - } + // Darion Mograine + uint32 uiAnti_magic_zone; + uint32 uiDeath_strike; + uint32 uiDeath_embrace; + uint32 uiIcy_touch; + uint32 uiUnholy_blight; + uint32 uiFight_speech; + uint32 uiSpawncheck; + uint32 uiTargetcheck; - void SetHoldState(bool bOnHold) - { - SetEscortPaused(bOnHold); - } + // Dawn + uint64 uiTirionGUID; + uint64 uiAlexandrosGUID; + uint64 uiDarionGUID; + uint64 uiKorfaxGUID; + uint64 uiMaxwellGUID; + uint64 uiEligorGUID; + uint64 uiRayneGUID; + uint64 uiDefenderGUID[ENCOUNTER_DEFENDER_NUMBER]; + uint64 uiEarthshatterGUID[ENCOUNTER_EARTHSHATTER_NUMBER]; - void WaypointReached(uint32 i) - { - switch (i) + // Death + uint64 uiKoltiraGUID; + uint64 uiOrbazGUID; + uint64 uiThassarianGUID; + uint64 uiLichKingGUID; + uint64 uiAbominationGUID[ENCOUNTER_ABOMINATION_NUMBER]; + uint64 uiBehemothGUID[ENCOUNTER_BEHEMOTH_NUMBER]; + uint64 uiGhoulGUID[ENCOUNTER_GHOUL_NUMBER]; + uint64 uiWarriorGUID[ENCOUNTER_WARRIOR_NUMBER]; + + void Reset() { - case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetHoldState(true); - break; - case 1: - SetHoldState(true); - - SpawnNPC(); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN07, pTemp); - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN08, pTemp); - - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - NPCChangeTarget(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - NPCChangeTarget(uiWarriorGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - NPCChangeTarget(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - NPCChangeTarget(uiBehemothGUID[i]); - NPCChangeTarget(uiKoltiraGUID); - NPCChangeTarget(uiOrbazGUID); - NPCChangeTarget(uiThassarianGUID); - - me->Unmount(); - me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only - - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->Unmount(); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->Unmount(); - - bIsBattle = true; - break; - case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - DoCast(me, SPELL_THE_LIGHT_OF_DAWN); - break; - case 3: + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); + bIsBattle = false; + uiStep = 0; + uiPhase_timer = 3000; + uiFight_duration = 300000; // 5 minutes + uiTotal_dawn = ENCOUNTER_TOTAL_DAWN; + uiTotal_scourge = ENCOUNTER_TOTAL_SCOURGE; + uiSummon_counter = 0; - DoScriptText(EMOTE_LIGHT_OF_DAWN05, me); - if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - { - if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - { - if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); - } - JumpToNextStep(10000); - } break; - case 4: - DoScriptText(SAY_LIGHT_OF_DAWN27, me); - me->SetStandState(UNIT_STAND_STATE_KNEEL); + uiAnti_magic_zone = urand(1000,6000); + uiDeath_strike = urand(5000,10000); + uiDeath_embrace = urand(5000,10000); + uiIcy_touch = urand(5000,10000); + uiUnholy_blight = urand(5000,10000); + + uiFight_speech = 15000; + uiSpawncheck = 1000; + uiTargetcheck = 10000; + + me->SetStandState(UNIT_STAND_STATE_STAND); + me->Mount(25279); + me->SetVisibility(VISIBILITY_ON); + + UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 0); + //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); + UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 0); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - SetHoldState(true); - break; - case 5: - DoScriptText(SAY_LIGHT_OF_DAWN33, me); - SetHoldState(true); - break; - case 6: - SetHoldState(true); - me->HandleEmoteCommand(EMOTE_ONESHOT_SPECIALATTACK1H); - JumpToNextStep(1000); - break; - case 7: - SetHoldState(true); - JumpToNextStep(2000); - break; - case 8: - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - me->CastSpell(pTemp, SPELL_ASHBRINGER, true); - DoScriptText(EMOTE_LIGHT_OF_DAWN14, me); - SetHoldState(true); - break; - } - } + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiRayneGUID)) + pTemp->setDeathState(JUST_DIED); - void EnterEvadeMode() - { - if (!bIsBattle)//do not reset self if we are in battle - npc_escortAI::EnterEvadeMode(); - } + uiTirionGUID = NULL; + uiKorfaxGUID = NULL; + uiMaxwellGUID = NULL; + uiEligorGUID = NULL; + uiRayneGUID = NULL; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (!bIsBattle) - { - if (uiPhase_timer <= diff) - { - // ******* Before battle ***************************************************************** - switch (uiStep) + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) { - case 0: // countdown - //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 1); - break; + if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiDefenderGUID[i] = 0; + } + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiEarthshatterGUID[i] = 0; + } - case 1: // just delay - //UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 1); - UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); - UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 1); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - JumpToNextStep(3000); - break; + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->setDeathState(JUST_DIED); + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->setDeathState(JUST_DIED); - case 2: - DoScriptText(SAY_LIGHT_OF_DAWN04, me); - if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f)) - uiKoltiraGUID = pKoltira->GetGUID(); - if (Creature* pOrbaz = GetClosestCreatureWithEntry(me, NPC_ORBAZ_BLOODBANE, 50.0f)) - uiOrbazGUID = pOrbaz->GetGUID(); - if (Creature* pThassarian = GetClosestCreatureWithEntry(me, NPC_THASSARIAN, 50.0f)) - uiThassarianGUID = pThassarian->GetGUID(); - JumpToNextStep(10000); - break; + uiKoltiraGUID = NULL; + uiOrbazGUID = NULL; + uiThassarianGUID = NULL; + uiLichKingGUID = NULL; + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiAbominationGUID[i] = 0; + } + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiBehemothGUID[i] = 0; + } + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiGhoulGUID[i] = 0; + } + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + { + if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) + pTemp->setDeathState(JUST_DIED); + uiWarriorGUID[i] = 0; + } + } + } - case 3: // rise - DoScriptText(SAY_LIGHT_OF_DAWN05, me); - JumpToNextStep(3000); - break; + void AttackStart(Unit* who) + { + if (!who) + return; - case 4: // summon ghoul - // Dunno whats the summon spell, so workaround - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiGhoulGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + if (who == me) + return; - case 5: // summon abomination - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiAbominationGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } - case 6: // summon warrior - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiWarriorGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + void MoveInLineOfSight(Unit* who) + { + if (!who) + return; - case 7: // summon warrior - DoCast(me, 33271); // shack effect - uiPhase_timer = 500; - if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) - { - Unit* pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->setFaction(2084); - uiBehemothGUID[uiSummon_counter] = pTemp->GetGUID(); - ++uiSummon_counter; - } - else - { - uiSummon_counter = 0; - ++uiStep; - } - break; + if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) + AttackStart(who); + } - case 8: // summon announce - DoScriptText(SAY_LIGHT_OF_DAWN06, me); - JumpToNextStep(5000); - break; + void SetHoldState(bool bOnHold) + { + SetEscortPaused(bOnHold); + } - case 9: // charge begins - SetHoldState(false); - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - { - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - } - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); - JumpToNextStep(5000); - break; + void WaypointReached(uint32 i) + { + switch (i) + { + case 0: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetHoldState(true); + break; + case 1: + SetHoldState(true); - // ******* After battle ***************************************************************** - case 11: // Tirion starts to speak - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN28, pTemp); - JumpToNextStep(21000); - break; + SpawnNPC(); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN07, pTemp); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN08, pTemp); - case 12: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN29, pTemp); - JumpToNextStep(13000); - break; + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + NPCChangeTarget(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + NPCChangeTarget(uiWarriorGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + NPCChangeTarget(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + NPCChangeTarget(uiBehemothGUID[i]); + NPCChangeTarget(uiKoltiraGUID); + NPCChangeTarget(uiOrbazGUID); + NPCChangeTarget(uiThassarianGUID); - case 13: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN30, pTemp); - JumpToNextStep(13000); - break; + me->Unmount(); + me->CastSpell(me, SPELL_THE_MIGHT_OF_MOGRAINE, true); // need to fix, on player only - case 14: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN31, me); - JumpToNextStep(7000); - break; + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->Unmount(); + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->Unmount(); - case 15: // summon gate - if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->CastSpell(pTemp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); - DoScriptText(EMOTE_LIGHT_OF_DAWN06, pTemp); - uiAlexandrosGUID = pTemp->GetGUID(); - } - JumpToNextStep(4000); - break; + bIsBattle = true; + break; + case 2: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + DoCast(me, SPELL_THE_LIGHT_OF_DAWN); + break; + case 3: + { + //Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID); - case 16: // Alexandros out - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); - DoScriptText(SAY_LIGHT_OF_DAWN32, pTemp); - } - SetHoldState(false); // makes darion turns back - JumpToNextStep(5000); - break; + DoScriptText(EMOTE_LIGHT_OF_DAWN05, me); + if (me->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + me->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + { + if (pTemp->HasAura(SPELL_THE_LIGHT_OF_DAWN, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); + } + JumpToNextStep(10000); + } break; + case 4: + DoScriptText(SAY_LIGHT_OF_DAWN27, me); + me->SetStandState(UNIT_STAND_STATE_KNEEL); - case 17: - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_LIGHT_OF_DAWN34, me); - JumpToNextStep(5000); - break; + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + SetHoldState(true); + break; + case 5: + DoScriptText(SAY_LIGHT_OF_DAWN33, me); + SetHoldState(true); + break; + case 6: + SetHoldState(true); + me->HandleEmoteCommand(EMOTE_ONESHOT_SPECIALATTACK1H); + JumpToNextStep(1000); + break; + case 7: + SetHoldState(true); + JumpToNextStep(2000); + break; + case 8: + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + me->CastSpell(pTemp, SPELL_ASHBRINGER, true); + DoScriptText(EMOTE_LIGHT_OF_DAWN14, me); + SetHoldState(true); + break; + } + } - case 18: // Darion's spirit out - if (Unit* pTemp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - DoScriptText(SAY_LIGHT_OF_DAWN35, pTemp); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - uiDarionGUID = pTemp->GetGUID(); - } - JumpToNextStep(4000); - break; + void EnterEvadeMode() + { + if (!bIsBattle)//do not reset self if we are in battle + npc_escortAI::EnterEvadeMode(); + } - case 19: // runs to father - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN07, pTemp); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); - } - JumpToNextStep(4000); - break; + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); - case 20: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN36, pTemp); - JumpToNextStep(4000); - break; + if (!bIsBattle) + { + if (uiPhase_timer <= diff) + { + // ******* Before battle ***************************************************************** + switch (uiStep) + { + case 0: // countdown + //UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 1); + break; - case 21: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN08, pTemp); - JumpToNextStep(4000); - break; + case 1: // just delay + //UpdateWorldState(me->GetMap(), WORLD_STATE_REMAINS, 1); + UpdateWorldState(me->GetMap(), WORLD_STATE_COUNTDOWN, 0); + UpdateWorldState(me->GetMap(), WORLD_STATE_EVENT_BEGIN, 1); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + JumpToNextStep(3000); + break; - case 22: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN37, pTemp); - JumpToNextStep(8000); - break; + case 2: + DoScriptText(SAY_LIGHT_OF_DAWN04, me); + if (Creature* pKoltira = GetClosestCreatureWithEntry(me, NPC_KOLTIRA_DEATHWEAVER, 50.0f)) + uiKoltiraGUID = pKoltira->GetGUID(); + if (Creature* pOrbaz = GetClosestCreatureWithEntry(me, NPC_ORBAZ_BLOODBANE, 50.0f)) + uiOrbazGUID = pOrbaz->GetGUID(); + if (Creature* pThassarian = GetClosestCreatureWithEntry(me, NPC_THASSARIAN, 50.0f)) + uiThassarianGUID = pThassarian->GetGUID(); + JumpToNextStep(10000); + break; - case 23: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN38, pTemp); - JumpToNextStep(8000); - break; + case 3: // rise + DoScriptText(SAY_LIGHT_OF_DAWN05, me); + JumpToNextStep(3000); + break; - case 24: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN39, pTemp); - - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); - - JumpToNextStep(15000); - break; - - case 25: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN40, pTemp); - JumpToNextStep(11000); - break; - - case 26: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN41, pTemp); - JumpToNextStep(5000); - break; - - case 27: - if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) - pTemp->setDeathState(JUST_DIED); - JumpToNextStep(24000); - break; - - case 28: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN42, pTemp); - JumpToNextStep(6000); - break; - - case 29: // lich king spawns - if (Unit* pTemp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - { - DoScriptText(SAY_LIGHT_OF_DAWN43, pTemp); - uiLichKingGUID = pTemp->GetGUID(); - if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID)) - pTemp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false); - } - JumpToNextStep(2000); - break; - - case 30: - if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him - { - DoScriptText(EMOTE_LIGHT_OF_DAWN09, pTemp); - pTemp->SetVisibility(VISIBILITY_OFF); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->InterruptNonMeleeSpells(false); - DoScriptText(SAY_LIGHT_OF_DAWN45, pTemp); - } - JumpToNextStep(3000); - break; - - case 31: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(EMOTE_LIGHT_OF_DAWN10, me); - DoScriptText(SAY_LIGHT_OF_DAWN44, me); - JumpToNextStep(3000); - break; - - case 32: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); - JumpToNextStep(6000); - break; - - case 33: // Darion supports to jump to lich king here - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge -// doesn't make it looks well, so workarounds, Darion charges, looks better - me->SetSpeed(MOVE_RUN, 3.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetHoldState(false); - JumpToNextStep(0); - break; - - case 35: // Lich king counterattacks - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->HandleEmoteCommand(EMOTE_ONESHOT_KICK); - DoScriptText(SAY_LIGHT_OF_DAWN46, pTemp); - } - me->SetSpeed(MOVE_RUN, 6.0f); - me->SetStandState(UNIT_STAND_STATE_DEAD); - SetHoldState(false); // Darion got kicked by lich king - JumpToNextStep(0); - break; - - case 37: // Lich king counterattacks - me->SetStandState(UNIT_STAND_STATE_KNEEL); - JumpToNextStep(3000); - break; - - case 38: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN47, pTemp); - JumpToNextStep(8000); - break; - - case 39: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN48, pTemp); - JumpToNextStep(15000); - break; - - case 40: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN49, pTemp); - JumpToNextStep(17000); - break; - - case 41: // Lich king - Apocalypse - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN11, pTemp); - DoScriptText(SAY_LIGHT_OF_DAWN51, pTemp); - if (Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID)) + case 4: // summon ghoul + // Dunno whats the summon spell, so workaround + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_GHOUL_NUMBER) { - pTirion->SetStandState(UNIT_STAND_STATE_KNEEL); - //pTemp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working - pTemp->CastSpell(pTirion, SPELL_SOUL_FEAST_TIRION, false); - DoScriptText(EMOTE_LIGHT_OF_DAWN12, pTirion); + Unit* pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiGhoulGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; } - } - JumpToNextStep(2000); - break; + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; - case 42: // Maxwell yells for attack - { - float fLichPositionX = 0, - fLichPositionY = 0, - fLichPositionZ = 0; + case 5: // summon abomination + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_ABOMINATION_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiAbominationGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; + + case 6: // summon warrior + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_WARRIOR_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiWarriorGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; + + case 7: // summon warrior + DoCast(me, 33271); // shack effect + uiPhase_timer = 500; + if (uiSummon_counter < ENCOUNTER_BEHEMOTH_NUMBER) + { + Unit* pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, (me->GetPositionX()-20)+rand()%40, (me->GetPositionY()-20)+rand()%40, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->setFaction(2084); + uiBehemothGUID[uiSummon_counter] = pTemp->GetGUID(); + ++uiSummon_counter; + } + else + { + uiSummon_counter = 0; + ++uiStep; + } + break; + + case 8: // summon announce + DoScriptText(SAY_LIGHT_OF_DAWN06, me); + JumpToNextStep(5000); + break; + + case 9: // charge begins + SetHoldState(false); + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + { + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + } + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiAbominationGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiBehemothGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiGhoulGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiWarriorGUID[i])) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z); + JumpToNextStep(5000); + break; + + // ******* After battle ***************************************************************** + case 11: // Tirion starts to speak + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN28, pTemp); + JumpToNextStep(21000); + break; + + case 12: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN29, pTemp); + JumpToNextStep(13000); + break; + + case 13: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN30, pTemp); + JumpToNextStep(13000); + break; + + case 14: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN31, me); + JumpToNextStep(7000); + break; + + case 15: // summon gate + if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->CastSpell(pTemp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); + DoScriptText(EMOTE_LIGHT_OF_DAWN06, pTemp); + uiAlexandrosGUID = pTemp->GetGUID(); + } + JumpToNextStep(4000); + break; + + case 16: // Alexandros out + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + { + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); + DoScriptText(SAY_LIGHT_OF_DAWN32, pTemp); + } + SetHoldState(false); // makes darion turns back + JumpToNextStep(5000); + break; + + case 17: + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_LIGHT_OF_DAWN34, me); + JumpToNextStep(5000); + break; + + case 18: // Darion's spirit out + if (Unit* pTemp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + DoScriptText(SAY_LIGHT_OF_DAWN35, pTemp); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + uiDarionGUID = pTemp->GetGUID(); + } + JumpToNextStep(4000); + break; + + case 19: // runs to father + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + { + DoScriptText(EMOTE_LIGHT_OF_DAWN07, pTemp); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); + } + JumpToNextStep(4000); + break; + + case 20: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN36, pTemp); + JumpToNextStep(4000); + break; + + case 21: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN08, pTemp); + JumpToNextStep(4000); + break; + + case 22: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN37, pTemp); + JumpToNextStep(8000); + break; + + case 23: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN38, pTemp); + JumpToNextStep(8000); + break; + + case 24: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN39, pTemp); + + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); + + JumpToNextStep(15000); + break; + + case 25: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN40, pTemp); + JumpToNextStep(11000); + break; + + case 26: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN41, pTemp); + JumpToNextStep(5000); + break; + + case 27: + if (Creature* pTemp = Unit::GetCreature(*me, uiDarionGUID)) + pTemp->setDeathState(JUST_DIED); + JumpToNextStep(24000); + break; + + case 28: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN42, pTemp); + JumpToNextStep(6000); + break; + + case 29: // lich king spawns + if (Unit* pTemp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + { + DoScriptText(SAY_LIGHT_OF_DAWN43, pTemp); + uiLichKingGUID = pTemp->GetGUID(); + if (Unit* pAlex = Unit::GetCreature(*me, uiAlexandrosGUID)) + pTemp->CastSpell(pAlex, SPELL_SOUL_FEAST_ALEX, false); + } + JumpToNextStep(2000); + break; + + case 30: + if (Creature* pTemp = Unit::GetCreature(*me, uiAlexandrosGUID)) // just hide him + { + DoScriptText(EMOTE_LIGHT_OF_DAWN09, pTemp); + pTemp->SetVisibility(VISIBILITY_OFF); + } if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { - fLichPositionX = pTemp->GetPositionX(); - fLichPositionY = pTemp->GetPositionY(); - fLichPositionZ = pTemp->GetPositionZ(); + pTemp->InterruptNonMeleeSpells(false); + DoScriptText(SAY_LIGHT_OF_DAWN45, pTemp); } + JumpToNextStep(3000); + break; - if (fLichPositionX && fLichPositionY) + case 31: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(EMOTE_LIGHT_OF_DAWN10, me); + DoScriptText(SAY_LIGHT_OF_DAWN44, me); + JumpToNextStep(3000); + break; + + case 32: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); + JumpToNextStep(6000); + break; + + case 33: // Darion supports to jump to lich king here + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoCast(me, SPELL_MOGRAINE_CHARGE); // jumping charge + // doesn't make it looks well, so workarounds, Darion charges, looks better + me->SetSpeed(MOVE_RUN, 3.0f); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetHoldState(false); + JumpToNextStep(0); + break; + + case 35: // Lich king counterattacks + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) { - Unit* pTemp; - pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->setFaction(me->getFaction()); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - uiDefenderGUID[0] = pTemp->GetGUID(); - - pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->setFaction(me->getFaction()); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - uiEarthshatterGUID[0] = pTemp->GetGUID(); + pTemp->HandleEmoteCommand(EMOTE_ONESHOT_KICK); + DoScriptText(SAY_LIGHT_OF_DAWN46, pTemp); } + me->SetSpeed(MOVE_RUN, 6.0f); + me->SetStandState(UNIT_STAND_STATE_DEAD); + SetHoldState(false); // Darion got kicked by lich king + JumpToNextStep(0); + break; + + case 37: // Lich king counterattacks + me->SetStandState(UNIT_STAND_STATE_KNEEL); + JumpToNextStep(3000); + break; + + case 38: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN47, pTemp); + JumpToNextStep(8000); + break; + + case 39: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN48, pTemp); + JumpToNextStep(15000); + break; + + case 40: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN49, pTemp); + JumpToNextStep(17000); + break; + + case 41: // Lich king - Apocalypse + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + { + DoScriptText(EMOTE_LIGHT_OF_DAWN11, pTemp); + DoScriptText(SAY_LIGHT_OF_DAWN51, pTemp); + if (Unit* pTirion = Unit::GetCreature(*me, uiTirionGUID)) + { + pTirion->SetStandState(UNIT_STAND_STATE_KNEEL); + //pTemp->CastSpell(pTirion, SPELL_APOCALYPSE, false); // not working + pTemp->CastSpell(pTirion, SPELL_SOUL_FEAST_TIRION, false); + DoScriptText(EMOTE_LIGHT_OF_DAWN12, pTirion); + } + } + JumpToNextStep(2000); + break; + + case 42: // Maxwell yells for attack + { + float fLichPositionX = 0, + fLichPositionY = 0, + fLichPositionZ = 0; + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + { + fLichPositionX = pTemp->GetPositionX(); + fLichPositionY = pTemp->GetPositionY(); + fLichPositionZ = pTemp->GetPositionZ(); + } + + if (fLichPositionX && fLichPositionY) + { + Unit* pTemp; + pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->setFaction(me->getFaction()); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + uiDefenderGUID[0] = pTemp->GetGUID(); + + pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->setFaction(me->getFaction()); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + uiEarthshatterGUID[0] = pTemp->GetGUID(); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + DoScriptText(SAY_LIGHT_OF_DAWN50, pTemp); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetSpeed(MOVE_RUN, 2.0f); + pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + } + } + JumpToNextStep(4500); + break; + + case 43: // They all got kicked + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN13, pTemp); + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); - DoScriptText(SAY_LIGHT_OF_DAWN50, pTemp); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); } if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->HandleEmoteCommand(EMOTE_STATE_ATTACK_UNARMED); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); } if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->SetSpeed(MOVE_RUN, 2.0f); - pTemp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); } - } - JumpToNextStep(4500); - break; - - case 43: // They all got kicked - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN13, pTemp); - - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[0])) - { - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[0])) - { - pTemp->SetSpeed(MOVE_RUN, 6.0f); - pTemp->SetStandState(UNIT_STAND_STATE_DEAD); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); - } - JumpToNextStep(3000); - break; - - case 44: // make them stand up - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - JumpToNextStep(1000); - break; - - case 45: - DoScriptText(SAY_LIGHT_OF_DAWN52, me); - JumpToNextStep(5000); - break; - - case 46: // Darion stand up, "not today" - me->SetSpeed(MOVE_RUN, 1.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN53, me); - SetHoldState(false); // Darion throws sword - JumpToNextStep(7000); - break; - - case 47: // Ashbringer rebirth - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(EMOTE_LIGHT_OF_DAWN15, me); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING)); - pTemp->CastSpell(pTemp, SPELL_REBIRTH_OF_THE_ASHBRINGER, false); - } - JumpToNextStep(1000); - break; - - case 48: // Show the cleansing effect (dawn of light) - //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) - // pGo->SetPhaseMask(128, true); - me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896, -5287.914, 83.066, 0, 0, 0, 0, 0, 30000); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - if (pTemp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) - pTemp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); - pTemp->CastSpell(pTemp, 41542, false); // workarounds, light expoded, makes it cool - pTemp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - } - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->InterruptNonMeleeSpells(false); - JumpToNextStep(2500); - break; - - case 49: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN54, pTemp); - JumpToNextStep(4000); - break; - - case 50: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN55, pTemp); - JumpToNextStep(5000); - break; - - case 51: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN56, pTemp); - JumpToNextStep(1000); - break; - - case 52: // Tiron charges - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - DoScriptText(EMOTE_LIGHT_OF_DAWN16, pTemp); - pTemp->CastSpell(pTemp, SPELL_TIRION_CHARGE, false); // jumping charge - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - pTemp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him - } - JumpToNextStep(1500); - break; - - case 53: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN57, pTemp); - JumpToNextStep(1000); - break; - - case 54: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - { - pTemp->SetSpeed(MOVE_RUN, 1.0f); - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 - } - JumpToNextStep(4000); - break; - - case 55: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); - JumpToNextStep(2000); - break; - - case 56: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->SetStandState(UNIT_STAND_STATE_STAND); - JumpToNextStep(1500); - break; - - case 57: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN58, pTemp); - JumpToNextStep(10000); - break; - - case 58: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN59, pTemp); - JumpToNextStep(10000); - break; - - case 59: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) - pTemp->CastSpell(pTemp, SPELL_TELEPORT_VISUAL, false); - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion - { - pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - pTemp->SetSpeed(MOVE_RUN, 1.0f); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6].x, LightofDawnLoc[6].y, LightofDawnLoc[6].z); - } - JumpToNextStep(2500); - break; - - case 60: - if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here - { - DoScriptText(EMOTE_LIGHT_OF_DAWN17, pTemp); - pTemp->Kill(pTemp); - } - JumpToNextStep(10000); - break; - - case 61: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN60, pTemp); - JumpToNextStep(3000); - break; - - case 62: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); - } - JumpToNextStep(5500); - break; - - case 63: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - { - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); - DoScriptText(SAY_LIGHT_OF_DAWN61, pTemp); - } - JumpToNextStep(15000); - break; - - case 64: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN62, pTemp); - JumpToNextStep(7000); - break; - - case 65: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN63, pTemp); - JumpToNextStep(10000); - break; - - case 66: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN64, pTemp); - JumpToNextStep(11000); - break; - - case 67: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN65, pTemp); - JumpToNextStep(10000); - break; - - case 68: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN66, pTemp); - JumpToNextStep(8000); - break; - - case 69: - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN67, pTemp); - JumpToNextStep(10000); - break; - - case 70: - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_LIGHT_OF_DAWN68, me); - JumpToNextStep(10000); - break; - - case 71: - //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light - // pGo->SetPhaseMask(0, true); - - { - Map *map = me->GetMap(); // search players with in 50 yards for quest credit - Map::PlayerList const &PlayerList = map->GetPlayers(); - if (!PlayerList.isEmpty()) + if (Creature* pTemp = Unit::GetCreature(*me, uiDefenderGUID[0])) { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource()->isAlive() && me->IsWithinDistInMap(i->getSource(), 50)) - i->getSource()->CastSpell(i->getSource(), SPELL_THE_LIGHT_OF_DAWN_Q, false); + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); } + if (Creature* pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[0])) + { + pTemp->SetSpeed(MOVE_RUN, 6.0f); + pTemp->SetStandState(UNIT_STAND_STATE_DEAD); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x+rand()%10, LightofDawnLoc[0].y+rand()%10, LightofDawnLoc[0].z); + } + JumpToNextStep(3000); + break; + + case 44: // make them stand up + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + JumpToNextStep(1000); + break; + + case 45: + DoScriptText(SAY_LIGHT_OF_DAWN52, me); + JumpToNextStep(5000); + break; + + case 46: // Darion stand up, "not today" + me->SetSpeed(MOVE_RUN, 1.0f); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN53, me); + SetHoldState(false); // Darion throws sword + JumpToNextStep(7000); + break; + + case 47: // Ashbringer rebirth + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(EMOTE_LIGHT_OF_DAWN15, me); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_HIGHLORD_TIRION_FORDRING)); + pTemp->CastSpell(pTemp, SPELL_REBIRTH_OF_THE_ASHBRINGER, false); + } + JumpToNextStep(1000); + break; + + case 48: // Show the cleansing effect (dawn of light) + //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) + // pGo->SetPhaseMask(128, true); + me->SummonGameObject(GO_LIGHT_OF_DAWN, 2283.896, -5287.914, 83.066, 0, 0, 0, 0, 0, 30000); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + if (pTemp->HasAura(SPELL_REBIRTH_OF_THE_ASHBRINGER, 0)) + pTemp->RemoveAurasDueToSpell(SPELL_REBIRTH_OF_THE_ASHBRINGER); + pTemp->CastSpell(pTemp, 41542, false); // workarounds, light expoded, makes it cool + pTemp->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + } + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->InterruptNonMeleeSpells(false); + JumpToNextStep(2500); + break; + + case 49: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN54, pTemp); + JumpToNextStep(4000); + break; + + case 50: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN55, pTemp); + JumpToNextStep(5000); + break; + + case 51: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN56, pTemp); + JumpToNextStep(1000); + break; + + case 52: // Tiron charges + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + DoScriptText(EMOTE_LIGHT_OF_DAWN16, pTemp); + pTemp->CastSpell(pTemp, SPELL_TIRION_CHARGE, false); // jumping charge + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + pTemp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him + } + JumpToNextStep(1500); + break; + + case 53: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN57, pTemp); + JumpToNextStep(1000); + break; + + case 54: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + { + pTemp->SetSpeed(MOVE_RUN, 1.0f); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 + } + JumpToNextStep(4000); + break; + + case 55: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_KNEEL); + JumpToNextStep(2000); + break; + + case 56: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->SetStandState(UNIT_STAND_STATE_STAND); + JumpToNextStep(1500); + break; + + case 57: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN58, pTemp); + JumpToNextStep(10000); + break; + + case 58: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN59, pTemp); + JumpToNextStep(10000); + break; + + case 59: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) + pTemp->CastSpell(pTemp, SPELL_TELEPORT_VISUAL, false); + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) // Tirion runs to Darion + { + pTemp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + pTemp->SetSpeed(MOVE_RUN, 1.0f); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6].x, LightofDawnLoc[6].y, LightofDawnLoc[6].z); + } + JumpToNextStep(2500); + break; + + case 60: + if (Creature* pTemp = Unit::GetCreature(*me, uiLichKingGUID)) // Lich king disappears here + { + DoScriptText(EMOTE_LIGHT_OF_DAWN17, pTemp); + pTemp->Kill(pTemp); + } + JumpToNextStep(10000); + break; + + case 61: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN60, pTemp); + JumpToNextStep(3000); + break; + + case 62: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); + } + JumpToNextStep(5500); + break; + + case 63: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + { + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); + DoScriptText(SAY_LIGHT_OF_DAWN61, pTemp); + } + JumpToNextStep(15000); + break; + + case 64: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN62, pTemp); + JumpToNextStep(7000); + break; + + case 65: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN63, pTemp); + JumpToNextStep(10000); + break; + + case 66: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN64, pTemp); + JumpToNextStep(11000); + break; + + case 67: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN65, pTemp); + JumpToNextStep(10000); + break; + + case 68: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN66, pTemp); + JumpToNextStep(8000); + break; + + case 69: + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN67, pTemp); + JumpToNextStep(10000); + break; + + case 70: + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_LIGHT_OF_DAWN68, me); + JumpToNextStep(10000); + break; + + case 71: + //if (GameObject* pGo = me->GetMap()->GetGameObject(uiDawnofLightGUID)) // Turn off dawn of light + // pGo->SetPhaseMask(0, true); + + { + Map *map = me->GetMap(); // search players with in 50 yards for quest credit + Map::PlayerList const &PlayerList = map->GetPlayers(); + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource()->isAlive() && me->IsWithinDistInMap(i->getSource(), 50)) + i->getSource()->CastSpell(i->getSource(), SPELL_THE_LIGHT_OF_DAWN_Q, false); + } + } + me->SetVisibility(VISIBILITY_OFF); // respawns another Darion for quest turn in + me->SummonCreature(NPC_HIGHLORD_DARION_MOGRAINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + JumpToNextStep(1000); + break; + + case 72: + SetHoldState(false); // Escort ends + JumpToNextStep(25000); + break; + + case 73: + me->ForcedDespawn(); + break; + } + + } else uiPhase_timer -= diff; + } + + // ******* During battle ***************************************************************** + else + { + if (uiAnti_magic_zone <= diff) + { + DoCast(me, SPELL_ANTI_MAGIC_ZONE1); + uiAnti_magic_zone = 25000 + rand()%5000; + } else uiAnti_magic_zone -= diff; + + if (uiDeath_strike <= diff) + { + DoCast(me->getVictim(), SPELL_DEATH_STRIKE); + uiDeath_strike = 5000 + rand()%5000; + } else uiDeath_strike -= diff; + + if (uiDeath_embrace <= diff) + { + DoCast(me->getVictim(), SPELL_DEATH_EMBRACE); + uiDeath_embrace = 5000 + rand()%5000; + } else uiDeath_embrace -= diff; + + if (uiIcy_touch <= diff) + { + DoCast(me->getVictim(), SPELL_ICY_TOUCH1); + uiIcy_touch = 5000 + rand()%5000; + } else uiIcy_touch -= diff; + + if (uiUnholy_blight <= diff) + { + DoCast(me->getVictim(), SPELL_UNHOLY_BLIGHT); + uiUnholy_blight = 5000 + rand()%5000; + } else uiUnholy_blight -= diff; + + if (uiFight_speech <= diff) + { + DoScriptText(RAND(SAY_LIGHT_OF_DAWN09,SAY_LIGHT_OF_DAWN10,SAY_LIGHT_OF_DAWN11, + SAY_LIGHT_OF_DAWN12,SAY_LIGHT_OF_DAWN13,SAY_LIGHT_OF_DAWN14, + SAY_LIGHT_OF_DAWN15,SAY_LIGHT_OF_DAWN16,SAY_LIGHT_OF_DAWN17, + SAY_LIGHT_OF_DAWN18,SAY_LIGHT_OF_DAWN19,SAY_LIGHT_OF_DAWN20, + SAY_LIGHT_OF_DAWN21,SAY_LIGHT_OF_DAWN22,SAY_LIGHT_OF_DAWN23, + SAY_LIGHT_OF_DAWN24), me); + uiFight_speech = 15000 + rand()%5000; + } else uiFight_speech -= diff; + + // Check spawns + if (uiSpawncheck <= diff) + { + SpawnNPC(); + uiSpawncheck = 1000; + } else uiSpawncheck -= diff; + + // Check targets + if (uiTargetcheck <= diff) + { + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + NPCChangeTarget(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + NPCChangeTarget(uiWarriorGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + NPCChangeTarget(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + NPCChangeTarget(uiBehemothGUID[i]); + NPCChangeTarget(uiKoltiraGUID); + NPCChangeTarget(uiOrbazGUID); + NPCChangeTarget(uiThassarianGUID); + + uiTargetcheck = 10000; + } else uiTargetcheck -= diff; + + // Battle end + if (uiFight_duration <= diff + 5000) + { + if (!uiTirionGUID) + if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + { + pTemp->setFaction(me->getFaction()); + pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); + DoScriptText(SAY_LIGHT_OF_DAWN25, pTemp); + uiTirionGUID = pTemp->GetGUID(); } - me->SetVisibility(VISIBILITY_OFF); // respawns another Darion for quest turn in - me->SummonCreature(NPC_HIGHLORD_DARION_MOGRAINE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); - JumpToNextStep(1000); - break; - - case 72: - SetHoldState(false); // Escort ends - JumpToNextStep(25000); - break; - - case 73: - me->ForcedDespawn(); - break; } + if (uiFight_duration <= diff) + { + bIsBattle = false; + uiFight_duration = 300000; - } else uiPhase_timer -= diff; - } + if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) + me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->InterruptNonMeleeSpells(false); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - // ******* During battle ***************************************************************** - else - { - if (uiAnti_magic_zone <= diff) - { - DoCast(me, SPELL_ANTI_MAGIC_ZONE1); - uiAnti_magic_zone = 25000 + rand()%5000; - } else uiAnti_magic_zone -= diff; + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + DespawnNPC(uiDefenderGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + DespawnNPC(uiEarthshatterGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + DespawnNPC(uiAbominationGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + DespawnNPC(uiBehemothGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + DespawnNPC(uiGhoulGUID[i]); + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + DespawnNPC(uiWarriorGUID[i]); - if (uiDeath_strike <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_STRIKE); - uiDeath_strike = 5000 + rand()%5000; - } else uiDeath_strike -= diff; - - if (uiDeath_embrace <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_EMBRACE); - uiDeath_embrace = 5000 + rand()%5000; - } else uiDeath_embrace -= diff; - - if (uiIcy_touch <= diff) - { - DoCast(me->getVictim(), SPELL_ICY_TOUCH1); - uiIcy_touch = 5000 + rand()%5000; - } else uiIcy_touch -= diff; - - if (uiUnholy_blight <= diff) - { - DoCast(me->getVictim(), SPELL_UNHOLY_BLIGHT); - uiUnholy_blight = 5000 + rand()%5000; - } else uiUnholy_blight -= diff; - - if (uiFight_speech <= diff) - { - DoScriptText(RAND(SAY_LIGHT_OF_DAWN09,SAY_LIGHT_OF_DAWN10,SAY_LIGHT_OF_DAWN11, - SAY_LIGHT_OF_DAWN12,SAY_LIGHT_OF_DAWN13,SAY_LIGHT_OF_DAWN14, - SAY_LIGHT_OF_DAWN15,SAY_LIGHT_OF_DAWN16,SAY_LIGHT_OF_DAWN17, - SAY_LIGHT_OF_DAWN18,SAY_LIGHT_OF_DAWN19,SAY_LIGHT_OF_DAWN20, - SAY_LIGHT_OF_DAWN21,SAY_LIGHT_OF_DAWN22,SAY_LIGHT_OF_DAWN23, - SAY_LIGHT_OF_DAWN24), me); - uiFight_speech = 15000 + rand()%5000; - } else uiFight_speech -= diff; - - // Check spawns - if (uiSpawncheck <= diff) - { - SpawnNPC(); - uiSpawncheck = 1000; - } else uiSpawncheck -= diff; - - // Check targets - if (uiTargetcheck <= diff) - { - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - NPCChangeTarget(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - NPCChangeTarget(uiWarriorGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - NPCChangeTarget(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - NPCChangeTarget(uiBehemothGUID[i]); - NPCChangeTarget(uiKoltiraGUID); - NPCChangeTarget(uiOrbazGUID); - NPCChangeTarget(uiThassarianGUID); - - uiTargetcheck = 10000; - } else uiTargetcheck -= diff; - - // Battle end - if (uiFight_duration <= diff + 5000) - { - if (!uiTirionGUID) - if (Unit* pTemp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); pTemp->setFaction(me->getFaction()); - pTemp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); - DoScriptText(SAY_LIGHT_OF_DAWN25, pTemp); - uiTirionGUID = pTemp->GetGUID(); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); } - } - if (uiFight_duration <= diff) - { - bIsBattle = false; - uiFight_duration = 300000; - if (me->HasAura(SPELL_THE_MIGHT_OF_MOGRAINE, 0)) - me->RemoveAurasDueToSpell(SPELL_THE_MIGHT_OF_MOGRAINE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->InterruptNonMeleeSpells(false); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) - DespawnNPC(uiDefenderGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - DespawnNPC(uiEarthshatterGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - DespawnNPC(uiAbominationGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - DespawnNPC(uiBehemothGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - DespawnNPC(uiGhoulGUID[i]); - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - DespawnNPC(uiWarriorGUID[i]); - - if (Creature* pTemp = Unit::GetCreature(*me, uiKorfaxGUID)) - { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) - { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) - { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); - } - DespawnNPC(uiRayneGUID); - - if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) - { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); - pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) - DoScriptText(EMOTE_LIGHT_OF_DAWN04, pTemp); - - if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) - { - pTemp->RemoveAllAuras(); - pTemp->DeleteThreatList(); - pTemp->CombatStop(true); - pTemp->AttackStop(); - pTemp->setFaction(me->getFaction()); - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); - pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); - } - - if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) - DoScriptText(SAY_LIGHT_OF_DAWN26, pTemp); - - SetHoldState(false); - - } else uiFight_duration -= diff; - - DoMeleeAttackIfReady(); - } - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } - - void NPCChangeTarget(uint64 ui_GUID) - { - if (Creature* pTemp = Unit::GetCreature(*me, ui_GUID)) - if (pTemp->isAlive()) - if (Unit* pTarger = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (pTarger->isAlive()) + if (Creature* pTemp = Unit::GetCreature(*me, uiMaxwellGUID)) { - // pTemp->DeleteThreatList(); - pTemp->AddThreat(pTarger, 0.0f); - pTemp->AI()->AttackStart(pTarger); - pTemp->SetInCombatWith(pTarger); - pTarger->SetInCombatWith(pTemp); - // pTemp->GetMotionMaster()->MoveChase(pTarger, 20.0f); + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); } - } - void SpawnNPC() - { - Unit* pTemp = NULL; + if (Creature* pTemp = Unit::GetCreature(*me, uiEligorGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); + } + DespawnNPC(uiRayneGUID); - // Death - for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiGhoulGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiGhoulGUID[i] = pTemp->GetGUID(); - } - } - for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiAbominationGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiAbominationGUID[i] = pTemp->GetGUID(); - } - } - for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiWarriorGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiWarriorGUID[i] = pTemp->GetGUID(); - } - } - for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiBehemothGUID[i]); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2084); - uiBehemothGUID[i] = pTemp->GetGUID(); + if (Creature* pTemp = Unit::GetCreature(*me, uiKoltiraGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); + pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); + } + + if (Creature* pTemp = Unit::GetCreature(*me, uiOrbazGUID)) + DoScriptText(EMOTE_LIGHT_OF_DAWN04, pTemp); + + if (Creature* pTemp = Unit::GetCreature(*me, uiThassarianGUID)) + { + pTemp->RemoveAllAuras(); + pTemp->DeleteThreatList(); + pTemp->CombatStop(true); + pTemp->AttackStop(); + pTemp->setFaction(me->getFaction()); + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); + pTemp->CastSpell(pTemp, SPELL_THE_LIGHT_OF_DAWN, false); + } + + if (Creature* pTemp = Unit::GetCreature(*me, uiTirionGUID)) + DoScriptText(SAY_LIGHT_OF_DAWN26, pTemp); + + SetHoldState(false); + + } else uiFight_duration -= diff; + + DoMeleeAttackIfReady(); } } - // Dawn - for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + void JumpToNextStep(uint32 uiTimer) { - pTemp = Unit::GetCreature(*me, uiDefenderGUID[i]); + uiPhase_timer = uiTimer; + ++uiStep; + } + + void NPCChangeTarget(uint64 ui_GUID) + { + if (Creature* pTemp = Unit::GetCreature(*me, ui_GUID)) + if (pTemp->isAlive()) + if (Unit* pTarger = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (pTarger->isAlive()) + { + // pTemp->DeleteThreatList(); + pTemp->AddThreat(pTarger, 0.0f); + pTemp->AI()->AttackStart(pTarger); + pTemp->SetInCombatWith(pTarger); + pTarger->SetInCombatWith(pTemp); + // pTemp->GetMotionMaster()->MoveChase(pTarger, 20.0f); + } + } + + void SpawnNPC() + { + Unit* pTemp = NULL; + + // Death + for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiGhoulGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiGhoulGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiAbominationGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiAbominationGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiWarriorGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiWarriorGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiBehemothGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2084); + uiBehemothGUID[i] = pTemp->GetGUID(); + } + } + + // Dawn + for (uint8 i = 0; i < ENCOUNTER_DEFENDER_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiDefenderGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiDefenderGUID[i] = pTemp->GetGUID(); + } + } + for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) + { + pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i]); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiEarthshatterGUID[i] = pTemp->GetGUID(); + } + } + pTemp = Unit::GetCreature(*me, uiKorfaxGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); pTemp->setFaction(2089); me->AddThreat(pTemp, 0.0f); - uiDefenderGUID[i] = pTemp->GetGUID(); + uiKorfaxGUID = pTemp->GetGUID(); } - } - for (uint8 i = 0; i < ENCOUNTER_EARTHSHATTER_NUMBER; ++i) - { - pTemp = Unit::GetCreature(*me, uiEarthshatterGUID[i]); + pTemp = Unit::GetCreature(*me, uiMaxwellGUID); if (!pTemp) { - pTemp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); pTemp->setFaction(2089); me->AddThreat(pTemp, 0.0f); - uiEarthshatterGUID[i] = pTemp->GetGUID(); + uiMaxwellGUID = pTemp->GetGUID(); } - } - pTemp = Unit::GetCreature(*me, uiKorfaxGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiKorfaxGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiMaxwellGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiMaxwellGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiEligorGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiEligorGUID = pTemp->GetGUID(); - } - pTemp = Unit::GetCreature(*me, uiRayneGUID); - if (!pTemp) - { - pTemp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); - pTemp->setFaction(2089); - me->AddThreat(pTemp, 0.0f); - uiRayneGUID = pTemp->GetGUID(); - } - } - - void DespawnNPC(uint64 pGUID) - { - if (Creature* pTemp = Unit::GetCreature(*me, pGUID)) - if (pTemp->isAlive()) + pTemp = Unit::GetCreature(*me, uiEligorGUID); + if (!pTemp) { - pTemp->SetVisibility(VISIBILITY_OFF); - pTemp->Kill(pTemp); + pTemp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiEligorGUID = pTemp->GetGUID(); } - } + pTemp = Unit::GetCreature(*me, uiRayneGUID); + if (!pTemp) + { + pTemp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x+rand()%30, LightofDawnLoc[0].y+rand()%30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + pTemp->setFaction(2089); + me->AddThreat(pTemp, 0.0f); + uiRayneGUID = pTemp->GetGUID(); + } + } + + void DespawnNPC(uint64 pGUID) + { + if (Creature* pTemp = Unit::GetCreature(*me, pGUID)) + if (pTemp->isAlive()) + { + pTemp->SetVisibility(VISIBILITY_OFF); + pTemp->Kill(pTemp); + } + } + }; + }; -bool GossipHello_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(12801) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(0, "I am ready.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_highlord_darion_mograine(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_highlord_darion_mograineAI, pCreature->AI())->uiStep = 1; - CAST_AI(npc_highlord_darion_mograineAI, pCreature->AI())->Start(true, false, pPlayer->GetGUID()); - break; - } - return true; -} /*###### ## npc the lich king in dawn of light -######*/ -struct npc_the_lich_king_tirion_dawnAI : public ScriptedAI +######*/ class npc_the_lich_king_tirion_dawn : public CreatureScript { - npc_the_lich_king_tirion_dawnAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - void Reset() {} - void AttackStart(Unit * /*who*/) {} // very sample, just don't make them aggreesive - void UpdateAI(const uint32 /*diff*/) {} - void JustDied(Unit* /*killer*/) {} +public: + npc_the_lich_king_tirion_dawn() : CreatureScript("npc_the_lich_king_tirion_dawn") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_the_lich_king_tirion_dawnAI (pCreature); + } + + struct npc_the_lich_king_tirion_dawnAI : public ScriptedAI + { + npc_the_lich_king_tirion_dawnAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + void Reset() {} + void AttackStart(Unit * /*who*/) {} // very sample, just don't make them aggreesive + void UpdateAI(const uint32 /*diff*/) {} + void JustDied(Unit* /*killer*/) {} + }; + }; -CreatureAI* GetAI_npc_highlord_darion_mograine(Creature* pCreature) -{ - return new npc_highlord_darion_mograineAI(pCreature); -} -CreatureAI* GetAI_npc_the_lich_king_tirion_dawn(Creature* pCreature) -{ - return new npc_the_lich_king_tirion_dawnAI (pCreature); -} void AddSC_the_scarlet_enclave_c5() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_highlord_darion_mograine"; - newscript->GetAI = &GetAI_npc_highlord_darion_mograine; - newscript->pGossipHello = &GossipHello_npc_highlord_darion_mograine; - newscript->pGossipSelect = &GossipSelect_npc_highlord_darion_mograine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_the_lich_king_tirion_dawn"; - newscript->GetAI = &GetAI_npc_the_lich_king_tirion_dawn; - newscript->RegisterSelf(); + new npc_highlord_darion_mograine(); + new npc_the_lich_king_tirion_dawn(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index 0a4f02c2e62..35d7baec4a3 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -22,97 +22,96 @@ ####*/ #define SPELL_REVIVE 51918 #define VALK_WHISPER "It is not yet your time, champion. Rise! Rise and fight once more!" - -struct npc_valkyr_battle_maidenAI : public PassiveAI + class npc_valkyr_battle_maiden : public CreatureScript { - npc_valkyr_battle_maidenAI(Creature *c) : PassiveAI(c) {} +public: + npc_valkyr_battle_maiden() : CreatureScript("npc_valkyr_battle_maiden") { } - uint32 FlyBackTimer; - float x, y, z; - uint32 phase; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->setActive(true); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlying(true); - FlyBackTimer = 500; - phase = 0; - - me->GetPosition(x, y, z); - z += 4; x -= 3.5; y -= 5; - me->GetMotionMaster()->Clear(false); - me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f); + return new npc_valkyr_battle_maidenAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_valkyr_battle_maidenAI : public PassiveAI { - if (FlyBackTimer <= diff) + npc_valkyr_battle_maidenAI(Creature *c) : PassiveAI(c) {} + + uint32 FlyBackTimer; + float x, y, z; + uint32 phase; + + void Reset() { - Player *plr = NULL; - if (me->isSummon()) - if (Unit *summoner = CAST_SUM(me)->GetSummoner()) - if (summoner->GetTypeId() == TYPEID_PLAYER) - plr = CAST_PLR(summoner); + me->setActive(true); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlying(true); + FlyBackTimer = 500; + phase = 0; - if (!plr) - phase = 3; + me->GetPosition(x, y, z); + z += 4; x -= 3.5; y -= 5; + me->GetMotionMaster()->Clear(false); + me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f); + } - switch(phase) + void UpdateAI(const uint32 diff) + { + if (FlyBackTimer <= diff) { - case 0: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED); - FlyBackTimer = 500; - break; - case 1: - plr->GetClosePoint(x,y,z, me->GetObjectSize()); - z += 2.5; x -= 2; y -= 1.5; - me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID()); - me->SetVisibility(VISIBILITY_ON); - FlyBackTimer = 4500; - break; - case 2: - if (!plr->isRessurectRequested()) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01); - DoCast(plr, SPELL_REVIVE, true); - me->MonsterWhisper(VALK_WHISPER, plr->GetGUID()); - } - FlyBackTimer = 5000; - break; - case 3: - me->SetVisibility(VISIBILITY_OFF); - FlyBackTimer = 3000; - break; - case 4: - me->DisappearAndDie(); - break; - default: - //Nothing To DO - break; - } - ++phase; - } else FlyBackTimer-=diff; - } + Player *plr = NULL; + if (me->isSummon()) + if (Unit *summoner = CAST_SUM(me)->GetSummoner()) + if (summoner->GetTypeId() == TYPEID_PLAYER) + plr = CAST_PLR(summoner); + + if (!plr) + phase = 3; + + switch(phase) + { + case 0: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED); + FlyBackTimer = 500; + break; + case 1: + plr->GetClosePoint(x,y,z, me->GetObjectSize()); + z += 2.5; x -= 2; y -= 1.5; + me->GetMotionMaster()->MovePoint(0, x, y, z); + me->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID()); + me->SetVisibility(VISIBILITY_ON); + FlyBackTimer = 4500; + break; + case 2: + if (!plr->isRessurectRequested()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01); + DoCast(plr, SPELL_REVIVE, true); + me->MonsterWhisper(VALK_WHISPER, plr->GetGUID()); + } + FlyBackTimer = 5000; + break; + case 3: + me->SetVisibility(VISIBILITY_OFF); + FlyBackTimer = 3000; + break; + case 4: + me->DisappearAndDie(); + break; + default: + //Nothing To DO + break; + } + ++phase; + } else FlyBackTimer-=diff; + } + }; + }; -CreatureAI* GetAI_npc_valkyr_battle_maiden(Creature* pCreature) -{ - return new npc_valkyr_battle_maidenAI (pCreature); -} void AddSC_the_scarlet_enclave() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_valkyr_battle_maiden"; - newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; - newscript->RegisterSelf(); - - // Chapter 3: Scarlet Armies Approach... - An End To All Things... - // Chapter 4: An End To All Things... - An End To All Things... + new npc_valkyr_battle_maiden(); } diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp index 6659d1aaba8..98c30dfdc2f 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_arcanist_doan.cpp @@ -36,95 +36,97 @@ enum eEnums SPELL_FIREAOE = 9435, SPELL_ARCANEBUBBLE = 9438, }; - -struct boss_arcanist_doanAI : public ScriptedAI + class boss_arcanist_doan : public CreatureScript { - boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {} +public: + boss_arcanist_doan() : CreatureScript("boss_arcanist_doan") { } - uint32 Polymorph_Timer; - uint32 AoESilence_Timer; - uint32 ArcaneExplosion_Timer; - bool bCanDetonate; - bool bShielded; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Polymorph_Timer = 20000; - AoESilence_Timer = 15000; - ArcaneExplosion_Timer = 3000; - bCanDetonate = false; - bShielded = false; + return new boss_arcanist_doanAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_arcanist_doanAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_arcanist_doanAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Polymorph_Timer; + uint32 AoESilence_Timer; + uint32 ArcaneExplosion_Timer; + bool bCanDetonate; + bool bShielded; - if (bShielded && bCanDetonate) + void Reset() { - DoCast(me, SPELL_FIREAOE); + Polymorph_Timer = 20000; + AoESilence_Timer = 15000; + ArcaneExplosion_Timer = 3000; bCanDetonate = false; + bShielded = false; } - if (me->HasAura(SPELL_ARCANEBUBBLE)) - return; - - //If we are <50% hp cast Arcane Bubble - if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + void EnterCombat(Unit * /*who*/) { - //wait if we already casting - if (me->IsNonMeleeSpellCasted(false)) + DoScriptText(SAY_AGGRO, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) return; - DoScriptText(SAY_SPECIALAE, me); - DoCast(me, SPELL_ARCANEBUBBLE); + if (bShielded && bCanDetonate) + { + DoCast(me, SPELL_FIREAOE); + bCanDetonate = false; + } - bCanDetonate = true; - bShielded = true; + if (me->HasAura(SPELL_ARCANEBUBBLE)) + return; + + //If we are <50% hp cast Arcane Bubble + if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + { + //wait if we already casting + if (me->IsNonMeleeSpellCasted(false)) + return; + + DoScriptText(SAY_SPECIALAE, me); + DoCast(me, SPELL_ARCANEBUBBLE); + + bCanDetonate = true; + bShielded = true; + } + + if (Polymorph_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget, SPELL_POLYMORPH); + + Polymorph_Timer = 20000; + } else Polymorph_Timer -= diff; + + //AoESilence_Timer + if (AoESilence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AOESILENCE); + AoESilence_Timer = 15000 + rand()%5000; + } else AoESilence_Timer -= diff; + + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); + ArcaneExplosion_Timer = 8000; + } else ArcaneExplosion_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (Polymorph_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(pTarget, SPELL_POLYMORPH); - - Polymorph_Timer = 20000; - } else Polymorph_Timer -= diff; - - //AoESilence_Timer - if (AoESilence_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_AOESILENCE); - AoESilence_Timer = 15000 + rand()%5000; - } else AoESilence_Timer -= diff; - - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION); - ArcaneExplosion_Timer = 8000; - } else ArcaneExplosion_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_arcanist_doan(Creature* pCreature) -{ - return new boss_arcanist_doanAI (pCreature); -} void AddSC_boss_arcanist_doan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_arcanist_doan"; - newscript->GetAI = &GetAI_boss_arcanist_doan; - newscript->RegisterSelf(); + new boss_arcanist_doan(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp index e30e527d567..d687a7da0d2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_azshir_the_sleepless.cpp @@ -28,73 +28,75 @@ EndScriptData */ #define SPELL_CALLOFTHEGRAVE 17831 #define SPELL_TERRIFY 7399 #define SPELL_SOULSIPHON 7290 - -struct boss_azshir_the_sleeplessAI : public ScriptedAI + class boss_azshir_the_sleepless : public CreatureScript { - boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {} +public: + boss_azshir_the_sleepless() : CreatureScript("boss_azshir_the_sleepless") { } - uint32 SoulSiphon_Timer; - uint32 CallOftheGrave_Timer; - uint32 Terrify_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SoulSiphon_Timer = 1; - CallOftheGrave_Timer = 30000; - Terrify_Timer = 20000; + return new boss_azshir_the_sleeplessAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_azshir_the_sleeplessAI : public ScriptedAI { - } + boss_azshir_the_sleeplessAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 SoulSiphon_Timer; + uint32 CallOftheGrave_Timer; + uint32 Terrify_Timer; - //If we are <50% hp cast Soul Siphon rank 1 - if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false)) + void Reset() { - //SoulSiphon_Timer - if (SoulSiphon_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SOULSIPHON); - return; - - //SoulSiphon_Timer = 20000; - } else SoulSiphon_Timer -= diff; + SoulSiphon_Timer = 1; + CallOftheGrave_Timer = 30000; + Terrify_Timer = 20000; } - //CallOfTheGrave_Timer - if (CallOftheGrave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); - CallOftheGrave_Timer = 30000; - } else CallOftheGrave_Timer -= diff; + } - //Terrify_Timer - if (Terrify_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_TERRIFY); - Terrify_Timer = 20000; - } else Terrify_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <50% hp cast Soul Siphon rank 1 + if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false)) + { + //SoulSiphon_Timer + if (SoulSiphon_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SOULSIPHON); + return; + + //SoulSiphon_Timer = 20000; + } else SoulSiphon_Timer -= diff; + } + + //CallOfTheGrave_Timer + if (CallOftheGrave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); + CallOftheGrave_Timer = 30000; + } else CallOftheGrave_Timer -= diff; + + //Terrify_Timer + if (Terrify_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TERRIFY); + Terrify_Timer = 20000; + } else Terrify_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_azshir_the_sleepless(Creature* pCreature) -{ - return new boss_azshir_the_sleeplessAI (pCreature); -} void AddSC_boss_azshir_the_sleepless() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azshir_the_sleepless"; - newscript->GetAI = &GetAI_boss_azshir_the_sleepless; - newscript->RegisterSelf(); + new boss_azshir_the_sleepless(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp index 2a53ce591db..131e74e5b99 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_bloodmage_thalnos.cpp @@ -36,91 +36,93 @@ enum eEnums SPELL_FLAMESPIKE = 8814, SPELL_FIRENOVA = 16079, }; - -struct boss_bloodmage_thalnosAI : public ScriptedAI + class boss_bloodmage_thalnos : public CreatureScript { - boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {} +public: + boss_bloodmage_thalnos() : CreatureScript("boss_bloodmage_thalnos") { } - bool HpYell; - uint32 FlameShock_Timer; - uint32 ShadowBolt_Timer; - uint32 FlameSpike_Timer; - uint32 FireNova_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - HpYell = false; - FlameShock_Timer = 10000; - ShadowBolt_Timer = 2000; - FlameSpike_Timer = 8000; - FireNova_Timer = 40000; + return new boss_bloodmage_thalnosAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_bloodmage_thalnosAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_bloodmage_thalnosAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit* /*Victim*/) - { - DoScriptText(SAY_KILL, me); - } + bool HpYell; + uint32 FlameShock_Timer; + uint32 ShadowBolt_Timer; + uint32 FlameSpike_Timer; + uint32 FireNova_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are <35% hp - if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35)) + void Reset() { - DoScriptText(SAY_HEALTH, me); - HpYell = true; + HpYell = false; + FlameShock_Timer = 10000; + ShadowBolt_Timer = 2000; + FlameSpike_Timer = 8000; + FireNova_Timer = 40000; } - //FlameShock_Timer - if (FlameShock_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FLAMESHOCK); - FlameShock_Timer = 10000 + rand()%5000; - } else FlameShock_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } - //FlameSpike_Timer - if (FlameSpike_Timer <= diff) + void KilledUnit(Unit* /*Victim*/) { - DoCast(me->getVictim(), SPELL_FLAMESPIKE); - FlameSpike_Timer = 30000; - } else FlameSpike_Timer -= diff; + DoScriptText(SAY_KILL, me); + } - //FireNova_Timer - if (FireNova_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FIRENOVA); - FireNova_Timer = 40000; - } else FireNova_Timer -= diff; + if (!UpdateVictim()) + return; - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWBOLT); - ShadowBolt_Timer = 2000; - } else ShadowBolt_Timer -= diff; + //If we are <35% hp + if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35)) + { + DoScriptText(SAY_HEALTH, me); + HpYell = true; + } + + //FlameShock_Timer + if (FlameShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMESHOCK); + FlameShock_Timer = 10000 + rand()%5000; + } else FlameShock_Timer -= diff; + + //FlameSpike_Timer + if (FlameSpike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAMESPIKE); + FlameSpike_Timer = 30000; + } else FlameSpike_Timer -= diff; + + //FireNova_Timer + if (FireNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIRENOVA); + FireNova_Timer = 40000; + } else FireNova_Timer -= diff; + + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 2000; + } else ShadowBolt_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_bloodmage_thalnos(Creature* pCreature) -{ - return new boss_bloodmage_thalnosAI (pCreature); -} void AddSC_boss_bloodmage_thalnos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_bloodmage_thalnos"; - newscript->GetAI = &GetAI_boss_bloodmage_thalnos; - newscript->RegisterSelf(); + new boss_bloodmage_thalnos(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 50a4dd8f60e..1f35363c635 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -127,604 +127,752 @@ static const char* Text[]= }; #define EMOTE_LAUGHS "Headless Horseman laughs" - -struct mob_wisp_invisAI : public ScriptedAI + class mob_wisp_invis : public CreatureScript { - mob_wisp_invisAI(Creature *c) : ScriptedAI(c) +public: + mob_wisp_invis() : CreatureScript("mob_wisp_invis") { } + + CreatureAI* GetAI(Creature* pCreature) const { - Creaturetype = delay = spell = spell2 = 0; - //that's hack but there are no info about range of this spells in dbc - SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE); - if (wisp) - wisp->rangeIndex = 6; //100 yards - SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT); - if (port) - port->rangeIndex = 6; + return new mob_wisp_invisAI (pCreature); } - uint32 Creaturetype; - uint32 delay; - uint32 spell; - uint32 spell2; - void Reset(){} - void EnterCombat(Unit * /*who*/){} - void SetType(uint32 _type) + struct mob_wisp_invisAI : public ScriptedAI { - switch(Creaturetype = _type) + mob_wisp_invisAI(Creature *c) : ScriptedAI(c) { - case 1: - spell = SPELL_PUMPKIN_AURA_GREEN; - break; - case 2: - delay = 15000; - spell = SPELL_BODY_FLAME; - spell2 = SPELL_DEATH; - break; - case 3: - delay = 15000; - spell = SPELL_SMOKE; - break; - case 4: - delay = 7000; - spell2 = SPELL_WISP_BLUE; - break; + Creaturetype = delay = spell = spell2 = 0; + //that's hack but there are no info about range of this spells in dbc + SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE); + if (wisp) + wisp->rangeIndex = 6; //100 yards + SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT); + if (port) + port->rangeIndex = 6; } - if (spell) - DoCast(me, spell); - } - void SpellHit(Unit* /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) - me->SetDisplayId(2027); - } - - void MoveInLineOfSight(Unit *who) - { - if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) - return; - - if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL)) - DoCast(who, SPELL_SQUASH_SOUL); - } - - void UpdateAI(const uint32 diff) - { - if (delay) + uint32 Creaturetype; + uint32 delay; + uint32 spell; + uint32 spell2; + void Reset(){} + void EnterCombat(Unit * /*who*/){} + void SetType(uint32 _type) { - if (delay <= diff) + switch(Creaturetype = _type) { - me->RemoveAurasDueToSpell(SPELL_SMOKE); - if (spell2) - DoCast(me, spell2); - delay = 0; - } else delay -= diff; + case 1: + spell = SPELL_PUMPKIN_AURA_GREEN; + break; + case 2: + delay = 15000; + spell = SPELL_BODY_FLAME; + spell2 = SPELL_DEATH; + break; + case 3: + delay = 15000; + spell = SPELL_SMOKE; + break; + case 4: + delay = 7000; + spell2 = SPELL_WISP_BLUE; + break; + } + if (spell) + DoCast(me, spell); } - } -}; -struct mob_headAI : public ScriptedAI -{ - mob_headAI(Creature *c) : ScriptedAI(c) {} - - uint64 bodyGUID; - - uint32 Phase; - uint32 laugh; - uint32 wait; - - bool withbody; - bool die; - - void Reset() - { - Phase = 0; - bodyGUID = 0; - die = false; - withbody = true; - wait = 1000; - laugh = urand(15000,30000); - } - - void EnterCombat(Unit * /*who*/) {} - void SaySound(int32 textEntry, Unit *pTarget = 0) - { - DoScriptText(textEntry, me, pTarget); - //DoCast(me, SPELL_HEAD_SPEAKS, true); - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - if (speaker) - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - laugh += 3000; - } - - void DamageTaken(Unit* /*done_by*/,uint32 &damage) - { - if (withbody) - return; - - switch(Phase) + void SpellHit(Unit* /*caster*/, const SpellEntry *spell) { - case 1: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67) - Disappear(); - break; - case 2: - if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34) - Disappear(); - break; - case 3: - if (damage >= me->GetHealth()) + if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) + me->SetDisplayId(2027); + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || Creaturetype != 1 || !who->isTargetableForAttack()) + return; + + if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL)) + DoCast(who, SPELL_SQUASH_SOUL); + } + + void UpdateAI(const uint32 diff) + { + if (delay) + { + if (delay <= diff) { - die = true; - withbody = true; - wait = 300; - damage = me->GetHealth() - me->GetMaxHealth()/100; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->StopMoving(); - //me->GetMotionMaster()->MoveIdle(); - DoCast(me, SPELL_HEAD_IS_DEAD); - } - break; + me->RemoveAurasDueToSpell(SPELL_SMOKE); + if (spell2) + DoCast(me, spell2); + delay = 0; + } else delay -= diff; + } } + }; + +}; + class mob_head : public CreatureScript +{ +public: + mob_head() : CreatureScript("mob_head") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_headAI (pCreature); } - void SpellHit(Unit *caster, const SpellEntry* spell) + struct mob_headAI : public ScriptedAI { - if (!withbody) - return; + mob_headAI(Creature *c) : ScriptedAI(c) {} - if (spell->Id == SPELL_FLYING_HEAD) + uint64 bodyGUID; + + uint32 Phase; + uint32 laugh; + uint32 wait; + + bool withbody; + bool die; + + void Reset() { - if (Phase < 3) ++Phase; - else Phase = 3; - withbody = false; - if (!bodyGUID) - bodyGUID = caster->GetGUID(); - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_HEAD_LANDS, true); - DoCast(me, SPELL_HEAD, false); - SaySound(SAY_LOST_HEAD); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFleeing(caster->getVictim()); + Phase = 0; + bodyGUID = 0; + die = false; + withbody = true; + wait = 1000; + laugh = urand(15000,30000); } - } - void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below - void UpdateAI(const uint32 diff) - { - if (!withbody) + + void EnterCombat(Unit * /*who*/) {} + void SaySound(int32 textEntry, Unit *pTarget = 0) { - if (wait <= diff) + DoScriptText(textEntry, me, pTarget); + //DoCast(me, SPELL_HEAD_SPEAKS, true); + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + if (speaker) + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + laugh += 3000; + } + + void DamageTaken(Unit* /*done_by*/,uint32 &damage) + { + if (withbody) + return; + + switch(Phase) { - wait = 1000; - if (!me->getVictim()) return; + case 1: + if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67) + Disappear(); + break; + case 2: + if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34) + Disappear(); + break; + case 3: + if (damage >= me->GetHealth()) + { + die = true; + withbody = true; + wait = 300; + damage = me->GetHealth() - me->GetMaxHealth()/100; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->StopMoving(); + //me->GetMotionMaster()->MoveIdle(); + DoCast(me, SPELL_HEAD_IS_DEAD); + } + break; + } + } + + void SpellHit(Unit *caster, const SpellEntry* spell) + { + if (!withbody) + return; + + if (spell->Id == SPELL_FLYING_HEAD) + { + if (Phase < 3) ++Phase; + else Phase = 3; + withbody = false; + if (!bodyGUID) + bodyGUID = caster->GetGUID(); + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_HEAD_LANDS, true); + DoCast(me, SPELL_HEAD, false); + SaySound(SAY_LOST_HEAD); me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFleeing(me->getVictim()); - } else wait -= diff; - - if (laugh <= diff) - { - laugh = urand(15000,30000); - DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]); - //DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head" - Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); - if (speaker) - speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); - me->MonsterTextEmote(EMOTE_LAUGHS,NULL); - } else laugh -= diff; + me->GetMotionMaster()->MoveFleeing(caster->getVictim()); + } } - else + void Disappear(); + void UpdateAI(const uint32 diff) { - if (die) + if (!withbody) { if (wait <= diff) { - die = false; - if (Unit *body = Unit::GetUnit((*me), bodyGUID)) - body->Kill(body); - me->Kill(me); + wait = 1000; + if (!me->getVictim()) return; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveFleeing(me->getVictim()); } else wait -= diff; + + if (laugh <= diff) + { + laugh = urand(15000,30000); + DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]); + //DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head" + Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000); + if (speaker) + speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false); + me->MonsterTextEmote(EMOTE_LAUGHS,NULL); + } else laugh -= diff; } - } - } -}; - -struct boss_headless_horsemanAI : public ScriptedAI -{ - boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) - { - SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION); - if (confl) - { - confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; - confl->EffectBasePoints[0] = 10; - //confl->EffectBaseDice[0] = 10; - confl->DmgMultiplier[0] = 1; - } -/* - if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION)) - confl->EffectTriggerSpell[1] = 22587; - - if (SpellEntry *speed = GET_SPELL(22587)) - { - speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; - speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; - } -*/ - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint64 headGUID; - uint64 PlayerGUID; - - uint32 Phase; - uint32 id; - uint32 count; - uint32 say_timer; - - uint32 conflagrate; - uint32 summonadds; - uint32 cleave; - uint32 regen; - uint32 whirlwind; - uint32 laugh; - uint32 burn; - - bool withhead; - bool returned; - bool IsFlying; - bool wp_reached; - bool burned; - - void Reset() - { - Phase = 1; - conflagrate = 15000; - summonadds = 15000; - laugh = urand(16000,20000); - cleave = 2000; - regen = 1000; - burn = 6000; - count = 0; - say_timer = 3000; - - withhead = true; - returned = true; - burned = false; - IsFlying = false; - DoCast(me, SPELL_HEAD); - if (headGUID) - { - if (Creature* Head = Unit::GetCreature((*me), headGUID)) - Head->DisappearAndDie(); - - headGUID = 0; - } - - //if (pInstance) - // pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED); - } - - void FlyMode() - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - me->SetSpeed(MOVE_WALK,5.0f,true); - wp_reached = false; - count = 0; - say_timer = 3000; - id = 0; - Phase = 0; - } - - void MovementInform(uint32 type, uint32 i) - { - if (type != POINT_MOTION_TYPE || !IsFlying || i != id) - return; - - wp_reached = true; - - switch (id) - { - case 0: - me->SetVisibility(VISIBILITY_ON); - break; - case 1: - { - if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000)) - CAST_AI(mob_wisp_invisAI, smoke->AI())->SetType(3); - DoCast(me, SPELL_RHYME_BIG); - break; - } - case 6: - if (pInstance) - pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject - break; - case 19: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - break; - case 20: - { - Phase = 1; - IsFlying = false; - wp_reached = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - SaySound(SAY_ENTRANCE); - if (Unit *plr = Unit::GetUnit((*me),PlayerGUID)) - DoStartMovement(plr); - break; - } - } - ++id; - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); - DoZoneInCombat(); - } - void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} - void MoveInLineOfSight(Unit *who) - { - if (withhead && Phase != 0) - ScriptedAI::MoveInLineOfSight(who); - } - void KilledUnit(Unit *plr) - { - if (plr->GetTypeId() == TYPEID_PLAYER) - { - if (withhead) - SaySound(SAY_PLAYER_DEATH); - //maybe possible when player dies from conflagration - else if (Creature *Head = Unit::GetCreature((*me), headGUID)) - CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); - } - } - - void SaySound(int32 textEntry, Unit *pTarget = 0) - { - DoScriptText(textEntry, me, pTarget); - laugh += 4000; - } - - Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) - { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return NULL; - - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - Map::PlayerList::const_iterator i; - if (PlayerList.isEmpty()) return NULL; - - std::list temp; - std::list::const_iterator j; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && - me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) - temp.push_back(i->getSource()); - - if (temp.size()) - { - j = temp.begin(); - advance(j, rand()%temp.size()); - return (*j); - } - return NULL; - } - - void SpellHitTarget(Unit* unit, const SpellEntry* spell) - { - if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION)) - SaySound(SAY_CONFLAGRATION,unit); - } - - void JustDied(Unit* /*killer*/) - { - me->StopMoving(); - //me->GetMotionMaster()->MoveIdle(); - SaySound(SAY_DEATH); - if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) - flame->CastSpell(flame,SPELL_BODY_FLAME,false); - if (Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) - CAST_AI(mob_wisp_invisAI, wisp->AI())->SetType(4); - if (pInstance) - pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); - } - - void SpellHit(Unit *caster, const SpellEntry* spell) - { - if (withhead) - return; - - if (spell->Id == SPELL_FLYING_HEAD) - { - if (Phase < 3) - ++Phase; else - Phase = 3; + { + if (die) + { + if (wait <= diff) + { + die = false; + if (Unit *body = Unit::GetUnit((*me), bodyGUID)) + body->Kill(body); + me->Kill(me); + } else wait -= diff; + } + } + } + }; + +}; + class boss_headless_horseman : public CreatureScript +{ +public: + boss_headless_horseman() : CreatureScript("boss_headless_horseman") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_headless_horsemanAI (pCreature); + } + + struct boss_headless_horsemanAI : public ScriptedAI + { + boss_headless_horsemanAI(Creature *c) : ScriptedAI(c) + { + SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION); + if (confl) + { + confl->EffectApplyAuraName[0] = SPELL_AURA_PERIODIC_DAMAGE_PERCENT; + confl->EffectBasePoints[0] = 10; + //confl->EffectBaseDice[0] = 10; + confl->DmgMultiplier[0] = 1; + } + /* + if (SpellEntry *confl = GET_SPELL(SPELL_CONFLAGRATION)) + confl->EffectTriggerSpell[1] = 22587; + + if (SpellEntry *speed = GET_SPELL(22587)) + { + speed->Effect[1] = SPELL_EFFECT_APPLY_AURA; + speed->EffectApplyAuraName[1] = SPELL_AURA_MOD_CONFUSE; + } + */ + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint64 headGUID; + uint64 PlayerGUID; + + uint32 Phase; + uint32 id; + uint32 count; + uint32 say_timer; + + uint32 conflagrate; + uint32 summonadds; + uint32 cleave; + uint32 regen; + uint32 whirlwind; + uint32 laugh; + uint32 burn; + + bool withhead; + bool returned; + bool IsFlying; + bool wp_reached; + bool burned; + + void Reset() + { + Phase = 1; + conflagrate = 15000; + summonadds = 15000; + laugh = urand(16000,20000); + cleave = 2000; + regen = 1000; + burn = 6000; + count = 0; + say_timer = 3000; + withhead = true; - me->RemoveAllAuras(); - me->SetName("Headless Horseman"); - me->SetHealth(me->GetMaxHealth()); - SaySound(SAY_REJOINED); + returned = true; + burned = false; + IsFlying = false; DoCast(me, SPELL_HEAD); - caster->GetMotionMaster()->Clear(false); - caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5)); - //DoResetThreat();//not sure if need - std::list::const_iterator itr; - for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + if (headGUID) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive() && pUnit != caster) - me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); + if (Creature* Head = Unit::GetCreature((*me), headGUID)) + Head->DisappearAndDie(); + + headGUID = 0; } + + //if (pInstance) + // pInstance->SetData(DATA_HORSEMAN_EVENT, NOT_STARTED); } - } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && withhead) + void FlyMode() { - withhead = false; - returned = false; - damage = me->GetHealth() - me->GetMaxHealth()/100; - me->RemoveAllAuras(); - me->SetName("Headless Horseman, Unhorsed"); - - if (!headGUID) - headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); - Unit* Head = Unit::GetUnit((*me), headGUID); - if (Head && Head->isAlive()) - { - Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_IMMUNE, true); - DoCast(me, SPELL_BODY_REGEN, true); - DoCast(Head, SPELL_FLYING_HEAD, true); - DoCast(me, SPELL_CONFUSE, false); //test - done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0); - whirlwind = urand(4000,8000); - regen = 0; - } + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->SetSpeed(MOVE_WALK,5.0f,true); + wp_reached = false; + count = 0; + say_timer = 3000; + id = 0; + Phase = 0; } - } - void UpdateAI(const uint32 diff) - { - if (withhead) + void MovementInform(uint32 type, uint32 i) { - switch(Phase) + if (type != POINT_MOTION_TYPE || !IsFlying || i != id) + return; + + wp_reached = true; + + switch (id) { case 0: + me->SetVisibility(VISIBILITY_ON); + break; + case 1: { - if (!IsFlying) + if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, smoke->AI())->SetType(3); + DoCast(me, SPELL_RHYME_BIG); + break; + } + case 6: + if (pInstance) + pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject + break; + case 19: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + break; + case 20: + { + Phase = 1; + IsFlying = false; + wp_reached = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + SaySound(SAY_ENTRANCE); + if (Unit *plr = Unit::GetUnit((*me),PlayerGUID)) + DoStartMovement(plr); + break; + } + } + ++id; + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); + DoZoneInCombat(); + } + void AttackStart(Unit* who) {ScriptedAI::AttackStart(who);} + void MoveInLineOfSight(Unit *who) + { + if (withhead && Phase != 0) + ScriptedAI::MoveInLineOfSight(who); + } + void KilledUnit(Unit *plr) + { + if (plr->GetTypeId() == TYPEID_PLAYER) + { + if (withhead) + SaySound(SAY_PLAYER_DEATH); + //maybe possible when player dies from conflagration + else if (Creature *Head = Unit::GetCreature((*me), headGUID)) + CAST_AI(mob_head::mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH); + } + } + + void SaySound(int32 textEntry, Unit *pTarget = 0) + { + DoScriptText(textEntry, me, pTarget); + laugh += 4000; + } + + Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true) + { + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return NULL; + + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + Map::PlayerList::const_iterator i; + if (PlayerList.isEmpty()) return NULL; + + std::list temp; + std::list::const_iterator j; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() && + me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) + temp.push_back(i->getSource()); + + if (temp.size()) + { + j = temp.begin(); + advance(j, rand()%temp.size()); + return (*j); + } + return NULL; + } + + void SpellHitTarget(Unit* unit, const SpellEntry* spell) + { + if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION)) + SaySound(SAY_CONFLAGRATION,unit); + } + + void JustDied(Unit* /*killer*/) + { + me->StopMoving(); + //me->GetMotionMaster()->MoveIdle(); + SaySound(SAY_DEATH); + if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) + flame->CastSpell(flame,SPELL_BODY_FLAME,false); + if (Creature *wisp = DoSpawnCreature(WISP_INVIS,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, wisp->AI())->SetType(4); + if (pInstance) + pInstance->SetData(DATA_HORSEMAN_EVENT, DONE); + } + + void SpellHit(Unit *caster, const SpellEntry* spell) + { + if (withhead) + return; + + if (spell->Id == SPELL_FLYING_HEAD) + { + if (Phase < 3) + ++Phase; + else + Phase = 3; + withhead = true; + me->RemoveAllAuras(); + me->SetName("Headless Horseman"); + me->SetHealth(me->GetMaxHealth()); + SaySound(SAY_REJOINED); + DoCast(me, SPELL_HEAD); + caster->GetMotionMaster()->Clear(false); + caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5)); + //DoResetThreat();//not sure if need + std::list::const_iterator itr; + for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive() && pUnit != caster) + me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit)); + } + } + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && withhead) + { + withhead = false; + returned = false; + damage = me->GetHealth() - me->GetMaxHealth()/100; + me->RemoveAllAuras(); + me->SetName("Headless Horseman, Unhorsed"); + + if (!headGUID) + headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID(); + Unit* Head = Unit::GetUnit((*me), headGUID); + if (Head && Head->isAlive()) + { + Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + //Head->CastSpell(Head,SPELL_HEAD_INVIS,false); + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_IMMUNE, true); + DoCast(me, SPELL_BODY_REGEN, true); + DoCast(Head, SPELL_FLYING_HEAD, true); + DoCast(me, SPELL_CONFUSE, false); //test + done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0); + whirlwind = urand(4000,8000); + regen = 0; + } + } + } + + void UpdateAI(const uint32 diff) + { + if (withhead) + { + switch(Phase) + { + case 0: { - if (say_timer <= diff) + if (!IsFlying) { - say_timer = 3000; - Player *plr = SelectRandomPlayer(100.0f,false); - if (count < 3) + if (say_timer <= diff) { - if (plr) - plr->Say(Text[count],0); - } - else - { - DoCast(me, SPELL_RHYME_BIG); - if (plr) + say_timer = 3000; + Player *plr = SelectRandomPlayer(100.0f,false); + if (count < 3) { - plr->Say(Text[count],0); - plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); + if (plr) + plr->Say(Text[count],0); } - wp_reached = true; - IsFlying = true; - count = 0; - break; - } - ++count; - } else say_timer -= diff; - } - else - { - if (wp_reached) + else + { + DoCast(me, SPELL_RHYME_BIG); + if (plr) + { + plr->Say(Text[count],0); + plr->HandleEmoteCommand(ANIM_EMOTE_SHOUT); + } + wp_reached = true; + IsFlying = true; + count = 0; + break; + } + ++count; + } else say_timer -= diff; + } + else { - wp_reached = false; - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); + if (wp_reached) + { + wp_reached = false; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z); + } } } - } - break; - case 1: - if (burned) + break; + case 1: + if (burned) + break; + if (burn <= diff) + { + if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000)) + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, flame->AI())->SetType(2); + burned = true; + } else burn -= diff; break; - if (burn <= diff) - { - if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000)) - CAST_AI(mob_wisp_invisAI, flame->AI())->SetType(2); - burned = true; - } else burn -= diff; - break; - case 2: - if (conflagrate <= diff) - { - if (Unit *plr = SelectRandomPlayer(30.0f)) - DoCast(plr, SPELL_CONFLAGRATION, false); - conflagrate = urand(10000,16000); - } else conflagrate -= diff; - break; - case 3: - if (summonadds <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_SUMMON_PUMPKIN); - SaySound(SAY_SPROUTING_PUMPKINS); - summonadds = urand(25000,35000); - } else summonadds -= diff; - break; - } + case 2: + if (conflagrate <= diff) + { + if (Unit *plr = SelectRandomPlayer(30.0f)) + DoCast(plr, SPELL_CONFLAGRATION, false); + conflagrate = urand(10000,16000); + } else conflagrate -= diff; + break; + case 3: + if (summonadds <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_SUMMON_PUMPKIN); + SaySound(SAY_SPROUTING_PUMPKINS); + summonadds = urand(25000,35000); + } else summonadds -= diff; + break; + } - if (laugh <= diff) - { - laugh = urand(11000,22000); - me->MonsterTextEmote(EMOTE_LAUGHS,NULL); - DoPlaySoundToSet(me, RandomLaugh[rand()%3]); - } else laugh -= diff; + if (laugh <= diff) + { + laugh = urand(11000,22000); + me->MonsterTextEmote(EMOTE_LAUGHS,NULL); + DoPlaySoundToSet(me, RandomLaugh[rand()%3]); + } else laugh -= diff; - if (UpdateVictim()) - { - DoMeleeAttackIfReady(); - if (cleave <= diff) + if (UpdateVictim()) { - DoCast(me->getVictim(), SPELL_CLEAVE); - cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec - } else cleave -= diff; - } - } - else - { - if (regen <= diff) - { - regen = 1000; //"body calls head" - if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned) - { - if (Phase > 1) - --Phase; - else - Phase = 1; - Creature* Head = Unit::GetCreature((*me), headGUID); - if (Head && Head->isAlive()) + DoMeleeAttackIfReady(); + if (cleave <= diff) { - CAST_AI(mob_headAI, Head->AI())->Phase = Phase; - CAST_AI(mob_headAI, Head->AI())->Disappear(); - } - return; + DoCast(me->getVictim(), SPELL_CLEAVE); + cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec + } else cleave -= diff; } } - else regen -= diff; - - if (whirlwind <= diff) + else { - whirlwind = urand(4000,8000); - if (urand(0,1)) + if (regen <= diff) { - me->RemoveAurasDueToSpell(SPELL_CONFUSE); - DoCast(me, SPELL_WHIRLWIND, true); - DoCast(me, SPELL_CONFUSE); - } else - me->RemoveAurasDueToSpell(SPELL_WHIRLWIND); - } else whirlwind -= diff; + regen = 1000; //"body calls head" + if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned) + { + if (Phase > 1) + --Phase; + else + Phase = 1; + Creature* Head = Unit::GetCreature((*me), headGUID); + if (Head && Head->isAlive()) + { + CAST_AI(mob_head::mob_headAI, Head->AI())->Phase = Phase; + CAST_AI(mob_head::mob_headAI, Head->AI())->Disappear(); + } + return; + } + } + else regen -= diff; + + if (whirlwind <= diff) + { + whirlwind = urand(4000,8000); + if (urand(0,1)) + { + me->RemoveAurasDueToSpell(SPELL_CONFUSE); + DoCast(me, SPELL_WHIRLWIND, true); + DoCast(me, SPELL_CONFUSE); + } else + me->RemoveAurasDueToSpell(SPELL_WHIRLWIND); + } else whirlwind -= diff; + } } - } + }; + }; -void mob_headAI::Disappear() + + class mob_pulsing_pumpkin : public CreatureScript +{ +public: + mob_pulsing_pumpkin() : CreatureScript("mob_pulsing_pumpkin") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_pulsing_pumpkinAI (pCreature); + } + + struct mob_pulsing_pumpkinAI : public ScriptedAI + { + mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {} + + bool sprouted; + uint64 debuffGUID; + + void Reset() + { + float x, y, z; + me->GetPosition(x, y, z); //this visual aura some under ground + me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f); + Despawn(); + Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); + if (debuff) + { + debuff->SetDisplayId(me->GetDisplayId()); + debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); + CAST_AI(mob_wisp_invis::mob_wisp_invisAI, debuff->AI())->SetType(1); + debuffGUID = debuff->GetGUID(); + } + sprouted = false; + DoCast(me, SPELL_PUMPKIN_AURA, true); + DoCast(me, SPELL_SPROUTING); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); + } + + void EnterCombat(Unit * /*who*/){} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SPROUTING) + { + sprouted = true; + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); + DoCast(me, SPELL_SPROUT_BODY, true); + me->UpdateEntry(PUMPKIN_FIEND); + DoStartMovement(me->getVictim()); + } + } + + void Despawn() + { + if (!debuffGUID) return; + Unit *debuff = Unit::GetUnit((*me),debuffGUID); + if (debuff) + debuff->SetVisibility(VISIBILITY_OFF); + debuffGUID = 0; + } + + void JustDied(Unit * /*killer*/) { if (!sprouted) Despawn(); } + + void MoveInLineOfSight(Unit *who) + { + if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) + return; + + me->AddThreat(who,0.0f); + if (sprouted) + DoStartMovement(who); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (sprouted && UpdateVictim()) + DoMeleeAttackIfReady(); + } + }; + +}; + class go_loosely_turned_soil : public GameObjectScript +{ +public: + go_loosely_turned_soil() : GameObjectScript("go_loosely_turned_soil") { } + + bool OnGossipHello(Player* pPlayer, GameObject* soil) + { + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (pInstance) + { + if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED) + return true; + pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); + } + /* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) + { + plr->PrepareQuestMenu(soil->GetGUID()); + plr->SendPreparedQuest(soil->GetGUID()); + } + if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) + { */ + pPlayer->AreaExploredOrEventHappens(11405); + if (Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0)) + { + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = pPlayer->GetGUID(); + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode(); + } + //} + return true; + } + +}; + +void mob_head::mob_headAI::Disappear() { if (withbody) return; @@ -741,154 +889,16 @@ void mob_headAI::Disappear() me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_headless_horsemanAI, body->AI())->returned = true; + CAST_AI(boss_headless_horseman::boss_headless_horsemanAI, body->AI())->returned = true; } } } -struct mob_pulsing_pumpkinAI : public ScriptedAI -{ - mob_pulsing_pumpkinAI(Creature *c) : ScriptedAI(c) {} - - bool sprouted; - uint64 debuffGUID; - - void Reset() - { - float x, y, z; - me->GetPosition(x, y, z); //this visual aura some under ground - me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f); - Despawn(); - Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500); - if (debuff) - { - debuff->SetDisplayId(me->GetDisplayId()); - debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false); - CAST_AI(mob_wisp_invisAI, debuff->AI())->SetType(1); - debuffGUID = debuff->GetGUID(); - } - sprouted = false; - DoCast(me, SPELL_PUMPKIN_AURA, true); - DoCast(me, SPELL_SPROUTING); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); - } - - void EnterCombat(Unit * /*who*/){} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SPROUTING) - { - sprouted = true; - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED); - DoCast(me, SPELL_SPROUT_BODY, true); - me->UpdateEntry(PUMPKIN_FIEND); - DoStartMovement(me->getVictim()); - } - } - - void Despawn() - { - if (!debuffGUID) return; - Unit *debuff = Unit::GetUnit((*me),debuffGUID); - if (debuff) - debuff->SetVisibility(VISIBILITY_OFF); - debuffGUID = 0; - } - - void JustDied(Unit * /*killer*/) { if (!sprouted) Despawn(); } - - void MoveInLineOfSight(Unit *who) - { - if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) - return; - - me->AddThreat(who,0.0f); - if (sprouted) - DoStartMovement(who); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (sprouted && UpdateVictim()) - DoMeleeAttackIfReady(); - } -}; - -bool GOHello_go_loosely_turned_soil(Player* pPlayer, GameObject* soil) -{ - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (pInstance) - { - if (pInstance->GetData(DATA_HORSEMAN_EVENT) != NOT_STARTED) - return true; - pInstance->SetData(DATA_HORSEMAN_EVENT, IN_PROGRESS); - } -/* if (soil->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER && plr->getLevel() > 64) - { - plr->PrepareQuestMenu(soil->GetGUID()); - plr->SendPreparedQuest(soil->GetGUID()); - } - if (plr->GetQuestStatus(11405) == QUEST_STATUS_INCOMPLETE && plr->getLevel() > 64) - { */ - pPlayer->AreaExploredOrEventHappens(11405); - if (Creature *horseman = soil->SummonCreature(HH_MOUNTED,FlightPoint[20].x,FlightPoint[20].y,FlightPoint[20].z,0,TEMPSUMMON_MANUAL_DESPAWN,0)) - { - CAST_AI(boss_headless_horsemanAI, horseman->AI())->PlayerGUID = pPlayer->GetGUID(); - CAST_AI(boss_headless_horsemanAI, horseman->AI())->FlyMode(); - } - //} - return true; -} - -CreatureAI* GetAI_mob_head(Creature* pCreature) -{ - return new mob_headAI (pCreature); -} - -CreatureAI* GetAI_boss_headless_horseman(Creature* pCreature) -{ - return new boss_headless_horsemanAI (pCreature); -} - -CreatureAI* GetAI_mob_pulsing_pumpkin(Creature* pCreature) -{ - return new mob_pulsing_pumpkinAI (pCreature); -} - -CreatureAI* GetAI_mob_wisp_invis(Creature* pCreature) -{ - return new mob_wisp_invisAI (pCreature); -} - void AddSC_boss_headless_horseman() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_headless_horseman"; - newscript->GetAI = &GetAI_boss_headless_horseman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_head"; - newscript->GetAI = &GetAI_mob_head; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pulsing_pumpkin"; - newscript->GetAI = &GetAI_mob_pulsing_pumpkin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_wisp_invis"; - newscript->GetAI = &GetAI_mob_wisp_invis; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_loosely_turned_soil"; - newscript->pGOHello = &GOHello_go_loosely_turned_soil; - newscript->RegisterSelf(); + new boss_headless_horseman(); + new mob_head(); + new mob_pulsing_pumpkin(); + new mob_wisp_invis(); + new go_loosely_turned_soil(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp index e6b535c1073..4200b4689bd 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_herod.cpp @@ -39,122 +39,127 @@ EndScriptData */ #define ENTRY_SCARLET_TRAINEE 6575 #define ENTRY_SCARLET_MYRMIDON 4295 - -struct boss_herodAI : public ScriptedAI + class boss_herod : public CreatureScript { - boss_herodAI(Creature *c) : ScriptedAI(c) {} +public: + boss_herod() : CreatureScript("boss_herod") { } - bool Enrage; - - uint32 Cleave_Timer; - uint32 Whirlwind_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Enrage = false; - Cleave_Timer = 12000; - Whirlwind_Timer = 60000; + return new boss_herodAI(pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_herodAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_RUSHINGCHARGE); - } + boss_herodAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + bool Enrage; - void JustDied(Unit* /*killer*/) - { - for (uint8 i = 0; i < 20; ++i) - me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - } + uint32 Cleave_Timer; + uint32 Whirlwind_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are <30% hp goes Enraged - if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + void Reset() { - DoScriptText(EMOTE_ENRAGE, me); - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_FRENZY); - Enrage = true; - } - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); + Enrage = false; Cleave_Timer = 12000; - } else Cleave_Timer -= diff; - - // Whirlwind_Timer - if (Whirlwind_Timer <= diff) - { - DoScriptText(SAY_WHIRLWIND, me); - DoCast(me->getVictim(), SPELL_WHIRLWIND); - Whirlwind_Timer = 30000; - } else Whirlwind_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_herod(Creature* pCreature) -{ - return new boss_herodAI(pCreature); -} - -struct mob_scarlet_traineeAI : public npc_escortAI -{ - mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) - { - Start_Timer = urand(1000,6000); - } - - uint32 Start_Timer; - - void Reset() {} - void WaypointReached(uint32 /*uiPoint*/) {} - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (Start_Timer) - { - if (Start_Timer <= diff) - { - Start(true,true); - Start_Timer = 0; - } else Start_Timer -= diff; + Whirlwind_Timer = 60000; } - npc_escortAI::UpdateAI(diff); - } + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_RUSHINGCHARGE); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit* /*killer*/) + { + for (uint8 i = 0; i < 20; ++i) + me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //If we are <30% hp goes Enraged + if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + { + DoScriptText(EMOTE_ENRAGE, me); + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_FRENZY); + Enrage = true; + } + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 12000; + } else Cleave_Timer -= diff; + + // Whirlwind_Timer + if (Whirlwind_Timer <= diff) + { + DoScriptText(SAY_WHIRLWIND, me); + DoCast(me->getVictim(), SPELL_WHIRLWIND); + Whirlwind_Timer = 30000; + } else Whirlwind_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_scarlet_trainee(Creature* pCreature) + class mob_scarlet_trainee : public CreatureScript { - return new mob_scarlet_traineeAI(pCreature); -} +public: + mob_scarlet_trainee() : CreatureScript("mob_scarlet_trainee") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_scarlet_traineeAI(pCreature); + } + + struct mob_scarlet_traineeAI : public npc_escortAI + { + mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) + { + Start_Timer = urand(1000,6000); + } + + uint32 Start_Timer; + + void Reset() {} + void WaypointReached(uint32 /*uiPoint*/) {} + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (Start_Timer) + { + if (Start_Timer <= diff) + { + Start(true,true); + Start_Timer = 0; + } else Start_Timer -= diff; + } + + npc_escortAI::UpdateAI(diff); + } + }; + +}; + void AddSC_boss_herod() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_herod"; - newscript->GetAI = &GetAI_boss_herod; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_scarlet_trainee"; - newscript->GetAI = &GetAI_mob_scarlet_trainee; - newscript->RegisterSelf(); + new boss_herod(); + new mob_scarlet_trainee(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp index e643e001ca6..9c595c522c6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_high_inquisitor_fairbanks.cpp @@ -34,102 +34,104 @@ enum eSpells SPELL_POWERWORDSHIELD = 11647, SPELL_SLEEP = 8399 }; - -struct boss_high_inquisitor_fairbanksAI : public ScriptedAI + class boss_high_inquisitor_fairbanks : public CreatureScript { - boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {} +public: + boss_high_inquisitor_fairbanks() : CreatureScript("boss_high_inquisitor_fairbanks") { } - uint32 CurseOfBlood_Timer; - uint32 DispelMagic_Timer; - uint32 Fear_Timer; - uint32 Heal_Timer; - uint32 Sleep_Timer; - uint32 Dispel_Timer; - bool PowerWordShield; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfBlood_Timer = 10000; - DispelMagic_Timer = 30000; - Fear_Timer = 40000; - Heal_Timer = 30000; - Sleep_Timer = 30000; - Dispel_Timer = 20000; - PowerWordShield = false; + return new boss_high_inquisitor_fairbanksAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_high_inquisitor_fairbanksAI : public ScriptedAI { - } + boss_high_inquisitor_fairbanksAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 CurseOfBlood_Timer; + uint32 DispelMagic_Timer; + uint32 Fear_Timer; + uint32 Heal_Timer; + uint32 Sleep_Timer; + uint32 Dispel_Timer; + bool PowerWordShield; - //If we are <25% hp cast Heal - if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) + void Reset() { - DoCast(me, SPELL_HEAL); - Heal_Timer = 30000; - } else Heal_Timer -= diff; - - //Fear_Timer - if (Fear_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(pTarget, SPELL_FEAR); - + CurseOfBlood_Timer = 10000; + DispelMagic_Timer = 30000; Fear_Timer = 40000; - } else Fear_Timer -= diff; - - //Sleep_Timer - if (Sleep_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,0)) - DoCast(pTarget, SPELL_SLEEP); - + Heal_Timer = 30000; Sleep_Timer = 30000; - } else Sleep_Timer -= diff; - - //PowerWordShield_Timer - if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25) - { - DoCast(me, SPELL_POWERWORDSHIELD); - PowerWordShield = true; + Dispel_Timer = 20000; + PowerWordShield = false; } - //Dispel_Timer - if (Dispel_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_DISPELMAGIC); + } - DispelMagic_Timer = 30000; - } else DispelMagic_Timer -= diff; - - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); - CurseOfBlood_Timer = 25000; - } else CurseOfBlood_Timer -= diff; + if (!UpdateVictim()) + return; + + //If we are <25% hp cast Heal + if (me->GetHealth()*100 / me->GetMaxHealth() <= 25 && !me->IsNonMeleeSpellCasted(false) && Heal_Timer <= diff) + { + DoCast(me, SPELL_HEAL); + Heal_Timer = 30000; + } else Heal_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget, SPELL_FEAR); + + Fear_Timer = 40000; + } else Fear_Timer -= diff; + + //Sleep_Timer + if (Sleep_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,0)) + DoCast(pTarget, SPELL_SLEEP); + + Sleep_Timer = 30000; + } else Sleep_Timer -= diff; + + //PowerWordShield_Timer + if (!PowerWordShield && me->GetHealth()*100 / me->GetMaxHealth() <= 25) + { + DoCast(me, SPELL_POWERWORDSHIELD); + PowerWordShield = true; + } + + //Dispel_Timer + if (Dispel_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_DISPELMAGIC); + + DispelMagic_Timer = 30000; + } else DispelMagic_Timer -= diff; + + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + CurseOfBlood_Timer = 25000; + } else CurseOfBlood_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_high_inquisitor_fairbanks(Creature* pCreature) -{ - return new boss_high_inquisitor_fairbanksAI (pCreature); -} void AddSC_boss_high_inquisitor_fairbanks() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_high_inquisitor_fairbanks"; - newscript->GetAI = &GetAI_boss_high_inquisitor_fairbanks; - newscript->RegisterSelf(); + new boss_high_inquisitor_fairbanks(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp index 324f28ccf6a..7be699e5300 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_houndmaster_loksey.cpp @@ -31,49 +31,51 @@ enum eEnums SPELL_SUMMONSCARLETHOUND = 17164, SPELL_BLOODLUST = 6742 }; - -struct boss_houndmaster_lokseyAI : public ScriptedAI + class boss_houndmaster_loksey : public CreatureScript { - boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {} +public: + boss_houndmaster_loksey() : CreatureScript("boss_houndmaster_loksey") { } - uint32 BloodLust_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - BloodLust_Timer = 20000; + return new boss_houndmaster_lokseyAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_houndmaster_lokseyAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_houndmaster_lokseyAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 BloodLust_Timer; - if (BloodLust_Timer <= diff) + void Reset() { - DoCast(me, SPELL_BLOODLUST); BloodLust_Timer = 20000; - } else BloodLust_Timer -= diff; + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (BloodLust_Timer <= diff) + { + DoCast(me, SPELL_BLOODLUST); + BloodLust_Timer = 20000; + } else BloodLust_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_houndmaster_loksey(Creature* pCreature) -{ - return new boss_houndmaster_lokseyAI (pCreature); -} void AddSC_boss_houndmaster_loksey() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_houndmaster_loksey"; - newscript->GetAI = &GetAI_boss_houndmaster_loksey; - newscript->RegisterSelf(); + new boss_houndmaster_loksey(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp index d804a680e76..325a83bf997 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_interrogator_vishas.cpp @@ -36,85 +36,87 @@ enum eEnums SPELL_SHADOWWORDPAIN = 2767, }; - -struct boss_interrogator_vishasAI : public ScriptedAI + class boss_interrogator_vishas : public CreatureScript { - boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c) +public: + boss_interrogator_vishas() : CreatureScript("boss_interrogator_vishas") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_interrogator_vishasAI (pCreature); } - ScriptedInstance* pInstance; - - bool Yell30; - bool Yell60; - uint32 ShadowWordPain_Timer; - - void Reset() + struct boss_interrogator_vishasAI : public ScriptedAI { - ShadowWordPain_Timer = 5000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void KilledUnit(Unit* /*Victim*/) - { - DoScriptText(SAY_KILL, me); - } - - void JustDied(Unit* /*Killer*/) - { - if (!pInstance) - return; - - //Any other actions to do with vorrel? setStandState? - if (Unit *vorrel = Unit::GetUnit(*me,pInstance->GetData64(DATA_VORREL))) - DoScriptText(SAY_TRIGGER_VORREL, vorrel); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are low on hp Do sayings - if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60)) + boss_interrogator_vishasAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_HEALTH1, me); - Yell60 = true; + pInstance = me->GetInstanceScript(); } - if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30)) + InstanceScript* pInstance; + + bool Yell30; + bool Yell60; + uint32 ShadowWordPain_Timer; + + void Reset() { - DoScriptText(SAY_HEALTH2, me); - Yell30 = true; + ShadowWordPain_Timer = 5000; } - //ShadowWordPain_Timer - if (ShadowWordPain_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); - ShadowWordPain_Timer = 5000 + rand()%10000; - } else ShadowWordPain_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } + + void KilledUnit(Unit* /*Victim*/) + { + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit* /*Killer*/) + { + if (!pInstance) + return; + + //Any other actions to do with vorrel? setStandState? + if (Unit *vorrel = Unit::GetUnit(*me,pInstance->GetData64(DATA_VORREL))) + DoScriptText(SAY_TRIGGER_VORREL, vorrel); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //If we are low on hp Do sayings + if (!Yell60 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 60)) + { + DoScriptText(SAY_HEALTH1, me); + Yell60 = true; + } + + if (!Yell30 && ((me->GetHealth()*100) / me->GetMaxHealth() <= 30)) + { + DoScriptText(SAY_HEALTH2, me); + Yell30 = true; + } + + //ShadowWordPain_Timer + if (ShadowWordPain_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN); + ShadowWordPain_Timer = 5000 + rand()%10000; + } else ShadowWordPain_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_interrogator_vishas(Creature* pCreature) -{ - return new boss_interrogator_vishasAI (pCreature); -} void AddSC_boss_interrogator_vishas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_interrogator_vishas"; - newscript->GetAI = &GetAI_boss_interrogator_vishas; - newscript->RegisterSelf(); + new boss_interrogator_vishas(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 2d4f7e8e244..d10c6580611 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -52,310 +52,314 @@ enum eEnums SPELL_HEAL = 12039, SPELL_POWERWORDSHIELD = 22187 }; - -struct boss_scarlet_commander_mograineAI : public ScriptedAI + class boss_scarlet_commander_mograine : public CreatureScript { - boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_scarlet_commander_mograine() : CreatureScript("boss_scarlet_commander_mograine") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_scarlet_commander_mograineAI (pCreature); } - ScriptedInstance* m_pInstance; - - uint32 m_uiCrusaderStrike_Timer; - uint32 m_uiHammerOfJustice_Timer; - - bool m_bHasDied; - bool m_bHeal; - bool m_bFakeDeath; - - void Reset() + struct boss_scarlet_commander_mograineAI : public ScriptedAI { - m_uiCrusaderStrike_Timer = 10000; - m_uiHammerOfJustice_Timer = 10000; - - //Incase wipe during phase that mograine fake death - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - - if (m_pInstance) - if (me->isAlive()) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED); - - m_bHasDied = false; - m_bHeal = false; - m_bFakeDeath = false; - } - - void JustReachedHome() - { - if (m_pInstance) + boss_scarlet_commander_mograineAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); + m_pInstance = pCreature->GetInstanceScript(); } - } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_MO_AGGRO, me); - DoCast(me, SPELL_RETRIBUTIONAURA); + InstanceScript* m_pInstance; - me->CallForHelp(VISIBLE_RANGE); - } + uint32 m_uiCrusaderStrike_Timer; + uint32 m_uiHammerOfJustice_Timer; - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(SAY_MO_KILL, me); - } + bool m_bHasDied; + bool m_bHeal; + bool m_bFakeDeath; - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) - { - if (uiDamage < me->GetHealth() || m_bHasDied || m_bFakeDeath) - return; - - if (!m_pInstance) - return; - - //On first death, fake death and open door, as well as initiate whitemane if exist - if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) + void Reset() { - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); + m_uiCrusaderStrike_Timer = 10000; + m_uiHammerOfJustice_Timer = 10000; - Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786); - - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - - me->SetHealth(0); - - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - me->ClearComboPointHolders(); - me->RemoveAllAuras(); - me->ClearAllReactives(); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_DEAD); - - m_bHasDied = true; - m_bFakeDeath = true; - - uiDamage = 0; - } - } - - void SpellHit(Unit* /*pWho*/, const SpellEntry* pSpell) - { - //When hit with ressurection say text - if (pSpell->Id == SPELL_SCARLETRESURRECTION) - { - DoScriptText(SAY_MO_RESSURECTED, me); - m_bFakeDeath = false; + //Incase wipe during phase that mograine fake death + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); if (m_pInstance) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); + if (me->isAlive()) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT,NOT_STARTED); + + m_bHasDied = false; + m_bHeal = false; + m_bFakeDeath = false; } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) + void JustReachedHome() { - //On ressurection, stop fake death and heal whitemane and resume fight + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT != NOT_STARTED)) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, FAIL); + } + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_MO_AGGRO, me); + DoCast(me, SPELL_RETRIBUTIONAURA); + + me->CallForHelp(VISIBLE_RANGE); + } + + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(SAY_MO_KILL, me); + } + + void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) + { + if (uiDamage < me->GetHealth() || m_bHasDied || m_bFakeDeath) + return; + + if (!m_pInstance) + return; + + //On first death, fake death and open door, as well as initiate whitemane if exist if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(Whitemane, SPELL_LAYONHANDS); + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, IN_PROGRESS); - m_uiCrusaderStrike_Timer = 10000; - m_uiHammerOfJustice_Timer = 10000; + Whitemane->GetMotionMaster()->MovePoint(1,1163.113370,1398.856812,32.527786); - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); - m_bHeal = true; + me->SetHealth(0); + + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + me->ClearComboPointHolders(); + me->RemoveAllAuras(); + me->ClearAllReactives(); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_DEAD); + + m_bHasDied = true; + m_bFakeDeath = true; + + uiDamage = 0; } } - //This if-check to make sure mograine does not attack while fake death - if (m_bFakeDeath) - return; - - //m_uiCrusaderStrike_Timer - if (m_uiCrusaderStrike_Timer <= uiDiff) + void SpellHit(Unit* /*pWho*/, const SpellEntry* pSpell) { - DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); - m_uiCrusaderStrike_Timer = 10000; - } else m_uiCrusaderStrike_Timer -= uiDiff; - - //m_uiHammerOfJustice_Timer - if (m_uiHammerOfJustice_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); - m_uiHammerOfJustice_Timer = 60000; - } else m_uiHammerOfJustice_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_high_inquisitor_whitemaneAI : public ScriptedAI -{ - boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - - uint32 m_uiHeal_Timer; - uint32 m_uiPowerWordShield_Timer; - uint32 m_uiHolySmite_Timer; - uint32 m_uiWait_Timer; - - bool m_bCanResurrectCheck; - bool m_bCanResurrect; - - void Reset() - { - m_uiWait_Timer = 7000; - m_uiHeal_Timer = 10000; - m_uiPowerWordShield_Timer = 15000; - m_uiHolySmite_Timer = 6000; - - m_bCanResurrectCheck = false; - m_bCanResurrect = false; - - if (m_pInstance) - if (me->isAlive()) - m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); - } - - void AttackStart(Unit* pWho) - { - if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED) - return; - - ScriptedAI::AttackStart(pWho); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_WH_INTRO, me); - } - - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(SAY_WH_KILL, me); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (m_bCanResurrect) - { - //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out - if (m_pInstance && m_uiWait_Timer <= uiDiff) + //When hit with ressurection say text + if (pSpell->Id == SPELL_SCARLETRESURRECTION) { - if (Unit* Mograine = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + DoScriptText(SAY_MO_RESSURECTED, me); + m_bFakeDeath = false; + + if (m_pInstance) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, SPECIAL); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (m_bHasDied && !m_bHeal && m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == SPECIAL) + { + //On ressurection, stop fake death and heal whitemane and resume fight + if (Unit* Whitemane = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_WHITEMANE))) { - DoCast(Mograine, SPELL_SCARLETRESURRECTION); - DoScriptText(SAY_WH_RESSURECT, me); - m_bCanResurrect = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(Whitemane, SPELL_LAYONHANDS); + + m_uiCrusaderStrike_Timer = 10000; + m_uiHammerOfJustice_Timer = 10000; + + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + + m_bHeal = true; } } - else m_uiWait_Timer -= uiDiff; + + //This if-check to make sure mograine does not attack while fake death + if (m_bFakeDeath) + return; + + //m_uiCrusaderStrike_Timer + if (m_uiCrusaderStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); + m_uiCrusaderStrike_Timer = 10000; + } else m_uiCrusaderStrike_Timer -= uiDiff; + + //m_uiHammerOfJustice_Timer + if (m_uiHammerOfJustice_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE); + m_uiHammerOfJustice_Timer = 60000; + } else m_uiHammerOfJustice_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_high_inquisitor_whitemane : public CreatureScript +{ +public: + boss_high_inquisitor_whitemane() : CreatureScript("boss_high_inquisitor_whitemane") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_high_inquisitor_whitemaneAI (pCreature); + } + + struct boss_high_inquisitor_whitemaneAI : public ScriptedAI + { + boss_high_inquisitor_whitemaneAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); } - //Cast Deep sleep when health is less than 50% - if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + InstanceScript* m_pInstance; + + uint32 m_uiHeal_Timer; + uint32 m_uiPowerWordShield_Timer; + uint32 m_uiHolySmite_Timer; + uint32 m_uiWait_Timer; + + bool m_bCanResurrectCheck; + bool m_bCanResurrect; + + void Reset() { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + m_uiWait_Timer = 7000; + m_uiHeal_Timer = 10000; + m_uiPowerWordShield_Timer = 15000; + m_uiHolySmite_Timer = 6000; - DoCast(me->getVictim(), SPELL_DEEPSLEEP); - m_bCanResurrectCheck = true; - m_bCanResurrect = true; - return; - } - - //while in "resurrect-mode", don't do anything - if (m_bCanResurrect) - return; - - //If we are <75% hp cast healing spells at self or Mograine - if (m_uiHeal_Timer <= uiDiff) - { - Creature* pTarget = NULL; - - if (me->GetHealth() <= me->GetMaxHealth()*0.75f) - pTarget = me; + m_bCanResurrectCheck = false; + m_bCanResurrect = false; if (m_pInstance) + if (me->isAlive()) + m_pInstance->SetData(TYPE_MOGRAINE_AND_WHITE_EVENT, NOT_STARTED); + } + + void AttackStart(Unit* pWho) + { + if (m_pInstance && m_pInstance->GetData(TYPE_MOGRAINE_AND_WHITE_EVENT) == NOT_STARTED) + return; + + ScriptedAI::AttackStart(pWho); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_WH_INTRO, me); + } + + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(SAY_WH_KILL, me); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (m_bCanResurrect) { - if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out + if (m_pInstance && m_uiWait_Timer <= uiDiff) { - // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death" - if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f) - pTarget = pMograine; + if (Unit* Mograine = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + { + DoCast(Mograine, SPELL_SCARLETRESURRECTION); + DoScriptText(SAY_WH_RESSURECT, me); + m_bCanResurrect = false; + } } + else m_uiWait_Timer -= uiDiff; } - if (pTarget) - DoCast(pTarget, SPELL_HEAL); + //Cast Deep sleep when health is less than 50% + if (!m_bCanResurrectCheck && me->GetHealth()*100 / me->GetMaxHealth() <= 50) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - m_uiHeal_Timer = 13000; - } else m_uiHeal_Timer -= uiDiff; + DoCast(me->getVictim(), SPELL_DEEPSLEEP); + m_bCanResurrectCheck = true; + m_bCanResurrect = true; + return; + } - //m_uiPowerWordShield_Timer - if (m_uiPowerWordShield_Timer <= uiDiff) - { - DoCast(me, SPELL_POWERWORDSHIELD); - m_uiPowerWordShield_Timer = 15000; - } else m_uiPowerWordShield_Timer -= uiDiff; + //while in "resurrect-mode", don't do anything + if (m_bCanResurrect) + return; - //m_uiHolySmite_Timer - if (m_uiHolySmite_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HOLYSMITE); - m_uiHolySmite_Timer = 6000; - } else m_uiHolySmite_Timer -= uiDiff; + //If we are <75% hp cast healing spells at self or Mograine + if (m_uiHeal_Timer <= uiDiff) + { + Creature* pTarget = NULL; + + if (me->GetHealth() <= me->GetMaxHealth()*0.75f) + pTarget = me; + + if (m_pInstance) + { + if (Creature* pMograine = Unit::GetCreature((*me), m_pInstance->GetData64(DATA_MOGRAINE))) + { + // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death" + if (m_bCanResurrectCheck && pMograine->isAlive() && pMograine->GetHealth() <= pMograine->GetMaxHealth()*0.75f) + pTarget = pMograine; + } + } + + if (pTarget) + DoCast(pTarget, SPELL_HEAL); + + m_uiHeal_Timer = 13000; + } else m_uiHeal_Timer -= uiDiff; + + //m_uiPowerWordShield_Timer + if (m_uiPowerWordShield_Timer <= uiDiff) + { + DoCast(me, SPELL_POWERWORDSHIELD); + m_uiPowerWordShield_Timer = 15000; + } else m_uiPowerWordShield_Timer -= uiDiff; + + //m_uiHolySmite_Timer + if (m_uiHolySmite_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HOLYSMITE); + m_uiHolySmite_Timer = 6000; + } else m_uiHolySmite_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_scarlet_commander_mograine(Creature* pCreature) -{ - return new boss_scarlet_commander_mograineAI (pCreature); -} -CreatureAI* GetAI_boss_high_inquisitor_whitemane(Creature* pCreature) -{ - return new boss_high_inquisitor_whitemaneAI (pCreature); -} void AddSC_boss_mograine_and_whitemane() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_scarlet_commander_mograine"; - newscript->GetAI = &GetAI_boss_scarlet_commander_mograine; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_high_inquisitor_whitemane"; - newscript->GetAI = &GetAI_boss_high_inquisitor_whitemane; - newscript->RegisterSelf(); + new boss_scarlet_commander_mograine(); + new boss_high_inquisitor_whitemane(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp index f37903d09e1..12ab173ed98 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_scorn.cpp @@ -29,75 +29,77 @@ EndScriptData */ #define SPELL_FROSTBOLTVOLLEY 8398 #define SPELL_MINDFLAY 17313 #define SPELL_FROSTNOVA 15531 - -struct boss_scornAI : public ScriptedAI + class boss_scorn : public CreatureScript { - boss_scornAI(Creature *c) : ScriptedAI(c) {} +public: + boss_scorn() : CreatureScript("boss_scorn") { } - uint32 LichSlap_Timer; - uint32 FrostboltVolley_Timer; - uint32 MindFlay_Timer; - uint32 FrostNova_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - LichSlap_Timer = 45000; - FrostboltVolley_Timer = 30000; - MindFlay_Timer = 30000; - FrostNova_Timer = 30000; + return new boss_scornAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_scornAI : public ScriptedAI { - } + boss_scornAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 LichSlap_Timer; + uint32 FrostboltVolley_Timer; + uint32 MindFlay_Timer; + uint32 FrostNova_Timer; - //LichSlap_Timer - if (LichSlap_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_LICHSLAP); LichSlap_Timer = 45000; - } else LichSlap_Timer -= diff; + FrostboltVolley_Timer = 30000; + MindFlay_Timer = 30000; + FrostNova_Timer = 30000; + } - //FrostboltVolley_Timer - if (FrostboltVolley_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FROSTBOLTVOLLEY); - FrostboltVolley_Timer = 20000; - } else FrostboltVolley_Timer -= diff; + } - //MindFlay_Timer - if (MindFlay_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MINDFLAY); - MindFlay_Timer = 20000; - } else MindFlay_Timer -= diff; + if (!UpdateVictim()) + return; - //FrostNova_Timer - if (FrostNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTNOVA); - FrostNova_Timer = 15000; - } else FrostNova_Timer -= diff; + //LichSlap_Timer + if (LichSlap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LICHSLAP); + LichSlap_Timer = 45000; + } else LichSlap_Timer -= diff; + + //FrostboltVolley_Timer + if (FrostboltVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLTVOLLEY); + FrostboltVolley_Timer = 20000; + } else FrostboltVolley_Timer -= diff; + + //MindFlay_Timer + if (MindFlay_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MINDFLAY); + MindFlay_Timer = 20000; + } else MindFlay_Timer -= diff; + + //FrostNova_Timer + if (FrostNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTNOVA); + FrostNova_Timer = 15000; + } else FrostNova_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_scorn(Creature* pCreature) -{ - return new boss_scornAI (pCreature); -} void AddSC_boss_scorn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_scorn"; - newscript->GetAI = &GetAI_boss_scorn; - newscript->RegisterSelf(); + new boss_scorn(); } - diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index dd7a88dbc88..873092a6043 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -32,128 +32,130 @@ EndScriptData */ #define ENTRY_PUMPKIN 23694 #define MAX_ENCOUNTER 2 - -struct instance_scarlet_monastery : public ScriptedInstance + class instance_scarlet_monastery : public InstanceMapScript { - instance_scarlet_monastery(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_scarlet_monastery() : InstanceMapScript("instance_scarlet_monastery") { } - uint64 PumpkinShrineGUID; - uint64 HorsemanGUID; - uint64 HeadGUID; - std::set HorsemanAdds; - - uint64 MograineGUID; - uint64 WhitemaneGUID; - uint64 VorrelGUID; - uint64 DoorHighInquisitorGUID; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - PumpkinShrineGUID = 0; - HorsemanGUID = 0; - HeadGUID = 0; - HorsemanAdds.clear(); - - MograineGUID = 0; - WhitemaneGUID = 0; - VorrelGUID = 0; - DoorHighInquisitorGUID = 0; + return new instance_scarlet_monastery_InstanceMapScript(pMap); } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + struct instance_scarlet_monastery_InstanceMapScript : public InstanceScript { - switch(pGo->GetEntry()) + instance_scarlet_monastery_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 PumpkinShrineGUID; + uint64 HorsemanGUID; + uint64 HeadGUID; + std::set HorsemanAdds; + + uint64 MograineGUID; + uint64 WhitemaneGUID; + uint64 VorrelGUID; + uint64 DoorHighInquisitorGUID; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + void Initialize() { - case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = pGo->GetGUID();break; - case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + PumpkinShrineGUID = 0; + HorsemanGUID = 0; + HeadGUID = 0; + HorsemanAdds.clear(); + + MograineGUID = 0; + WhitemaneGUID = 0; + VorrelGUID = 0; + DoorHighInquisitorGUID = 0; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case ENTRY_HORSEMAN: HorsemanGUID = pCreature->GetGUID(); break; - case ENTRY_HEAD: HeadGUID = pCreature->GetGUID(); break; - case ENTRY_PUMPKIN: HorsemanAdds.insert(pCreature->GetGUID());break; - case 3976: MograineGUID = pCreature->GetGUID(); break; - case 3977: WhitemaneGUID = pCreature->GetGUID(); break; - case 3981: VorrelGUID = pCreature->GetGUID(); break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case TYPE_MOGRAINE_AND_WHITE_EVENT: - if (data == IN_PROGRESS) - DoUseDoorOrButton(DoorHighInquisitorGUID); - if (data == FAIL) - DoUseDoorOrButton(DoorHighInquisitorGUID); - - m_auiEncounter[0] = data; - break; - case GAMEOBJECT_PUMPKIN_SHRINE: - HandleGameObject(PumpkinShrineGUID, false); - break; - case DATA_HORSEMAN_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) + switch(pGo->GetEntry()) { - for (std::set::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) - { - Creature* add = instance->GetCreature(*itr); - if (add && add->isAlive()) - add->Kill(add); - } - HorsemanAdds.clear(); - HandleGameObject(PumpkinShrineGUID, false); + case ENTRY_PUMPKIN_SHRINE: PumpkinShrineGUID = pGo->GetGUID();break; + case 104600: DoorHighInquisitorGUID = pGo->GetGUID(); break; } - break; } - } - uint64 GetData64(uint32 type) - { - switch(type) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; - //case DATA_HORSEMAN: return HorsemanGUID; - //case DATA_HEAD: return HeadGUID; - case DATA_MOGRAINE: return MograineGUID; - case DATA_WHITEMANE: return WhitemaneGUID; - case DATA_VORREL: return VorrelGUID; - case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; + switch(pCreature->GetEntry()) + { + case ENTRY_HORSEMAN: HorsemanGUID = pCreature->GetGUID(); break; + case ENTRY_HEAD: HeadGUID = pCreature->GetGUID(); break; + case ENTRY_PUMPKIN: HorsemanAdds.insert(pCreature->GetGUID());break; + case 3976: MograineGUID = pCreature->GetGUID(); break; + case 3977: WhitemaneGUID = pCreature->GetGUID(); break; + case 3981: VorrelGUID = pCreature->GetGUID(); break; + } } - return 0; - } - uint32 GetData(uint32 type) - { - if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) - return m_auiEncounter[0]; - if (type == DATA_HORSEMAN_EVENT) - return m_auiEncounter[1]; - return 0; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_MOGRAINE_AND_WHITE_EVENT: + if (data == IN_PROGRESS) + DoUseDoorOrButton(DoorHighInquisitorGUID); + if (data == FAIL) + DoUseDoorOrButton(DoorHighInquisitorGUID); + + m_auiEncounter[0] = data; + break; + case GAMEOBJECT_PUMPKIN_SHRINE: + HandleGameObject(PumpkinShrineGUID, false); + break; + case DATA_HORSEMAN_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + { + for (std::set::const_iterator itr = HorsemanAdds.begin(); itr != HorsemanAdds.end(); ++itr) + { + Creature* add = instance->GetCreature(*itr); + if (add && add->isAlive()) + add->Kill(add); + } + HorsemanAdds.clear(); + HandleGameObject(PumpkinShrineGUID, false); + } + break; + } + } + + uint64 GetData64(uint32 type) + { + switch(type) + { + //case GAMEOBJECT_PUMPKIN_SHRINE: return PumpkinShrineGUID; + //case DATA_HORSEMAN: return HorsemanGUID; + //case DATA_HEAD: return HeadGUID; + case DATA_MOGRAINE: return MograineGUID; + case DATA_WHITEMANE: return WhitemaneGUID; + case DATA_VORREL: return VorrelGUID; + case DATA_DOOR_WHITEMANE: return DoorHighInquisitorGUID; + } + return 0; + } + + uint32 GetData(uint32 type) + { + if (type == TYPE_MOGRAINE_AND_WHITE_EVENT) + return m_auiEncounter[0]; + if (type == DATA_HORSEMAN_EVENT) + return m_auiEncounter[1]; + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_scarlet_monastery(Map* pMap) -{ - return new instance_scarlet_monastery(pMap); -} void AddSC_instance_scarlet_monastery() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_scarlet_monastery"; - newscript->GetInstanceData = &GetInstanceData_instance_scarlet_monastery; - newscript->RegisterSelf(); + new instance_scarlet_monastery(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 1f2e2fe1429..d4493c0fd1f 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -49,179 +49,181 @@ EndScriptData */ #define ADD_4Y 99.373 #define ADD_4Z 104.732 #define ADD_4O 3.16 - -struct boss_darkmaster_gandlingAI : public ScriptedAI + class boss_darkmaster_gandling : public CreatureScript { - boss_darkmaster_gandlingAI(Creature *c) : ScriptedAI(c) +public: + boss_darkmaster_gandling() : CreatureScript("boss_darkmaster_gandling") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_darkmaster_gandlingAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 ArcaneMissiles_Timer; - uint32 ShadowShield_Timer; - uint32 Curse_Timer; - uint32 Teleport_Timer; - - void Reset() + struct boss_darkmaster_gandlingAI : public ScriptedAI { - ArcaneMissiles_Timer = 4500; - ShadowShield_Timer = 12000; - Curse_Timer = 2000; - Teleport_Timer = 16000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_GANDLING, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //ArcaneMissiles_Timer - if (ArcaneMissiles_Timer <= diff) + boss_darkmaster_gandlingAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_ARCANEMISSILES); - ArcaneMissiles_Timer = 8000; - } else ArcaneMissiles_Timer -= diff; - - //ShadowShield_Timer - if (ShadowShield_Timer <= diff) - { - DoCast(me, SPELL_SHADOWSHIELD); - ShadowShield_Timer = 14000 + rand()%14000; - } else ShadowShield_Timer -= diff; - - //Curse_Timer - if (Curse_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CURSE); - Curse_Timer = 15000 + rand()%12000; - } else Curse_Timer -= diff; - - //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. - //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. - if (me->GetHealth()*100 / me->GetMaxHealth() > 3) - { - if (Teleport_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - { - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); - - Creature *Summoned = NULL; - switch(rand()%6) - { - case 0: - DoTeleportPlayer(pTarget, 250.0696,0.3921,84.8408,3.149); - Summoned = me->SummonCreature(16119,254.2325,0.3417,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,257.7133,4.0226,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,258.6702,-2.60656,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 1: - DoTeleportPlayer(pTarget, 181.4220,-91.9481,84.8410,1.608); - Summoned = me->SummonCreature(16119,184.0519,-73.5649,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,179.5951,-73.7045,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,180.6452,-78.2143,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,283.2274,-78.1518,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 2: - DoTeleportPlayer(pTarget, 95.1547,-1.8173,85.2289,0.043); - Summoned = me->SummonCreature(16119,100.9404,-1.8016,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,101.3729,0.4882,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,101.4596,-4.4740,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 3: - DoTeleportPlayer(pTarget, 250.0696,0.3921,72.6722,3.149); - Summoned = me->SummonCreature(16119,240.34481,0.7368,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,240.3633,-2.9520,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,240.6702,3.34949,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 4: - DoTeleportPlayer(pTarget, 181.4220,-91.9481,70.7734,1.608); - Summoned = me->SummonCreature(16119,184.0519,-73.5649,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,179.5951,-73.7045,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,180.6452,-78.2143,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,283.2274,-78.1518,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - case 5: - DoTeleportPlayer(pTarget, 106.1541,-1.8994,75.3663,0.043); - Summoned = me->SummonCreature(16119,115.3945,-1.5555,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,257.7133,1.8066,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - Summoned = me->SummonCreature(16119,258.6702,-5.1001,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); - if (Summoned) - Summoned->AI()->AttackStart(pTarget); - break; - } - } - Teleport_Timer = 20000 + rand()%15000; - } else Teleport_Timer -= diff; + pInstance = me->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + InstanceScript* pInstance; + + uint32 ArcaneMissiles_Timer; + uint32 ShadowShield_Timer; + uint32 Curse_Timer; + uint32 Teleport_Timer; + + void Reset() + { + ArcaneMissiles_Timer = 4500; + ShadowShield_Timer = 12000; + Curse_Timer = 2000; + Teleport_Timer = 16000; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_GANDLING, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //ArcaneMissiles_Timer + if (ArcaneMissiles_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANEMISSILES); + ArcaneMissiles_Timer = 8000; + } else ArcaneMissiles_Timer -= diff; + + //ShadowShield_Timer + if (ShadowShield_Timer <= diff) + { + DoCast(me, SPELL_SHADOWSHIELD); + ShadowShield_Timer = 14000 + rand()%14000; + } else ShadowShield_Timer -= diff; + + //Curse_Timer + if (Curse_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSE); + Curse_Timer = 15000 + rand()%12000; + } else Curse_Timer -= diff; + + //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer. + //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot. + if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + { + if (Teleport_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + + Creature *Summoned = NULL; + switch(rand()%6) + { + case 0: + DoTeleportPlayer(pTarget, 250.0696,0.3921,84.8408,3.149); + Summoned = me->SummonCreature(16119,254.2325,0.3417,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,257.7133,4.0226,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,258.6702,-2.60656,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 1: + DoTeleportPlayer(pTarget, 181.4220,-91.9481,84.8410,1.608); + Summoned = me->SummonCreature(16119,184.0519,-73.5649,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,179.5951,-73.7045,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,180.6452,-78.2143,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,283.2274,-78.1518,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 2: + DoTeleportPlayer(pTarget, 95.1547,-1.8173,85.2289,0.043); + Summoned = me->SummonCreature(16119,100.9404,-1.8016,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,101.3729,0.4882,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,101.4596,-4.4740,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 3: + DoTeleportPlayer(pTarget, 250.0696,0.3921,72.6722,3.149); + Summoned = me->SummonCreature(16119,240.34481,0.7368,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,240.3633,-2.9520,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,240.6702,3.34949,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 4: + DoTeleportPlayer(pTarget, 181.4220,-91.9481,70.7734,1.608); + Summoned = me->SummonCreature(16119,184.0519,-73.5649,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,179.5951,-73.7045,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,180.6452,-78.2143,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,283.2274,-78.1518,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + case 5: + DoTeleportPlayer(pTarget, 106.1541,-1.8994,75.3663,0.043); + Summoned = me->SummonCreature(16119,115.3945,-1.5555,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,257.7133,1.8066,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + Summoned = me->SummonCreature(16119,258.6702,-5.1001,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + if (Summoned) + Summoned->AI()->AttackStart(pTarget); + break; + } + } + Teleport_Timer = 20000 + rand()%15000; + } else Teleport_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_darkmaster_gandling(Creature* pCreature) -{ - return new boss_darkmaster_gandlingAI (pCreature); -} void AddSC_boss_darkmaster_gandling() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_darkmaster_gandling"; - newscript->GetAI = &GetAI_boss_darkmaster_gandling; - newscript->RegisterSelf(); + new boss_darkmaster_gandling(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp index c021e9e677e..184bd2a834e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_death_knight_darkreaver.cpp @@ -24,37 +24,38 @@ SDCategory: Scholomance EndScriptData */ #include "ScriptPCH.h" - -struct boss_death_knight_darkreaverAI : public ScriptedAI + class boss_death_knight_darkreaver : public CreatureScript { - boss_death_knight_darkreaverAI(Creature *c) : ScriptedAI(c) {} +public: + boss_death_knight_darkreaver() : CreatureScript("boss_death_knight_darkreaver") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_death_knight_darkreaverAI (pCreature); } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) + struct boss_death_knight_darkreaverAI : public ScriptedAI { - if (me->GetHealth() <= damage) - DoCast(me, 23261, true); //Summon Darkreaver's Fallen Charger - } + boss_death_knight_darkreaverAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (me->GetHealth() <= damage) + DoCast(me, 23261, true); //Summon Darkreaver's Fallen Charger + } + + void EnterCombat(Unit * /*who*/) + { + } + }; - void EnterCombat(Unit * /*who*/) - { - } }; -CreatureAI* GetAI_boss_death_knight_darkreaver(Creature* pCreature) -{ - return new boss_death_knight_darkreaverAI (pCreature); -} void AddSC_boss_death_knight_darkreaver() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_death_knight_darkreaver"; - newscript->GetAI = &GetAI_boss_death_knight_darkreaver; - newscript->RegisterSelf(); + new boss_death_knight_darkreaver(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp index 24b5bafd57c..eac38cc88e2 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_doctor_theolen_krastinov.cpp @@ -34,86 +34,88 @@ enum eEnums SPELL_BACKHAND = 18103, SPELL_FRENZY = 8269 }; - -struct boss_theolenkrastinovAI : public ScriptedAI + class boss_doctor_theolen_krastinov : public CreatureScript { - boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} +public: + boss_doctor_theolen_krastinov() : CreatureScript("boss_doctor_theolen_krastinov") { } - uint32 m_uiRend_Timer; - uint32 m_uiBackhand_Timer; - uint32 m_uiFrenzy_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiRend_Timer = 8000; - m_uiBackhand_Timer = 9000; - m_uiFrenzy_Timer = 1000; + return new boss_theolenkrastinovAI (pCreature); } - void JustDied(Unit* /*pKiller*/) + struct boss_theolenkrastinovAI : public ScriptedAI { - ScriptedInstance* pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); + boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + uint32 m_uiRend_Timer; + uint32 m_uiBackhand_Timer; + uint32 m_uiFrenzy_Timer; + + void Reset() + { + m_uiRend_Timer = 8000; + m_uiBackhand_Timer = 9000; + m_uiFrenzy_Timer = 1000; } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //Rend_Timer - if (m_uiRend_Timer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - DoCast(me->getVictim(), SPELL_REND); - m_uiRend_Timer = 10000; - } - else - m_uiRend_Timer -= uiDiff; - - //Backhand_Timer - if (m_uiBackhand_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_BACKHAND); - m_uiBackhand_Timer = 10000; - } - else - m_uiBackhand_Timer -= uiDiff; - - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 26) - { - if (m_uiFrenzy_Timer <= uiDiff) + InstanceScript* pInstance = me->GetInstanceScript(); + if (pInstance) { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); - m_uiFrenzy_Timer = 120000; + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //Rend_Timer + if (m_uiRend_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_REND); + m_uiRend_Timer = 10000; } else - m_uiFrenzy_Timer -= uiDiff; - } + m_uiRend_Timer -= uiDiff; + + //Backhand_Timer + if (m_uiBackhand_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BACKHAND); + m_uiBackhand_Timer = 10000; + } + else + m_uiBackhand_Timer -= uiDiff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 26) + { + if (m_uiFrenzy_Timer <= uiDiff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + m_uiFrenzy_Timer = 120000; + } + else + m_uiFrenzy_Timer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_theolenkrastinov(Creature* pCreature) -{ - return new boss_theolenkrastinovAI (pCreature); -} void AddSC_boss_theolenkrastinov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_doctor_theolen_krastinov"; - newscript->GetAI = &GetAI_boss_theolenkrastinov; - newscript->RegisterSelf(); + new boss_doctor_theolen_krastinov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index b2748fef22a..72991e3b59d 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -30,90 +30,92 @@ EndScriptData */ #define SPELL_SHADOWSHOCK 20603 #define SPELL_SILENCE 15487 #define SPELL_FEAR 6215 - -struct boss_illuciabarovAI : public ScriptedAI + class boss_illucia_barov : public CreatureScript { - boss_illuciabarovAI(Creature *c) : ScriptedAI(c) {} +public: + boss_illucia_barov() : CreatureScript("boss_illucia_barov") { } - uint32 CurseOfAgony_Timer; - uint32 ShadowShock_Timer; - uint32 Silence_Timer; - uint32 Fear_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfAgony_Timer = 18000; - ShadowShock_Timer = 9000; - Silence_Timer = 5000; - Fear_Timer = 30000; + return new boss_illuciabarovAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_illuciabarovAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) + boss_illuciabarovAI(Creature *c) : ScriptedAI(c) {} + + uint32 CurseOfAgony_Timer; + uint32 ShadowShock_Timer; + uint32 Silence_Timer; + uint32 Fear_Timer; + + void Reset() { - pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); - - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //CurseOfAgony_Timer - if (CurseOfAgony_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CURSEOFAGONY); - CurseOfAgony_Timer = 30000; - } else CurseOfAgony_Timer -= diff; - - //ShadowShock_Timer - if (ShadowShock_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_SHADOWSHOCK); - - ShadowShock_Timer = 12000; - } else ShadowShock_Timer -= diff; - - //Silence_Timer - if (Silence_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SILENCE); - Silence_Timer = 14000; - } else Silence_Timer -= diff; - - //Fear_Timer - if (Fear_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); + CurseOfAgony_Timer = 18000; + ShadowShock_Timer = 9000; + Silence_Timer = 5000; Fear_Timer = 30000; - } else Fear_Timer -= diff; + } + + void JustDied(Unit * /*killer*/) + { + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); + + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //CurseOfAgony_Timer + if (CurseOfAgony_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSEOFAGONY); + CurseOfAgony_Timer = 30000; + } else CurseOfAgony_Timer -= diff; + + //ShadowShock_Timer + if (ShadowShock_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_SHADOWSHOCK); + + ShadowShock_Timer = 12000; + } else ShadowShock_Timer -= diff; + + //Silence_Timer + if (Silence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCE); + Silence_Timer = 14000; + } else Silence_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + Fear_Timer = 30000; + } else Fear_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_illuciabarov(Creature* pCreature) -{ - return new boss_illuciabarovAI (pCreature); -} void AddSC_boss_illuciabarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_illucia_barov"; - newscript->GetAI = &GetAI_boss_illuciabarov; - newscript->RegisterSelf(); + new boss_illucia_barov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index d78b486d00f..9c23fbb1087 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -31,125 +31,127 @@ EndScriptData */ #define SPELL_FLASHHEAL 10917 #define SPELL_RENEW 10929 #define SPELL_HEALINGTOUCH 9889 - -struct boss_instructormaliciaAI : public ScriptedAI + class boss_instructor_malicia : public CreatureScript { - boss_instructormaliciaAI(Creature *c) : ScriptedAI(c) {} +public: + boss_instructor_malicia() : CreatureScript("boss_instructor_malicia") { } - uint32 CallOfGraves_Timer; - uint32 Corruption_Timer; - uint32 FlashHeal_Timer; - uint32 Renew_Timer; - uint32 HealingTouch_Timer; - uint32 FlashCounter; - uint32 TouchCounter; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CallOfGraves_Timer = 4000; - Corruption_Timer = 8000; - FlashHeal_Timer = 38000; - Renew_Timer = 32000; - HealingTouch_Timer = 45000; - FlashCounter = 0; - TouchCounter = 0; + return new boss_instructormaliciaAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_instructormaliciaAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); + boss_instructormaliciaAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + uint32 CallOfGraves_Timer; + uint32 Corruption_Timer; + uint32 FlashHeal_Timer; + uint32 Renew_Timer; + uint32 HealingTouch_Timer; + uint32 FlashCounter; + uint32 TouchCounter; + + void Reset() + { + CallOfGraves_Timer = 4000; + Corruption_Timer = 8000; + FlashHeal_Timer = 38000; + Renew_Timer = 32000; + HealingTouch_Timer = 45000; + FlashCounter = 0; + TouchCounter = 0; } - } - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //CallOfGraves_Timer - if (CallOfGraves_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_CALLOFGRAVES); - CallOfGraves_Timer = 65000; - } else CallOfGraves_Timer -= diff; - - //Corruption_Timer - if (Corruption_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_CORRUPTION); - - Corruption_Timer = 24000; - } else Corruption_Timer -= diff; - - //Renew_Timer - if (Renew_Timer <= diff) - { - DoCast(me, SPELL_RENEW); - Renew_Timer = 10000; - } else Renew_Timer -= diff; - - //FlashHeal_Timer - if (FlashHeal_Timer <= diff) - { - DoCast(me, SPELL_FLASHHEAL); - - //5 Flashheals will be casted - if (FlashCounter < 2) + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) { - FlashHeal_Timer = 5000; - ++FlashCounter; - } - else - { - FlashCounter=0; - FlashHeal_Timer = 30000; - } - } else FlashHeal_Timer -= diff; + pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); - //HealingTouch_Timer - if (HealingTouch_Timer <= diff) + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_HEALINGTOUCH); + } - //3 Healingtouchs will be casted - if (HealingTouch_Timer < 2) - { - HealingTouch_Timer = 5500; - ++TouchCounter; - } - else - { - TouchCounter=0; - HealingTouch_Timer = 30000; - } - } else HealingTouch_Timer -= diff; + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //CallOfGraves_Timer + if (CallOfGraves_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CALLOFGRAVES); + CallOfGraves_Timer = 65000; + } else CallOfGraves_Timer -= diff; + + //Corruption_Timer + if (Corruption_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_CORRUPTION); + + Corruption_Timer = 24000; + } else Corruption_Timer -= diff; + + //Renew_Timer + if (Renew_Timer <= diff) + { + DoCast(me, SPELL_RENEW); + Renew_Timer = 10000; + } else Renew_Timer -= diff; + + //FlashHeal_Timer + if (FlashHeal_Timer <= diff) + { + DoCast(me, SPELL_FLASHHEAL); + + //5 Flashheals will be casted + if (FlashCounter < 2) + { + FlashHeal_Timer = 5000; + ++FlashCounter; + } + else + { + FlashCounter=0; + FlashHeal_Timer = 30000; + } + } else FlashHeal_Timer -= diff; + + //HealingTouch_Timer + if (HealingTouch_Timer <= diff) + { + DoCast(me, SPELL_HEALINGTOUCH); + + //3 Healingtouchs will be casted + if (HealingTouch_Timer < 2) + { + HealingTouch_Timer = 5500; + ++TouchCounter; + } + else + { + TouchCounter=0; + HealingTouch_Timer = 30000; + } + } else HealingTouch_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_instructormalicia(Creature* pCreature) -{ - return new boss_instructormaliciaAI (pCreature); -} void AddSC_boss_instructormalicia() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_instructor_malicia"; - newscript->GetAI = &GetAI_boss_instructormalicia; - newscript->RegisterSelf(); + new boss_instructor_malicia(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp index 63ba5885573..316f78fd42b 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_jandice_barov.cpp @@ -30,174 +30,179 @@ EndScriptData */ //Spells of Illusion of Jandice Barov #define SPELL_CLEAVE 15584 - -struct boss_jandicebarovAI : public ScriptedAI + class boss_jandice_barov : public CreatureScript { - boss_jandicebarovAI(Creature *c) : ScriptedAI(c) {} +public: + boss_jandice_barov() : CreatureScript("boss_jandice_barov") { } - uint32 CurseOfBlood_Timer; - uint32 Illusion_Timer; - //uint32 Illusioncounter; - uint32 Invisible_Timer; - bool Invisible; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CurseOfBlood_Timer = 15000; - Illusion_Timer = 30000; - Invisible_Timer = 3000; //Too much too low? - Invisible = false; + return new boss_jandicebarovAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_jandicebarovAI : public ScriptedAI { - } + boss_jandicebarovAI(Creature *c) : ScriptedAI(c) {} - void SummonIllusions(Unit* victim) - { - if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) - Illusion->AI()->AttackStart(victim); - } + uint32 CurseOfBlood_Timer; + uint32 Illusion_Timer; + //uint32 Illusioncounter; + uint32 Invisible_Timer; + bool Invisible; - void UpdateAI(const uint32 diff) - { - if (Invisible && Invisible_Timer <= diff) + void Reset() { - //Become visible again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11073); //Jandice Model + CurseOfBlood_Timer = 15000; + Illusion_Timer = 30000; + Invisible_Timer = 3000; //Too much too low? Invisible = false; - } else if (Invisible) - { - Invisible_Timer -= diff; - //Do nothing while invisible - return; } - //Return since we have no target - if (!UpdateVictim()) - return; - - //CurseOfBlood_Timer - if (CurseOfBlood_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - //Cast - DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + } - //45 seconds - CurseOfBlood_Timer = 30000; - } else CurseOfBlood_Timer -= diff; - - //Illusion_Timer - if (!Invisible && Illusion_Timer <= diff) + void SummonIllusions(Unit* victim) { + if (Creature *Illusion = DoSpawnCreature(11439, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000)) + Illusion->AI()->AttackStart(victim); + } - //Interrupt any spell casting - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); // Invisible Model - DoModifyThreatPercent(me->getVictim(),-99); - - //Summon 10 Illusions attacking random gamers - Unit *pTarget = NULL; - for (uint8 i = 0; i < 10; ++i) + void UpdateAI(const uint32 diff) + { + if (Invisible && Invisible_Timer <= diff) { - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - SummonIllusions(pTarget); + //Become visible again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11073); //Jandice Model + Invisible = false; + } else if (Invisible) + { + Invisible_Timer -= diff; + //Do nothing while invisible + return; } - Invisible = true; - Invisible_Timer = 3000; - //25 seconds until we should cast this agian - Illusion_Timer = 25000; - } else Illusion_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - // //Illusion_Timer - // if (Illusion_Timer <= diff) - // { - // //Cast - // DoCast(me->getVictim(), SPELL_ILLUSION); - // - // //3 Illusion will be summoned - // if (Illusioncounter < 3) - // { - // Illusion_Timer = 500; - // ++Illusioncounter; - // } - // else { - // //15 seconds until we should cast this again - // Illusion_Timer = 15000; - // Illusioncounter = 0; - // } - // - // } else Illusion_Timer -= diff; + //CurseOfBlood_Timer + if (CurseOfBlood_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_CURSEOFBLOOD); + + //45 seconds + CurseOfBlood_Timer = 30000; + } else CurseOfBlood_Timer -= diff; + + //Illusion_Timer + if (!Invisible && Illusion_Timer <= diff) + { + + //Interrupt any spell casting + me->InterruptNonMeleeSpells(false); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); // Invisible Model + DoModifyThreatPercent(me->getVictim(),-99); + + //Summon 10 Illusions attacking random gamers + Unit *pTarget = NULL; + for (uint8 i = 0; i < 10; ++i) + { + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + SummonIllusions(pTarget); + } + Invisible = true; + Invisible_Timer = 3000; + + //25 seconds until we should cast this agian + Illusion_Timer = 25000; + } else Illusion_Timer -= diff; + + // //Illusion_Timer + // if (Illusion_Timer <= diff) + // { + // //Cast + // DoCast(me->getVictim(), SPELL_ILLUSION); + // + // //3 Illusion will be summoned + // if (Illusioncounter < 3) + // { + // Illusion_Timer = 500; + // ++Illusioncounter; + // } + // else { + // //15 seconds until we should cast this again + // Illusion_Timer = 15000; + // Illusioncounter = 0; + // } + // + // } else Illusion_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; // Illusion of Jandice Barov Script - -struct mob_illusionofjandicebarovAI : public ScriptedAI + class mob_illusionofjandicebarov : public CreatureScript { - mob_illusionofjandicebarovAI(Creature *c) : ScriptedAI(c) {} +public: + mob_illusionofjandicebarov() : CreatureScript("mob_illusionofjandicebarov") { } - uint32 Cleave_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cleave_Timer = 2000 + rand()%6000; - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + return new mob_illusionofjandicebarovAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_illusionofjandicebarovAI : public ScriptedAI { - } + mob_illusionofjandicebarovAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Cleave_Timer; - //Cleave_Timer - if (Cleave_Timer <= diff) + void Reset() { - //Cast - DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 2000 + rand()%6000; + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + } - //5-8 seconds - Cleave_Timer = 5000 + rand()%3000; - } else Cleave_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_CLEAVE); + + //5-8 seconds + Cleave_Timer = 5000 + rand()%3000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_jandicebarov(Creature* pCreature) -{ - return new boss_jandicebarovAI (pCreature); -} -CreatureAI* GetAI_mob_illusionofjandicebarov(Creature* pCreature) -{ - return new mob_illusionofjandicebarovAI (pCreature); -} void AddSC_boss_jandicebarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_jandice_barov"; - newscript->GetAI = &GetAI_boss_jandicebarov; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_illusionofjandicebarov"; - newscript->GetAI = &GetAI_mob_illusionofjandicebarov; - newscript->RegisterSelf(); + new boss_jandice_barov(); + new mob_illusionofjandicebarov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp index 9a41a16a2e7..5518e04aa5e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kormok.cpp @@ -27,96 +27,98 @@ EndScriptData */ #define SPELL_SHADOWBOLTVOLLEY 20741 #define SPELL_BONESHIELD 27688 - -struct boss_kormokAI : public ScriptedAI + class boss_kormok : public CreatureScript { - boss_kormokAI(Creature *c) : ScriptedAI(c) {} +public: + boss_kormok() : CreatureScript("boss_kormok") { } - uint32 ShadowVolley_Timer; - uint32 BoneShield_Timer; - uint32 Minion_Timer; - uint32 Mage_Timer; - bool Mages; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowVolley_Timer = 10000; - BoneShield_Timer = 2000; - Minion_Timer = 15000; - Mage_Timer = 0; - Mages = false; + return new boss_kormokAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_kormokAI : public ScriptedAI { - } + boss_kormokAI(Creature *c) : ScriptedAI(c) {} - void SummonMinions(Unit* victim) - { - if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMinion->AI()->AttackStart(victim); - } + uint32 ShadowVolley_Timer; + uint32 BoneShield_Timer; + uint32 Minion_Timer; + uint32 Mage_Timer; + bool Mages; - void SummonMages(Unit* victim) - { - if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) - SummonedMage->AI()->AttackStart(victim); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); - ShadowVolley_Timer = 15000; - } else ShadowVolley_Timer -= diff; - - //BoneShield_Timer - if (BoneShield_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_BONESHIELD); - BoneShield_Timer = 45000; - } else BoneShield_Timer -= diff; - - //Minion_Timer - if (Minion_Timer <= diff) - { - //Cast - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); - SummonMinions(me->getVictim()); - - Minion_Timer = 12000; - } else Minion_Timer -= diff; - - //Summon 2 Bone Mages - if (!Mages && me->GetHealth()*100 / me->GetMaxHealth() < 26) - { - //Cast - SummonMages(me->getVictim()); - SummonMages(me->getVictim()); - Mages = true; + ShadowVolley_Timer = 10000; + BoneShield_Timer = 2000; + Minion_Timer = 15000; + Mage_Timer = 0; + Mages = false; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void SummonMinions(Unit* victim) + { + if (Creature *SummonedMinion = DoSpawnCreature(16119, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMinion->AI()->AttackStart(victim); + } + + void SummonMages(Unit* victim) + { + if (Creature *SummonedMage = DoSpawnCreature(16120, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 120000)) + SummonedMage->AI()->AttackStart(victim); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY); + ShadowVolley_Timer = 15000; + } else ShadowVolley_Timer -= diff; + + //BoneShield_Timer + if (BoneShield_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_BONESHIELD); + BoneShield_Timer = 45000; + } else BoneShield_Timer -= diff; + + //Minion_Timer + if (Minion_Timer <= diff) + { + //Cast + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + SummonMinions(me->getVictim()); + + Minion_Timer = 12000; + } else Minion_Timer -= diff; + + //Summon 2 Bone Mages + if (!Mages && me->GetHealth()*100 / me->GetMaxHealth() < 26) + { + //Cast + SummonMages(me->getVictim()); + SummonMages(me->getVictim()); + Mages = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_kormok(Creature* pCreature) -{ - return new boss_kormokAI (pCreature); -} void AddSC_boss_kormok() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kormok"; - newscript->GetAI = &GetAI_boss_kormok; - newscript->RegisterSelf(); + new boss_kormok(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 9782475540f..9878711b7c1 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -28,74 +28,76 @@ EndScriptData */ #define SPELL_IMMOLATE 20294 // Old ID was 15570 #define SPELL_VEILOFSHADOW 17820 - -struct boss_lordalexeibarovAI : public ScriptedAI + class boss_lord_alexei_barov : public CreatureScript { - boss_lordalexeibarovAI(Creature *c) : ScriptedAI(c) {} +public: + boss_lord_alexei_barov() : CreatureScript("boss_lord_alexei_barov") { } - uint32 Immolate_Timer; - uint32 VeilofShadow_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Immolate_Timer = 7000; - VeilofShadow_Timer = 15000; - - me->LoadCreaturesAddon(); + return new boss_lordalexeibarovAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_lordalexeibarovAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); + boss_lordalexeibarovAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + uint32 Immolate_Timer; + uint32 VeilofShadow_Timer; + + void Reset() + { + Immolate_Timer = 7000; + VeilofShadow_Timer = 15000; + + me->LoadCreaturesAddon(); } - } - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Immolate_Timer - if (Immolate_Timer <= diff) + void JustDied(Unit * /*killer*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); - Immolate_Timer = 12000; - } else Immolate_Timer -= diff; + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } - //VeilofShadow_Timer - if (VeilofShadow_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_VEILOFSHADOW); - VeilofShadow_Timer = 20000; - } else VeilofShadow_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Immolate_Timer + if (Immolate_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) DoCast(pTarget, SPELL_IMMOLATE); + + Immolate_Timer = 12000; + } else Immolate_Timer -= diff; + + //VeilofShadow_Timer + if (VeilofShadow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VEILOFSHADOW); + VeilofShadow_Timer = 20000; + } else VeilofShadow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lordalexeibarov(Creature* pCreature) -{ - return new boss_lordalexeibarovAI (pCreature); -} void AddSC_boss_lordalexeibarov() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lord_alexei_barov"; - newscript->GetAI = &GetAI_boss_lordalexeibarov; - newscript->RegisterSelf(); + new boss_lord_alexei_barov(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index 7d3dc7cf873..ad975112e07 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -30,87 +30,89 @@ EndScriptData */ #define SPELL_DARKPLAGUE 18270 #define SPELL_CORROSIVEACID 23313 #define SPELL_NOXIOUSCATALYST 18151 - -struct boss_lorekeeperpolkeltAI : public ScriptedAI + class boss_lorekeeper_polkelt : public CreatureScript { - boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {} +public: + boss_lorekeeper_polkelt() : CreatureScript("boss_lorekeeper_polkelt") { } - uint32 VolatileInfection_Timer; - uint32 Darkplague_Timer; - uint32 CorrosiveAcid_Timer; - uint32 NoxiousCatalyst_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - VolatileInfection_Timer = 38000; - Darkplague_Timer = 8000; - CorrosiveAcid_Timer = 45000; - NoxiousCatalyst_Timer = 35000; + return new boss_lorekeeperpolkeltAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_lorekeeperpolkeltAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) + boss_lorekeeperpolkeltAI(Creature *c) : ScriptedAI(c) {} + + uint32 VolatileInfection_Timer; + uint32 Darkplague_Timer; + uint32 CorrosiveAcid_Timer; + uint32 NoxiousCatalyst_Timer; + + void Reset() { - pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); - - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); - } - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //VolatileInfection_Timer - if (VolatileInfection_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); - VolatileInfection_Timer = 32000; - } else VolatileInfection_Timer -= diff; - - //Darkplague_Timer - if (Darkplague_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DARKPLAGUE); + VolatileInfection_Timer = 38000; Darkplague_Timer = 8000; - } else Darkplague_Timer -= diff; + CorrosiveAcid_Timer = 45000; + NoxiousCatalyst_Timer = 35000; + } - //CorrosiveAcid_Timer - if (CorrosiveAcid_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_CORROSIVEACID); - CorrosiveAcid_Timer = 25000; - } else CorrosiveAcid_Timer -= diff; + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); - //NoxiousCatalyst_Timer - if (NoxiousCatalyst_Timer <= diff) + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_NOXIOUSCATALYST); - NoxiousCatalyst_Timer = 38000; - } else NoxiousCatalyst_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //VolatileInfection_Timer + if (VolatileInfection_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); + VolatileInfection_Timer = 32000; + } else VolatileInfection_Timer -= diff; + + //Darkplague_Timer + if (Darkplague_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DARKPLAGUE); + Darkplague_Timer = 8000; + } else Darkplague_Timer -= diff; + + //CorrosiveAcid_Timer + if (CorrosiveAcid_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVEACID); + CorrosiveAcid_Timer = 25000; + } else CorrosiveAcid_Timer -= diff; + + //NoxiousCatalyst_Timer + if (NoxiousCatalyst_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSCATALYST); + NoxiousCatalyst_Timer = 38000; + } else NoxiousCatalyst_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lorekeeperpolkelt(Creature* pCreature) -{ - return new boss_lorekeeperpolkeltAI (pCreature); -} void AddSC_boss_lorekeeperpolkelt() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lorekeeper_polkelt"; - newscript->GetAI = &GetAI_boss_lorekeeperpolkelt; - newscript->RegisterSelf(); + new boss_lorekeeper_polkelt(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp index a5957995981..0cdcbaf04ad 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_ras_frostwhisper.cpp @@ -31,95 +31,97 @@ EndScriptData */ #define SPELL_FEAR 26070 #define SPELL_CHILLNOVA 18099 #define SPELL_FROSTVOLLEY 8398 - -struct boss_rasfrostAI : public ScriptedAI + class boss_boss_ras_frostwhisper : public CreatureScript { - boss_rasfrostAI(Creature *c) : ScriptedAI(c) {} +public: + boss_boss_ras_frostwhisper() : CreatureScript("boss_boss_ras_frostwhisper") { } - uint32 IceArmor_Timer; - uint32 Frostbolt_Timer; - uint32 Freeze_Timer; - uint32 Fear_Timer; - uint32 ChillNova_Timer; - uint32 FrostVolley_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - IceArmor_Timer = 2000; - Frostbolt_Timer = 8000; - ChillNova_Timer = 12000; - Freeze_Timer = 18000; - FrostVolley_Timer = 24000; - Fear_Timer = 45000; - - DoCast(me, SPELL_ICEARMOR, true); + return new boss_rasfrostAI (pCreature); } - void EnterCombat(Unit * /*who*/){} - - void UpdateAI(const uint32 diff) + struct boss_rasfrostAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_rasfrostAI(Creature *c) : ScriptedAI(c) {} - //IceArmor_Timer - if (IceArmor_Timer <= diff) + uint32 IceArmor_Timer; + uint32 Frostbolt_Timer; + uint32 Freeze_Timer; + uint32 Fear_Timer; + uint32 ChillNova_Timer; + uint32 FrostVolley_Timer; + + void Reset() { - DoCast(me, SPELL_ICEARMOR); - IceArmor_Timer = 180000; - } else IceArmor_Timer -= diff; - - //Frostbolt_Timer - if (Frostbolt_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_FROSTBOLT); - + IceArmor_Timer = 2000; Frostbolt_Timer = 8000; - } else Frostbolt_Timer -= diff; + ChillNova_Timer = 12000; + Freeze_Timer = 18000; + FrostVolley_Timer = 24000; + Fear_Timer = 45000; - //Freeze_Timer - if (Freeze_Timer <= diff) + DoCast(me, SPELL_ICEARMOR, true); + } + + void EnterCombat(Unit * /*who*/){} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FREEZE); - Freeze_Timer = 24000; - } else Freeze_Timer -= diff; + if (!UpdateVictim()) + return; - //Fear_Timer - if (Fear_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); - Fear_Timer = 30000; - } else Fear_Timer -= diff; + //IceArmor_Timer + if (IceArmor_Timer <= diff) + { + DoCast(me, SPELL_ICEARMOR); + IceArmor_Timer = 180000; + } else IceArmor_Timer -= diff; - //ChillNova_Timer - if (ChillNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CHILLNOVA); - ChillNova_Timer = 14000; - } else ChillNova_Timer -= diff; + //Frostbolt_Timer + if (Frostbolt_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_FROSTBOLT); - //FrostVolley_Timer - if (FrostVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTVOLLEY); - FrostVolley_Timer = 15000; - } else FrostVolley_Timer -= diff; + Frostbolt_Timer = 8000; + } else Frostbolt_Timer -= diff; + + //Freeze_Timer + if (Freeze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FREEZE); + Freeze_Timer = 24000; + } else Freeze_Timer -= diff; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + Fear_Timer = 30000; + } else Fear_Timer -= diff; + + //ChillNova_Timer + if (ChillNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHILLNOVA); + ChillNova_Timer = 14000; + } else ChillNova_Timer -= diff; + + //FrostVolley_Timer + if (FrostVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTVOLLEY); + FrostVolley_Timer = 15000; + } else FrostVolley_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rasfrost(Creature* pCreature) -{ - return new boss_rasfrostAI (pCreature); -} void AddSC_boss_rasfrost() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_boss_ras_frostwhisper"; - newscript->GetAI = &GetAI_boss_rasfrost; - newscript->RegisterSelf(); + new boss_boss_ras_frostwhisper(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index e23bc4fdd97..d50e3752e32 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -30,90 +30,92 @@ EndScriptData */ #define SPELL_CLEAVE 20691 #define SPELL_SUNDERINCLEAVE 25174 #define SPELL_KNOCKAWAY 10101 - -struct boss_theravenianAI : public ScriptedAI + class boss_the_ravenian : public CreatureScript { - boss_theravenianAI(Creature *c) : ScriptedAI(c) {} +public: + boss_the_ravenian() : CreatureScript("boss_the_ravenian") { } - uint32 Trample_Timer; - uint32 Cleave_Timer; - uint32 SunderingCleave_Timer; - uint32 KnockAway_Timer; - bool HasYelled; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Trample_Timer = 24000; - Cleave_Timer = 15000; - SunderingCleave_Timer = 40000; - KnockAway_Timer = 32000; - HasYelled = false; + return new boss_theravenianAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_theravenianAI : public ScriptedAI { - ScriptedInstance *pInstance = me->GetInstanceData(); - if (pInstance) - { - pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); + boss_theravenianAI(Creature *c) : ScriptedAI(c) {} - if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) - me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + uint32 Trample_Timer; + uint32 Cleave_Timer; + uint32 SunderingCleave_Timer; + uint32 KnockAway_Timer; + bool HasYelled; + + void Reset() + { + Trample_Timer = 24000; + Cleave_Timer = 15000; + SunderingCleave_Timer = 40000; + KnockAway_Timer = 32000; + HasYelled = false; } - } - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Trample_Timer - if (Trample_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_TRAMPLE); - Trample_Timer = 10000; - } else Trample_Timer -= diff; + InstanceScript *pInstance = me->GetInstanceScript(); + if (pInstance) + { + pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); - //Cleave_Timer - if (Cleave_Timer <= diff) + if (pInstance->GetData(TYPE_GANDLING) == IN_PROGRESS) + me->SummonCreature(1853, 180.73, -9.43856, 75.507, 1.61399, TEMPSUMMON_DEAD_DESPAWN, 0); + } + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + } - //SunderingCleave_Timer - if (SunderingCleave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SUNDERINCLEAVE); - SunderingCleave_Timer = 20000; - } else SunderingCleave_Timer -= diff; + if (!UpdateVictim()) + return; - //KnockAway_Timer - if (KnockAway_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 12000; - } else KnockAway_Timer -= diff; + //Trample_Timer + if (Trample_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + Trample_Timer = 10000; + } else Trample_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //SunderingCleave_Timer + if (SunderingCleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDERINCLEAVE); + SunderingCleave_Timer = 20000; + } else SunderingCleave_Timer -= diff; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 12000; + } else KnockAway_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_theravenian(Creature* pCreature) -{ - return new boss_theravenianAI (pCreature); -} void AddSC_boss_theravenian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_the_ravenian"; - newscript->GetAI = &GetAI_boss_theravenian; - newscript->RegisterSelf(); + new boss_the_ravenian(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp index 1aa278f1bce..e4b89896dac 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_vectus.cpp @@ -34,74 +34,76 @@ enum eEnums SPELL_FIRESHIELD = 19626, SPELL_FRENZY = 8269 //28371, }; - -struct boss_vectusAI : public ScriptedAI + class boss_vectus : public CreatureScript { - boss_vectusAI(Creature *c) : ScriptedAI(c) {} +public: + boss_vectus() : CreatureScript("boss_vectus") { } - uint32 m_uiFireShield_Timer; - uint32 m_uiBlastWave_Timer; - uint32 m_uiFrenzy_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiFireShield_Timer = 2000; - m_uiBlastWave_Timer = 14000; - m_uiFrenzy_Timer = 0; + return new boss_vectusAI (pCreature); } - void UpdateAI(const uint32 uiDiff) + struct boss_vectusAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_vectusAI(Creature *c) : ScriptedAI(c) {} - //FireShield_Timer - if (m_uiFireShield_Timer <= uiDiff) + uint32 m_uiFireShield_Timer; + uint32 m_uiBlastWave_Timer; + uint32 m_uiFrenzy_Timer; + + void Reset() { - DoCast(me, SPELL_FIRESHIELD); - m_uiFireShield_Timer = 90000; + m_uiFireShield_Timer = 2000; + m_uiBlastWave_Timer = 14000; + m_uiFrenzy_Timer = 0; } - else - m_uiFireShield_Timer -= uiDiff; - //BlastWave_Timer - if (m_uiBlastWave_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - DoCast(me->getVictim(), SPELL_BLAST_WAVE); - m_uiBlastWave_Timer = 12000; - } - else - m_uiBlastWave_Timer -= uiDiff; + if (!UpdateVictim()) + return; - //Frenzy_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 25) - { - if (m_uiFrenzy_Timer <= uiDiff) + //FireShield_Timer + if (m_uiFireShield_Timer <= uiDiff) { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); - - m_uiFrenzy_Timer = 24000; + DoCast(me, SPELL_FIRESHIELD); + m_uiFireShield_Timer = 90000; } else - m_uiFrenzy_Timer -= uiDiff; - } + m_uiFireShield_Timer -= uiDiff; + + //BlastWave_Timer + if (m_uiBlastWave_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BLAST_WAVE); + m_uiBlastWave_Timer = 12000; + } + else + m_uiBlastWave_Timer -= uiDiff; + + //Frenzy_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 25) + { + if (m_uiFrenzy_Timer <= uiDiff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + + m_uiFrenzy_Timer = 24000; + } + else + m_uiFrenzy_Timer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_vectus(Creature* pCreature) -{ - return new boss_vectusAI (pCreature); -} void AddSC_boss_vectus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_vectus"; - newscript->GetAI = &GetAI_boss_vectus; - newscript->RegisterSelf(); + new boss_vectus(); } - diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 28ed326cefa..898dd0f1a62 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -36,113 +36,115 @@ EndScriptData */ #define GO_GATE_ILLUCIA 177371 #define MAX_ENCOUNTER 2 - -struct instance_scholomance : public ScriptedInstance + class instance_scholomance : public InstanceMapScript { - instance_scholomance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_scholomance() : InstanceMapScript("instance_scholomance") { } - //Lord Alexei Barov, Doctor Theolen Krastinov, The Ravenian, Lorekeeper Polkelt, Instructor Malicia and the Lady Illucia Barov. - bool IsBossDied[6]; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 GateKirtonosGUID; - uint64 GateGandlingGUID; - uint64 GateMiliciaGUID; - uint64 GateTheolenGUID; - uint64 GatePolkeltGUID; - uint64 GateRavenianGUID; - uint64 GateBarovGUID; - uint64 GateIlluciaGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - GateKirtonosGUID = 0; - GateGandlingGUID = 0; - GateMiliciaGUID = 0; - GateTheolenGUID = 0; - GatePolkeltGUID = 0; - GateRavenianGUID = 0; - GateBarovGUID = 0; - GateIlluciaGUID = 0; - - for (uint8 i = 0; i < 6; ++i) - IsBossDied[i] = false; + return new instance_scholomance_InstanceMapScript(pMap); } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + struct instance_scholomance_InstanceMapScript : public InstanceScript { - switch(pGo->GetEntry()) + instance_scholomance_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + //Lord Alexei Barov, Doctor Theolen Krastinov, The Ravenian, Lorekeeper Polkelt, Instructor Malicia and the Lady Illucia Barov. + bool IsBossDied[6]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint64 GateKirtonosGUID; + uint64 GateGandlingGUID; + uint64 GateMiliciaGUID; + uint64 GateTheolenGUID; + uint64 GatePolkeltGUID; + uint64 GateRavenianGUID; + uint64 GateBarovGUID; + uint64 GateIlluciaGUID; + + void Initialize() { - case GO_GATE_KIRTONOS: GateKirtonosGUID = pGo->GetGUID(); break; - case GO_GATE_GANDLING: GateGandlingGUID = pGo->GetGUID(); break; - case GO_GATE_MALICIA: GateMiliciaGUID = pGo->GetGUID(); break; - case GO_GATE_THEOLEN: GateTheolenGUID = pGo->GetGUID(); break; - case GO_GATE_POLKELT: GatePolkeltGUID = pGo->GetGUID(); break; - case GO_GATE_RAVENIAN: GateRavenianGUID = pGo->GetGUID(); break; - case GO_GATE_BAROV: GateBarovGUID = pGo->GetGUID(); break; - case GO_GATE_ILLUCIA: GateIlluciaGUID = pGo->GetGUID(); break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + GateKirtonosGUID = 0; + GateGandlingGUID = 0; + GateMiliciaGUID = 0; + GateTheolenGUID = 0; + GatePolkeltGUID = 0; + GateRavenianGUID = 0; + GateBarovGUID = 0; + GateIlluciaGUID = 0; + + for (uint8 i = 0; i < 6; ++i) + IsBossDied[i] = false; } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_LORDALEXEIBAROV_DEATH: - IsBossDied[0] = true; - break; - case DATA_DOCTORTHEOLENKRASTINOV_DEATH: - IsBossDied[1] = true; - break; - case DATA_THERAVENIAN_DEATH: - IsBossDied[2] = true; - break; - case DATA_LOREKEEPERPOLKELT_DEATH: - IsBossDied[3] = true; - break; - case DATA_INSTRUCTORMALICIA_DEATH: - IsBossDied[4] = true; - break; - case DATA_LADYILLUCIABAROV_DEATH: - IsBossDied[5] = true; - break; - case TYPE_GANDLING: - m_auiEncounter[0] = data; - break; - case TYPE_KIRTONOS: - m_auiEncounter[1] = data; - break; - } - } - - uint32 GetData(uint32 type) - { - if (type == TYPE_GANDLING) - { - if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) + switch(pGo->GetEntry()) { - m_auiEncounter[0] = IN_PROGRESS; - return IN_PROGRESS; + case GO_GATE_KIRTONOS: GateKirtonosGUID = pGo->GetGUID(); break; + case GO_GATE_GANDLING: GateGandlingGUID = pGo->GetGUID(); break; + case GO_GATE_MALICIA: GateMiliciaGUID = pGo->GetGUID(); break; + case GO_GATE_THEOLEN: GateTheolenGUID = pGo->GetGUID(); break; + case GO_GATE_POLKELT: GatePolkeltGUID = pGo->GetGUID(); break; + case GO_GATE_RAVENIAN: GateRavenianGUID = pGo->GetGUID(); break; + case GO_GATE_BAROV: GateBarovGUID = pGo->GetGUID(); break; + case GO_GATE_ILLUCIA: GateIlluciaGUID = pGo->GetGUID(); break; } } - return 0; - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_LORDALEXEIBAROV_DEATH: + IsBossDied[0] = true; + break; + case DATA_DOCTORTHEOLENKRASTINOV_DEATH: + IsBossDied[1] = true; + break; + case DATA_THERAVENIAN_DEATH: + IsBossDied[2] = true; + break; + case DATA_LOREKEEPERPOLKELT_DEATH: + IsBossDied[3] = true; + break; + case DATA_INSTRUCTORMALICIA_DEATH: + IsBossDied[4] = true; + break; + case DATA_LADYILLUCIABAROV_DEATH: + IsBossDied[5] = true; + break; + case TYPE_GANDLING: + m_auiEncounter[0] = data; + break; + case TYPE_KIRTONOS: + m_auiEncounter[1] = data; + break; + } + } + + uint32 GetData(uint32 type) + { + if (type == TYPE_GANDLING) + { + if (IsBossDied[0] && IsBossDied[1] && IsBossDied[2] && IsBossDied[3] && IsBossDied[4] && IsBossDied[5]) + { + m_auiEncounter[0] = IN_PROGRESS; + return IN_PROGRESS; + } + } + + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_scholomance(Map* pMap) -{ - return new instance_scholomance(pMap); -} void AddSC_instance_scholomance() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_scholomance"; - newscript->GetInstanceData = &GetInstanceData_instance_scholomance; - newscript->RegisterSelf(); + new instance_scholomance(); } - diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index be3cd67c8d6..e8c7e83dd0c 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -53,227 +53,229 @@ const Position SpawnLocation[] = {-145.905,2180.520,128.448,4.183}, {-140.794,2178.037,128.448,4.090}, {-138.640,2170.159,136.577,2.737} -}; -struct instance_shadowfang_keep : public ScriptedInstance +}; class instance_shadowfang_keep : public InstanceMapScript { - instance_shadowfang_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_shadowfang_keep() : InstanceMapScript("instance_shadowfang_keep") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 uiAshGUID; - uint64 uiAdaGUID; - uint64 uiArchmageArugalGUID; - - uint64 DoorCourtyardGUID; - uint64 DoorSorcererGUID; - uint64 DoorArugalGUID; - - uint8 uiPhase; - uint16 uiTimer; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - uiAshGUID = 0; - uiAdaGUID = 0; - uiArchmageArugalGUID = 0; - - DoorCourtyardGUID = 0; - DoorSorcererGUID = 0; - DoorArugalGUID = 0; - - uiPhase = 0; - uiTimer = 0; + return new instance_shadowfang_keep_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) - { - case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break; - case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; - case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break; - } - } + instance_shadowfang_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_COURTYARD_DOOR: - DoorCourtyardGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - HandleGameObject(NULL, true, pGo); - break; - case GO_SORCERER_DOOR: - DoorSorcererGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL, true, pGo); - break; - case GO_ARUGAL_DOOR: - DoorArugalGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL, true, pGo); - break; - } - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - void DoSpeech() - { - Creature* pAda = instance->GetCreature(uiAdaGUID); - Creature* pAsh = instance->GetCreature(uiAshGUID); + uint64 uiAshGUID; + uint64 uiAdaGUID; + uint64 uiArchmageArugalGUID; - if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) - { - DoScriptText(SAY_BOSS_DIE_AD,pAda); - DoScriptText(SAY_BOSS_DIE_AS,pAsh); - } - } + uint64 DoorCourtyardGUID; + uint64 DoorSorcererGUID; + uint64 DoorArugalGUID; - void SetData(uint32 type, uint32 data) - { - switch(type) + uint8 uiPhase; + uint16 uiTimer; + + void Initialize() { - case TYPE_FREE_NPC: - if (data == DONE) - DoUseDoorOrButton(DoorCourtyardGUID); - m_auiEncounter[0] = data; - break; - case TYPE_RETHILGORE: - if (data == DONE) - DoSpeech(); - m_auiEncounter[1] = data; - break; - case TYPE_FENRUS: - switch(data) - { - case DONE: - uiTimer = 1000; - uiPhase = 1; - break; - case 7: - DoUseDoorOrButton(DoorSorcererGUID); - break; - } - m_auiEncounter[2] = data; - break; - case TYPE_NANDOS: - if (data == DONE) - DoUseDoorOrButton(DoorArugalGUID); - m_auiEncounter[3] = data; - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + uiAshGUID = 0; + uiAdaGUID = 0; + uiArchmageArugalGUID = 0; + + DoorCourtyardGUID = 0; + DoorSorcererGUID = 0; + DoorArugalGUID = 0; + + uiPhase = 0; + uiTimer = 0; } - if (data == DONE) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_FREE_NPC: - return m_auiEncounter[0]; - case TYPE_RETHILGORE: - return m_auiEncounter[1]; - case TYPE_FENRUS: - return m_auiEncounter[2]; - case TYPE_NANDOS: - return m_auiEncounter[3]; - } - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } - - OUT_LOAD_INST_DATA_COMPLETE; - } - - void Update(uint32 uiDiff) - { - if (GetData(TYPE_FENRUS) != DONE) - return; - - Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID); - Creature* pSummon = NULL; - - if (!pArchmage || !pArchmage->isAlive()) - return; - - if (uiPhase) - { - if (uiTimer <= uiDiff) + switch(pCreature->GetEntry()) { - switch(uiPhase) - { - case 1: - pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pSummon->SetReactState(REACT_DEFENSIVE); - pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true); - DoScriptText(SAY_ARCHMAGE,pSummon); - uiTimer = 2000; - uiPhase = 2; - break; - case 2: - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - uiPhase = 0; - break; - - } - } else uiTimer -= uiDiff; + case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break; + case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; + case NPC_ARCHMAGE_ARUGAL: uiArchmageArugalGUID = pCreature->GetGUID(); break; + } } - } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_COURTYARD_DOOR: + DoorCourtyardGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case GO_SORCERER_DOOR: + DoorSorcererGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL, true, pGo); + break; + case GO_ARUGAL_DOOR: + DoorArugalGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL, true, pGo); + break; + } + } + + void DoSpeech() + { + Creature* pAda = instance->GetCreature(uiAdaGUID); + Creature* pAsh = instance->GetCreature(uiAshGUID); + + if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) + { + DoScriptText(SAY_BOSS_DIE_AD,pAda); + DoScriptText(SAY_BOSS_DIE_AS,pAsh); + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_FREE_NPC: + if (data == DONE) + DoUseDoorOrButton(DoorCourtyardGUID); + m_auiEncounter[0] = data; + break; + case TYPE_RETHILGORE: + if (data == DONE) + DoSpeech(); + m_auiEncounter[1] = data; + break; + case TYPE_FENRUS: + switch(data) + { + case DONE: + uiTimer = 1000; + uiPhase = 1; + break; + case 7: + DoUseDoorOrButton(DoorSorcererGUID); + break; + } + m_auiEncounter[2] = data; + break; + case TYPE_NANDOS: + if (data == DONE) + DoUseDoorOrButton(DoorArugalGUID); + m_auiEncounter[3] = data; + break; + } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_FREE_NPC: + return m_auiEncounter[0]; + case TYPE_RETHILGORE: + return m_auiEncounter[1]; + case TYPE_FENRUS: + return m_auiEncounter[2]; + case TYPE_NANDOS: + return m_auiEncounter[3]; + } + return 0; + } + + std::string GetSaveData() + { + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } + + OUT_LOAD_INST_DATA_COMPLETE; + } + + void Update(uint32 uiDiff) + { + if (GetData(TYPE_FENRUS) != DONE) + return; + + Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID); + Creature* pSummon = NULL; + + if (!pArchmage || !pArchmage->isAlive()) + return; + + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + pSummon = pArchmage->SummonCreature(pArchmage->GetEntry(),SpawnLocation[4],TEMPSUMMON_TIMED_DESPAWN,10000); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pSummon->SetReactState(REACT_DEFENSIVE); + pSummon->CastSpell(pSummon,SPELL_ASHCROMBE_TELEPORT,true); + DoScriptText(SAY_ARCHMAGE,pSummon); + uiTimer = 2000; + uiPhase = 2; + break; + case 2: + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[0],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[1],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[2],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER,SpawnLocation[3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + uiPhase = 0; + break; + + } + } else uiTimer -= uiDiff; + } + } + }; + }; -InstanceData* GetInstanceData_instance_shadowfang_keep(Map* pMap) -{ - return new instance_shadowfang_keep(pMap); -} void AddSC_instance_shadowfang_keep() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_shadowfang_keep"; - newscript->GetInstanceData = &GetInstanceData_instance_shadowfang_keep; - newscript->RegisterSelf(); + new instance_shadowfang_keep(); } - diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 61f06276bb6..a66ff361eaf 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -52,149 +52,153 @@ enum eEnums }; #define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door." - -struct npc_shadowfang_prisonerAI : public npc_escortAI + class npc_shadowfang_prisoner : public CreatureScript { - npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) +public: + npc_shadowfang_prisoner() : CreatureScript("npc_shadowfang_prisoner") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - uiNpcEntry = c->GetEntry(); + return new npc_shadowfang_prisonerAI(pCreature); } - ScriptedInstance *pInstance; - uint32 uiNpcEntry; - - void WaypointReached(uint32 uiPoint) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(uiPoint) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case 0: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_FREE_AS, me); - else - DoScriptText(SAY_FREE_AD, me); - break; - case 10: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_OPEN_DOOR_AS, me); - else - DoScriptText(SAY_OPEN_DOOR_AD, me); - break; - case 11: - if (uiNpcEntry == NPC_ASH) - DoCast(me, SPELL_UNLOCK); - break; - case 12: - if (uiNpcEntry == NPC_ASH) - DoScriptText(SAY_POST_DOOR_AS, me); - else - DoScriptText(SAY_POST1_DOOR_AD, me); + pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - pInstance->SetData(TYPE_FREE_NPC, DONE); - break; - case 13: - if (uiNpcEntry != NPC_ASH) - DoScriptText(SAY_POST2_DOOR_AD, me); - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisoner::npc_shadowfang_prisonerAI, pCreature->AI())) + pEscortAI->Start(false, false); } + return true; } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} -}; - -CreatureAI* GetAI_npc_shadowfang_prisoner(Creature* pCreature) -{ - return new npc_shadowfang_prisonerAI(pCreature); -} - -bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - - if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); + InstanceScript* pInstance = pCreature->GetInstanceScript(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_shadowfang_prisonerAI, pCreature->AI())) - pEscortAI->Start(false, false); - } - return true; -} + if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); -struct npc_arugal_voidwalkerAI : public ScriptedAI -{ - npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - ScriptedInstance* pInstance; - - uint32 uiDarkOffering; - - void Reset() + struct npc_shadowfang_prisonerAI : public npc_escortAI { - uiDarkOffering = urand(290,10); - } - - void UpdateAI(uint32 const uiDiff) - { - if (!UpdateVictim()) - return; - - if (uiDarkOffering <= uiDiff) + npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) { - if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true)) + pInstance = c->GetInstanceScript(); + uiNpcEntry = c->GetEntry(); + } + + InstanceScript *pInstance; + uint32 uiNpcEntry; + + void WaypointReached(uint32 uiPoint) + { + switch(uiPoint) { - if (pFriend) - DoCast(pFriend,SPELL_DARK_OFFERING); + case 0: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_FREE_AS, me); + else + DoScriptText(SAY_FREE_AD, me); + break; + case 10: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_OPEN_DOOR_AS, me); + else + DoScriptText(SAY_OPEN_DOOR_AD, me); + break; + case 11: + if (uiNpcEntry == NPC_ASH) + DoCast(me, SPELL_UNLOCK); + break; + case 12: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_POST_DOOR_AS, me); + else + DoScriptText(SAY_POST1_DOOR_AD, me); + + if (pInstance) + pInstance->SetData(TYPE_FREE_NPC, DONE); + break; + case 13: + if (uiNpcEntry != NPC_ASH) + DoScriptText(SAY_POST2_DOOR_AD, me); + break; } - else - DoCast(me,SPELL_DARK_OFFERING); - uiDarkOffering = urand(4400,12500); - } else uiDarkOffering -= uiDiff; + } - DoMeleeAttackIfReady(); - } + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + }; - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1); - } }; -CreatureAI* GetAI_npc_arugal_voidwalker(Creature* pCreature) + + + class npc_arugal_voidwalker : public CreatureScript { - return new npc_arugal_voidwalkerAI(pCreature); -} +public: + npc_arugal_voidwalker() : CreatureScript("npc_arugal_voidwalker") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_arugal_voidwalkerAI(pCreature); + } + + struct npc_arugal_voidwalkerAI : public ScriptedAI + { + npc_arugal_voidwalkerAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiDarkOffering; + + void Reset() + { + uiDarkOffering = urand(290,10); + } + + void UpdateAI(uint32 const uiDiff) + { + if (!UpdateVictim()) + return; + + if (uiDarkOffering <= uiDiff) + { + if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(),25.0f,true)) + { + if (pFriend) + DoCast(pFriend,SPELL_DARK_OFFERING); + } + else + DoCast(me,SPELL_DARK_OFFERING); + uiDarkOffering = urand(4400,12500); + } else uiDarkOffering -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(TYPE_FENRUS, pInstance->GetData(TYPE_FENRUS) + 1); + } + }; + +}; + void AddSC_shadowfang_keep() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_shadowfang_prisoner"; - newscript->pGossipHello = &GossipHello_npc_shadowfang_prisoner; - newscript->pGossipSelect = &GossipSelect_npc_shadowfang_prisoner; - newscript->GetAI = &GetAI_npc_shadowfang_prisoner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_arugal_voidwalker"; - newscript->GetAI = &GetAI_npc_arugal_voidwalker; - newscript->RegisterSelf(); + new npc_shadowfang_prisoner(); + new npc_arugal_voidwalker(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index ca2ca46d198..33af2acdb57 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -76,117 +76,119 @@ EndScriptData */ #define SPELL_RAISE_DEAD4 17478 #define SPELL_RAISE_DEAD5 17479 #define SPELL_RAISE_DEAD6 17480 - -struct boss_baron_rivendareAI : public ScriptedAI + class boss_baron_rivendare : public CreatureScript { - boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) +public: + boss_baron_rivendare() : CreatureScript("boss_baron_rivendare") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_baron_rivendareAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 ShadowBolt_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - // uint32 RaiseDead_Timer; - uint32 SummonSkeletons_Timer; - - void Reset() + struct boss_baron_rivendareAI : public ScriptedAI { - ShadowBolt_Timer = 5000; - Cleave_Timer = 8000; - MortalStrike_Timer = 12000; - // RaiseDead_Timer = 30000; - SummonSkeletons_Timer = 34000; - if (pInstance && pInstance->GetData(TYPE_RAMSTEIN) == DONE) - pInstance->SetData(TYPE_BARON,NOT_STARTED); - } - - void AttackStart(Unit* who) - { - if (pInstance)//can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door - pInstance->SetData(TYPE_BARON,IN_PROGRESS); - ScriptedAI::AttackStart(who); - } - - void JustSummoned(Creature* summoned) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(pTarget); - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_BARON,DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //ShadowBolt - if (ShadowBolt_Timer <= diff) + boss_baron_rivendareAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(me->getVictim(), SPELL_SHADOWBOLT); + pInstance = me->GetInstanceScript(); + } - ShadowBolt_Timer = 10000; - } else ShadowBolt_Timer -= diff; + InstanceScript* pInstance; - //Cleave - if (Cleave_Timer <= diff) + uint32 ShadowBolt_Timer; + uint32 Cleave_Timer; + uint32 MortalStrike_Timer; + // uint32 RaiseDead_Timer; + uint32 SummonSkeletons_Timer; + + void Reset() { - DoCast(me->getVictim(), SPELL_CLEAVE); - //13 seconds until we should cast this again - Cleave_Timer = 7000 + (rand()%10000); - } else Cleave_Timer -= diff; + ShadowBolt_Timer = 5000; + Cleave_Timer = 8000; + MortalStrike_Timer = 12000; + // RaiseDead_Timer = 30000; + SummonSkeletons_Timer = 34000; + if (pInstance && pInstance->GetData(TYPE_RAMSTEIN) == DONE) + pInstance->SetData(TYPE_BARON,NOT_STARTED); + } - //MortalStrike - if (MortalStrike_Timer <= diff) + void AttackStart(Unit* who) { - DoCast(me->getVictim(), SPELL_MORTALSTRIKE); - MortalStrike_Timer = 10000 + (rand()%15000); - } else MortalStrike_Timer -= diff; + if (pInstance)//can't use entercombat(), boss' dmg aura sets near players in combat, before entering the room's door + pInstance->SetData(TYPE_BARON,IN_PROGRESS); + ScriptedAI::AttackStart(who); + } - //RaiseDead - // if (RaiseDead_Timer <= diff) - // { - // DoCast(me, SPELL_RAISEDEAD); - // RaiseDead_Timer = 45000; - // } else RaiseDead_Timer -= diff; - - //SummonSkeletons - if (SummonSkeletons_Timer <= diff) + void JustSummoned(Creature* summoned) { - me->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); - me->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(pTarget); + } - //34 seconds until we should cast this again - SummonSkeletons_Timer = 40000; - } else SummonSkeletons_Timer -= diff; + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_BARON,DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //ShadowBolt + if (ShadowBolt_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + + ShadowBolt_Timer = 10000; + } else ShadowBolt_Timer -= diff; + + //Cleave + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + //13 seconds until we should cast this again + Cleave_Timer = 7000 + (rand()%10000); + } else Cleave_Timer -= diff; + + //MortalStrike + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALSTRIKE); + MortalStrike_Timer = 10000 + (rand()%15000); + } else MortalStrike_Timer -= diff; + + //RaiseDead + // if (RaiseDead_Timer <= diff) + // { + // DoCast(me, SPELL_RAISEDEAD); + // RaiseDead_Timer = 45000; + // } else RaiseDead_Timer -= diff; + + //SummonSkeletons + if (SummonSkeletons_Timer <= diff) + { + me->SummonCreature(11197,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,29000); + me->SummonCreature(11197,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,29000); + + //34 seconds until we should cast this again + SummonSkeletons_Timer = 40000; + } else SummonSkeletons_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_baron_rivendare(Creature* pCreature) -{ - return new boss_baron_rivendareAI (pCreature); -} void AddSC_boss_baron_rivendare() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baron_rivendare"; - newscript->GetAI = &GetAI_boss_baron_rivendare; - newscript->RegisterSelf(); + new boss_baron_rivendare(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index ba2a49a1804..ddf3e3a7e3d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -30,100 +30,102 @@ EndScriptData */ #define SPELL_BANSHEECURSE 16867 #define SPELL_SILENCE 18327 //#define SPELL_POSSESS 17244 - -struct boss_baroness_anastariAI : public ScriptedAI + class boss_baroness_anastari : public CreatureScript { - boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) +public: + boss_baroness_anastari() : CreatureScript("boss_baroness_anastari") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_baroness_anastariAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 BansheeWail_Timer; - uint32 BansheeCurse_Timer; - uint32 Silence_Timer; - //uint32 Possess_Timer; - - void Reset() + struct boss_baroness_anastariAI : public ScriptedAI { - BansheeWail_Timer = 1000; - BansheeCurse_Timer = 11000; - Silence_Timer = 13000; - //Possess_Timer = 35000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //BansheeWail - if (BansheeWail_Timer <= diff) + boss_baroness_anastariAI(Creature *c) : ScriptedAI(c) { - if (rand()%100 < 95) - DoCast(me->getVictim(), SPELL_BANSHEEWAIL); - //4 seconds until we should cast this again - BansheeWail_Timer = 4000; - } else BansheeWail_Timer -= diff; - - //BansheeCurse - if (BansheeCurse_Timer <= diff) - { - if (rand()%100 < 75) - DoCast(me->getVictim(), SPELL_BANSHEECURSE); - //18 seconds until we should cast this again - BansheeCurse_Timer = 18000; - } else BansheeCurse_Timer -= diff; - - //Silence - if (Silence_Timer <= diff) - { - if (rand()%100 < 80) - DoCast(me->getVictim(), SPELL_SILENCE); - //13 seconds until we should cast this again - Silence_Timer = 13000; - } else Silence_Timer -= diff; - - //Possess - /* if (Possess_Timer <= diff) - { - //Cast - if (rand()%100 < 65) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget)DoCast(pTarget, SPELL_POSSESS); + pInstance = me->GetInstanceScript(); } - //50 seconds until we should cast this again - Possess_Timer = 50000; - } else Possess_Timer -= diff; - */ - DoMeleeAttackIfReady(); - } + InstanceScript* pInstance; + + uint32 BansheeWail_Timer; + uint32 BansheeCurse_Timer; + uint32 Silence_Timer; + //uint32 Possess_Timer; + + void Reset() + { + BansheeWail_Timer = 1000; + BansheeCurse_Timer = 11000; + Silence_Timer = 13000; + //Possess_Timer = 35000; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_BARONESS,IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //BansheeWail + if (BansheeWail_Timer <= diff) + { + if (rand()%100 < 95) + DoCast(me->getVictim(), SPELL_BANSHEEWAIL); + //4 seconds until we should cast this again + BansheeWail_Timer = 4000; + } else BansheeWail_Timer -= diff; + + //BansheeCurse + if (BansheeCurse_Timer <= diff) + { + if (rand()%100 < 75) + DoCast(me->getVictim(), SPELL_BANSHEECURSE); + //18 seconds until we should cast this again + BansheeCurse_Timer = 18000; + } else BansheeCurse_Timer -= diff; + + //Silence + if (Silence_Timer <= diff) + { + if (rand()%100 < 80) + DoCast(me->getVictim(), SPELL_SILENCE); + //13 seconds until we should cast this again + Silence_Timer = 13000; + } else Silence_Timer -= diff; + + //Possess + /* if (Possess_Timer <= diff) + { + //Cast + if (rand()%100 < 65) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget)DoCast(pTarget, SPELL_POSSESS); + } + //50 seconds until we should cast this again + Possess_Timer = 50000; + } else Possess_Timer -= diff; + */ + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_baroness_anastari(Creature* pCreature) -{ - return new boss_baroness_anastariAI (pCreature); -} void AddSC_boss_baroness_anastari() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_baroness_anastari"; - newscript->GetAI = &GetAI_boss_baroness_anastari; - newscript->RegisterSelf(); + new boss_baroness_anastari(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index 0de4d122904..eb4bbdec36c 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -75,148 +75,150 @@ EndScriptData */ #define SPELL_PUMMEL 15615 #define SPELL_SHOOT 16496 //#define SPELL_SUMMONCRIMSONRIFLEMAN 17279 - -struct boss_cannon_master_willeyAI : public ScriptedAI + class boss_cannon_master_willey : public CreatureScript { - boss_cannon_master_willeyAI(Creature *c) : ScriptedAI(c) {} +public: + boss_cannon_master_willey() : CreatureScript("boss_cannon_master_willey") { } - uint32 KnockAway_Timer; - uint32 Pummel_Timer; - uint32 Shoot_Timer; - uint32 SummonRifleman_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Shoot_Timer = 1000; - Pummel_Timer = 7000; - KnockAway_Timer = 11000; - SummonRifleman_Timer = 15000; + return new boss_cannon_master_willeyAI (pCreature); } - void JustDied(Unit* /*Victim*/) + struct boss_cannon_master_willeyAI : public ScriptedAI { - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - } + boss_cannon_master_willeyAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - } + uint32 KnockAway_Timer; + uint32 Pummel_Timer; + uint32 Shoot_Timer; + uint32 SummonRifleman_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Pummel - if (Pummel_Timer <= diff) + void Reset() { - //Cast - if (rand()%100 < 90) //90% chance to cast - { - DoCast(me->getVictim(), SPELL_PUMMEL); - } - //12 seconds until we should cast this again - Pummel_Timer = 12000; - } else Pummel_Timer -= diff; - - //KnockAway - if (KnockAway_Timer <= diff) - { - //Cast - if (rand()%100 < 80) //80% chance to cast - { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - } - //14 seconds until we should cast this again - KnockAway_Timer = 14000; - } else KnockAway_Timer -= diff; - - //Shoot - if (Shoot_Timer <= diff) - { - //Cast - DoCast(me->getVictim(), SPELL_SHOOT); - //1 seconds until we should cast this again Shoot_Timer = 1000; - } else Shoot_Timer -= diff; + Pummel_Timer = 7000; + KnockAway_Timer = 11000; + SummonRifleman_Timer = 15000; + } - //SummonRifleman - if (SummonRifleman_Timer <= diff) + void JustDied(Unit* /*Victim*/) { - //Cast - switch (rand()%9) - { - case 0: - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 1: - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 2: - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 3: - me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 4: - me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 5: - me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 6: - me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 7: - me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - case 8: - me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); - me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); - break; - } - //30 seconds until we should cast this again - SummonRifleman_Timer = 30000; - } else SummonRifleman_Timer -= diff; + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Pummel + if (Pummel_Timer <= diff) + { + //Cast + if (rand()%100 < 90) //90% chance to cast + { + DoCast(me->getVictim(), SPELL_PUMMEL); + } + //12 seconds until we should cast this again + Pummel_Timer = 12000; + } else Pummel_Timer -= diff; + + //KnockAway + if (KnockAway_Timer <= diff) + { + //Cast + if (rand()%100 < 80) //80% chance to cast + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + } + //14 seconds until we should cast this again + KnockAway_Timer = 14000; + } else KnockAway_Timer -= diff; + + //Shoot + if (Shoot_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_SHOOT); + //1 seconds until we should cast this again + Shoot_Timer = 1000; + } else Shoot_Timer -= diff; + + //SummonRifleman + if (SummonRifleman_Timer <= diff) + { + //Cast + switch (rand()%9) + { + case 0: + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 1: + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 2: + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 3: + me->SummonCreature(11054,ADD_4X,ADD_4Y,ADD_4Z,ADD_4O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 4: + me->SummonCreature(11054,ADD_5X,ADD_5Y,ADD_5Z,ADD_5O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 5: + me->SummonCreature(11054,ADD_6X,ADD_6Y,ADD_6Z,ADD_6O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 6: + me->SummonCreature(11054,ADD_7X,ADD_7Y,ADD_7Z,ADD_7O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 7: + me->SummonCreature(11054,ADD_8X,ADD_8Y,ADD_8Z,ADD_8O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + case 8: + me->SummonCreature(11054,ADD_9X,ADD_9Y,ADD_9Z,ADD_9O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,240000); + me->SummonCreature(11054,ADD_3X,ADD_3Y,ADD_3Z,ADD_3O,TEMPSUMMON_TIMED_DESPAWN,240000); + break; + } + //30 seconds until we should cast this again + SummonRifleman_Timer = 30000; + } else SummonRifleman_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_cannon_master_willey(Creature* pCreature) -{ - return new boss_cannon_master_willeyAI (pCreature); -} void AddSC_boss_cannon_master_willey() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_cannon_master_willey"; - newscript->GetAI = &GetAI_boss_cannon_master_willey; - newscript->RegisterSelf(); + new boss_cannon_master_willey(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index ec2fd370a16..c740bc39459 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -64,156 +64,158 @@ SummonDef m_aSummonPoint[]= {3460.975, -3078.901, 135.002, 3.784}, //G2 back left {3457.338, -3073.979, 135.002, 3.784} //G2 back, right }; - -struct boss_dathrohan_balnazzarAI : public ScriptedAI + class boss_dathrohan_balnazzar : public CreatureScript { - boss_dathrohan_balnazzarAI(Creature *c) : ScriptedAI(c) {} +public: + boss_dathrohan_balnazzar() : CreatureScript("boss_dathrohan_balnazzar") { } - uint32 m_uiCrusadersHammer_Timer; - uint32 m_uiCrusaderStrike_Timer; - uint32 m_uiMindBlast_Timer; - uint32 m_uiHolyStrike_Timer; - uint32 m_uiShadowShock_Timer; - uint32 m_uiPsychicScream_Timer; - uint32 m_uiDeepSleep_Timer; - uint32 m_uiMindControl_Timer; - bool m_bTransformed; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiCrusadersHammer_Timer = 8000; - m_uiCrusaderStrike_Timer = 12000; - m_uiMindBlast_Timer = 6000; - m_uiHolyStrike_Timer = 18000; - m_uiShadowShock_Timer = 4000; - m_uiPsychicScream_Timer = 16000; - m_uiDeepSleep_Timer = 20000; - m_uiMindControl_Timer = 10000; - m_bTransformed = false; - - if (me->GetEntry() == NPC_BALNAZZAR) - me->UpdateEntry(NPC_DATHROHAN); + return new boss_dathrohan_balnazzarAI (pCreature); } - void JustDied(Unit* /*Victim*/) + struct boss_dathrohan_balnazzarAI : public ScriptedAI { - static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); + boss_dathrohan_balnazzarAI(Creature *c) : ScriptedAI(c) {} - for (uint8 i=0; iSummonCreature(NPC_ZOMBIE, - m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, - TEMPSUMMON_TIMED_DESPAWN, HOUR*IN_MILLISECONDS); - } + uint32 m_uiCrusadersHammer_Timer; + uint32 m_uiCrusaderStrike_Timer; + uint32 m_uiMindBlast_Timer; + uint32 m_uiHolyStrike_Timer; + uint32 m_uiShadowShock_Timer; + uint32 m_uiPsychicScream_Timer; + uint32 m_uiDeepSleep_Timer; + uint32 m_uiMindControl_Timer; + bool m_bTransformed; - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //START NOT TRANSFORMED - if (!m_bTransformed) + void Reset() { - //MindBlast - if (m_uiMindBlast_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDBLAST); - m_uiMindBlast_Timer = 15000 + rand()%5000; - } else m_uiMindBlast_Timer -= uiDiff; + m_uiCrusadersHammer_Timer = 8000; + m_uiCrusaderStrike_Timer = 12000; + m_uiMindBlast_Timer = 6000; + m_uiHolyStrike_Timer = 18000; + m_uiShadowShock_Timer = 4000; + m_uiPsychicScream_Timer = 16000; + m_uiDeepSleep_Timer = 20000; + m_uiMindControl_Timer = 10000; + m_bTransformed = false; - //CrusadersHammer - if (m_uiCrusadersHammer_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CRUSADERSHAMMER); - m_uiCrusadersHammer_Timer = 12000; - } else m_uiCrusadersHammer_Timer -= uiDiff; + if (me->GetEntry() == NPC_BALNAZZAR) + me->UpdateEntry(NPC_DATHROHAN); + } - //CrusaderStrike - if (m_uiCrusaderStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); - m_uiCrusaderStrike_Timer = 15000; - } else m_uiCrusaderStrike_Timer -= uiDiff; + void JustDied(Unit* /*Victim*/) + { + static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); - //HolyStrike - if (m_uiHolyStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_HOLYSTRIKE); - m_uiHolyStrike_Timer = 15000; - } else m_uiHolyStrike_Timer -= uiDiff; + for (uint8 i=0; iSummonCreature(NPC_ZOMBIE, + m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, + TEMPSUMMON_TIMED_DESPAWN, HOUR*IN_MILLISECONDS); + } - //BalnazzarTransform - if (me->GetHealth()*100 / me->GetMaxHealth() < 40) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + void EnterCombat(Unit * /*who*/) + { + } - //restore hp, mana and stun - DoCast(me, SPELL_BALNAZZARTRANSFORM); - me->UpdateEntry(NPC_BALNAZZAR); - m_bTransformed = true; + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //START NOT TRANSFORMED + if (!m_bTransformed) + { + //MindBlast + if (m_uiMindBlast_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + m_uiMindBlast_Timer = 15000 + rand()%5000; + } else m_uiMindBlast_Timer -= uiDiff; + + //CrusadersHammer + if (m_uiCrusadersHammer_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSHAMMER); + m_uiCrusadersHammer_Timer = 12000; + } else m_uiCrusadersHammer_Timer -= uiDiff; + + //CrusaderStrike + if (m_uiCrusaderStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CRUSADERSTRIKE); + m_uiCrusaderStrike_Timer = 15000; + } else m_uiCrusaderStrike_Timer -= uiDiff; + + //HolyStrike + if (m_uiHolyStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_HOLYSTRIKE); + m_uiHolyStrike_Timer = 15000; + } else m_uiHolyStrike_Timer -= uiDiff; + + //BalnazzarTransform + if (me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + //restore hp, mana and stun + DoCast(me, SPELL_BALNAZZARTRANSFORM); + me->UpdateEntry(NPC_BALNAZZAR); + m_bTransformed = true; + } } + else + { + //MindBlast + if (m_uiMindBlast_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDBLAST); + m_uiMindBlast_Timer = 15000 + rand()%5000; + } else m_uiMindBlast_Timer -= uiDiff; + + //ShadowShock + if (m_uiShadowShock_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SHADOWSHOCK); + m_uiShadowShock_Timer = 11000; + } else m_uiShadowShock_Timer -= uiDiff; + + //PsychicScream + if (m_uiPsychicScream_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_PSYCHICSCREAM); + + m_uiPsychicScream_Timer = 20000; + } else m_uiPsychicScream_Timer -= uiDiff; + + //DeepSleep + if (m_uiDeepSleep_Timer <= uiDiff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SLEEP); + + m_uiDeepSleep_Timer = 15000; + } else m_uiDeepSleep_Timer -= uiDiff; + + //MindControl + if (m_uiMindControl_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MINDCONTROL); + m_uiMindControl_Timer = 15000; + } else m_uiMindControl_Timer -= uiDiff; + } + + DoMeleeAttackIfReady(); } - else - { - //MindBlast - if (m_uiMindBlast_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDBLAST); - m_uiMindBlast_Timer = 15000 + rand()%5000; - } else m_uiMindBlast_Timer -= uiDiff; + }; - //ShadowShock - if (m_uiShadowShock_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_SHADOWSHOCK); - m_uiShadowShock_Timer = 11000; - } else m_uiShadowShock_Timer -= uiDiff; - - //PsychicScream - if (m_uiPsychicScream_Timer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_PSYCHICSCREAM); - - m_uiPsychicScream_Timer = 20000; - } else m_uiPsychicScream_Timer -= uiDiff; - - //DeepSleep - if (m_uiDeepSleep_Timer <= uiDiff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SLEEP); - - m_uiDeepSleep_Timer = 15000; - } else m_uiDeepSleep_Timer -= uiDiff; - - //MindControl - if (m_uiMindControl_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MINDCONTROL); - m_uiMindControl_Timer = 15000; - } else m_uiMindControl_Timer -= uiDiff; - } - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_dathrohan_balnazzar(Creature* pCreature) -{ - return new boss_dathrohan_balnazzarAI (pCreature); -} void AddSC_boss_dathrohan_balnazzar() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_dathrohan_balnazzar"; - newscript->GetAI = &GetAI_boss_dathrohan_balnazzar; - newscript->RegisterSelf(); + new boss_dathrohan_balnazzar(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index 4551a8c5118..075117d9721 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -33,98 +33,100 @@ EndScriptData */ #define MODEL_NORMAL 10433 #define MODEL_HUMAN 3637 - -struct boss_magistrate_barthilasAI : public ScriptedAI + class boss_magistrate_barthilas : public CreatureScript { - boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) {} +public: + boss_magistrate_barthilas() : CreatureScript("boss_magistrate_barthilas") { } - uint32 DrainingBlow_Timer; - uint32 CrowdPummel_Timer; - uint32 MightyBlow_Timer; - uint32 FuriousAnger_Timer; - uint32 AngerCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DrainingBlow_Timer = 20000; - CrowdPummel_Timer = 15000; - MightyBlow_Timer = 10000; - FuriousAnger_Timer = 5000; - AngerCount = 0; - - if (me->isAlive()) - me->SetDisplayId(MODEL_NORMAL); - else - me->SetDisplayId(MODEL_HUMAN); + return new boss_magistrate_barthilasAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct boss_magistrate_barthilasAI : public ScriptedAI { - //nothing to see here yet + boss_magistrate_barthilasAI(Creature *c) : ScriptedAI(c) {} - ScriptedAI::MoveInLineOfSight(who); - } + uint32 DrainingBlow_Timer; + uint32 CrowdPummel_Timer; + uint32 MightyBlow_Timer; + uint32 FuriousAnger_Timer; + uint32 AngerCount; - void JustDied(Unit* /*Killer*/) - { - me->SetDisplayId(MODEL_HUMAN); - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (FuriousAnger_Timer <= diff) + void Reset() { - FuriousAnger_Timer = 4000; - if (AngerCount > 25) + DrainingBlow_Timer = 20000; + CrowdPummel_Timer = 15000; + MightyBlow_Timer = 10000; + FuriousAnger_Timer = 5000; + AngerCount = 0; + + if (me->isAlive()) + me->SetDisplayId(MODEL_NORMAL); + else + me->SetDisplayId(MODEL_HUMAN); + } + + void MoveInLineOfSight(Unit *who) + { + //nothing to see here yet + + ScriptedAI::MoveInLineOfSight(who); + } + + void JustDied(Unit* /*Killer*/) + { + me->SetDisplayId(MODEL_HUMAN); + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) return; - ++AngerCount; - DoCast(me, SPELL_FURIOUS_ANGER, false); - } else FuriousAnger_Timer -= diff; + if (FuriousAnger_Timer <= diff) + { + FuriousAnger_Timer = 4000; + if (AngerCount > 25) + return; - //DrainingBlow - if (DrainingBlow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DRAININGBLOW); - DrainingBlow_Timer = 15000; - } else DrainingBlow_Timer -= diff; + ++AngerCount; + DoCast(me, SPELL_FURIOUS_ANGER, false); + } else FuriousAnger_Timer -= diff; - //CrowdPummel - if (CrowdPummel_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CROWDPUMMEL); - CrowdPummel_Timer = 15000; - } else CrowdPummel_Timer -= diff; + //DrainingBlow + if (DrainingBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DRAININGBLOW); + DrainingBlow_Timer = 15000; + } else DrainingBlow_Timer -= diff; - //MightyBlow - if (MightyBlow_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MIGHTYBLOW); - MightyBlow_Timer = 20000; - } else MightyBlow_Timer -= diff; + //CrowdPummel + if (CrowdPummel_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CROWDPUMMEL); + CrowdPummel_Timer = 15000; + } else CrowdPummel_Timer -= diff; + + //MightyBlow + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTYBLOW); + MightyBlow_Timer = 20000; + } else MightyBlow_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_magistrate_barthilas(Creature* pCreature) -{ - return new boss_magistrate_barthilasAI (pCreature); -} void AddSC_boss_magistrate_barthilas() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_magistrate_barthilas"; - newscript->GetAI = &GetAI_boss_magistrate_barthilas; - newscript->RegisterSelf(); + new boss_magistrate_barthilas(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index f47da709578..e65694baaec 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -30,81 +30,83 @@ EndScriptData */ #define SPELL_DRAINLIFE 20743 #define SPELL_DRAIN_MANA 17243 #define SPELL_ICETOMB 16869 - -struct boss_maleki_the_pallidAI : public ScriptedAI + class boss_maleki_the_pallid : public CreatureScript { - boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) +public: + boss_maleki_the_pallid() : CreatureScript("boss_maleki_the_pallid") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_maleki_the_pallidAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 Frostbolt_Timer; - uint32 IceTomb_Timer; - uint32 DrainLife_Timer; - - void Reset() + struct boss_maleki_the_pallidAI : public ScriptedAI { - Frostbolt_Timer = 1000; - IceTomb_Timer = 16000; - DrainLife_Timer = 31000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_PALLID,IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Frostbolt - if (Frostbolt_Timer <= diff) + boss_maleki_the_pallidAI(Creature *c) : ScriptedAI(c) { - if (rand()%100 < 90) - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 3500; - } else Frostbolt_Timer -= diff; + pInstance = me->GetInstanceScript(); + } - //IceTomb - if (IceTomb_Timer <= diff) - { - if (rand()%100 < 65) - DoCast(me->getVictim(), SPELL_ICETOMB); - IceTomb_Timer = 28000; - } else IceTomb_Timer -= diff; + InstanceScript* pInstance; - //DrainLife - if (DrainLife_Timer <= diff) + uint32 Frostbolt_Timer; + uint32 IceTomb_Timer; + uint32 DrainLife_Timer; + + void Reset() { - if (rand()%100 < 55) - DoCast(me->getVictim(), SPELL_DRAINLIFE); + Frostbolt_Timer = 1000; + IceTomb_Timer = 16000; DrainLife_Timer = 31000; - } else DrainLife_Timer -= diff; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_PALLID,IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Frostbolt + if (Frostbolt_Timer <= diff) + { + if (rand()%100 < 90) + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 3500; + } else Frostbolt_Timer -= diff; + + //IceTomb + if (IceTomb_Timer <= diff) + { + if (rand()%100 < 65) + DoCast(me->getVictim(), SPELL_ICETOMB); + IceTomb_Timer = 28000; + } else IceTomb_Timer -= diff; + + //DrainLife + if (DrainLife_Timer <= diff) + { + if (rand()%100 < 55) + DoCast(me->getVictim(), SPELL_DRAINLIFE); + DrainLife_Timer = 31000; + } else DrainLife_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_maleki_the_pallid(Creature* pCreature) -{ - return new boss_maleki_the_pallidAI (pCreature); -} void AddSC_boss_maleki_the_pallid() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_maleki_the_pallid"; - newscript->GetAI = &GetAI_boss_maleki_the_pallid; - newscript->RegisterSelf(); + new boss_maleki_the_pallid(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index 1e39e4ef3e4..19cb00172b8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -30,94 +30,96 @@ EndScriptData */ #define SPELL_PIERCEARMOR 6016 #define SPELL_CRYPT_SCARABS 31602 #define SPELL_RAISEUNDEADSCARAB 17235 - -struct boss_nerubenkanAI : public ScriptedAI + class boss_nerubenkan : public CreatureScript { - boss_nerubenkanAI(Creature *c) : ScriptedAI(c) +public: + boss_nerubenkan() : CreatureScript("boss_nerubenkan") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_nerubenkanAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 EncasingWebs_Timer; - uint32 PierceArmor_Timer; - uint32 CryptScarabs_Timer; - uint32 RaiseUndeadScarab_Timer; - - void Reset() + struct boss_nerubenkanAI : public ScriptedAI { - CryptScarabs_Timer = 3000; - EncasingWebs_Timer = 7000; - PierceArmor_Timer = 19000; - RaiseUndeadScarab_Timer = 3000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_NERUB,IN_PROGRESS); - } - - void RaiseUndeadScarab(Unit* pVictim) - { - if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) - if (pUndeadScarab->AI()) - pUndeadScarab->AI()->AttackStart(pVictim); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //EncasingWebs - if (EncasingWebs_Timer <= diff) + boss_nerubenkanAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_ENCASINGWEBS); - EncasingWebs_Timer = 30000; - } else EncasingWebs_Timer -= diff; + pInstance = me->GetInstanceScript(); + } - //PierceArmor - if (PierceArmor_Timer <= diff) + InstanceScript* pInstance; + + uint32 EncasingWebs_Timer; + uint32 PierceArmor_Timer; + uint32 CryptScarabs_Timer; + uint32 RaiseUndeadScarab_Timer; + + void Reset() { - if (urand(0,3) < 2) - DoCast(me->getVictim(), SPELL_PIERCEARMOR); - PierceArmor_Timer = 35000; - } else PierceArmor_Timer -= diff; + CryptScarabs_Timer = 3000; + EncasingWebs_Timer = 7000; + PierceArmor_Timer = 19000; + RaiseUndeadScarab_Timer = 3000; + } - //CryptScarabs_Timer - if (CryptScarabs_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CRYPT_SCARABS); - CryptScarabs_Timer = 20000; - } else CryptScarabs_Timer -= diff; + } - //RaiseUndeadScarab - if (RaiseUndeadScarab_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - RaiseUndeadScarab(me->getVictim()); - RaiseUndeadScarab_Timer = 16000; - } else RaiseUndeadScarab_Timer -= diff; + if (pInstance) + pInstance->SetData(TYPE_NERUB,IN_PROGRESS); + } + + void RaiseUndeadScarab(Unit* pVictim) + { + if (Creature* pUndeadScarab = DoSpawnCreature(10876, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000)) + if (pUndeadScarab->AI()) + pUndeadScarab->AI()->AttackStart(pVictim); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //EncasingWebs + if (EncasingWebs_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ENCASINGWEBS); + EncasingWebs_Timer = 30000; + } else EncasingWebs_Timer -= diff; + + //PierceArmor + if (PierceArmor_Timer <= diff) + { + if (urand(0,3) < 2) + DoCast(me->getVictim(), SPELL_PIERCEARMOR); + PierceArmor_Timer = 35000; + } else PierceArmor_Timer -= diff; + + //CryptScarabs_Timer + if (CryptScarabs_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CRYPT_SCARABS); + CryptScarabs_Timer = 20000; + } else CryptScarabs_Timer -= diff; + + //RaiseUndeadScarab + if (RaiseUndeadScarab_Timer <= diff) + { + RaiseUndeadScarab(me->getVictim()); + RaiseUndeadScarab_Timer = 16000; + } else RaiseUndeadScarab_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_nerubenkan(Creature* pCreature) -{ - return new boss_nerubenkanAI (pCreature); -} void AddSC_boss_nerubenkan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_nerubenkan"; - newscript->GetAI = &GetAI_boss_nerubenkan; - newscript->RegisterSelf(); + new boss_nerubenkan(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index c20ac90aae0..6e4eb25fb12 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -42,118 +42,117 @@ EndScriptData */ #define SPELL_HOLY_LIGHT 25263 #define SPELL_DIVINE_SHIELD 13874 - -struct boss_silver_hand_bossesAI : public ScriptedAI +class boss_silver_hand_bosses : public CreatureScript { - boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) +public: + boss_silver_hand_bosses() : CreatureScript("boss_silver_hand_bosses") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_silver_hand_bossesAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 HolyLight_Timer; - uint32 DivineShield_Timer; - - void Reset() + struct boss_silver_hand_bossesAI : public ScriptedAI { - HolyLight_Timer = 20000; - DivineShield_Timer = 20000; - - if (pInstance) + boss_silver_hand_bossesAI(Creature* c) : ScriptedAI(c) { - switch(me->GetEntry()) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 HolyLight_Timer; + uint32 DivineShield_Timer; + + void Reset() + { + HolyLight_Timer = 20000; + DivineShield_Timer = 20000; + + if (pInstance) { - case SH_AELMAR: - pInstance->SetData(TYPE_SH_AELMAR, 0); - break; - case SH_CATHELA: - pInstance->SetData(TYPE_SH_CATHELA, 0); - break; - case SH_GREGOR: - pInstance->SetData(TYPE_SH_GREGOR, 0); - break; - case SH_NEMAS: - pInstance->SetData(TYPE_SH_NEMAS, 0); - break; - case SH_VICAR: - pInstance->SetData(TYPE_SH_VICAR, 0); - break; + switch(me->GetEntry()) + { + case SH_AELMAR: + pInstance->SetData(TYPE_SH_AELMAR, 0); + break; + case SH_CATHELA: + pInstance->SetData(TYPE_SH_CATHELA, 0); + break; + case SH_GREGOR: + pInstance->SetData(TYPE_SH_GREGOR, 0); + break; + case SH_NEMAS: + pInstance->SetData(TYPE_SH_NEMAS, 0); + break; + case SH_VICAR: + pInstance->SetData(TYPE_SH_VICAR, 0); + break; + } } } - } - void EnterCombat(Unit* /*who*/) - { - } - - void JustDied(Unit* Killer) - { - if (pInstance) + void EnterCombat(Unit* /*who*/) { - switch(me->GetEntry()) - { - case SH_AELMAR: - pInstance->SetData(TYPE_SH_AELMAR, 2); - break; - case SH_CATHELA: - pInstance->SetData(TYPE_SH_CATHELA, 2); - break; - case SH_GREGOR: - pInstance->SetData(TYPE_SH_GREGOR, 2); - break; - case SH_NEMAS: - pInstance->SetData(TYPE_SH_NEMAS, 2); - break; - case SH_VICAR: - pInstance->SetData(TYPE_SH_VICAR, 2); - break; - } - if (pInstance->GetData(TYPE_SH_QUEST) && Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT,me->GetGUID()); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (HolyLight_Timer <= diff) + void JustDied(Unit* Killer) { - if (me->GetHealth()*5 < me->GetMaxHealth()) + if (pInstance) { - DoCast(me, SPELL_HOLY_LIGHT); - HolyLight_Timer = 20000; + switch(me->GetEntry()) + { + case SH_AELMAR: + pInstance->SetData(TYPE_SH_AELMAR, 2); + break; + case SH_CATHELA: + pInstance->SetData(TYPE_SH_CATHELA, 2); + break; + case SH_GREGOR: + pInstance->SetData(TYPE_SH_GREGOR, 2); + break; + case SH_NEMAS: + pInstance->SetData(TYPE_SH_NEMAS, 2); + break; + case SH_VICAR: + pInstance->SetData(TYPE_SH_VICAR, 2); + break; + } + if (pInstance->GetData(TYPE_SH_QUEST) && Killer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(Killer)->KilledMonsterCredit(SH_QUEST_CREDIT,me->GetGUID()); } - } else HolyLight_Timer -= diff; + } - if (DivineShield_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (me->GetHealth()*20 < me->GetMaxHealth()) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (HolyLight_Timer <= diff) { - DoCast(me, SPELL_DIVINE_SHIELD); - DivineShield_Timer = 40000; - } - } else DivineShield_Timer -= diff; + if (me->GetHealth()*5 < me->GetMaxHealth()) + { + DoCast(me, SPELL_HOLY_LIGHT); + HolyLight_Timer = 20000; + } + } else HolyLight_Timer -= diff; - DoMeleeAttackIfReady(); - } + if (DivineShield_Timer <= diff) + { + if (me->GetHealth()*20 < me->GetMaxHealth()) + { + DoCast(me, SPELL_DIVINE_SHIELD); + DivineShield_Timer = 40000; + } + } else DivineShield_Timer -= diff; + DoMeleeAttackIfReady(); + } + }; }; -CreatureAI* GetAI_boss_silver_hand_bossesAI(Creature* pCreature) -{ - return new boss_silver_hand_bossesAI (pCreature); -} void AddSC_boss_order_of_silver_hand() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_silver_hand_bosses"; - newscript->GetAI = &GetAI_boss_silver_hand_bossesAI; - newscript->RegisterSelf(); + new boss_silver_hand_bosses(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 002cd963e2a..26934d10137 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -35,112 +35,114 @@ EndScriptData */ #define SPELL_CURSEOFWEAKNESS 8552 #define SPELL_CURSEOFTONGUES 12889 #define SPELL_CALLOFTHEGRAVE 17831 - -struct boss_postmaster_malownAI : public ScriptedAI + class boss_postmaster_malown : public CreatureScript { - boss_postmaster_malownAI(Creature *c) : ScriptedAI(c) {} +public: + boss_postmaster_malown() : CreatureScript("boss_postmaster_malown") { } - uint32 WailingDead_Timer; - uint32 Backhand_Timer; - uint32 CurseOfWeakness_Timer; - uint32 CurseOfTongues_Timer; - uint32 CallOfTheGrave_Timer; - bool HasYelled; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WailingDead_Timer = 19000; //lasts 6 sec - Backhand_Timer = 8000; //2 sec stun - CurseOfWeakness_Timer = 20000; //lasts 2 mins - CurseOfTongues_Timer = 22000; - CallOfTheGrave_Timer = 25000; - HasYelled = false; + return new boss_postmaster_malownAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_postmaster_malownAI : public ScriptedAI { - } + boss_postmaster_malownAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WailingDead_Timer; + uint32 Backhand_Timer; + uint32 CurseOfWeakness_Timer; + uint32 CurseOfTongues_Timer; + uint32 CallOfTheGrave_Timer; + bool HasYelled; - //WailingDead - if (WailingDead_Timer <= diff) + void Reset() { - //Cast - if (rand()%100 < 65) //65% chance to cast - { - DoCast(me->getVictim(), SPELL_WAILINGDEAD); - } - //19 seconds until we should cast this again - WailingDead_Timer = 19000; - } else WailingDead_Timer -= diff; - - //Backhand - if (Backhand_Timer <= diff) - { - //Cast - if (rand()%100 < 45) //45% chance to cast - { - DoCast(me->getVictim(), SPELL_BACKHAND); - } - //8 seconds until we should cast this again - Backhand_Timer = 8000; - } else Backhand_Timer -= diff; - - //CurseOfWeakness - if (CurseOfWeakness_Timer <= diff) - { - //Cast - if (rand()%100 < 3) //3% chance to cast - { - DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); - } - //20 seconds until we should cast this again - CurseOfWeakness_Timer = 20000; - } else CurseOfWeakness_Timer -= diff; - - //CurseOfTongues - if (CurseOfTongues_Timer <= diff) - { - //Cast - if (rand()%100 < 3) //3% chance to cast - { - DoCast(me->getVictim(), SPELL_CURSEOFTONGUES); - } - //22 seconds until we should cast this again + WailingDead_Timer = 19000; //lasts 6 sec + Backhand_Timer = 8000; //2 sec stun + CurseOfWeakness_Timer = 20000; //lasts 2 mins CurseOfTongues_Timer = 22000; - } else CurseOfTongues_Timer -= diff; - - //CallOfTheGrave - if (CallOfTheGrave_Timer <= diff) - { - //Cast - if (rand()%100 < 5) //5% chance to cast - { - DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); - } - //25 seconds until we should cast this again CallOfTheGrave_Timer = 25000; - } else CallOfTheGrave_Timer -= diff; + HasYelled = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //WailingDead + if (WailingDead_Timer <= diff) + { + //Cast + if (rand()%100 < 65) //65% chance to cast + { + DoCast(me->getVictim(), SPELL_WAILINGDEAD); + } + //19 seconds until we should cast this again + WailingDead_Timer = 19000; + } else WailingDead_Timer -= diff; + + //Backhand + if (Backhand_Timer <= diff) + { + //Cast + if (rand()%100 < 45) //45% chance to cast + { + DoCast(me->getVictim(), SPELL_BACKHAND); + } + //8 seconds until we should cast this again + Backhand_Timer = 8000; + } else Backhand_Timer -= diff; + + //CurseOfWeakness + if (CurseOfWeakness_Timer <= diff) + { + //Cast + if (rand()%100 < 3) //3% chance to cast + { + DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS); + } + //20 seconds until we should cast this again + CurseOfWeakness_Timer = 20000; + } else CurseOfWeakness_Timer -= diff; + + //CurseOfTongues + if (CurseOfTongues_Timer <= diff) + { + //Cast + if (rand()%100 < 3) //3% chance to cast + { + DoCast(me->getVictim(), SPELL_CURSEOFTONGUES); + } + //22 seconds until we should cast this again + CurseOfTongues_Timer = 22000; + } else CurseOfTongues_Timer -= diff; + + //CallOfTheGrave + if (CallOfTheGrave_Timer <= diff) + { + //Cast + if (rand()%100 < 5) //5% chance to cast + { + DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE); + } + //25 seconds until we should cast this again + CallOfTheGrave_Timer = 25000; + } else CallOfTheGrave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_postmaster_malown(Creature* pCreature) -{ - return new boss_postmaster_malownAI (pCreature); -} void AddSC_boss_postmaster_malown() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_postmaster_malown"; - newscript->GetAI = &GetAI_boss_postmaster_malown; - newscript->RegisterSelf(); + new boss_postmaster_malown(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index 809b62e68af..62ab92965b3 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -30,75 +30,77 @@ EndScriptData */ #define SPELL_KNOCKOUT 17307 #define C_MINDLESS_UNDEAD 11030 - -struct boss_ramstein_the_gorgerAI : public ScriptedAI + class boss_ramstein_the_gorger : public CreatureScript { - boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) +public: + boss_ramstein_the_gorger() : CreatureScript("boss_ramstein_the_gorger") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_ramstein_the_gorgerAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 Trample_Timer; - uint32 Knockout_Timer; - - void Reset() + struct boss_ramstein_the_gorgerAI : public ScriptedAI { - Trample_Timer = 3000; - Knockout_Timer = 12000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*Killer*/) - { - for (uint8 i = 0; i < 30; ++i) + boss_ramstein_the_gorgerAI(Creature *c) : ScriptedAI(c) { - if (Creature* mob = me->SummonCreature(C_MINDLESS_UNDEAD,3969.35+irand(-10,10),-3391.87+irand(-10,10),119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000)) - mob->AI()->AttackStart(me->SelectNearestTarget(500)); + pInstance = me->GetInstanceScript(); } - if (pInstance) - pInstance->SetData(TYPE_RAMSTEIN,DONE); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Trample_Timer; + uint32 Knockout_Timer; - //Trample - if (Trample_Timer <= diff) + void Reset() { - DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 7000; - } else Trample_Timer -= diff; + Trample_Timer = 3000; + Knockout_Timer = 12000; + } - //Knockout - if (Knockout_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_KNOCKOUT); - Knockout_Timer = 10000; - } else Knockout_Timer -= diff; + } + + void JustDied(Unit* /*Killer*/) + { + for (uint8 i = 0; i < 30; ++i) + { + if (Creature* mob = me->SummonCreature(C_MINDLESS_UNDEAD,3969.35+irand(-10,10),-3391.87+irand(-10,10),119.11,5.91,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000)) + mob->AI()->AttackStart(me->SelectNearestTarget(500)); + } + + if (pInstance) + pInstance->SetData(TYPE_RAMSTEIN,DONE); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Trample + if (Trample_Timer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + Trample_Timer = 7000; + } else Trample_Timer -= diff; + + //Knockout + if (Knockout_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKOUT); + Knockout_Timer = 10000; + } else Knockout_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ramstein_the_gorger(Creature* pCreature) -{ - return new boss_ramstein_the_gorgerAI (pCreature); -} void AddSC_boss_ramstein_the_gorger() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ramstein_the_gorger"; - newscript->GetAI = &GetAI_boss_ramstein_the_gorger; - newscript->RegisterSelf(); + new boss_ramstein_the_gorger(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index 426e40e2db2..751fec2de38 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -28,58 +28,60 @@ EndScriptData */ #define SAY_SPAWN "TIMMY!" #define SPELL_RAVENOUSCLAW 17470 - -struct boss_timmy_the_cruelAI : public ScriptedAI + class boss_timmy_the_cruel : public CreatureScript { - boss_timmy_the_cruelAI(Creature *c) : ScriptedAI(c) {} +public: + boss_timmy_the_cruel() : CreatureScript("boss_timmy_the_cruel") { } - uint32 RavenousClaw_Timer; - bool HasYelled; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - RavenousClaw_Timer = 10000; - HasYelled = false; + return new boss_timmy_the_cruelAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_timmy_the_cruelAI : public ScriptedAI { - if (!HasYelled) + boss_timmy_the_cruelAI(Creature *c) : ScriptedAI(c) {} + + uint32 RavenousClaw_Timer; + bool HasYelled; + + void Reset() { - me->MonsterYell(SAY_SPAWN,LANG_UNIVERSAL,NULL); - HasYelled = true; + RavenousClaw_Timer = 10000; + HasYelled = false; } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //RavenousClaw - if (RavenousClaw_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - //Cast - DoCast(me->getVictim(), SPELL_RAVENOUSCLAW); - //15 seconds until we should cast this again - RavenousClaw_Timer = 15000; - } else RavenousClaw_Timer -= diff; + if (!HasYelled) + { + me->MonsterYell(SAY_SPAWN,LANG_UNIVERSAL,NULL); + HasYelled = true; + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //RavenousClaw + if (RavenousClaw_Timer <= diff) + { + //Cast + DoCast(me->getVictim(), SPELL_RAVENOUSCLAW); + //15 seconds until we should cast this again + RavenousClaw_Timer = 15000; + } else RavenousClaw_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_timmy_the_cruel(Creature* pCreature) -{ - return new boss_timmy_the_cruelAI (pCreature); -} void AddSC_boss_timmy_the_cruel() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_timmy_the_cruel"; - newscript->GetAI = &GetAI_boss_timmy_the_cruel; - newscript->RegisterSelf(); + new boss_timmy_the_cruel(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 797a3899806..1baae222285 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -48,413 +48,415 @@ EndScriptData */ #define C_YSIDA 16031 #define MAX_ENCOUNTER 6 - -struct instance_stratholme : public ScriptedInstance + class instance_stratholme : public InstanceMapScript { - instance_stratholme(Map* pMap) : ScriptedInstance(pMap) {} +public: + instance_stratholme() : InstanceMapScript("instance_stratholme") { } - uint32 Encounter[MAX_ENCOUNTER]; - - bool IsSilverHandDead[5]; - - uint32 BaronRun_Timer; - uint32 SlaugtherSquare_Timer; - - uint64 serviceEntranceGUID; - uint64 gauntletGate1GUID; - uint64 ziggurat1GUID; - uint64 ziggurat2GUID; - uint64 ziggurat3GUID; - uint64 ziggurat4GUID; - uint64 ziggurat5GUID; - uint64 portGauntletGUID; - uint64 portSlaugtherGUID; - uint64 portElderGUID; - - uint64 baronGUID; - uint64 ysidaTriggerGUID; - std::set crystalsGUID; - std::set abomnationGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - Encounter[i] = NOT_STARTED; - - for (uint8 i = 0; i < 5; ++i) - IsSilverHandDead[i] = false; - - BaronRun_Timer = 0; - SlaugtherSquare_Timer = 0; - - serviceEntranceGUID = 0; - gauntletGate1GUID = 0; - ziggurat1GUID = 0; - ziggurat2GUID = 0; - ziggurat3GUID = 0; - ziggurat4GUID = 0; - ziggurat5GUID = 0; - portGauntletGUID = 0; - portSlaugtherGUID = 0; - portElderGUID = 0; - - baronGUID = 0; - ysidaTriggerGUID = 0; - crystalsGUID.clear(); - abomnationGUID.clear(); + return new instance_stratholme_InstanceMapScript(pMap); } - bool StartSlaugtherSquare() + struct instance_stratholme_InstanceMapScript : public InstanceScript { - //change to DONE when crystals implemented - if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) + instance_stratholme_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} + + uint32 Encounter[MAX_ENCOUNTER]; + + bool IsSilverHandDead[5]; + + uint32 BaronRun_Timer; + uint32 SlaugtherSquare_Timer; + + uint64 serviceEntranceGUID; + uint64 gauntletGate1GUID; + uint64 ziggurat1GUID; + uint64 ziggurat2GUID; + uint64 ziggurat3GUID; + uint64 ziggurat4GUID; + uint64 ziggurat5GUID; + uint64 portGauntletGUID; + uint64 portSlaugtherGUID; + uint64 portElderGUID; + + uint64 baronGUID; + uint64 ysidaTriggerGUID; + std::set crystalsGUID; + std::set abomnationGUID; + + void Initialize() { - HandleGameObject(portGauntletGUID, true); - HandleGameObject(portSlaugtherGUID, true); - return true; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + Encounter[i] = NOT_STARTED; + + for (uint8 i = 0; i < 5; ++i) + IsSilverHandDead[i] = false; + + BaronRun_Timer = 0; + SlaugtherSquare_Timer = 0; + + serviceEntranceGUID = 0; + gauntletGate1GUID = 0; + ziggurat1GUID = 0; + ziggurat2GUID = 0; + ziggurat3GUID = 0; + ziggurat4GUID = 0; + ziggurat5GUID = 0; + portGauntletGUID = 0; + portSlaugtherGUID = 0; + portElderGUID = 0; + + baronGUID = 0; + ysidaTriggerGUID = 0; + crystalsGUID.clear(); + abomnationGUID.clear(); } - sLog.outDebug("TSCR: Instance Stratholme: Cannot open slaugther square yet."); - return false; - } - - //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds - void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) - { - if (!goGuid) - return; - - if (GameObject* pGo = instance->GetGameObject(goGuid)) + bool StartSlaugtherSquare() { - if (withRestoreTime) - pGo->UseDoorOrButton(10); - else - pGo->SetGoState((GOState)newState); - } - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case C_BARON: baronGUID = pCreature->GetGUID(); break; - case C_YSIDA_TRIGGER: ysidaTriggerGUID = pCreature->GetGUID(); break; - case C_CRYSTAL: crystalsGUID.insert(pCreature->GetGUID()); break; - case C_ABOM_BILE: - case C_ABOM_VENOM: abomnationGUID.insert(pCreature->GetGUID()); break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_SERVICE_ENTRANCE: - serviceEntranceGUID = pGo->GetGUID(); - break; - case GO_GAUNTLET_GATE1: - //weird, but unless flag is set, client will not respond as expected. DB bug? - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); - gauntletGate1GUID = pGo->GetGUID(); - break; - case GO_ZIGGURAT1: - ziggurat1GUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT2: - ziggurat2GUID = pGo->GetGUID(); - if (GetData(TYPE_NERUB) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT3: - ziggurat3GUID = pGo->GetGUID(); - if (GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT4: - ziggurat4GUID = pGo->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, pGo); - break; - case GO_ZIGGURAT5: - ziggurat5GUID = pGo->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_GAUNTLET: - portGauntletGUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_SLAUGTHER: - portSlaugtherGUID = pGo->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) - HandleGameObject(0, true, pGo); - break; - case GO_PORT_ELDERS: - portElderGUID = pGo->GetGUID(); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case TYPE_BARON_RUN: - switch(data) + //change to DONE when crystals implemented + if (Encounter[1] == IN_PROGRESS && Encounter[2] == IN_PROGRESS && Encounter[3] == IN_PROGRESS) { - case IN_PROGRESS: - if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) - break; - Encounter[0] = data; - BaronRun_Timer = 2700000; - sLog.outDebug("TSCR: Instance Stratholme: Baron run in progress."); - break; - case FAIL: - //may add code to remove aura from players, but in theory the time should be up already and removed. - Encounter[0] = data; - break; - case DONE: - Encounter[0] = data; - if (Creature* pYsidaT = instance->GetCreature(ysidaTriggerGUID)) - pYsidaT->SummonCreature(C_YSIDA, - pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(), - TEMPSUMMON_TIMED_DESPAWN,1800000); - BaronRun_Timer = 0; - break; - } - break; - case TYPE_BARONESS: - Encounter[1] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat1GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_NERUB: - Encounter[2] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat2GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_PALLID: - Encounter[3] = data; - if (data == IN_PROGRESS) - HandleGameObject(ziggurat3GUID, true); - if (data == IN_PROGRESS) //change to DONE when crystals implemented - StartSlaugtherSquare(); - break; - case TYPE_RAMSTEIN: - if (data == IN_PROGRESS) - { - HandleGameObject(portGauntletGUID, false); - - uint32 count = abomnationGUID.size(); - for (std::set::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) - { - if (Creature* pAbom = instance->GetCreature(*i)) - { - if (!pAbom->isAlive()) - --count; - } - } - - if (!count) - { - //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. - //UpdateGoState(ziggurat4GUID,0,true); - if (Creature* pBaron = instance->GetCreature(baronGUID)) - pBaron->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); - sLog.outDebug("TSCR: Instance Stratholme: Ramstein spawned."); - } - else - sLog.outDebug("TSCR: Instance Stratholme: %u Abomnation left to kill.",count); - } - - if (data == NOT_STARTED) HandleGameObject(portGauntletGUID, true); - - if (data == DONE) - { - SlaugtherSquare_Timer = 300000; - sLog.outDebug("TSCR: Instance Stratholme: Slaugther event will continue in 5 minutes."); + HandleGameObject(portSlaugtherGUID, true); + return true; } - Encounter[4] = data; - break; - case TYPE_BARON: - if (data == IN_PROGRESS) + + sLog.outDebug("TSCR: Instance Stratholme: Cannot open slaugther square yet."); + return false; + } + + //if withRestoreTime true, then newState will be ignored and GO should be restored to original state after 10 seconds + void UpdateGoState(uint64 goGuid, uint32 newState, bool withRestoreTime) + { + if (!goGuid) + return; + + if (GameObject* pGo = instance->GetGameObject(goGuid)) { - HandleGameObject(ziggurat4GUID, false); - HandleGameObject(ziggurat5GUID, false); - if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) + if (withRestoreTime) + pGo->UseDoorOrButton(10); + else + pGo->SetGoState((GOState)newState); + } + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case C_BARON: baronGUID = pCreature->GetGUID(); break; + case C_YSIDA_TRIGGER: ysidaTriggerGUID = pCreature->GetGUID(); break; + case C_CRYSTAL: crystalsGUID.insert(pCreature->GetGUID()); break; + case C_ABOM_BILE: + case C_ABOM_VENOM: abomnationGUID.insert(pCreature->GetGUID()); break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_SERVICE_ENTRANCE: + serviceEntranceGUID = pGo->GetGUID(); + break; + case GO_GAUNTLET_GATE1: + //weird, but unless flag is set, client will not respond as expected. DB bug? + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_LOCKED); + gauntletGate1GUID = pGo->GetGUID(); + break; + case GO_ZIGGURAT1: + ziggurat1GUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT2: + ziggurat2GUID = pGo->GetGUID(); + if (GetData(TYPE_NERUB) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT3: + ziggurat3GUID = pGo->GetGUID(); + if (GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT4: + ziggurat4GUID = pGo->GetGUID(); + if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + HandleGameObject(0, true, pGo); + break; + case GO_ZIGGURAT5: + ziggurat5GUID = pGo->GetGUID(); + if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_GAUNTLET: + portGauntletGUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_SLAUGTHER: + portSlaugtherGUID = pGo->GetGUID(); + if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + HandleGameObject(0, true, pGo); + break; + case GO_PORT_ELDERS: + portElderGUID = pGo->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_BARON_RUN: + switch(data) { - Map::PlayerList const& players = instance->GetPlayers(); + case IN_PROGRESS: + if (Encounter[0] == IN_PROGRESS || Encounter[0] == FAIL) + break; + Encounter[0] = data; + BaronRun_Timer = 2700000; + sLog.outDebug("TSCR: Instance Stratholme: Baron run in progress."); + break; + case FAIL: + //may add code to remove aura from players, but in theory the time should be up already and removed. + Encounter[0] = data; + break; + case DONE: + Encounter[0] = data; + if (Creature* pYsidaT = instance->GetCreature(ysidaTriggerGUID)) + pYsidaT->SummonCreature(C_YSIDA, + pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(), + TEMPSUMMON_TIMED_DESPAWN,1800000); + BaronRun_Timer = 0; + break; + } + break; + case TYPE_BARONESS: + Encounter[1] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat1GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_NERUB: + Encounter[2] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat2GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_PALLID: + Encounter[3] = data; + if (data == IN_PROGRESS) + HandleGameObject(ziggurat3GUID, true); + if (data == IN_PROGRESS) //change to DONE when crystals implemented + StartSlaugtherSquare(); + break; + case TYPE_RAMSTEIN: + if (data == IN_PROGRESS) + { + HandleGameObject(portGauntletGUID, false); - if (!players.isEmpty()) + uint32 count = abomnationGUID.size(); + for (std::set::const_iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Creature* pAbom = instance->GetCreature(*i)) { - if (Player* pPlayer = itr->getSource()) - { - if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) - pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); - - if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); - } + if (!pAbom->isAlive()) + --count; } } - SetData(TYPE_BARON_RUN,DONE); + if (!count) + { + //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. + //UpdateGoState(ziggurat4GUID,0,true); + if (Creature* pBaron = instance->GetCreature(baronGUID)) + pBaron->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + sLog.outDebug("TSCR: Instance Stratholme: Ramstein spawned."); + } + else + sLog.outDebug("TSCR: Instance Stratholme: %u Abomnation left to kill.",count); } - } - if (data == DONE || data == NOT_STARTED) - { - HandleGameObject(ziggurat4GUID, true); - HandleGameObject(ziggurat5GUID, true); - } - if (data == DONE) - HandleGameObject(portGauntletGUID, true); - Encounter[5] = data; - break; - case TYPE_SH_AELMAR: - IsSilverHandDead[0] = (data) ? true : false; - break; - case TYPE_SH_CATHELA: - IsSilverHandDead[1] = (data) ? true : false; - break; - case TYPE_SH_GREGOR: - IsSilverHandDead[2] = (data) ? true : false; - break; - case TYPE_SH_NEMAS: - IsSilverHandDead[3] = (data) ? true : false; - break; - case TYPE_SH_VICAR: - IsSilverHandDead[4] = (data) ? true : false; - break; - } - if (data == DONE)SaveToDB(); - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + if (data == NOT_STARTED) + HandleGameObject(portGauntletGUID, true); - std::ostringstream saveStream; - saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " - << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] - >> Encounter[4] >> Encounter[5]; - - // Do not reset 1, 2 and 3. they are not set to done, yet . - if (Encounter[0] == IN_PROGRESS) - Encounter[0] = NOT_STARTED; - if (Encounter[4] == IN_PROGRESS) - Encounter[4] = NOT_STARTED; - if (Encounter[5] == IN_PROGRESS) - Encounter[5] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_SH_QUEST: - if (IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) - return 1; - return 0; - case TYPE_BARON_RUN: - return Encounter[0]; - case TYPE_BARONESS: - return Encounter[1]; - case TYPE_NERUB: - return Encounter[2]; - case TYPE_PALLID: - return Encounter[3]; - case TYPE_RAMSTEIN: - return Encounter[4]; - case TYPE_BARON: - return Encounter[5]; - } - return 0; - } - - uint64 GetData64(uint32 data) - { - switch(data) - { - case DATA_BARON: - return baronGUID; - case DATA_YSIDA_TRIGGER: - return ysidaTriggerGUID; - } - return 0; - } - - void Update(uint32 diff) - { - if (BaronRun_Timer) - { - if (BaronRun_Timer <= diff) - { - if (GetData(TYPE_BARON_RUN) != DONE) - SetData(TYPE_BARON_RUN, FAIL); - BaronRun_Timer = 0; - sLog.outDebug("TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); - } else BaronRun_Timer -= diff; - } - - if (SlaugtherSquare_Timer) - { - if (SlaugtherSquare_Timer <= diff) - { - if (Creature* pBaron = instance->GetCreature(baronGUID)) + if (data == DONE) { - for (uint8 i = 0; i < 4; ++i) - pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + SlaugtherSquare_Timer = 300000; + sLog.outDebug("TSCR: Instance Stratholme: Slaugther event will continue in 5 minutes."); + } + Encounter[4] = data; + break; + case TYPE_BARON: + if (data == IN_PROGRESS) + { + HandleGameObject(ziggurat4GUID, false); + HandleGameObject(ziggurat5GUID, false); + if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) + { + Map::PlayerList const& players = instance->GetPlayers(); + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + { + if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) + pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); + + if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); + } + } + } + + SetData(TYPE_BARON_RUN,DONE); + } + } + if (data == DONE || data == NOT_STARTED) + { HandleGameObject(ziggurat4GUID, true); HandleGameObject(ziggurat5GUID, true); - sLog.outDebug("TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); } - SlaugtherSquare_Timer = 0; - } else SlaugtherSquare_Timer -= diff; + if (data == DONE) + HandleGameObject(portGauntletGUID, true); + Encounter[5] = data; + break; + case TYPE_SH_AELMAR: + IsSilverHandDead[0] = (data) ? true : false; + break; + case TYPE_SH_CATHELA: + IsSilverHandDead[1] = (data) ? true : false; + break; + case TYPE_SH_GREGOR: + IsSilverHandDead[2] = (data) ? true : false; + break; + case TYPE_SH_NEMAS: + IsSilverHandDead[3] = (data) ? true : false; + break; + case TYPE_SH_VICAR: + IsSilverHandDead[4] = (data) ? true : false; + break; + } + if (data == DONE)SaveToDB(); } - } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << Encounter[0] << " " << Encounter[1] << " " << Encounter[2] << " " + << Encounter[3] << " " << Encounter[4] << " " << Encounter[5]; + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3] + >> Encounter[4] >> Encounter[5]; + + // Do not reset 1, 2 and 3. they are not set to done, yet . + if (Encounter[0] == IN_PROGRESS) + Encounter[0] = NOT_STARTED; + if (Encounter[4] == IN_PROGRESS) + Encounter[4] = NOT_STARTED; + if (Encounter[5] == IN_PROGRESS) + Encounter[5] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_SH_QUEST: + if (IsSilverHandDead[0] && IsSilverHandDead[1] && IsSilverHandDead[2] && IsSilverHandDead[3] && IsSilverHandDead[4]) + return 1; + return 0; + case TYPE_BARON_RUN: + return Encounter[0]; + case TYPE_BARONESS: + return Encounter[1]; + case TYPE_NERUB: + return Encounter[2]; + case TYPE_PALLID: + return Encounter[3]; + case TYPE_RAMSTEIN: + return Encounter[4]; + case TYPE_BARON: + return Encounter[5]; + } + return 0; + } + + uint64 GetData64(uint32 data) + { + switch(data) + { + case DATA_BARON: + return baronGUID; + case DATA_YSIDA_TRIGGER: + return ysidaTriggerGUID; + } + return 0; + } + + void Update(uint32 diff) + { + if (BaronRun_Timer) + { + if (BaronRun_Timer <= diff) + { + if (GetData(TYPE_BARON_RUN) != DONE) + SetData(TYPE_BARON_RUN, FAIL); + BaronRun_Timer = 0; + sLog.outDebug("TSCR: Instance Stratholme: Baron run event reached end. Event has state %u.",GetData(TYPE_BARON_RUN)); + } else BaronRun_Timer -= diff; + } + + if (SlaugtherSquare_Timer) + { + if (SlaugtherSquare_Timer <= diff) + { + if (Creature* pBaron = instance->GetCreature(baronGUID)) + { + for (uint8 i = 0; i < 4; ++i) + pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); + + HandleGameObject(ziggurat4GUID, true); + HandleGameObject(ziggurat5GUID, true); + sLog.outDebug("TSCR: Instance Stratholme: Black guard sentries spawned. Opening gates to baron."); + } + SlaugtherSquare_Timer = 0; + } else SlaugtherSquare_Timer -= diff; + } + } + }; + }; -InstanceData* GetInstanceData_instance_stratholme(Map* pMap) -{ - return new instance_stratholme(pMap); -} void AddSC_instance_stratholme() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_stratholme"; - newscript->GetInstanceData = &GetInstanceData_instance_stratholme; - newscript->RegisterSelf(); + new instance_stratholme(); } - diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index ed87b7fdccb..dfb691fa65d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -36,38 +36,44 @@ EndContentData */ /*###### ## go_gauntlet_gate (this is the _first_ of the gauntlet gates, two exist) ######*/ - -bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) + class go_gauntlet_gate : public GameObjectScript { - ScriptedInstance* pInstance = pGo->GetInstanceData(); +public: + go_gauntlet_gate() : GameObjectScript("go_gauntlet_gate") { } - if (!pInstance) - return false; - - if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) - return false; - - if (Group *pGroup = pPlayer->GetGroup()) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + InstanceScript* pInstance = pGo->GetInstanceScript(); + + if (!pInstance) + return false; + + if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) + return false; + + if (Group *pGroup = pPlayer->GetGroup()) { - Player* pGroupie = itr->getSource(); - if (!pGroupie) - continue; + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player* pGroupie = itr->getSource(); + if (!pGroupie) + continue; - if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && - !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) && - pGroupie->GetMap() == pGo->GetMap()) - pGroupie->CastSpell(pGroupie,SPELL_BARON_ULTIMATUM,true); - } - } else if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && - !pPlayer->HasAura(SPELL_BARON_ULTIMATUM) && - pPlayer->GetMap() == pGo->GetMap()) - pPlayer->CastSpell(pPlayer,SPELL_BARON_ULTIMATUM,true); + if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && + !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) && + pGroupie->GetMap() == pGo->GetMap()) + pGroupie->CastSpell(pGroupie,SPELL_BARON_ULTIMATUM,true); + } + } else if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE && + !pPlayer->HasAura(SPELL_BARON_ULTIMATUM) && + pPlayer->GetMap() == pGo->GetMap()) + pPlayer->CastSpell(pPlayer,SPELL_BARON_ULTIMATUM,true); - pInstance->SetData(TYPE_BARON_RUN,IN_PROGRESS); - return false; -} + pInstance->SetData(TYPE_BARON_RUN,IN_PROGRESS); + return false; + } + +}; /*###### ## mob_freed_soul @@ -78,23 +84,30 @@ bool GOHello_go_gauntlet_gate(Player* pPlayer, GameObject* pGo) #define SAY_ZAPPED1 -1329001 #define SAY_ZAPPED2 -1329002 #define SAY_ZAPPED3 -1329003 - -struct mob_freed_soulAI : public ScriptedAI + class mob_freed_soul : public CreatureScript { - mob_freed_soulAI(Creature *c) : ScriptedAI(c) {} +public: + mob_freed_soul() : CreatureScript("mob_freed_soul") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), me); + return new mob_freed_soulAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} + struct mob_freed_soulAI : public ScriptedAI + { + mob_freed_soulAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + DoScriptText(RAND(SAY_ZAPPED0,SAY_ZAPPED1,SAY_ZAPPED2,SAY_ZAPPED3), me); + } + + void EnterCombat(Unit* /*who*/) {} + }; + }; -CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) -{ - return new mob_freed_soulAI (pCreature); -} /*###### ## mob_restless_soul @@ -105,67 +118,74 @@ CreatureAI* GetAI_mob_freed_soul(Creature* pCreature) #define QUEST_RESTLESS_SOUL 5282 #define ENTRY_RESTLESS 11122 #define ENTRY_FREED 11136 - -struct mob_restless_soulAI : public ScriptedAI + class mob_restless_soul : public CreatureScript { - mob_restless_soulAI(Creature *c) : ScriptedAI(c) {} +public: + mob_restless_soul() : CreatureScript("mob_restless_soul") { } - uint64 Tagger; - uint32 Die_Timer; - bool Tagged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Tagger = 0; - Die_Timer = 5000; - Tagged = false; + return new mob_restless_soulAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit *caster, const SpellEntry *spell) + struct mob_restless_soulAI : public ScriptedAI { - if (caster->GetTypeId() == TYPEID_PLAYER) + mob_restless_soulAI(Creature *c) : ScriptedAI(c) {} + + uint64 Tagger; + uint32 Die_Timer; + bool Tagged; + + void Reset() { - if (!Tagged && spell->Id == SPELL_EGAN_BLASTER && CAST_PLR(caster)->GetQuestStatus(QUEST_RESTLESS_SOUL) == QUEST_STATUS_INCOMPLETE) + Tagger = 0; + Die_Timer = 5000; + Tagged = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (caster->GetTypeId() == TYPEID_PLAYER) { - Tagged = true; - Tagger = caster->GetGUID(); + if (!Tagged && spell->Id == SPELL_EGAN_BLASTER && CAST_PLR(caster)->GetQuestStatus(QUEST_RESTLESS_SOUL) == QUEST_STATUS_INCOMPLETE) + { + Tagged = true; + Tagger = caster->GetGUID(); + } } } - } - void JustSummoned(Creature *summoned) - { - summoned->CastSpell(summoned,SPELL_SOUL_FREED,false); - } - - void JustDied(Unit* /*Killer*/) - { - if (Tagged) - me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000); - } - - void UpdateAI(const uint32 diff) - { - if (Tagged) + void JustSummoned(Creature *summoned) { - if (Die_Timer <= diff) - { - if (Unit* pTemp = Unit::GetUnit(*me,Tagger)) - { - CAST_PLR(pTemp)->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID()); - me->Kill(me); - } - } else Die_Timer -= diff; + summoned->CastSpell(summoned,SPELL_SOUL_FREED,false); } - } + + void JustDied(Unit* /*Killer*/) + { + if (Tagged) + me->SummonCreature(ENTRY_FREED, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 300000); + } + + void UpdateAI(const uint32 diff) + { + if (Tagged) + { + if (Die_Timer <= diff) + { + if (Unit* pTemp = Unit::GetUnit(*me,Tagger)) + { + CAST_PLR(pTemp)->KilledMonsterCredit(ENTRY_RESTLESS, me->GetGUID()); + me->Kill(me); + } + } else Die_Timer -= diff; + } + } + }; + }; -CreatureAI* GetAI_mob_restless_soul(Creature* pCreature) -{ - return new mob_restless_soulAI (pCreature); -} /*###### ## mobs_spectral_ghostly_citizen @@ -176,109 +196,98 @@ enum eGhostlyCitizenSpells SPELL_HAUNTING_PHANTOM = 16336, SPELL_SLAP = 6754 }; - -struct mobs_spectral_ghostly_citizenAI : public ScriptedAI + class mobs_spectral_ghostly_citizen : public CreatureScript { - mobs_spectral_ghostly_citizenAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_spectral_ghostly_citizen() : CreatureScript("mobs_spectral_ghostly_citizen") { } - uint32 Die_Timer; - bool Tagged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Die_Timer = 5000; - Tagged = false; + return new mobs_spectral_ghostly_citizenAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + struct mobs_spectral_ghostly_citizenAI : public ScriptedAI { - if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) - Tagged = true; - } + mobs_spectral_ghostly_citizenAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*Killer*/) - { - if (Tagged) + uint32 Die_Timer; + bool Tagged; + + void Reset() { - for (uint32 i = 1; i <= 4; ++i) + Die_Timer = 5000; + Tagged = false; + } + + void EnterCombat(Unit* /*who*/) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) + Tagged = true; + } + + void JustDied(Unit* /*Killer*/) + { + if (Tagged) { - //100%, 50%, 33%, 25% chance to spawn - if (urand(1,i) == 1) - DoSummon(ENTRY_RESTLESS, me, 20.0f, 600000); + for (uint32 i = 1; i <= 4; ++i) + { + //100%, 50%, 33%, 25% chance to spawn + if (urand(1,i) == 1) + DoSummon(ENTRY_RESTLESS, me, 20.0f, 600000); + } } } - } - void UpdateAI(const uint32 diff) - { - if (Tagged) + void UpdateAI(const uint32 diff) { - if (Die_Timer <= diff) - me->Kill(me); - else Die_Timer -= diff; + if (Tagged) + { + if (Die_Timer <= diff) + me->Kill(me); + else Die_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - switch(emote) + void ReceiveEmote(Player* pPlayer, uint32 emote) { - case TEXTEMOTE_DANCE: - EnterEvadeMode(); - break; - case TEXTEMOTE_RUDE: - if (me->IsWithinDistInMap(pPlayer, 5)) - DoCast(pPlayer, SPELL_SLAP, false); - else - me->HandleEmoteCommand(EMOTE_ONESHOT_RUDE); - break; - case TEXTEMOTE_WAVE: - me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - break; - case TEXTEMOTE_BOW: - me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); - break; - case TEXTEMOTE_KISS: - me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); - break; + switch(emote) + { + case TEXTEMOTE_DANCE: + EnterEvadeMode(); + break; + case TEXTEMOTE_RUDE: + if (me->IsWithinDistInMap(pPlayer, 5)) + DoCast(pPlayer, SPELL_SLAP, false); + else + me->HandleEmoteCommand(EMOTE_ONESHOT_RUDE); + break; + case TEXTEMOTE_WAVE: + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + break; + case TEXTEMOTE_BOW: + me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); + break; + case TEXTEMOTE_KISS: + me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); + break; + } } - } + }; + }; -CreatureAI* GetAI_mobs_spectral_ghostly_citizen(Creature* pCreature) -{ - return new mobs_spectral_ghostly_citizenAI (pCreature); -} void AddSC_stratholme() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_gauntlet_gate"; - newscript->pGOHello = &GOHello_go_gauntlet_gate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_freed_soul"; - newscript->GetAI = &GetAI_mob_freed_soul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_restless_soul"; - newscript->GetAI = &GetAI_mob_restless_soul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mobs_spectral_ghostly_citizen"; - newscript->GetAI = &GetAI_mobs_spectral_ghostly_citizen; - newscript->RegisterSelf(); + new go_gauntlet_gate(); + new mob_freed_soul(); + new mob_restless_soul(); + new mobs_spectral_ghostly_citizen(); } - diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index 99c018161dc..554d5f45dc7 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -38,169 +38,172 @@ EndScriptData */ #define GO_ATALAI_LIGHT2 148937 #define NPC_MALFURION_STORMRAGE 15362 - -struct instance_sunken_temple : public ScriptedInstance + class instance_sunken_temple : public InstanceMapScript { - instance_sunken_temple(Map* pMap) : ScriptedInstance(pMap) +public: + instance_sunken_temple() : InstanceMapScript("instance_sunken_temple") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - Initialize(); + return new instance_sunken_temple_InstanceMapScript(pMap); + } + + struct instance_sunken_temple_InstanceMapScript : public InstanceScript + { + instance_sunken_temple_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + Initialize(); + }; + + uint64 GOAtalaiStatue1; + uint64 GOAtalaiStatue2; + uint64 GOAtalaiStatue3; + uint64 GOAtalaiStatue4; + uint64 GOAtalaiStatue5; + uint64 GOAtalaiStatue6; + uint64 GOAtalaiIdol; + + uint32 State; + + bool s1; + bool s2; + bool s3; + bool s4; + bool s5; + bool s6; + + void Initialize() + { + GOAtalaiStatue1 = 0; + GOAtalaiStatue2 = 0; + GOAtalaiStatue3 = 0; + GOAtalaiStatue4 = 0; + GOAtalaiStatue5 = 0; + GOAtalaiStatue6 = 0; + GOAtalaiIdol = 0; + + State = 0; + + s1 = false; + s2 = false; + s3 = false; + s4 = false; + s5 = false; + s6 = false; + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_ATALAI_STATUE1: GOAtalaiStatue1 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE2: GOAtalaiStatue2 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE3: GOAtalaiStatue3 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE4: GOAtalaiStatue4 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE5: GOAtalaiStatue5 = pGo->GetGUID(); break; + case GO_ATALAI_STATUE6: GOAtalaiStatue6 = pGo->GetGUID(); break; + case GO_ATALAI_IDOL: GOAtalaiIdol = pGo->GetGUID(); break; + } + } + + virtual void Update(uint32 /*diff*/) // correct order goes form 1-6 + { + switch(State) + { + case GO_ATALAI_STATUE1: + if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue1 = instance->GetGameObject(GOAtalaiStatue1)) + UseStatue(pAtalaiStatue1); + s1 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE2: + if (s1 && !s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue2 = instance->GetGameObject(GOAtalaiStatue2)) + UseStatue(pAtalaiStatue2); + s2 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE3: + if (s1 && s2 && !s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue3 = instance->GetGameObject(GOAtalaiStatue3)) + UseStatue(pAtalaiStatue3); + s3 = true; + State = 0; + }; + break; + case GO_ATALAI_STATUE4: + if (s1 && s2 && s3 && !s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue4 = instance->GetGameObject(GOAtalaiStatue4)) + UseStatue(pAtalaiStatue4); + s4 = true; + State = 0; + } + break; + case GO_ATALAI_STATUE5: + if (s1 && s2 && s3 && s4 && !s5 && !s6) + { + if (GameObject *pAtalaiStatue5 = instance->GetGameObject(GOAtalaiStatue5)) + UseStatue(pAtalaiStatue5); + s5 = true; + State = 0; + } + break; + case GO_ATALAI_STATUE6: + if (s1 && s2 && s3 && s4 && s5 && !s6) + { + if (GameObject *pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6)) + UseStatue(pAtalaiStatue6); + s6 = true; + State = 0; + } + break; + } + }; + + void UseStatue(GameObject* pGo) + { + pGo->SummonGameObject(GO_ATALAI_LIGHT1,pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ(),0,0,0,0,0,0); + pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 4); + } + + /* + void UseLastStatue(GameObject* pGo) + { + AtalaiStatue1->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue1->GetPositionX(),AtalaiStatue1->GetPositionY(),AtalaiStatue1->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue2->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue2->GetPositionX(),AtalaiStatue2->GetPositionY(),AtalaiStatue2->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue3->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue3->GetPositionX(),AtalaiStatue3->GetPositionY(),AtalaiStatue3->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue4->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue4->GetPositionX(),AtalaiStatue4->GetPositionY(),AtalaiStatue4->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue5->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue5->GetPositionX(),AtalaiStatue5->GetPositionY(),AtalaiStatue5->GetPositionZ(),0,0,0,0,0,100000); + AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue6->GetPositionX(),AtalaiStatue6->GetPositionY(),AtalaiStatue6->GetPositionZ(),0,0,0,0,0,100000); + pGo->SummonGameObject(148838,-488.997,96.61,-189.019,-1.52,0,0,0,0,100000); + } + */ + + void SetData(uint32 type, uint32 data) + { + if (type == EVENT_STATE) + State = data; + } + + uint32 GetData(uint32 type) + { + if (type == EVENT_STATE) + return State; + return 0; + } }; - uint64 GOAtalaiStatue1; - uint64 GOAtalaiStatue2; - uint64 GOAtalaiStatue3; - uint64 GOAtalaiStatue4; - uint64 GOAtalaiStatue5; - uint64 GOAtalaiStatue6; - uint64 GOAtalaiIdol; - - uint32 State; - - bool s1; - bool s2; - bool s3; - bool s4; - bool s5; - bool s6; - - void Initialize() - { - GOAtalaiStatue1 = 0; - GOAtalaiStatue2 = 0; - GOAtalaiStatue3 = 0; - GOAtalaiStatue4 = 0; - GOAtalaiStatue5 = 0; - GOAtalaiStatue6 = 0; - GOAtalaiIdol = 0; - - State = 0; - - s1 = false; - s2 = false; - s3 = false; - s4 = false; - s5 = false; - s6 = false; - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_ATALAI_STATUE1: GOAtalaiStatue1 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE2: GOAtalaiStatue2 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE3: GOAtalaiStatue3 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE4: GOAtalaiStatue4 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE5: GOAtalaiStatue5 = pGo->GetGUID(); break; - case GO_ATALAI_STATUE6: GOAtalaiStatue6 = pGo->GetGUID(); break; - case GO_ATALAI_IDOL: GOAtalaiIdol = pGo->GetGUID(); break; - } - } - - virtual void Update(uint32 /*diff*/) // correct order goes form 1-6 - { - switch(State) - { - case GO_ATALAI_STATUE1: - if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue1 = instance->GetGameObject(GOAtalaiStatue1)) - UseStatue(pAtalaiStatue1); - s1 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE2: - if (s1 && !s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue2 = instance->GetGameObject(GOAtalaiStatue2)) - UseStatue(pAtalaiStatue2); - s2 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE3: - if (s1 && s2 && !s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue3 = instance->GetGameObject(GOAtalaiStatue3)) - UseStatue(pAtalaiStatue3); - s3 = true; - State = 0; - }; - break; - case GO_ATALAI_STATUE4: - if (s1 && s2 && s3 && !s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue4 = instance->GetGameObject(GOAtalaiStatue4)) - UseStatue(pAtalaiStatue4); - s4 = true; - State = 0; - } - break; - case GO_ATALAI_STATUE5: - if (s1 && s2 && s3 && s4 && !s5 && !s6) - { - if (GameObject *pAtalaiStatue5 = instance->GetGameObject(GOAtalaiStatue5)) - UseStatue(pAtalaiStatue5); - s5 = true; - State = 0; - } - break; - case GO_ATALAI_STATUE6: - if (s1 && s2 && s3 && s4 && s5 && !s6) - { - if (GameObject *pAtalaiStatue6 = instance->GetGameObject(GOAtalaiStatue6)) - UseStatue(pAtalaiStatue6); - s6 = true; - State = 0; - } - break; - } - }; - - void UseStatue(GameObject* pGo) - { - pGo->SummonGameObject(GO_ATALAI_LIGHT1,pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ(),0,0,0,0,0,0); - pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 4); - } - - /* - void UseLastStatue(GameObject* pGo) - { - AtalaiStatue1->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue1->GetPositionX(),AtalaiStatue1->GetPositionY(),AtalaiStatue1->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue2->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue2->GetPositionX(),AtalaiStatue2->GetPositionY(),AtalaiStatue2->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue3->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue3->GetPositionX(),AtalaiStatue3->GetPositionY(),AtalaiStatue3->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue4->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue4->GetPositionX(),AtalaiStatue4->GetPositionY(),AtalaiStatue4->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue5->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue5->GetPositionX(),AtalaiStatue5->GetPositionY(),AtalaiStatue5->GetPositionZ(),0,0,0,0,0,100000); - AtalaiStatue6->SummonGameObject(GO_ATALAI_LIGHT2,AtalaiStatue6->GetPositionX(),AtalaiStatue6->GetPositionY(),AtalaiStatue6->GetPositionZ(),0,0,0,0,0,100000); - pGo->SummonGameObject(148838,-488.997,96.61,-189.019,-1.52,0,0,0,0,100000); - } - */ - - void SetData(uint32 type, uint32 data) - { - if (type == EVENT_STATE) - State = data; - } - - uint32 GetData(uint32 type) - { - if (type == EVENT_STATE) - return State; - return 0; - } }; -InstanceData* GetInstanceData_instance_sunken_temple(Map* pMap) -{ - return new instance_sunken_temple(pMap); -} void AddSC_instance_sunken_temple() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_sunken_temple"; - newscript->GetInstanceData = &GetInstanceData_instance_sunken_temple; - newscript->RegisterSelf(); + new instance_sunken_temple(); } diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index ca49cac4908..98bb24cbf6c 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -33,41 +33,44 @@ EndContentData */ /*##### # at_malfurion_Stormrage_trigger #####*/ - -bool AreaTrigger_at_malfurion_stormrage(Player* pPlayer, const AreaTriggerEntry * /*at*/) + class at_malfurion_stormrage : public AreaTriggerScript { - if (ScriptedInstance* pInstance = pPlayer->GetInstanceData()) +public: + at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (!pPlayer->FindNearestCreature(15362,15)) - pPlayer->SummonCreature(15362, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), -1.52, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100000); - return false; + if (InstanceScript* pInstance = pPlayer->GetInstanceScript()) + { + if (!pPlayer->FindNearestCreature(15362,15)) + pPlayer->SummonCreature(15362, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), -1.52, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100000); + return false; + } + return false; } -return false; -} + +}; /*##### # go_atalai_statue #####*/ - -bool GOHello_go_atalai_statue(Player* pPlayer, GameObject* pGo) + class go_atalai_statue : public GameObjectScript { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (!pInstance) +public: + go_atalai_statue() : GameObjectScript("go_atalai_statue") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (!pInstance) + return false; + pInstance->SetData(EVENT_STATE,pGo->GetEntry()); return false; - pInstance->SetData(EVENT_STATE,pGo->GetEntry()); - return false; -} + } + +}; void AddSC_sunken_temple() { - Script *newscript; - - newscript = new Script; - newscript->Name = "at_malfurion_stormrage"; - newscript->pAreaTrigger = &AreaTrigger_at_malfurion_stormrage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_atalai_statue"; - newscript->pGOHello = &GOHello_go_atalai_statue; - newscript->RegisterSelf(); + new at_malfurion_stormrage(); + new go_atalai_statue(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index 5aa1daaad77..ad773f070a7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -65,287 +65,289 @@ enum Spells }; #define FELMYST 25038 - -struct boss_brutallusAI : public ScriptedAI + class boss_brutallus : public CreatureScript { - boss_brutallusAI(Creature *c) : ScriptedAI(c) +public: + boss_brutallus() : CreatureScript("boss_brutallus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Intro = true; + return new boss_brutallusAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 SlashTimer; - uint32 BurnTimer; - uint32 StompTimer; - uint32 BerserkTimer; - - uint32 IntroPhase; - uint32 IntroPhaseTimer; - uint32 IntroFrostBoltTimer; - - bool Intro; - bool IsIntro; - bool Enraged; - - void Reset() + struct boss_brutallusAI : public ScriptedAI { - SlashTimer = 11000; - StompTimer = 30000; - BurnTimer = 60000; - BerserkTimer = 360000; - - IntroPhase = 0; - IntroPhaseTimer = 0; - IntroFrostBoltTimer = 0; - - IsIntro = false; - Enraged = false; - - DoCast(me, SPELL_DUAL_WIELD, true); - - if (pInstance) - pInstance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(YELL_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(YELL_KILL1,YELL_KILL2,YELL_KILL3), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(YELL_DEATH, me); - - if (pInstance) + boss_brutallusAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_BRUTALLUS_EVENT, DONE); - float x,y,z; - me->GetPosition(x,y,z); - me->SummonCreature(FELMYST, x,y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); + pInstance = c->GetInstanceScript(); + Intro = true; } - } - void EnterEvadeMode() - { - if (!Intro) - ScriptedAI::EnterEvadeMode(); - } + InstanceScript* pInstance; - void StartIntro() - { - if (!Intro || IsIntro) - return; - sLog.outError("Start Intro"); - Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); - if (Madrigosa) + uint32 SlashTimer; + uint32 BurnTimer; + uint32 StompTimer; + uint32 BerserkTimer; + + uint32 IntroPhase; + uint32 IntroPhaseTimer; + uint32 IntroFrostBoltTimer; + + bool Intro; + bool IsIntro; + bool Enraged; + + void Reset() { - Madrigosa->Respawn(); - Madrigosa->setActive(true); - IsIntro = true; - Madrigosa->SetMaxHealth(me->GetMaxHealth()); - Madrigosa->SetHealth(me->GetMaxHealth()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->Attack(Madrigosa, true); - Madrigosa->Attack(me, true); - }else - { - //Madrigosa not found, end intro - sLog.outError("Madrigosa was not found"); - EndIntro(); + SlashTimer = 11000; + StompTimer = 30000; + BurnTimer = 60000; + BerserkTimer = 360000; + + IntroPhase = 0; + IntroPhaseTimer = 0; + IntroFrostBoltTimer = 0; + + IsIntro = false; + Enraged = false; + + DoCast(me, SPELL_DUAL_WIELD, true); + + if (pInstance) + pInstance->SetData(DATA_BRUTALLUS_EVENT, NOT_STARTED); } - } - void EndIntro() - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Intro = false; - IsIntro = false; - sLog.outError("End Intro"); - } - - void AttackStart(Unit* pWho) - { - if (!pWho || Intro || IsIntro) - return; - ScriptedAI::AttackStart(pWho); - } - - void DoIntro() - { - Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); - if (!Madrigosa) - return; - - switch (IntroPhase) + void EnterCombat(Unit * /*who*/) { - case 0: - DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); - IntroPhaseTimer = 7000; - ++IntroPhase; - break; - case 1: - me->SetInFront(Madrigosa); - Madrigosa->SetInFront(me); - DoScriptText(YELL_MADR_INTRO, Madrigosa, me); - IntroPhaseTimer = 9000; - ++IntroPhase; - break; - case 2: - DoScriptText(YELL_INTRO, me, Madrigosa); - IntroPhaseTimer = 13000; - ++IntroPhase; - break; - case 3: - DoCast(me, SPELL_INTRO_FROST_BLAST); - Madrigosa->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->AttackStop(); - Madrigosa->AttackStop(); - IntroFrostBoltTimer = 3000; - IntroPhaseTimer = 28000; - ++IntroPhase; - break; - case 4: - DoScriptText(YELL_INTRO_BREAK_ICE, me); - IntroPhaseTimer = 6000; - ++IntroPhase; - break; - case 5: - Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); - DoScriptText(YELL_MADR_TRAP, Madrigosa); - DoCast(me, SPELL_INTRO_ENCAPSULATE); - IntroPhaseTimer = 11000; - ++IntroPhase; - break; - case 6: - DoScriptText(YELL_INTRO_CHARGE, me); - IntroPhaseTimer = 5000; - ++IntroPhase; - break; - case 7: - me->Kill(Madrigosa); - DoScriptText(YELL_MADR_DEATH, Madrigosa); - me->SetHealth(me->GetMaxHealth()); - me->AttackStop(); - IntroPhaseTimer = 4000; - ++IntroPhase; - break; - case 8: - DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); - me->SetOrientation(0.14f); - me->StopMoving(); - Madrigosa->setDeathState(CORPSE); - IntroPhaseTimer = 8000; - ++IntroPhase; - break; - case 9: - DoScriptText(YELL_INTRO_TAUNT, me); - IntroPhaseTimer = 5000; - ++IntroPhase; - break; - case 10: - EndIntro(); - break; + DoScriptText(YELL_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_BRUTALLUS_EVENT, IN_PROGRESS); } - } - void MoveInLineOfSight(Unit *who) - { - if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) - return; - if (pInstance && Intro) - pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); - - if (Intro && !IsIntro) - StartIntro(); - if (!Intro) - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - if (IsIntro) + void KilledUnit(Unit* /*victim*/) { - if (IntroPhaseTimer <= diff) - DoIntro(); - else IntroPhaseTimer -= diff; + DoScriptText(RAND(YELL_KILL1,YELL_KILL2,YELL_KILL3), me); + } - if (IntroPhase == 3 + 1) + void JustDied(Unit* /*Killer*/) + { + DoScriptText(YELL_DEATH, me); + + if (pInstance) { - if (IntroFrostBoltTimer <= diff) - { - if (Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0)) - { - Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); - IntroFrostBoltTimer = 2000; - } - } else IntroFrostBoltTimer -= diff; + pInstance->SetData(DATA_BRUTALLUS_EVENT, DONE); + float x,y,z; + me->GetPosition(x,y,z); + me->SummonCreature(FELMYST, x,y, z+30, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0); } - if (!UpdateVictim()) + } + + void EnterEvadeMode() + { + if (!Intro) + ScriptedAI::EnterEvadeMode(); + } + + void StartIntro() + { + if (!Intro || IsIntro) return; + sLog.outError("Start Intro"); + Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); + if (Madrigosa) + { + Madrigosa->Respawn(); + Madrigosa->setActive(true); + IsIntro = true; + Madrigosa->SetMaxHealth(me->GetMaxHealth()); + Madrigosa->SetHealth(me->GetMaxHealth()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->Attack(Madrigosa, true); + Madrigosa->Attack(me, true); + }else + { + //Madrigosa not found, end intro + sLog.outError("Madrigosa was not found"); + EndIntro(); + } + } + + void EndIntro() + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Intro = false; + IsIntro = false; + sLog.outError("End Intro"); + } + + void AttackStart(Unit* pWho) + { + if (!pWho || Intro || IsIntro) + return; + ScriptedAI::AttackStart(pWho); + } + + void DoIntro() + { + Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0); + if (!Madrigosa) + return; + + switch (IntroPhase) + { + case 0: + DoScriptText(YELL_MADR_ICE_BARRIER, Madrigosa); + IntroPhaseTimer = 7000; + ++IntroPhase; + break; + case 1: + me->SetInFront(Madrigosa); + Madrigosa->SetInFront(me); + DoScriptText(YELL_MADR_INTRO, Madrigosa, me); + IntroPhaseTimer = 9000; + ++IntroPhase; + break; + case 2: + DoScriptText(YELL_INTRO, me, Madrigosa); + IntroPhaseTimer = 13000; + ++IntroPhase; + break; + case 3: + DoCast(me, SPELL_INTRO_FROST_BLAST); + Madrigosa->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->AttackStop(); + Madrigosa->AttackStop(); + IntroFrostBoltTimer = 3000; + IntroPhaseTimer = 28000; + ++IntroPhase; + break; + case 4: + DoScriptText(YELL_INTRO_BREAK_ICE, me); + IntroPhaseTimer = 6000; + ++IntroPhase; + break; + case 5: + Madrigosa->CastSpell(me, SPELL_INTRO_ENCAPSULATE_CHANELLING, false); + DoScriptText(YELL_MADR_TRAP, Madrigosa); + DoCast(me, SPELL_INTRO_ENCAPSULATE); + IntroPhaseTimer = 11000; + ++IntroPhase; + break; + case 6: + DoScriptText(YELL_INTRO_CHARGE, me); + IntroPhaseTimer = 5000; + ++IntroPhase; + break; + case 7: + me->Kill(Madrigosa); + DoScriptText(YELL_MADR_DEATH, Madrigosa); + me->SetHealth(me->GetMaxHealth()); + me->AttackStop(); + IntroPhaseTimer = 4000; + ++IntroPhase; + break; + case 8: + DoScriptText(YELL_INTRO_KILL_MADRIGOSA, me); + me->SetOrientation(0.14f); + me->StopMoving(); + Madrigosa->setDeathState(CORPSE); + IntroPhaseTimer = 8000; + ++IntroPhase; + break; + case 9: + DoScriptText(YELL_INTRO_TAUNT, me); + IntroPhaseTimer = 5000; + ++IntroPhase; + break; + case 10: + EndIntro(); + break; + } + } + + void MoveInLineOfSight(Unit *who) + { + if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) + return; + if (pInstance && Intro) + pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); + + if (Intro && !IsIntro) + StartIntro(); + if (!Intro) + ScriptedAI::MoveInLineOfSight(who); + } + + void UpdateAI(const uint32 diff) + { + if (IsIntro) + { + if (IntroPhaseTimer <= diff) + DoIntro(); + else IntroPhaseTimer -= diff; + + if (IntroPhase == 3 + 1) + { + if (IntroFrostBoltTimer <= diff) + { + if (Creature *Madrigosa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_MADRIGOSA) : 0)) + { + Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true); + IntroFrostBoltTimer = 2000; + } + } else IntroFrostBoltTimer -= diff; + } + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + + if (!UpdateVictim() || IsIntro) + return; + + if (SlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_METEOR_SLASH); + SlashTimer = 11000; + } else SlashTimer -= diff; + + if (StompTimer <= diff) + { + DoScriptText(RAND(YELL_LOVE1,YELL_LOVE2,YELL_LOVE3), me); + DoCast(me->getVictim(), SPELL_STOMP); + StompTimer = 30000; + } else StompTimer -= diff; + + if (BurnTimer <= diff) + { + std::list pTargets; + SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true); + for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) + if (!(*i)->HasAura(SPELL_BURN)) + { + (*i)->CastSpell((*i), SPELL_BURN, true); + break; + } + BurnTimer = urand(60000,180000); + } else BurnTimer -= diff; + + if (BerserkTimer < diff && !Enraged) + { + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK); + Enraged = true; + } else BerserkTimer -= diff; + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim() || IsIntro) - return; - - if (SlashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_METEOR_SLASH); - SlashTimer = 11000; - } else SlashTimer -= diff; - - if (StompTimer <= diff) - { - DoScriptText(RAND(YELL_LOVE1,YELL_LOVE2,YELL_LOVE3), me); - DoCast(me->getVictim(), SPELL_STOMP); - StompTimer = 30000; - } else StompTimer -= diff; - - if (BurnTimer <= diff) - { - std::list pTargets; - SelectTargetList(pTargets, 10, SELECT_TARGET_RANDOM, 100, true); - for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) - if (!(*i)->HasAura(SPELL_BURN)) - { - (*i)->CastSpell((*i), SPELL_BURN, true); - break; - } - BurnTimer = urand(60000,180000); - } else BurnTimer -= diff; - - if (BerserkTimer < diff && !Enraged) - { - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK); - Enraged = true; - } else BerserkTimer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_brutallus(Creature* pCreature) -{ - return new boss_brutallusAI (pCreature); -} void AddSC_boss_brutallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_brutallus"; - newscript->GetAI = &GetAI_boss_brutallus; - newscript->RegisterSelf(); + new boss_brutallus(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index 6ce5b933d6a..9851c9d919a 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -84,680 +84,688 @@ enum Spells SPELL_BLAZE_SUMMON = 45236, //187366 GO SPELL_BLAZE_BURN = 45246 }; - -struct boss_sacrolashAI : public ScriptedAI + class boss_sacrolash : public CreatureScript { - boss_sacrolashAI(Creature *c) : ScriptedAI(c) +public: + boss_sacrolash() : CreatureScript("boss_sacrolash") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - } + return new boss_sacrolashAI (pCreature); + }; - ScriptedInstance *pInstance; - - bool SisterDeath; - bool Enraged; - - uint32 ShadowbladesTimer; - uint32 ShadownovaTimer; - uint32 ConfoundingblowTimer; - uint32 ShadowimageTimer; - uint32 ConflagrationTimer; - uint32 EnrageTimer; - - void Reset() + struct boss_sacrolashAI : public ScriptedAI { - Enraged = false; - - if (pInstance) + boss_sacrolashAI(Creature *c) : ScriptedAI(c) { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp) - if (Temp->isDead()) - { - CAST_CRE(Temp)->Respawn(); - }else - { - if (Temp->getVictim()) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + bool SisterDeath; + bool Enraged; + + uint32 ShadowbladesTimer; + uint32 ShadownovaTimer; + uint32 ConfoundingblowTimer; + uint32 ShadowimageTimer; + uint32 ConflagrationTimer; + uint32 EnrageTimer; + + void Reset() + { + Enraged = false; + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp) + if (Temp->isDead()) { - me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + CAST_CRE(Temp)->Respawn(); + }else + { + if (Temp->getVictim()) + { + me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + } + } + } + + if (!me->isInCombat()) + { + ShadowbladesTimer = 10000; + ShadownovaTimer = 30000; + ConfoundingblowTimer = 25000; + ShadowimageTimer = 20000; + ConflagrationTimer = 30000; + EnrageTimer = 360000; + + SisterDeath = false; + } + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * who) + { + DoZoneInCombat(); + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp && Temp->isAlive() && !(Temp->getVictim())) + CAST_CRE(Temp)->AI()->AttackStart(who); + } + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + } + + void KilledUnit(Unit * /*victim*/) + { + if (rand()%4 == 0) + DoScriptText(RAND(YELL_SAC_KILL_1,YELL_SAC_KILL_2), me); + } + + void JustDied(Unit* /*Killer*/) + { + // only if ALY death + if (SisterDeath) + { + DoScriptText(SAY_SAC_DEAD, me); + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + } + else + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) + { + switch(spell->Id) + { + case SPELL_SHADOW_BLADES: + case SPELL_SHADOW_NOVA: + case SPELL_CONFOUNDING_BLOW: + case SPELL_SHADOW_FURY: + HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); + break; + case SPELL_CONFLAGRATION: + HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); + break; + } + } + + void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) + { + switch(TouchedType) + { + case SPELL_FLAME_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) + { + if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); + } + break; + case SPELL_DARK_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) + { + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + } + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!SisterDeath) + { + if (pInstance) + { + Unit* Temp = NULL; + Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); + if (Temp && Temp->isDead()) + { + DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; } } - } - - if (!me->isInCombat()) - { - ShadowbladesTimer = 10000; - ShadownovaTimer = 30000; - ConfoundingblowTimer = 25000; - ShadowimageTimer = 20000; - ConflagrationTimer = 30000; - EnrageTimer = 360000; - - SisterDeath = false; - } - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * who) - { - DoZoneInCombat(); - - if (pInstance) - { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp && Temp->isAlive() && !(Temp->getVictim())) - CAST_CRE(Temp)->AI()->AttackStart(who); - } - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - if (rand()%4 == 0) - DoScriptText(RAND(YELL_SAC_KILL_1,YELL_SAC_KILL_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - // only if ALY death - if (SisterDeath) - { - DoScriptText(SAY_SAC_DEAD, me); - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); - } - else - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) - { - case SPELL_SHADOW_BLADES: - case SPELL_SHADOW_NOVA: - case SPELL_CONFOUNDING_BLOW: - case SPELL_SHADOW_FURY: - HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); - break; - case SPELL_CONFLAGRATION: - HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); - break; - } - } - - void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) - { - switch(TouchedType) - { - case SPELL_FLAME_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_DARK_TOUCHED)) - { - pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); } - break; - case SPELL_DARK_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) - { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); - } - break; - } - } - void UpdateAI(const uint32 diff) - { - if (!SisterDeath) - { - if (pInstance) - { - Unit* Temp = NULL; - Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_ALYTHESS)); - if (Temp && Temp->isDead()) - { - DoScriptText(YELL_SISTER_ALYTHESS_DEAD, me); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; - } - } - } + if (!UpdateVictim()) + return; - if (!UpdateVictim()) - return; - - if (SisterDeath) - { - if (ConflagrationTimer <= diff) + if (SisterDeath) { - if (!me->IsNonMeleeSpellCasted(false)) + if (ConflagrationTimer <= diff) { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); - } - } else ConflagrationTimer -= diff; - } - else - { - if (ShadownovaTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_SHADOW_NOVA); - - if (!SisterDeath) + if (!me->IsNonMeleeSpellCasted(false)) { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) - DoScriptText(EMOTE_SHADOW_NOVA, me, pTarget); - DoScriptText(YELL_SHADOW_NOVA, me); + DoCast(pTarget, SPELL_CONFLAGRATION); + ConflagrationTimer = 30000+(rand()%5000); } - ShadownovaTimer = 30000+(rand()%5000); - } - } else ShadownovaTimer -=diff; - } + } else ConflagrationTimer -= diff; + } + else + { + if (ShadownovaTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_SHADOW_NOVA); - if (ConfoundingblowTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (!SisterDeath) + { + if (pTarget) + DoScriptText(EMOTE_SHADOW_NOVA, me, pTarget); + DoScriptText(YELL_SHADOW_NOVA, me); + } + ShadownovaTimer = 30000+(rand()%5000); + } + } else ShadownovaTimer -=diff; + } + + if (ConfoundingblowTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_CONFOUNDING_BLOW); + ConfoundingblowTimer = 20000 + (rand()%5000); + } + } else ConfoundingblowTimer -=diff; + + if (ShadowimageTimer <= diff) { Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_CONFOUNDING_BLOW); - ConfoundingblowTimer = 20000 + (rand()%5000); - } - } else ConfoundingblowTimer -=diff; - - if (ShadowimageTimer <= diff) - { - Unit *pTarget = NULL; - Creature* temp = NULL; - for (uint8 i = 0; i<3; ++i) - { - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); - if (temp && pTarget) + Creature* temp = NULL; + for (uint8 i = 0; i<3; ++i) { - temp->AddThreat(pTarget,1000000);//don't change target(healers) - temp->AI()->AttackStart(pTarget); - } - } - ShadowimageTimer = 20000; - } else ShadowimageTimer -=diff; - - if (ShadowbladesTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me, SPELL_SHADOW_BLADES); - ShadowbladesTimer = 10000; - } - } else ShadowbladesTimer -=diff; - - if (EnrageTimer < diff && !Enraged) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_ENRAGE, me); - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else EnrageTimer -= diff; - - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) - { - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED); - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - } - } -}; - -CreatureAI* GetAI_boss_sacrolash(Creature* pCreature) -{ - return new boss_sacrolashAI (pCreature); -}; - -struct boss_alythessAI : public Scripted_NoMovementAI -{ - boss_alythessAI(Creature *c) : Scripted_NoMovementAI(c) - { - pInstance = c->GetInstanceData(); - IntroStepCounter = 10; - } - - ScriptedInstance *pInstance; - - bool SisterDeath; - bool Enraged; - - uint32 IntroStepCounter; - uint32 IntroYellTimer; - - uint32 ConflagrationTimer; - uint32 BlazeTimer; - uint32 PyrogenicsTimer; - uint32 ShadownovaTimer; - uint32 FlamesearTimer; - uint32 EnrageTimer; - - void Reset() - { - Enraged = false; - - if (pInstance) - { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp) - if (Temp->isDead()) - { - CAST_CRE(Temp)->Respawn(); - }else - { - if (Temp->getVictim()) + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + temp = DoSpawnCreature(MOB_SHADOW_IMAGE,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN,10000); + if (temp && pTarget) { - me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + temp->AddThreat(pTarget,1000000);//don't change target(healers) + temp->AI()->AttackStart(pTarget); } } - } + ShadowimageTimer = 20000; + } else ShadowimageTimer -=diff; - if (!me->isInCombat()) - { - ConflagrationTimer = 45000; - BlazeTimer = 100; - PyrogenicsTimer = 15000; - ShadownovaTimer = 40000; - EnrageTimer = 360000; - FlamesearTimer = 15000; - IntroYellTimer = 10000; - - SisterDeath = false; - } - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * who) - { - DoZoneInCombat(); - - if (pInstance) - { - Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isAlive() && !(Temp->getVictim())) - CAST_CRE(Temp)->AI()->AttackStart(who); - } - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); - } - - void AttackStart(Unit *who) - { - if (!me->isInCombat()) - { - Scripted_NoMovementAI::AttackStart(who); - } - } - - void MoveInLineOfSight(Unit *who) - { - if (!who || me->getVictim()) - return; - - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) - { - - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) - { - if (!me->isInCombat()) - { - DoStartNoMovement(who); - } - } - } - else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) - { - IntroStepCounter = 0; - } - } - - void KilledUnit(Unit * /*victim*/) - { - if (rand()%4 == 0) - { - DoScriptText(RAND(YELL_ALY_KILL_1,YELL_ALY_KILL_2), me); - } - } - - void JustDied(Unit* /*Killer*/) - { - if (SisterDeath) - { - DoScriptText(YELL_ALY_DEAD, me); - - if (pInstance) - pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); - } - else - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } - - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) - { - - case SPELL_BLAZE: - pTarget->CastSpell(pTarget, SPELL_BLAZE_SUMMON, true); - case SPELL_CONFLAGRATION: - case SPELL_FLAME_SEAR: - HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); - break; - case SPELL_SHADOW_NOVA: - HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); - break; - } - } - - void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) - { - switch(TouchedType) - { - case SPELL_FLAME_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_DARK_TOUCHED)) - { - pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - }else - { - pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); - } - } - break; - case SPELL_DARK_TOUCHED: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) - { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); - } - break; - } - } - - uint32 IntroStep(uint32 step) - { - Creature* Sacrolash = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_SACROLASH) : 0); - switch (step) - { - case 0: return 0; - case 1: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_1, Sacrolash); - return 1000; - case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; - case 3: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_3, Sacrolash); - return 2000; - case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; - case 5: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_5, Sacrolash); - return 2000; - case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; - case 7: - if (Sacrolash) - DoScriptText(YELL_INTRO_SAC_7, Sacrolash); - return 3000; - case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; - } - return 10000; - } - - void UpdateAI(const uint32 diff) - { - if (IntroStepCounter < 9) - { - if (IntroYellTimer <= diff) - { - IntroYellTimer = IntroStep(++IntroStepCounter); - } else IntroYellTimer -= diff; - } - - if (!SisterDeath) - { - if (pInstance) - { - Unit* Temp = NULL; - Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); - if (Temp && Temp->isDead()) - { - DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); - DoCast(me, SPELL_EMPOWER); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - SisterDeath = true; - } - } - } - if (!me->getVictim()) - { - if (pInstance) - { - Creature* sisiter = Unit::GetCreature((*me),pInstance->GetData64(DATA_SACROLASH)); - if (sisiter && !sisiter->isDead() && sisiter->getVictim()) - { - me->AddThreat(sisiter->getVictim(),0.0f); - DoStartNoMovement(sisiter->getVictim()); - me->Attack(sisiter->getVictim(),false); - } - } - } - - if (!UpdateVictim()) - return; - - if (SisterDeath) - { - if (ShadownovaTimer <= diff) + if (ShadowbladesTimer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_SHADOW_NOVA); - ShadownovaTimer= 30000+(rand()%5000); + DoCast(me, SPELL_SHADOW_BLADES); + ShadowbladesTimer = 10000; } - } else ShadownovaTimer -=diff; - } - else - { - if (ConflagrationTimer <= diff) + } else ShadowbladesTimer -=diff; + + if (EnrageTimer < diff && !Enraged) { - if (!me->IsNonMeleeSpellCasted(false)) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_CONFLAGRATION); - ConflagrationTimer = 30000+(rand()%5000); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoScriptText(YELL_ENRAGE, me); + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else EnrageTimer -= diff; - if (!SisterDeath) - { - if (pTarget) - DoScriptText(EMOTE_CONFLAGRATION, me, pTarget); - DoScriptText(YELL_CANFLAGRATION, me); - } - - BlazeTimer = 4000; - } - } else ConflagrationTimer -= diff; - } - - if (FlamesearTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me, SPELL_FLAME_SEAR); - FlamesearTimer = 15000; - } - } else FlamesearTimer -=diff; - - if (PyrogenicsTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me, SPELL_PYROGENICS, true); - PyrogenicsTimer = 15000; - } - } else PyrogenicsTimer -= diff; - - if (BlazeTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me->getVictim(), SPELL_BLAZE); - BlazeTimer = 3800; - } - } else BlazeTimer -= diff; - - if (EnrageTimer < diff && !Enraged) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else EnrageTimer -= diff; - } -}; - -CreatureAI* GetAI_boss_alythess(Creature* pCreature) -{ - return new boss_alythessAI (pCreature); -}; - -struct mob_shadow_imageAI : public ScriptedAI -{ - mob_shadow_imageAI(Creature *c) : ScriptedAI(c) {} - - uint32 ShadowfuryTimer; - uint32 KillTimer; - uint32 DarkstrikeTimer; - - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - ShadowfuryTimer = 5000 + (rand()%15000); - DarkstrikeTimer = 3000; - KillTimer = 15000; - } - - void EnterCombat(Unit * /*who*/){} - - void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) - { - switch(spell->Id) - { - - case SPELL_SHADOW_FURY: - case SPELL_DARK_STRIKE: - if (!pTarget->HasAura(SPELL_DARK_FLAME)) - { - if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) - { - pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); - pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); - } else pTarget->CastSpell(pTarget,SPELL_DARK_TOUCHED,true); - } - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(SPELL_IMAGE_VISUAL)) - DoCast(me, SPELL_IMAGE_VISUAL); - - if (KillTimer <= diff) - { - me->Kill(me); - KillTimer = 9999999; - } else KillTimer -= diff; - - if (!UpdateVictim()) - return; - - if (ShadowfuryTimer <= diff) - { - DoCast(me, SPELL_SHADOW_FURY); - ShadowfuryTimer = 10000; - } else ShadowfuryTimer -=diff; - - if (DarkstrikeTimer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) { //If we are within range melee the target if (me->IsWithinMeleeRange(me->getVictim())) - DoCast(me->getVictim(), SPELL_DARK_STRIKE); + { + HandleTouchedSpells(me->getVictim(), SPELL_DARK_TOUCHED); + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } } - DarkstrikeTimer = 3000; - } else DarkstrikeTimer -= diff; - } + } + }; + }; -CreatureAI* GetAI_mob_shadow_image(Creature* pCreature) + class boss_alythess : public CreatureScript { - return new mob_shadow_imageAI (pCreature); +public: + boss_alythess() : CreatureScript("boss_alythess") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_alythessAI (pCreature); + }; + + struct boss_alythessAI : public Scripted_NoMovementAI + { + boss_alythessAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + IntroStepCounter = 10; + } + + InstanceScript *pInstance; + + bool SisterDeath; + bool Enraged; + + uint32 IntroStepCounter; + uint32 IntroYellTimer; + + uint32 ConflagrationTimer; + uint32 BlazeTimer; + uint32 PyrogenicsTimer; + uint32 ShadownovaTimer; + uint32 FlamesearTimer; + uint32 EnrageTimer; + + void Reset() + { + Enraged = false; + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp) + if (Temp->isDead()) + { + CAST_CRE(Temp)->Respawn(); + }else + { + if (Temp->getVictim()) + { + me->getThreatManager().addThreat(Temp->getVictim(),0.0f); + } + } + } + + if (!me->isInCombat()) + { + ConflagrationTimer = 45000; + BlazeTimer = 100; + PyrogenicsTimer = 15000; + ShadownovaTimer = 40000; + EnrageTimer = 360000; + FlamesearTimer = 15000; + IntroYellTimer = 10000; + + SisterDeath = false; + } + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * who) + { + DoZoneInCombat(); + + if (pInstance) + { + Unit* Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isAlive() && !(Temp->getVictim())) + CAST_CRE(Temp)->AI()->AttackStart(who); + } + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit *who) + { + if (!me->isInCombat()) + { + Scripted_NoMovementAI::AttackStart(who); + } + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || me->getVictim()) + return; + + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + { + + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) + { + if (!me->isInCombat()) + { + DoStartNoMovement(who); + } + } + } + else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30)) + { + IntroStepCounter = 0; + } + } + + void KilledUnit(Unit * /*victim*/) + { + if (rand()%4 == 0) + { + DoScriptText(RAND(YELL_ALY_KILL_1,YELL_ALY_KILL_2), me); + } + } + + void JustDied(Unit* /*Killer*/) + { + if (SisterDeath) + { + DoScriptText(YELL_ALY_DEAD, me); + + if (pInstance) + pInstance->SetData(DATA_EREDAR_TWINS_EVENT, DONE); + } + else + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + } + + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) + { + switch(spell->Id) + { + + case SPELL_BLAZE: + pTarget->CastSpell(pTarget, SPELL_BLAZE_SUMMON, true); + case SPELL_CONFLAGRATION: + case SPELL_FLAME_SEAR: + HandleTouchedSpells(pTarget, SPELL_FLAME_TOUCHED); + break; + case SPELL_SHADOW_NOVA: + HandleTouchedSpells(pTarget, SPELL_DARK_TOUCHED); + break; + } + } + + void HandleTouchedSpells(Unit *pTarget, uint32 TouchedType) + { + switch(TouchedType) + { + case SPELL_FLAME_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) + { + if (pTarget->HasAura(SPELL_DARK_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + }else + { + pTarget->CastSpell(pTarget, SPELL_FLAME_TOUCHED, true); + } + } + break; + case SPELL_DARK_TOUCHED: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) + { + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget, SPELL_DARK_TOUCHED, true); + } + break; + } + } + + uint32 IntroStep(uint32 step) + { + Creature* Sacrolash = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_SACROLASH) : 0); + switch (step) + { + case 0: return 0; + case 1: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_1, Sacrolash); + return 1000; + case 2: DoScriptText(YELL_INTRO_ALY_2, me); return 1000; + case 3: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_3, Sacrolash); + return 2000; + case 4: DoScriptText(YELL_INTRO_ALY_4, me); return 1000; + case 5: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_5, Sacrolash); + return 2000; + case 6: DoScriptText(YELL_INTRO_ALY_6, me); return 1000; + case 7: + if (Sacrolash) + DoScriptText(YELL_INTRO_SAC_7, Sacrolash); + return 3000; + case 8: DoScriptText(YELL_INTRO_ALY_8, me); return 900000; + } + return 10000; + } + + void UpdateAI(const uint32 diff) + { + if (IntroStepCounter < 9) + { + if (IntroYellTimer <= diff) + { + IntroYellTimer = IntroStep(++IntroStepCounter); + } else IntroYellTimer -= diff; + } + + if (!SisterDeath) + { + if (pInstance) + { + Unit* Temp = NULL; + Temp = Unit::GetUnit((*me),pInstance->GetData64(DATA_SACROLASH)); + if (Temp && Temp->isDead()) + { + DoScriptText(YELL_SISTER_SACROLASH_DEAD, me); + DoCast(me, SPELL_EMPOWER); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + SisterDeath = true; + } + } + } + if (!me->getVictim()) + { + if (pInstance) + { + Creature* sisiter = Unit::GetCreature((*me),pInstance->GetData64(DATA_SACROLASH)); + if (sisiter && !sisiter->isDead() && sisiter->getVictim()) + { + me->AddThreat(sisiter->getVictim(),0.0f); + DoStartNoMovement(sisiter->getVictim()); + me->Attack(sisiter->getVictim(),false); + } + } + } + + if (!UpdateVictim()) + return; + + if (SisterDeath) + { + if (ShadownovaTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_SHADOW_NOVA); + ShadownovaTimer= 30000+(rand()%5000); + } + } else ShadownovaTimer -=diff; + } + else + { + if (ConflagrationTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_CONFLAGRATION); + ConflagrationTimer = 30000+(rand()%5000); + + if (!SisterDeath) + { + if (pTarget) + DoScriptText(EMOTE_CONFLAGRATION, me, pTarget); + DoScriptText(YELL_CANFLAGRATION, me); + } + + BlazeTimer = 4000; + } + } else ConflagrationTimer -= diff; + } + + if (FlamesearTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_FLAME_SEAR); + FlamesearTimer = 15000; + } + } else FlamesearTimer -=diff; + + if (PyrogenicsTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_PYROGENICS, true); + PyrogenicsTimer = 15000; + } + } else PyrogenicsTimer -= diff; + + if (BlazeTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me->getVictim(), SPELL_BLAZE); + BlazeTimer = 3800; + } + } else BlazeTimer -= diff; + + if (EnrageTimer < diff && !Enraged) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else EnrageTimer -= diff; + } + }; + }; + class mob_shadow_image : public CreatureScript +{ +public: + mob_shadow_image() : CreatureScript("mob_shadow_image") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shadow_imageAI (pCreature); + }; + + struct mob_shadow_imageAI : public ScriptedAI + { + mob_shadow_imageAI(Creature *c) : ScriptedAI(c) {} + + uint32 ShadowfuryTimer; + uint32 KillTimer; + uint32 DarkstrikeTimer; + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + ShadowfuryTimer = 5000 + (rand()%15000); + DarkstrikeTimer = 3000; + KillTimer = 15000; + } + + void EnterCombat(Unit * /*who*/){} + + void SpellHitTarget(Unit *pTarget,const SpellEntry* spell) + { + switch(spell->Id) + { + + case SPELL_SHADOW_FURY: + case SPELL_DARK_STRIKE: + if (!pTarget->HasAura(SPELL_DARK_FLAME)) + { + if (pTarget->HasAura(SPELL_FLAME_TOUCHED)) + { + pTarget->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED); + pTarget->CastSpell(pTarget, SPELL_DARK_FLAME, true); + } else pTarget->CastSpell(pTarget,SPELL_DARK_TOUCHED,true); + } + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(SPELL_IMAGE_VISUAL)) + DoCast(me, SPELL_IMAGE_VISUAL); + + if (KillTimer <= diff) + { + me->Kill(me); + KillTimer = 9999999; + } else KillTimer -= diff; + + if (!UpdateVictim()) + return; + + if (ShadowfuryTimer <= diff) + { + DoCast(me, SPELL_SHADOW_FURY); + ShadowfuryTimer = 10000; + } else ShadowfuryTimer -=diff; + + if (DarkstrikeTimer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + DoCast(me->getVictim(), SPELL_DARK_STRIKE); + } + DarkstrikeTimer = 3000; + } else DarkstrikeTimer -= diff; + } + }; + +}; + + void AddSC_boss_eredar_twins() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sacrolash"; - newscript->GetAI = &GetAI_boss_sacrolash; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_alythess"; - newscript->GetAI = &GetAI_boss_alythess; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadow_image"; - newscript->GetAI = &GetAI_mob_shadow_image; - newscript->RegisterSelf(); + new boss_sacrolash(); + new boss_alythess(); + new mob_shadow_image(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index 3c6efbb97fe..55341d2c2f9 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -102,479 +102,488 @@ enum EventFelmyst EVENT_SUMMON_DEAD, EVENT_SUMMON_FOG, }; - -struct boss_felmystAI : public ScriptedAI + class boss_felmyst : public CreatureScript { - boss_felmystAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); +public: + boss_felmyst() : CreatureScript("boss_felmyst") { } - // wait for core patch be accepted - /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT); - if (TempSpell->SpellIconID == 2294) - TempSpell->SpellIconID = 2295; - TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER); - if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) - TempSpell->Attributes |= SPELL_ATTR_PASSIVE; - TempSpell = GET_SPELL(SPELL_FOG_CHARM2); - if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) - TempSpell->Attributes |= SPELL_ATTR_PASSIVE;*/ + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_felmystAI(pCreature); } - ScriptedInstance *pInstance; - PhaseFelmyst phase; - EventMap events; - - uint32 uiFlightCount; - uint32 uiBreathCount; - - float breathX, breathY; - - void Reset() + struct boss_felmystAI : public ScriptedAI { - phase = PHASE_NONE; - - events.Reset(); - - uiFlightCount = 0; - - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - - DespawnSummons(MOB_VAPOR_TRAIL); - me->setActive(false); - - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - events.ScheduleEvent(EVENT_BERSERK, 600000); - - me->setActive(true); - DoZoneInCombat(); - DoCast(me, AURA_SUNWELL_RADIANCE, true); - DoCast(me, AURA_NOXIOUS_FUMES, true); - EnterPhase(PHASE_GROUND); - - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); - } - - void AttackStart(Unit *who) - { - if (phase != PHASE_FLIGHT) - ScriptedAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit *who) - { - if (phase != PHASE_FLIGHT) - ScriptedAI::MoveInLineOfSight(who); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(YELL_KILL1,YELL_KILL2), me); - } - - void JustRespawned() - { - DoScriptText(YELL_BIRTH, me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(YELL_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_FELMYST_EVENT, DONE); - } - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - // workaround for linked aura - /*if (spell->Id == SPELL_VAPOR_FORCE) + boss_felmystAI(Creature *c) : ScriptedAI(c) { - caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true); - }*/ - // workaround for mind control - if (spell->Id == SPELL_FOG_INFORM) - { - float x, y, z; - caster->GetPosition(x, y, z); - if (Unit* summon = me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - { - summon->SetMaxHealth(caster->GetMaxHealth()); - summon->SetHealth(caster->GetMaxHealth()); - summon->CastSpell(summon, SPELL_FOG_CHARM, true); - summon->CastSpell(summon, SPELL_FOG_CHARM2, true); - } - me->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pInstance = c->GetInstanceScript(); + + // wait for core patch be accepted + /*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT); + if (TempSpell->SpellIconID == 2294) + TempSpell->SpellIconID = 2295; + TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER); + if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) + TempSpell->Attributes |= SPELL_ATTR_PASSIVE; + TempSpell = GET_SPELL(SPELL_FOG_CHARM2); + if ((TempSpell->Attributes & SPELL_ATTR_PASSIVE) == 0) + TempSpell->Attributes |= SPELL_ATTR_PASSIVE;*/ } - } - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == MOB_DEAD) + InstanceScript *pInstance; + PhaseFelmyst phase; + EventMap events; + + uint32 uiFlightCount; + uint32 uiBreathCount; + + float breathX, breathY; + + void Reset() { - summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); - DoZoneInCombat(summon); - summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true); - } - } + phase = PHASE_NONE; - void MovementInform(uint32, uint32) - { - if (phase == PHASE_FLIGHT) - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - } + events.Reset(); - void DamageTaken(Unit*, uint32 &damage) - { - if (phase != PHASE_GROUND && damage >= me->GetHealth()) - damage = 0; - } - - void EnterPhase(PhaseFelmyst NextPhase) - { - switch(NextPhase) - { - case PHASE_GROUND: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - me->SetUnitMovementFlags(MOVEMENTFLAG_NONE); - me->SetSpeed(MOVE_RUN, 2.0); - - events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); - events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); - events.ScheduleEvent(EVENT_FLIGHT, 60000); - break; - case PHASE_FLIGHT: - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); uiFlightCount = 0; - uiBreathCount = 0; - break; - } - phase = NextPhase; - } - void HandleFlightSequence() - { - switch(uiFlightCount) - { - case 0: - //me->AttackStop(); - me->GetMotionMaster()->Clear(false); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->StopMoving(); - DoScriptText(YELL_TAKEOFF, me); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); - break; - case 1: - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); - break; - case 2: - { - Unit *pTarget = pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); - if (!pTarget) - { - EnterEvadeMode(); - return; - } - - Creature* Vapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (Vapor) - { - Vapor->AI()->AttackStart(pTarget); - me->InterruptNonMeleeSpells(false); - DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug - Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); - } - - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 3: - { DespawnSummons(MOB_VAPOR_TRAIL); - //DoCast(me, SPELL_VAPOR_SELECT); need core support + me->setActive(false); - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, NOT_STARTED); + } - if (!pTarget) + void EnterCombat(Unit * /*who*/) + { + events.ScheduleEvent(EVENT_BERSERK, 600000); + + me->setActive(true); + DoZoneInCombat(); + DoCast(me, AURA_SUNWELL_RADIANCE, true); + DoCast(me, AURA_NOXIOUS_FUMES, true); + EnterPhase(PHASE_GROUND); + + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit *who) + { + if (phase != PHASE_FLIGHT) + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit *who) + { + if (phase != PHASE_FLIGHT) + ScriptedAI::MoveInLineOfSight(who); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(YELL_KILL1,YELL_KILL2), me); + } + + void JustRespawned() + { + DoScriptText(YELL_BIRTH, me); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(YELL_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_FELMYST_EVENT, DONE); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + // workaround for linked aura + /*if (spell->Id == SPELL_VAPOR_FORCE) { - EnterEvadeMode(); + caster->CastSpell(caster, SPELL_VAPOR_TRIGGER, true); + }*/ + // workaround for mind control + if (spell->Id == SPELL_FOG_INFORM) + { + float x, y, z; + caster->GetPosition(x, y, z); + if (Unit* summon = me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + { + summon->SetMaxHealth(caster->GetMaxHealth()); + summon->SetHealth(caster->GetMaxHealth()); + summon->CastSpell(summon, SPELL_FOG_CHARM, true); + summon->CastSpell(summon, SPELL_FOG_CHARM2, true); + } + me->DealDamage(caster, caster->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } + + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == MOB_DEAD) + { + summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); + DoZoneInCombat(summon); + summon->CastSpell(summon, SPELL_DEAD_PASSIVE, true); + } + } + + void MovementInform(uint32, uint32) + { + if (phase == PHASE_FLIGHT) + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + } + + void DamageTaken(Unit*, uint32 &damage) + { + if (phase != PHASE_GROUND && damage >= me->GetHealth()) + damage = 0; + } + + void EnterPhase(PhaseFelmyst NextPhase) + { + switch(NextPhase) + { + case PHASE_GROUND: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + me->SetUnitMovementFlags(MOVEMENTFLAG_NONE); + me->SetSpeed(MOVE_RUN, 2.0); + + events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); + events.ScheduleEvent(EVENT_CORROSION, urand(10000, 20000)); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(15000, 20000)); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(20000, 25000)); + events.ScheduleEvent(EVENT_FLIGHT, 60000); + break; + case PHASE_FLIGHT: + me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1000); + uiFlightCount = 0; + uiBreathCount = 0; + break; + } + phase = NextPhase; + } + + void HandleFlightSequence() + { + switch(uiFlightCount) + { + case 0: + //me->AttackStop(); + me->GetMotionMaster()->Clear(false); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->StopMoving(); + DoScriptText(YELL_TAKEOFF, me); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 2000); + break; + case 1: + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10); + break; + case 2: + { + Unit *pTarget = pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + Creature* Vapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); + if (Vapor) + { + Vapor->AI()->AttackStart(pTarget); + me->InterruptNonMeleeSpells(false); + DoCast(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug + Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + } + case 3: + { + DespawnSummons(MOB_VAPOR_TRAIL); + //DoCast(me, SPELL_VAPOR_SELECT); need core support + + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + //pTarget->CastSpell(pTarget, SPELL_VAPOR_SUMMON, true); need core support + Creature* pVapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); + if (pVapor) + { + if (pVapor->AI()) + pVapor->AI()->AttackStart(pTarget); + me->InterruptNonMeleeSpells(false); + DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug + pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); + } + + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + } + case 4: + DespawnSummons(MOB_VAPOR_TRAIL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + break; + case 5: + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); + if (!pTarget) + pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + + if (!pTarget) + { + EnterEvadeMode(); + return; + } + + breathX = pTarget->GetPositionX(); + breathY = pTarget->GetPositionY(); + float x, y, z; + pTarget->GetContactPoint(me, x, y, z, 70); + me->GetMotionMaster()->MovePoint(0, x, y, z+10); + break; + } + case 6: + me->SetOrientation(me->GetAngle(breathX, breathY)); + me->StopMoving(); + //DoTextEmote("takes a deep breath.", NULL); + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); + break; + case 7: + { + DoCast(me, SPELL_FOG_BREATH, true); + float x, y, z; + me->GetPosition(x, y, z); + x = 2 * breathX - x; + y = 2 * breathY - y; + me->GetMotionMaster()->MovePoint(0, x, y, z); + events.ScheduleEvent(EVENT_SUMMON_FOG, 1); + break; + } + case 8: + me->CastStop(SPELL_FOG_BREATH); + me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); + ++uiBreathCount; + events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); + if (uiBreathCount < 3) + uiFlightCount = 4; + break; + case 9: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO)) + DoStartMovement(pTarget); + else + { + EnterEvadeMode(); + return; + } + break; + case 10: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + EnterPhase(PHASE_GROUND); + AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); + break; + } + ++uiFlightCount; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + { + if (phase == PHASE_FLIGHT && !me->IsInEvadeMode()) + EnterEvadeMode(); return; } - //pTarget->CastSpell(pTarget, SPELL_VAPOR_SUMMON, true); need core support - Creature* pVapor = me->SummonCreature(MOB_VAPOR, pTarget->GetPositionX()-5+rand()%10, pTarget->GetPositionY()-5+rand()%10, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000); - if (pVapor) - { - if (pVapor->AI()) - pVapor->AI()->AttackStart(pTarget); - me->InterruptNonMeleeSpells(false); - DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug - pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true); - } + events.Update(diff); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - } - case 4: - DespawnSummons(MOB_VAPOR_TRAIL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - break; - case 5: - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true); - if (!pTarget) - pTarget = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); - - if (!pTarget) - { - EnterEvadeMode(); + if (me->IsNonMeleeSpellCasted(false)) return; + + if (phase == PHASE_GROUND) + { + switch(events.ExecuteEvent()) + { + case EVENT_BERSERK: + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK, true); + events.ScheduleEvent(EVENT_BERSERK, 10000); + break; + case EVENT_CLEAVE: + DoCast(me->getVictim(), SPELL_CLEAVE, false); + events.ScheduleEvent(EVENT_CLEAVE, urand(5000,10000)); + break; + case EVENT_CORROSION: + DoCast(me->getVictim(), SPELL_CORROSION, false); + events.ScheduleEvent(EVENT_CORROSION, urand(20000,30000)); + break; + case EVENT_GAS_NOVA: + DoCast(me, SPELL_GAS_NOVA, false); + events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000,25000)); + break; + case EVENT_ENCAPSULATE: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true)) + DoCast(pTarget, SPELL_ENCAPSULATE_CHANNEL, false); + events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000,30000)); + break; + case EVENT_FLIGHT: + EnterPhase(PHASE_FLIGHT); + break; + default: + DoMeleeAttackIfReady(); + break; + } } - breathX = pTarget->GetPositionX(); - breathY = pTarget->GetPositionY(); - float x, y, z; - pTarget->GetContactPoint(me, x, y, z, 70); - me->GetMotionMaster()->MovePoint(0, x, y, z+10); - break; + if (phase == PHASE_FLIGHT) + { + switch(events.ExecuteEvent()) + { + case EVENT_BERSERK: + DoScriptText(YELL_BERSERK, me); + DoCast(me, SPELL_BERSERK, true); + break; + case EVENT_FLIGHT_SEQUENCE: + HandleFlightSequence(); + break; + case EVENT_SUMMON_FOG: + { + float x, y, z; + me->GetPosition(x, y, z); + me->UpdateGroundPositionZ(x, y, z); + if (Creature *Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) + { + Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER); + Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true); + me->CastSpell(Fog, SPELL_FOG_FORCE, true); + } + } + events.ScheduleEvent(EVENT_SUMMON_FOG, 1000); + break; + } + } } - case 6: - me->SetOrientation(me->GetAngle(breathX, breathY)); - me->StopMoving(); - //DoTextEmote("takes a deep breath.", NULL); - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); - break; - case 7: + + void DespawnSummons(uint32 entry) { - DoCast(me, SPELL_FOG_BREATH, true); + std::list templist; float x, y, z; me->GetPosition(x, y, z); - x = 2 * breathX - x; - y = 2 * breathY - y; - me->GetMotionMaster()->MovePoint(0, x, y, z); - events.ScheduleEvent(EVENT_SUMMON_FOG, 1); - break; - } - case 8: - me->CastStop(SPELL_FOG_BREATH); - me->RemoveAurasDueToSpell(SPELL_FOG_BREATH); - ++uiBreathCount; - events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1); - if (uiBreathCount < 3) - uiFlightCount = 4; - break; - case 9: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO)) - DoStartMovement(pTarget); - else - { - EnterEvadeMode(); - return; - } - break; - case 10: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - EnterPhase(PHASE_GROUND); - AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO)); - break; - } - ++uiFlightCount; - } - void UpdateAI(const uint32 diff) + CellPair pair(Trinity::ComputeCellPair(x, y)); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); + Trinity::CreatureListSearcher searcher(me, templist, check); + TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); + cell.Visit(pair, cSearcher, *(me->GetMap())); + + for (std::list::const_iterator i = templist.begin(); i != templist.end(); ++i) + { + if (entry == MOB_VAPOR_TRAIL && phase == PHASE_FLIGHT) + { + (*i)->GetPosition(x, y, z); + me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + } + (*i)->SetVisibility(VISIBILITY_OFF); + (*i)->setDeathState(JUST_DIED); + if ((*i)->getDeathState() == CORPSE) + (*i)->RemoveCorpse(); + } + } + }; + +}; + class mob_felmyst_vapor : public CreatureScript +{ +public: + mob_felmyst_vapor() : CreatureScript("mob_felmyst_vapor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - if (!UpdateVictim()) - { - if (phase == PHASE_FLIGHT && !me->IsInEvadeMode()) - EnterEvadeMode(); - return; - } - - events.Update(diff); - - if (me->IsNonMeleeSpellCasted(false)) - return; - - if (phase == PHASE_GROUND) - { - switch(events.ExecuteEvent()) - { - case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK, true); - events.ScheduleEvent(EVENT_BERSERK, 10000); - break; - case EVENT_CLEAVE: - DoCast(me->getVictim(), SPELL_CLEAVE, false); - events.ScheduleEvent(EVENT_CLEAVE, urand(5000,10000)); - break; - case EVENT_CORROSION: - DoCast(me->getVictim(), SPELL_CORROSION, false); - events.ScheduleEvent(EVENT_CORROSION, urand(20000,30000)); - break; - case EVENT_GAS_NOVA: - DoCast(me, SPELL_GAS_NOVA, false); - events.ScheduleEvent(EVENT_GAS_NOVA, urand(20000,25000)); - break; - case EVENT_ENCAPSULATE: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true)) - DoCast(pTarget, SPELL_ENCAPSULATE_CHANNEL, false); - events.ScheduleEvent(EVENT_ENCAPSULATE, urand(25000,30000)); - break; - case EVENT_FLIGHT: - EnterPhase(PHASE_FLIGHT); - break; - default: - DoMeleeAttackIfReady(); - break; - } - } - - if (phase == PHASE_FLIGHT) - { - switch(events.ExecuteEvent()) - { - case EVENT_BERSERK: - DoScriptText(YELL_BERSERK, me); - DoCast(me, SPELL_BERSERK, true); - break; - case EVENT_FLIGHT_SEQUENCE: - HandleFlightSequence(); - break; - case EVENT_SUMMON_FOG: - { - float x, y, z; - me->GetPosition(x, y, z); - me->UpdateGroundPositionZ(x, y, z); - if (Creature *Fog = me->SummonCreature(MOB_VAPOR_TRAIL, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 10000)) - { - Fog->RemoveAurasDueToSpell(SPELL_TRAIL_TRIGGER); - Fog->CastSpell(Fog, SPELL_FOG_TRIGGER, true); - me->CastSpell(Fog, SPELL_FOG_FORCE, true); - } - } - events.ScheduleEvent(EVENT_SUMMON_FOG, 1000); - break; - } - } + return new mob_felmyst_vaporAI(pCreature); } - void DespawnSummons(uint32 entry) + struct mob_felmyst_vaporAI : public ScriptedAI { - std::list templist; - float x, y, z; - me->GetPosition(x, y, z); - - CellPair pair(Trinity::ComputeCellPair(x, y)); - Cell cell(pair); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); - - Trinity::AllCreaturesOfEntryInRange check(me, entry, 100); - Trinity::CreatureListSearcher searcher(me, templist, check); - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - cell.Visit(pair, cSearcher, *(me->GetMap())); - - for (std::list::const_iterator i = templist.begin(); i != templist.end(); ++i) + mob_felmyst_vaporAI(Creature *c) : ScriptedAI(c) { - if (entry == MOB_VAPOR_TRAIL && phase == PHASE_FLIGHT) - { - (*i)->GetPosition(x, y, z); - me->SummonCreature(MOB_DEAD, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - } - (*i)->SetVisibility(VISIBILITY_OFF); - (*i)->setDeathState(JUST_DIED); - if ((*i)->getDeathState() == CORPSE) - (*i)->RemoveCorpse(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetSpeed(MOVE_RUN, 0.8); } + void Reset() {} + void EnterCombat(Unit* /*who*/) + { + DoZoneInCombat(); + //DoCast(me, SPELL_VAPOR_FORCE, true); core bug + } + void UpdateAI(const uint32 /*diff*/) + { + if (!me->getVictim()) + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + AttackStart(pTarget); + } + }; + +}; + class mob_felmyst_trail : public CreatureScript +{ +public: + mob_felmyst_trail() : CreatureScript("mob_felmyst_trail") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_felmyst_trailAI(pCreature); } + + struct mob_felmyst_trailAI : public ScriptedAI + { + mob_felmyst_trailAI(Creature *c) : ScriptedAI(c) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_TRAIL_TRIGGER, true); + me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01); // core bug + } + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + }; + }; -struct mob_felmyst_vaporAI : public ScriptedAI -{ - mob_felmyst_vaporAI(Creature *c) : ScriptedAI(c) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetSpeed(MOVE_RUN, 0.8); - } - void Reset() {} - void EnterCombat(Unit* /*who*/) - { - DoZoneInCombat(); - //DoCast(me, SPELL_VAPOR_FORCE, true); core bug - } - void UpdateAI(const uint32 /*diff*/) - { - if (!me->getVictim()) - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - AttackStart(pTarget); - } -}; -struct mob_felmyst_trailAI : public ScriptedAI -{ - mob_felmyst_trailAI(Creature *c) : ScriptedAI(c) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_TRAIL_TRIGGER, true); - me->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 0.01); // core bug - } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} -}; -CreatureAI* GetAI_boss_felmyst(Creature* pCreature) -{ - return new boss_felmystAI(pCreature); -} - -CreatureAI* GetAI_mob_felmyst_vapor(Creature* pCreature) -{ - return new mob_felmyst_vaporAI(pCreature); -} - -CreatureAI* GetAI_mob_felmyst_trail(Creature* pCreature) -{ - return new mob_felmyst_trailAI(pCreature); -} void AddSC_boss_felmyst() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_felmyst"; - newscript->GetAI = &GetAI_boss_felmyst; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felmyst_vapor"; - newscript->GetAI = &GetAI_mob_felmyst_vapor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_felmyst_trail"; - newscript->GetAI = &GetAI_mob_felmyst_trail; - newscript->RegisterSelf(); + new boss_felmyst(); + new mob_felmyst_vapor(); + new mob_felmyst_trail(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 61def91b736..5660ccf98ac 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -102,159 +102,641 @@ enum SWPActions #define MAX_PLAYERS_IN_SPECTRAL_REALM 0 //over this, teleport object won't work, 0 disables check uint32 WildMagic[] = { 44978, 45001, 45002, 45004, 45006, 45010 }; - -struct boss_kalecgosAI : public ScriptedAI + class boss_kalecgos : public CreatureScript { - boss_kalecgosAI(Creature *c) : ScriptedAI(c) +public: + boss_kalecgos() : CreatureScript("boss_kalecgos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - SathGUID = 0; - DoorGUID = 0; - bJustReset = false; - me->setActive(true); - SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST); - if (TempSpell) - TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; + return new boss_kalecgosAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 ArcaneBuffetTimer; - uint32 FrostBreathTimer; - uint32 WildMagicTimer; - uint32 SpectralBlastTimer; - uint32 TailLashTimer; - uint32 CheckTimer; - uint32 TalkTimer; - uint32 TalkSequence; - uint32 ResetTimer; - - bool isFriendly; - bool isEnraged; - bool isBanished; - bool bJustReset; - - uint64 SathGUID; - uint64 DoorGUID; - - void Reset() + struct boss_kalecgosAI : public ScriptedAI { - if (pInstance) + boss_kalecgosAI(Creature *c) : ScriptedAI(c) { - SathGUID = pInstance->GetData64(DATA_SATHROVARR); - pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); + SathGUID = 0; + DoorGUID = 0; + bJustReset = false; + me->setActive(true); + SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST); + if (TempSpell) + TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY; } - if (Creature *Sath = Unit::GetCreature(*me, SathGUID)) - Sath->AI()->EnterEvadeMode(); + InstanceScript *pInstance; - me->setFaction(14); - if (!bJustReset) //first reset at create + uint32 ArcaneBuffetTimer; + uint32 FrostBreathTimer; + uint32 WildMagicTimer; + uint32 SpectralBlastTimer; + uint32 TailLashTimer; + uint32 CheckTimer; + uint32 TalkTimer; + uint32 TalkSequence; + uint32 ResetTimer; + + bool isFriendly; + bool isEnraged; + bool isBanished; + bool bJustReset; + + uint64 SathGUID; + uint64 DoorGUID; + + void Reset() { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetVisibility(VISIBILITY_ON); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. - ArcaneBuffetTimer = 8000; - FrostBreathTimer = 15000; - WildMagicTimer = 10000; - TailLashTimer = 25000; - SpectralBlastTimer = urand(20000,25000); - CheckTimer = 1000; - ResetTimer = 30000; - - TalkTimer = 0; - TalkSequence = 0; - isFriendly = false; - isEnraged = false; - isBanished = false; - } - - void EnterEvadeMode() - { - bJustReset = true; - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - ScriptedAI::EnterEvadeMode(); - } - - void DoAction(const int32 param) - { - switch (param) - { - case DO_ENRAGE: - isEnraged = true; - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case DO_BANISH: - isBanished = true; - me->CastSpell(me, SPELL_BANISH, true); - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (TalkTimer) - { - if (!TalkSequence) + if (pInstance) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(); - ++TalkSequence; + SathGUID = pInstance->GetData64(DATA_SATHROVARR); + pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); } - if (TalkTimer <= diff) + + if (Creature *Sath = Unit::GetCreature(*me, SathGUID)) + Sath->AI()->EnterEvadeMode(); + + me->setFaction(14); + if (!bJustReset) //first reset at create { - if (isFriendly) - GoodEnding(); - else - BadEnding(); - ++TalkSequence; - } else TalkTimer -= diff; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetVisibility(VISIBILITY_ON); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } + me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + ArcaneBuffetTimer = 8000; + FrostBreathTimer = 15000; + WildMagicTimer = 10000; + TailLashTimer = 25000; + SpectralBlastTimer = urand(20000,25000); + CheckTimer = 1000; + ResetTimer = 30000; + + TalkTimer = 0; + TalkSequence = 0; + isFriendly = false; + isEnraged = false; + isBanished = false; } - else + + void EnterEvadeMode() { - if (bJustReset) + bJustReset = true; + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + ScriptedAI::EnterEvadeMode(); + } + + void DoAction(const int32 param) + { + switch (param) { - if (ResetTimer <= diff) + case DO_ENRAGE: + isEnraged = true; + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case DO_BANISH: + isBanished = true; + me->CastSpell(me, SPELL_BANISH, true); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (TalkTimer) + { + if (!TalkSequence) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetVisibility(VISIBILITY_ON); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - ResetTimer = 10000; - bJustReset = false; - } else ResetTimer -= diff; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(); + ++TalkSequence; + } + if (TalkTimer <= diff) + { + if (isFriendly) + GoodEnding(); + else + BadEnding(); + ++TalkSequence; + } else TalkTimer -= diff; + } + else + { + if (bJustReset) + { + if (ResetTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetVisibility(VISIBILITY_ON); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + ResetTimer = 10000; + bJustReset = false; + } else ResetTimer -= diff; + return; + } + if (!UpdateVictim()) + return; + + if (CheckTimer <= diff) + { + if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) + { + me->AI()->EnterEvadeMode(); + return; + } + if (HealthBelowPct(10) && !isEnraged) + { + if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + Sath->AI()->DoAction(DO_ENRAGE); + DoAction(DO_ENRAGE); + } + if (!isBanished && HealthBelowPct(1)) + { + if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + { + if (Sath->HasAura(SPELL_BANISH)) + { + Sath->DealDamage(Sath, Sath->GetHealth()); + return; + } + else + DoAction(DO_BANISH); + } + else + { + sLog.outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted."); + EnterEvadeMode(); + return; + } + } + CheckTimer = 1000; + } else CheckTimer -= diff; + + if (ArcaneBuffetTimer <= diff) + { + DoCastAOE(SPELL_ARCANE_BUFFET); + ArcaneBuffetTimer = 8000; + } else ArcaneBuffetTimer -= diff; + + if (FrostBreathTimer <= diff) + { + DoCastAOE(SPELL_FROST_BREATH); + FrostBreathTimer = 15000; + } else FrostBreathTimer -= diff; + + if (TailLashTimer <= diff) + { + DoCastAOE(SPELL_TAIL_LASH); + TailLashTimer = 15000; + } else TailLashTimer -= diff; + + if (WildMagicTimer <= diff) + { + DoCastAOE(WildMagic[rand()%6]); + WildMagicTimer = 20000; + } else WildMagicTimer -= diff; + + if (SpectralBlastTimer <= diff) + { + std::list &m_threatlist = me->getThreatManager().getThreatList(); + std::list targetList; + for (std::list::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) + if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) + targetList.push_back((*itr)->getTarget()); + if (targetList.empty()) + { + SpectralBlastTimer = 1000; + return; + } + std::list::const_iterator i = targetList.begin(); + advance(i, rand()%targetList.size()); + if ((*i)) + { + (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST,true); + SpectralBlastTimer = 20000+rand()%5000; + } else SpectralBlastTimer = 1000; + } else SpectralBlastTimer -= diff; + + DoMeleeAttackIfReady(); + } + } + + void MoveInLineOfSight(Unit *who) + { + if (bJustReset)//boss is invisible, don't attack + return; + + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + { + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius)) + AttackStart(who); + } + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = 0; + } + + void EnterCombat(Unit* /*who*/) + { + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_EVIL_AGGRO, me); + DoZoneInCombat(); + + if (pInstance) + pInstance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_EVIL_SLAY1,SAY_EVIL_SLAY2), me); + } + + void MovementInform(uint32 type,uint32 /*id*/) + { + if (type != POINT_MOTION_TYPE) + return; + me->SetVisibility(VISIBILITY_OFF); + if (isFriendly) + { + me->setDeathState(JUST_DIED); + + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer) + me->GetMap()->ToInstanceMap()->PermBindAllPlayers(pPlayer); + } + } + } + else + { + me->GetMotionMaster()->MoveTargetedHome(); + TalkTimer = 1000; + } + } + + void GoodEnding() + { + switch(TalkSequence) + { + case 1: + me->setFaction(35); + TalkTimer = 1000; + break; + case 2: + DoScriptText(SAY_GOOD_PLRWIN, me); + TalkTimer = 10000; + break; + case 3: + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); + TalkTimer = 600000; + break; + default: + break; + } + } + + void BadEnding() + { + switch(TalkSequence) + { + case 1: + DoScriptText(SAY_EVIL_ENRAGE, me); + TalkTimer = 3000; + break; + case 2: + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); + TalkTimer = 15000; + break; + case 3: + EnterEvadeMode(); + break; + default: + break; + } + } + }; + +}; + class boss_kalec : public CreatureScript +{ +public: + boss_kalec() : CreatureScript("boss_kalec") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_kalecAI (pCreature); + } + + struct boss_kalecAI : public ScriptedAI + { + InstanceScript *pInstance; + + uint32 RevitalizeTimer; + uint32 HeroicStrikeTimer; + uint32 YellTimer; + uint32 YellSequence; + + uint64 SathGUID; + + bool isEnraged; // if demon is enraged + + boss_kalecAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + void Reset() + { + if (pInstance) + SathGUID = pInstance->GetData64(DATA_SATHROVARR); + + RevitalizeTimer = 5000; + HeroicStrikeTimer = 3000; + YellTimer = 5000; + YellSequence = 0; + + isEnraged = false; + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetGUID() != SathGUID) + damage = 0; + else if (isEnraged) + damage *= 3; + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) + me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); + if (!UpdateVictim()) + return; + + if (YellTimer <= diff) + { + switch(YellSequence) + { + case 0: + DoScriptText(SAY_GOOD_AGGRO, me); + ++YellSequence; + break; + case 1: + if (HealthBelowPct(50)) + { + DoScriptText(SAY_GOOD_NEAR_DEATH, me); + ++YellSequence; + } + break; + case 2: + if (HealthBelowPct(10)) + { + DoScriptText(SAY_GOOD_NEAR_DEATH2, me); + ++YellSequence; + } + break; + default: + break; + } + YellTimer = 5000; + } + + if (RevitalizeTimer <= diff) + { + DoCast(me, SPELL_REVITALIZE); + RevitalizeTimer = 5000; + } else RevitalizeTimer -= diff; + + if (HeroicStrikeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HEROIC_STRIKE); + HeroicStrikeTimer = 2000; + } else HeroicStrikeTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class kalecgos_teleporter : public GameObjectScript +{ +public: + kalecgos_teleporter() : GameObjectScript("kalecgos_teleporter") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) + { + uint32 SpectralPlayers = 0; + Map* pMap = pGo->GetMap(); + if (!pMap->IsDungeon()) return true; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5) + ++SpectralPlayers; + } + if (pPlayer->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MAX_PLAYERS_IN_SPECTRAL_REALM && SpectralPlayers >= MAX_PLAYERS_IN_SPECTRAL_REALM)) + pPlayer->GetSession()->SendNotification(GO_FAILED); + else + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_SPECTRAL, true); + return true; + } + +}; + class boss_sathrovarr : public CreatureScript +{ +public: + boss_sathrovarr() : CreatureScript("boss_sathrovarr") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_sathrovarrAI (pCreature); + } + + struct boss_sathrovarrAI : public ScriptedAI + { + boss_sathrovarrAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + KalecGUID = 0; + KalecgosGUID = 0; + } + + InstanceScript *pInstance; + + uint32 CorruptionStrikeTimer; + uint32 AgonyCurseTimer; + uint32 ShadowBoltTimer; + uint32 CheckTimer; + uint32 ResetThreat; + + uint64 KalecGUID; + uint64 KalecgosGUID; + + bool isEnraged; + bool isBanished; + + void Reset() + { + me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. + me->setActive(true); + if (pInstance) + { + KalecgosGUID = pInstance->GetData64(DATA_KALECGOS_DRAGON); + pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); + } + if (KalecGUID) + { + if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) + Kalec->setDeathState(JUST_DIED); + KalecGUID = 0; + } + + ShadowBoltTimer = 7000 + rand()%3 * 1000; + AgonyCurseTimer = 20000; + CorruptionStrikeTimer = 13000; + CheckTimer = 1000; + ResetThreat = 1000; + isEnraged = false; + isBanished = false; + + me->CastSpell(me, AURA_DEMONIC_VISUAL, true); + TeleportAllPlayersBack(); + } + + void EnterCombat(Unit* /*who*/) + { + if (Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + { + KalecGUID = Kalec->GetGUID(); + me->CombatStart(Kalec); + me->AddThreat(Kalec, 100.0f); + Kalec->setActive(true); + } + DoScriptText(SAY_SATH_AGGRO, me); + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = 0; + } + + void KilledUnit(Unit *pTarget) + { + if (pTarget->GetGUID() == KalecGUID) + { + TeleportAllPlayersBack(); + if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + { + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; + } + EnterEvadeMode(); return; } + DoScriptText(RAND(SAY_SATH_SLAY1,SAY_SATH_SLAY2), me); + } + + void JustDied(Unit * /*killer*/) + { + DoScriptText(SAY_SATH_DEATH, me); + me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); + TeleportAllPlayersBack(); + if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + { + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; + CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; + } + + if (pInstance) + pInstance->SetData(DATA_KALECGOS_EVENT, DONE); + } + + void TeleportAllPlayersBack() + { + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return; + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5) + { + i->getSource()->RemoveAura(AURA_SPECTRAL_REALM); + i->getSource()->TeleportTo(me->GetMap()->GetId(),i->getSource()->GetPositionX(),i->getSource()->GetPositionY(),DRAGON_REALM_Z+5,i->getSource()->GetOrientation()); + } + } + } + + void DoAction(const int32 param) + { + switch (param) + { + case DO_ENRAGE: + isEnraged = true; + me->CastSpell(me, SPELL_ENRAGE, true); + break; + case DO_BANISH: + isBanished = true; + me->CastSpell(me, SPELL_BANISH, true); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) + me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); if (!UpdateVictim()) return; if (CheckTimer <= diff) { - if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75) + Creature *Kalec = Unit::GetCreature(*me, KalecGUID); + if (!Kalec || (Kalec && !Kalec->isAlive())) { - me->AI()->EnterEvadeMode(); - return; + if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + Kalecgos->AI()->EnterEvadeMode(); + return; } if (HealthBelowPct(10) && !isEnraged) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) - Sath->AI()->DoAction(DO_ENRAGE); + if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) + Kalecgos->AI()->DoAction(DO_ENRAGE); DoAction(DO_ENRAGE); } + Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID); + if (Kalecgos) + { + if (!Kalecgos->isInCombat()) + { + me->AI()->EnterEvadeMode(); + return; + } + } if (!isBanished && HealthBelowPct(1)) { - if (Creature* Sath = Unit::GetCreature(*me, SathGUID)) + if (Kalecgos) { - if (Sath->HasAura(SPELL_BANISH)) + if (Kalecgos->HasAura(SPELL_BANISH)) { - Sath->DealDamage(Sath, Sath->GetHealth()); + me->DealDamage(me, me->GetHealth()); return; } else @@ -262,7 +744,7 @@ struct boss_kalecgosAI : public ScriptedAI } else { - sLog.outError("TSCR: Didn't find Shathrowar. Kalecgos event reseted."); + me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); EnterEvadeMode(); return; } @@ -270,527 +752,54 @@ struct boss_kalecgosAI : public ScriptedAI CheckTimer = 1000; } else CheckTimer -= diff; - if (ArcaneBuffetTimer <= diff) + if (ResetThreat <= diff) { - DoCastAOE(SPELL_ARCANE_BUFFET); - ArcaneBuffetTimer = 8000; - } else ArcaneBuffetTimer -= diff; - - if (FrostBreathTimer <= diff) - { - DoCastAOE(SPELL_FROST_BREATH); - FrostBreathTimer = 15000; - } else FrostBreathTimer -= diff; - - if (TailLashTimer <= diff) - { - DoCastAOE(SPELL_TAIL_LASH); - TailLashTimer = 15000; - } else TailLashTimer -= diff; - - if (WildMagicTimer <= diff) - { - DoCastAOE(WildMagic[rand()%6]); - WildMagicTimer = 20000; - } else WildMagicTimer -= diff; - - if (SpectralBlastTimer <= diff) - { - std::list &m_threatlist = me->getThreatManager().getThreatList(); - std::list targetList; - for (std::list::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) - if ((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) - targetList.push_back((*itr)->getTarget()); - if (targetList.empty()) + for (std::list::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { - SpectralBlastTimer = 1000; - return; + if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + { + if (pUnit->GetPositionZ() > me->GetPositionZ()+5) + { + me->getThreatManager().modifyThreatPercent(pUnit,-100); + } + } } - std::list::const_iterator i = targetList.begin(); - advance(i, rand()%targetList.size()); - if ((*i)) - { - (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST,true); - SpectralBlastTimer = 20000+rand()%5000; - } else SpectralBlastTimer = 1000; - } else SpectralBlastTimer -= diff; + ResetThreat = 1000; + } else ResetThreat -= diff; + + if (ShadowBoltTimer <= diff) + { + if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); + DoCast(me, SPELL_SHADOW_BOLT); + ShadowBoltTimer = 7000+(rand()%3000); + } else ShadowBoltTimer -= diff; + + if (AgonyCurseTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (!pTarget) pTarget = me->getVictim(); + DoCast(pTarget, SPELL_AGONY_CURSE); + AgonyCurseTimer = 20000; + } else AgonyCurseTimer -= diff; + + if (CorruptionStrikeTimer <= diff) + { + if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); + DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); + CorruptionStrikeTimer = 13000; + } else CorruptionStrikeTimer -= diff; DoMeleeAttackIfReady(); } - } + }; - void MoveInLineOfSight(Unit *who) - { - if (bJustReset)//boss is invisible, don't attack - return; - - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) - { - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius)) - AttackStart(who); - } - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = 0; - } - - void EnterCombat(Unit* /*who*/) - { - me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_EVIL_AGGRO, me); - DoZoneInCombat(); - - if (pInstance) - pInstance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_EVIL_SLAY1,SAY_EVIL_SLAY2), me); - } - - void MovementInform(uint32 type,uint32 /*id*/) - { - if (type != POINT_MOTION_TYPE) - return; - me->SetVisibility(VISIBILITY_OFF); - if (isFriendly) - { - me->setDeathState(JUST_DIED); - - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (!players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - Player* pPlayer = itr->getSource(); - if (pPlayer) - me->GetMap()->ToInstanceMap()->PermBindAllPlayers(pPlayer); - } - } - } - else - { - me->GetMotionMaster()->MoveTargetedHome(); - TalkTimer = 1000; - } - } - - void GoodEnding() - { - switch(TalkSequence) - { - case 1: - me->setFaction(35); - TalkTimer = 1000; - break; - case 2: - DoScriptText(SAY_GOOD_PLRWIN, me); - TalkTimer = 10000; - break; - case 3: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); - TalkTimer = 600000; - break; - default: - break; - } - } - - void BadEnding() - { - switch(TalkSequence) - { - case 1: - DoScriptText(SAY_EVIL_ENRAGE, me); - TalkTimer = 3000; - break; - case 2: - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->GetMotionMaster()->MovePoint(0,FLY_X,FLY_Y,FLY_Z); - TalkTimer = 15000; - break; - case 3: - EnterEvadeMode(); - break; - default: - break; - } - } }; -struct boss_sathrovarrAI : public ScriptedAI -{ - boss_sathrovarrAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - KalecGUID = 0; - KalecgosGUID = 0; - } - - ScriptedInstance *pInstance; - - uint32 CorruptionStrikeTimer; - uint32 AgonyCurseTimer; - uint32 ShadowBoltTimer; - uint32 CheckTimer; - uint32 ResetThreat; - - uint64 KalecGUID; - uint64 KalecgosGUID; - - bool isEnraged; - bool isBanished; - - void Reset() - { - me->SetHealth(me->GetMaxHealth());//dunno why it does not resets health at evade.. - me->setActive(true); - if (pInstance) - { - KalecgosGUID = pInstance->GetData64(DATA_KALECGOS_DRAGON); - pInstance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED); - } - if (KalecGUID) - { - if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID)) - Kalec->setDeathState(JUST_DIED); - KalecGUID = 0; - } - - ShadowBoltTimer = 7000 + rand()%3 * 1000; - AgonyCurseTimer = 20000; - CorruptionStrikeTimer = 13000; - CheckTimer = 1000; - ResetThreat = 1000; - isEnraged = false; - isBanished = false; - - me->CastSpell(me, AURA_DEMONIC_VISUAL, true); - TeleportAllPlayersBack(); - } - - void EnterCombat(Unit* /*who*/) - { - if (Creature *Kalec = me->SummonCreature(MOB_KALEC, me->GetPositionX() + 10, me->GetPositionY() + 5, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - { - KalecGUID = Kalec->GetGUID(); - me->CombatStart(Kalec); - me->AddThreat(Kalec, 100.0f); - Kalec->setActive(true); - } - DoScriptText(SAY_SATH_AGGRO, me); - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = 0; - } - - void KilledUnit(Unit *pTarget) - { - if (pTarget->GetGUID() == KalecGUID) - { - TeleportAllPlayersBack(); - if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - { - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->isFriendly = false; - } - EnterEvadeMode(); - return; - } - DoScriptText(RAND(SAY_SATH_SLAY1,SAY_SATH_SLAY2), me); - } - - void JustDied(Unit * /*killer*/) - { - DoScriptText(SAY_SATH_DEATH, me); - me->GetMap()->CreatureRelocation(me, me->GetPositionX(), me->GetPositionY(), DRAGON_REALM_Z, me->GetOrientation()); - TeleportAllPlayersBack(); - if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - { - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1; - CAST_AI(boss_kalecgosAI, Kalecgos->AI())->isFriendly = true; - } - - if (pInstance) - pInstance->SetData(DATA_KALECGOS_EVENT, DONE); - } - - void TeleportAllPlayersBack() - { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->GetPositionZ() <= DRAGON_REALM_Z-5) - { - i->getSource()->RemoveAura(AURA_SPECTRAL_REALM); - i->getSource()->TeleportTo(me->GetMap()->GetId(),i->getSource()->GetPositionX(),i->getSource()->GetPositionY(),DRAGON_REALM_Z+5,i->getSource()->GetOrientation()); - } - } - } - - void DoAction(const int32 param) - { - switch (param) - { - case DO_ENRAGE: - isEnraged = true; - me->CastSpell(me, SPELL_ENRAGE, true); - break; - case DO_BANISH: - isBanished = true; - me->CastSpell(me, SPELL_BANISH, true); - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) - me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); - if (!UpdateVictim()) - return; - - if (CheckTimer <= diff) - { - Creature *Kalec = Unit::GetCreature(*me, KalecGUID); - if (!Kalec || (Kalec && !Kalec->isAlive())) - { - if (Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - Kalecgos->AI()->EnterEvadeMode(); - return; - } - if (HealthBelowPct(10) && !isEnraged) - { - if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID)) - Kalecgos->AI()->DoAction(DO_ENRAGE); - DoAction(DO_ENRAGE); - } - Creature *Kalecgos = Unit::GetCreature(*me, KalecgosGUID); - if (Kalecgos) - { - if (!Kalecgos->isInCombat()) - { - me->AI()->EnterEvadeMode(); - return; - } - } - if (!isBanished && HealthBelowPct(1)) - { - if (Kalecgos) - { - if (Kalecgos->HasAura(SPELL_BANISH)) - { - me->DealDamage(me, me->GetHealth()); - return; - } - else - DoAction(DO_BANISH); - } - else - { - me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, NULL); - EnterEvadeMode(); - return; - } - } - CheckTimer = 1000; - } else CheckTimer -= diff; - - if (ResetThreat <= diff) - { - for (std::list::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) - { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) - { - if (pUnit->GetPositionZ() > me->GetPositionZ()+5) - { - me->getThreatManager().modifyThreatPercent(pUnit,-100); - } - } - } - ResetThreat = 1000; - } else ResetThreat -= diff; - - if (ShadowBoltTimer <= diff) - { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL1, me); - DoCast(me, SPELL_SHADOW_BOLT); - ShadowBoltTimer = 7000+(rand()%3000); - } else ShadowBoltTimer -= diff; - - if (AgonyCurseTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget) pTarget = me->getVictim(); - DoCast(pTarget, SPELL_AGONY_CURSE); - AgonyCurseTimer = 20000; - } else AgonyCurseTimer -= diff; - - if (CorruptionStrikeTimer <= diff) - { - if (!(rand()%5))DoScriptText(SAY_SATH_SPELL2, me); - DoCast(me->getVictim(), SPELL_CORRUPTION_STRIKE); - CorruptionStrikeTimer = 13000; - } else CorruptionStrikeTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_kalecAI : public ScriptedAI -{ - ScriptedInstance *pInstance; - - uint32 RevitalizeTimer; - uint32 HeroicStrikeTimer; - uint32 YellTimer; - uint32 YellSequence; - - uint64 SathGUID; - - bool isEnraged; // if demon is enraged - - boss_kalecAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - void Reset() - { - if (pInstance) - SathGUID = pInstance->GetData64(DATA_SATHROVARR); - - RevitalizeTimer = 5000; - HeroicStrikeTimer = 3000; - YellTimer = 5000; - YellSequence = 0; - - isEnraged = false; - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != SathGUID) - damage = 0; - else if (isEnraged) - damage *= 3; - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY)) - me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true); - if (!UpdateVictim()) - return; - - if (YellTimer <= diff) - { - switch(YellSequence) - { - case 0: - DoScriptText(SAY_GOOD_AGGRO, me); - ++YellSequence; - break; - case 1: - if (HealthBelowPct(50)) - { - DoScriptText(SAY_GOOD_NEAR_DEATH, me); - ++YellSequence; - } - break; - case 2: - if (HealthBelowPct(10)) - { - DoScriptText(SAY_GOOD_NEAR_DEATH2, me); - ++YellSequence; - } - break; - default: - break; - } - YellTimer = 5000; - } - - if (RevitalizeTimer <= diff) - { - DoCast(me, SPELL_REVITALIZE); - RevitalizeTimer = 5000; - } else RevitalizeTimer -= diff; - - if (HeroicStrikeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HEROIC_STRIKE); - HeroicStrikeTimer = 2000; - } else HeroicStrikeTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -bool GOkalecgos_teleporter(Player* pPlayer, GameObject* pGo) -{ - uint32 SpectralPlayers = 0; - Map* pMap = pGo->GetMap(); - if (!pMap->IsDungeon()) return true; - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource() && i->getSource()->GetPositionZ() < DEMON_REALM_Z + 5) - ++SpectralPlayers; - } - if (pPlayer->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MAX_PLAYERS_IN_SPECTRAL_REALM && SpectralPlayers >= MAX_PLAYERS_IN_SPECTRAL_REALM)) - pPlayer->GetSession()->SendNotification(GO_FAILED); - else - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT_SPECTRAL, true); - return true; -} - -CreatureAI* GetAI_boss_kalecgos(Creature* pCreature) -{ - return new boss_kalecgosAI (pCreature); -} - -CreatureAI* GetAI_boss_Sathrovarr(Creature* pCreature) -{ - return new boss_sathrovarrAI (pCreature); -} - -CreatureAI* GetAI_boss_kalec(Creature* pCreature) -{ - return new boss_kalecAI (pCreature); -} void AddSC_boss_kalecgos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kalecgos"; - newscript->GetAI = &GetAI_boss_kalecgos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_sathrovarr"; - newscript->GetAI = &GetAI_boss_Sathrovarr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_kalec"; - newscript->GetAI = &GetAI_boss_kalec; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "kalecgos_teleporter"; - newscript->pGOHello = &GOkalecgos_teleporter; - newscript->RegisterSelf(); + new boss_kalecgos(); + new boss_sathrovarr(); + new boss_kalec(); + new kalecgos_teleporter(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 01b0539c5c2..04d43100bf7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -238,1172 +238,1199 @@ static Speech Speeches[]= {SAY_KALECGOS_GOODBYE, DATA_KALECGOS_KJ, 12000}, }; -//AI for Kalecgos -struct boss_kalecgos_kjAI : public ScriptedAI +//AI for Kalecgos class boss_kalecgos_kj : public CreatureScript { - boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c) +public: + boss_kalecgos_kj() : CreatureScript("boss_kalecgos_kj") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kalecgos_kjAI (pCreature); } - ScriptedInstance* pInstance; - uint8 OrbsEmpowered; - uint8 EmpowerCount; - - void Reset() + struct boss_kalecgos_kjAI : public ScriptedAI { - OrbsEmpowered = 0; - EmpowerCount = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setActive(true); - - for (uint8 i = 0; i < 4; ++i) - if (GameObject* pOrb = GetOrb(i)) - pOrb->SetGoType(GAMEOBJECT_TYPE_BUTTON); - } - - GameObject* GetOrb(int32 index) - { - if (!pInstance) - return NULL; - - switch(index) + boss_kalecgos_kjAI(Creature* c) : ScriptedAI(c) { - case 0: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); - case 1: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); - case 2: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); - case 3: - return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + pInstance = c->GetInstanceScript(); } - return NULL; - } + InstanceScript* pInstance; + uint8 OrbsEmpowered; + uint8 EmpowerCount; - void ResetOrbs() - { - me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for (uint8 i = 0; i < 4; ++i) - if (GameObject* pOrb = GetOrb(i)) - pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 0); - } + void Reset() + { + OrbsEmpowered = 0; + EmpowerCount = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setActive(true); - void EmpowerOrb(bool all) - { - GameObject* pOrbEmpowered = GetOrb(OrbsEmpowered); - if (!pOrbEmpowered) - return; + for (uint8 i = 0; i < 4; ++i) + if (GameObject* pOrb = GetOrb(i)) + pOrb->SetGoType(GAMEOBJECT_TYPE_BUTTON); + } - if (all) + GameObject* GetOrb(int32 index) + { + if (!pInstance) + return NULL; + + switch(index) + { + case 0: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_1)); + case 1: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_2)); + case 2: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_3)); + case 3: + return pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ORB_OF_THE_BLUE_DRAGONFLIGHT_4)); + } + + return NULL; + } + + void ResetOrbs() + { + me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + for (uint8 i = 0; i < 4; ++i) + if (GameObject* pOrb = GetOrb(i)) + pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 0); + } + + void EmpowerOrb(bool all) + { + GameObject* pOrbEmpowered = GetOrb(OrbsEmpowered); + if (!pOrbEmpowered) + return; + + if (all) + { + me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); + for (uint8 i = 0; i < 4; ++i) + { + if (GameObject* pOrb = GetOrb(i)) + { + pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); + pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); + pOrb->setActive(true); + pOrb->Refresh(); + } + } + DoScriptText(SAY_KALECGOS_ENCOURAGE, me); + } + else + { + if (GameObject* pOrb = GetOrb(urand(0,3))) + { + pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); + pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); + pOrb->setActive(true); + pOrb->Refresh(); + + OrbsEmpowered = (OrbsEmpowered+1)%4; + + ++EmpowerCount; + switch(EmpowerCount) + { + case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; + case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; + case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; + case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + } + } + } + } + + void UpdateAI(const uint32 diff) + { + } + + void SetRingOfBlueFlames() { me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); for (uint8 i = 0; i < 4; ++i) { if (GameObject* pOrb = GetOrb(i)) { - pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); - pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); - pOrb->setActive(true); - pOrb->Refresh(); - } - } - DoScriptText(SAY_KALECGOS_ENCOURAGE, me); - } - else - { - if (GameObject* pOrb = GetOrb(urand(0,3))) - { - pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); - pOrb->SetUInt32Value(GAMEOBJECT_FACTION, 35); - pOrb->setActive(true); - pOrb->Refresh(); - - OrbsEmpowered = (OrbsEmpowered+1)%4; - - ++EmpowerCount; - switch(EmpowerCount) - { - case 1: DoScriptText(SAY_KALEC_ORB_READY1, me); break; - case 2: DoScriptText(SAY_KALEC_ORB_READY2, me); break; - case 3: DoScriptText(SAY_KALEC_ORB_READY3, me); break; - case 4: DoScriptText(SAY_KALEC_ORB_READY4, me); break; + if (pOrb->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + { + pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); + pOrb->setActive(true); + pOrb->Refresh(); + } } } } - } + }; - void UpdateAI(const uint32 diff) +}; + class go_orb_of_the_blue_flight : public GameObjectScript +{ +public: + go_orb_of_the_blue_flight() : GameObjectScript("go_orb_of_the_blue_flight") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { + if (pGo->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + { + InstanceScript* pInstance = pGo->GetInstanceScript(); + pPlayer->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); + pPlayer->CastSpell(pPlayer, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); + pGo->SetUInt32Value(GAMEOBJECT_FACTION, 0); + + if (Creature* pKalec = Unit::GetCreature(*pPlayer, pInstance->GetData64(DATA_KALECGOS_KJ))) + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); + + pGo->Refresh(); + } + return true; } - void SetRingOfBlueFlames() - { - me->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - for (uint8 i = 0; i < 4; ++i) - { - if (GameObject* pOrb = GetOrb(i)) - { - if (pOrb->GetUInt32Value(GAMEOBJECT_FACTION) == 35) - { - pOrb->CastSpell(me, SPELL_RING_OF_BLUE_FLAMES); - pOrb->setActive(true); - pOrb->Refresh(); - } - } - } - } }; -CreatureAI* GetAI_boss_kalecgos_kj(Creature* pCreature) +//AI for Kil'jaeden Event Controller class mob_kiljaeden_controller : public CreatureScript { - return new boss_kalecgos_kjAI (pCreature); -} +public: + mob_kiljaeden_controller() : CreatureScript("mob_kiljaeden_controller") { } -bool GOHello_go_orb_of_the_blue_flight(Player* pPlayer, GameObject* pGo) -{ - if (pGo->GetUInt32Value(GAMEOBJECT_FACTION) == 35) + CreatureAI* GetAI(Creature* pCreature) const { - ScriptedInstance* pInstance = pGo->GetInstanceData(); - pPlayer->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000); - pPlayer->CastSpell(pPlayer, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, false); - pGo->SetUInt32Value(GAMEOBJECT_FACTION, 0); - - if (Creature* pKalec = Unit::GetCreature(*pPlayer, pInstance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->SetRingOfBlueFlames(); - - pGo->Refresh(); - } - return true; -} - -//AI for Kil'jaeden Event Controller -struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI -{ - mob_kiljaeden_controllerAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) - { - pInstance = c->GetInstanceData(); + return new mob_kiljaeden_controllerAI (pCreature); } - ScriptedInstance* pInstance; - SummonList summons; - - bool bSummonedDeceivers; - bool bKiljaedenDeath; - - uint32 uiRandomSayTimer; - uint32 phase; - uint8 deceiverDeathCount; - - void InitializeAI() + struct mob_kiljaeden_controllerAI : public Scripted_NoMovementAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->addUnitState(UNIT_STAT_STUNNED); - - ScriptedAI::InitializeAI(); - } - - void Reset() - { - phase = PHASE_DECEIVERS; - - if (Creature* pKalecKJ = Unit::GetCreature((*me), pInstance->GetData64(DATA_KALECGOS_KJ))) - CAST_AI(boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); - deceiverDeathCount = 0; - bSummonedDeceivers = false; - bKiljaedenDeath = false; - uiRandomSayTimer = 30000; - summons.DespawnAll(); - } - - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) + mob_kiljaeden_controllerAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) { - case CREATURE_HAND_OF_THE_DECEIVER: - summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); - break; - case CREATURE_ANVEENA: - summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); - summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - break; - case CREATURE_KILJAEDEN: - summoned->CastSpell(summoned, SPELL_REBIRTH, false); - summoned->AddThreat(me->getVictim(), 1.0f); - break; + pInstance = c->GetInstanceScript(); } - summons.Summon(summoned); - } - void UpdateAI(const uint32 diff) - { - if (uiRandomSayTimer < diff) + InstanceScript* pInstance; + SummonList summons; + + bool bSummonedDeceivers; + bool bKiljaedenDeath; + + uint32 uiRandomSayTimer; + uint32 phase; + uint8 deceiverDeathCount; + + void InitializeAI() { - if (pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) - DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), me); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->addUnitState(UNIT_STAT_STUNNED); + + ScriptedAI::InitializeAI(); + } + + void Reset() + { + phase = PHASE_DECEIVERS; + + if (Creature* pKalecKJ = Unit::GetCreature((*me), pInstance->GetData64(DATA_KALECGOS_KJ))) + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalecKJ->AI())->ResetOrbs(); + deceiverDeathCount = 0; + bSummonedDeceivers = false; + bKiljaedenDeath = false; uiRandomSayTimer = 30000; - } else uiRandomSayTimer -= diff; - - if (!bSummonedDeceivers) - { - for (uint8 i = 0; i < 3; ++i) - me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); - - DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); - DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); - bSummonedDeceivers = true; + summons.DespawnAll(); } - if (deceiverDeathCount > 2 && phase == PHASE_DECEIVERS) + void JustSummoned(Creature* summoned) { - me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); - phase = PHASE_NORMAL; - DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0,0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + switch(summoned->GetEntry()) + { + case CREATURE_HAND_OF_THE_DECEIVER: + summoned->CastSpell(summoned, SPELL_SHADOW_CHANNELING, false); + break; + case CREATURE_ANVEENA: + summoned->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING); + summoned->CastSpell(summoned, SPELL_ANVEENA_PRISON, true); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + break; + case CREATURE_KILJAEDEN: + summoned->CastSpell(summoned, SPELL_REBIRTH, false); + summoned->AddThreat(me->getVictim(), 1.0f); + break; + } + summons.Summon(summoned); } - } + + void UpdateAI(const uint32 diff) + { + if (uiRandomSayTimer < diff) + { + if (pInstance && pInstance->GetData(DATA_MURU_EVENT) != DONE && pInstance->GetData(DATA_KILJAEDEN_EVENT) == NOT_STARTED) + DoScriptText(RAND(SAY_KJ_OFFCOMBAT1,SAY_KJ_OFFCOMBAT2,SAY_KJ_OFFCOMBAT3,SAY_KJ_OFFCOMBAT4,SAY_KJ_OFFCOMBAT5), me); + uiRandomSayTimer = 30000; + } else uiRandomSayTimer -= diff; + + if (!bSummonedDeceivers) + { + for (uint8 i = 0; i < 3; ++i) + me->SummonCreature(CREATURE_HAND_OF_THE_DECEIVER, DeceiverLocations[i], TEMPSUMMON_DEAD_DESPAWN, 0); + + DoSpawnCreature(CREATURE_ANVEENA, 0, 0, 40, 0, TEMPSUMMON_DEAD_DESPAWN, 0); + DoCast(me, SPELL_ANVEENA_ENERGY_DRAIN); + bSummonedDeceivers = true; + } + + if (deceiverDeathCount > 2 && phase == PHASE_DECEIVERS) + { + me->RemoveAurasDueToSpell(SPELL_ANVEENA_ENERGY_DRAIN); + phase = PHASE_NORMAL; + DoSpawnCreature(CREATURE_KILJAEDEN, 0, 0,0, 0, TEMPSUMMON_MANUAL_DESPAWN, 0); + } + } + }; + }; -CreatureAI* GetAI_mob_kiljaeden_controller(Creature* pCreature) + +//AI for Kil'jaeden class boss_kiljaeden : public CreatureScript { - return new mob_kiljaeden_controllerAI (pCreature); -} +public: + boss_kiljaeden() : CreatureScript("boss_kiljaeden") { } -//AI for Kil'jaeden -struct boss_kiljaedenAI : public Scripted_NoMovementAI -{ - boss_kiljaedenAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kiljaedenAI (pCreature); } - ScriptedInstance* pInstance; - SummonList summons; - - uint8 Phase; - uint8 ActiveTimers; - uint32 SpeechTimer; - - uint32 Timer[10]; - uint32 WaitTimer; - uint8 speechCount; - uint8 speechPhaseEnd; - - /* Boolean */ - bool IsInDarkness; - bool TimerIsDeactivated[10]; - bool IsWaiting; - bool OrbActivated; - bool SpeechBegins; - - void InitializeAI() + struct boss_kiljaedenAI : public Scripted_NoMovementAI { - Scripted_NoMovementAI::InitializeAI(); - } - - void Reset() - { - TimerIsDeactivated[TIMER_SPEECH] = false; - Timer[TIMER_SPEECH] = 0; - - //Phase 2 Timer - Timer[TIMER_SOUL_FLAY] = 11000; - Timer[TIMER_LEGION_LIGHTNING] = 30000; - Timer[TIMER_FIRE_BLOOM] = 20000; - Timer[TIMER_SUMMON_SHILEDORB] = 35000; - - //Phase 3 Timer - Timer[TIMER_SHADOW_SPIKE] = 4000; - Timer[TIMER_FLAME_DART] = 3000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_ORBS_EMPOWER] = 35000; - - //Phase 4 Timer - Timer[TIMER_ARMAGEDDON] = 2000; - - ActiveTimers = 5; - WaitTimer = 0; - speechCount = 0; - SpeechTimer = 0; - - Phase = PHASE_NORMAL; - - IsInDarkness = false; - IsWaiting = false; - OrbActivated = false; - SpeechBegins = true; - - if (pInstance) + boss_kiljaedenAI(Creature* c) : Scripted_NoMovementAI(c), summons(me) { - if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) - pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); - } - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); - ChangeTimers(false, 0); - summons.DespawnAll(); - } - - void ChangeTimers(bool status, uint32 WTimer) - { - for (uint8 i = 1; i < ActiveTimers; ++i) - TimerIsDeactivated[i] = status; - - if (WTimer > 0) - { - IsWaiting = true; - WaitTimer = WTimer; + pInstance = c->GetInstanceScript(); } - if (OrbActivated) - TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; - if (Timer[TIMER_SHADOW_SPIKE] == 0) - TimerIsDeactivated[TIMER_SHADOW_SPIKE] = true; - if (Phase == PHASE_SACRIFICE) - TimerIsDeactivated[TIMER_SUMMON_SHILEDORB] = true; - } + InstanceScript* pInstance; + SummonList summons; - void JustSummoned(Creature* summoned) - { - if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) + uint8 Phase; + uint8 ActiveTimers; + uint32 SpeechTimer; + + uint32 Timer[10]; + uint32 WaitTimer; + uint8 speechCount; + uint8 speechPhaseEnd; + + /* Boolean */ + bool IsInDarkness; + bool TimerIsDeactivated[10]; + bool IsWaiting; + bool OrbActivated; + bool SpeechBegins; + + void InitializeAI() { - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - // summoned->SetVisibility(VISIBILITY_OFF); //with this we cant see the armageddon visuals + Scripted_NoMovementAI::InitializeAI(); } - else - summoned->SetLevel(me->getLevel()); - summoned->setFaction(me->getFaction()); - summons.Summon(summoned); - } - - void JustDied(Unit* killer) - { - DoScriptText(SAY_KJ_DEATH, me); - summons.DespawnAll(); - - if (pInstance) - pInstance->SetData(DATA_KILJAEDEN_EVENT, DONE); - } - - void KilledUnit(Unit* victim) - { - DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), me); - } - - void EnterEvadeMode() - { - Scripted_NoMovementAI::EnterEvadeMode(); - summons.DespawnAll(); - - // Reset the controller - if (pInstance) + void Reset() { - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - CAST_AI(mob_kiljaeden_controllerAI, pControl->AI())->Reset(); - } - } + TimerIsDeactivated[TIMER_SPEECH] = false; + Timer[TIMER_SPEECH] = 0; - void EnterCombat(Unit* who) - { - DoZoneInCombat(); - } + //Phase 2 Timer + Timer[TIMER_SOUL_FLAY] = 11000; + Timer[TIMER_LEGION_LIGHTNING] = 30000; + Timer[TIMER_FIRE_BLOOM] = 20000; + Timer[TIMER_SUMMON_SHILEDORB] = 35000; - void EnterNextPhase() - { - SpeechBegins = true; - OrbActivated = false; - ChangeTimers(true, 0);//stop every cast Shadow spike will reactivate em all - TimerIsDeactivated[TIMER_SHADOW_SPIKE] = false; - Timer[TIMER_SHADOW_SPIKE] = 100; - // empowered orbs before darkness - Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(10000,40000); - Timer[TIMER_ORBS_EMPOWER] = (Phase == PHASE_SACRIFICE) ? 10000 : 5000; - } + //Phase 3 Timer + Timer[TIMER_SHADOW_SPIKE] = 4000; + Timer[TIMER_FLAME_DART] = 3000; + Timer[TIMER_DARKNESS] = 45000; + Timer[TIMER_ORBS_EMPOWER] = 35000; - void CastSinisterReflection() - { - DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), me); - for (uint8 i = 0; i < 4; ++i) - { - float x,y,z; - Unit *pTarget; - for (uint8 z = 0; z < 6; ++z) + //Phase 4 Timer + Timer[TIMER_ARMAGEDDON] = 2000; + + ActiveTimers = 5; + WaitTimer = 0; + speechCount = 0; + SpeechTimer = 0; + + Phase = PHASE_NORMAL; + + IsInDarkness = false; + IsWaiting = false; + OrbActivated = false; + SpeechBegins = true; + + if (pInstance) { - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; + if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) + pKalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES); } - if (pTarget) + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 12); + ChangeTimers(false, 0); + summons.DespawnAll(); + } + + void ChangeTimers(bool status, uint32 WTimer) + { + for (uint8 i = 1; i < ActiveTimers; ++i) + TimerIsDeactivated[i] = status; + + if (WTimer > 0) { - pTarget->GetPosition(x,y,z); - if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x,y,z,0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + IsWaiting = true; + WaitTimer = WTimer; + } + + if (OrbActivated) + TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; + if (Timer[TIMER_SHADOW_SPIKE] == 0) + TimerIsDeactivated[TIMER_SHADOW_SPIKE] = true; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactivated[TIMER_SUMMON_SHILEDORB] = true; + } + + void JustSummoned(Creature* summoned) + { + if (summoned->GetEntry() == CREATURE_ARMAGEDDON_TARGET) + { + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + // summoned->SetVisibility(VISIBILITY_OFF); //with this we cant see the armageddon visuals + } + else + summoned->SetLevel(me->getLevel()); + + summoned->setFaction(me->getFaction()); + summons.Summon(summoned); + } + + void JustDied(Unit* killer) + { + DoScriptText(SAY_KJ_DEATH, me); + summons.DespawnAll(); + + if (pInstance) + pInstance->SetData(DATA_KILJAEDEN_EVENT, DONE); + } + + void KilledUnit(Unit* victim) + { + DoScriptText(RAND(SAY_KJ_SLAY1,SAY_KJ_SLAY2), me); + } + + void EnterEvadeMode() + { + Scripted_NoMovementAI::EnterEvadeMode(); + summons.DespawnAll(); + + // Reset the controller + if (pInstance) + { + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + CAST_AI(mob_kiljaeden_controller::mob_kiljaeden_controllerAI, pControl->AI())->Reset(); + } + } + + void EnterCombat(Unit* who) + { + DoZoneInCombat(); + } + + void EnterNextPhase() + { + SpeechBegins = true; + OrbActivated = false; + ChangeTimers(true, 0);//stop every cast Shadow spike will reactivate em all + TimerIsDeactivated[TIMER_SHADOW_SPIKE] = false; + Timer[TIMER_SHADOW_SPIKE] = 100; + // empowered orbs before darkness + Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(10000,40000); + Timer[TIMER_ORBS_EMPOWER] = (Phase == PHASE_SACRIFICE) ? 10000 : 5000; + } + + void CastSinisterReflection() + { + DoScriptText(RAND(SAY_KJ_REFLECTION1,SAY_KJ_REFLECTION2), me); + for (uint8 i = 0; i < 4; ++i) + { + float x,y,z; + Unit *pTarget; + for (uint8 z = 0; z < 6; ++z) { - pSinisterReflection->SetDisplayId(pTarget->GetDisplayId()); - pSinisterReflection->AI()->AttackStart(pTarget); + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0))break; + } + if (pTarget) + { + pTarget->GetPosition(x,y,z); + if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x,y,z,0, TEMPSUMMON_CORPSE_DESPAWN, 0)) + { + pSinisterReflection->SetDisplayId(pTarget->GetDisplayId()); + pSinisterReflection->AI()->AttackStart(pTarget); + } } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || Phase < PHASE_NORMAL) - return; - - if (IsWaiting) + void UpdateAI(const uint32 diff) { - if (WaitTimer <= diff) - { - IsWaiting = false; - ChangeTimers(false, 0); - } else WaitTimer -= diff; - } + if (!UpdateVictim() || Phase < PHASE_NORMAL) + return; - for (uint8 t = 0; t < ActiveTimers; ++t) - { - if (Timer[t] < diff && !TimerIsDeactivated[t]) + if (IsWaiting) { - switch(t) + if (WaitTimer <= diff) { - case TIMER_SPEECH: - if (SpeechBegins) - { - SpeechBegins=false; - switch(Phase) - { - case PHASE_NORMAL: - speechPhaseEnd=1; - break; - case PHASE_DARKNESS: - speechPhaseEnd=4; - break; - case PHASE_ARMAGEDDON: - speechPhaseEnd=7; - break; - case PHASE_SACRIFICE: - speechPhaseEnd=12; - break; - } - } - if (Speeches[speechCount].timer < SpeechTimer) - { - SpeechTimer = 0; - if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature))) - DoScriptText(Speeches[speechCount].textid, pSpeechCreature); - if (speechCount == 12) - if (Creature* pAnveena = Unit::GetCreature(*me, pInstance->GetData64(DATA_ANVEENA))) - pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); - // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds - if (speechCount == speechPhaseEnd) - TimerIsDeactivated[TIMER_SPEECH]=true; - speechCount++; - } - SpeechTimer += diff; - break; - case TIMER_SOUL_FLAY: - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(me->getVictim(), SPELL_SOUL_FLAY_SLOW, false); - DoCast(me->getVictim(), SPELL_SOUL_FLAY, false); - Timer[TIMER_SOUL_FLAY] = 3500; - } - break; - case TIMER_LEGION_LIGHTNING: - if (!me->IsNonMeleeSpellCasted(false)) - { - Unit* pRandomPlayer; + IsWaiting = false; + ChangeTimers(false, 0); + } else WaitTimer -= diff; + } - me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); + for (uint8 t = 0; t < ActiveTimers; ++t) + { + if (Timer[t] < diff && !TimerIsDeactivated[t]) + { + switch(t) + { + case TIMER_SPEECH: + if (SpeechBegins) + { + SpeechBegins=false; + switch(Phase) + { + case PHASE_NORMAL: + speechPhaseEnd=1; + break; + case PHASE_DARKNESS: + speechPhaseEnd=4; + break; + case PHASE_ARMAGEDDON: + speechPhaseEnd=7; + break; + case PHASE_SACRIFICE: + speechPhaseEnd=12; + break; + } + } + if (Speeches[speechCount].timer < SpeechTimer) + { + SpeechTimer = 0; + if (Creature* pSpeechCreature = Unit::GetCreature(*me, pInstance->GetData64(Speeches[speechCount].pCreature))) + DoScriptText(Speeches[speechCount].textid, pSpeechCreature); + if (speechCount == 12) + if (Creature* pAnveena = Unit::GetCreature(*me, pInstance->GetData64(DATA_ANVEENA))) + pAnveena->CastSpell(me, SPELL_SACRIFICE_OF_ANVEENA, false); + // ChangeTimers(true, 10000); // Kil should do an emote while screaming without attacking for 10 seconds + if (speechCount == speechPhaseEnd) + TimerIsDeactivated[TIMER_SPEECH]=true; + speechCount++; + } + SpeechTimer += diff; + break; + case TIMER_SOUL_FLAY: + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me->getVictim(), SPELL_SOUL_FLAY_SLOW, false); + DoCast(me->getVictim(), SPELL_SOUL_FLAY, false); + Timer[TIMER_SOUL_FLAY] = 3500; + } + break; + case TIMER_LEGION_LIGHTNING: + if (!me->IsNonMeleeSpellCasted(false)) + { + Unit* pRandomPlayer; + + me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); + for (uint8 z = 0; z < 6; ++z) + { + pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) + break; + } + + if (pRandomPlayer) + DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); + else + sLog.outError("try to cast SPELL_LEGION_LIGHTNING on invalid target"); + + Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE + Timer[TIMER_SOUL_FLAY] = 2500; + } + break; + case TIMER_FIRE_BLOOM: + if (!me->IsNonMeleeSpellCasted(false)) + { + me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); + DoCastAOE(SPELL_FIRE_BLOOM, false); + Timer[TIMER_FIRE_BLOOM] = (Phase == PHASE_SACRIFICE) ? 25000 : 40000; // 25 seconds in PHASE_SACRIFICE + Timer[TIMER_SOUL_FLAY] = 1000; + } + break; + case TIMER_SUMMON_SHILEDORB: + for (uint8 i = 1; i < Phase; ++i) + { + float sx, sy; + sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); + sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); + me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + } + Timer[TIMER_SUMMON_SHILEDORB] = urand(30000,60000); // 30-60seconds cooldown + Timer[TIMER_SOUL_FLAY] = 2000; + break; + case TIMER_SHADOW_SPIKE: //Phase 3 + if (!me->IsNonMeleeSpellCasted(false)) + { + CastSinisterReflection(); + DoCastAOE(SPELL_SHADOW_SPIKE, false); + ChangeTimers(true, 30000); + Timer[TIMER_SHADOW_SPIKE] = 0; + TimerIsDeactivated[TIMER_SPEECH] = false; + } + break; + case TIMER_FLAME_DART: //Phase 3 + DoCastAOE(SPELL_FLAME_DART, false); + Timer[TIMER_FLAME_DART] = 3000; //TODO Timer + break; + case TIMER_DARKNESS: //Phase 3 + if (!me->IsNonMeleeSpellCasted(false)) + { + // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. + if (!IsInDarkness) + { + DoScriptText(EMOTE_KJ_DARKNESS, me); + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); + ChangeTimers(true, 9000); + Timer[TIMER_DARKNESS] = 8750; + TimerIsDeactivated[TIMER_DARKNESS] = false; + if (Phase == PHASE_SACRIFICE) + TimerIsDeactivated[TIMER_ARMAGEDDON] = false; + IsInDarkness = true; + } + else + { + Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000,70000); + IsInDarkness = false; + DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); + DoScriptText(RAND(SAY_KJ_DARKNESS1,SAY_KJ_DARKNESS2,SAY_KJ_DARKNESS3), me); + } + Timer[TIMER_SOUL_FLAY] = 9000; + } + break; + case TIMER_ORBS_EMPOWER: //Phase 3 + if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) + { + switch (Phase) + { + case PHASE_SACRIFICE: + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); + break; + default: + CAST_AI(boss_kalecgos_kj::boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); + break; + } + } + OrbActivated = true; + TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; + break; + case TIMER_ARMAGEDDON: //Phase 4 + Unit *pTarget; for (uint8 z = 0; z < 6; ++z) { - pRandomPlayer = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pRandomPlayer || !pRandomPlayer->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) - break; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; } - - if (pRandomPlayer) - DoCast(pRandomPlayer, SPELL_LEGION_LIGHTNING, false); - else - sLog.outError("try to cast SPELL_LEGION_LIGHTNING on invalid target"); - - Timer[TIMER_LEGION_LIGHTNING] = (Phase == PHASE_SACRIFICE) ? 18000 : 30000; // 18 seconds in PHASE_SACRIFICE - Timer[TIMER_SOUL_FLAY] = 2500; - } - break; - case TIMER_FIRE_BLOOM: - if (!me->IsNonMeleeSpellCasted(false)) - { - me->RemoveAurasDueToSpell(SPELL_SOUL_FLAY); - DoCastAOE(SPELL_FIRE_BLOOM, false); - Timer[TIMER_FIRE_BLOOM] = (Phase == PHASE_SACRIFICE) ? 25000 : 40000; // 25 seconds in PHASE_SACRIFICE - Timer[TIMER_SOUL_FLAY] = 1000; - } - break; - case TIMER_SUMMON_SHILEDORB: - for (uint8 i = 1; i < Phase; ++i) - { - float sx, sy; - sx = ShieldOrbLocations[0][0] + sin(ShieldOrbLocations[i][0]); - sy = ShieldOrbLocations[0][1] + sin(ShieldOrbLocations[i][1]); - me->SummonCreature(CREATURE_SHIELD_ORB, sx, sy, SHIELD_ORB_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - } - Timer[TIMER_SUMMON_SHILEDORB] = urand(30000,60000); // 30-60seconds cooldown - Timer[TIMER_SOUL_FLAY] = 2000; - break; - case TIMER_SHADOW_SPIKE: //Phase 3 - if (!me->IsNonMeleeSpellCasted(false)) - { - CastSinisterReflection(); - DoCastAOE(SPELL_SHADOW_SPIKE, false); - ChangeTimers(true, 30000); - Timer[TIMER_SHADOW_SPIKE] = 0; - TimerIsDeactivated[TIMER_SPEECH] = false; - } - break; - case TIMER_FLAME_DART: //Phase 3 - DoCastAOE(SPELL_FLAME_DART, false); - Timer[TIMER_FLAME_DART] = 3000; //TODO Timer - break; - case TIMER_DARKNESS: //Phase 3 - if (!me->IsNonMeleeSpellCasted(false)) - { - // Begins to channel for 8 seconds, then deals 50'000 damage to all raid members. - if (!IsInDarkness) + if (pTarget) { - DoScriptText(EMOTE_KJ_DARKNESS, me); - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS, false); - ChangeTimers(true, 9000); - Timer[TIMER_DARKNESS] = 8750; - TimerIsDeactivated[TIMER_DARKNESS] = false; - if (Phase == PHASE_SACRIFICE) - TimerIsDeactivated[TIMER_ARMAGEDDON] = false; - IsInDarkness = true; + float x, y, z; + pTarget->GetPosition(x, y, z); + me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x,y,z,0, TEMPSUMMON_TIMED_DESPAWN,15000); } - else - { - Timer[TIMER_DARKNESS] = (Phase == PHASE_SACRIFICE) ? 15000 : urand(40000,70000); - IsInDarkness = false; - DoCastAOE(SPELL_DARKNESS_OF_A_THOUSAND_SOULS_DAMAGE); - DoScriptText(RAND(SAY_KJ_DARKNESS1,SAY_KJ_DARKNESS2,SAY_KJ_DARKNESS3), me); - } - Timer[TIMER_SOUL_FLAY] = 9000; - } - break; - case TIMER_ORBS_EMPOWER: //Phase 3 - if (Creature* pKalec = Unit::GetCreature(*me, pInstance->GetData64(DATA_KALECGOS_KJ))) - { - switch (Phase) - { - case PHASE_SACRIFICE: - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(true); - break; - default: - CAST_AI(boss_kalecgos_kjAI, pKalec->AI())->EmpowerOrb(false); - break; - } - } - OrbActivated = true; - TimerIsDeactivated[TIMER_ORBS_EMPOWER] = true; - break; - case TIMER_ARMAGEDDON: //Phase 4 - Unit *pTarget; - for (uint8 z = 0; z < 6; ++z) - { - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!pTarget || !pTarget->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT,0)) break; - } - if (pTarget) - { - float x, y, z; - pTarget->GetPosition(x, y, z); - me->SummonCreature(CREATURE_ARMAGEDDON_TARGET, x,y,z,0, TEMPSUMMON_TIMED_DESPAWN,15000); - } - Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding - break; - } - } - } - DoMeleeAttackIfReady(); - //Time runs over! - for (uint8 i = 0; i < ActiveTimers; ++i) - if (!TimerIsDeactivated[i]) - { - Timer[i] -= diff; - if (((int32)Timer[i]) < 0) Timer[i] = 0; - } - - //Phase 3 - if (Phase <= PHASE_NORMAL && !IsInDarkness) - { - if (Phase == PHASE_NORMAL && HealthBelowPct(85)) - { - Phase = PHASE_DARKNESS; - ActiveTimers = 9; - EnterNextPhase(); - } - else return; - } - - //Phase 4 - if (Phase <= PHASE_DARKNESS && !IsInDarkness) - { - if (Phase == PHASE_DARKNESS && HealthBelowPct(55)) - { - Phase = PHASE_ARMAGEDDON; - ActiveTimers = 10; - EnterNextPhase(); - } - else return; - } - - //Phase 5 specific spells all we can - if (Phase <= PHASE_ARMAGEDDON && !IsInDarkness) - { - if (Phase == PHASE_ARMAGEDDON && HealthBelowPct(25)) - { - Phase = PHASE_SACRIFICE; - EnterNextPhase(); - } - else return; - } - } -}; - -CreatureAI* GetAI_boss_kiljaeden(Creature* pCreature) -{ - return new boss_kiljaedenAI (pCreature); -} - -//AI for Hand of the Deceiver -struct mob_hand_of_the_deceiverAI : public ScriptedAI -{ - mob_hand_of_the_deceiverAI(Creature* c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 ShadowBoltVolleyTimer; - uint32 FelfirePortalTimer; - - void Reset() - { - // TODO: Timers! - ShadowBoltVolleyTimer = urand(8000,14000); // So they don't all cast it in the same moment. - FelfirePortalTimer = 20000; - if (pInstance) - pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); - } - - void JustSummoned(Creature* summoned) - { - summoned->setFaction(me->getFaction()); - summoned->SetLevel(me->getLevel()); - } - - void EnterCombat(Unit* who) - { - if (pInstance) - { - pInstance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - pControl->AddThreat(who, 1.0f); - } - me->InterruptNonMeleeSpells(true); - } - - void JustDied(Unit* killer) - { - if (!pInstance) - return; - - if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) - ++(CAST_AI(mob_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); - } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - DoCast(me, SPELL_SHADOW_CHANNELING); - - if (!UpdateVictim()) - return; - - // Gain Shadow Infusion at 20% health - if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0)) - DoCast(me, SPELL_SHADOW_INFUSION, true); - - // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. - if (ShadowBoltVolleyTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); - ShadowBoltVolleyTimer = 12000; - } - else - ShadowBoltVolleyTimer -= diff; - - // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. - if (FelfirePortalTimer <= diff) - { - if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) - { - std::list::iterator itr; - for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) - { - Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pUnit) - pPortal->AddThreat(pUnit, 1.0f); + Timer[TIMER_ARMAGEDDON] = 2000; // No, I'm not kidding + break; + } } } - FelfirePortalTimer = 20000; - } else FelfirePortalTimer -= diff; + DoMeleeAttackIfReady(); + //Time runs over! + for (uint8 i = 0; i < ActiveTimers; ++i) + if (!TimerIsDeactivated[i]) + { + Timer[i] -= diff; + if (((int32)Timer[i]) < 0) Timer[i] = 0; + } - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_hand_of_the_deceiver(Creature* pCreature) -{ - return new mob_hand_of_the_deceiverAI (pCreature); -} - -//AI for Felfire Portal -struct mob_felfire_portalAI : public Scripted_NoMovementAI -{ - mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} - - uint32 uiSpawnFiendTimer; - - void Reset() - { - uiSpawnFiendTimer = 5000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - } - - void JustSummoned(Creature* summoned) - { - summoned->setFaction(me->getFaction()); - summoned->SetLevel(me->getLevel()); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiSpawnFiendTimer <= diff) - { - if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) - pFiend->AddThreat(SelectUnit(SELECT_TARGET_RANDOM,0), 100000.0f); - uiSpawnFiendTimer = urand(4000,8000); - } else uiSpawnFiendTimer -= diff; - } -}; - -CreatureAI* GetAI_mob_felfire_portal(Creature* pCreature) -{ - return new mob_felfire_portalAI (pCreature); -} - -//AI for Felfire Fiend -struct mob_volatile_felfire_fiendAI : public ScriptedAI -{ - mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} - - uint32 uiExplodeTimer; - - bool bLockedTarget; - - void Reset() - { - uiExplodeTimer = 2000; - bLockedTarget = false; - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage > me->GetHealth()) - DoCast(me, SPELL_FELFIRE_FISSION, true); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!bLockedTarget) - { - me->AddThreat(me->getVictim(), 10000000.0f); - bLockedTarget = true; - } - - if (uiExplodeTimer) - { - if (uiExplodeTimer <= diff) - uiExplodeTimer = 0; - else uiExplodeTimer -= diff; - } - else if (me->IsWithinDistInMap(me->getVictim(), 3)) // Explode if it's close enough to it's target - { - DoCast(me->getVictim(), SPELL_FELFIRE_FISSION); - me->Kill(me); - } - } -}; - -CreatureAI* GetAI_mob_volatile_felfire_fiend(Creature* pCreature) -{ - return new mob_volatile_felfire_fiendAI (pCreature); -} - -//AI for Armageddon target -struct mob_armageddonAI : public Scripted_NoMovementAI -{ - mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} - - uint8 spell; - uint32 uiTimer; - - void Reset() - { - spell = 0; - uiTimer = 0; - } - - void UpdateAI(const uint32 diff) - { - if (uiTimer <= diff) - { - switch(spell) + //Phase 3 + if (Phase <= PHASE_NORMAL && !IsInDarkness) { - case 0: - DoCast(me, SPELL_ARMAGEDDON_VISUAL, true); - ++spell; - break; - case 1: - DoCast(me, SPELL_ARMAGEDDON_VISUAL2, true); - uiTimer = 9000; - ++spell; - break; - case 2: - DoCast(me, SPELL_ARMAGEDDON_TRIGGER, true); - ++spell; - uiTimer = 5000; - break; - case 3: - me->Kill(me); - me->RemoveCorpse(); - break; + if (Phase == PHASE_NORMAL && HealthBelowPct(85)) + { + Phase = PHASE_DARKNESS; + ActiveTimers = 9; + EnterNextPhase(); + } + else return; } - } else uiTimer -=diff; - } + + //Phase 4 + if (Phase <= PHASE_DARKNESS && !IsInDarkness) + { + if (Phase == PHASE_DARKNESS && HealthBelowPct(55)) + { + Phase = PHASE_ARMAGEDDON; + ActiveTimers = 10; + EnterNextPhase(); + } + else return; + } + + //Phase 5 specific spells all we can + if (Phase <= PHASE_ARMAGEDDON && !IsInDarkness) + { + if (Phase == PHASE_ARMAGEDDON && HealthBelowPct(25)) + { + Phase = PHASE_SACRIFICE; + EnterNextPhase(); + } + else return; + } + } + }; + }; -CreatureAI* GetAI_mob_armageddon(Creature* pCreature) -{ - return new mob_armageddonAI (pCreature); -} -//AI for Shield Orbs -struct mob_shield_orbAI : public ScriptedAI +//AI for Hand of the Deceiver class mob_hand_of_the_deceiver : public CreatureScript { - mob_shield_orbAI(Creature* c) : ScriptedAI(c) +public: + mob_hand_of_the_deceiver() : CreatureScript("mob_hand_of_the_deceiver") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_hand_of_the_deceiverAI (pCreature); } - ScriptedInstance* pInstance; - - bool bPointReached; - bool bClockwise; - uint32 uiTimer; - uint32 uiCheckTimer; - float x, y, r, c, mx, my; - - void Reset() + struct mob_hand_of_the_deceiverAI : public ScriptedAI { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - bPointReached = true; - uiTimer = urand(500,1000); - uiCheckTimer = 1000; - r = 17; - c = 0; - mx = ShieldOrbLocations[0][0]; - my = ShieldOrbLocations[0][1]; - bClockwise = urand(0,1); - } - - void UpdateAI(const uint32 diff) - { - if (bPointReached) + mob_hand_of_the_deceiverAI(Creature* c) : ScriptedAI(c) { - if (bClockwise) + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 ShadowBoltVolleyTimer; + uint32 FelfirePortalTimer; + + void Reset() + { + // TODO: Timers! + ShadowBoltVolleyTimer = urand(8000,14000); // So they don't all cast it in the same moment. + FelfirePortalTimer = 20000; + if (pInstance) + pInstance->SetData(DATA_KILJAEDEN_EVENT, NOT_STARTED); + } + + void JustSummoned(Creature* summoned) + { + summoned->setFaction(me->getFaction()); + summoned->SetLevel(me->getLevel()); + } + + void EnterCombat(Unit* who) + { + if (pInstance) { - y = my - r * sin(c); - x = mx - r * cos(c); + pInstance->SetData(DATA_KILJAEDEN_EVENT, IN_PROGRESS); + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + pControl->AddThreat(who, 1.0f); + } + me->InterruptNonMeleeSpells(true); + } + + void JustDied(Unit* killer) + { + if (!pInstance) + return; + + if (Creature* pControl = Unit::GetCreature(*me, pInstance->GetData64(DATA_KILJAEDEN_CONTROLLER))) + ++(CAST_AI(mob_kiljaeden_controller::mob_kiljaeden_controllerAI, pControl->AI())->deceiverDeathCount); + } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) + DoCast(me, SPELL_SHADOW_CHANNELING); + + if (!UpdateVictim()) + return; + + // Gain Shadow Infusion at 20% health + if (HealthBelowPct(20) && !me->HasAura(SPELL_SHADOW_INFUSION, 0)) + DoCast(me, SPELL_SHADOW_INFUSION, true); + + // Shadow Bolt Volley - Shoots Shadow Bolts at all enemies within 30 yards, for ~2k Shadow damage. + if (ShadowBoltVolleyTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT_VOLLEY); + ShadowBoltVolleyTimer = 12000; + } + else + ShadowBoltVolleyTimer -= diff; + + // Felfire Portal - Creatres a portal, that spawns Volatile Felfire Fiends, which do suicide bombing. + if (FelfirePortalTimer <= diff) + { + if (Creature* pPortal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + { + std::list::iterator itr; + for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + { + Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pUnit) + pPortal->AddThreat(pUnit, 1.0f); + } + } + FelfirePortalTimer = 20000; + } else FelfirePortalTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + + +//AI for Felfire Portal class mob_felfire_portal : public CreatureScript +{ +public: + mob_felfire_portal() : CreatureScript("mob_felfire_portal") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_felfire_portalAI (pCreature); + } + + struct mob_felfire_portalAI : public Scripted_NoMovementAI + { + mob_felfire_portalAI(Creature* c) : Scripted_NoMovementAI(c) {} + + uint32 uiSpawnFiendTimer; + + void Reset() + { + uiSpawnFiendTimer = 5000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); + } + + void JustSummoned(Creature* summoned) + { + summoned->setFaction(me->getFaction()); + summoned->SetLevel(me->getLevel()); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiSpawnFiendTimer <= diff) + { + if (Creature* pFiend = DoSpawnCreature(CREATURE_VOLATILE_FELFIRE_FIEND, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + pFiend->AddThreat(SelectUnit(SELECT_TARGET_RANDOM,0), 100000.0f); + uiSpawnFiendTimer = urand(4000,8000); + } else uiSpawnFiendTimer -= diff; + } + }; + +}; + + +//AI for Felfire Fiend class mob_volatile_felfire_fiend : public CreatureScript +{ +public: + mob_volatile_felfire_fiend() : CreatureScript("mob_volatile_felfire_fiend") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_volatile_felfire_fiendAI (pCreature); + } + + struct mob_volatile_felfire_fiendAI : public ScriptedAI + { + mob_volatile_felfire_fiendAI(Creature* c) : ScriptedAI(c) {} + + uint32 uiExplodeTimer; + + bool bLockedTarget; + + void Reset() + { + uiExplodeTimer = 2000; + bLockedTarget = false; + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage > me->GetHealth()) + DoCast(me, SPELL_FELFIRE_FISSION, true); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!bLockedTarget) + { + me->AddThreat(me->getVictim(), 10000000.0f); + bLockedTarget = true; + } + + if (uiExplodeTimer) + { + if (uiExplodeTimer <= diff) + uiExplodeTimer = 0; + else uiExplodeTimer -= diff; + } + else if (me->IsWithinDistInMap(me->getVictim(), 3)) // Explode if it's close enough to it's target + { + DoCast(me->getVictim(), SPELL_FELFIRE_FISSION); + me->Kill(me); + } + } + }; + +}; + + +//AI for Armageddon target class mob_armageddon : public CreatureScript +{ +public: + mob_armageddon() : CreatureScript("mob_armageddon") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_armageddonAI (pCreature); + } + + struct mob_armageddonAI : public Scripted_NoMovementAI + { + mob_armageddonAI(Creature* c) : Scripted_NoMovementAI(c) {} + + uint8 spell; + uint32 uiTimer; + + void Reset() + { + spell = 0; + uiTimer = 0; + } + + void UpdateAI(const uint32 diff) + { + if (uiTimer <= diff) + { + switch(spell) + { + case 0: + DoCast(me, SPELL_ARMAGEDDON_VISUAL, true); + ++spell; + break; + case 1: + DoCast(me, SPELL_ARMAGEDDON_VISUAL2, true); + uiTimer = 9000; + ++spell; + break; + case 2: + DoCast(me, SPELL_ARMAGEDDON_TRIGGER, true); + ++spell; + uiTimer = 5000; + break; + case 3: + me->Kill(me); + me->RemoveCorpse(); + break; + } + } else uiTimer -=diff; + } + }; + +}; + + +//AI for Shield Orbs class mob_shield_orb : public CreatureScript +{ +public: + mob_shield_orb() : CreatureScript("mob_shield_orb") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shield_orbAI (pCreature); + } + + struct mob_shield_orbAI : public ScriptedAI + { + mob_shield_orbAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + bool bPointReached; + bool bClockwise; + uint32 uiTimer; + uint32 uiCheckTimer; + float x, y, r, c, mx, my; + + void Reset() + { + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + bPointReached = true; + uiTimer = urand(500,1000); + uiCheckTimer = 1000; + r = 17; + c = 0; + mx = ShieldOrbLocations[0][0]; + my = ShieldOrbLocations[0][1]; + bClockwise = urand(0,1); + } + + void UpdateAI(const uint32 diff) + { + if (bPointReached) + { + if (bClockwise) + { + y = my - r * sin(c); + x = mx - r * cos(c); + } + else + { + y = my + r * sin(c); + x = mx + r * cos(c); + } + bPointReached = false; + uiCheckTimer = 1000; + me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z); + c += M_PI/32; + if (c >= 2*M_PI) c = 0; } else { - y = my + r * sin(c); - x = mx + r * cos(c); + if (uiCheckTimer <= diff) + { + DoTeleportTo(x,y,SHIELD_ORB_Z); + bPointReached = true; + } + else uiCheckTimer -= diff; } - bPointReached = false; - uiCheckTimer = 1000; - me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z); - c += M_PI/32; - if (c >= 2*M_PI) c = 0; - } - else - { - if (uiCheckTimer <= diff) + + if (uiTimer <= diff) { - DoTeleportTo(x,y,SHIELD_ORB_Z); - bPointReached = true; - } - else uiCheckTimer -= diff; + if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) + DoCast(random, SPELL_SHADOW_BOLT, false); + uiTimer = urand(500,1000); + } else uiTimer -= diff; } - if (uiTimer <= diff) + void MovementInform(uint32 type, uint32 id) { - if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0)) - DoCast(random, SPELL_SHADOW_BOLT, false); - uiTimer = urand(500,1000); - } else uiTimer -= diff; - } + if (type != POINT_MOTION_TYPE) + return; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + bPointReached = true; + } + }; - bPointReached = true; - } }; -CreatureAI* GetAI_mob_shield_orb(Creature* pCreature) + +//AI for Sinister Reflection class mob_sinster_reflection : public CreatureScript { - return new mob_shield_orbAI (pCreature); -} +public: + mob_sinster_reflection() : CreatureScript("mob_sinster_reflection") { } -//AI for Sinister Reflection -struct mob_sinster_reflectionAI : public ScriptedAI -{ - mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} - - uint8 victimClass; - uint32 uiTimer[3]; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiTimer[0] = 0; - uiTimer[1] = 0; - uiTimer[2] = 0; - victimClass = 0; + return new mob_sinster_reflectionAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_sinster_reflectionAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_sinster_reflectionAI(Creature* c) : ScriptedAI(c) {} - if ((victimClass == 0) && me->getVictim()) + uint8 victimClass; + uint32 uiTimer[3]; + + void Reset() { - victimClass = me->getVictim()->getClass(); - switch (victimClass) - { - case CLASS_DRUID: - break; - case CLASS_HUNTER: - break; - case CLASS_MAGE: - break; - case CLASS_WARLOCK: - break; - case CLASS_WARRIOR: - me->SetCanDualWield(true); - break; - case CLASS_PALADIN: - break; - case CLASS_PRIEST: - break; - case CLASS_SHAMAN: - me->SetCanDualWield(true); - break; - case CLASS_ROGUE: - me->SetCanDualWield(true); - break; - } + uiTimer[0] = 0; + uiTimer[1] = 0; + uiTimer[2] = 0; + victimClass = 0; } - switch(victimClass) { - case CLASS_DRUID: - if (uiTimer[1] <= diff) + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if ((victimClass == 0) && me->getVictim()) + { + victimClass = me->getVictim()->getClass(); + switch (victimClass) { - DoCast(me->getVictim(), SPELL_SR_MOONFIRE, false); - uiTimer[1] = urand(2000,4000); + case CLASS_DRUID: + break; + case CLASS_HUNTER: + break; + case CLASS_MAGE: + break; + case CLASS_WARLOCK: + break; + case CLASS_WARRIOR: + me->SetCanDualWield(true); + break; + case CLASS_PALADIN: + break; + case CLASS_PRIEST: + break; + case CLASS_SHAMAN: + me->SetCanDualWield(true); + break; + case CLASS_ROGUE: + me->SetCanDualWield(true); + break; } - DoMeleeAttackIfReady(); - break; - case CLASS_HUNTER: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); - uiTimer[1] = urand(8000,10000); - } - if (uiTimer[2] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_SHOOT, false); - uiTimer[2] = urand(4000,6000); - } - if (me->IsWithinMeleeRange(me->getVictim(), 6)) - { - if (uiTimer[0] <= diff) + } + + switch(victimClass) { + case CLASS_DRUID: + if (uiTimer[1] <= diff) { - DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); - uiTimer[0] = urand(6000,8000); + DoCast(me->getVictim(), SPELL_SR_MOONFIRE, false); + uiTimer[1] = urand(2000,4000); } DoMeleeAttackIfReady(); + break; + case CLASS_HUNTER: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); + uiTimer[1] = urand(8000,10000); + } + if (uiTimer[2] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_SHOOT, false); + uiTimer[2] = urand(4000,6000); + } + if (me->IsWithinMeleeRange(me->getVictim(), 6)) + { + if (uiTimer[0] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_MULTI_SHOT, false); + uiTimer[0] = urand(6000,8000); + } + DoMeleeAttackIfReady(); + } + break; + case CLASS_MAGE: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_FIREBALL, false); + uiTimer[1] = urand(2000,4000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_WARLOCK: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_SHADOW_BOLT, false); + uiTimer[1] = urand(3000,5000); + } + if (uiTimer[2] <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_SR_CURSE_OF_AGONY, true); + uiTimer[2] = urand(2000,4000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_WARRIOR: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_WHIRLWIND, false); + uiTimer[1] = urand(9000,11000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_PALADIN: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HAMMER_OF_JUSTICE, false); + uiTimer[1] = urand(6000,8000); + } + if (uiTimer[2] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HOLY_SHOCK, false); + uiTimer[2] = urand(2000,4000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_PRIEST: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HOLY_SMITE, false); + uiTimer[1] = urand(4000,6000); + } + if (uiTimer[2] <= diff) + { + DoCast(me, SPELL_SR_RENEW, false); + uiTimer[2] = urand(6000,8000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_SHAMAN: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_EARTH_SHOCK, false); + uiTimer[1] = urand(4000,6000); + } + DoMeleeAttackIfReady(); + break; + case CLASS_ROGUE: + if (uiTimer[1] <= diff) + { + DoCast(me->getVictim(), SPELL_SR_HEMORRHAGE, true); + uiTimer[1] = urand(4000,6000); + } + DoMeleeAttackIfReady(); + break; } - break; - case CLASS_MAGE: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_FIREBALL, false); - uiTimer[1] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_WARLOCK: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_SHADOW_BOLT, false); - uiTimer[1] = urand(3000,5000); - } - if (uiTimer[2] <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_SR_CURSE_OF_AGONY, true); - uiTimer[2] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_WARRIOR: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_WHIRLWIND, false); - uiTimer[1] = urand(9000,11000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_PALADIN: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HAMMER_OF_JUSTICE, false); - uiTimer[1] = urand(6000,8000); - } - if (uiTimer[2] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HOLY_SHOCK, false); - uiTimer[2] = urand(2000,4000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_PRIEST: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HOLY_SMITE, false); - uiTimer[1] = urand(4000,6000); - } - if (uiTimer[2] <= diff) - { - DoCast(me, SPELL_SR_RENEW, false); - uiTimer[2] = urand(6000,8000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_SHAMAN: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_EARTH_SHOCK, false); - uiTimer[1] = urand(4000,6000); - } - DoMeleeAttackIfReady(); - break; - case CLASS_ROGUE: - if (uiTimer[1] <= diff) - { - DoCast(me->getVictim(), SPELL_SR_HEMORRHAGE, true); - uiTimer[1] = urand(4000,6000); - } - DoMeleeAttackIfReady(); - break; + sLog.outDebug("Sinister-Timer"); + for (uint8 i = 0; i < 3; ++i) + uiTimer[i] -= diff; } - sLog.outDebug("Sinister-Timer"); - for (uint8 i = 0; i < 3; ++i) - uiTimer[i] -= diff; - } + }; + }; -CreatureAI* GetAI_mob_sinster_reflection(Creature* pCreature) -{ - return new mob_sinster_reflectionAI (pCreature); -} void AddSC_boss_kiljaeden() { - Script* newscript; - - newscript = new Script; - newscript->pGOHello = &GOHello_go_orb_of_the_blue_flight; - newscript->Name = "go_orb_of_the_blue_flight"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_kalecgos_kj; - newscript->Name = "boss_kalecgos_kj"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_boss_kiljaeden; - newscript->Name = "boss_kiljaeden"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_kiljaeden_controller; - newscript->Name = "mob_kiljaeden_controller"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_hand_of_the_deceiver; - newscript->Name = "mob_hand_of_the_deceiver"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_felfire_portal; - newscript->Name = "mob_felfire_portal"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_volatile_felfire_fiend; - newscript->Name = "mob_volatile_felfire_fiend"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_armageddon; - newscript->Name = "mob_armageddon"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_shield_orb; - newscript->Name = "mob_shield_orb"; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->GetAI = &GetAI_mob_sinster_reflection; - newscript->Name = "mob_sinster_reflection"; - newscript->RegisterSelf(); + new go_orb_of_the_blue_flight(); + new boss_kalecgos_kj(); + new boss_kiljaeden(); + new mob_kiljaeden_controller(); + new mob_hand_of_the_deceiver(); + new mob_felfire_portal(); + new mob_volatile_felfire_fiend(); + new mob_armageddon(); + new mob_shield_orb(); + new mob_sinster_reflection(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 1fa61f85a80..7bb1156b740 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -100,542 +100,560 @@ float Humanoides[6][5] = {CREATURE_BERSERKER, 1842.91, 599.93, 71.23, 2.44} }; -uint32 EnrageTimer = 600000; -struct boss_entropiusAI : public ScriptedAI +uint32 EnrageTimer = 600000; class boss_entropius : public CreatureScript { - boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + boss_entropius() : CreatureScript("boss_entropius") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_entropiusAI (pCreature); } - ScriptedInstance* pInstance; - SummonList Summons; - - uint32 BlackHoleSummonTimer; - - void Reset() + struct boss_entropiusAI : public ScriptedAI { - BlackHoleSummonTimer = 15000; - DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); - - Summons.DespawnAll(); - - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); - DoCast(me, SPELL_ENTROPIUS_SPAWN, false); - - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); - } - - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) + boss_entropiusAI(Creature *c) : ScriptedAI(c), Summons(me) { - case CREATURE_DARK_FIENDS: - summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); - break; - case CREATURE_DARKNESS: - summoned->addUnitState(UNIT_STAT_STUNNED); - float x,y,z,o; - summoned->GetHomePosition(x,y,z,o); - me->SummonCreature(CREATURE_DARK_FIENDS, x,y,z,o, TEMPSUMMON_CORPSE_DESPAWN, 0); - break; + pInstance = c->GetInstanceScript(); } - summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); - Summons.Summon(summoned); - } - void JustDied(Unit* /*killer*/) - { - Summons.DespawnAll(); + InstanceScript* pInstance; + SummonList Summons; - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, DONE); - } + uint32 BlackHoleSummonTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + void Reset() { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; - - if (BlackHoleSummonTimer <= diff) - { - Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) - return; - - DoCast(random, SPELL_DARKNESS_E, false); - - random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (!random) - return; - - random->CastSpell(random, SPELL_BLACKHOLE, false); BlackHoleSummonTimer = 15000; - } else BlackHoleSummonTimer -= diff; + DoCastAOE(SPELL_NEGATIVE_ENERGY_E, false); - DoMeleeAttackIfReady(); - } -}; + Summons.DespawnAll(); -CreatureAI* GetAI_boss_entropius(Creature* pCreature) -{ - return new boss_entropiusAI (pCreature); -} - -struct boss_muruAI : public Scripted_NoMovementAI -{ - boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - SummonList Summons; - - uint8 Phase; - uint32 Timer[4]; - - bool DarkFiend; - - void Reset() - { - DarkFiend = false; - Phase = 1; - - EnrageTimer = 600000; - Timer[TIMER_DARKNESS] = 45000; - Timer[TIMER_HUMANOIDES] = 10000; - Timer[TIMER_PHASE] = 2000; - Timer[TIMER_SENTINEL] = 31500; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); - - Summons.DespawnAll(); - - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoCastAOE(SPELL_NEGATIVE_ENERGY,false); - - if (pInstance) - pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage > me->GetHealth() && Phase == 1) - { - damage = 0; - Phase = 2; - me->RemoveAllAuras(); - DoCast(me, SPELL_OPEN_ALL_PORTALS, false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); } - if (Phase > 1 && Phase < 4) - damage = 0; - } - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) + void EnterCombat(Unit * /*who*/) { - case BOSS_ENTROPIUS: - me->SetVisibility(VISIBILITY_OFF); - break; - case CREATURE_DARK_FIENDS: - summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); - break; + DoCastAOE(SPELL_NEGATIVE_ENERGY_E, true); + DoCast(me, SPELL_ENTROPIUS_SPAWN, false); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); } - summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); - Summons.Summon(summoned); - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Phase == 3) + void JustSummoned(Creature* summoned) { - if (Timer[TIMER_PHASE] <= diff) + switch(summoned->GetEntry()) { - if (!pInstance) + case CREATURE_DARK_FIENDS: + summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); + break; + case CREATURE_DARKNESS: + summoned->addUnitState(UNIT_STAT_STUNNED); + float x,y,z,o; + summoned->GetHomePosition(x,y,z,o); + me->SummonCreature(CREATURE_DARK_FIENDS, x,y,z,o, TEMPSUMMON_CORPSE_DESPAWN, 0); + break; + } + summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); + Summons.Summon(summoned); + } + + void JustDied(Unit* /*killer*/) + { + Summons.DespawnAll(); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + { + DoCast(me, SPELL_ENRAGE, false); + } else EnrageTimer -= diff; + + if (BlackHoleSummonTimer <= diff) + { + Unit* random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!random) return; - switch(pInstance->GetData(DATA_MURU_EVENT)) - { - case NOT_STARTED: - Reset(); - break; - case DONE: - Phase = 4; - me->DisappearAndDie(); - break; - } - Timer[TIMER_PHASE] = 3000; - } else Timer[TIMER_PHASE] -= diff; - return; + + DoCast(random, SPELL_DARKNESS_E, false); + + random = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (!random) + return; + + random->CastSpell(random, SPELL_BLACKHOLE, false); + BlackHoleSummonTimer = 15000; + } else BlackHoleSummonTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + + class boss_muru : public CreatureScript +{ +public: + boss_muru() : CreatureScript("boss_muru") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_muruAI (pCreature); + } + + struct boss_muruAI : public Scripted_NoMovementAI + { + boss_muruAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); } - if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) - { - DoCast(me, SPELL_ENRAGE, false); - } else EnrageTimer -= diff; + InstanceScript* pInstance; + SummonList Summons; - for (uint8 i = 0; i < 4; ++i) + uint8 Phase; + uint32 Timer[4]; + + bool DarkFiend; + + void Reset() { - if (Timer[i] <= diff) + DarkFiend = false; + Phase = 1; + + EnrageTimer = 600000; + Timer[TIMER_DARKNESS] = 45000; + Timer[TIMER_HUMANOIDES] = 10000; + Timer[TIMER_PHASE] = 2000; + Timer[TIMER_SENTINEL] = 31500; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); + + Summons.DespawnAll(); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + DoCastAOE(SPELL_NEGATIVE_ENERGY,false); + + if (pInstance) + pInstance->SetData(DATA_MURU_EVENT, IN_PROGRESS); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage > me->GetHealth() && Phase == 1) { - switch(i) + damage = 0; + Phase = 2; + me->RemoveAllAuras(); + DoCast(me, SPELL_OPEN_ALL_PORTALS, false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + if (Phase > 1 && Phase < 4) + damage = 0; + } + + void JustSummoned(Creature* summoned) + { + switch(summoned->GetEntry()) + { + case BOSS_ENTROPIUS: + me->SetVisibility(VISIBILITY_OFF); + break; + case CREATURE_DARK_FIENDS: + summoned->CastSpell(summoned,SPELL_DARKFIEND_VISUAL,false); + break; + } + summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true)); + Summons.Summon(summoned); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Phase == 3) + { + if (Timer[TIMER_PHASE] <= diff) { - case TIMER_DARKNESS: - if (!DarkFiend) - { - DoCastAOE(SPELL_DARKNESS, false); - Timer[TIMER_DARKNESS] = 3000; - DarkFiend = true; - } - else - { - DarkFiend = false; - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_DARKNESS] = 42000; - } - break; - case TIMER_HUMANOIDES: - for (uint8 i = 0; i < 6; ++i) - me->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); - Timer[TIMER_HUMANOIDES] = 60000; - break; - case TIMER_PHASE: - me->RemoveAllAuras(); - DoCast(me, SPELL_SUMMON_ENTROPIUS, false); - Timer[TIMER_PHASE] = 3000; - Phase = 3; + if (!pInstance) return; - case TIMER_SENTINEL: - DoCastAOE(SPELL_OPEN_PORTAL_2, false); - Timer[TIMER_SENTINEL] = 30000; - break; - } - break; - } - } - - //Timer - for (uint8 i = 0; i < 4; ++i) - { - if (i != TIMER_PHASE)Timer[i] -= diff; - else if (Phase == 2) Timer[i] -= diff; - } - } -}; - -CreatureAI* GetAI_boss_muru(Creature* pCreature) -{ - return new boss_muruAI (pCreature); -} - -struct npc_muru_portalAI : public Scripted_NoMovementAI -{ - npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - SummonList Summons; - - bool SummonSentinel; - bool InAction; - - uint32 SummonTimer; - - void Reset() - { - SummonTimer = 5000; - - InAction = false; - SummonSentinel = false; - - me->addUnitState(UNIT_STAT_STUNNED); - - Summons.DespawnAll(); - } - - void JustSummoned(Creature* summoned) - { - if (pInstance) - if (Player* Target = Unit::GetPlayer(*me, pInstance->GetData64(DATA_PLAYER_GUID))) - summoned->AI()->AttackStart(Target); - - Summons.Summon(summoned); - } - - void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) - { - float x,y,z,o; - me->GetHomePosition(x,y,z,o); - DoTeleportTo(x,y,z); - InAction = true; - switch(Spell->Id) - { - case SPELL_OPEN_ALL_PORTALS: - DoCastAOE(SPELL_OPEN_PORTAL, false); - break; - case SPELL_OPEN_PORTAL_2: - DoCastAOE(SPELL_OPEN_PORTAL, false); - SummonSentinel = true; - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (!SummonSentinel) - { - if (InAction && pInstance && pInstance->GetData(DATA_MURU_EVENT) == NOT_STARTED) - Reset(); - return; - } - if (SummonTimer <= diff) - { - DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false); - SummonTimer = 5000; - SummonSentinel = false; - } else SummonTimer -= diff; - } -}; - -CreatureAI* GetAI_npc_muru_portal(Creature* pCreature) -{ - return new npc_muru_portalAI (pCreature); -} - -struct npc_dark_fiendAI : public ScriptedAI -{ - npc_dark_fiendAI(Creature *c) : ScriptedAI(c) {} - - uint32 WaitTimer; - bool InAction; - - void Reset() - { - WaitTimer = 2000; - InAction = false; - - me->addUnitState(UNIT_STAT_STUNNED); - } - - void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) - { - for (uint8 i = 0; i < 3; ++i) - if (Spell->Effect[i] == 38) - me->DisappearAndDie(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (WaitTimer <= diff) - { - if (!InAction) - { - me->clearUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_DARKFIEND_SKIN, false); - AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)); - InAction = true; - WaitTimer = 500; - } - else - { - - if (me->IsWithinDist(me->getVictim(), 5)) - { - DoCastAOE(SPELL_DARKFIEND_AOE, false); - me->DisappearAndDie(); - } - WaitTimer = 500; - } - } else WaitTimer -= diff; - } -}; - -CreatureAI* GetAI_npc_dark_fiend(Creature* pCreature) -{ - return new npc_dark_fiendAI (pCreature); -} - -struct npc_void_sentinelAI : public ScriptedAI -{ - npc_void_sentinelAI(Creature *c) : ScriptedAI(c){} - - uint32 PulseTimer; - uint32 VoidBlastTimer; - - void Reset() - { - PulseTimer = 3000; - VoidBlastTimer = 45000; //is this a correct timer? - - float x,y,z,o; - me->GetHomePosition(x,y,z,o); - DoTeleportTo(x,y,71); - } - - void JustDied(Unit* /*killer*/) - { - for (uint8 i = 0; i < 8; ++i) - me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (PulseTimer <= diff) - { - DoCastAOE(SPELL_SHADOW_PULSE, true); - PulseTimer = 3000; - } else PulseTimer -= diff; - - if (VoidBlastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_VOID_BLAST, false); - VoidBlastTimer = 45000; - } else VoidBlastTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_npc_void_sentinel(Creature* pCreature) -{ - return new npc_void_sentinelAI (pCreature); -} - -struct npc_blackholeAI : public ScriptedAI -{ - npc_blackholeAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 DespawnTimer; - uint32 SpellTimer; - uint8 Phase; - uint8 NeedForAHack; - - void Reset() - { - DespawnTimer = 15000; - SpellTimer = 5000; - Phase = 0; - - me->addUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); - } - - void UpdateAI(const uint32 diff) - { - if (SpellTimer <= diff) - { - Unit* Victim = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); - switch (NeedForAHack) - { - case 0: - me->clearUnitState(UNIT_STAT_STUNNED); - DoCastAOE(SPELL_BLACKHOLE_GROW, false); - if (Victim) - AttackStart(Victim); - SpellTimer = 700; - NeedForAHack = 2; - break; - case 1: - me->AddAura(SPELL_BLACKHOLE_GROW, me); - NeedForAHack = 2; - SpellTimer = 600; - break; - case 2: - SpellTimer = 400; - NeedForAHack = 3; - me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); - break; - case 3: - SpellTimer = urand(400,900); - NeedForAHack = 1; - if (Unit* Temp = me->getVictim()) + switch(pInstance->GetData(DATA_MURU_EVENT)) { - if (Temp->GetPositionZ() > 73 && Victim) - AttackStart(Victim); - } else - return; + case NOT_STARTED: + Reset(); + break; + case DONE: + Phase = 4; + me->DisappearAndDie(); + break; + } + Timer[TIMER_PHASE] = 3000; + } else Timer[TIMER_PHASE] -= diff; + return; } - } else SpellTimer -= diff; - if (DespawnTimer <= diff) - me->DisappearAndDie(); - else DespawnTimer -= diff; - } + if (EnrageTimer < diff && !me->HasAura(SPELL_ENRAGE, 0)) + { + DoCast(me, SPELL_ENRAGE, false); + } else EnrageTimer -= diff; + + for (uint8 i = 0; i < 4; ++i) + { + if (Timer[i] <= diff) + { + switch(i) + { + case TIMER_DARKNESS: + if (!DarkFiend) + { + DoCastAOE(SPELL_DARKNESS, false); + Timer[TIMER_DARKNESS] = 3000; + DarkFiend = true; + } + else + { + DarkFiend = false; + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(CREATURE_DARK_FIENDS,DarkFiends[i][0],DarkFiends[i][1],DarkFiends[i][2], DarkFiends[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + Timer[TIMER_DARKNESS] = 42000; + } + break; + case TIMER_HUMANOIDES: + for (uint8 i = 0; i < 6; ++i) + me->SummonCreature(Humanoides[i][0],Humanoides[i][1],Humanoides[i][2],Humanoides[i][3], Humanoides[i][4], TEMPSUMMON_CORPSE_DESPAWN, 0); + Timer[TIMER_HUMANOIDES] = 60000; + break; + case TIMER_PHASE: + me->RemoveAllAuras(); + DoCast(me, SPELL_SUMMON_ENTROPIUS, false); + Timer[TIMER_PHASE] = 3000; + Phase = 3; + return; + case TIMER_SENTINEL: + DoCastAOE(SPELL_OPEN_PORTAL_2, false); + Timer[TIMER_SENTINEL] = 30000; + break; + } + break; + } + } + + //Timer + for (uint8 i = 0; i < 4; ++i) + { + if (i != TIMER_PHASE)Timer[i] -= diff; + else if (Phase == 2) Timer[i] -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_blackhole(Creature* pCreature) + class npc_muru_portal : public CreatureScript { - return new npc_blackholeAI (pCreature); -} +public: + npc_muru_portal() : CreatureScript("npc_muru_portal") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_muru_portalAI (pCreature); + } + + struct npc_muru_portalAI : public Scripted_NoMovementAI + { + npc_muru_portalAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + SummonList Summons; + + bool SummonSentinel; + bool InAction; + + uint32 SummonTimer; + + void Reset() + { + SummonTimer = 5000; + + InAction = false; + SummonSentinel = false; + + me->addUnitState(UNIT_STAT_STUNNED); + + Summons.DespawnAll(); + } + + void JustSummoned(Creature* summoned) + { + if (pInstance) + if (Player* Target = Unit::GetPlayer(*me, pInstance->GetData64(DATA_PLAYER_GUID))) + summoned->AI()->AttackStart(Target); + + Summons.Summon(summoned); + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) + { + float x,y,z,o; + me->GetHomePosition(x,y,z,o); + DoTeleportTo(x,y,z); + InAction = true; + switch(Spell->Id) + { + case SPELL_OPEN_ALL_PORTALS: + DoCastAOE(SPELL_OPEN_PORTAL, false); + break; + case SPELL_OPEN_PORTAL_2: + DoCastAOE(SPELL_OPEN_PORTAL, false); + SummonSentinel = true; + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!SummonSentinel) + { + if (InAction && pInstance && pInstance->GetData(DATA_MURU_EVENT) == NOT_STARTED) + Reset(); + return; + } + if (SummonTimer <= diff) + { + DoCastAOE(SPELL_SUMMON_VOID_SENTINEL, false); + SummonTimer = 5000; + SummonSentinel = false; + } else SummonTimer -= diff; + } + }; + +}; + + class npc_dark_fiend : public CreatureScript +{ +public: + npc_dark_fiend() : CreatureScript("npc_dark_fiend") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_dark_fiendAI (pCreature); + } + + struct npc_dark_fiendAI : public ScriptedAI + { + npc_dark_fiendAI(Creature *c) : ScriptedAI(c) {} + + uint32 WaitTimer; + bool InAction; + + void Reset() + { + WaitTimer = 2000; + InAction = false; + + me->addUnitState(UNIT_STAT_STUNNED); + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* Spell) + { + for (uint8 i = 0; i < 3; ++i) + if (Spell->Effect[i] == 38) + me->DisappearAndDie(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (WaitTimer <= diff) + { + if (!InAction) + { + me->clearUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_DARKFIEND_SKIN, false); + AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)); + InAction = true; + WaitTimer = 500; + } + else + { + + if (me->IsWithinDist(me->getVictim(), 5)) + { + DoCastAOE(SPELL_DARKFIEND_AOE, false); + me->DisappearAndDie(); + } + WaitTimer = 500; + } + } else WaitTimer -= diff; + } + }; + +}; + + class npc_void_sentinel : public CreatureScript +{ +public: + npc_void_sentinel() : CreatureScript("npc_void_sentinel") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_void_sentinelAI (pCreature); + } + + struct npc_void_sentinelAI : public ScriptedAI + { + npc_void_sentinelAI(Creature *c) : ScriptedAI(c){} + + uint32 PulseTimer; + uint32 VoidBlastTimer; + + void Reset() + { + PulseTimer = 3000; + VoidBlastTimer = 45000; //is this a correct timer? + + float x,y,z,o; + me->GetHomePosition(x,y,z,o); + DoTeleportTo(x,y,71); + } + + void JustDied(Unit* /*killer*/) + { + for (uint8 i = 0; i < 8; ++i) + me->SummonCreature(CREATURE_VOID_SPAWN, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), rand()%6, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (PulseTimer <= diff) + { + DoCastAOE(SPELL_SHADOW_PULSE, true); + PulseTimer = 3000; + } else PulseTimer -= diff; + + if (VoidBlastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VOID_BLAST, false); + VoidBlastTimer = 45000; + } else VoidBlastTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + + class npc_blackhole : public CreatureScript +{ +public: + npc_blackhole() : CreatureScript("npc_blackhole") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_blackholeAI (pCreature); + } + + struct npc_blackholeAI : public ScriptedAI + { + npc_blackholeAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 DespawnTimer; + uint32 SpellTimer; + uint8 Phase; + uint8 NeedForAHack; + + void Reset() + { + DespawnTimer = 15000; + SpellTimer = 5000; + Phase = 0; + + me->addUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); + } + + void UpdateAI(const uint32 diff) + { + if (SpellTimer <= diff) + { + Unit* Victim = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0); + switch (NeedForAHack) + { + case 0: + me->clearUnitState(UNIT_STAT_STUNNED); + DoCastAOE(SPELL_BLACKHOLE_GROW, false); + if (Victim) + AttackStart(Victim); + SpellTimer = 700; + NeedForAHack = 2; + break; + case 1: + me->AddAura(SPELL_BLACKHOLE_GROW, me); + NeedForAHack = 2; + SpellTimer = 600; + break; + case 2: + SpellTimer = 400; + NeedForAHack = 3; + me->RemoveAura(SPELL_BLACKHOLE_GROW, 1); + break; + case 3: + SpellTimer = urand(400,900); + NeedForAHack = 1; + if (Unit* Temp = me->getVictim()) + { + if (Temp->GetPositionZ() > 73 && Victim) + AttackStart(Victim); + } else + return; + } + } else SpellTimer -= diff; + + if (DespawnTimer <= diff) + me->DisappearAndDie(); + else DespawnTimer -= diff; + } + }; + +}; + void AddSC_boss_muru() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_muru"; - newscript->GetAI = &GetAI_boss_muru; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_entropius"; - newscript->GetAI = &GetAI_boss_entropius; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_muru_portal"; - newscript->GetAI = &GetAI_npc_muru_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dark_fiend"; - newscript->GetAI = &GetAI_npc_dark_fiend; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_void_sentinel"; - newscript->GetAI = &GetAI_npc_void_sentinel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_blackhole"; - newscript->GetAI = &GetAI_npc_blackhole; - newscript->RegisterSelf(); + new boss_muru(); + new boss_entropius(); + new npc_muru_portal(); + new npc_dark_fiend(); + new npc_void_sentinel(); + new npc_blackhole(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 12a0bdfffff..32237b39def 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -36,276 +36,277 @@ EndScriptData */ 4 - M'uru 5 - Kil'Jaeden */ - -struct instance_sunwell_plateau : public ScriptedInstance + class instance_sunwell_plateau : public InstanceMapScript { - instance_sunwell_plateau(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_sunwell_plateau() : InstanceMapScript("instance_sunwell_plateau") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - /** Creatures **/ - uint64 Kalecgos_Dragon; - uint64 Kalecgos_Human; - uint64 Sathrovarr; - uint64 Brutallus; - uint64 Madrigosa; - uint64 Felmyst; - uint64 Alythess; - uint64 Sacrolash; - uint64 Muru; - uint64 KilJaeden; - uint64 KilJaedenController; - uint64 Anveena; - uint64 KalecgosKJ; - uint32 SpectralPlayers; - - /** GameObjects **/ - uint64 ForceField; // Kalecgos Encounter - uint64 KalecgosWall[2]; - uint64 FireBarrier; // Felmysts Encounter - uint64 MurusGate[2]; // Murus Encounter - - /*** Misc ***/ - uint32 SpectralRealmTimer; - std::vector SpectralRealmList; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + return new instance_sunwell_plateau_InstanceMapScript(pMap); + } - /*** Creatures ***/ - Kalecgos_Dragon = 0; - Kalecgos_Human = 0; - Sathrovarr = 0; - Brutallus = 0; - Madrigosa = 0; - Felmyst = 0; - Alythess = 0; - Sacrolash = 0; - Muru = 0; - KilJaeden = 0; - KilJaedenController = 0; - Anveena = 0; - KalecgosKJ = 0; - SpectralPlayers = 0; + struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript + { + instance_sunwell_plateau_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - /*** GameObjects ***/ - ForceField = 0; - FireBarrier = 0; - MurusGate[0] = 0; - MurusGate[1] = 0; - KalecgosWall[0] = 0; - KalecgosWall[1] = 0; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + /** Creatures **/ + uint64 Kalecgos_Dragon; + uint64 Kalecgos_Human; + uint64 Sathrovarr; + uint64 Brutallus; + uint64 Madrigosa; + uint64 Felmyst; + uint64 Alythess; + uint64 Sacrolash; + uint64 Muru; + uint64 KilJaeden; + uint64 KilJaedenController; + uint64 Anveena; + uint64 KalecgosKJ; + uint32 SpectralPlayers; + + /** GameObjects **/ + uint64 ForceField; // Kalecgos Encounter + uint64 KalecgosWall[2]; + uint64 FireBarrier; // Felmysts Encounter + uint64 MurusGate[2]; // Murus Encounter /*** Misc ***/ - SpectralRealmTimer = 5000; - } + uint32 SpectralRealmTimer; + std::vector SpectralRealmList; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; - - return false; - } - - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) + void Initialize() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + /*** Creatures ***/ + Kalecgos_Dragon = 0; + Kalecgos_Human = 0; + Sathrovarr = 0; + Brutallus = 0; + Madrigosa = 0; + Felmyst = 0; + Alythess = 0; + Sacrolash = 0; + Muru = 0; + KilJaeden = 0; + KilJaedenController = 0; + Anveena = 0; + KalecgosKJ = 0; + SpectralPlayers = 0; + + /*** GameObjects ***/ + ForceField = 0; + FireBarrier = 0; + MurusGate[0] = 0; + MurusGate[1] = 0; + KalecgosWall[0] = 0; + KalecgosWall[1] = 0; + + /*** Misc ***/ + SpectralRealmTimer = 5000; + } + + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + + return false; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - Player* plr = itr->getSource(); - if (plr && !plr->HasAura(45839,0)) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* plr = itr->getSource(); + if (plr && !plr->HasAura(45839,0)) + return plr; + } + } + + sLog.outDebug("TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 24850: Kalecgos_Dragon = pCreature->GetGUID(); break; + case 24891: Kalecgos_Human = pCreature->GetGUID(); break; + case 24892: Sathrovarr = pCreature->GetGUID(); break; + case 24882: Brutallus = pCreature->GetGUID(); break; + case 24895: Madrigosa = pCreature->GetGUID(); break; + case 25038: Felmyst = pCreature->GetGUID(); break; + case 25166: Alythess = pCreature->GetGUID(); break; + case 25165: Sacrolash = pCreature->GetGUID(); break; + case 25741: Muru = pCreature->GetGUID(); break; + case 25315: KilJaeden = pCreature->GetGUID(); break; + case 25608: KilJaedenController = pCreature->GetGUID(); break; + case 26046: Anveena = pCreature->GetGUID(); break; + case 25319: KalecgosKJ = pCreature->GetGUID(); break; } } - sLog.outDebug("TSCR: Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 24850: Kalecgos_Dragon = pCreature->GetGUID(); break; - case 24891: Kalecgos_Human = pCreature->GetGUID(); break; - case 24892: Sathrovarr = pCreature->GetGUID(); break; - case 24882: Brutallus = pCreature->GetGUID(); break; - case 24895: Madrigosa = pCreature->GetGUID(); break; - case 25038: Felmyst = pCreature->GetGUID(); break; - case 25166: Alythess = pCreature->GetGUID(); break; - case 25165: Sacrolash = pCreature->GetGUID(); break; - case 25741: Muru = pCreature->GetGUID(); break; - case 25315: KilJaeden = pCreature->GetGUID(); break; - case 25608: KilJaedenController = pCreature->GetGUID(); break; - case 26046: Anveena = pCreature->GetGUID(); break; - case 25319: KalecgosKJ = pCreature->GetGUID(); break; + switch(pGo->GetEntry()) + { + case 188421: ForceField = pGo->GetGUID(); break; + case 188523: KalecgosWall[0] = pGo->GetGUID(); break; + case 188524: KalecgosWall[0] = pGo->GetGUID(); break; + case 188075: + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL, true, pGo); + FireBarrier = pGo->GetGUID(); + break; + case 187990: MurusGate[0] = pGo->GetGUID(); break; + case 188118: + if (m_auiEncounter[4] == DONE) + HandleGameObject(NULL, true, pGo); + MurusGate[1]= pGo->GetGUID(); + break; + } } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + uint32 GetData(uint32 id) { - case 188421: ForceField = pGo->GetGUID(); break; - case 188523: KalecgosWall[0] = pGo->GetGUID(); break; - case 188524: KalecgosWall[0] = pGo->GetGUID(); break; - case 188075: - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL, true, pGo); - FireBarrier = pGo->GetGUID(); - break; - case 187990: MurusGate[0] = pGo->GetGUID(); break; - case 188118: - if (m_auiEncounter[4] == DONE) - HandleGameObject(NULL, true, pGo); - MurusGate[1]= pGo->GetGUID(); - break; + switch(id) + { + case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; + case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; + case DATA_FELMYST_EVENT: return m_auiEncounter[2]; + case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; + case DATA_MURU_EVENT: return m_auiEncounter[4]; + case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + } + return 0; } - } - uint32 GetData(uint32 id) - { - switch(id) + uint64 GetData64(uint32 id) { - case DATA_KALECGOS_EVENT: return m_auiEncounter[0]; - case DATA_BRUTALLUS_EVENT: return m_auiEncounter[1]; - case DATA_FELMYST_EVENT: return m_auiEncounter[2]; - case DATA_EREDAR_TWINS_EVENT: return m_auiEncounter[3]; - case DATA_MURU_EVENT: return m_auiEncounter[4]; - case DATA_KILJAEDEN_EVENT: return m_auiEncounter[5]; + switch(id) + { + case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; + case DATA_KALECGOS_HUMAN: return Kalecgos_Human; + case DATA_SATHROVARR: return Sathrovarr; + case DATA_GO_FORCEFIELD: return ForceField; + case DATA_BRUTALLUS: return Brutallus; + case DATA_MADRIGOSA: return Madrigosa; + case DATA_FELMYST: return Felmyst; + case DATA_ALYTHESS: return Alythess; + case DATA_SACROLASH: return Sacrolash; + case DATA_MURU: return Muru; + case DATA_KILJAEDEN: return KilJaeden; + case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; + case DATA_ANVEENA: return Anveena; + case DATA_KALECGOS_KJ: return KalecgosKJ; + case DATA_PLAYER_GUID: + Player* Target = GetPlayerInMap(); + return Target->GetGUID(); + } + return 0; } - return 0; - } - uint64 GetData64(uint32 id) - { - switch(id) + void SetData(uint32 id, uint32 data) { - case DATA_KALECGOS_DRAGON: return Kalecgos_Dragon; - case DATA_KALECGOS_HUMAN: return Kalecgos_Human; - case DATA_SATHROVARR: return Sathrovarr; - case DATA_GO_FORCEFIELD: return ForceField; - case DATA_BRUTALLUS: return Brutallus; - case DATA_MADRIGOSA: return Madrigosa; - case DATA_FELMYST: return Felmyst; - case DATA_ALYTHESS: return Alythess; - case DATA_SACROLASH: return Sacrolash; - case DATA_MURU: return Muru; - case DATA_KILJAEDEN: return KilJaeden; - case DATA_KILJAEDEN_CONTROLLER: return KilJaedenController; - case DATA_ANVEENA: return Anveena; - case DATA_KALECGOS_KJ: return KalecgosKJ; - case DATA_PLAYER_GUID: - Player* Target = GetPlayerInMap(); - return Target->GetGUID(); - } - return 0; - } - - void SetData(uint32 id, uint32 data) - { - switch(id) - { - case DATA_KALECGOS_EVENT: - { - if (data == NOT_STARTED || data == DONE) + switch(id) + { + case DATA_KALECGOS_EVENT: { - HandleGameObject(ForceField,true); - HandleGameObject(KalecgosWall[0],true); - HandleGameObject(KalecgosWall[1],true); + if (data == NOT_STARTED || data == DONE) + { + HandleGameObject(ForceField,true); + HandleGameObject(KalecgosWall[0],true); + HandleGameObject(KalecgosWall[1],true); + } + else if (data == IN_PROGRESS) + { + HandleGameObject(ForceField,false); + HandleGameObject(KalecgosWall[0],false); + HandleGameObject(KalecgosWall[1],false); + } + m_auiEncounter[0] = data; } - else if (data == IN_PROGRESS) + break; + case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; + case DATA_FELMYST_EVENT: + if (data == DONE) + HandleGameObject(FireBarrier, true); + m_auiEncounter[2] = data; break; + case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; + case DATA_MURU_EVENT: + switch(data) { - HandleGameObject(ForceField,false); - HandleGameObject(KalecgosWall[0],false); - HandleGameObject(KalecgosWall[1],false); + case DONE: + HandleGameObject(MurusGate[0], true); + HandleGameObject(MurusGate[1], true); + break; + case IN_PROGRESS: + HandleGameObject(MurusGate[0], false); + HandleGameObject(MurusGate[1], false); + break; + case NOT_STARTED: + HandleGameObject(MurusGate[0], true); + HandleGameObject(MurusGate[1], false); + break; } - m_auiEncounter[0] = data; - } - break; - case DATA_BRUTALLUS_EVENT: m_auiEncounter[1] = data; break; - case DATA_FELMYST_EVENT: - if (data == DONE) - HandleGameObject(FireBarrier, true); - m_auiEncounter[2] = data; break; - case DATA_EREDAR_TWINS_EVENT: m_auiEncounter[3] = data; break; - case DATA_MURU_EVENT: - switch(data) - { - case DONE: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], true); - break; - case IN_PROGRESS: - HandleGameObject(MurusGate[0], false); - HandleGameObject(MurusGate[1], false); - break; - case NOT_STARTED: - HandleGameObject(MurusGate[0], true); - HandleGameObject(MurusGate[1], false); - break; - } - m_auiEncounter[4] = data; break; - case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; + m_auiEncounter[4] = data; break; + case DATA_KILJAEDEN_EVENT: m_auiEncounter[5] = data; break; + } + + if (data == DONE) + SaveToDB(); } - if (data == DONE) - SaveToDB(); - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " - << m_auiEncounter[4] << " " << m_auiEncounter[5]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) + std::string GetSaveData() { - OUT_SAVE_INST_DATA_COMPLETE; - return out; + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " + << m_auiEncounter[4] << " " << m_auiEncounter[5]; + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + return NULL; } - return NULL; - } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + std::istringstream stream(in); + stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5]; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_sunwell_plateau(Map* pMap) -{ - return new instance_sunwell_plateau(pMap); -} void AddSC_instance_sunwell_plateau() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_sunwell_plateau"; - newscript->GetInstanceData = &GetInstanceData_instance_sunwell_plateau; - newscript->RegisterSelf(); + new instance_sunwell_plateau(); } - diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index c470eba6648..8fa378037f7 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -64,7 +64,7 @@ class boss_archaedas : public CreatureScript { boss_archaedasAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } uint32 Tremor_Timer; @@ -74,7 +74,7 @@ class boss_archaedas : public CreatureScript bool guardiansAwake; bool vaultWalkersAwake; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -226,7 +226,7 @@ class mob_archaedas_minions : public CreatureScript { mob_archaedas_minionsAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } uint32 Arcing_Timer; @@ -234,7 +234,7 @@ class mob_archaedas_minions : public CreatureScript bool wakingUp; bool amIAwake; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -322,10 +322,10 @@ class mob_stonekeepers : public CreatureScript { mob_stonekeepersAI(Creature *c) : ScriptedAI(c) { - pInstance = (me->GetInstanceData()); + pInstance = (me->GetInstanceScript()); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -385,7 +385,7 @@ class go_altar_of_archaedas : public GameObjectScript bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); + InstanceScript* pInstance = pPlayer->GetInstanceScript(); if (!pInstance) return false; @@ -417,7 +417,7 @@ class go_altar_of_the_keepers : public GameObjectScript bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); + InstanceScript* pInstance = pPlayer->GetInstanceScript(); if (!pInstance) return false; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index ddd4c52f438..99f7cd56eae 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -33,9 +33,9 @@ class instance_uldaman : public InstanceMapScript { } - struct instance_uldaman_InstanceMapScript : public ScriptedInstance + struct instance_uldaman_InstanceMapScript : public InstanceScript { - instance_uldaman_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) + instance_uldaman_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; @@ -290,7 +290,7 @@ class instance_uldaman : public InstanceMapScript } // end GetData64 }; - InstanceData* OnGetInstanceData(InstanceMap* pMap) + InstanceScript* OnGetInstanceData(InstanceMap* pMap) { return new instance_uldaman_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 6f048557858..ed0d0fd5ba3 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -29,15 +29,18 @@ EndScriptData */ #include "zulaman.h" #include "Weather.h" -#define SPELL_STATIC_DISRUPTION 43622 -#define SPELL_STATIC_VISUAL 45265 -#define SPELL_CALL_LIGHTNING 43661 //Missing timer -#define SPELL_GUST_OF_WIND 43621 -#define SPELL_ELECTRICAL_STORM 43648 -#define SPELL_BERSERK 45078 -#define SPELL_ELECTRICAL_DAMAGE 43657 -#define SPELL_ELECTRICAL_OVERLOAD 43658 -#define SPELL_EAGLE_SWOOP 44732 +enum Spells +{ + SPELL_STATIC_DISRUPTION = 43622, + SPELL_STATIC_VISUAL = 45265, + SPELL_CALL_LIGHTNING = 43661, //Missing timer + SPELL_GUST_OF_WIND = 43621, + SPELL_ELECTRICAL_STORM = 43648, + SPELL_BERSERK = 45078, + SPELL_ELECTRICAL_DAMAGE = 43657, + SPELL_ELECTRICAL_OVERLOAD = 43658, + SPELL_EAGLE_SWOOP = 44732 +}; //"Your death gonna be quick, strangers. You shoulda never have come to this place..." #define SAY_ONAGGRO "I be da predator! You da prey..." @@ -75,9 +78,9 @@ class boss_akilzon : public CreatureScript SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE); if (TempSpell) TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 BirdGUIDs[8]; uint64 TargetGUID; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 08896c91b1b..5b43bbbfd10 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -86,14 +86,14 @@ class boss_halazzi : public CreatureScript { boss_halazziAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); // need to find out what controls totem's spell cooldown SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING); if (TempSpell && TempSpell->CastingTimeIndex != 5) TempSpell->CastingTimeIndex = 5; // 2000 ms casting time } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 FrenzyTimer; uint32 SaberlashTimer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index b968f89ae8e..0b026ce826d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -177,11 +177,11 @@ static PlayerAbilityStruct PlayerAbility[][3] = struct boss_hexlord_addAI : public ScriptedAI { - ScriptedInstance* pInstance; + InstanceScript* pInstance; boss_hexlord_addAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } void Reset() {} @@ -213,13 +213,13 @@ class boss_hexlord_malacrass : public CreatureScript { boss_hex_lord_malacrassAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); SelectAddEntry(); for (uint8 i = 0; i < 4; ++i) AddGUID[i] = 0; } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 AddGUID[4]; uint32 AddEntry[4]; @@ -469,7 +469,7 @@ class boss_hexlord_malacrass : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new boss_hexlord_malacrassAI(creature); + return new boss_hex_lord_malacrassAI(creature); } }; @@ -937,7 +937,7 @@ void AddSC_boss_hex_lord_malacrass() { new boss_hexlord_malacrass(); new boss_thurg(); - new boss_gazakroth(); + // new boss_gazakroth(); new boss_lord_raadan(); new boss_darkheart(); new boss_slither(); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index a7e020c2e66..3604a5d3678 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -114,7 +114,7 @@ class boss_janalai : public CreatureScript { boss_janalaiAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); SpellEntry *TempSpell = GET_SPELL(SPELL_HATCH_EGG); if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) @@ -124,7 +124,7 @@ class boss_janalai : public CreatureScript } } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 FireBreathTimer; uint32 BombTimer; @@ -493,12 +493,12 @@ class mob_janalai_hatcher : public CreatureScript struct mob_janalai_hatcherAI : public ScriptedAI { - mob_amanishi_hatcherAI(Creature *c) : ScriptedAI(c) + mob_janalai_hatcherAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 waypoint; uint32 HatchNum; @@ -628,10 +628,10 @@ class mob_janalai_hatchling : public CreatureScript { mob_janalai_hatchlingAI(Creature *c) : ScriptedAI(c) { - pInstance =c->GetInstanceData(); + pInstance =c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 BuffetTimer; void Reset() @@ -676,38 +676,37 @@ class mob_janalai_hatchling : public CreatureScript class mob_janalai_egg : public CreatureScript { - public: +public: - mob_janalai_egg() - : CreatureScript("mob_janalai_egg") - { - } - - - - CreatureAI* GetAI(Creature* creature) const - { - return new mob_janalai_eggAI(creature); - } -}; - -struct mob_eggAI : public ScriptedAI -{ - mob_eggAI(Creature *c) : ScriptedAI(c){} - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + mob_janalai_egg() + : CreatureScript("mob_janalai_egg") { - if (spell->Id == SPELL_HATCH_EGG) - { - DoSpawnCreature(MOB_HATCHLING, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->SetDisplayId(11686); - } } + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_janalai_eggAI(creature); + } + + struct mob_janalai_eggAI : public ScriptedAI + { + mob_janalai_eggAI(Creature *c) : ScriptedAI(c){} + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_HATCH_EGG) + { + DoSpawnCreature(MOB_HATCHLING, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->SetDisplayId(11686); + } + } + }; + }; void AddSC_boss_janalai() diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index d1e8912f18e..6bcc5553e1d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -105,10 +105,10 @@ class boss_nalorakk : public CreatureScript { MoveEvent = true; MovePhase = 0; - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 BrutalSwipe_Timer; uint32 Mangle_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp index 6f442afa064..40eb40f6fcf 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp @@ -153,9 +153,9 @@ class boss_zuljin : public CreatureScript { boss_zuljinAI(Creature *c) : ScriptedAI(c), Summons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint64 SpiritGUID[4]; uint64 ClawTargetGUID; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index b600ea26ad9..065f6f1ef51 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -59,9 +59,9 @@ class instance_zulaman : public InstanceMapScript { } - struct instance_zulaman_InstanceMapScript : public ScriptedInstance + struct instance_zulaman_InstanceMapScript : public InstanceScript { - instance_zulaman_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_zulaman_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 HarkorsSatchelGUID; uint64 TanzarsTrunkGUID; @@ -314,7 +314,7 @@ class instance_zulaman : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_zulaman_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 4a4a5e06f76..79d6ce4e3a5 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -51,10 +51,10 @@ class npc_forest_frog : public CreatureScript { npc_forest_frogAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() {} @@ -166,7 +166,7 @@ class npc_zulaman_hostage : public CreatureScript return true; pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); + InstanceScript* pInstance = pCreature->GetInstanceScript(); if (pInstance) { //uint8 progress = pInstance->GetData(DATA_CHESTLOOTED); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index d20a124f5a0..4f86318c5b6 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -61,10 +61,10 @@ class boss_arlokk : public CreatureScript { boss_arlokkAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance = pCreature->GetInstanceData(); + m_pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* m_pInstance; + InstanceScript* m_pInstance; uint32 m_uiShadowWordPain_Timer; uint32 m_uiGouge_Timer; @@ -271,7 +271,7 @@ class go_gong_of_bethekk : public GameObjectScript bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) { - if (ScriptedInstance* m_pInstance = pGo->GetInstanceData()) + if (InstanceScript* m_pInstance = pGo->GetInstanceScript()) { if (m_pInstance->GetData(TYPE_ARLOKK) == DONE || m_pInstance->GetData(TYPE_ARLOKK) == IN_PROGRESS) return true; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 680a68f773a..5d226bca91b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -57,10 +57,10 @@ class boss_hakkar : public CreatureScript { boss_hakkarAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index 34340ba7896..c9d20db0380 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -56,10 +56,10 @@ class boss_jeklik : public CreatureScript { boss_jeklikAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -238,10 +238,10 @@ class mob_batrider : public CreatureScript { mob_batriderAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 Bomb_Timer; uint32 Check_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 689cc4dae27..d98fbf0f559 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -189,12 +189,12 @@ class mob_healing_ward : public CreatureScript { mob_healing_wardAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 Heal_Timer; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 3c8ab2fdf23..90adeb5743a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -57,7 +57,7 @@ class boss_mandokir : public CreatureScript { boss_mandokirAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 KillCount; @@ -72,7 +72,7 @@ class boss_mandokir : public CreatureScript float targetY; float targetZ; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; bool endWatch; bool someWatched; @@ -296,11 +296,11 @@ class mob_ohgan : public CreatureScript { mob_ohganAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 SunderArmor_Timer; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index 644ccc6788a..0963057f299 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -53,10 +53,10 @@ class boss_marli : public CreatureScript { boss_marliAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -211,11 +211,10 @@ class boss_marli : public CreatureScript } } }; - CreatureAI* GetAI(Creature* creature) const { - return new example_creatureAI(creature); + return new boss_marliAI(creature); } }; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index d4bbf4704ca..99392a6c7ce 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -68,7 +68,7 @@ class boss_thekal : public CreatureScript { boss_thekalAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 MortalCleave_Timer; @@ -81,7 +81,7 @@ class boss_thekal : public CreatureScript uint32 Check_Timer; uint32 Resurrect_Timer; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; bool Enraged; bool PhaseTwo; bool WasDead; @@ -276,7 +276,7 @@ class mob_zealot_lorkhan : public CreatureScript { mob_zealot_lorkhanAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 Shield_Timer; @@ -287,7 +287,7 @@ class mob_zealot_lorkhan : public CreatureScript bool FakeDeath; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { @@ -433,7 +433,7 @@ class mob_zealot_zath : public CreatureScript { mob_zealot_zathAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } uint32 SweepingStrikes_Timer; @@ -445,7 +445,7 @@ class mob_zealot_zath : public CreatureScript bool FakeDeath; - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index b3530fb1a29..b0172c041a4 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -52,10 +52,10 @@ class boss_venoxis : public CreatureScript { boss_venoxisAI(Creature *c) : ScriptedAI(c) { - m_pInstance = c->GetInstanceData(); + m_pInstance = c->GetInstanceScript(); } - ScriptedInstance *m_pInstance; + InstanceScript *m_pInstance; uint32 HolyFire_Timer; uint32 HolyWrath_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index 6649ea66528..4f496a72c6c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -34,9 +34,9 @@ class instance_zulgurub : public InstanceMapScript { } - struct instance_zulgurub_InstanceMapScript : public ScriptedInstance + struct instance_zulgurub_InstanceMapScript : public InstanceScript { - instance_zulgurub(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_zulgurub_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; //If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too. uint32 m_auiEncounter[MAX_ENCOUNTERS]; @@ -153,7 +153,7 @@ class instance_zulgurub : public InstanceMapScript } }; - InstanceData* OnGetInstanceData(InstanceMap* pMap) + InstanceScript* OnGetInstanceData(InstanceMap* pMap) { return new instance_zulgurub_InstanceMapScript(pMap); } diff --git a/src/server/scripts/EasternKingdoms/blasted_lands.cpp b/src/server/scripts/EasternKingdoms/blasted_lands.cpp index cbeb8d45ffe..5f0cdcbf892 100644 --- a/src/server/scripts/EasternKingdoms/blasted_lands.cpp +++ b/src/server/scripts/EasternKingdoms/blasted_lands.cpp @@ -39,27 +39,34 @@ EndContentData */ #define SPELL_TELEPORT_SINGLE 12885 #define SPELL_TELEPORT_SINGLE_IN_GROUP 13142 #define SPELL_TELEPORT_GROUP 27686 - -bool GossipHello_npc_deathly_usher(Player* pPlayer, Creature* pCreature) + class npc_deathly_usher : public CreatureScript { - if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); +public: + npc_deathly_usher() : CreatureScript("npc_deathly_usher") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_TELEPORT_SINGLE, true); + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_TELEPORT_SINGLE, true); + } + + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(3628) == QUEST_STATUS_INCOMPLETE && pPlayer->HasItemCount(10757, 1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_USHER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_fallen_hero_of_horde @@ -74,90 +81,86 @@ bool GossipSelect_npc_deathly_usher(Player* pPlayer, Creature* pCreature, uint32 #define GOSSIP_ITEM_FALLEN3 "What are the stones of binding?" #define GOSSIP_ITEM_FALLEN4 "You can count on me, Hero" #define GOSSIP_ITEM_FALLEN5 "I shall" - -bool GossipHello_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature) + class npc_fallen_hero_of_horde : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_fallen_hero_of_horde() : CreatureScript("npc_fallen_hero_of_horde") { } - if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == HORDE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_fallen_hero_of_horde(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(1392, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(2784); - if (pPlayer->GetTeam() == ALLIANCE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(1392, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); - } - break; + if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(2784); + if (pPlayer->GetTeam() == ALLIANCE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1411, pCreature->GetGUID()); + } + break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - pPlayer->SEND_GOSSIP_MENU(1451, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(1452, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - pPlayer->SEND_GOSSIP_MENU(1453, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+23: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); - pPlayer->SEND_GOSSIP_MENU(1454, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+24: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); - pPlayer->SEND_GOSSIP_MENU(1455, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+25: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); - pPlayer->SEND_GOSSIP_MENU(1456, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+26: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2801); - break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + pPlayer->SEND_GOSSIP_MENU(1451, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+21: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(1452, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + pPlayer->SEND_GOSSIP_MENU(1453, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+23: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); + pPlayer->SEND_GOSSIP_MENU(1454, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+24: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); + pPlayer->SEND_GOSSIP_MENU(1455, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+25: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FALLEN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 26); + pPlayer->SEND_GOSSIP_MENU(1456, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+26: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2801); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(2784) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == HORDE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + if (pPlayer->GetQuestStatus(2801) == QUEST_STATUS_INCOMPLETE && pPlayer->GetTeam() == ALLIANCE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_F1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_blasted_lands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_deathly_usher"; - newscript->pGossipHello = &GossipHello_npc_deathly_usher; - newscript->pGossipSelect = &GossipSelect_npc_deathly_usher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_fallen_hero_of_horde"; - newscript->pGossipHello = &GossipHello_npc_fallen_hero_of_horde; - newscript->pGossipSelect = &GossipSelect_npc_fallen_hero_of_horde; - newscript->RegisterSelf(); + new npc_deathly_usher(); + new npc_fallen_hero_of_horde(); } diff --git a/src/server/scripts/EasternKingdoms/boss_kruul.cpp b/src/server/scripts/EasternKingdoms/boss_kruul.cpp index d6a6cb76d59..afb0f50fd8b 100644 --- a/src/server/scripts/EasternKingdoms/boss_kruul.cpp +++ b/src/server/scripts/EasternKingdoms/boss_kruul.cpp @@ -32,125 +32,128 @@ EndScriptData */ #define SPELL_VOIDBOLT 21066 #define SPELL_RAGE 21340 #define SPELL_CAPTURESOUL 21054 - -struct boss_kruulAI : public ScriptedAI + class boss_kruul : public CreatureScript { - boss_kruulAI(Creature *c) : ScriptedAI(c) {} +public: + boss_kruul() : CreatureScript("boss_kruul") { } - uint32 ShadowVolley_Timer; - uint32 Cleave_Timer; - uint32 ThunderClap_Timer; - uint32 TwistedReflection_Timer; - uint32 VoidBolt_Timer; - uint32 Rage_Timer; - uint32 Hound_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowVolley_Timer = 10000; - Cleave_Timer = 14000; - ThunderClap_Timer = 20000; - TwistedReflection_Timer = 25000; - VoidBolt_Timer = 30000; - Rage_Timer = 60000; //Cast rage after 1 minute - Hound_Timer = 8000; + return new boss_kruulAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_kruulAI : public ScriptedAI { - } + boss_kruulAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit() - { - // When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health. - DoCast(me, SPELL_CAPTURESOUL); - } + uint32 ShadowVolley_Timer; + uint32 Cleave_Timer; + uint32 ThunderClap_Timer; + uint32 TwistedReflection_Timer; + uint32 VoidBolt_Timer; + uint32 Rage_Timer; + uint32 Hound_Timer; - void SummonHounds(Unit* pVictim) - { - if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) - Hound->AI()->AttackStart(pVictim); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void Reset() { - if (urand(0,99) < 45) - DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); + ShadowVolley_Timer = 10000; + Cleave_Timer = 14000; + ThunderClap_Timer = 20000; + TwistedReflection_Timer = 25000; + VoidBolt_Timer = 30000; + Rage_Timer = 60000; //Cast rage after 1 minute + Hound_Timer = 8000; + } - ShadowVolley_Timer = 5000; - } else ShadowVolley_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (urand(0,1)) - DoCast(me->getVictim(), SPELL_CLEAVE); + } - Cleave_Timer = 10000; - } else Cleave_Timer -= diff; - - //ThunderClap_Timer - if (ThunderClap_Timer <= diff) + void KilledUnit() { - if (urand(0,9) < 2) - DoCast(me->getVictim(), SPELL_THUNDERCLAP); + // When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health. + DoCast(me, SPELL_CAPTURESOUL); + } - ThunderClap_Timer = 12000; - } else ThunderClap_Timer -= diff; - - //TwistedReflection_Timer - if (TwistedReflection_Timer <= diff) + void SummonHounds(Unit* pVictim) { - DoCast(me->getVictim(), SPELL_TWISTEDREFLECTION); - TwistedReflection_Timer = 30000; - } else TwistedReflection_Timer -= diff; + if (Creature *Hound = DoSpawnCreature(19207, irand(-9,9), irand(-9,9), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + Hound->AI()->AttackStart(pVictim); + } - //VoidBolt_Timer - if (VoidBolt_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (urand(0,9) < 4) - DoCast(me->getVictim(), SPELL_VOIDBOLT); + //Return since we have no target + if (!UpdateVictim()) + return; - VoidBolt_Timer = 18000; - } else VoidBolt_Timer -= diff; + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) + { + if (urand(0,99) < 45) + DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); - //Rage_Timer - if (Rage_Timer <= diff) - { - DoCast(me, SPELL_RAGE); - Rage_Timer = 70000; - } else Rage_Timer -= diff; + ShadowVolley_Timer = 5000; + } else ShadowVolley_Timer -= diff; - //Hound_Timer - if (Hound_Timer <= diff) - { - SummonHounds(me->getVictim()); - SummonHounds(me->getVictim()); - SummonHounds(me->getVictim()); + //Cleave_Timer + if (Cleave_Timer <= diff) + { + if (urand(0,1)) + DoCast(me->getVictim(), SPELL_CLEAVE); - Hound_Timer = 45000; - } else Hound_Timer -= diff; + Cleave_Timer = 10000; + } else Cleave_Timer -= diff; + + //ThunderClap_Timer + if (ThunderClap_Timer <= diff) + { + if (urand(0,9) < 2) + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + + ThunderClap_Timer = 12000; + } else ThunderClap_Timer -= diff; + + //TwistedReflection_Timer + if (TwistedReflection_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TWISTEDREFLECTION); + TwistedReflection_Timer = 30000; + } else TwistedReflection_Timer -= diff; + + //VoidBolt_Timer + if (VoidBolt_Timer <= diff) + { + if (urand(0,9) < 4) + DoCast(me->getVictim(), SPELL_VOIDBOLT); + + VoidBolt_Timer = 18000; + } else VoidBolt_Timer -= diff; + + //Rage_Timer + if (Rage_Timer <= diff) + { + DoCast(me, SPELL_RAGE); + Rage_Timer = 70000; + } else Rage_Timer -= diff; + + //Hound_Timer + if (Hound_Timer <= diff) + { + SummonHounds(me->getVictim()); + SummonHounds(me->getVictim()); + SummonHounds(me->getVictim()); + + Hound_Timer = 45000; + } else Hound_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kruul(Creature* pCreature) -{ - return new boss_kruulAI (pCreature); -} void AddSC_boss_kruul() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kruul"; - newscript->GetAI = &GetAI_boss_kruul; - newscript->RegisterSelf(); + new boss_kruul(); } diff --git a/src/server/scripts/EasternKingdoms/burning_steppes.cpp b/src/server/scripts/EasternKingdoms/burning_steppes.cpp index de543258b40..32157a16439 100644 --- a/src/server/scripts/EasternKingdoms/burning_steppes.cpp +++ b/src/server/scripts/EasternKingdoms/burning_steppes.cpp @@ -45,111 +45,113 @@ EndContentData */ #define GOSSIP_SELECT9 "300? So the Dark Irons killed him and dragged him into the Depths?" #define GOSSIP_SELECT10 "Ahh... Ironfoe" #define GOSSIP_SELECT11 "Thanks, Ragged John. Your story was very uplifting and informative" - -struct npc_ragged_johnAI : public ScriptedAI + class npc_ragged_john : public CreatureScript { - npc_ragged_johnAI(Creature *c) : ScriptedAI(c) {} +public: + npc_ragged_john() : CreatureScript("npc_ragged_john") { } - void Reset() {} - - void MoveInLineOfSight(Unit *who) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (who->HasAura(16468)) + switch (uiAction) { - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me)) + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2714, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2715, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2716, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(2717, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(2718, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(2719, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(2720, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); + pPlayer->SEND_GOSSIP_MENU(2721, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+8: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); + pPlayer->SEND_GOSSIP_MENU(2722, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+9: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + pPlayer->SEND_GOSSIP_MENU(2723, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(2725, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(4224); + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(2713, pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ragged_johnAI (pCreature); + } + + struct npc_ragged_johnAI : public ScriptedAI + { + npc_ragged_johnAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void MoveInLineOfSight(Unit *who) + { + if (who->HasAura(16468)) { - DoCast(who, 16472); - CAST_PLR(who)->AreaExploredOrEventHappens(4866); + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me)) + { + DoCast(who, 16472); + CAST_PLR(who)->AreaExploredOrEventHappens(4866); + } } + + ScriptedAI::MoveInLineOfSight(who); } - ScriptedAI::MoveInLineOfSight(who); - } + void EnterCombat(Unit * /*who*/) {} + }; - void EnterCombat(Unit * /*who*/) {} }; -CreatureAI* GetAI_npc_ragged_john(Creature* pCreature) -{ - return new npc_ragged_johnAI (pCreature); -} -bool GossipHello_npc_ragged_john(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(4224) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(2713, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_ragged_john(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2714, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2715, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2716, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(2717, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(2718, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(2719, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(2720, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 8); - pPlayer->SEND_GOSSIP_MENU(2721, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+8: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9); - pPlayer->SEND_GOSSIP_MENU(2722, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+9: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - pPlayer->SEND_GOSSIP_MENU(2723, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(2725, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(4224); - break; - } - return true; -} void AddSC_burning_steppes() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_ragged_john"; - newscript->GetAI = &GetAI_npc_ragged_john; - newscript->pGossipHello = &GossipHello_npc_ragged_john; - newscript->pGossipSelect = &GossipSelect_npc_ragged_john; - newscript->RegisterSelf(); + new npc_ragged_john(); } diff --git a/src/server/scripts/EasternKingdoms/dun_morogh.cpp b/src/server/scripts/EasternKingdoms/dun_morogh.cpp index c170529aa45..9b3f879df97 100644 --- a/src/server/scripts/EasternKingdoms/dun_morogh.cpp +++ b/src/server/scripts/EasternKingdoms/dun_morogh.cpp @@ -35,70 +35,72 @@ EndContentData */ // signed for 6172 #define SAY_HEAL -1100280 - -struct npc_narm_faulkAI : public ScriptedAI + class npc_narm_faulk : public CreatureScript { - uint32 lifeTimer; - bool spellHit; +public: + npc_narm_faulk() : CreatureScript("npc_narm_faulk") { } - npc_narm_faulkAI(Creature *c) : ScriptedAI(c) {} - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); - spellHit = false; + return new npc_narm_faulkAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_narm_faulkAI : public ScriptedAI { - } + uint32 lifeTimer; + bool spellHit; - void MoveInLineOfSight(Unit * /*who*/) - { - return; - } + npc_narm_faulkAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() { - if (lifeTimer <= diff) + lifeTimer = 120000; + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); + spellHit = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void MoveInLineOfSight(Unit * /*who*/) + { + return; + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) { - EnterEvadeMode(); - return; + if (lifeTimer <= diff) + { + EnterEvadeMode(); + return; + } + else + lifeTimer -= diff; } - else - lifeTimer -= diff; } - } - void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) - { - if (Spellkind->Id == 8593 && !spellHit) + void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) { - DoCast(me, 32343); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; + if (Spellkind->Id == 8593 && !spellHit) + { + DoCast(me, 32343); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } } - } + + }; }; -CreatureAI* GetAI_npc_narm_faulk(Creature* pCreature) -{ - return new npc_narm_faulkAI (pCreature); -} void AddSC_dun_morogh() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_narm_faulk"; - newscript->GetAI = &GetAI_npc_narm_faulk; - newscript->RegisterSelf(); + new npc_narm_faulk(); } diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index 3dcf9a01f6a..f40aa0fd86f 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -28,24 +28,30 @@ EndScriptData */ /*###### # at_twilight_grove ######*/ - -bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*at*/) + class at_twilight_grove : public AreaTriggerScript { - if (pPlayer->HasQuestForItem(21149)) +public: + at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000)) + if (pPlayer->HasQuestForItem(21149)) { - TCorrupter->setFaction(14); - TCorrupter->SetMaxHealth(832750); + if (Unit* TCorrupter = pPlayer->SummonCreature(15625,-10328.16,-489.57,49.95,0,TEMPSUMMON_MANUAL_DESPAWN,60000)) + { + TCorrupter->setFaction(14); + TCorrupter->SetMaxHealth(832750); + } + if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000)) + { + CorrupterSpeaker->SetName("Twilight Corrupter"); + CorrupterSpeaker->SetVisibility(VISIBILITY_ON); + CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID()); + } } - if (Unit* CorrupterSpeaker = pPlayer->SummonCreature(1,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()-1,0,TEMPSUMMON_TIMED_DESPAWN,15000)) - { - CorrupterSpeaker->SetName("Twilight Corrupter"); - CorrupterSpeaker->SetVisibility(VISIBILITY_ON); - CorrupterSpeaker->MonsterYell("Come, $N. See what the Nightmare brings...",0,pPlayer->GetGUID()); - } - } - return false; + return false; + }; + }; /*###### @@ -55,74 +61,72 @@ bool AreaTrigger_at_twilight_grove(Player* pPlayer, const AreaTriggerEntry * /*a #define SPELL_SOUL_CORRUPTION 25805 #define SPELL_CREATURE_OF_NIGHTMARE 25806 #define SPELL_LEVEL_UP 24312 - -struct boss_twilight_corrupterAI : public ScriptedAI + class boss_twilight_corrupter : public CreatureScript { - boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {} +public: + boss_twilight_corrupter() : CreatureScript("boss_twilight_corrupter") { } - uint32 SoulCorruption_Timer; - uint32 CreatureOfNightmare_Timer; - uint8 KillCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SoulCorruption_Timer = 15000; - CreatureOfNightmare_Timer = 30000; - KillCount = 0; - } - void EnterCombat(Unit* /*who*/) - { - me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID()); + return new boss_twilight_corrupterAI (pCreature); } - void KilledUnit(Unit* victim) + struct boss_twilight_corrupterAI : public ScriptedAI { - if (victim->GetTypeId() == TYPEID_PLAYER) + boss_twilight_corrupterAI(Creature *c) : ScriptedAI(c) {} + + uint32 SoulCorruption_Timer; + uint32 CreatureOfNightmare_Timer; + uint8 KillCount; + + void Reset() { - ++KillCount; - me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true); + SoulCorruption_Timer = 15000; + CreatureOfNightmare_Timer = 30000; + KillCount = 0; + } + void EnterCombat(Unit* /*who*/) + { + me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID()); + } - if (KillCount == 3) + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER) { - DoCast(me, SPELL_LEVEL_UP, true); - KillCount = 0; + ++KillCount; + me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true); + + if (KillCount == 3) + { + DoCast(me, SPELL_LEVEL_UP, true); + KillCount = 0; + } } } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (SoulCorruption_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION); - SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers - } else SoulCorruption_Timer-=diff; - if (CreatureOfNightmare_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE); - CreatureOfNightmare_Timer = 45000; //gotta confirm Timers - } else CreatureOfNightmare_Timer-=diff; - DoMeleeAttackIfReady(); + if (!UpdateVictim()) + return; + if (SoulCorruption_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION); + SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers + } else SoulCorruption_Timer-=diff; + if (CreatureOfNightmare_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE); + CreatureOfNightmare_Timer = 45000; //gotta confirm Timers + } else CreatureOfNightmare_Timer-=diff; + DoMeleeAttackIfReady(); + }; }; + }; -CreatureAI* GetAI_boss_twilight_corrupter(Creature* pCreature) -{ - return new boss_twilight_corrupterAI (pCreature); -} void AddSC_duskwood() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_twilight_corrupter"; - newscript->GetAI = &GetAI_boss_twilight_corrupter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_twilight_grove"; - newscript->pAreaTrigger = &AreaTrigger_at_twilight_grove; - newscript->RegisterSelf(); + new boss_twilight_corrupter(); + new at_twilight_grove(); } diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp index 32091439b1f..7a7421548a2 100644 --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp @@ -35,81 +35,103 @@ EndContentData */ //id8530 - cannibal ghoul //id8531 - gibbering ghoul //id8532 - diseased flayer - -struct mobs_ghoul_flayerAI : public ScriptedAI + class mobs_ghoul_flayer : public CreatureScript { - mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_ghoul_flayer() : CreatureScript("mobs_ghoul_flayer") { } - void Reset() {} - - void EnterCombat(Unit* /*who*/) {} - - void JustDied(Unit* Killer) + CreatureAI* GetAI(Creature* pCreature) const { - if (Killer->GetTypeId() == TYPEID_PLAYER) - me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + return new mobs_ghoul_flayerAI (pCreature); } + + struct mobs_ghoul_flayerAI : public ScriptedAI + { + mobs_ghoul_flayerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + + void EnterCombat(Unit* /*who*/) {} + + void JustDied(Unit* Killer) + { + if (Killer->GetTypeId() == TYPEID_PLAYER) + me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000); + } + }; + }; -CreatureAI* GetAI_mobs_ghoul_flayer(Creature* pCreature) -{ - return new mobs_ghoul_flayerAI (pCreature); -} /*###### ## npc_augustus_the_touched ######*/ - -bool GossipHello_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature) + class npc_augustus_the_touched : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_augustus_the_touched() : CreatureScript("npc_augustus_the_touched") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(6164)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; -bool GossipSelect_npc_augustus_the_touched(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} /*###### ## npc_darrowshire_spirit ######*/ #define SPELL_SPIRIT_SPAWNIN 17321 - -struct npc_darrowshire_spiritAI : public ScriptedAI + class npc_darrowshire_spirit : public CreatureScript { - npc_darrowshire_spiritAI(Creature *c) : ScriptedAI(c) {} +public: + npc_darrowshire_spirit() : CreatureScript("npc_darrowshire_spirit") { } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - DoCast(me, SPELL_SPIRIT_SPAWNIN); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pPlayer->SEND_GOSSIP_MENU(3873, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + return true; } - void EnterCombat(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_darrowshire_spiritAI (pCreature); + } + + struct npc_darrowshire_spiritAI : public ScriptedAI + { + npc_darrowshire_spiritAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + DoCast(me, SPELL_SPIRIT_SPAWNIN); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/) {} + + }; }; -CreatureAI* GetAI_npc_darrowshire_spirit(Creature* pCreature) -{ - return new npc_darrowshire_spiritAI (pCreature); -} -bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) -{ - pPlayer->SEND_GOSSIP_MENU(3873, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - return true; -} /*###### ## npc_tirion_fordring @@ -119,69 +141,55 @@ bool GossipHello_npc_darrowshire_spirit(Player* pPlayer, Creature* pCreature) #define GOSSIP_SELECT1 "Thank you, Tirion. What of your identity?" #define GOSSIP_SELECT2 "That is terrible." #define GOSSIP_SELECT3 "I will, Tirion." - -bool GossipHello_npc_tirion_fordring(Player* pPlayer, Creature* pCreature) + class npc_tirion_fordring : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_tirion_fordring() : CreatureScript("npc_tirion_fordring") { } - if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_tirion_fordring(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4493, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4494, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(4495, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(5742); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(4493, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4494, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(4495, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(5742); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && pPlayer->getStandState() == UNIT_STAND_STATE_SIT) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_eastern_plaguelands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_ghoul_flayer"; - newscript->GetAI = &GetAI_mobs_ghoul_flayer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_augustus_the_touched"; - newscript->pGossipHello = &GossipHello_npc_augustus_the_touched; - newscript->pGossipSelect = &GossipSelect_npc_augustus_the_touched; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_darrowshire_spirit"; - newscript->GetAI = &GetAI_npc_darrowshire_spirit; - newscript->pGossipHello = &GossipHello_npc_darrowshire_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tirion_fordring"; - newscript->pGossipHello = &GossipHello_npc_tirion_fordring; - newscript->pGossipSelect = &GossipSelect_npc_tirion_fordring; - newscript->RegisterSelf(); + new mobs_ghoul_flayer(); + new npc_augustus_the_touched(); + new npc_darrowshire_spirit(); + new npc_tirion_fordring(); } - diff --git a/src/server/scripts/EasternKingdoms/elwynn_forest.cpp b/src/server/scripts/EasternKingdoms/elwynn_forest.cpp index 8b56c16f8fa..fb01585c2b4 100644 --- a/src/server/scripts/EasternKingdoms/elwynn_forest.cpp +++ b/src/server/scripts/EasternKingdoms/elwynn_forest.cpp @@ -34,70 +34,72 @@ EndContentData */ ######*/ #define SAY_HEAL -1100280 - -struct npc_henze_faulkAI : public ScriptedAI + class npc_henze_faulk : public CreatureScript { - uint32 lifeTimer; - bool spellHit; +public: + npc_henze_faulk() : CreatureScript("npc_henze_faulk") { } - npc_henze_faulkAI(Creature *c) : ScriptedAI(c) {} - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); // lay down - spellHit = false; + return new npc_henze_faulkAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_henze_faulkAI : public ScriptedAI { - } + uint32 lifeTimer; + bool spellHit; - void MoveInLineOfSight(Unit * /*who*/) - { - return; - } + npc_henze_faulkAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() { - if (lifeTimer <= diff) + lifeTimer = 120000; + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); // lay down + spellHit = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void MoveInLineOfSight(Unit * /*who*/) + { + return; + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) { - EnterEvadeMode(); - return; + if (lifeTimer <= diff) + { + EnterEvadeMode(); + return; + } + else + lifeTimer -= diff; } - else - lifeTimer -= diff; } - } - void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) - { - if (Spellkind->Id == 8593 && !spellHit) + void SpellHit(Unit * /*Hitter*/, const SpellEntry *Spellkind) { - DoCast(me, 32343); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; + if (Spellkind->Id == 8593 && !spellHit) + { + DoCast(me, 32343); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } } - } + + }; }; -CreatureAI* GetAI_npc_henze_faulk(Creature* pCreature) -{ - return new npc_henze_faulkAI (pCreature); -} void AddSC_elwynn_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_henze_faulk"; - newscript->GetAI = &GetAI_npc_henze_faulk; - newscript->RegisterSelf(); + new npc_henze_faulk(); } diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index a463e3fb225..db377a9fe63 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -47,69 +47,78 @@ enum eProspectorAnvilward SAY_ANVIL2 = -1000210, QUEST_THE_DWARVEN_SPY = 8483, }; - -struct npc_prospector_anvilwardAI : public npc_escortAI + class npc_prospector_anvilward : public CreatureScript { - // CreatureAI functions - npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {} +public: + npc_prospector_anvilward() : CreatureScript("npc_prospector_anvilward") { } - // Pure Virtual Functions - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + switch(uiAction) { - case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break; - case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break; - case 6: me->setFaction(24); break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(8240, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilward::npc_prospector_anvilwardAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + break; } + return true; } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->RestoreFaction(); + if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID()); + return true; } - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* pCreature) const { - me->RestoreFaction(); + return new npc_prospector_anvilwardAI(pCreature); } + + struct npc_prospector_anvilwardAI : public npc_escortAI + { + // CreatureAI functions + npc_prospector_anvilwardAI(Creature *c) : npc_escortAI(c) {} + + // Pure Virtual Functions + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break; + case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break; + case 6: me->setFaction(24); break; + } + } + + void Reset() + { + me->RestoreFaction(); + } + + void JustDied(Unit* /*killer*/) + { + me->RestoreFaction(); + } + }; + }; -CreatureAI* GetAI_npc_prospector_anvilward(Creature* pCreature) -{ - return new npc_prospector_anvilwardAI(pCreature); -} -bool GossipHello_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_THE_DWARVEN_SPY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(8239, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_prospector_anvilward(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(8240, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_anvilwardAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - break; - } - return true; -} /*###### ## Quest 9686 Second Trial @@ -167,275 +176,304 @@ static uint32 PaladinEntry[] = {CHAMPION_BLOODWRATH, CHAMPION_LIGHTREND, CHAMPIO /*###### ## npc_second_trial_paladin ######*/ - -struct npc_secondTrialAI : public ScriptedAI + class npc_second_trial_paladin : public CreatureScript { - npc_secondTrialAI(Creature *c) : ScriptedAI(c) {} +public: + npc_second_trial_paladin() : CreatureScript("npc_second_trial_paladin") { } - uint32 timer; - uint8 questPhase; - uint64 summonerGuid; - - bool spellFlashLight; - bool spellJustice; - bool spellJudLight; - bool spellCommand; - - uint32 timerFlashLight; - uint32 timerJustice; - uint32 timerJudLight; - uint32 timerCommand; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - - timer = 2000; - questPhase = 0; - summonerGuid = 0; - - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL); - me->setFaction(FACTION_FRIENDLY); - - spellFlashLight = false; - spellJustice = false; - spellJudLight = false; - spellCommand = false; - - switch(me->GetEntry()) - { - case CHAMPION_BLOODWRATH: - spellFlashLight = true; - timerFlashLight = TIMER_FLASH_OF_LIGHT; - break; - case CHAMPION_LIGHTREND: - spellJustice = true; - timerJustice = 500; - break; - case CHAMPION_SWIFTBLADE: - spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 - timerJudLight = 500; - break; - case CHAMPION_SUNSTRIKER: - spellFlashLight = true; - spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 - spellCommand = false; // Misses Dummy // http://www.wowhead.com/?spell=20375 - timerFlashLight = TIMER_FLASH_OF_LIGHT; - timerJudLight = 500; - timerCommand = 1500; - break; - } + return new npc_secondTrialAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct npc_secondTrialAI : public ScriptedAI { - if (questPhase == 1) - if (timer <= diff) - { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - me->setFaction(FACTION_HOSTILE); - questPhase = 0; + npc_secondTrialAI(Creature *c) : ScriptedAI(c) {} - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + uint32 timer; + uint8 questPhase; + uint64 summonerGuid; + + bool spellFlashLight; + bool spellJustice; + bool spellJudLight; + bool spellCommand; + + uint32 timerFlashLight; + uint32 timerJustice; + uint32 timerJudLight; + uint32 timerCommand; + + void Reset() + { + + timer = 2000; + questPhase = 0; + summonerGuid = 0; + + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL); + me->setFaction(FACTION_FRIENDLY); + + spellFlashLight = false; + spellJustice = false; + spellJudLight = false; + spellCommand = false; + + switch(me->GetEntry()) + { + case CHAMPION_BLOODWRATH: + spellFlashLight = true; + timerFlashLight = TIMER_FLASH_OF_LIGHT; + break; + case CHAMPION_LIGHTREND: + spellJustice = true; + timerJustice = 500; + break; + case CHAMPION_SWIFTBLADE: + spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 + timerJudLight = 500; + break; + case CHAMPION_SUNSTRIKER: + spellFlashLight = true; + spellJudLight = false; // Misses Script Effect // http://www.wowhead.com/?spell=20271 + spellCommand = false; // Misses Dummy // http://www.wowhead.com/?spell=20375 + timerFlashLight = TIMER_FLASH_OF_LIGHT; + timerJudLight = 500; + timerCommand = 1500; + break; + } + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (questPhase == 1) + if (timer <= diff) { - me->AddThreat(pTarget, 5000000.0f); - AttackStart(pTarget); - } - } - else - timer -= diff; + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + me->setFaction(FACTION_HOSTILE); + questPhase = 0; - if (!UpdateVictim()) - return; - - // healer - if (spellFlashLight) - if (me->GetHealth()*100 / me->GetMaxHealth() < 70) - if (timerFlashLight <= diff) - { - DoCast(me, SPELL_FLASH_OF_LIGHT); - timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT; + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + me->AddThreat(pTarget, 5000000.0f); + AttackStart(pTarget); + } } else - timerFlashLight -= diff; + timer -= diff; - if (spellJustice) - if (timerJustice <= diff) - { - DoCast(me, SPELL_SEAL_OF_JUSTICE); - timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE; - } - else - timerJustice -= diff; + if (!UpdateVictim()) + return; - if (spellJudLight) - if (timerJudLight <= diff) - { - DoCast(me, SPELL_JUDGEMENT_OF_LIGHT); - timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT; - } - else - timerJudLight -= diff; + // healer + if (spellFlashLight) + if (me->GetHealth()*100 / me->GetMaxHealth() < 70) + if (timerFlashLight <= diff) + { + DoCast(me, SPELL_FLASH_OF_LIGHT); + timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT; + } + else + timerFlashLight -= diff; - if (spellCommand) - if (timerCommand <= diff) - { - DoCast(me, TIMER_SEAL_OF_COMMAND); - timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND; - } - else - timerCommand -= diff; + if (spellJustice) + if (timerJustice <= diff) + { + DoCast(me, SPELL_SEAL_OF_JUSTICE); + timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE; + } + else + timerJustice -= diff; - DoMeleeAttackIfReady(); - } + if (spellJudLight) + if (timerJudLight <= diff) + { + DoCast(me, SPELL_JUDGEMENT_OF_LIGHT); + timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT; + } + else + timerJudLight -= diff; - void Activate(uint64 summonerguid); - void KilledUnit(Unit* Killed); - void JustDied(Unit* Killer); + if (spellCommand) + if (timerCommand <= diff) + { + DoCast(me, TIMER_SEAL_OF_COMMAND); + timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND; + } + else + timerCommand -= diff; + DoMeleeAttackIfReady(); + } + + void Activate(uint64 summonerguid) + { + questPhase = 1; + summonerGuid = summonerguid; + } + + void KilledUnit(Unit* Killed) + { + if (Killed->GetTypeId() == TYPEID_PLAYER) + if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) + CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); + } + + void JustDied(Unit* Killer); + }; }; /*###### ## npc_second_trial_controller ######*/ - -struct master_kelerun_bloodmournAI : public ScriptedAI + class npc_second_trial_controller : public CreatureScript { - master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {} +public: + npc_second_trial_controller() : CreatureScript("npc_second_trial_controller") { } - uint8 questPhase; - uint8 paladinPhase; - uint32 timer; - - uint64 paladinGuid[4]; - - void Reset() + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) { - questPhase = 0; - timer = 60000; - paladinPhase = 0; - for (uint8 i = 0; i < 4; ++i) - paladinGuid[i] = 0; + // One Player exclusive quest, wait for user go activation + if (quest->GetQuestId() == QUEST_SECOND_TRIAL) + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1; + + return true; } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - // Quest accepted but object not activated, object despawned (if in sync 1 minute!) - if (questPhase == 1) - { - if (timer <= diff) - Reset(); - else - timer -= diff; - } - // fight the 4 paladin mobs phase - else if (questPhase == 2) - { - if (timer <= diff) - { - if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase])) - { - CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID()); + // quest only available if not already started + // Quest_template flag is set to : QUEST_FLAGS_EVENT + // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest. + // !not sure if this really works! - switch(paladinPhase) + if (CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) + { + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + pPlayer->SendPreparedQuest(pCreature->GetGUID()); + } + + pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new master_kelerun_bloodmournAI (pCreature); + } + + struct master_kelerun_bloodmournAI : public ScriptedAI + { + master_kelerun_bloodmournAI(Creature *c) : ScriptedAI(c) {} + + uint8 questPhase; + uint8 paladinPhase; + uint32 timer; + + uint64 paladinGuid[4]; + + void Reset() + { + questPhase = 0; + timer = 60000; + paladinPhase = 0; + for (uint8 i = 0; i < 4; ++i) + paladinGuid[i] = 0; + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + // Quest accepted but object not activated, object despawned (if in sync 1 minute!) + if (questPhase == 1) + { + if (timer <= diff) + Reset(); + else + timer -= diff; + } + // fight the 4 paladin mobs phase + else if (questPhase == 2) + { + if (timer <= diff) + { + if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase])) { - case 0: - DoScriptText(TEXT_SECOND_TRIAL_1,me); - break; - case 1: - DoScriptText(TEXT_SECOND_TRIAL_2,me); - break; - case 2: - DoScriptText(TEXT_SECOND_TRIAL_3,me); - break; - case 3: - DoScriptText(TEXT_SECOND_TRIAL_4,me); - break; + CAST_AI(npc_second_trial_paladin::npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID()); + + switch(paladinPhase) + { + case 0: + DoScriptText(TEXT_SECOND_TRIAL_1,me); + break; + case 1: + DoScriptText(TEXT_SECOND_TRIAL_2,me); + break; + case 2: + DoScriptText(TEXT_SECOND_TRIAL_3,me); + break; + case 3: + DoScriptText(TEXT_SECOND_TRIAL_4,me); + break; + } } + else + Reset(); + + questPhase = 4; + timer = OFFSET_NEXT_ATTACK; } else - Reset(); - - questPhase = 4; - timer = OFFSET_NEXT_ATTACK; + timer -= diff; } - else - timer -= diff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; + void StartEvent() + { - DoMeleeAttackIfReady(); - } + if (questPhase == 1) + { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code - void StartEvent() - { + for (uint8 i = 0; i < 4; ++i) + if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) + paladinGuid[i] = pSummoned->GetGUID(); - if (questPhase == 1) - { // no player check, quest can be finished as group, so no complex PlayerGUID/group search code - - for (uint8 i = 0; i < 4; ++i) - if (Creature *pSummoned = DoSpawnCreature(PaladinEntry[i], SpawnPosition[i].x, SpawnPosition[i].y, SpawnPosition[i].z, SpawnPosition[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 180000)) - paladinGuid[i] = pSummoned->GetGUID(); - - timer = OFFSET_NEXT_ATTACK; - questPhase = 2; + timer = OFFSET_NEXT_ATTACK; + questPhase = 2; + } } - } - void SecondTrialKill(); - void SummonedCreatureDespawn(Creature* /*c*/) {} + void SecondTrialKill() + { + if (questPhase > 0) + { + ++paladinPhase; + + if (paladinPhase < 4) + questPhase = 2; + else + Reset(); // Quest Complete, QuestComplete handler is + } + } + + void SummonedCreatureDespawn(Creature* /*c*/) {} + }; }; -bool GossipHello_master_kelerun_bloodmourn(Player* pPlayer, Creature* pCreature) -{ - // quest only available if not already started - // Quest_template flag is set to : QUEST_FLAGS_EVENT - // Escort quests or any other event-driven quests. If player in party, all players that can accept this quest will receive confirmation box to accept quest. - // !not sure if this really works! - - if (CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase == 0) - { - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SendPreparedQuest(pCreature->GetGUID()); - } - - pPlayer->SEND_GOSSIP_MENU(pCreature->GetEntry(), pCreature->GetGUID()); - return true; -} - -bool QuestAccept_master_kelerun_bloodmourn(Player* /*pPlayer*/, Creature* pCreature, Quest const *quest) -{ - // One Player exclusive quest, wait for user go activation - if (quest->GetQuestId() == QUEST_SECOND_TRIAL) - CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->questPhase = 1; - - return true; -} - -void master_kelerun_bloodmournAI::SecondTrialKill() -{ - if (questPhase > 0) - { - ++paladinPhase; - - if (paladinPhase < 4) - questPhase = 2; - else - Reset(); // Quest Complete, QuestComplete handler is in npc_secondTrialAI::JustDied - } -} - -void npc_secondTrialAI::JustDied(Unit* Killer) +void npc_second_trial_paladin::npc_secondTrialAI::JustDied(Unit* Killer) { if (Killer->GetTypeId() == TYPEID_PLAYER) { if (Creature *pSummoner = Unit::GetCreature((*me), summonerGuid)) - CAST_AI(master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill(); + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill(); // last kill quest complete for group if (me->GetEntry() == CHAMPION_SUNSTRIKER) @@ -446,41 +484,26 @@ void npc_secondTrialAI::JustDied(Unit* Killer) } } -void npc_secondTrialAI::KilledUnit(Unit* Killed) -{ - if (Killed->GetTypeId() == TYPEID_PLAYER) - if (CAST_PLR(Killed)->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE) - CAST_PLR(Killed)->FailQuest(QUEST_SECOND_TRIAL); -} - -void npc_secondTrialAI::Activate(uint64 summonerguid) -{ - questPhase = 1; - summonerGuid = summonerguid; -} - -CreatureAI* GetAI_master_kelerun_bloodmourn(Creature* pCreature) -{ - return new master_kelerun_bloodmournAI (pCreature); -} - -CreatureAI* GetAI_npc_secondTrial(Creature* pCreature) -{ - return new npc_secondTrialAI (pCreature); -} /*###### ## go_second_trial ######*/ - -bool GOHello_go_second_trial(Player* /*pPlayer*/, GameObject* pGO) +class go_second_trial : public GameObjectScript { - // find spawn :: master_kelerun_bloodmourn - if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) - CAST_AI(master_kelerun_bloodmournAI, pCreature->AI())->StartEvent(); +public: + go_second_trial() : GameObjectScript("go_second_trial") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) + { + // find spawn :: master_kelerun_bloodmourn + if (Creature *pCreature = pGO->FindNearestCreature(MASTER_KELERUN_BLOODMOURN, 30.0f)) + CAST_AI(npc_second_trial_controller::master_kelerun_bloodmournAI, pCreature->AI())->StartEvent(); + + return true; + } + +}; - return true; -} /*###### ## npc_apprentice_mirveda @@ -489,75 +512,82 @@ bool GOHello_go_second_trial(Player* /*pPlayer*/, GameObject* pGO) #define QUEST_UNEXPECTED_RESULT 8488 #define MOB_GHARZUL 15958 #define MOB_ANGERSHADE 15656 - -struct npc_apprentice_mirvedaAI : public ScriptedAI + class npc_apprentice_mirveda : public CreatureScript { - npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {} +public: + npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { } - uint32 KillCount; - uint64 PlayerGUID; - bool Summon; - SummonList Summons; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); - Summon = false; - } - - void EnterCombat(Unit* /*who*/){} - - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me); - Summons.Summon(summoned); - } - - void SummonedCreatureDespawn(Creature* summoned) - { - Summons.Despawn(summoned); - ++KillCount; - } - - void JustDied(Unit* /*killer*/) - { - if (PlayerGUID) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (KillCount >= 3 && PlayerGUID) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); - - if (Summon) + if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) { - me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); - me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, pCreature->AI())->Summon = true; + CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_apprentice_mirvedaAI (pCreature); + } + + struct npc_apprentice_mirvedaAI : public ScriptedAI + { + npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {} + + uint32 KillCount; + uint64 PlayerGUID; + bool Summon; + SummonList Summons; + + void Reset() + { + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); Summon = false; } - } + + void EnterCombat(Unit* /*who*/){} + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(me); + Summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature* summoned) + { + Summons.Despawn(summoned); + ++KillCount; + } + + void JustDied(Unit* /*killer*/) + { + if (PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->FailQuest(QUEST_UNEXPECTED_RESULT); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (KillCount >= 3 && PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->CompleteQuest(QUEST_UNEXPECTED_RESULT); + + if (Summon) + { + me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000); + Summon = false; + } + } + }; + }; -bool QuestAccept_npc_apprentice_mirveda(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) - { - CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->Summon = true; - CAST_AI(npc_apprentice_mirvedaAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - return true; -} - -CreatureAI* GetAI_npc_apprentice_mirvedaAI(Creature* pCreature) -{ - return new npc_apprentice_mirvedaAI (pCreature); -} /*###### ## npc_infused_crystal @@ -583,120 +613,96 @@ static Location SpawnLocations[] = {8278.51, -7242.13, 139.162}, {8267.97, -7239.17, 139.517} }; - -struct npc_infused_crystalAI : public Scripted_NoMovementAI + class npc_infused_crystal : public CreatureScript { - npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} +public: + npc_infused_crystal() : CreatureScript("npc_infused_crystal") { } - uint32 EndTimer; - uint32 WaveTimer; - bool Completed; - bool Progress; - uint64 PlayerGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - EndTimer = 0; - Completed = false; - Progress = false; - PlayerGUID = 0; - WaveTimer = 0; + return new npc_infused_crystalAI (pCreature); } - void MoveInLineOfSight(Unit* who) + struct npc_infused_crystalAI : public Scripted_NoMovementAI { - if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) + npc_infused_crystalAI(Creature* c) : Scripted_NoMovementAI(c) {} + + uint32 EndTimer; + uint32 WaveTimer; + bool Completed; + bool Progress; + uint64 PlayerGUID; + + void Reset() { - if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE) + EndTimer = 0; + Completed = false; + Progress = false; + PlayerGUID = 0; + WaveTimer = 0; + } + + void MoveInLineOfSight(Unit* who) + { + if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) { - PlayerGUID = who->GetGUID(); - WaveTimer = 1000; - EndTimer = 60000; - Progress = true; + if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + WaveTimer = 1000; + EndTimer = 60000; + Progress = true; + } } } - } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me); - } - - void JustDied(Unit* /*killer*/) - { - if (PlayerGUID && !Completed) - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); - } - - void UpdateAI(const uint32 diff) - { - if (EndTimer < diff && Progress) + void JustSummoned(Creature *summoned) { - DoScriptText(EMOTE, me); - Completed = true; - if (PlayerGUID) + summoned->AI()->AttackStart(me); + } + + void JustDied(Unit* /*killer*/) + { + if (PlayerGUID && !Completed) if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); + CAST_PLR(pPlayer)->FailQuest(QUEST_POWERING_OUR_DEFENSES); + } - me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); - } else EndTimer -= diff; - - if (WaveTimer < diff && !Completed && Progress) + void UpdateAI(const uint32 diff) { - uint32 ran1 = rand()%8; - uint32 ran2 = rand()%8; - uint32 ran3 = rand()%8; - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); - WaveTimer = 30000; - } else WaveTimer -= diff; - } -}; + if (EndTimer < diff && Progress) + { + DoScriptText(EMOTE, me); + Completed = true; + if (PlayerGUID) + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES); -CreatureAI* GetAI_npc_infused_crystalAI(Creature* pCreature) -{ - return new npc_infused_crystalAI (pCreature); -} + me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } else EndTimer -= diff; + + if (WaveTimer < diff && !Completed && Progress) + { + uint32 ran1 = rand()%8; + uint32 ran2 = rand()%8; + uint32 ran3 = rand()%8; + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + WaveTimer = 30000; + } else WaveTimer -= diff; + } + }; + +}; void AddSC_eversong_woods() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_prospector_anvilward"; - newscript->GetAI = &GetAI_npc_prospector_anvilward; - newscript->pGossipHello = &GossipHello_npc_prospector_anvilward; - newscript->pGossipSelect = &GossipSelect_npc_prospector_anvilward; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_second_trial_controller"; - newscript->GetAI = &GetAI_master_kelerun_bloodmourn; - newscript->pGossipHello = &GossipHello_master_kelerun_bloodmourn; - newscript->pQuestAccept = &QuestAccept_master_kelerun_bloodmourn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_second_trial_paladin"; - newscript->GetAI = &GetAI_npc_secondTrial; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_second_trial"; - newscript->pGOHello = &GOHello_go_second_trial; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_apprentice_mirveda"; - newscript->GetAI = &GetAI_npc_apprentice_mirvedaAI; - newscript->pQuestAccept = &QuestAccept_npc_apprentice_mirveda; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_infused_crystal"; - newscript->GetAI = &GetAI_npc_infused_crystalAI; - newscript->RegisterSelf(); + new npc_prospector_anvilward(); + new npc_second_trial_controller(); + new npc_second_trial_paladin(); + new go_second_trial(); + new npc_apprentice_mirveda(); + new npc_infused_crystal(); } diff --git a/src/server/scripts/EasternKingdoms/ghostlands.cpp b/src/server/scripts/EasternKingdoms/ghostlands.cpp index a33974b2ecd..5ce868444a4 100644 --- a/src/server/scripts/EasternKingdoms/ghostlands.cpp +++ b/src/server/scripts/EasternKingdoms/ghostlands.cpp @@ -38,85 +38,106 @@ EndContentData */ ######*/ #define GOSSIP_H_BKD "Take Blood Knight Insignia" - -bool GossipHello_npc_blood_knight_dawnstar(Player* pPlayer, Creature* pCreature) + class npc_blood_knight_dawnstar : public CreatureScript { - if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_blood_knight_dawnstar() : CreatureScript("npc_blood_knight_dawnstar") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_blood_knight_dawnstar(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 24226, 1, false); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, 24226, 1, true); - pPlayer->PlayerTalkClass->ClearMenus(); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 24226, 1, false); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, 24226, 1, true); + pPlayer->PlayerTalkClass->ClearMenus(); + } } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(9692) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(24226,1,true)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_H_BKD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_budd_nedreck ######*/ #define GOSSIP_HBN "You gave the crew disguises?" - -bool GossipHello_npc_budd_nedreck(Player* pPlayer, Creature* pCreature) + class npc_budd_nedreck : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_budd_nedreck() : CreatureScript("npc_budd_nedreck") { } - if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_budd_nedreck(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 42540, false); + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 42540, false); + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(11166) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_rathis_tomber ######*/ - -bool GossipHello_npc_rathis_tomber(Player* pPlayer, Creature* pCreature) + class npc_rathis_tomber : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rathis_tomber() : CreatureScript("npc_rathis_tomber") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(9152)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(8432, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(8431, pCreature->GetGUID()); + + return true; + } + +}; -bool GossipSelect_npc_rathis_tomber(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} /*###### ## npc_ranger_lilatha @@ -137,116 +158,102 @@ enum eEnums NPC_CAPTAIN_HELIOS = 16220, FACTION_SMOON_E = 1603, }; - -struct npc_ranger_lilathaAI : public npc_escortAI + class npc_ranger_lilatha : public CreatureScript { - npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} +public: + npc_ranger_lilatha() : CreatureScript("npc_ranger_lilatha") { } - void WaypointReached(uint32 i) + struct npc_ranger_lilathaAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_ranger_lilathaAI(Creature *c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 0: + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { - me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_ACTIVE); - DoScriptText(SAY_START, me, pPlayer); - break; + case 0: + { + me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_ACTIVE); + DoScriptText(SAY_START, me, pPlayer); + break; + } + case 5: + DoScriptText(SAY_PROGRESS1, me, pPlayer); + case 11: + DoScriptText(SAY_PROGRESS2, me, pPlayer); + me->SetOrientation(4.762841); + break; + case 18: + { + DoScriptText(SAY_PROGRESS3, me, pPlayer); + Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); + Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); + if (Summ1 && Summ2) + { + Summ1->Attack(me, true); + Summ2->Attack(pPlayer, true); + } + me->AI()->AttackStart(Summ1); + break; + } + case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; + case 30: + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); + break; + case 32: + me->SetOrientation(2.978281); + DoScriptText(SAY_END1, me, pPlayer); + break; + case 33: + me->SetOrientation(5.858011); + DoScriptText(SAY_END2, me, pPlayer); + Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); + if (CaptainHelios) + DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); + break; } - case 5: - DoScriptText(SAY_PROGRESS1, me, pPlayer); - case 11: - DoScriptText(SAY_PROGRESS2, me, pPlayer); - me->SetOrientation(4.762841); - break; - case 18: - { - DoScriptText(SAY_PROGRESS3, me, pPlayer); - Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); - Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Summ1 && Summ2) - { - Summ1->Attack(me, true); - Summ2->Attack(pPlayer, true); - } - me->AI()->AttackStart(Summ1); - break; - } - case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); break; - case 30: - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me); - break; - case 32: - me->SetOrientation(2.978281); - DoScriptText(SAY_END1, me, pPlayer); - break; - case 33: - me->SetOrientation(5.858011); - DoScriptText(SAY_END2, me, pPlayer); - Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50); - if (CaptainHelios) - DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer); - break; } + + void Reset() + { + if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) + Cage->SetGoState(GO_STATE_READY); + } + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) + { + pCreature->setFaction(113); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilatha::npc_ranger_lilathaAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20)) - Cage->SetGoState(GO_STATE_READY); + return new npc_ranger_lilathaAI(pCreature); } + }; -bool QuestAccept_npc_ranger_lilatha(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCAPE_FROM_THE_CATACOMBS) - { - pCreature->setFaction(113); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_ranger_lilathaAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} - -CreatureAI* GetAI_npc_ranger_lilathaAI(Creature* pCreature) -{ - return new npc_ranger_lilathaAI(pCreature); -} void AddSC_ghostlands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_blood_knight_dawnstar"; - newscript->pGossipHello = &GossipHello_npc_blood_knight_dawnstar; - newscript->pGossipSelect = &GossipSelect_npc_blood_knight_dawnstar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_budd_nedreck"; - newscript->pGossipHello = &GossipHello_npc_budd_nedreck; - newscript->pGossipSelect = &GossipSelect_npc_budd_nedreck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rathis_tomber"; - newscript->pGossipHello = &GossipHello_npc_rathis_tomber; - newscript->pGossipSelect = &GossipSelect_npc_rathis_tomber; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ranger_lilatha"; - newscript->GetAI = &GetAI_npc_ranger_lilathaAI; - newscript->pQuestAccept = &QuestAccept_npc_ranger_lilatha; - newscript->RegisterSelf(); + new npc_blood_knight_dawnstar(); + new npc_budd_nedreck(); + new npc_rathis_tomber(); + new npc_ranger_lilatha(); } diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index 081d1b157e6..1ce459560d1 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -51,96 +51,104 @@ enum eOOX FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - -struct npc_00x09hlAI : public npc_escortAI + class npc_00x09hl : public CreatureScript { - npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_00x09hl() : CreatureScript("npc_00x09hl") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) { - case 26: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 43: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 64: - DoScriptText(SAY_OOX_END, me); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); - break; + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + else if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + DoScriptText(SAY_OOX_START, pCreature, pPlayer); + + if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void WaypointStart(uint32 uiPointId) + CreatureAI* GetAI(Creature* pCreature) const { - switch(uiPointId) + return new npc_00x09hlAI(pCreature); + } + + struct npc_00x09hlAI : public npc_escortAI + { + npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) { - case 27: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - } - break; - case 44: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); - } - break; + switch(uiPointId) + { + case 26: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 43: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 64: + DoScriptText(SAY_OOX_END, me); + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); + break; + } } - } - void EnterCombat(Unit* pWho) - { - if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) - return; + void WaypointStart(uint32 uiPointId) + { + switch(uiPointId) + { + case 27: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + } + break; + case 44: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); + } + break; + } + } - if (rand()%1) - DoScriptText(SAY_OOX_AGGRO1, me); - else - DoScriptText(SAY_OOX_AGGRO2, me); - } + void EnterCombat(Unit* pWho) + { + if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) + return; + + if (rand()%1) + DoScriptText(SAY_OOX_AGGRO1, me); + else + DoScriptText(SAY_OOX_AGGRO2, me); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + } + }; - void JustSummoned(Creature* pSummoned) - { - pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - } }; -bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORTEE_A); - else if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORTEE_H); - - DoScriptText(SAY_OOX_START, pCreature, pPlayer); - - if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} - -CreatureAI* GetAI_npc_00x09hl(Creature* pCreature) -{ - return new npc_00x09hlAI(pCreature); -} /*###### ## npc_rinji @@ -178,175 +186,172 @@ Location m_afAmbushMoveTo[] = {166.630386, -2824.780273, 108.153}, {70.886589, -2874.335449, 116.675} }; - -struct npc_rinjiAI : public npc_escortAI + class npc_rinji : public CreatureScript { - npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_rinji() : CreatureScript("npc_rinji") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - 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 (HasEscortState(STATE_ESCORT_ESCORTING)) + if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) { - if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) - { - DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); - m_bIsByOutrunner = true; - } + if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) + pGo->UseDoorOrButton(); - if (rand()%4) - return; - - //only if attacked and escorter is not in combat? - DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinji::npc_rinjiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void DoSpawnAmbush(bool bFirst) + CreatureAI* GetAI(Creature* pCreature) const { - if (!bFirst) - m_iSpawnId = 1; + return new npc_rinjiAI(pCreature); + } - me->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) + struct npc_rinjiAI : public npc_escortAI + { + npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) { - me->SummonCreature(NPC_OUTRUNNER, + 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 (HasEscortState(STATE_ESCORT_ESCORTING)) + { + 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? + DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + } + } + + void DoSpawnAmbush(bool bFirst) + { + if (!bFirst) + m_iSpawnId = 1; + + me->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); - } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - 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 = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(uiPointId) - { - case 1: - DoScriptText(SAY_RIN_FREE, me, pPlayer); - break; - case 7: - DoSpawnAmbush(true); - break; - case 13: - DoSpawnAmbush(false); - break; - case 17: - DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); - SetRun(); - m_uiPostEventCount = 1; - break; - } - } - - void UpdateEscortAI(const uint32 uiDiff) - { - //Check if we have a current target - if (!UpdateVictim()) - { - if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) + for (int i = 0; i < 2; ++i) { - if (m_uiPostEventTimer <= uiDiff) - { - m_uiPostEventTimer = 3000; + me->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); + } + } - if (Unit* pPlayer = GetPlayerForEscort()) + void JustSummoned(Creature* pSummoned) + { + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + 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 = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 1: + DoScriptText(SAY_RIN_FREE, me, pPlayer); + break; + case 7: + DoSpawnAmbush(true); + break; + case 13: + DoSpawnAmbush(false); + break; + case 17: + DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); + SetRun(); + m_uiPostEventCount = 1; + break; + } + } + + void UpdateEscortAI(const uint32 uiDiff) + { + //Check if we have a current target + if (!UpdateVictim()) + { + if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) + { + if (m_uiPostEventTimer <= uiDiff) { - switch(m_uiPostEventCount) + m_uiPostEventTimer = 3000; + + if (Unit* pPlayer = GetPlayerForEscort()) { - case 1: - DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); - ++m_uiPostEventCount; - break; - case 2: - DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); - m_uiPostEventCount = 0; - break; + switch(m_uiPostEventCount) + { + case 1: + DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); + ++m_uiPostEventCount; + break; + case 2: + DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); + m_uiPostEventCount = 0; + break; + } + } + else + { + me->ForcedDespawn(); + return; } } else - { - me->ForcedDespawn(); - return; - } + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -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) -{ - return new npc_rinjiAI(pCreature); -} void AddSC_hinterlands() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_00x09hl"; - newscript->GetAI = &GetAI_npc_00x09hl; - newscript->pQuestAccept = &QuestAccept_npc_00x09hl; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rinji"; - newscript->GetAI = &GetAI_npc_rinji; - newscript->pQuestAccept = &QuestAccept_npc_rinji; - newscript->RegisterSelf(); + new npc_00x09hl(); + new npc_rinji(); } diff --git a/src/server/scripts/EasternKingdoms/ironforge.cpp b/src/server/scripts/EasternKingdoms/ironforge.cpp index da215065c6d..a29f24814b7 100644 --- a/src/server/scripts/EasternKingdoms/ironforge.cpp +++ b/src/server/scripts/EasternKingdoms/ironforge.cpp @@ -38,58 +38,59 @@ EndContentData */ #define GOSSIP_ITEM_ROYAL_2 "Interesting, continue please." #define GOSSIP_ITEM_ROYAL_3 "Unbelievable! How dare they??" #define GOSSIP_ITEM_ROYAL_4 "Of course I will help!" - -bool GossipHello_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature) + class npc_royal_historian_archesonus : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_royal_historian_archesonus() : CreatureScript("npc_royal_historian_archesonus") { } - if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2236, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2237, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2238, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(2239, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3702); + break; + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_royal_historian_archesonus(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2236, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2237, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2238, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(2239, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3702); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(3702) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ROYAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(2235, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + void AddSC_ironforge() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_royal_historian_archesonus"; - newscript->pGossipHello = &GossipHello_npc_royal_historian_archesonus; - newscript->pGossipSelect = &GossipSelect_npc_royal_historian_archesonus; - newscript->RegisterSelf(); + new npc_royal_historian_archesonus(); } diff --git a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp index 2bb7a723b06..122ae3b864f 100644 --- a/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp +++ b/src/server/scripts/EasternKingdoms/isle_of_queldanas.cpp @@ -38,47 +38,54 @@ EndContentData */ #define SAY_CONVERTED_2 -1000189 #define SPELL_CONVERT_CREDIT 45009 - -struct npc_converted_sentryAI : public ScriptedAI + class npc_converted_sentry : public CreatureScript { - npc_converted_sentryAI(Creature *c) : ScriptedAI(c) {} +public: + npc_converted_sentry() : CreatureScript("npc_converted_sentry") { } - bool Credit; - uint32 Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Credit = false; - Timer = 2500; + return new npc_converted_sentryAI (pCreature); } - void MoveInLineOfSight(Unit * /*who*/) {} - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) + struct npc_converted_sentryAI : public ScriptedAI { - if (!Credit) + npc_converted_sentryAI(Creature *c) : ScriptedAI(c) {} + + bool Credit; + uint32 Timer; + + void Reset() { - if (Timer <= diff) - { - uint32 i = urand(1,2); - if (i == 1) - DoScriptText(SAY_CONVERTED_1, me); - else - DoScriptText(SAY_CONVERTED_2, me); - - DoCast(me, SPELL_CONVERT_CREDIT); - if (me->isPet()) - CAST_PET(me)->SetDuration(7500); - Credit = true; - } else Timer -= diff; + Credit = false; + Timer = 2500; } - } + + void MoveInLineOfSight(Unit * /*who*/) {} + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!Credit) + { + if (Timer <= diff) + { + uint32 i = urand(1,2); + if (i == 1) + DoScriptText(SAY_CONVERTED_1, me); + else + DoScriptText(SAY_CONVERTED_2, me); + + DoCast(me, SPELL_CONVERT_CREDIT); + if (me->isPet()) + CAST_PET(me)->SetDuration(7500); + Credit = true; + } else Timer -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_converted_sentry(Creature* pCreature) -{ - return new npc_converted_sentryAI (pCreature); -} /*###### ## npc_greengill_slave @@ -88,66 +95,63 @@ CreatureAI* GetAI_npc_converted_sentry(Creature* pCreature) #define ORB 45109 #define QUESTG 11541 #define DM 25060 - -struct npc_greengill_slaveAI : public ScriptedAI + class npc_greengill_slave : public CreatureScript { - npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} +public: + npc_greengill_slave() : CreatureScript("npc_greengill_slave") { } - uint64 PlayerGUID; - - void EnterCombat(Unit* /*who*/){} - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; + return new npc_greengill_slaveAI(pCreature); } - void SpellHit(Unit* caster, const SpellEntry* spell) + struct npc_greengill_slaveAI : public ScriptedAI { - if (!caster) - return; + npc_greengill_slaveAI(Creature* c) : ScriptedAI(c) {} - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE)) + uint64 PlayerGUID; + + void EnterCombat(Unit* /*who*/){} + + void Reset() { - PlayerGUID = caster->GetGUID(); - if (PlayerGUID) + PlayerGUID = 0; + } + + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if (!caster) + return; + + if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE)) { - Unit* plr = Unit::GetUnit((*me), PlayerGUID); - if (plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) - DoCast(plr, 45110, true); - } - DoCast(me, ENRAGE); - Unit* Myrmidon = me->FindNearestCreature(DM, 70); - if (Myrmidon) - { - me->AddThreat(Myrmidon, 100000.0f); - AttackStart(Myrmidon); + PlayerGUID = caster->GetGUID(); + if (PlayerGUID) + { + Unit* plr = Unit::GetUnit((*me), PlayerGUID); + if (plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE) + DoCast(plr, 45110, true); + } + DoCast(me, ENRAGE); + Unit* Myrmidon = me->FindNearestCreature(DM, 70); + if (Myrmidon) + { + me->AddThreat(Myrmidon, 100000.0f); + AttackStart(Myrmidon); + } } } - } - void UpdateAI(const uint32 /*diff*/) - { - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 /*diff*/) + { + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_greengill_slaveAI(Creature* pCreature) -{ - return new npc_greengill_slaveAI(pCreature); -} - void AddSC_isle_of_queldanas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_converted_sentry"; - newscript->GetAI = &GetAI_npc_converted_sentry; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_greengill_slave"; - newscript->GetAI = &GetAI_npc_greengill_slaveAI; - newscript->RegisterSelf(); + new npc_converted_sentry(); + new npc_greengill_slave(); } diff --git a/src/server/scripts/EasternKingdoms/loch_modan.cpp b/src/server/scripts/EasternKingdoms/loch_modan.cpp index 1a5dafb8b17..f54792407fb 100644 --- a/src/server/scripts/EasternKingdoms/loch_modan.cpp +++ b/src/server/scripts/EasternKingdoms/loch_modan.cpp @@ -41,62 +41,63 @@ EndContentData */ #define GOSSIP_MP4 "Yes..." #define GOSSIP_MP5 "Ok, i'll try to remember that." #define GOSSIP_MP6 "A key? Ok!" - -bool GossipHello_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature) + class npc_mountaineer_pebblebitty : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_mountaineer_pebblebitty() : CreatureScript("npc_mountaineer_pebblebitty") { } - if (!pPlayer->GetQuestRewardStatus(3181) == 1) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_mountaineer_pebblebitty(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1833, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(1834, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(1835, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(1836, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(1837, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(1838, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1833, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(1834, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(1835, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(1836, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(1837, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(1838, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (!pPlayer->GetQuestRewardStatus(3181) == 1) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_MP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_loch_modan() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_mountaineer_pebblebitty"; - newscript->pGossipHello = &GossipHello_npc_mountaineer_pebblebitty; - newscript->pGossipSelect = &GossipSelect_npc_mountaineer_pebblebitty; - newscript->RegisterSelf(); + new npc_mountaineer_pebblebitty(); } diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index f6e45c2711a..0a288ce7e20 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -37,136 +37,138 @@ enum eCorporalKeeshan SPELL_MOCKING_BLOW = 21008, SPELL_SHIELD_BASH = 11972, }; - -struct npc_corporal_keeshanAI : public npc_escortAI + class npc_corporal_keeshan : public CreatureScript { - npc_corporal_keeshanAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { } - uint32 uiPhase; - uint32 uiTimer; - uint32 uiMockingBlowTimer; - uint32 uiShieldBashTimer; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *pQuest) { - uiTimer = 0; - uiPhase = 0; - uiMockingBlowTimer = 5000; - uiShieldBashTimer = 8000; - } - - void WaypointReached(uint32 uiI) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - - switch(uiI) + if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) { - case 39: - SetEscortPaused(true); - uiTimer = 2000; - uiPhase = 1; - break; - case 65: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - break; - case 115: - pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION); - uiTimer = 2000; - uiPhase = 4; - break; - } - } - - void UpdateAI(const uint32 uiDiff) - { - if (HasEscortState(STATE_ESCORT_NONE)) - return; - - npc_escortAI::UpdateAI(uiDiff); - - if (uiPhase) - { - if (uiTimer <= uiDiff) - { - switch(uiPhase) - { - case 1: - me->SetStandState(UNIT_STAND_STATE_SIT); - uiTimer = 1000; - uiPhase = 2; - break; - case 2: - DoScriptText(SAY_CORPORAL_2,me); - uiTimer = 15000; - uiPhase = 3; - break; - case 3: - DoScriptText(SAY_CORPORAL_3,me); - me->SetStandState(UNIT_STAND_STATE_STAND); - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 4: - DoScriptText(SAY_CORPORAL_4, me); - uiTimer = 2500; - uiPhase = 5; - case 5: - DoScriptText(SAY_CORPORAL_5, me); - uiTimer = 0; - uiPhase = 0; - } - } else uiTimer -= uiDiff; + CAST_AI(npc_corporal_keeshan::npc_corporal_keeshanAI,pCreature->AI())->Start(true, false, pPlayer->GetGUID(),pQuest); + DoScriptText(SAY_CORPORAL_1, pCreature); } - if (!UpdateVictim()) - return; + return false; + } - if (uiMockingBlowTimer <= uiDiff) + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_corporal_keeshanAI(pCreature); + } + + struct npc_corporal_keeshanAI : public npc_escortAI + { + npc_corporal_keeshanAI(Creature* pCreature) : npc_escortAI(pCreature) {} + + uint32 uiPhase; + uint32 uiTimer; + uint32 uiMockingBlowTimer; + uint32 uiShieldBashTimer; + + void Reset() { - DoCast(me->getVictim(),SPELL_MOCKING_BLOW); + uiTimer = 0; + uiPhase = 0; uiMockingBlowTimer = 5000; - } else uiMockingBlowTimer -= uiDiff; + uiShieldBashTimer = 8000; + } - if (uiShieldBashTimer <= uiDiff) + void WaypointReached(uint32 uiI) { - DoCast(me->getVictim(),SPELL_MOCKING_BLOW); - uiShieldBashTimer = 8000; - } else uiShieldBashTimer -= uiDiff; + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALKING) + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + switch(uiI) + { + case 39: + SetEscortPaused(true); + uiTimer = 2000; + uiPhase = 1; + break; + case 65: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + break; + case 115: + pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION); + uiTimer = 2000; + uiPhase = 4; + break; + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (HasEscortState(STATE_ESCORT_NONE)) + return; + + npc_escortAI::UpdateAI(uiDiff); + + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + me->SetStandState(UNIT_STAND_STATE_SIT); + uiTimer = 1000; + uiPhase = 2; + break; + case 2: + DoScriptText(SAY_CORPORAL_2,me); + uiTimer = 15000; + uiPhase = 3; + break; + case 3: + DoScriptText(SAY_CORPORAL_3,me); + me->SetStandState(UNIT_STAND_STATE_STAND); + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 4: + DoScriptText(SAY_CORPORAL_4, me); + uiTimer = 2500; + uiPhase = 5; + case 5: + DoScriptText(SAY_CORPORAL_5, me); + uiTimer = 0; + uiPhase = 0; + } + } else uiTimer -= uiDiff; + } + + if (!UpdateVictim()) + return; + + if (uiMockingBlowTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_MOCKING_BLOW); + uiMockingBlowTimer = 5000; + } else uiMockingBlowTimer -= uiDiff; + + if (uiShieldBashTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_MOCKING_BLOW); + uiShieldBashTimer = 8000; + } else uiShieldBashTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool QuestAccept_npc_corporal_keeshan(Player* pPlayer, Creature* pCreature, Quest const *pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) - { - CAST_AI(npc_corporal_keeshanAI,pCreature->AI())->Start(true, false, pPlayer->GetGUID(),pQuest); - DoScriptText(SAY_CORPORAL_1, pCreature); - } - return false; -} - -CreatureAI* GetAI_npc_corporal_keeshan(Creature* pCreature) -{ - return new npc_corporal_keeshanAI(pCreature); -} void AddSC_redridge_mountains() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_corporal_keeshan"; - newscript->GetAI = &GetAI_npc_corporal_keeshan; - newscript->pQuestAccept = &QuestAccept_npc_corporal_keeshan; - newscript->RegisterSelf(); + new npc_corporal_keeshan(); } diff --git a/src/server/scripts/EasternKingdoms/searing_gorge.cpp b/src/server/scripts/EasternKingdoms/searing_gorge.cpp index 602fdeb2b59..ef6a0152154 100644 --- a/src/server/scripts/EasternKingdoms/searing_gorge.cpp +++ b/src/server/scripts/EasternKingdoms/searing_gorge.cpp @@ -38,69 +38,83 @@ EndContentData */ #define GOSSIP_HELLO_KW "Tell me what drives this vengance?" #define GOSSIP_SELECT_KW1 "Continue please" #define GOSSIP_SELECT_KW2 "Let me confer with my colleagues" - -bool GossipHello_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature) + class npc_kalaran_windblade : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_kalaran_windblade() : CreatureScript("npc_kalaran_windblade") { } - if (pPlayer->GetQuestStatus(3441) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_kalaran_windblade(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(1954, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1955, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3441); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(1954, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_KW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1955, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3441); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(3441) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_KW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_lothos_riftwaker ######*/ #define GOSSIP_HELLO_LR "Teleport me to the Molten Core" - -bool GossipHello_npc_lothos_riftwaker(Player* pPlayer, Creature* pCreature) + class npc_lothos_riftwaker : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lothos_riftwaker() : CreatureScript("npc_lothos_riftwaker") { } - if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->TeleportTo(409, 1096, -467, -104.6, 3.64); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TeleportTo(409, 1096, -467, -104.6, 3.64); + } + + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestRewardStatus(7487) || pPlayer->GetQuestRewardStatus(7848)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_zamael_lunthistle @@ -109,39 +123,46 @@ bool GossipSelect_npc_lothos_riftwaker(Player* pPlayer, Creature* /*pCreature*/, #define GOSSIP_HELLO_ZL "Tell me your story" #define GOSSIP_SELECT_ZL1 "Please continue..." #define GOSSIP_SELECT_ZL2 "Goodbye" - -bool GossipHello_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature) + class npc_zamael_lunthistle : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_zamael_lunthistle() : CreatureScript("npc_zamael_lunthistle") { } - if (pPlayer->GetQuestStatus(3377) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ZL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(1920, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(1921, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(1922, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3377); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(1921, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_ZL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(1922, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3377); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(3377) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ZL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(1920, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## @@ -149,23 +170,7 @@ bool GossipSelect_npc_zamael_lunthistle(Player* pPlayer, Creature* pCreature, ui void AddSC_searing_gorge() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kalaran_windblade"; - newscript->pGossipHello = &GossipHello_npc_kalaran_windblade; - newscript->pGossipSelect = &GossipSelect_npc_kalaran_windblade; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lothos_riftwaker"; - newscript->pGossipHello = &GossipHello_npc_lothos_riftwaker; - newscript->pGossipSelect = &GossipSelect_npc_lothos_riftwaker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zamael_lunthistle"; - newscript->pGossipHello = &GossipHello_npc_zamael_lunthistle; - newscript->pGossipSelect = &GossipSelect_npc_zamael_lunthistle; - newscript->RegisterSelf(); + new npc_kalaran_windblade(); + new npc_lothos_riftwaker(); + new npc_zamael_lunthistle(); } diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index b636f20bb44..d05aabcd004 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -38,67 +38,70 @@ EndContentData */ #define QUEST_REDEEMING_THE_DEAD 9685 #define SPELL_SHIMMERING_VESSEL 31225 #define SPELL_REVIVE_SELF 32343 - -struct npc_blood_knight_stillbladeAI : public ScriptedAI + class npc_blood_knight_stillblade : public CreatureScript { - npc_blood_knight_stillbladeAI(Creature *c) : ScriptedAI(c) {} +public: + npc_blood_knight_stillblade() : CreatureScript("npc_blood_knight_stillblade") { } - uint32 lifeTimer; - bool spellHit; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - lifeTimer = 120000; - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetUInt32Value(UNIT_FIELD_BYTES_1,7); // lay down - spellHit = false; + return new npc_blood_knight_stillbladeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct npc_blood_knight_stillbladeAI : public ScriptedAI { - } + npc_blood_knight_stillbladeAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit * /*who*/) - { - } + uint32 lifeTimer; + bool spellHit; - void UpdateAI(const uint32 diff) - { - if (me->IsStandState()) + void Reset() { - if (lifeTimer <= diff) - me->AI()->EnterEvadeMode(); - else - lifeTimer -= diff; + lifeTimer = 120000; + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetUInt32Value(UNIT_FIELD_BYTES_1,7); // lay down + spellHit = false; } - } - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) - { - if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && - (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))) + void EnterCombat(Unit * /*who*/) { - CAST_PLR(Hitter)->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD); - DoCast(me, SPELL_REVIVE_SELF); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - //me->RemoveAllAuras(); - DoScriptText(SAY_HEAL, me); - spellHit = true; } - } + + void MoveInLineOfSight(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (me->IsStandState()) + { + if (lifeTimer <= diff) + me->AI()->EnterEvadeMode(); + else + lifeTimer -= diff; + } + } + + void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + { + if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && + (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))) + { + CAST_PLR(Hitter)->AreaExploredOrEventHappens(QUEST_REDEEMING_THE_DEAD); + DoCast(me, SPELL_REVIVE_SELF); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + //me->RemoveAllAuras(); + DoScriptText(SAY_HEAL, me); + spellHit = true; + } + } + }; + }; -CreatureAI* GetAI_npc_blood_knight_stillblade(Creature* pCreature) -{ - return new npc_blood_knight_stillbladeAI (pCreature); -} void AddSC_silvermoon_city() { - Script *newscript; - newscript = new Script; - newscript->Name = "npc_blood_knight_stillblade"; - newscript->GetAI = &GetAI_npc_blood_knight_stillblade; - newscript->RegisterSelf(); + new npc_blood_knight_stillblade(); } diff --git a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp index d27155afb72..87423302abf 100644 --- a/src/server/scripts/EasternKingdoms/silverpine_forest.cpp +++ b/src/server/scripts/EasternKingdoms/silverpine_forest.cpp @@ -38,58 +38,67 @@ EndContentData */ #define GOSSIP_HAH "You're Astor Hadren, right?" #define GOSSIP_SAH "You've got something I need, Astor. And I'll be taking it now." - -struct npc_astor_hadrenAI : public ScriptedAI + class npc_astor_hadren : public CreatureScript { - npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {} +public: + npc_astor_hadren() : CreatureScript("npc_astor_hadren") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->setFaction(68); + return new npc_astor_hadrenAI(pCreature); } - void EnterCombat(Unit* /*who*/) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(21); + if (pPlayer) + CAST_AI(npc_astor_hadren::npc_astor_hadrenAI, pCreature->AI())->AttackStart(pPlayer); + break; + } + return true; } - void JustDied(Unit * /*who*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->setFaction(68); + if (pPlayer->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID()); + + return true; } + + struct npc_astor_hadrenAI : public ScriptedAI + { + npc_astor_hadrenAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + me->setFaction(68); + } + + void EnterCombat(Unit* /*who*/) + { + } + + void JustDied(Unit * /*who*/) + { + me->setFaction(68); + } + }; + }; -CreatureAI* GetAI_npc_astor_hadren(Creature* pCreature) -{ - return new npc_astor_hadrenAI(pCreature); -} -bool GossipHello_npc_astor_hadren(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(1886) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(623, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_astor_hadren(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SAH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(624, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(21); - if (pPlayer) - CAST_AI(npc_astor_hadrenAI, pCreature->AI())->AttackStart(pPlayer); - break; - } - return true; -} /*###### ## npc_deathstalker_erland @@ -116,68 +125,75 @@ enum eErland NPC_RANE = 1950, NPC_QUINN = 1951 }; - -struct npc_deathstalker_erlandAI : public npc_escortAI + class npc_deathstalker_erland : public CreatureScript { - npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {} +public: + npc_deathstalker_erland() : CreatureScript("npc_deathstalker_erland") { } - void WaypointReached(uint32 i) + struct npc_deathstalker_erlandAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_deathstalker_erlandAI(Creature *c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 1: DoScriptText(SAY_START, me, pPlayer);break; - case 13: - DoScriptText(SAY_LAST, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_ESCORTING, me); break; - case 14: DoScriptText(SAY_THANKS, me, pPlayer); break; - case 15: { - Unit* Rane = me->FindNearestCreature(NPC_RANE, 20); - if (Rane) - DoScriptText(SAY_RANE, Rane); - break;} - case 16: DoScriptText(SAY_ANSWER, me); break; - case 17: DoScriptText(SAY_MOVE_QUINN, me); break; - case 24: DoScriptText(SAY_GREETINGS, me); break; - case 25: { - Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20); - if (Quinn) - DoScriptText(SAY_QUINN, Quinn); - break;} - case 26: DoScriptText(SAY_ON_BYE, me, NULL); break; + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + + switch(i) + { + case 1: DoScriptText(SAY_START, me, pPlayer);break; + case 13: + DoScriptText(SAY_LAST, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_ESCORTING, me); break; + case 14: DoScriptText(SAY_THANKS, me, pPlayer); break; + case 15: { + Unit* Rane = me->FindNearestCreature(NPC_RANE, 20); + if (Rane) + DoScriptText(SAY_RANE, Rane); + break;} + case 16: DoScriptText(SAY_ANSWER, me); break; + case 17: DoScriptText(SAY_MOVE_QUINN, me); break; + case 24: DoScriptText(SAY_GREETINGS, me); break; + case 25: { + Unit* Quinn = me->FindNearestCreature(NPC_QUINN, 20); + if (Quinn) + DoScriptText(SAY_QUINN, Quinn); + break;} + case 26: DoScriptText(SAY_ON_BYE, me, NULL); break; + + } } - } - void Reset() {} + void Reset() {} - void EnterCombat(Unit* who) + void EnterCombat(Unit* who) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + } + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + if (quest->GetQuestId() == QUEST_ESCORTING) + { + DoScriptText(SAY_QUESTACCEPT, pCreature, pPlayer); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erland::npc_deathstalker_erlandAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_deathstalker_erlandAI(pCreature); + } + }; -bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCORTING) - { - DoScriptText(SAY_QUESTACCEPT, pCreature, pPlayer); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_deathstalker_erlandAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - - return true; -} - -CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) -{ - return new npc_deathstalker_erlandAI(pCreature); -} /*###### ## pyrewood_ambush @@ -204,159 +220,167 @@ static float PyrewoodSpawnPoints[3][4] = }; #define WAIT_SECS 6000 - -struct pyrewood_ambushAI : public ScriptedAI + class pyrewood_ambush : public CreatureScript { - pyrewood_ambushAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + pyrewood_ambush() : CreatureScript("pyrewood_ambush") { } + + bool OnQuestAccept(Player *pPlayer, Creature *pCreature, const Quest *pQuest) { - QuestInProgress = false; - } - - uint32 Phase; - int8 KillCount; - uint32 WaitTimer; - uint64 PlayerGUID; - SummonList Summons; - - bool QuestInProgress; - - void Reset() - { - WaitTimer = WAIT_SECS; - - if (!QuestInProgress) //fix reset values (see UpdateVictim) + if (pQuest->GetQuestId() == QUEST_PYREWOOD_AMBUSH && !CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->QuestInProgress) { - Phase = 0; - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->QuestInProgress = true; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->Phase = 0; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->KillCount = 0; + CAST_AI(pyrewood_ambush::pyrewood_ambushAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); } + + return true; } - void EnterCombat(Unit * /*who*/){} - - void JustSummoned(Creature *pSummoned) + CreatureAI* GetAI(Creature *pCreature) { - Summons.Summon(pSummoned); - ++KillCount; + return new pyrewood_ambushAI (pCreature); } - void SummonedCreatureDespawn(Creature *pSummoned) + struct pyrewood_ambushAI : public ScriptedAI { - Summons.Despawn(pSummoned); - --KillCount; - } - - void SummonCreatureWithRandomTarget(uint32 creatureId, int position) - { - if (Creature *pSummoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + pyrewood_ambushAI(Creature *c) : ScriptedAI(c), Summons(me) { - Player *pPlayer = NULL; - Unit *pTarget = NULL; - if (PlayerGUID) - { - pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - pTarget = RAND((Unit*)me, (Unit*)pPlayer); - } else - pTarget = me; + QuestInProgress = false; + } - if (pTarget) + uint32 Phase; + int8 KillCount; + uint32 WaitTimer; + uint64 PlayerGUID; + SummonList Summons; + + bool QuestInProgress; + + void Reset() + { + WaitTimer = WAIT_SECS; + + if (!QuestInProgress) //fix reset values (see UpdateVictim) { - pSummoned->setFaction(168); - pSummoned->AddThreat(pTarget, 32.0f); - pSummoned->AI()->AttackStart(pTarget); + Phase = 0; + KillCount = 0; + PlayerGUID = 0; + Summons.DespawnAll(); } } - } - void JustDied(Unit * /*pKiller*/) - { - if (PlayerGUID) - if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - if (pPlayer->GetQuestStatus(QUEST_PYREWOOD_AMBUSH) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_PYREWOOD_AMBUSH); - } + void EnterCombat(Unit * /*who*/){} - void UpdateAI(const uint32 diff) - { - //sLog.outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); - - if (!QuestInProgress) - return; - - if (KillCount && Phase < 6) + void JustSummoned(Creature *pSummoned) { - if (!UpdateVictim()) //reset() on target Despawn... - return; - - DoMeleeAttackIfReady(); - return; + Summons.Summon(pSummoned); + ++KillCount; } - switch (Phase) + void SummonedCreatureDespawn(Creature *pSummoned) { - case 0: - if (WaitTimer == WAIT_SECS) - me->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, 0); //no blizzlike + Summons.Despawn(pSummoned); + --KillCount; + } - if (WaitTimer <= diff) - { - WaitTimer -= diff; - return; - } - break; - case 1: - SummonCreatureWithRandomTarget(2060, 1); - break; - case 2: - SummonCreatureWithRandomTarget(2061, 2); - SummonCreatureWithRandomTarget(2062, 0); - break; - case 3: - SummonCreatureWithRandomTarget(2063, 1); - SummonCreatureWithRandomTarget(2064, 2); - SummonCreatureWithRandomTarget(2065, 0); - break; - case 4: - SummonCreatureWithRandomTarget(2066, 1); - SummonCreatureWithRandomTarget(2067, 0); - SummonCreatureWithRandomTarget(2068, 2); - break; - case 5: //end + void SummonCreatureWithRandomTarget(uint32 creatureId, int position) + { + if (Creature *pSummoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000)) + { + Player *pPlayer = NULL; + Unit *pTarget = NULL; if (PlayerGUID) { - if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - { - me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, 0); //not blizzlike - pPlayer->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me); - } + pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + pTarget = RAND((Unit*)me, (Unit*)pPlayer); + } else + pTarget = me; + + if (pTarget) + { + pSummoned->setFaction(168); + pSummoned->AddThreat(pTarget, 32.0f); + pSummoned->AI()->AttackStart(pTarget); } - QuestInProgress = false; - Reset(); - break; + } } - ++Phase; //prepare next phase - } + + void JustDied(Unit * /*pKiller*/) + { + if (PlayerGUID) + if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + if (pPlayer->GetQuestStatus(QUEST_PYREWOOD_AMBUSH) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_PYREWOOD_AMBUSH); + } + + void UpdateAI(const uint32 diff) + { + //sLog.outString("DEBUG: p(%i) k(%i) d(%u) W(%i)", Phase, KillCount, diff, WaitTimer); + + if (!QuestInProgress) + return; + + if (KillCount && Phase < 6) + { + if (!UpdateVictim()) //reset() on target Despawn... + return; + + DoMeleeAttackIfReady(); + return; + } + + switch (Phase) + { + case 0: + if (WaitTimer == WAIT_SECS) + me->MonsterSay(NPCSAY_INIT, LANG_UNIVERSAL, 0); //no blizzlike + + if (WaitTimer <= diff) + { + WaitTimer -= diff; + return; + } + break; + case 1: + SummonCreatureWithRandomTarget(2060, 1); + break; + case 2: + SummonCreatureWithRandomTarget(2061, 2); + SummonCreatureWithRandomTarget(2062, 0); + break; + case 3: + SummonCreatureWithRandomTarget(2063, 1); + SummonCreatureWithRandomTarget(2064, 2); + SummonCreatureWithRandomTarget(2065, 0); + break; + case 4: + SummonCreatureWithRandomTarget(2066, 1); + SummonCreatureWithRandomTarget(2067, 0); + SummonCreatureWithRandomTarget(2068, 2); + break; + case 5: //end + if (PlayerGUID) + { + if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + { + me->MonsterSay(NPCSAY_END, LANG_UNIVERSAL, 0); //not blizzlike + pPlayer->GroupEventHappens(QUEST_PYREWOOD_AMBUSH, me); + } + } + QuestInProgress = false; + Reset(); + break; + } + ++Phase; //prepare next phase + } + }; + }; -CreatureAI* GetAI_pyrewood_ambush(Creature *pCreature) -{ - return new pyrewood_ambushAI (pCreature); -} -bool QuestAccept_pyrewood_ambush(Player *pPlayer, Creature *pCreature, const Quest *pQuest) -{ - if (pQuest->GetQuestId() == QUEST_PYREWOOD_AMBUSH && !CAST_AI(pyrewood_ambushAI, pCreature->AI())->QuestInProgress) - { - CAST_AI(pyrewood_ambushAI, pCreature->AI())->QuestInProgress = true; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->Phase = 0; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->KillCount = 0; - CAST_AI(pyrewood_ambushAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - - return true; -} /*###### ## AddSC @@ -364,24 +388,7 @@ bool QuestAccept_pyrewood_ambush(Player *pPlayer, Creature *pCreature, const Que void AddSC_silverpine_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_astor_hadren"; - newscript->pGossipHello = &GossipHello_npc_astor_hadren; - newscript->pGossipSelect = &GossipSelect_npc_astor_hadren; - newscript->GetAI = &GetAI_npc_astor_hadren; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deathstalker_erland"; - newscript->GetAI = &GetAI_npc_deathstalker_erlandAI; - newscript->pQuestAccept = &QuestAccept_npc_deathstalker_erland; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "pyrewood_ambush"; - newscript->GetAI = &GetAI_pyrewood_ambush; - newscript->pQuestAccept = &QuestAccept_pyrewood_ambush; - newscript->RegisterSelf(); + new npc_astor_hadren(); + new npc_deathstalker_erland(); + new pyrewood_ambush(); } diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 4553dea53a2..6ffb01f568e 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -42,30 +42,37 @@ EndContentData */ ######*/ #define GOSSIP_ITEM_MALIN "Can you send me to Theramore? I have an urgent message for Lady Jaina from Highlord Bolvar." - -bool GossipHello_npc_archmage_malin(Player* pPlayer, Creature* pCreature) + class npc_archmage_malin : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_archmage_malin() : CreatureScript("npc_archmage_malin") { } - if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_archmage_malin(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 42711, true); + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 42711, true); + } + + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(11223) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(11223)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MALIN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_bartleby @@ -76,61 +83,69 @@ enum eBartleby FACTION_ENEMY = 168, QUEST_BEAT = 1640 }; - -struct npc_bartlebyAI : public ScriptedAI + class npc_bartleby : public CreatureScript { - npc_bartlebyAI(Creature *c) : ScriptedAI(c) +public: + npc_bartleby() : CreatureScript("npc_bartleby") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiNormalFaction = c->getFaction(); - } - - uint32 m_uiNormalFaction; - - void Reset() - { - if (me->getFaction() != m_uiNormalFaction) - me->setFaction(m_uiNormalFaction); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (pQuest->GetQuestId() == QUEST_BEAT) { - //Take 0 damage - uiDamage = 0; - - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT); - EnterEvadeMode(); + pCreature->setFaction(FACTION_ENEMY); + pCreature->AI()->AttackStart(pPlayer); } + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_bartlebyAI(pCreature); + } + + struct npc_bartlebyAI : public ScriptedAI + { + npc_bartlebyAI(Creature *c) : ScriptedAI(c) + { + m_uiNormalFaction = c->getFaction(); + } + + uint32 m_uiNormalFaction; + + void Reset() + { + if (me->getFaction() != m_uiNormalFaction) + me->setFaction(m_uiNormalFaction); + } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; + + if (me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + { + //Take 0 damage + uiDamage = 0; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT); + EnterEvadeMode(); + } + } + }; + }; -bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_BEAT) - { - pCreature->setFaction(FACTION_ENEMY); - pCreature->AI()->AttackStart(pPlayer); - } - return true; -} -CreatureAI* GetAI_npc_bartleby(Creature* pCreature) -{ - return new npc_bartlebyAI(pCreature); -} /*###### ## npc_dashel_stonefist @@ -141,61 +156,69 @@ enum eDashel QUEST_MISSING_DIPLO_PT8 = 1447, FACTION_HOSTILE = 168 }; - -struct npc_dashel_stonefistAI : public ScriptedAI + class npc_dashel_stonefist : public CreatureScript { - npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) +public: + npc_dashel_stonefist() : CreatureScript("npc_dashel_stonefist") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiNormalFaction = c->getFaction(); - } - - uint32 m_uiNormalFaction; - - void Reset() - { - if (me->getFaction() != m_uiNormalFaction) - me->setFaction(m_uiNormalFaction); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) { - uiDamage = 0; - - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); - - EnterEvadeMode(); + pCreature->setFaction(FACTION_HOSTILE); + CAST_AI(npc_dashel_stonefist::npc_dashel_stonefistAI, pCreature->AI())->AttackStart(pPlayer); } + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_dashel_stonefistAI(pCreature); + } + + struct npc_dashel_stonefistAI : public ScriptedAI + { + npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) + { + m_uiNormalFaction = c->getFaction(); + } + + uint32 m_uiNormalFaction; + + void Reset() + { + if (me->getFaction() != m_uiNormalFaction) + me->setFaction(m_uiNormalFaction); + } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; + + if (me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + { + uiDamage = 0; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); + + EnterEvadeMode(); + } + } + }; + }; -bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) - { - pCreature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_dashel_stonefistAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} -CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) -{ - return new npc_dashel_stonefistAI(pCreature); -} /*###### ## npc_lady_katrana_prestor @@ -205,43 +228,50 @@ CreatureAI* GetAI_npc_dashel_stonefist(Creature* pCreature) #define GOSSIP_ITEM_KAT_2 "My apologies, Lady Prestor." #define GOSSIP_ITEM_KAT_3 "Begging your pardon, Lady Prestor. That was not my intent." #define GOSSIP_ITEM_KAT_4 "Thank you for your time, Lady Prestor." - -bool GossipHello_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature) + class npc_lady_katrana_prestor : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lady_katrana_prestor() : CreatureScript("npc_lady_katrana_prestor") { } - if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(2693, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(2694, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(2695, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(2696, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(4185); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(2694, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(2695, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(2696, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(4185); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(4185) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KAT_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(2693, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_lord_gregor_lescovar @@ -263,225 +293,239 @@ enum eLordGregorLescovar QUEST_THE_ATTACK = 434 }; - -struct npc_lord_gregor_lescovarAI : public npc_escortAI + class npc_lord_gregor_lescovar : public CreatureScript { - npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_lord_gregor_lescovar() : CreatureScript("npc_lord_gregor_lescovar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->RestoreFaction(); + return new npc_lord_gregor_lescovarAI(pCreature); } - uint32 uiTimer; - uint32 uiPhase; - - uint64 MarzonGUID; - - void Reset() + struct npc_lord_gregor_lescovarAI : public npc_escortAI { - uiTimer = 0; - uiPhase = 0; - - MarzonGUID = 0; - } - - void EnterEvadeMode() - { - me->DisappearAndDie(); - - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + npc_lord_gregor_lescovarAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (pMarzon->isAlive()) - pMarzon->DisappearAndDie(); + pCreature->RestoreFaction(); } - } - void EnterCombat(Unit* pWho) - { - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) - { - if (pMarzon->isAlive() && !pMarzon->isInCombat()) - pMarzon->AI()->AttackStart(pWho); - } - } + uint32 uiTimer; + uint32 uiPhase; - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + uint64 MarzonGUID; + + void Reset() { - case 14: - SetEscortPaused(true); - DoScriptText(SAY_LESCOVAR_2, me); - uiTimer = 3000; - uiPhase = 1; - break; - case 16: - SetEscortPaused(true); - if (Creature *pMarzon = me->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) - { - pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903); - MarzonGUID = pMarzon->GetGUID(); - } - uiTimer = 2000; - uiPhase = 4; - break; + uiTimer = 0; + uiPhase = 0; + + MarzonGUID = 0; } - } - //TO-DO: We don't have movemaps, also we can't make 2 npcs walks to one point propperly (and we can not use escort ai, because they are 2 different spawns and with same entry), because of it we make them, disappear. - void DoGuardsDisappearAndDie() - { - std::list GuardList; - me->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f); - if (!GuardList.empty()) + + void EnterEvadeMode() { - for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + me->DisappearAndDie(); + + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) { - if (Creature* pGuard = *itr) - pGuard->DisappearAndDie(); + if (pMarzon->isAlive()) + pMarzon->DisappearAndDie(); } } - } - void UpdateAI(const uint32 uiDiff) - { - if (uiPhase) + void EnterCombat(Unit* pWho) { - if (uiTimer <= uiDiff) + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) { - switch(uiPhase) - { - case 1: - if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true)) - DoScriptText(SAY_GUARD_2, pGuard); - uiTimer = 3000; - uiPhase = 2; - break; - case 2: - DoGuardsDisappearAndDie(); - uiTimer = 2000; - uiPhase = 3; - break; - case 3: - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 4: - DoScriptText(SAY_LESCOVAR_3, me); - uiTimer = 0; - uiPhase = 0; - break; - case 5: - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) - DoScriptText(SAY_MARZON_1, pMarzon); - uiTimer = 3000; - uiPhase = 6; - break; - case 6: - DoScriptText(SAY_LESCOVAR_4, me); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->AreaExploredOrEventHappens(QUEST_THE_ATTACK); - uiTimer = 2000; - uiPhase = 7; - break; - case 7: - if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true)) - DoScriptText(SAY_TYRION_2, pTyrion); - if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) - pMarzon->setFaction(14); - me->setFaction(14); - uiTimer = 0; - uiPhase = 0; - break; - } - } else uiTimer -= uiDiff; + if (pMarzon->isAlive() && !pMarzon->isInCombat()) + pMarzon->AI()->AttackStart(pWho); + } } - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 14: + SetEscortPaused(true); + DoScriptText(SAY_LESCOVAR_2, me); + uiTimer = 3000; + uiPhase = 1; + break; + case 16: + SetEscortPaused(true); + if (Creature *pMarzon = me->SummonCreature(NPC_MARZON_BLADE,-8411.360352, 480.069733, 123.760895, 4.941504, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000)) + { + pMarzon->GetMotionMaster()->MovePoint(0,-8408.000977, 468.611450, 123.759903); + MarzonGUID = pMarzon->GetGUID(); + } + uiTimer = 2000; + uiPhase = 4; + break; + } + } + //TO-DO: We don't have movemaps, also we can't make 2 npcs walks to one point propperly (and we can not use escort ai, because they are 2 different spawns and with same entry), because of it we make them, disappear. + void DoGuardsDisappearAndDie() + { + std::list GuardList; + me->GetCreatureListWithEntryInGrid(GuardList,NPC_STORMWIND_ROYAL,8.0f); + if (!GuardList.empty()) + { + for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + { + if (Creature* pGuard = *itr) + pGuard->DisappearAndDie(); + } + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 8.0f, true)) + DoScriptText(SAY_GUARD_2, pGuard); + uiTimer = 3000; + uiPhase = 2; + break; + case 2: + DoGuardsDisappearAndDie(); + uiTimer = 2000; + uiPhase = 3; + break; + case 3: + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 4: + DoScriptText(SAY_LESCOVAR_3, me); + uiTimer = 0; + uiPhase = 0; + break; + case 5: + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + DoScriptText(SAY_MARZON_1, pMarzon); + uiTimer = 3000; + uiPhase = 6; + break; + case 6: + DoScriptText(SAY_LESCOVAR_4, me); + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->AreaExploredOrEventHappens(QUEST_THE_ATTACK); + uiTimer = 2000; + uiPhase = 7; + break; + case 7: + if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION, 20.0f, true)) + DoScriptText(SAY_TYRION_2, pTyrion); + if (Creature *pMarzon = Unit::GetCreature(*me, MarzonGUID)) + pMarzon->setFaction(14); + me->setFaction(14); + uiTimer = 0; + uiPhase = 0; + break; + } + } else uiTimer -= uiDiff; + } + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_lord_gregor_lescovar(Creature* pCreature) -{ - return new npc_lord_gregor_lescovarAI(pCreature); -} /*###### ## npc_marzon_silent_blade ######*/ - -struct npc_marzon_silent_bladeAI : public ScriptedAI + class npc_marzon_silent_blade : public CreatureScript { - npc_marzon_silent_bladeAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_marzon_silent_blade() : CreatureScript("npc_marzon_silent_blade") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + return new npc_marzon_silent_bladeAI(pCreature); } - void Reset() + struct npc_marzon_silent_bladeAI : public ScriptedAI { - me->RestoreFaction(); - } - - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_MARZON_2, me); - - if (me->isSummon()) + npc_marzon_silent_bladeAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + } + + void Reset() + { + me->RestoreFaction(); + } + + void EnterCombat(Unit* pWho) + { + DoScriptText(SAY_MARZON_2, me); + + if (me->isSummon()) { - if (pSummoner && pSummoner->isAlive() && !pSummoner->isInCombat()) - CAST_CRE(pSummoner)->AI()->AttackStart(pWho); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive() && !pSummoner->isInCombat()) + CAST_CRE(pSummoner)->AI()->AttackStart(pWho); + } } } - } - void EnterEvadeMode() - { - me->DisappearAndDie(); - - if (me->isSummon()) + void EnterEvadeMode() { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + me->DisappearAndDie(); + + if (me->isSummon()) { - if (pSummoner && pSummoner->isAlive()) - CAST_CRE(pSummoner)->DisappearAndDie(); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive()) + CAST_CRE(pSummoner)->DisappearAndDie(); + } } } - } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; - - if (me->isSummon()) + void MovementInform(uint32 uiType, uint32 /*uiId*/) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + if (uiType != POINT_MOTION_TYPE) + return; + + if (me->isSummon()) { - CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000; - CAST_AI(npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5; - //me->ChangeOrient(0.0f, pSummoner); + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000; + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5; + //me->ChangeOrient(0.0f, pSummoner); + } } } - } - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_marzon_silent_blade(Creature* pCreature) -{ - return new npc_marzon_silent_bladeAI(pCreature); -} /*###### ## npc_tyrion_spybot @@ -501,129 +545,136 @@ enum eTyrionSpybot NPC_PRIESTESS_TYRIONA = 7779, NPC_LORD_GREGOR_LESCOVAR = 1754, }; - -struct npc_tyrion_spybotAI : public npc_escortAI + class npc_tyrion_spybot : public CreatureScript { - npc_tyrion_spybotAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_tyrion_spybot() : CreatureScript("npc_tyrion_spybot") { } - uint32 uiTimer; - uint32 uiPhase; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiTimer = 0; - uiPhase = 0; + return new npc_tyrion_spybotAI(pCreature); } - void WaypointReached(uint32 uiPointId) + struct npc_tyrion_spybotAI : public npc_escortAI { - switch(uiPointId) + npc_tyrion_spybotAI(Creature* pCreature) : npc_escortAI(pCreature) {} + + uint32 uiTimer; + uint32 uiPhase; + + void Reset() { - case 1: - SetEscortPaused(true); - uiTimer = 2000; - uiPhase = 1; - break; - case 5: - SetEscortPaused(true); - DoScriptText(SAY_SPYBOT_1, me); - uiTimer = 2000; - uiPhase = 5; - break; - case 17: - SetEscortPaused(true); - DoScriptText(SAY_SPYBOT_3, me); - uiTimer = 3000; - uiPhase = 8; - break; + uiTimer = 0; + uiPhase = 0; } - } - void UpdateAI(const uint32 uiDiff) - { - if (uiPhase) + void WaypointReached(uint32 uiPointId) { - if (uiTimer <= uiDiff) + switch(uiPointId) { - switch(uiPhase) - { - case 1: - DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me); - uiTimer = 3000; - uiPhase = 2; - break; - case 2: - if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION,10.0f)) - DoScriptText(SAY_TYRION_1, pTyrion); - uiTimer = 3000; - uiPhase = 3; - break; - case 3: - me->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE); - uiTimer = 2000; - uiPhase = 4; - break; - case 4: - SetEscortPaused(false); - uiPhase = 0; - uiTimer = 0; - break; - case 5: - if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true)) - DoScriptText(SAY_GUARD_1, pGuard); - uiTimer = 3000; - uiPhase = 6; - break; - case 6: - DoScriptText(SAY_SPYBOT_2, me); - uiTimer = 3000; - uiPhase = 7; - break; - case 7: - SetEscortPaused(false); - uiTimer = 0; - uiPhase = 0; - break; - case 8: - if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) - DoScriptText(SAY_LESCOVAR_1, pLescovar); - uiTimer = 3000; - uiPhase = 9; - break; - case 9: - DoScriptText(SAY_SPYBOT_4, me); - uiTimer = 3000; - uiPhase = 10; - break; - case 10: - if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) - { - if (Player* pPlayer = GetPlayerForEscort()) - { - CAST_AI(npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f); - } - } - me->DisappearAndDie(); - uiTimer = 0; - uiPhase = 0; - break; - } - } else uiTimer -= uiDiff; + case 1: + SetEscortPaused(true); + uiTimer = 2000; + uiPhase = 1; + break; + case 5: + SetEscortPaused(true); + DoScriptText(SAY_SPYBOT_1, me); + uiTimer = 2000; + uiPhase = 5; + break; + case 17: + SetEscortPaused(true); + DoScriptText(SAY_SPYBOT_3, me); + uiTimer = 3000; + uiPhase = 8; + break; + } } - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 uiDiff) + { + if (uiPhase) + { + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + DoScriptText(SAY_QUEST_ACCEPT_ATTACK, me); + uiTimer = 3000; + uiPhase = 2; + break; + case 2: + if (Creature* pTyrion = me->FindNearestCreature(NPC_TYRION,10.0f)) + DoScriptText(SAY_TYRION_1, pTyrion); + uiTimer = 3000; + uiPhase = 3; + break; + case 3: + me->UpdateEntry(NPC_PRIESTESS_TYRIONA, ALLIANCE); + uiTimer = 2000; + uiPhase = 4; + break; + case 4: + SetEscortPaused(false); + uiPhase = 0; + uiTimer = 0; + break; + case 5: + if (Creature* pGuard = me->FindNearestCreature(NPC_STORMWIND_ROYAL, 10.0f, true)) + DoScriptText(SAY_GUARD_1, pGuard); + uiTimer = 3000; + uiPhase = 6; + break; + case 6: + DoScriptText(SAY_SPYBOT_2, me); + uiTimer = 3000; + uiPhase = 7; + break; + case 7: + SetEscortPaused(false); + uiTimer = 0; + uiPhase = 0; + break; + case 8: + if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) + DoScriptText(SAY_LESCOVAR_1, pLescovar); + uiTimer = 3000; + uiPhase = 9; + break; + case 9: + DoScriptText(SAY_SPYBOT_4, me); + uiTimer = 3000; + uiPhase = 10; + break; + case 10: + if (Creature* pLescovar = me->FindNearestCreature(NPC_LORD_GREGOR_LESCOVAR,10.0f)) + { + if (Player* pPlayer = GetPlayerForEscort()) + { + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI,pLescovar->AI())->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pLescovar->AI())->SetMaxPlayerDistance(200.0f); + } + } + me->DisappearAndDie(); + uiTimer = 0; + uiPhase = 0; + break; + } + } else uiTimer -= uiDiff; + } + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_tyrion_spybot(Creature* pCreature) -{ - return new npc_tyrion_spybotAI(pCreature); -} /*###### ## npc_tyrion @@ -633,66 +684,35 @@ enum eTyrion { NPC_TYRION_SPYBOT = 8856 }; - -bool QuestAccept_npc_tyrion(Player* pPlayer, Creature* pCreature, Quest const *pQuest) + class npc_tyrion : public CreatureScript { - if (pQuest->GetQuestId() == QUEST_THE_ATTACK) +public: + npc_tyrion() : CreatureScript("npc_tyrion") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *pQuest) { - if (Creature* pSpybot = pCreature->FindNearestCreature(NPC_TYRION_SPYBOT, 5.0f, true)) + if (pQuest->GetQuestId() == QUEST_THE_ATTACK) { - CAST_AI(npc_tyrion_spybotAI,pSpybot->AI())->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_tyrion_spybotAI,pSpybot->AI())->SetMaxPlayerDistance(200.0f); + if (Creature* pSpybot = pCreature->FindNearestCreature(NPC_TYRION_SPYBOT, 5.0f, true)) + { + CAST_AI(npc_tyrion_spybot::npc_tyrion_spybotAI,pSpybot->AI())->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_tyrion_spybot::npc_tyrion_spybotAI,pSpybot->AI())->SetMaxPlayerDistance(200.0f); + } + return true; } - return true; + return false; } - return false; -} + +}; void AddSC_stormwind_city() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_archmage_malin"; - newscript->pGossipHello = &GossipHello_npc_archmage_malin; - newscript->pGossipSelect = &GossipSelect_npc_archmage_malin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bartleby"; - newscript->GetAI = &GetAI_npc_bartleby; - newscript->pQuestAccept = &QuestAccept_npc_bartleby; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dashel_stonefist"; - newscript->GetAI = &GetAI_npc_dashel_stonefist; - newscript->pQuestAccept = &QuestAccept_npc_dashel_stonefist; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lady_katrana_prestor"; - newscript->pGossipHello = &GossipHello_npc_lady_katrana_prestor; - newscript->pGossipSelect = &GossipSelect_npc_lady_katrana_prestor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrion"; - newscript->pQuestAccept = &QuestAccept_npc_tyrion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrion_spybot"; - newscript->GetAI = &GetAI_npc_tyrion_spybot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lord_gregor_lescovar"; - newscript->GetAI = &GetAI_npc_lord_gregor_lescovar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marzon_silent_blade"; - newscript->GetAI = &GetAI_npc_marzon_silent_blade; - newscript->RegisterSelf(); + new npc_archmage_malin(); + new npc_bartleby(); + new npc_dashel_stonefist(); + new npc_lady_katrana_prestor(); + new npc_tyrion(); + new npc_tyrion_spybot(); + new npc_lord_gregor_lescovar(); + new npc_marzon_silent_blade(); } diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index 503e27f993c..e25bf43669b 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -32,82 +32,89 @@ EndContentData */ /*###### ## mob_yenniku ######*/ - -struct mob_yennikuAI : public ScriptedAI + class mob_yenniku : public CreatureScript { - mob_yennikuAI(Creature *c) : ScriptedAI(c) +public: + mob_yenniku() : CreatureScript("mob_yenniku") { } + + CreatureAI* GetAI(Creature* pCreature) const { - bReset = false; + return new mob_yennikuAI (pCreature); } - uint32 Reset_Timer; - bool bReset; - - void Reset() + struct mob_yennikuAI : public ScriptedAI { - Reset_Timer = 0; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - } - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (caster->GetTypeId() == TYPEID_PLAYER) + mob_yennikuAI(Creature *c) : ScriptedAI(c) { - //Yenniku's Release - if (!bReset && CAST_PLR(caster)->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE && spell->Id == 3607) - { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); - me->CombatStop(); //stop combat - me->DeleteThreatList(); //unsure of this - me->setFaction(83); //horde generic - - bReset = true; - Reset_Timer = 60000; - } + bReset = false; } - return; - } - void EnterCombat(Unit * /*who*/) {} + uint32 Reset_Timer; + bool bReset; - void UpdateAI(const uint32 diff) - { - if (bReset) + void Reset() { - if (Reset_Timer <= diff) - { - EnterEvadeMode(); - bReset = false; - me->setFaction(28); //troll, bloodscalp - return; - } - else Reset_Timer -= diff; + Reset_Timer = 0; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + } - if (me->isInCombat() && me->getVictim()) + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (caster->GetTypeId() == TYPEID_PLAYER) { - if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) + //Yenniku's Release + if (!bReset && CAST_PLR(caster)->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE && spell->Id == 3607) { - Unit *victim = me->getVictim(); - if (CAST_PLR(victim)->GetTeam() == HORDE) - { - me->CombatStop(); - me->DeleteThreatList(); - } + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); + me->CombatStop(); //stop combat + me->DeleteThreatList(); //unsure of this + me->setFaction(83); //horde generic + + bReset = true; + Reset_Timer = 60000; } } - } - - //Return since we have no target - if (!UpdateVictim()) return; + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (bReset) + { + if (Reset_Timer <= diff) + { + EnterEvadeMode(); + bReset = false; + me->setFaction(28); //troll, bloodscalp + return; + } + else Reset_Timer -= diff; + + if (me->isInCombat() && me->getVictim()) + { + if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) + { + Unit *victim = me->getVictim(); + if (CAST_PLR(victim)->GetTeam() == HORDE) + { + me->CombatStop(); + me->DeleteThreatList(); + } + } + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_yenniku(Creature* pCreature) -{ - return new mob_yennikuAI (pCreature); -} /*###### ## @@ -115,10 +122,5 @@ CreatureAI* GetAI_mob_yenniku(Creature* pCreature) void AddSC_stranglethorn_vale() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_yenniku"; - newscript->GetAI = &GetAI_mob_yenniku; - newscript->RegisterSelf(); + new mob_yenniku(); } diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 1f34a015f37..8dc91f7eeac 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -42,108 +42,116 @@ enum eCalvin QUEST_590 = 590, FACTION_HOSTILE = 168 }; - -struct npc_calvin_montagueAI : public ScriptedAI + class npc_calvin_montague : public CreatureScript { - npc_calvin_montagueAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_calvin_montague() : CreatureScript("npc_calvin_montague") { } - uint32 m_uiPhase; - uint32 m_uiPhaseTimer; - uint64 m_uiPlayerGUID; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - m_uiPhase = 0; - m_uiPhaseTimer = 5000; - m_uiPlayerGUID = 0; - - me->RestoreFaction(); - - if (!me->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - void EnterCombat(Unit* /*who*/) {} - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim() || me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) + if (pQuest->GetQuestId() == QUEST_590) { - uiDamage = 0; + pCreature->setFaction(FACTION_HOSTILE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, pCreature->AI())->AttackStart(pPlayer); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_calvin_montagueAI (pCreature); + } + + struct npc_calvin_montagueAI : public ScriptedAI + { + npc_calvin_montagueAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + uint32 m_uiPhase; + uint32 m_uiPhaseTimer; + uint64 m_uiPlayerGUID; + + void Reset() + { + m_uiPhase = 0; + m_uiPhaseTimer = 5000; + m_uiPlayerGUID = 0; me->RestoreFaction(); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->CombatStop(true); - m_uiPhase = 1; - - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - m_uiPlayerGUID = pDoneBy->GetGUID(); + if (!me->HasFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE)) + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); } - } - void UpdateAI(const uint32 uiDiff) - { - if (m_uiPhase) + void EnterCombat(Unit* /*who*/) {} + + void AttackedBy(Unit* pAttacker) { - if (m_uiPhaseTimer <= uiDiff) - m_uiPhaseTimer = 7500; - else + if (me->getVictim() || me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 15)) { - m_uiPhaseTimer -= uiDiff; + uiDamage = 0; + + me->RestoreFaction(); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->CombatStop(true); + + m_uiPhase = 1; + + if (pDoneBy->GetTypeId() == TYPEID_PLAYER) + m_uiPlayerGUID = pDoneBy->GetGUID(); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (m_uiPhase) + { + if (m_uiPhaseTimer <= uiDiff) + m_uiPhaseTimer = 7500; + else + { + m_uiPhaseTimer -= uiDiff; + return; + } + + switch(m_uiPhase) + { + case 1: + DoScriptText(SAY_COMPLETE, me); + ++m_uiPhase; + break; + case 2: + if (Player *pPlayer = Unit::GetPlayer(*me, m_uiPlayerGUID)) + pPlayer->AreaExploredOrEventHappens(QUEST_590); + + DoCast(me, SPELL_DRINK, true); + ++m_uiPhase; + break; + case 3: + EnterEvadeMode(); + break; + } + return; } - switch(m_uiPhase) - { - case 1: - DoScriptText(SAY_COMPLETE, me); - ++m_uiPhase; - break; - case 2: - if (Player *pPlayer = Unit::GetPlayer(*me, m_uiPlayerGUID)) - pPlayer->AreaExploredOrEventHappens(QUEST_590); + if (!UpdateVictim()) + return; - DoCast(me, SPELL_DRINK, true); - ++m_uiPhase; - break; - case 3: - EnterEvadeMode(); - break; - } - - return; + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_calvin_montague(Creature* pCreature) -{ - return new npc_calvin_montagueAI (pCreature); -} -bool QuestAccept_npc_calvin_montague(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_590) - { - pCreature->setFaction(FACTION_HOSTILE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - CAST_AI(npc_calvin_montagueAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} /*###### ## go_mausoleum_door @@ -157,54 +165,52 @@ enum eMausoleum GO_TRIGGER = 104593, GO_DOOR = 176594 }; - -bool GOHello_go_mausoleum_door(Player* pPlayer, GameObject* /*pGo*/) + class go_mausoleum_door : public GameObjectScript { - if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) - return false; +public: + go_mausoleum_door() : GameObjectScript("go_mausoleum_door") { } - if (GameObject* pTrigger = pPlayer->FindNearestGameObject(GO_TRIGGER, 30.0f)) + bool OnGossipHello(Player* pPlayer, GameObject* /*pGo*/) { - pTrigger->SetGoState(GO_STATE_READY); - pPlayer->SummonCreature(NPC_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); + if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) + return false; + + if (GameObject* pTrigger = pPlayer->FindNearestGameObject(GO_TRIGGER, 30.0f)) + { + pTrigger->SetGoState(GO_STATE_READY); + pPlayer->SummonCreature(NPC_ULAG, 2390.26, 336.47, 40.01, 2.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 300000); + return false; + } + return false; } - return false; -} - -bool GOHello_go_mausoleum_trigger(Player* pPlayer, GameObject* pGo) +}; + class go_mausoleum_trigger : public GameObjectScript { - if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) - return false; +public: + go_mausoleum_trigger() : GameObjectScript("go_mausoleum_trigger") { } - if (GameObject* pDoor = pPlayer->FindNearestGameObject(GO_DOOR, 30.0f)) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - pGo->SetGoState(GO_STATE_ACTIVE); - pDoor->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - return true; + if (pPlayer->GetQuestStatus(QUEST_ULAG) != QUEST_STATUS_INCOMPLETE) + return false; + + if (GameObject* pDoor = pPlayer->FindNearestGameObject(GO_DOOR, 30.0f)) + { + pGo->SetGoState(GO_STATE_ACTIVE); + pDoor->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + return true; + } + + return false; } - return false; -} +}; void AddSC_tirisfal_glades() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_calvin_montague"; - newscript->GetAI = &GetAI_npc_calvin_montague; - newscript->pQuestAccept = &QuestAccept_npc_calvin_montague; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_mausoleum_door"; - newscript->pGOHello = &GOHello_go_mausoleum_door; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_mausoleum_trigger"; - newscript->pGOHello = &GOHello_go_mausoleum_trigger; - newscript->RegisterSelf(); + new npc_calvin_montague(); + new go_mausoleum_door(); + new go_mausoleum_trigger(); } diff --git a/src/server/scripts/EasternKingdoms/undercity.cpp b/src/server/scripts/EasternKingdoms/undercity.cpp index 017dab5b63d..7d3e831be1c 100644 --- a/src/server/scripts/EasternKingdoms/undercity.cpp +++ b/src/server/scripts/EasternKingdoms/undercity.cpp @@ -56,133 +56,148 @@ float HighborneLoc[4][3]= #define HIGHBORNE_LOC_Y -61.00 #define HIGHBORNE_LOC_Y_NEW -55.50 - -struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI + class npc_lady_sylvanas_windrunner : public CreatureScript { - npc_lady_sylvanas_windrunnerAI(Creature *c) : ScriptedAI(c) {} +public: + npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { } - uint32 LamentEvent_Timer; - bool LamentEvent; - uint64 targetGUID; - - void Reset() + bool ChooseReward(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*slot*/) { - LamentEvent_Timer = 5000; - LamentEvent = false; - targetGUID = 0; + if (_Quest->GetQuestId() == 9180) + { + CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, pCreature->AI())->LamentEvent = true; + CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, pCreature->AI())->DoPlaySoundToSet(pCreature,SOUND_CREDIT); + pCreature->CastSpell(pCreature,SPELL_SYLVANAS_CAST,false); + + for (uint8 i = 0; i < 4; ++i) + pCreature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); + } + + return true; } - void EnterCombat(Unit * /*who*/) {} - - void JustSummoned(Creature *summoned) + CreatureAI* GetAI(Creature* pCreature) const { - if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) + return new npc_lady_sylvanas_windrunnerAI (pCreature); + } + + struct npc_lady_sylvanas_windrunnerAI : public ScriptedAI + { + npc_lady_sylvanas_windrunnerAI(Creature *c) : ScriptedAI(c) {} + + uint32 LamentEvent_Timer; + bool LamentEvent; + uint64 targetGUID; + + void Reset() { - if (Unit *pTarget = Unit::GetUnit(*summoned,targetGUID)) + LamentEvent_Timer = 5000; + LamentEvent = false; + targetGUID = 0; + } + + void EnterCombat(Unit * /*who*/) {} + + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY) { - pTarget->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0,0); - pTarget->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0, 0.0f); - summoned->CastSpell(pTarget, SPELL_RIBBON_OF_SOULS, false); + if (Unit *pTarget = Unit::GetUnit(*summoned,targetGUID)) + { + pTarget->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0,0); + pTarget->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), me->GetPositionZ()+15.0, 0.0f); + summoned->CastSpell(pTarget, SPELL_RIBBON_OF_SOULS, false); + } + + summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + targetGUID = summoned->GetGUID(); + } + } + + void UpdateAI(const uint32 diff) + { + if (LamentEvent) + { + if (LamentEvent_Timer <= diff) + { + DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); + + LamentEvent_Timer = 2000; + if (!me->HasAura(SPELL_SYLVANAS_CAST)) + { + DoScriptText(SAY_LAMENT_END, me); + DoScriptText(EMOTE_LAMENT_END, me); + LamentEvent = false; + } + } else LamentEvent_Timer -= diff; } - summoned->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - targetGUID = summoned->GetGUID(); + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } - } + }; - void UpdateAI(const uint32 diff) - { - if (LamentEvent) - { - if (LamentEvent_Timer <= diff) - { - DoSummon(ENTRY_HIGHBORNE_BUNNY, me, 10.0f, 3000, TEMPSUMMON_TIMED_DESPAWN); - - LamentEvent_Timer = 2000; - if (!me->HasAura(SPELL_SYLVANAS_CAST)) - { - DoScriptText(SAY_LAMENT_END, me); - DoScriptText(EMOTE_LAMENT_END, me); - LamentEvent = false; - } - } else LamentEvent_Timer -= diff; - } - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_lady_sylvanas_windrunner(Creature* pCreature) -{ - return new npc_lady_sylvanas_windrunnerAI (pCreature); -} -bool ChooseReward_npc_lady_sylvanas_windrunner(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest, uint32 /*slot*/) -{ - if (_Quest->GetQuestId() == 9180) - { - CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->LamentEvent = true; - CAST_AI(npc_lady_sylvanas_windrunnerAI, pCreature->AI())->DoPlaySoundToSet(pCreature,SOUND_CREDIT); - pCreature->CastSpell(pCreature,SPELL_SYLVANAS_CAST,false); - - for (uint8 i = 0; i < 4; ++i) - pCreature->SummonCreature(ENTRY_HIGHBORNE_LAMENTER, HighborneLoc[i][0], HighborneLoc[i][1], HIGHBORNE_LOC_Y, HighborneLoc[i][2], TEMPSUMMON_TIMED_DESPAWN, 160000); - } - - return true; -} /*###### ## npc_highborne_lamenter ######*/ - -struct npc_highborne_lamenterAI : public ScriptedAI + class npc_highborne_lamenter : public CreatureScript { - npc_highborne_lamenterAI(Creature *c) : ScriptedAI(c) {} +public: + npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { } - uint32 EventMove_Timer; - uint32 EventCast_Timer; - bool EventMove; - bool EventCast; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - EventMove_Timer = 10000; - EventCast_Timer = 17500; - EventMove = true; - EventCast = true; + return new npc_highborne_lamenterAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct npc_highborne_lamenterAI : public ScriptedAI { - if (EventMove) + npc_highborne_lamenterAI(Creature *c) : ScriptedAI(c) {} + + uint32 EventMove_Timer; + uint32 EventCast_Timer; + bool EventMove; + bool EventCast; + + void Reset() { - if (EventMove_Timer <= diff) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMonsterMoveWithSpeed(me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,5000); - me->GetMap()->CreatureRelocation(me,me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,me->GetOrientation()); - EventMove = false; - } else EventMove_Timer -= diff; + EventMove_Timer = 10000; + EventCast_Timer = 17500; + EventMove = true; + EventCast = true; } - if (EventCast) + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (EventCast_Timer <= diff) + if (EventMove) { - DoCast(me, SPELL_HIGHBORNE_AURA); - EventCast = false; - } else EventCast_Timer -= diff; + if (EventMove_Timer <= diff) + { + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMonsterMoveWithSpeed(me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,5000); + me->GetMap()->CreatureRelocation(me,me->GetPositionX(),me->GetPositionY(),HIGHBORNE_LOC_Y_NEW,me->GetOrientation()); + EventMove = false; + } else EventMove_Timer -= diff; + } + if (EventCast) + { + if (EventCast_Timer <= diff) + { + DoCast(me, SPELL_HIGHBORNE_AURA); + EventCast = false; + } else EventCast_Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_npc_highborne_lamenter(Creature* pCreature) -{ - return new npc_highborne_lamenterAI (pCreature); -} /*###### ## npc_parqual_fintallas @@ -193,39 +208,46 @@ CreatureAI* GetAI_npc_highborne_lamenter(Creature* pCreature) #define GOSSIP_HPF1 "Gul'dan" #define GOSSIP_HPF2 "Kel'Thuzad" #define GOSSIP_HPF3 "Ner'zhul" - -bool GossipHello_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature) + class npc_parqual_fintallas : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_parqual_fintallas() : CreatureScript("npc_parqual_fintallas") { } - if (pPlayer->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasAura(SPELL_MARK_OF_SHAME)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(5822, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,SPELL_MARK_OF_SHAME,false); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(6628); + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(5821, pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,SPELL_MARK_OF_SHAME,false); + if (pPlayer->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasAura(SPELL_MARK_OF_SHAME)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(5822, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(5821, pCreature->GetGUID()); + + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(6628); - } - return true; -} + +}; + /*###### ## AddSC @@ -233,22 +255,7 @@ bool GossipSelect_npc_parqual_fintallas(Player* pPlayer, Creature* pCreature, ui void AddSC_undercity() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_lady_sylvanas_windrunner"; - newscript->GetAI = &GetAI_npc_lady_sylvanas_windrunner; - newscript->pChooseReward = &ChooseReward_npc_lady_sylvanas_windrunner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_highborne_lamenter"; - newscript->GetAI = &GetAI_npc_highborne_lamenter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_parqual_fintallas"; - newscript->pGossipHello = &GossipHello_npc_parqual_fintallas; - newscript->pGossipSelect = &GossipSelect_npc_parqual_fintallas; - newscript->RegisterSelf(); + new npc_lady_sylvanas_windrunner(); + new npc_highborne_lamenter(); + new npc_parqual_fintallas(); } diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index 3dddf3a3f80..9950955fd44 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -43,57 +43,64 @@ EndContentData */ #define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?" #define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser" - -bool GossipHello_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature) + class npcs_dithers_and_arbington : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npcs_dithers_and_arbington() : CreatureScript("npcs_dithers_and_arbington") { } - if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npcs_dithers_and_arbington(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3980, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3981, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3982, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(3983, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 17529, false); - break; + switch(uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3980, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3981, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3982, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(3983, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 17529, false); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (pPlayer->GetQuestRewardStatus(5237) || pPlayer->GetQuestRewardStatus(5238)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(3985, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_myranda_the_hag @@ -107,106 +114,120 @@ enum eMyranda }; #define GOSSIP_ITEM_ILLUSION "I am ready for the illusion, Myranda." - -bool GossipHello_npc_myranda_the_hag(Player* pPlayer, Creature* pCreature) + class npc_myranda_the_hag : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_myranda_the_hag() : CreatureScript("npc_myranda_the_hag") { } - if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && - !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION)) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4773, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CastSpell(pPlayer, SPELL_SCARLET_ILLUSION, false); + } return true; } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_myranda_the_hag(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CastSpell(pPlayer, SPELL_SCARLET_ILLUSION, false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE && + !pPlayer->GetQuestRewardStatus(QUEST_IN_DREAMS) && !pPlayer->HasAura(SPELL_SCARLET_ILLUSION)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ILLUSION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(4773, pCreature->GetGUID()); + return true; + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_the_scourge_cauldron ######*/ - -struct npc_the_scourge_cauldronAI : public ScriptedAI + class npc_the_scourge_cauldron : public CreatureScript { - npc_the_scourge_cauldronAI(Creature *c) : ScriptedAI(c) {} +public: + npc_the_scourge_cauldron() : CreatureScript("npc_the_scourge_cauldron") { } - void Reset() {} - - void EnterCombat(Unit* /*who*/) {} - - void DoDie() + CreatureAI* GetAI(Creature* pCreature) const { - //summoner dies here - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - //override any database `spawntimesecs` to prevent duplicated summons - uint32 rTime = me->GetRespawnDelay(); - if (rTime<600) - me->SetRespawnDelay(600); + return new npc_the_scourge_cauldronAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_the_scourge_cauldronAI : public ScriptedAI { - if (!who || who->GetTypeId() != TYPEID_PLAYER) - return; + npc_the_scourge_cauldronAI(Creature *c) : ScriptedAI(c) {} - if (who->GetTypeId() == TYPEID_PLAYER) + void Reset() {} + + void EnterCombat(Unit* /*who*/) {} + + void DoDie() { - switch(me->GetAreaId()) + //summoner dies here + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + //override any database `spawntimesecs` to prevent duplicated summons + uint32 rTime = me->GetRespawnDelay(); + if (rTime<600) + me->SetRespawnDelay(600); + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || who->GetTypeId() != TYPEID_PLAYER) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) { - case 199: //felstone - if (CAST_PLR(who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - DoDie(); - } - break; - case 200: //dalson - if (CAST_PLR(who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - DoDie(); - } - break; - case 201: //gahrron - if (CAST_PLR(who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); - DoDie(); - } - break; - case 202: //writhing - if (CAST_PLR(who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE || - CAST_PLR(who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE) - { - me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); - DoDie(); - } - break; + switch(me->GetAreaId()) + { + case 199: //felstone + if (CAST_PLR(who)->GetQuestStatus(5216) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5229) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11075, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + DoDie(); + } + break; + case 200: //dalson + if (CAST_PLR(who)->GetQuestStatus(5219) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5231) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11077, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + DoDie(); + } + break; + case 201: //gahrron + if (CAST_PLR(who)->GetQuestStatus(5225) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5235) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11078, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); + DoDie(); + } + break; + case 202: //writhing + if (CAST_PLR(who)->GetQuestStatus(5222) == QUEST_STATUS_INCOMPLETE || + CAST_PLR(who)->GetQuestStatus(5233) == QUEST_STATUS_INCOMPLETE) + { + me->SummonCreature(11076, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000); + DoDie(); + } + break; + } } } - } + }; + }; -CreatureAI* GetAI_npc_the_scourge_cauldron(Creature* pCreature) -{ - return new npc_the_scourge_cauldronAI (pCreature); -} /*###### ## npcs_andorhal_tower @@ -216,25 +237,32 @@ enum eAndorhalTower { GO_BEACON_TORCH = 176093 }; - -struct npc_andorhal_towerAI : public Scripted_NoMovementAI + class npc_andorhal_tower : public CreatureScript { - npc_andorhal_towerAI(Creature *c) : Scripted_NoMovementAI(c) {} +public: + npc_andorhal_tower() : CreatureScript("npc_andorhal_tower") { } - void MoveInLineOfSight(Unit* pWho) + CreatureAI* GetAI(Creature* pCreature) const { - if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER) - return; - - if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f)) - CAST_PLR(pWho)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); + return new npc_andorhal_towerAI (pCreature); } + + struct npc_andorhal_towerAI : public Scripted_NoMovementAI + { + npc_andorhal_towerAI(Creature *c) : Scripted_NoMovementAI(c) {} + + void MoveInLineOfSight(Unit* pWho) + { + if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER) + return; + + if (me->FindNearestGameObject(GO_BEACON_TORCH, 10.0f)) + CAST_PLR(pWho)->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); + } + }; + }; -CreatureAI* GetAI_npc_andorhal_tower(Creature* pCreature) -{ - return new npc_andorhal_towerAI (pCreature); -} /*###### ## npc_anchorite_truuen @@ -256,109 +284,117 @@ enum eTruuen SAY_WP_5 = -1999986, //Please, rise my friend. Keep the Blessing as a symbol of the strength of the Light and how heroes long gone might once again rise in each of us to inspire. SAY_WP_6 = -1999987 //Thank you my friend for making this possible. This is a day that I shall never forget! I think I will stay a while. Please return to High Priestess MacDonnell at the camp. I know that she'll be keenly interested to know of what has transpired here. }; + class npc_anchorite_truuen : public CreatureScript +{ +public: + npc_anchorite_truuen() : CreatureScript("npc_anchorite_truuen") { } -struct npc_anchorite_truuenAI : public npc_escortAI -{ - npc_anchorite_truuenAI(Creature* pCreature) : npc_escortAI(pCreature) { } + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) + { + npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, pCreature->AI()); - uint32 m_uiChatTimer; - - uint64 UghostGUID; - uint64 TheldanisGUID; - - Creature* Ughost; - Creature* Theldanis; - - void Reset() - { - m_uiChatTimer = 7000; + if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + return false; } - void JustSummoned(Creature* pSummoned) + CreatureAI* GetAI(Creature* pCreature) const { - if (pSummoned->GetEntry() == NPC_GHOUL) - pSummoned->AI()->AttackStart(me); + return new npc_anchorite_truuenAI(pCreature); } - - void WaypointReached(uint32 i) + + struct npc_anchorite_truuenAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); - switch (i) - { - case 8: - DoScriptText(SAY_WP_0, me); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - break; - case 9: - DoScriptText(SAY_WP_1, me); - break; - case 14: - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+10.0f, me->GetPositionY()+10.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - me->SummonCreature(NPC_GHOUL, me->GetPositionX()+8.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); - break; - case 15: - DoScriptText(SAY_WP_2, me); - case 21: - Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150); - DoScriptText(SAY_WP_3, Theldanis); - break; - case 22: - break; - case 23: - Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86,-1825.42 ,81.99 , 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - Ughost->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - DoScriptText(SAY_WP_4, Ughost, me); - m_uiChatTimer = 4000; - break; - case 24: - DoScriptText(SAY_WP_5, Ughost, me); - m_uiChatTimer = 4000; - break; - case 25: - DoScriptText(SAY_WP_6, Ughost, me); - m_uiChatTimer = 4000; - break; - case 26: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_TOMB_LIGHTBRINGER, me); - break; + npc_anchorite_truuenAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + uint32 m_uiChatTimer; + + uint64 UghostGUID; + uint64 TheldanisGUID; + + Creature* Ughost; + Creature* Theldanis; + + void Reset() + { + m_uiChatTimer = 7000; } - } - void EnterCombat(Unit* /*pWho*/){} + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_GHOUL) + pSummoned->AI()->AttackStart(me); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 8: + DoScriptText(SAY_WP_0, me); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + break; + case 9: + DoScriptText(SAY_WP_1, me); + break; + case 14: + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+7.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+5.0f, me->GetPositionY()+5.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+10.0f, me->GetPositionY()+10.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + me->SummonCreature(NPC_GHOUL, me->GetPositionX()+8.0f, me->GetPositionY()+8.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 90000); + break; + case 15: + DoScriptText(SAY_WP_2, me); + case 21: + Theldanis = GetClosestCreatureWithEntry(me, NPC_THEL_DANIS, 150); + DoScriptText(SAY_WP_3, Theldanis); + break; + case 22: + break; + case 23: + Ughost = me->SummonCreature(NPC_GHOST_UTHER, 971.86,-1825.42 ,81.99 , 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + Ughost->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + DoScriptText(SAY_WP_4, Ughost, me); + m_uiChatTimer = 4000; + break; + case 24: + DoScriptText(SAY_WP_5, Ughost, me); + m_uiChatTimer = 4000; + break; + case 25: + DoScriptText(SAY_WP_6, Ughost, me); + m_uiChatTimer = 4000; + break; + case 26: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TOMB_LIGHTBRINGER, me); + break; + } + } - void JustDied(Unit* /*pKiller*/) - { - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->FailQuest(QUEST_TOMB_LIGHTBRINGER); - } + void EnterCombat(Unit* /*pWho*/){} + + void JustDied(Unit* /*pKiller*/) + { + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->FailQuest(QUEST_TOMB_LIGHTBRINGER); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + DoMeleeAttackIfReady(); + if (HasEscortState(STATE_ESCORT_ESCORTING)) + m_uiChatTimer = 6000; + } + }; - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - DoMeleeAttackIfReady(); - if (HasEscortState(STATE_ESCORT_ESCORTING)) - m_uiChatTimer = 6000; - } }; -CreatureAI* GetAI_npc_anchorite_truuen(Creature* pCreature) -{ - return new npc_anchorite_truuenAI(pCreature); -} -bool QuestAccept_npc_anchorite_truuen(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuenAI, pCreature->AI()); - - if (quest->GetQuestId() == QUEST_TOMB_LIGHTBRINGER) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - return false; -} /*###### ## @@ -366,33 +402,9 @@ bool QuestAccept_npc_anchorite_truuen(Player* pPlayer, Creature* pCreature, Ques void AddSC_western_plaguelands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npcs_dithers_and_arbington"; - newscript->pGossipHello = &GossipHello_npcs_dithers_and_arbington; - newscript->pGossipSelect = &GossipSelect_npcs_dithers_and_arbington; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_myranda_the_hag"; - newscript->pGossipHello = &GossipHello_npc_myranda_the_hag; - newscript->pGossipSelect = &GossipSelect_npc_myranda_the_hag; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_the_scourge_cauldron"; - newscript->GetAI = &GetAI_npc_the_scourge_cauldron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_andorhal_tower"; - newscript->GetAI = &GetAI_npc_andorhal_tower; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anchorite_truuen"; - newscript->GetAI = &GetAI_npc_anchorite_truuen; - newscript->pQuestAccept = &QuestAccept_npc_anchorite_truuen; - newscript->RegisterSelf(); + new npcs_dithers_and_arbington(); + new npc_myranda_the_hag(); + new npc_the_scourge_cauldron(); + new npc_andorhal_tower(); + new npc_anchorite_truuen(); } diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index e706594dcf5..14e33177555 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -48,138 +48,146 @@ enum eEnums NPC_DEFIAS_RAIDER = 6180, EQUIP_ID_RIFLE = 2511 }; - -struct npc_daphne_stilwellAI : public npc_escortAI + class npc_daphne_stilwell : public CreatureScript { - npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_daphne_stilwell() : CreatureScript("npc_daphne_stilwell") { } - uint32 uiWPHolder; - uint32 uiShootTimer; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (HasEscortState(STATE_ESCORT_ESCORTING)) + if (pQuest->GetQuestId() == QUEST_TOME_VALOR) { - switch(uiWPHolder) + DoScriptText(SAY_DS_START, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + } + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_daphne_stilwellAI(pCreature); + } + + struct npc_daphne_stilwellAI : public npc_escortAI + { + npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} + + uint32 uiWPHolder; + uint32 uiShootTimer; + + void Reset() + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) { - case 7: DoScriptText(SAY_DS_DOWN_1, me); break; - case 8: DoScriptText(SAY_DS_DOWN_2, me); break; - case 9: DoScriptText(SAY_DS_DOWN_3, me); break; + switch(uiWPHolder) + { + case 7: DoScriptText(SAY_DS_DOWN_1, me); break; + case 8: DoScriptText(SAY_DS_DOWN_2, me); break; + case 9: DoScriptText(SAY_DS_DOWN_3, me); break; + } + } + else + uiWPHolder = 0; + + uiShootTimer = 0; + } + + void WaypointReached(uint32 uiPoint) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + uiWPHolder = uiPoint; + + switch(uiPoint) + { + case 4: + SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); + me->SetSheath(SHEATH_STATE_RANGED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 7: + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 8: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 10: + SetRun(false); + break; + case 11: + DoScriptText(SAY_DS_PROLOGUE, me); + break; + case 13: + SetEquipmentSlots(true); + me->SetSheath(SHEATH_STATE_UNARMED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 17: + pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); + break; } } - else - uiWPHolder = 0; - uiShootTimer = 0; - } - - void WaypointReached(uint32 uiPoint) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - uiWPHolder = uiPoint; - - switch(uiPoint) + void AttackStart(Unit* pWho) { - case 4: - SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); - me->SetSheath(SHEATH_STATE_RANGED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 7: - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 8: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 10: - SetRun(false); - break; - case 11: - DoScriptText(SAY_DS_PROLOGUE, me); - break; - case 13: - SetEquipmentSlots(true); - me->SetSheath(SHEATH_STATE_UNARMED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 17: - pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); - break; + if (!pWho) + return; + + if (me->Attack(pWho, false)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + me->GetMotionMaster()->MoveChase(pWho, 30.0f); + } } - } - void AttackStart(Unit* pWho) - { - if (!pWho) - return; - - if (me->Attack(pWho, false)) + void JustSummoned(Creature* pSummoned) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - - me->GetMotionMaster()->MoveChase(pWho, 30.0f); + pSummoned->AI()->AttackStart(me); } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->AI()->AttackStart(me); - } - - void Update(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (uiShootTimer <= diff) + void Update(const uint32 diff) { - uiShootTimer = 1500; + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (uiShootTimer <= diff) + { + uiShootTimer = 1500; + + if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) + DoCast(me->getVictim(), SPELL_SHOOT); + } else uiShootTimer -= diff; + } + }; - if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) - DoCast(me->getVictim(), SPELL_SHOOT); - } else uiShootTimer -= diff; - } }; -bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOME_VALOR) - { - DoScriptText(SAY_DS_START, pCreature); - if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwellAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - } - - return true; -} - -CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) -{ - return new npc_daphne_stilwellAI(pCreature); -} /*###### ## npc_defias_traitor @@ -192,74 +200,71 @@ CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) #define SAY_AGGRO_2 -1000105 #define QUEST_DEFIAS_BROTHERHOOD 155 - -struct npc_defias_traitorAI : public npc_escortAI + class npc_defias_traitor : public CreatureScript { - npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } +public: + npc_defias_traitor() : CreatureScript("npc_defias_traitor") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) { - case 35: - SetRun(false); - break; - case 36: - DoScriptText(SAY_PROGRESS, me, pPlayer); - break; - case 44: - DoScriptText(SAY_END, me, pPlayer); - { - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); - } - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitor::npc_defias_traitorAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + + DoScriptText(SAY_START, pCreature, pPlayer); } - } - void EnterCombat(Unit* who) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + + return true; } - void Reset() {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_defias_traitorAI(pCreature); + } + + struct npc_defias_traitorAI : public npc_escortAI + { + npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 35: + SetRun(false); + break; + case 36: + DoScriptText(SAY_PROGRESS, me, pPlayer); + break; + case 44: + DoScriptText(SAY_END, me, pPlayer); + { + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); + } + break; + } + } + void EnterCombat(Unit* who) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + } + + void Reset() {} + }; + }; -bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitorAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - DoScriptText(SAY_START, pCreature, pPlayer); - } - - return true; -} - -CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature) -{ - return new npc_defias_traitorAI(pCreature); -} void AddSC_westfall() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_daphne_stilwell"; - newscript->GetAI = &GetAI_npc_daphne_stilwell; - newscript->pQuestAccept = &QuestAccept_npc_daphne_stilwell; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_defias_traitor"; - newscript->GetAI = &GetAI_npc_defias_traitor; - newscript->pQuestAccept = &QuestAccept_npc_defias_traitor; - newscript->RegisterSelf(); + new npc_daphne_stilwell(); + new npc_defias_traitor(); } diff --git a/src/server/scripts/EasternKingdoms/wetlands.cpp b/src/server/scripts/EasternKingdoms/wetlands.cpp index 084b673dacd..bfac81a4ba0 100644 --- a/src/server/scripts/EasternKingdoms/wetlands.cpp +++ b/src/server/scripts/EasternKingdoms/wetlands.cpp @@ -44,111 +44,124 @@ enum eTapokeSlim NPC_SLIMS_FRIEND = 4971, NPC_TAPOKE_SLIM_JAHN = 4962 }; - -struct npc_tapoke_slim_jahnAI : public npc_escortAI + class npc_tapoke_slim_jahn : public CreatureScript { - npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_tapoke_slim_jahn() : CreatureScript("npc_tapoke_slim_jahn") { } - bool m_bFriendSummoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - m_bFriendSummoned = false; + return new npc_tapoke_slim_jahnAI(pCreature); } - void WaypointReached(uint32 uiPointId) + struct npc_tapoke_slim_jahnAI : public npc_escortAI { - switch(uiPointId) - { - case 2: - if (me->HasStealthAura()) - me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } - SetRun(); - me->setFaction(FACTION_ENEMY); - break; + bool m_bFriendSummoned; + + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + m_bFriendSummoned = false; } - } - void EnterCombat(Unit* /*pWho*/) - { - Player* pPlayer = GetPlayerForEscort(); - - if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer) + void WaypointReached(uint32 uiPointId) { - for (uint8 i = 0; i < 3; ++i) - DoCast(me, SPELL_CALL_FRIENDS, true); - - m_bFriendSummoned = true; - } - } - - void JustSummoned(Creature* pSummoned) - { - if (Player* pPlayer = GetPlayerForEscort()) - pSummoned->AI()->AttackStart(pPlayer); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (me->GetHealth()*100 < me->GetMaxHealth()*20) - { - if (Player* pPlayer = GetPlayerForEscort()) + switch(uiPointId) { - if (pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me); + case 2: + if (me->HasStealthAura()) + me->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); - uiDamage = 0; - - me->RestoreFaction(); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - - SetRun(false); + SetRun(); + me->setFaction(FACTION_ENEMY); + break; } } - } + + void EnterCombat(Unit* /*pWho*/) + { + Player* pPlayer = GetPlayerForEscort(); + + if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && pPlayer) + { + for (uint8 i = 0; i < 3; ++i) + DoCast(me, SPELL_CALL_FRIENDS, true); + + m_bFriendSummoned = true; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (Player* pPlayer = GetPlayerForEscort()) + pSummoned->AI()->AttackStart(pPlayer); + } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; + + if (me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) + { + if (me->GetHealth()*100 < me->GetMaxHealth()*20) + { + if (Player* pPlayer = GetPlayerForEscort()) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, me); + + uiDamage = 0; + + me->RestoreFaction(); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + + SetRun(false); + } + } + } + }; + }; -CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature) -{ - return new npc_tapoke_slim_jahnAI(pCreature); -} /*###### ## npc_mikhail ######*/ - -bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) + class npc_mikhail : public CreatureScript { - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) +public: + npc_mikhail() : CreatureScript("npc_mikhail") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) + { + Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); - if (!pSlim) - return false; + if (!pSlim) + return false; - if (!pSlim->HasStealthAura()) - pSlim->CastSpell(pSlim, SPELL_STEALTH, true); + if (!pSlim->HasStealthAura()) + pSlim->CastSpell(pSlim, SPELL_STEALTH, true); - if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + if (npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI, pSlim->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return false; } - return false; -} + +}; /*###### ## AddSC @@ -156,15 +169,6 @@ bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* void AddSC_wetlands() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_tapoke_slim_jahn"; - newscript->GetAI = &GetAI_npc_tapoke_slim_jahn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mikhail"; - newscript->pQuestAccept = &QuestAccept_npc_mikhail; - newscript->RegisterSelf(); + new npc_tapoke_slim_jahn(); + new npc_mikhail(); } diff --git a/src/server/scripts/Examples/example_escort.cpp b/src/server/scripts/Examples/example_escort.cpp index 2def7fa7770..50961744d3b 100644 --- a/src/server/scripts/Examples/example_escort.cpp +++ b/src/server/scripts/Examples/example_escort.cpp @@ -199,7 +199,7 @@ class example_escort : public CreatureScript bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { - npc_escortAI* pEscortAI = CAST_AI(example_escortAI, creature->AI()); + npc_escortAI* pEscortAI = CAST_AI(example_escort::example_escortAI, creature->AI()); switch(action) { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index f217661871c..ac3423dd882 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -31,221 +31,231 @@ enum eSpells #define GOSSIP_ITEM_MORRIDUNE "Please port me to Darnassus" const Position HomePosition = {-815.817,-145.299,-25.870, 0}; - -bool GoHello_blackfathom_altar(Player *pPlayer, GameObject* /*pGo*/) + class go_blackfathom_altar : public GameObjectScript { - if (!pPlayer->HasAura(SPELL_BLESSING_OF_BLACKFATHOM)) - pPlayer->AddAura(SPELL_BLESSING_OF_BLACKFATHOM,pPlayer); - return true; -} +public: + go_blackfathom_altar() : GameObjectScript("go_blackfathom_altar") { } -bool GoHello_blackfathom_fire(Player * /*pPlayer*/, GameObject* pGo) -{ - ScriptedInstance *pInstance = pGo->GetInstanceData(); - - if (pInstance) + bool OnGossipHello(Player *pPlayer, GameObject* /*pGo*/) { - pGo->SetGoState(GO_STATE_ACTIVE); - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pInstance->SetData(DATA_FIRE, pInstance->GetData(DATA_FIRE) + 1); + if (!pPlayer->HasAura(SPELL_BLESSING_OF_BLACKFATHOM)) + pPlayer->AddAura(SPELL_BLESSING_OF_BLACKFATHOM,pPlayer); return true; } - return false; -} -struct npc_blackfathom_deeps_eventAI : public ScriptedAI +}; + class go_blackfathom_fire : public GameObjectScript { - npc_blackfathom_deeps_eventAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + go_blackfathom_fire() : GameObjectScript("go_blackfathom_fire") { } + + bool OnGossipHello(Player * /*pPlayer*/, GameObject* pGo) { - if (pCreature->isSummon()) + InstanceScript *pInstance = pGo->GetInstanceScript(); + + if (pInstance) { - pCreature->SetHomePosition(HomePosition); - AttackPlayer(); + pGo->SetGoState(GO_STATE_ACTIVE); + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pInstance->SetData(DATA_FIRE, pInstance->GetData(DATA_FIRE) + 1); + return true; + } + return false; + } + +}; + class npc_blackfathom_deeps_event : public CreatureScript +{ +public: + npc_blackfathom_deeps_event() : CreatureScript("npc_blackfathom_deeps_event") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_blackfathom_deeps_eventAI (pCreature); + } + + struct npc_blackfathom_deeps_eventAI : public ScriptedAI + { + npc_blackfathom_deeps_eventAI(Creature* pCreature) : ScriptedAI(pCreature) + { + if (pCreature->isSummon()) + { + pCreature->SetHomePosition(HomePosition); + AttackPlayer(); + } + + pInstance = pCreature->GetInstanceScript(); } - pInstance = pCreature->GetInstanceData(); - } + InstanceScript* pInstance; - ScriptedInstance* pInstance; + uint32 uiRavageTimer; + uint32 uiFrostNovaTimer; + uint32 uiFrostBoltVolleyTimer; - uint32 uiRavageTimer; - uint32 uiFrostNovaTimer; - uint32 uiFrostBoltVolleyTimer; + bool bFlee; - bool bFlee; - - void Reset() - { - bFlee = false; - - uiRavageTimer = urand(5000,8000); - uiFrostNovaTimer = urand(9000,12000); - uiFrostBoltVolleyTimer = urand(2000,4000); - } - - void AttackPlayer() - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - - if (PlList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + void Reset() { - if (Player* pPlayer = i->getSource()) - { - if (pPlayer->isGameMaster()) - continue; + bFlee = false; - if (pPlayer->isAlive()) - { - me->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(me); - me->AddThreat(pPlayer, 0.0f); - } - } + uiRavageTimer = urand(5000,8000); + uiFrostNovaTimer = urand(9000,12000); + uiFrostBoltVolleyTimer = urand(2000,4000); } - } - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - switch (me->GetEntry()) + void AttackPlayer() { - case NPC_AKU_MAI_SNAPJAW: + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { - if (uiRavageTimer <= uiDiff) + if (Player* pPlayer = i->getSource()) { - DoCast(me->getVictim(), SPELL_RAVAGE); - uiRavageTimer = urand(9000,14000); - } else uiRavageTimer -= uiDiff; - break; - } - case NPC_MURKSHALLOW_SOFTSHELL: - case NPC_BARBED_CRUSTACEAN: - { - if (!bFlee && HealthBelowPct(15)) - { - bFlee = true; - me->DoFleeToGetAssistance(); - } - break; - } - case NPC_AKU_MAI_SERVANT: - { - if (uiFrostBoltVolleyTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) { - if (pTarget) - DoCast(pTarget, SPELL_FROST_BOLT_VOLLEY); + me->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(me); + me->AddThreat(pPlayer, 0.0f); } - uiFrostBoltVolleyTimer = urand(5000,8000); - } else uiFrostBoltVolleyTimer -= uiDiff; - if (uiFrostNovaTimer <= uiDiff) - { - DoCastAOE(SPELL_FROST_NOVA,false); - uiFrostNovaTimer = urand(25000,30000); - } else uiFrostNovaTimer -= uiDiff; - break; + } } } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + switch (me->GetEntry()) + { + case NPC_AKU_MAI_SNAPJAW: + { + if (uiRavageTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_RAVAGE); + uiRavageTimer = urand(9000,14000); + } else uiRavageTimer -= uiDiff; + break; + } + case NPC_MURKSHALLOW_SOFTSHELL: + case NPC_BARBED_CRUSTACEAN: + { + if (!bFlee && HealthBelowPct(15)) + { + bFlee = true; + me->DoFleeToGetAssistance(); + } + break; + } + case NPC_AKU_MAI_SERVANT: + { + if (uiFrostBoltVolleyTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget) + DoCast(pTarget, SPELL_FROST_BOLT_VOLLEY); + } + uiFrostBoltVolleyTimer = urand(5000,8000); + } else uiFrostBoltVolleyTimer -= uiDiff; + if (uiFrostNovaTimer <= uiDiff) + { + DoCastAOE(SPELL_FROST_NOVA,false); + uiFrostNovaTimer = urand(25000,30000); + } else uiFrostNovaTimer -= uiDiff; + break; + } + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (me->isSummon()) //we are not a normal spawn. + if (pInstance) + pInstance->SetData(DATA_EVENT, pInstance->GetData(DATA_EVENT) + 1); + } + }; - void JustDied(Unit* /*pKiller*/) - { - if (me->isSummon()) //we are not a normal spawn. - if (pInstance) - pInstance->SetData(DATA_EVENT, pInstance->GetData(DATA_EVENT) + 1); - } }; -CreatureAI* GetAI_npc_blackfathom_deeps_event(Creature* pCreature) -{ - return new npc_blackfathom_deeps_eventAI (pCreature); -} enum eMorridune { SAY_MORRIDUNE_1 = -1048003, SAY_MORRIDUNE_2 = -1048004 }; - -struct npc_morriduneAI : public npc_escortAI + class npc_morridune : public CreatureScript { - npc_morriduneAI(Creature* pCreature) : npc_escortAI(pCreature) - { - DoScriptText(SAY_MORRIDUNE_1,pCreature); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Start(false,false,NULL); - } +public: + npc_morridune() : CreatureScript("npc_morridune") { } - void WaypointReached(uint32 uiPoint) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - switch(uiPoint) + switch(uiAction) { - case 4: - SetEscortPaused(true); - me->SetOrientation(1.775791); - me->SendMovementFlagUpdate(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoScriptText(SAY_MORRIDUNE_2,me); + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->TeleportTo(1,9952.239,2284.277,1341.394,1.595); + pPlayer->CLOSE_GOSSIP_MENU(); break; } + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MORRIDUNE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_morriduneAI (pCreature); + } + + struct npc_morriduneAI : public npc_escortAI + { + npc_morriduneAI(Creature* pCreature) : npc_escortAI(pCreature) + { + DoScriptText(SAY_MORRIDUNE_1,pCreature); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + Start(false,false,NULL); + } + + void WaypointReached(uint32 uiPoint) + { + switch(uiPoint) + { + case 4: + SetEscortPaused(true); + me->SetOrientation(1.775791); + me->SendMovementFlagUpdate(); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoScriptText(SAY_MORRIDUNE_2,me); + break; + } + } + }; + }; -CreatureAI* GetAI_npc_morridune(Creature* pCreature) -{ - return new npc_morriduneAI (pCreature); -} -bool GossipHello_npc_morridune(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MORRIDUNE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_morridune(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->TeleportTo(1,9952.239,2284.277,1341.394,1.595); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - return true; -} void AddSC_blackfathom_deeps() { - Script *newscript; - newscript = new Script; - newscript->Name = "go_blackfathom_altar"; - newscript->pGOHello = &GoHello_blackfathom_altar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_blackfathom_fire"; - newscript->pGOHello = &GoHello_blackfathom_fire; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_blackfathom_deeps_event"; - newscript->GetAI = &GetAI_npc_blackfathom_deeps_event; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_morridune"; - newscript->GetAI = &GetAI_npc_morridune; - newscript->pGossipHello = &GossipHello_npc_morridune; - newscript->pGossipSelect = &GossipSelect_npc_morridune; - newscript->RegisterSelf(); + new go_blackfathom_altar(); + new go_blackfathom_fire(); + new npc_blackfathom_deeps_event(); + new npc_morridune(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 9037fe25ff3..522af3a7aee 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -23,71 +23,73 @@ enum Spells SPELL_POISON_CLOUD = 3815, SPELL_FRENZIED_RAGE = 3490 }; - -struct boss_aku_maiAI : public ScriptedAI + class boss_aku_mai : public CreatureScript { - boss_aku_maiAI(Creature *c) : ScriptedAI(c) +public: + boss_aku_mai() : CreatureScript("boss_aku_mai") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_aku_maiAI (pCreature); } - uint32 uiPoisonCloudTimer; - bool bIsEnraged; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_aku_maiAI : public ScriptedAI { - uiPoisonCloudTimer = urand(5000,9000); - bIsEnraged = false; - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiPoisonCloudTimer < diff) + boss_aku_maiAI(Creature *c) : ScriptedAI(c) { - DoCastVictim(SPELL_POISON_CLOUD); - uiPoisonCloudTimer = urand(25000,50000); - } else uiPoisonCloudTimer -= diff; - - if (!bIsEnraged && HealthBelowPct(30)) - { - DoCast(me,SPELL_FRENZIED_RAGE); - bIsEnraged = true; + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + uint32 uiPoisonCloudTimer; + bool bIsEnraged; + + InstanceScript *pInstance; + + void Reset() + { + uiPoisonCloudTimer = urand(5000,9000); + bIsEnraged = false; + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiPoisonCloudTimer < diff) + { + DoCastVictim(SPELL_POISON_CLOUD); + uiPoisonCloudTimer = urand(25000,50000); + } else uiPoisonCloudTimer -= diff; + + if (!bIsEnraged && HealthBelowPct(30)) + { + DoCast(me,SPELL_FRENZIED_RAGE); + bIsEnraged = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_aku_mai(Creature* pCreature) -{ - return new boss_aku_maiAI (pCreature); -} void AddSC_boss_aku_mai() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_aku_mai"; - newscript->GetAI = &GetAI_boss_aku_mai; - newscript->RegisterSelf(); + new boss_aku_mai(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 2525f949f89..d1a05f52ef6 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -22,63 +22,65 @@ enum Spells { SPELL_NET = 6533 }; - -struct boss_gelihastAI : public ScriptedAI + class boss_gelihast : public CreatureScript { - boss_gelihastAI(Creature *c) : ScriptedAI(c) +public: + boss_gelihast() : CreatureScript("boss_gelihast") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gelihastAI (pCreature); } - uint32 uiNetTimer; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_gelihastAI : public ScriptedAI { - uiNetTimer = urand(2000,4000); - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiNetTimer < diff) + boss_gelihastAI(Creature *c) : ScriptedAI(c) { - DoCastVictim(SPELL_NET); - uiNetTimer = urand(4000,7000); - } else uiNetTimer -= diff; + pInstance = c->GetInstanceScript(); + } + + uint32 uiNetTimer; + + InstanceScript *pInstance; + + void Reset() + { + uiNetTimer = urand(2000,4000); + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiNetTimer < diff) + { + DoCastVictim(SPELL_NET); + uiNetTimer = urand(4000,7000); + } else uiNetTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gelihast(Creature* pCreature) -{ - return new boss_gelihastAI (pCreature); -} void AddSC_boss_gelihast() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gelihast"; - newscript->GetAI = &GetAI_boss_gelihast; - newscript->RegisterSelf(); + new boss_gelihast(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index a8183971a98..28633137ddc 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -31,77 +31,79 @@ enum Yells SAY_SLEEP = -1048001, SAY_DEATH = -1048000 }; - -struct boss_kelrisAI : public ScriptedAI + class boss_kelris : public CreatureScript { - boss_kelrisAI(Creature *c) : ScriptedAI(c) +public: + boss_kelris() : CreatureScript("boss_kelris") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kelrisAI (pCreature); } - uint32 uiMindBlastTimer; - uint32 uiSleepTimer; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_kelrisAI : public ScriptedAI { - uiMindBlastTimer = urand(2000,5000); - uiSleepTimer = urand(9000,12000); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiMindBlastTimer < diff) + boss_kelrisAI(Creature *c) : ScriptedAI(c) { - DoCastVictim(SPELL_MIND_BLAST); - uiMindBlastTimer = urand(7000,9000); - } else uiMindBlastTimer -= diff; + pInstance = c->GetInstanceScript(); + } - if (uiSleepTimer < diff) + uint32 uiMindBlastTimer; + uint32 uiSleepTimer; + + InstanceScript *pInstance; + + void Reset() { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + uiMindBlastTimer = urand(2000,5000); + uiSleepTimer = urand(9000,12000); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiMindBlastTimer < diff) { - DoScriptText(SAY_SLEEP, me); - DoCast(pTarget, SPELL_SLEEP); - } - uiSleepTimer = urand(15000,20000); - } else uiSleepTimer -= diff; + DoCastVictim(SPELL_MIND_BLAST); + uiMindBlastTimer = urand(7000,9000); + } else uiMindBlastTimer -= diff; + + if (uiSleepTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_SLEEP, me); + DoCast(pTarget, SPELL_SLEEP); + } + uiSleepTimer = urand(15000,20000); + } else uiSleepTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kelris(Creature* pCreature) -{ - return new boss_kelrisAI (pCreature); -} void AddSC_boss_kelris() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_kelris"; - newscript->GetAI = &GetAI_boss_kelris; - newscript->RegisterSelf(); + new boss_kelris(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index 99ddd5cdd82..2d6e43ab707 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -50,212 +50,215 @@ const Position SpawnsLocation[] = {-862.193, -174.251, -25.871, 6.182}, {-863.895, -458.899, -33.891, 5.637} }; - -struct instance_blackfathom_deeps : public ScriptedInstance + class instance_blackfathom_deeps : public InstanceMapScript { - instance_blackfathom_deeps(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_blackfathom_deeps() : InstanceMapScript("instance_blackfathom_deeps") { } - uint64 m_uiTwilightLordKelrisGUID; - uint64 m_uiShrine1GUID; - uint64 m_uiShrine2GUID; - uint64 m_uiShrine3GUID; - uint64 m_uiShrine4GUID; - uint64 m_uiShrineOfGelihastGUID; - uint64 m_uiAltarOfTheDeepsGUID; - uint64 m_uiMainDoorGUID; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - uint8 m_uiCountFires; - uint8 uiDeathTimes; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiTwilightLordKelrisGUID = 0; - m_uiShrine1GUID = 0; - m_uiShrine2GUID = 0; - m_uiShrine3GUID = 0; - m_uiShrine4GUID = 0; - m_uiShrineOfGelihastGUID = 0; - m_uiAltarOfTheDeepsGUID = 0; - m_uiMainDoorGUID = 0; - m_uiCountFires = 0; - uiDeathTimes = 0; + return new instance_blackfathom_deeps_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_blackfathom_deeps_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_blackfathom_deeps_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 m_uiTwilightLordKelrisGUID; + uint64 m_uiShrine1GUID; + uint64 m_uiShrine2GUID; + uint64 m_uiShrine3GUID; + uint64 m_uiShrine4GUID; + uint64 m_uiShrineOfGelihastGUID; + uint64 m_uiAltarOfTheDeepsGUID; + uint64 m_uiMainDoorGUID; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 m_uiCountFires; + uint8 uiDeathTimes; + + void Initialize() { - case NPC_TWILIGHT_LORD_KELRIS: - m_uiTwilightLordKelrisGUID = pCreature->GetGUID(); - break; - case NPC_LORGUS_JETT: - pCreature->SetHomePosition(LorgusPosition[urand(0,3)]); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiTwilightLordKelrisGUID = 0; + m_uiShrine1GUID = 0; + m_uiShrine2GUID = 0; + m_uiShrine3GUID = 0; + m_uiShrine4GUID = 0; + m_uiShrineOfGelihastGUID = 0; + m_uiAltarOfTheDeepsGUID = 0; + m_uiMainDoorGUID = 0; + m_uiCountFires = 0; + uiDeathTimes = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_FIRE_OF_AKU_MAI_1: - m_uiShrine1GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_2: - m_uiShrine2GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_3: - m_uiShrine3GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_4: - m_uiShrine4GUID = pGo->GetGUID(); - break; - case GO_SHRINE_OF_GELIHAST: - m_uiShrineOfGelihastGUID = pGo->GetGUID(); - if (m_auiEncounter[0] != DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case GO_ALTAR_OF_THE_DEEPS: - m_uiAltarOfTheDeepsGUID = pGo->GetGUID(); - if (m_auiEncounter[3] != DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case GO_AKU_MAI_DOOR: - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL,true,pGo); - m_uiMainDoorGUID = pGo->GetGUID(); - break; + switch (pCreature->GetEntry()) + { + case NPC_TWILIGHT_LORD_KELRIS: + m_uiTwilightLordKelrisGUID = pCreature->GetGUID(); + break; + case NPC_LORGUS_JETT: + pCreature->SetHomePosition(LorgusPosition[urand(0,3)]); + break; + } } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case TYPE_GELIHAST: - m_auiEncounter[0] = uiData; - if (uiData == DONE) - if (GameObject *pGo = instance->GetGameObject(m_uiShrineOfGelihastGUID)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case TYPE_AKU_MAI: - m_auiEncounter[3] = uiData; - if (uiData == DONE) - if (GameObject *pGo = instance->GetGameObject(m_uiAltarOfTheDeepsGUID)) + switch(pGo->GetEntry()) + { + case GO_FIRE_OF_AKU_MAI_1: + m_uiShrine1GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_2: + m_uiShrine2GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_3: + m_uiShrine3GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_4: + m_uiShrine4GUID = pGo->GetGUID(); + break; + case GO_SHRINE_OF_GELIHAST: + m_uiShrineOfGelihastGUID = pGo->GetGUID(); + if (m_auiEncounter[0] != DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case GO_ALTAR_OF_THE_DEEPS: + m_uiAltarOfTheDeepsGUID = pGo->GetGUID(); + if (m_auiEncounter[3] != DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case GO_AKU_MAI_DOOR: + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL,true,pGo); + m_uiMainDoorGUID = pGo->GetGUID(); + break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_GELIHAST: + m_auiEncounter[0] = uiData; + if (uiData == DONE) + if (GameObject *pGo = instance->GetGameObject(m_uiShrineOfGelihastGUID)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case TYPE_AKU_MAI: + m_auiEncounter[3] = uiData; + if (uiData == DONE) + if (GameObject *pGo = instance->GetGameObject(m_uiAltarOfTheDeepsGUID)) + { + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGo->SummonCreature(NPC_MORRIDUNE,SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + case DATA_FIRE: + m_uiCountFires = uiData; + switch (m_uiCountFires) { - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGo->SummonCreature(NPC_MORRIDUNE,SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - case DATA_FIRE: - m_uiCountFires = uiData; - switch (m_uiCountFires) - { - case 1: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - case 2: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - for (uint8 i = 0; i < 2; ++i) + case 1: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) { - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); } - } - break; - case 3: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - case 4: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - } - break; - case DATA_EVENT: - uiDeathTimes = uiData; - if (uiDeathTimes == 18) - HandleGameObject(m_uiMainDoorGUID,true); - break; + break; + case 2: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + for (uint8 i = 0; i < 2; ++i) + { + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + } + break; + case 3: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + case 4: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + } + break; + case DATA_EVENT: + uiDeathTimes = uiData; + if (uiDeathTimes == 18) + HandleGameObject(m_uiMainDoorGUID,true); + break; + } } - } - uint32 GetData(uint32 uiType) - { - switch(uiType) + uint32 GetData(uint32 uiType) { - case TYPE_GELIHAST: - return m_auiEncounter[0]; - case TYPE_KELRIS: - return m_auiEncounter[1]; - case TYPE_SHRINE: - return m_auiEncounter[2]; - case TYPE_AKU_MAI: - return m_auiEncounter[3]; - case DATA_FIRE: - return m_uiCountFires; - case DATA_EVENT: - return uiDeathTimes; + switch(uiType) + { + case TYPE_GELIHAST: + return m_auiEncounter[0]; + case TYPE_KELRIS: + return m_auiEncounter[1]; + case TYPE_SHRINE: + return m_auiEncounter[2]; + case TYPE_AKU_MAI: + return m_auiEncounter[3]; + case DATA_FIRE: + return m_uiCountFires; + case DATA_EVENT: + return uiDeathTimes; + } + + return 0; } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint64 GetData64(uint32 uiData) { - case DATA_TWILIGHT_LORD_KELRIS: - return m_uiTwilightLordKelrisGUID; - case DATA_SHRINE1: - return m_uiShrine1GUID; - case DATA_SHRINE2: - return m_uiShrine2GUID; - case DATA_SHRINE3: - return m_uiShrine3GUID; - case DATA_SHRINE4: - return m_uiShrine4GUID; - case DATA_SHRINE_OF_GELIHAST: - return m_uiShrineOfGelihastGUID; - case DATA_MAINDOOR: - return m_uiMainDoorGUID; - } + switch(uiData) + { + case DATA_TWILIGHT_LORD_KELRIS: + return m_uiTwilightLordKelrisGUID; + case DATA_SHRINE1: + return m_uiShrine1GUID; + case DATA_SHRINE2: + return m_uiShrine2GUID; + case DATA_SHRINE3: + return m_uiShrine3GUID; + case DATA_SHRINE4: + return m_uiShrine4GUID; + case DATA_SHRINE_OF_GELIHAST: + return m_uiShrineOfGelihastGUID; + case DATA_MAINDOOR: + return m_uiMainDoorGUID; + } + + return 0; + } + }; - return 0; - } }; -InstanceData* GetInstanceData_instance_blackfathom_deeps(Map* pMap) -{ - return new instance_blackfathom_deeps(pMap); -} void AddSC_instance_blackfathom_deeps() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_blackfathom_deeps"; - newscript->GetInstanceData = &GetInstanceData_instance_blackfathom_deeps; - newscript->RegisterSelf(); + new instance_blackfathom_deeps(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index e70eefe62d5..9b94335dac3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -51,275 +51,281 @@ #define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!" #define SOUND_ONAGGRO 10977 - -struct boss_anetheronAI : public hyjal_trashAI + class boss_anetheron : public CreatureScript { - boss_anetheronAI(Creature *c) : hyjal_trashAI(c) +public: + boss_anetheron() : CreatureScript("boss_anetheron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP); - if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + return new boss_anetheronAI (pCreature); + } + + struct boss_anetheronAI : public hyjal_trashAI + { + boss_anetheronAI(Creature *c) : hyjal_trashAI(c) { - TempSpell->EffectImplicitTargetA[0] = 1; - TempSpell->EffectImplicitTargetB[0] = 0; - } - } - - uint32 SwarmTimer; - uint32 SleepTimer; - uint32 AuraTimer; - uint32 InfernoTimer; - bool pGo; - uint32 pos; - - void Reset() - { - damageTaken = 0; - SwarmTimer = 45000; - SleepTimer = 60000; - AuraTimer = 5000; - InfernoTimer = 45000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); - } - - void KilledUnit(Unit * /*victim*/) - { - switch (urand(0,2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); - break; - } - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } - } - - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); - } - - void UpdateAI(const uint32 diff) - { - if (IsEvent) - { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP); + if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) { - pGo = true; - if (pInstance) + TempSpell->EffectImplicitTargetA[0] = 1; + TempSpell->EffectImplicitTargetB[0] = 0; + } + } + + uint32 SwarmTimer; + uint32 SleepTimer; + uint32 AuraTimer; + uint32 InfernoTimer; + bool pGo; + uint32 pos; + + void Reset() + { + damageTaken = 0; + SwarmTimer = 45000; + SleepTimer = 60000; + AuraTimer = 5000; + InfernoTimer = 45000; + + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + } + + void KilledUnit(Unit * /*victim*/) + { + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); + break; + } + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + + void JustDied(Unit *victim) + { + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); + } + + void UpdateAI(const uint32 diff) + { + if (IsEvent) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) { - AddWaypoint(0, 4896.08, -1576.35, 1333.65); - AddWaypoint(1, 4898.68, -1615.02, 1329.48); - AddWaypoint(2, 4907.12, -1667.08, 1321.00); - AddWaypoint(3, 4963.18, -1699.35, 1340.51); - AddWaypoint(4, 4989.16, -1716.67, 1335.74); - AddWaypoint(5, 5026.27, -1736.89, 1323.02); - AddWaypoint(6, 5037.77, -1770.56, 1324.36); - AddWaypoint(7, 5067.23, -1789.95, 1321.17); - Start(false, true); - SetDespawnAtEnd(false); + pGo = true; + if (pInstance) + { + AddWaypoint(0, 4896.08, -1576.35, 1333.65); + AddWaypoint(1, 4898.68, -1615.02, 1329.48); + AddWaypoint(2, 4907.12, -1667.08, 1321.00); + AddWaypoint(3, 4963.18, -1699.35, 1340.51); + AddWaypoint(4, 4989.16, -1716.67, 1335.74); + AddWaypoint(5, 5026.27, -1736.89, 1323.02); + AddWaypoint(6, 5037.77, -1770.56, 1324.36); + AddWaypoint(7, 5067.23, -1789.95, 1321.17); + Start(false, true); + SetDespawnAtEnd(false); + } } } - } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (SwarmTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CARRION_SWARM); - - SwarmTimer = urand(45000,60000); - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_SWARM1); - me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_SWARM2); - me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); - break; - } - } else SwarmTimer -= diff; - - if (SleepTimer <= diff) - { - for (uint8 i = 0; i < 3; ++i) + if (SwarmTimer <= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - pTarget->CastSpell(pTarget,SPELL_SLEEP,true); - } - SleepTimer = 60000; - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_SLEEP1); - me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_SLEEP2); - me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); - break; - } - } else SleepTimer -= diff; - if (AuraTimer <= diff) - { - DoCast(me, SPELL_VAMPIRIC_AURA, true); - AuraTimer = urand(10000,20000); - } else AuraTimer -= diff; - if (InfernoTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); - InfernoTimer = 45000; - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_INFERNO1); - me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_INFERNO2); - me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); - break; - } - } else InfernoTimer -= diff; + DoCast(pTarget, SPELL_CARRION_SWARM); + + SwarmTimer = urand(45000,60000); + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_SWARM1); + me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_SWARM2); + me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); + break; + } + } else SwarmTimer -= diff; + + if (SleepTimer <= diff) + { + for (uint8 i = 0; i < 3; ++i) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + pTarget->CastSpell(pTarget,SPELL_SLEEP,true); + } + SleepTimer = 60000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_SLEEP1); + me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_SLEEP2); + me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); + break; + } + } else SleepTimer -= diff; + if (AuraTimer <= diff) + { + DoCast(me, SPELL_VAMPIRIC_AURA, true); + AuraTimer = urand(10000,20000); + } else AuraTimer -= diff; + if (InfernoTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); + InfernoTimer = 45000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_INFERNO1); + me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_INFERNO2); + me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); + break; + } + } else InfernoTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anetheron(Creature* pCreature) -{ - return new boss_anetheronAI (pCreature); -} #define SPELL_IMMOLATION 31303 #define SPELL_INFERNO_EFFECT 31302 - -struct mob_towering_infernalAI : public ScriptedAI + class mob_towering_infernal : public CreatureScript { - mob_towering_infernalAI(Creature *c) : ScriptedAI(c) +public: + mob_towering_infernal() : CreatureScript("mob_towering_infernal") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - if (pInstance) - AnetheronGUID = pInstance->GetData64(DATA_ANETHERON); + return new mob_towering_infernalAI (pCreature); } - uint32 ImmolationTimer; - uint32 CheckTimer; - uint64 AnetheronGUID; - ScriptedInstance* pInstance; - - void Reset() + struct mob_towering_infernalAI : public ScriptedAI { - DoCast(me, SPELL_INFERNO_EFFECT); - ImmolationTimer = 5000; - CheckTimer = 5000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void KilledUnit(Unit * /*victim*/) - { - } - - void JustDied(Unit * /*victim*/) - { - } - - void MoveInLineOfSight(Unit *who) - { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) - AttackStart(who); - } - - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + mob_towering_infernalAI(Creature *c) : ScriptedAI(c) { - if (AnetheronGUID) - { - Creature* boss = Unit::GetCreature((*me),AnetheronGUID); - if (!boss || (boss && boss->isDead())) - { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - return; - } - } - CheckTimer = 5000; - } else CheckTimer -= diff; + pInstance = c->GetInstanceScript(); + if (pInstance) + AnetheronGUID = pInstance->GetData64(DATA_ANETHERON); + } - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ImmolationTimer; + uint32 CheckTimer; + uint64 AnetheronGUID; + InstanceScript* pInstance; - if (ImmolationTimer <= diff) + void Reset() { - DoCast(me, SPELL_IMMOLATION); + DoCast(me, SPELL_INFERNO_EFFECT); ImmolationTimer = 5000; - } else ImmolationTimer -= diff; + CheckTimer = 5000; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void KilledUnit(Unit * /*victim*/) + { + } + + void JustDied(Unit * /*victim*/) + { + } + + void MoveInLineOfSight(Unit *who) + { + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + AttackStart(who); + } + + void UpdateAI(const uint32 diff) + { + if (CheckTimer <= diff) + { + if (AnetheronGUID) + { + Creature* boss = Unit::GetCreature((*me),AnetheronGUID); + if (!boss || (boss && boss->isDead())) + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + return; + } + } + CheckTimer = 5000; + } else CheckTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (ImmolationTimer <= diff) + { + DoCast(me, SPELL_IMMOLATION); + ImmolationTimer = 5000; + } else ImmolationTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_towering_infernal(Creature* pCreature) -{ - return new mob_towering_infernalAI (pCreature); -} void AddSC_boss_anetheron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anetheron"; - newscript->GetAI = &GetAI_boss_anetheron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_towering_infernal"; - newscript->GetAI = &GetAI_mob_towering_infernal; - newscript->RegisterSelf(); + new boss_anetheron(); + new mob_towering_infernal(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 04a838d9adb..1d422b1aa3f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -73,108 +73,141 @@ EndScriptData */ #define NORDRASSIL_X 5503.713 #define NORDRASSIL_Y -3523.436 #define NORDRASSIL_Z 1608.781 - -struct mob_ancient_wispAI : public ScriptedAI + class mob_ancient_wisp : public CreatureScript { - mob_ancient_wispAI(Creature* c) : ScriptedAI(c) +public: + mob_ancient_wisp() : CreatureScript("mob_ancient_wisp") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - ArchimondeGUID = 0; + return new mob_ancient_wispAI(pCreature); } - ScriptedInstance* pInstance; - uint64 ArchimondeGUID; - uint32 CheckTimer; - - void Reset() + struct mob_ancient_wispAI : public ScriptedAI { - CheckTimer = 1000; - - if (pInstance) - ArchimondeGUID = pInstance->GetData64(DATA_ARCHIMONDE); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void EnterCombat(Unit* /*who*/) {} - - void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } - - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + mob_ancient_wispAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + ArchimondeGUID = 0; + } + + InstanceScript* pInstance; + uint64 ArchimondeGUID; + uint32 CheckTimer; + + void Reset() { - if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID)) - { - if ((((Archimonde->GetHealth()*100) / Archimonde->GetMaxHealth()) < 2) || !Archimonde->isAlive()) - DoCast(me, SPELL_DENOUEMENT_WISP); - else - DoCast(Archimonde, SPELL_ANCIENT_SPARK); - } CheckTimer = 1000; - } else CheckTimer -= diff; - } + + if (pInstance) + ArchimondeGUID = pInstance->GetData64(DATA_ARCHIMONDE); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void EnterCombat(Unit* /*who*/) {} + + void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } + + void UpdateAI(const uint32 diff) + { + if (CheckTimer <= diff) + { + if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID)) + { + if ((((Archimonde->GetHealth()*100) / Archimonde->GetMaxHealth()) < 2) || !Archimonde->isAlive()) + DoCast(me, SPELL_DENOUEMENT_WISP); + else + DoCast(Archimonde, SPELL_ANCIENT_SPARK); + } + CheckTimer = 1000; + } else CheckTimer -= diff; + } + }; + }; /* This script is merely a placeholder for the Doomfire that triggers Doomfire spell. It will - MoveChase the Doomfire Spirit always, until despawn (AttackStart is called upon it's spawn) */ -struct mob_doomfireAI : public ScriptedAI + MoveChase the Doomfire Spirit always, until despawn (AttackStart is called upon it's spawn) */ class mob_doomfire : public CreatureScript { - mob_doomfireAI(Creature* c) : ScriptedAI(c) {} +public: + mob_doomfire() : CreatureScript("mob_doomfire") { } - void Reset() { } + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_doomfireAI(pCreature); + } + + struct mob_doomfireAI : public ScriptedAI + { + mob_doomfireAI(Creature* c) : ScriptedAI(c) {} + + void Reset() { } + + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } + }; - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit* /*who*/) {} - void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } }; /* This is the script for the Doomfire Spirit Mob. This mob simply follow players or - travels in random directions if pTarget cannot be found. */ -struct mob_doomfire_targettingAI : public ScriptedAI + travels in random directions if pTarget cannot be found. */ class mob_doomfire_targetting : public CreatureScript { - mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} +public: + mob_doomfire_targetting() : CreatureScript("mob_doomfire_targetting") { } - uint64 TargetGUID; - uint32 ChangeTargetTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - TargetGUID = 0; - ChangeTargetTimer = 5000; + return new mob_doomfire_targettingAI(pCreature); } - void MoveInLineOfSight(Unit* who) + struct mob_doomfire_targettingAI : public ScriptedAI { - //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 - //when UpdateAI needs it, it will be forced to select randomPoint - if (!TargetGUID && who->GetTypeId() == TYPEID_PLAYER) - TargetGUID = who->GetGUID(); - } + mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} - void EnterCombat(Unit* /*who*/) {} + uint64 TargetGUID; + uint32 ChangeTargetTimer; - void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } - - void UpdateAI(const uint32 diff) - { - if (ChangeTargetTimer <= diff) + void Reset() { - if (Unit *temp = Unit::GetUnit(*me,TargetGUID)) - { - me->GetMotionMaster()->MoveFollow(temp,0.0f,0.0f); - TargetGUID = 0; - } - else - { - Position pos; - me->GetRandomNearPosition(pos, 40); - me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - } - + TargetGUID = 0; ChangeTargetTimer = 5000; - } else ChangeTargetTimer -= diff; - } + } + + void MoveInLineOfSight(Unit* who) + { + //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 + //when UpdateAI needs it, it will be forced to select randomPoint + if (!TargetGUID && who->GetTypeId() == TYPEID_PLAYER) + TargetGUID = who->GetGUID(); + } + + void EnterCombat(Unit* /*who*/) {} + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } + + void UpdateAI(const uint32 diff) + { + if (ChangeTargetTimer <= diff) + { + if (Unit *temp = Unit::GetUnit(*me,TargetGUID)) + { + me->GetMotionMaster()->MoveFollow(temp,0.0f,0.0f); + TargetGUID = 0; + } + else + { + Position pos; + me->GetRandomNearPosition(pos, 40); + me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); + } + + ChangeTargetTimer = 5000; + } else ChangeTargetTimer -= diff; + } + }; + }; /* Finally, Archimonde's script. His script isn't extremely complex, most are simply spells on timers. @@ -184,454 +217,433 @@ struct mob_doomfire_targettingAI : public ScriptedAI is NOT the main tank (creature's victim), then we aggro that player and they become the new victim. For Doomfire, we summon a mob (Doomfire Spirit) for the Doomfire mob to follow. It's spirit will randomly select it's pTarget to follow and then we create the random movement making it unpredictable. */ - -struct boss_archimondeAI : public hyjal_trashAI + class boss_archimonde : public CreatureScript { - boss_archimondeAI(Creature *c) : hyjal_trashAI(c) +public: + boss_archimonde() : CreatureScript("boss_archimonde") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_archimondeAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 DoomfireSpiritGUID; - uint64 WorldTreeGUID; - - uint32 DrainNordrassilTimer; - uint32 FearTimer; - uint32 AirBurstTimer; - uint32 GripOfTheLegionTimer; - uint32 DoomfireTimer; - uint32 SoulChargeTimer; - uint32 SoulChargeCount; - uint32 MeleeRangeCheckTimer; - uint32 HandOfDeathTimer; - uint32 SummonWispTimer; - uint32 WispCount; - uint32 EnrageTimer; - uint32 CheckDistanceTimer; - - bool Enraged; - bool BelowTenPercent; - bool HasProtected; - bool IsChanneling; - - void Reset() + struct boss_archimondeAI : public hyjal_trashAI { - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - - DoomfireSpiritGUID = 0; - damageTaken = 0; - WorldTreeGUID = 0; - - DrainNordrassilTimer = 0; - FearTimer = 42000; - AirBurstTimer = 30000; - GripOfTheLegionTimer = urand(5000,25000); - DoomfireTimer = 20000; - SoulChargeTimer = urand(2000,30000); - SoulChargeCount = 0; - MeleeRangeCheckTimer = 15000; - HandOfDeathTimer = 2000; - WispCount = 0; // When ~30 wisps are summoned, Archimonde dies - EnrageTimer = 600000; // 10 minutes - CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage - SummonWispTimer = 0; - - Enraged = false; - BelowTenPercent = false; - HasProtected = false; - IsChanneling = false; - } - - void EnterCombat(Unit * /*who*/) - { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * victim) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - - if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) - GainSoulCharge(CAST_PLR(victim)); - } - - void GainSoulCharge(Player* victim) - { - switch(victim->getClass()) + boss_archimondeAI(Creature *c) : hyjal_trashAI(c) { - case CLASS_PRIEST: - case CLASS_PALADIN: - case CLASS_WARLOCK: - victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); - break; - case CLASS_MAGE: - case CLASS_ROGUE: - case CLASS_WARRIOR: - victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); - break; - case CLASS_DRUID: - case CLASS_SHAMAN: - case CLASS_HUNTER: - victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); - break; + pInstance = c->GetInstanceScript(); } - SoulChargeTimer = urand(2000,30000); - ++SoulChargeCount; - } + InstanceScript* pInstance; - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - DoScriptText(SAY_DEATH, me); + uint64 DoomfireSpiritGUID; + uint64 WorldTreeGUID; - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); - } + uint32 DrainNordrassilTimer; + uint32 FearTimer; + uint32 AirBurstTimer; + uint32 GripOfTheLegionTimer; + uint32 DoomfireTimer; + uint32 SoulChargeTimer; + uint32 SoulChargeCount; + uint32 MeleeRangeCheckTimer; + uint32 HandOfDeathTimer; + uint32 SummonWispTimer; + uint32 WispCount; + uint32 EnrageTimer; + uint32 CheckDistanceTimer; - bool CanUseFingerOfDeath() - { - // First we check if our current victim is in melee range or not. - Unit* victim = me->getVictim(); - if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim))) - return false; + bool Enraged; + bool BelowTenPercent; + bool HasProtected; + bool IsChanneling; - std::list& m_threatlist = me->getThreatManager().getThreatList(); - if (m_threatlist.empty()) - return false; - - std::list targets; - std::list::const_iterator itr = m_threatlist.begin(); - for (; itr != m_threatlist.end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - targets.push_back(pUnit); - } - - if (targets.empty()) - return false; - - targets.sort(Trinity::ObjectDistanceOrderPred(me)); - Unit *pTarget = targets.front(); - if (pTarget) - { - if (!me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) - return true; // Cast Finger of Death - else // This target is closest, he is our new tank - me->AddThreat(pTarget, me->getThreatManager().getThreat(me->getVictim())); - } - - return false; - } - - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) - summoned->AI()->AttackStart(me); - else - { - summoned->setFaction(me->getFaction()); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) - { - DoomfireSpiritGUID = summoned->GetGUID(); - } - - if (summoned->GetEntry() == CREATURE_DOOMFIRE) - { - summoned->CastSpell(summoned,SPELL_DOOMFIRE_SPAWN,false); - summoned->CastSpell(summoned,SPELL_DOOMFIRE,true,0,0,me->GetGUID()); - - if (Unit *DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID)) - { - summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit,0.0f,0.0f); - DoomfireSpiritGUID = 0; - } - } - } - - //this is code doing close to what the summoning spell would do (spell 31903) - void SummonDoomfire(Unit *pTarget) - { - me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, - pTarget->GetPositionX()+15.0,pTarget->GetPositionY()+15.0,pTarget->GetPositionZ(),0, - TEMPSUMMON_TIMED_DESPAWN, 27000); - - me->SummonCreature(CREATURE_DOOMFIRE, - pTarget->GetPositionX()-15.0,pTarget->GetPositionY()-15.0,pTarget->GetPositionZ(),0, - TEMPSUMMON_TIMED_DESPAWN, 27000); - } - - void UnleashSoulCharge() - { - me->InterruptNonMeleeSpells(false); - - bool HasCast = false; - uint32 chargeSpell = 0; - uint32 unleashSpell = 0; - - switch (urand(0,2)) - { - case 0: - chargeSpell = SPELL_SOUL_CHARGE_RED; - unleashSpell = SPELL_UNLEASH_SOUL_RED; - break; - case 1: - chargeSpell = SPELL_SOUL_CHARGE_YELLOW; - unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; - break; - case 2: - chargeSpell = SPELL_SOUL_CHARGE_GREEN; - unleashSpell = SPELL_UNLEASH_SOUL_GREEN; - break; - } - - if (me->HasAura(chargeSpell)) - { - me->RemoveAuraFromStack(chargeSpell); - DoCast(me->getVictim(), unleashSpell); - HasCast = true; - SoulChargeCount--; - } - - if (HasCast) - SoulChargeTimer = urand(2000,30000); - } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) + void Reset() { if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); + + DoomfireSpiritGUID = 0; + damageTaken = 0; + WorldTreeGUID = 0; + + DrainNordrassilTimer = 0; + FearTimer = 42000; + AirBurstTimer = 30000; + GripOfTheLegionTimer = urand(5000,25000); + DoomfireTimer = 20000; + SoulChargeTimer = urand(2000,30000); + SoulChargeCount = 0; + MeleeRangeCheckTimer = 15000; + HandOfDeathTimer = 2000; + WispCount = 0; // When ~30 wisps are summoned, Archimonde dies + EnrageTimer = 600000; // 10 minutes + CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage + SummonWispTimer = 0; + + Enraged = false; + BelowTenPercent = false; + HasProtected = false; + IsChanneling = false; + } + + void EnterCombat(Unit * /*who*/) + { + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + + if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); + } + + void KilledUnit(Unit * victim) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + + if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) + GainSoulCharge(CAST_PLR(victim)); + } + + void GainSoulCharge(Player* victim) + { + switch(victim->getClass()) { - // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. - if ((pInstance->GetData(DATA_AZGALOREVENT) < DONE) && ((me->GetVisibility() != VISIBILITY_OFF) || (me->getFaction() != 35))) - { - me->SetVisibility(VISIBILITY_OFF); - me->setFaction(35); - } - else if ((pInstance->GetData(DATA_AZGALOREVENT) >= DONE) && ((me->GetVisibility() != VISIBILITY_ON) || (me->getFaction() == 35))) - { - me->setFaction(1720); - me->SetVisibility(VISIBILITY_ON); - } + case CLASS_PRIEST: + case CLASS_PALADIN: + case CLASS_WARLOCK: + victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); + break; + case CLASS_MAGE: + case CLASS_ROGUE: + case CLASS_WARRIOR: + victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); + break; + case CLASS_DRUID: + case CLASS_SHAMAN: + case CLASS_HUNTER: + victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); + break; } - if (DrainNordrassilTimer <= diff) + SoulChargeTimer = urand(2000,30000); + ++SoulChargeCount; + } + + void JustDied(Unit *victim) + { + hyjal_trashAI::JustDied(victim); + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); + } + + bool CanUseFingerOfDeath() + { + // First we check if our current victim is in melee range or not. + Unit* victim = me->getVictim(); + if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim))) + return false; + + std::list& m_threatlist = me->getThreatManager().getThreatList(); + if (m_threatlist.empty()) + return false; + + std::list targets; + std::list::const_iterator itr = m_threatlist.begin(); + for (; itr != m_threatlist.end(); ++itr) { - if (!IsChanneling) + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) + targets.push_back(pUnit); + } + + if (targets.empty()) + return false; + + targets.sort(Trinity::ObjectDistanceOrderPred(me)); + Unit *pTarget = targets.front(); + if (pTarget) + { + if (!me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) + return true; // Cast Finger of Death + else // This target is closest, he is our new tank + me->AddThreat(pTarget, me->getThreatManager().getThreat(me->getVictim())); + } + + return false; + } + + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) + summoned->AI()->AttackStart(me); + else + { + summoned->setFaction(me->getFaction()); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) + { + DoomfireSpiritGUID = summoned->GetGUID(); + } + + if (summoned->GetEntry() == CREATURE_DOOMFIRE) + { + summoned->CastSpell(summoned,SPELL_DOOMFIRE_SPAWN,false); + summoned->CastSpell(summoned,SPELL_DOOMFIRE,true,0,0,me->GetGUID()); + + if (Unit *DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID)) { - Creature *temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); + summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit,0.0f,0.0f); + DoomfireSpiritGUID = 0; + } + } + } - if (temp) - WorldTreeGUID = temp->GetGUID(); + //this is code doing close to what the summoning spell would do (spell 31903) + void SummonDoomfire(Unit *pTarget) + { + me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, + pTarget->GetPositionX()+15.0,pTarget->GetPositionY()+15.0,pTarget->GetPositionZ(),0, + TEMPSUMMON_TIMED_DESPAWN, 27000); - if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + me->SummonCreature(CREATURE_DOOMFIRE, + pTarget->GetPositionX()-15.0,pTarget->GetPositionY()-15.0,pTarget->GetPositionZ(),0, + TEMPSUMMON_TIMED_DESPAWN, 27000); + } + + void UnleashSoulCharge() + { + me->InterruptNonMeleeSpells(false); + + bool HasCast = false; + uint32 chargeSpell = 0; + uint32 unleashSpell = 0; + + switch (urand(0,2)) + { + case 0: + chargeSpell = SPELL_SOUL_CHARGE_RED; + unleashSpell = SPELL_UNLEASH_SOUL_RED; + break; + case 1: + chargeSpell = SPELL_SOUL_CHARGE_YELLOW; + unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; + break; + case 2: + chargeSpell = SPELL_SOUL_CHARGE_GREEN; + unleashSpell = SPELL_UNLEASH_SOUL_GREEN; + break; + } + + if (me->HasAura(chargeSpell)) + { + me->RemoveAuraFromStack(chargeSpell); + DoCast(me->getVictim(), unleashSpell); + HasCast = true; + SoulChargeCount--; + } + + if (HasCast) + SoulChargeTimer = urand(2000,30000); + } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) + { + if (pInstance) + { + // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. + if ((pInstance->GetData(DATA_AZGALOREVENT) < DONE) && ((me->GetVisibility() != VISIBILITY_OFF) || (me->getFaction() != 35))) { - Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Nordrassil->SetDisplayId(11686); - DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); - IsChanneling = true; + me->SetVisibility(VISIBILITY_OFF); + me->setFaction(35); + } + else if ((pInstance->GetData(DATA_AZGALOREVENT) >= DONE) && ((me->GetVisibility() != VISIBILITY_ON) || (me->getFaction() == 35))) + { + me->setFaction(1720); + me->SetVisibility(VISIBILITY_ON); } } - if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + if (DrainNordrassilTimer <= diff) { - Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); - DrainNordrassilTimer = 1000; - } - } else DrainNordrassilTimer -= diff; - } + if (!IsChanneling) + { + Creature *temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); - if (!UpdateVictim()) - return; + if (temp) + WorldTreeGUID = temp->GetGUID(); - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged) - BelowTenPercent = true; + if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + { + Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Nordrassil->SetDisplayId(11686); + DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); + IsChanneling = true; + } + } - if (!Enraged) - { - if (EnrageTimer <= diff) + if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + { + Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); + DrainNordrassilTimer = 1000; + } + } else DrainNordrassilTimer -= diff; + } + + if (!UpdateVictim()) + return; + + if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged) + BelowTenPercent = true; + + if (!Enraged) { - if ((me->GetHealth()*100 / me->GetMaxHealth()) > 10) + if (EnrageTimer <= diff) { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - Enraged = true; - DoScriptText(SAY_ENRAGE, me); - } - } else EnrageTimer -= diff; - - if (CheckDistanceTimer <= diff) - { - // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature - Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); - if (Check) - { - Check->SetVisibility(VISIBILITY_OFF); - - if (me->IsWithinDistInMap(Check, 75)) + if ((me->GetHealth()*100 / me->GetMaxHealth()) > 10) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; DoScriptText(SAY_ENRAGE, me); } + } else EnrageTimer -= diff; + + if (CheckDistanceTimer <= diff) + { + // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature + Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); + if (Check) + { + Check->SetVisibility(VISIBILITY_OFF); + + if (me->IsWithinDistInMap(Check, 75)) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + Enraged = true; + DoScriptText(SAY_ENRAGE, me); + } + } + CheckDistanceTimer = 5000; + } else CheckDistanceTimer -= diff; + } + + if (BelowTenPercent) + { + if (!HasProtected) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + + //all members of raid must get this buff + DoCast(me->getVictim(), SPELL_PROTECTION_OF_ELUNE); + HasProtected = true; + Enraged = true; } - CheckDistanceTimer = 5000; - } else CheckDistanceTimer -= diff; - } - if (BelowTenPercent) - { - if (!HasProtected) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); + if (SummonWispTimer <= diff) + { + DoSpawnCreature(CREATURE_ANCIENT_WISP, rand()%40, rand()%40, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + SummonWispTimer = 1500; + ++WispCount; + } else SummonWispTimer -= diff; - //all members of raid must get this buff - DoCast(me->getVictim(), SPELL_PROTECTION_OF_ELUNE); - HasProtected = true; - Enraged = true; + if (WispCount >= 30) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - if (SummonWispTimer <= diff) + if (Enraged) { - DoSpawnCreature(CREATURE_ANCIENT_WISP, rand()%40, rand()%40, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - SummonWispTimer = 1500; - ++WispCount; - } else SummonWispTimer -= diff; - - if (WispCount >= 30) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - - if (Enraged) - { - if (HandOfDeathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HAND_OF_DEATH); - HandOfDeathTimer = 2000; - } else HandOfDeathTimer -= diff; - return; // Don't do anything after this point. - } - - if (SoulChargeCount) - { - if (SoulChargeTimer <= diff) - UnleashSoulCharge(); - else SoulChargeTimer -= diff; - } - - if (GripOfTheLegionTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); - GripOfTheLegionTimer = urand(5000,25000); - } else GripOfTheLegionTimer -= diff; - - if (AirBurstTimer <= diff) - { - if (urand(0,1)) - DoScriptText(SAY_AIR_BURST1, me); - else - DoScriptText(SAY_AIR_BURST2, me); - - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank - AirBurstTimer = urand(25000,40000); - } else AirBurstTimer -= diff; - - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); - FearTimer = 42000; - } else FearTimer -= diff; - - if (DoomfireTimer <= diff) - { - if (urand(0,1)) - DoScriptText(SAY_DOOMFIRE1, me); - else - DoScriptText(SAY_DOOMFIRE2, me); - - Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!temp) - temp = me->getVictim(); - - //replace with spell cast 31903 once implicitTarget 73 implemented - SummonDoomfire(temp); - - //supposedly three doomfire can be up at the same time - DoomfireTimer = 20000; - } else DoomfireTimer -= diff; - - if (MeleeRangeCheckTimer <= diff) - { - if (CanUseFingerOfDeath()) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); - MeleeRangeCheckTimer = 1000; + if (HandOfDeathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAND_OF_DEATH); + HandOfDeathTimer = 2000; + } else HandOfDeathTimer -= diff; + return; // Don't do anything after this point. } - MeleeRangeCheckTimer = 5000; - } else MeleeRangeCheckTimer -= diff; + if (SoulChargeCount) + { + if (SoulChargeTimer <= diff) + UnleashSoulCharge(); + else SoulChargeTimer -= diff; + } + + if (GripOfTheLegionTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); + GripOfTheLegionTimer = urand(5000,25000); + } else GripOfTheLegionTimer -= diff; + + if (AirBurstTimer <= diff) + { + if (urand(0,1)) + DoScriptText(SAY_AIR_BURST1, me); + else + DoScriptText(SAY_AIR_BURST2, me); + + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank + AirBurstTimer = urand(25000,40000); + } else AirBurstTimer -= diff; + + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + FearTimer = 42000; + } else FearTimer -= diff; + + if (DoomfireTimer <= diff) + { + if (urand(0,1)) + DoScriptText(SAY_DOOMFIRE1, me); + else + DoScriptText(SAY_DOOMFIRE2, me); + + Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!temp) + temp = me->getVictim(); + + //replace with spell cast 31903 once implicitTarget 73 implemented + SummonDoomfire(temp); + + //supposedly three doomfire can be up at the same time + DoomfireTimer = 20000; + } else DoomfireTimer -= diff; + + if (MeleeRangeCheckTimer <= diff) + { + if (CanUseFingerOfDeath()) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); + MeleeRangeCheckTimer = 1000; + } + + MeleeRangeCheckTimer = 5000; + } else MeleeRangeCheckTimer -= diff; + + DoMeleeAttackIfReady(); + } + void WaypointReached(uint32 /*i*/){} + }; - DoMeleeAttackIfReady(); - } - void WaypointReached(uint32 /*i*/){} }; -CreatureAI* GetAI_boss_archimonde(Creature* pCreature) -{ - return new boss_archimondeAI (pCreature); -} -CreatureAI* GetAI_mob_doomfire(Creature* pCreature) -{ - return new mob_doomfireAI(pCreature); -} -CreatureAI* GetAI_mob_doomfire_targetting(Creature* pCreature) -{ - return new mob_doomfire_targettingAI(pCreature); -} -CreatureAI* GetAI_mob_ancient_wisp(Creature* pCreature) -{ - return new mob_ancient_wispAI(pCreature); -} void AddSC_boss_archimonde() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_archimonde"; - newscript->GetAI = &GetAI_boss_archimonde; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_doomfire"; - newscript->GetAI = &GetAI_mob_doomfire; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_doomfire_targetting"; - newscript->GetAI = &GetAI_mob_doomfire_targetting; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ancient_wisp"; - newscript->GetAI = &GetAI_mob_ancient_wisp; - newscript->RegisterSelf(); + new boss_archimonde(); + new mob_doomfire(); + new mob_doomfire_targetting(); + new mob_ancient_wisp(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 50b86c7fa30..39ab6f2e886 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -42,260 +42,266 @@ #define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!" #define SOUND_ONAGGRO 10999 - -struct boss_azgalorAI : public hyjal_trashAI + class boss_azgalor : public CreatureScript { - boss_azgalorAI(Creature *c) : hyjal_trashAI(c) +public: + boss_azgalor() : CreatureScript("boss_azgalor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR); - if (TempSpell) - TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?! + return new boss_azgalorAI (pCreature); } - uint32 RainTimer; - uint32 DoomTimer; - uint32 HowlTimer; - uint32 CleaveTimer; - uint32 EnrageTimer; - bool enraged; - - bool pGo; - uint32 pos; - - void Reset() + struct boss_azgalorAI : public hyjal_trashAI { - damageTaken = 0; - RainTimer = 20000; - DoomTimer = 50000; - HowlTimer = 30000; - CleaveTimer = 10000; - EnrageTimer = 600000; - enraged = false; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); - } - - void KilledUnit(Unit * /*victim*/) - { - switch (urand(0,2)) + boss_azgalorAI(Creature *c) : hyjal_trashAI(c) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); - break; + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR); + if (TempSpell) + TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?! } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + uint32 RainTimer; + uint32 DoomTimer; + uint32 HowlTimer; + uint32 CleaveTimer; + uint32 EnrageTimer; + bool enraged; + + bool pGo; + uint32 pos; + + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + damageTaken = 0; + RainTimer = 20000; + DoomTimer = 50000; + HowlTimer = 30000; + CleaveTimer = 10000; + EnrageTimer = 600000; + enraged = false; + + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); } - } - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - } - - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void EnterCombat(Unit * /*who*/) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); + } + + void KilledUnit(Unit * /*victim*/) + { + switch (urand(0,2)) { - pGo = true; - if (pInstance) - { - AddWaypoint(0, 5492.91, -2404.61, 1462.63); - AddWaypoint(1, 5531.76, -2460.87, 1469.55); - AddWaypoint(2, 5554.58, -2514.66, 1476.12); - AddWaypoint(3, 5554.16, -2567.23, 1479.90); - AddWaypoint(4, 5540.67, -2625.99, 1480.89); - AddWaypoint(5, 5508.16, -2659.2, 1480.15); - AddWaypoint(6, 5489.62, -2704.05, 1482.18); - AddWaypoint(7, 5457.04, -2726.26, 1485.10); - Start(false, true); - SetDespawnAtEnd(false); - } + case 0: + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); + break; } } - //Return since we have no target - if (!UpdateVictim()) - return; - - if (RainTimer <= diff) + void WaypointReached(uint32 i) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE); - RainTimer = 20000+rand()%15000; - } else RainTimer -= diff; + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } - if (DoomTimer <= diff) + void JustDied(Unit *victim) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank - DoomTimer = 45000+rand()%5000; - } else DoomTimer -= diff; + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + } - if (HowlTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_HOWL_OF_AZGALOR); - HowlTimer = 30000; - } else HowlTimer -= diff; + if (IsEvent) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) + { + pGo = true; + if (pInstance) + { + AddWaypoint(0, 5492.91, -2404.61, 1462.63); + AddWaypoint(1, 5531.76, -2460.87, 1469.55); + AddWaypoint(2, 5554.58, -2514.66, 1476.12); + AddWaypoint(3, 5554.16, -2567.23, 1479.90); + AddWaypoint(4, 5540.67, -2625.99, 1480.89); + AddWaypoint(5, 5508.16, -2659.2, 1480.15); + AddWaypoint(6, 5489.62, -2704.05, 1482.18); + AddWaypoint(7, 5457.04, -2726.26, 1485.10); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } - if (CleaveTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - CleaveTimer = 10000+rand()%5000; - } else CleaveTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (EnrageTimer < diff && !enraged) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_BERSERK, true); - enraged = true; - EnrageTimer = 600000; - } else EnrageTimer -= diff; + if (RainTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE); + RainTimer = 20000+rand()%15000; + } else RainTimer -= diff; + + if (DoomTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank + DoomTimer = 45000+rand()%5000; + } else DoomTimer -= diff; + + if (HowlTimer <= diff) + { + DoCast(me, SPELL_HOWL_OF_AZGALOR); + HowlTimer = 30000; + } else HowlTimer -= diff; + + if (CleaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + CleaveTimer = 10000+rand()%5000; + } else CleaveTimer -= diff; + + if (EnrageTimer < diff && !enraged) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_BERSERK, true); + enraged = true; + EnrageTimer = 600000; + } else EnrageTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_azgalor(Creature* pCreature) -{ - return new boss_azgalorAI (pCreature); -} #define SPELL_THRASH 12787 #define SPELL_CRIPPLE 31406 #define SPELL_WARSTOMP 31408 - -struct mob_lesser_doomguardAI : public hyjal_trashAI + class mob_lesser_doomguard : public CreatureScript { - mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c) +public: + mob_lesser_doomguard() : CreatureScript("mob_lesser_doomguard") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - if (pInstance) - AzgalorGUID = pInstance->GetData64(DATA_AZGALOR); + return new mob_lesser_doomguardAI (pCreature); } - uint32 CrippleTimer; - uint32 WarstompTimer; - uint32 CheckTimer; - uint64 AzgalorGUID; - ScriptedInstance* pInstance; - - void Reset() + struct mob_lesser_doomguardAI : public hyjal_trashAI { - CrippleTimer = 50000; - WarstompTimer = 10000; - DoCast(me, SPELL_THRASH); - CheckTimer = 5000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void KilledUnit(Unit * /*victim*/) - { - } - - void WaypointReached(uint32 /*i*/) - { - } - - void MoveInLineOfSight(Unit *who) - { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) - AttackStart(who); - } - - void JustDied(Unit * /*victim*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c) { - if (AzgalorGUID) - { - Creature* boss = Unit::GetCreature((*me),AzgalorGUID); - if (!boss || (boss && boss->isDead())) - { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - return; - } - } + pInstance = c->GetInstanceScript(); + if (pInstance) + AzgalorGUID = pInstance->GetData64(DATA_AZGALOR); + } + + uint32 CrippleTimer; + uint32 WarstompTimer; + uint32 CheckTimer; + uint64 AzgalorGUID; + InstanceScript* pInstance; + + void Reset() + { + CrippleTimer = 50000; + WarstompTimer = 10000; + DoCast(me, SPELL_THRASH); CheckTimer = 5000; - } else CheckTimer -= diff; + } - //Return since we have no target - if (!UpdateVictim()) - return; - - if (WarstompTimer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_WARSTOMP); - WarstompTimer = 10000+rand()%5000; - } else WarstompTimer -= diff; + } - if (CrippleTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE); - CrippleTimer = 25000+rand()%5000; - } else CrippleTimer -= diff; + } + + void WaypointReached(uint32 /*i*/) + { + } + + void MoveInLineOfSight(Unit *who) + { + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + AttackStart(who); + } + + void JustDied(Unit * /*victim*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (CheckTimer <= diff) + { + if (AzgalorGUID) + { + Creature* boss = Unit::GetCreature((*me),AzgalorGUID); + if (!boss || (boss && boss->isDead())) + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + return; + } + } + CheckTimer = 5000; + } else CheckTimer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (WarstompTimer <= diff) + { + DoCast(me, SPELL_WARSTOMP); + WarstompTimer = 10000+rand()%5000; + } else WarstompTimer -= diff; + + if (CrippleTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE); + CrippleTimer = 25000+rand()%5000; + } else CrippleTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_lesser_doomguard(Creature* pCreature) -{ - return new mob_lesser_doomguardAI (pCreature); -} void AddSC_boss_azgalor() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azgalor"; - newscript->GetAI = &GetAI_boss_azgalor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_lesser_doomguard"; - newscript->GetAI = &GetAI_mob_lesser_doomguard; - newscript->RegisterSelf(); + new boss_azgalor(); + new mob_lesser_doomguard(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 2e9228b2f75..779088297f5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -39,175 +39,178 @@ #define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit." #define SOUND_ONAGGRO 11015 - -struct boss_kazrogalAI : public hyjal_trashAI + class boss_kazrogal : public CreatureScript { - boss_kazrogalAI(Creature *c) : hyjal_trashAI(c) +public: + boss_kazrogal() : CreatureScript("boss_kazrogal") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_MARK); - if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + return new boss_kazrogalAI (pCreature); + } + + struct boss_kazrogalAI : public hyjal_trashAI + { + boss_kazrogalAI(Creature *c) : hyjal_trashAI(c) { - TempSpell->EffectImplicitTargetA[0] = 1; - TempSpell->EffectImplicitTargetB[0] = 0; - } - } - - uint32 CleaveTimer; - uint32 WarStompTimer; - uint32 MarkTimer; - uint32 MarkTimerBase; - bool pGo; - uint32 pos; - - void Reset() - { - damageTaken = 0; - CleaveTimer = 5000; - WarStompTimer = 15000; - MarkTimer = 45000; - MarkTimerBase = 45000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); - } - - void KilledUnit(Unit * /*victim*/) - { - switch (urand(0,2)) - { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); - break; - } - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } - } - - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - } - - void UpdateAI(const uint32 diff) - { - if (IsEvent) - { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_MARK); + if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) { - pGo = true; - if (pInstance) - { - AddWaypoint(0, 5492.91, -2404.61, 1462.63); - AddWaypoint(1, 5531.76, -2460.87, 1469.55); - AddWaypoint(2, 5554.58, -2514.66, 1476.12); - AddWaypoint(3, 5554.16, -2567.23, 1479.90); - AddWaypoint(4, 5540.67, -2625.99, 1480.89); - AddWaypoint(5, 5508.16, -2659.2, 1480.15); - AddWaypoint(6, 5489.62, -2704.05, 1482.18); - AddWaypoint(7, 5457.04, -2726.26, 1485.10); - Start(false, true); - SetDespawnAtEnd(false); - } + TempSpell->EffectImplicitTargetA[0] = 1; + TempSpell->EffectImplicitTargetB[0] = 0; } } - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 CleaveTimer; + uint32 WarStompTimer; + uint32 MarkTimer; + uint32 MarkTimerBase; + bool pGo; + uint32 pos; - if (CleaveTimer <= diff) + void Reset() { - DoCast(me, SPELL_CLEAVE); - CleaveTimer = 6000+rand()%15000; - } else CleaveTimer -= diff; + damageTaken = 0; + CleaveTimer = 5000; + WarStompTimer = 15000; + MarkTimer = 45000; + MarkTimerBase = 45000; - if (WarStompTimer <= diff) + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_WARSTOMP); - WarStompTimer = 60000; - } else WarStompTimer -= diff; + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); + } - if (me->HasAura(SPELL_MARK)) - me->RemoveAurasDueToSpell(SPELL_MARK); - if (MarkTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - //cast dummy, useful for bos addons - me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); - - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) - { - pTarget->CastSpell(pTarget, SPELL_MARK,true);//only cast on mana users - } - } - MarkTimerBase -= 5000; - if (MarkTimerBase < 5500) - MarkTimerBase = 5500; - MarkTimer = MarkTimerBase; switch (urand(0,2)) { case 0: - DoPlaySoundToSet(me, SOUND_MARK1); - me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); break; case 1: - DoPlaySoundToSet(me, SOUND_MARK2); - me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); break; } - } else MarkTimer -= diff; + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + + void JustDied(Unit *victim) + { + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + } + + void UpdateAI(const uint32 diff) + { + if (IsEvent) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) + { + pGo = true; + if (pInstance) + { + AddWaypoint(0, 5492.91, -2404.61, 1462.63); + AddWaypoint(1, 5531.76, -2460.87, 1469.55); + AddWaypoint(2, 5554.58, -2514.66, 1476.12); + AddWaypoint(3, 5554.16, -2567.23, 1479.90); + AddWaypoint(4, 5540.67, -2625.99, 1480.89); + AddWaypoint(5, 5508.16, -2659.2, 1480.15); + AddWaypoint(6, 5489.62, -2704.05, 1482.18); + AddWaypoint(7, 5457.04, -2726.26, 1485.10); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (CleaveTimer <= diff) + { + DoCast(me, SPELL_CLEAVE); + CleaveTimer = 6000+rand()%15000; + } else CleaveTimer -= diff; + + if (WarStompTimer <= diff) + { + DoCast(me, SPELL_WARSTOMP); + WarStompTimer = 60000; + } else WarStompTimer -= diff; + + if (me->HasAura(SPELL_MARK)) + me->RemoveAurasDueToSpell(SPELL_MARK); + if (MarkTimer <= diff) + { + //cast dummy, useful for bos addons + me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); + + std::list t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) + { + pTarget->CastSpell(pTarget, SPELL_MARK,true);//only cast on mana users + } + } + MarkTimerBase -= 5000; + if (MarkTimerBase < 5500) + MarkTimerBase = 5500; + MarkTimer = MarkTimerBase; + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_MARK1); + me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_MARK2); + me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, NULL); + break; + } + } else MarkTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kazrogal(Creature* pCreature) -{ - return new boss_kazrogalAI (pCreature); -} void AddSC_boss_kazrogal() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kazrogal"; - newscript->GetAI = &GetAI_boss_kazrogal; - newscript->RegisterSelf(); + new boss_kazrogal(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 28b32e19063..2446bad14bb 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -45,164 +45,167 @@ #define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!" #define SOUND_ONAGGRO 11022 - -struct boss_rage_winterchillAI : public hyjal_trashAI + class boss_rage_winterchill : public CreatureScript { - boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c) +public: + boss_rage_winterchill() : CreatureScript("boss_rage_winterchill") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; + return new boss_rage_winterchillAI (pCreature); } - uint32 FrostArmorTimer; - uint32 DecayTimer; - uint32 NovaTimer; - uint32 IceboltTimer; - bool pGo; - uint32 pos; - - void Reset() + struct boss_rage_winterchillAI : public hyjal_trashAI { - damageTaken = 0; - FrostArmorTimer = 37000; - DecayTimer = 45000; - NovaTimer = 15000; - IceboltTimer = 10000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); - } - - void KilledUnit(Unit * /*victim*/) - { - switch (urand(0,1)) + boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + uint32 FrostArmorTimer; + uint32 DecayTimer; + uint32 NovaTimer; + uint32 IceboltTimer; + bool pGo; + uint32 pos; + + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0f); + damageTaken = 0; + FrostArmorTimer = 37000; + DecayTimer = 45000; + NovaTimer = 15000; + IceboltTimer = 10000; + + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); } - } - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL); - } - - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void EnterCombat(Unit * /*who*/) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + } + + void KilledUnit(Unit * /*victim*/) + { + switch (urand(0,1)) { - pGo = true; - if (pInstance) + case 0: + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + break; + } + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0f); + } + } + + void JustDied(Unit *victim) + { + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL); + } + + void UpdateAI(const uint32 diff) + { + if (IsEvent) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) { - AddWaypoint(0, 4896.08, -1576.35, 1333.65); - AddWaypoint(1, 4898.68, -1615.02, 1329.48); - AddWaypoint(2, 4907.12, -1667.08, 1321.00); - AddWaypoint(3, 4963.18, -1699.35, 1340.51); - AddWaypoint(4, 4989.16, -1716.67, 1335.74); - AddWaypoint(5, 5026.27, -1736.89, 1323.02); - AddWaypoint(6, 5037.77, -1770.56, 1324.36); - AddWaypoint(7, 5067.23, -1789.95, 1321.17); - Start(false, true); - SetDespawnAtEnd(false); + pGo = true; + if (pInstance) + { + AddWaypoint(0, 4896.08, -1576.35, 1333.65); + AddWaypoint(1, 4898.68, -1615.02, 1329.48); + AddWaypoint(2, 4907.12, -1667.08, 1321.00); + AddWaypoint(3, 4963.18, -1699.35, 1340.51); + AddWaypoint(4, 4989.16, -1716.67, 1335.74); + AddWaypoint(5, 5026.27, -1736.89, 1323.02); + AddWaypoint(6, 5037.77, -1770.56, 1324.36); + AddWaypoint(7, 5067.23, -1789.95, 1321.17); + Start(false, true); + SetDespawnAtEnd(false); + } } } + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (FrostArmorTimer <= diff) + { + DoCast(me, SPELL_FROST_ARMOR); + FrostArmorTimer = 40000+rand()%20000; + } else FrostArmorTimer -= diff; + if (DecayTimer <= diff) + { + DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); + DecayTimer = 60000+rand()%20000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_DECAY1); + me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_DECAY2); + me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, NULL); + break; + } + } else DecayTimer -= diff; + if (NovaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_NOVA); + NovaTimer = 30000+rand()%15000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_NOVA1); + me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_NOVA2); + me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, NULL); + break; + } + } else NovaTimer -= diff; + if (IceboltTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT); + IceboltTimer = 11000+rand()%20000; + } else IceboltTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - //Return since we have no target - if (!UpdateVictim()) - return; - - if (FrostArmorTimer <= diff) - { - DoCast(me, SPELL_FROST_ARMOR); - FrostArmorTimer = 40000+rand()%20000; - } else FrostArmorTimer -= diff; - if (DecayTimer <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); - DecayTimer = 60000+rand()%20000; - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_DECAY1); - me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_DECAY2); - me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, NULL); - break; - } - } else DecayTimer -= diff; - if (NovaTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FROST_NOVA); - NovaTimer = 30000+rand()%15000; - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_NOVA1); - me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_NOVA2); - me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, NULL); - break; - } - } else NovaTimer -= diff; - if (IceboltTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT); - IceboltTimer = 11000+rand()%20000; - } else IceboltTimer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rage_winterchill(Creature* pCreature) -{ - return new boss_rage_winterchillAI (pCreature); -} void AddSC_boss_rage_winterchill() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rage_winterchill"; - newscript->GetAI = &GetAI_boss_rage_winterchill; - newscript->RegisterSelf(); + new boss_rage_winterchill(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 4f524587525..c39ee759a22 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -44,206 +44,210 @@ EndContentData */ #define ITEM_TEAR_OF_GODDESS 24494 #define GOSSIP_ITEM_GM1 "[GM] Toggle Debug Timers" - -CreatureAI* GetAI_npc_jaina_proudmoore(Creature* pCreature) + class npc_jaina_proudmoore : public CreatureScript { - hyjalAI* ai = new hyjalAI(pCreature); +public: + npc_jaina_proudmoore() : CreatureScript("npc_jaina_proudmoore") { } - ai->Reset(); - ai->EnterEvadeMode(); - - ai->Spell[0].SpellId = SPELL_BLIZZARD; - ai->Spell[0].Cooldown = 15000 + rand()%20000; - ai->Spell[0].TargetType = TARGETTYPE_RANDOM; - - ai->Spell[1].SpellId = SPELL_PYROBLAST; - ai->Spell[1].Cooldown = 5500 + rand()%4000; - ai->Spell[1].TargetType = TARGETTYPE_RANDOM; - - ai->Spell[2].SpellId = SPELL_SUMMON_ELEMENTALS; - ai->Spell[2].Cooldown = 15000 + rand()%30000; - ai->Spell[2].TargetType = TARGETTYPE_SELF; - - return ai; -} - -bool GossipHello_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - if (ai->EventBegun) - return false; - - uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT); - uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT); - if (RageEncounter == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_ALLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ANETHERON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - else if (RageEncounter == DONE && AnetheronEncounter == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - - if (pPlayer->isGameMaster()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF + 1: - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - ai->FirstBossDead = true; - ai->WaveCount = 9; - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - ai->Retreat(); - break; - case GOSSIP_ACTION_INFO_DEF: - ai->Debug = !ai->Debug; - sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); - break; - } - return true; -} - -CreatureAI* GetAI_npc_thrall(Creature* pCreature) -{ - hyjalAI* ai = new hyjalAI(pCreature); - - ai->Reset(); - ai->EnterEvadeMode(); - - ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING; - ai->Spell[0].Cooldown = 3000 + rand()%5000; - ai->Spell[0].TargetType = TARGETTYPE_VICTIM; - - ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF; - ai->Spell[1].Cooldown = 6000 + rand()%35000; - ai->Spell[1].TargetType = TARGETTYPE_RANDOM; - - return ai; -} - -bool GossipHello_npc_thrall(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - if (ai->EventBegun) - return false; - - uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); - // Only let them start the Horde phases if Anetheron is dead. - if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) - { - uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT); - uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - if (KazrogalEvent == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_HORDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AZGALOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - else if (AzgalorEvent == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + ai->FirstBossDead = true; + ai->WaveCount = 9; + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + ai->Retreat(); + break; + case GOSSIP_ACTION_INFO_DEF: + ai->Debug = !ai->Debug; + sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); + break; + } + return true; } - if (pPlayer->isGameMaster()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_thrall(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - ai->DeSpawnVeins();//despawn the alliance veins - switch(uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF + 1: - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - ai->FirstBossDead = true; - ai->WaveCount = 9; - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - ai->Retreat(); - break; - case GOSSIP_ACTION_INFO_DEF: - ai->Debug = !ai->Debug; - sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); - break; + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + if (ai->EventBegun) + return false; + + uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT); + uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT); + if (RageEncounter == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_ALLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ANETHERON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + else if (RageEncounter == DONE && AnetheronEncounter == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + if (pPlayer->isGameMaster()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; } - return true; -} -CreatureAI* GetAI_npc_tyrande_whisperwind(Creature* pCreature) -{ - hyjalAI* ai = new hyjalAI(pCreature); - ai->Reset(); - ai->EnterEvadeMode(); - return ai; -} - -bool GossipHello_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - - // Only let them get item if Azgalor is dead. - if (AzgalorEvent == DONE && !pPlayer->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + CreatureAI* GetAI(Creature* pCreature) const { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = pPlayer->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); - if (item && pPlayer) - pPlayer->SendNewItem(item,1,true,false,true); - } - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - CAST_AI(hyjalAI, pCreature->AI()); + hyjalAI* ai = new hyjalAI(pCreature); + + ai->Reset(); + ai->EnterEvadeMode(); + + ai->Spell[0].SpellId = SPELL_BLIZZARD; + ai->Spell[0].Cooldown = 15000 + rand()%20000; + ai->Spell[0].TargetType = TARGETTYPE_RANDOM; + + ai->Spell[1].SpellId = SPELL_PYROBLAST; + ai->Spell[1].Cooldown = 5500 + rand()%4000; + ai->Spell[1].TargetType = TARGETTYPE_RANDOM; + + ai->Spell[2].SpellId = SPELL_SUMMON_ELEMENTALS; + ai->Spell[2].Cooldown = 15000 + rand()%30000; + ai->Spell[2].TargetType = TARGETTYPE_SELF; + + return ai; } - return true; -} + +}; + + + class npc_thrall : public CreatureScript +{ +public: + npc_thrall() : CreatureScript("npc_thrall") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + ai->DeSpawnVeins();//despawn the alliance veins + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + ai->FirstBossDead = true; + ai->WaveCount = 9; + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + ai->Retreat(); + break; + case GOSSIP_ACTION_INFO_DEF: + ai->Debug = !ai->Debug; + sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + if (ai->EventBegun) + return false; + + uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); + // Only let them start the Horde phases if Anetheron is dead. + if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) + { + uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT); + uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); + if (KazrogalEvent == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_HORDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AZGALOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + else if (AzgalorEvent == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + } + + if (pPlayer->isGameMaster()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + hyjalAI* ai = new hyjalAI(pCreature); + + ai->Reset(); + ai->EnterEvadeMode(); + + ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING; + ai->Spell[0].Cooldown = 3000 + rand()%5000; + ai->Spell[0].TargetType = TARGETTYPE_VICTIM; + + ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF; + ai->Spell[1].Cooldown = 6000 + rand()%35000; + ai->Spell[1].TargetType = TARGETTYPE_RANDOM; + + return ai; + } + +}; + + + class npc_tyrande_whisperwind : public CreatureScript +{ +public: + npc_tyrande_whisperwind() : CreatureScript("npc_tyrande_whisperwind") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + hyjalAI* ai = new hyjalAI(pCreature); + ai->Reset(); + ai->EnterEvadeMode(); + return ai; + } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = pPlayer->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); + if (item && pPlayer) + pPlayer->SendNewItem(item,1,true,false,true); + } + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + CAST_AI(hyjalAI, pCreature->AI()); + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); + + // Only let them get item if Azgalor is dead. + if (AzgalorEvent == DONE && !pPlayer->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; + } + +}; + + void AddSC_hyjal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_jaina_proudmoore"; - newscript->GetAI = &GetAI_npc_jaina_proudmoore; - newscript->pGossipHello = &GossipHello_npc_jaina_proudmoore; - newscript->pGossipSelect = &GossipSelect_npc_jaina_proudmoore; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall"; - newscript->GetAI = &GetAI_npc_thrall; - newscript->pGossipHello = &GossipHello_npc_thrall; - newscript->pGossipSelect = &GossipSelect_npc_thrall; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrande_whisperwind"; - newscript->pGossipHello = &GossipHello_npc_tyrande_whisperwind; - newscript->pGossipSelect = &GossipSelect_npc_tyrande_whisperwind; - newscript->GetAI = &GetAI_npc_tyrande_whisperwind; - newscript->RegisterSelf(); + new npc_jaina_proudmoore(); + new npc_thrall(); + new npc_tyrande_whisperwind(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 276b62c0689..a3045446692 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -312,7 +312,7 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; for (uint8 i=0; i<14; ++i) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index 245e719295a..7ffaf24f845 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -210,7 +210,7 @@ struct hyjalAI : public npc_escortAI void Talk(uint32 id); // Searches for the appropriate yell and sound and uses it to inform the raid of various things public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 PlayerGUID; uint64 BossGUID[2]; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index dd889b9fee6..c4820817ae2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -157,7 +157,7 @@ float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); IsEvent = false; Delay = 0; LastOverronPos = 0; @@ -388,1069 +388,1098 @@ void hyjal_trashAI::JustDied(Unit * /*victim*/) me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);//no loot } -struct mob_giant_infernalAI : public hyjal_trashAI +class mob_giant_infernal : public CreatureScript { - mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) +public: + mob_giant_infernal() : CreatureScript("mob_giant_infernal") { } + + struct mob_giant_infernalAI : public hyjal_trashAI { - pInstance = c->GetInstanceData(); - meteor = false;//call once! - CanMove = false; - Delay = rand()%30000; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(MODEL_INVIS); - pGo = false; - pos = 0; - Reset(); - } - - bool meteor; - bool CanMove; - bool WpEnabled; - bool pGo; - uint32 pos; - uint32 spawnTimer; - uint32 FlameBuffetTimer; - bool imol; - - void Reset() - { - spawnTimer = 2000; - FlameBuffetTimer= 2000; - imol = false; - } - - void EnterCombat(Unit* /*who*/) {} - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 0 && pInstance && !IsOverrun) + mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + meteor = false;//call once! + CanMove = false; + Delay = rand()%30000; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(MODEL_INVIS); + pGo = false; + pos = 0; + Reset(); } - } - void UpdateAI(const uint32 diff) - { - if (Delay <= diff) + bool meteor; + bool CanMove; + bool WpEnabled; + bool pGo; + uint32 pos; + uint32 spawnTimer; + uint32 FlameBuffetTimer; + bool imol; + + void Reset() { - Delay=0; - }else{ - Delay-=diff; - return; + spawnTimer = 2000; + FlameBuffetTimer= 2000; + imol = false; } - if (!meteor) + + void EnterCombat(Unit* /*who*/) {} + + void WaypointReached(uint32 i) { - float x,y,z; - me->GetPosition(x,y,z); - Creature* trigger = me->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,me->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000); - if (trigger) + pos = i; + if (i == 0 && pInstance && !IsOverrun) { - trigger->SetVisibility(VISIBILITY_OFF); - trigger->setFaction(me->getFaction()); - trigger->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - trigger->CastSpell(me,SPELL_METEOR,true); - } - me->GetMotionMaster()->Clear(); - meteor = true; - } else if (!CanMove){ - if (spawnTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); - CanMove = true; - if (pInstance) + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT)) + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + } + + void UpdateAI(const uint32 diff) + { + if (Delay <= diff) + { + Delay=0; + }else{ + Delay-=diff; + return; + } + if (!meteor) + { + float x,y,z; + me->GetPosition(x,y,z); + Creature* trigger = me->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,me->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000); + if (trigger) + { + trigger->SetVisibility(VISIBILITY_OFF); + trigger->setFaction(me->getFaction()); + trigger->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + trigger->CastSpell(me,SPELL_METEOR,true); + } + me->GetMotionMaster()->Clear(); + meteor = true; + } else if (!CanMove){ + if (spawnTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); + CanMove = true; + if (pInstance) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){ - //do overrun + if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){ + //do overrun + } + } + } else spawnTimer -= diff; + } + if (!CanMove)return; + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall + Start(true, true); + SetDespawnAtEnd(false); } } - } else spawnTimer -= diff; - } - if (!CanMove)return; - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) - { - if (!pGo) - { - pGo = true; - if (pInstance) - { - AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall - Start(true, true); - SetDespawnAtEnd(false); - } } - } - if (!UpdateVictim()) - return; - if (!imol) - { - DoCast(me, SPELL_IMMOLATION); - imol=true; + if (!UpdateVictim()) + return; + if (!imol) + { + DoCast(me, SPELL_IMMOLATION); + imol=true; + } + if (FlameBuffetTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAME_BUFFET, true); + FlameBuffetTimer = 7000; + } else FlameBuffetTimer -= diff; + DoMeleeAttackIfReady(); } - if (FlameBuffetTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAME_BUFFET, true); - FlameBuffetTimer = 7000; - } else FlameBuffetTimer -= diff; - DoMeleeAttackIfReady(); + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_giant_infernalAI(pCreature); } }; -CreatureAI* GetAI_mob_giant_infernal(Creature* pCreature) -{ - return new mob_giant_infernalAI(pCreature); -} - #define SPELL_DISEASE_CLOUD 31607 #define SPELL_KNOCKDOWN 31610 - -struct mob_abominationAI : public hyjal_trashAI + class mob_abomination : public CreatureScript { - mob_abominationAI(Creature* c) : hyjal_trashAI(c) +public: + mob_abomination() : CreatureScript("mob_abomination") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); + return new mob_abominationAI(pCreature); } - bool pGo; - uint32 KnockDownTimer; - uint32 pos; - void Reset() + struct mob_abominationAI : public hyjal_trashAI { - KnockDownTimer = 10000; - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_abominationAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - if (i == LastOverronPos && IsOverrun) + + bool pGo; + uint32 KnockDownTimer; + uint32 pos; + void Reset() { - if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) - { - me->setDeathState(DEAD); - me->RemoveCorpse(); - } + KnockDownTimer = 10000; } - } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void WaypointReached(uint32 i) { - if (!pGo) + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + if (i == LastOverronPos && IsOverrun) + { + if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + { + me->setDeathState(DEAD); + me->RemoveCorpse(); } } } - if (!me->HasAura(SPELL_DISEASE_CLOUD)) - DoCast(me, SPELL_DISEASE_CLOUD); - if (!UpdateVictim()) - return; - if (KnockDownTimer <= diff) + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); - KnockDownTimer = 15000+rand()%10000; - } else KnockDownTimer -= diff; - DoMeleeAttackIfReady(); - } + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } + } + if (!me->HasAura(SPELL_DISEASE_CLOUD)) + DoCast(me, SPELL_DISEASE_CLOUD); + if (!UpdateVictim()) + return; + if (KnockDownTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + KnockDownTimer = 15000+rand()%10000; + } else KnockDownTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_abomination(Creature* pCreature) -{ - return new mob_abominationAI(pCreature); -} #define SPELL_FRENZY 31540 - -struct mob_ghoulAI : public hyjal_trashAI + class mob_ghoul : public CreatureScript { - mob_ghoulAI(Creature* c) : hyjal_trashAI(c) +public: + mob_ghoul() : CreatureScript("mob_ghoul") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); + return new mob_ghoulAI(pCreature); } - bool pGo; - uint32 FrenzyTimer; - uint32 pos; - uint32 MoveTimer; - bool RandomMove; - void Reset() + struct mob_ghoulAI : public hyjal_trashAI { - FrenzyTimer = 5000+rand()%5000; - MoveTimer = 2000; - RandomMove = false; - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_ghoulAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - if (i == LastOverronPos && IsOverrun) - { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED); - if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) - { - me->setDeathState(DEAD); - me->RemoveCorpse(); - } + bool pGo; + uint32 FrenzyTimer; + uint32 pos; + uint32 MoveTimer; + bool RandomMove; + void Reset() + { + FrenzyTimer = 5000+rand()%5000; + MoveTimer = 2000; + RandomMove = false; } - } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void WaypointReached(uint32 i) { - if (!pGo) + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + if (i == LastOverronPos && IsOverrun) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED); + if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + { + me->setDeathState(DEAD); + me->RemoveCorpse(); + } + + } + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } - } - if (FrenzyTimer <= diff) - { - DoCast(me, SPELL_FRENZY); - FrenzyTimer = 15000+rand()%15000; - } else FrenzyTimer -= diff; - if (!UpdateVictim()) - return; + if (FrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + FrenzyTimer = 15000+rand()%15000; + } else FrenzyTimer -= diff; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_ghoul(Creature* pCreature) -{ - return new mob_ghoulAI(pCreature); -} #define SPELL_RAISE_DEAD_1 31617 #define SPELL_RAISE_DEAD_2 31624 #define SPELL_RAISE_DEAD_3 31625 #define SPELL_SHADOW_BOLT 31627 - -struct mob_necromancerAI : public hyjal_trashAI + class mob_necromancer : public CreatureScript { - mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(me) +public: + mob_necromancer() : CreatureScript("mob_necromancer") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } - SummonList summons; - bool pGo; - uint32 ShadowBoltTimer; - uint32 pos; - void Reset() - { - ShadowBoltTimer = 1000+rand()%5000; - summons.DespawnAll(); + return new mob_necromancerAI(pCreature); } - void JustSummoned(Creature* summon) + struct mob_necromancerAI : public hyjal_trashAI { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true); - if (pTarget && summon) - summon->Attack(pTarget,false); - summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(me) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - } - - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,2)) + SummonList summons; + bool pGo; + uint32 ShadowBoltTimer; + uint32 pos; + void Reset() { - case 0: - DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - DoSpawnCreature(17902,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; - case 1: - DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - DoSpawnCreature(17903,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; - case 2: - DoSpawnCreature(RAND(17902,17903),3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; + ShadowBoltTimer = 1000+rand()%5000; + summons.DespawnAll(); } - } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void JustSummoned(Creature* summon) { - if (!pGo) + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true); + if (pTarget && summon) + summon->Attack(pTarget,false); + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(true, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(true, true); - SetDespawnAtEnd(false); - } + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); } } } - if (!UpdateVictim()) - return; - if (ShadowBoltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - ShadowBoltTimer = 20000+rand()%10000; - } else ShadowBoltTimer -= diff; - DoMeleeAttackIfReady(); - } + void KilledUnit(Unit* /*victim*/) + { + switch (urand(0,2)) + { + case 0: + DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + DoSpawnCreature(17902,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + case 1: + DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + DoSpawnCreature(17903,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + case 2: + DoSpawnCreature(RAND(17902,17903),3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + } + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(true, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(true, true); + SetDespawnAtEnd(false); + } + } + } + } + if (!UpdateVictim()) + return; + if (ShadowBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + ShadowBoltTimer = 20000+rand()%10000; + } else ShadowBoltTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_necromancer(Creature* pCreature) -{ - return new mob_necromancerAI(pCreature); -} #define SPELL_BANSHEE_CURSE 31651 #define SPELL_BANSHEE_WAIL 38183 #define SPELL_ANTI_MAGIC_SHELL 31662 - -struct mob_bansheeAI : public hyjal_trashAI + class mob_banshee : public CreatureScript { - mob_bansheeAI(Creature* c) : hyjal_trashAI(c) +public: + mob_banshee() : CreatureScript("mob_banshee") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); + return new mob_bansheeAI(pCreature); } - bool pGo; - uint32 CourseTimer; - uint32 WailTimer; - uint32 ShellTimer; - uint32 pos; - void Reset() + struct mob_bansheeAI : public hyjal_trashAI { - CourseTimer = 20000+rand()%5000; - WailTimer = 15000+rand()%5000; - ShellTimer = 50000+rand()%10000; - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_bansheeAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + bool pGo; + uint32 CourseTimer; + uint32 WailTimer; + uint32 ShellTimer; + uint32 pos; + void Reset() { - if (!pGo) + CourseTimer = 20000+rand()%5000; + WailTimer = 15000+rand()%5000; + ShellTimer = 50000+rand()%10000; + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); } } } - if (!UpdateVictim()) - return; - if (CourseTimer <= diff) + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_BANSHEE_CURSE); - CourseTimer = 20000+rand()%5000; - } else CourseTimer -= diff; - if (WailTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BANSHEE_WAIL); - WailTimer = 15000+rand()%5000; - } else WailTimer -= diff; - if (ShellTimer <= diff) - { - DoCast(me, SPELL_ANTI_MAGIC_SHELL); - ShellTimer = 50000+rand()%10000; - } else ShellTimer -= diff; - DoMeleeAttackIfReady(); - } + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } + } + if (!UpdateVictim()) + return; + if (CourseTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BANSHEE_CURSE); + CourseTimer = 20000+rand()%5000; + } else CourseTimer -= diff; + if (WailTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BANSHEE_WAIL); + WailTimer = 15000+rand()%5000; + } else WailTimer -= diff; + if (ShellTimer <= diff) + { + DoCast(me, SPELL_ANTI_MAGIC_SHELL); + ShellTimer = 50000+rand()%10000; + } else ShellTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_banshee(Creature* pCreature) -{ - return new mob_bansheeAI(pCreature); -} #define SPELL_WEB 28991 - -struct mob_crypt_fiendAI : public hyjal_trashAI + class mob_crypt_fiend : public CreatureScript { - mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) +public: + mob_crypt_fiend() : CreatureScript("mob_crypt_fiend") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); + return new mob_crypt_fiendAI(pCreature); } - bool pGo; - uint32 WebTimer; - uint32 pos; - void Reset() + struct mob_crypt_fiendAI : public hyjal_trashAI { - WebTimer = 20000+rand()%5000; - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + bool pGo; + uint32 WebTimer; + uint32 pos; + void Reset() { - if (!pGo) - { - pGo = true; - if (pInstance) - { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + WebTimer = 20000+rand()%5000; + } + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); } } } - if (!UpdateVictim()) - return; - if (WebTimer <= diff) + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_WEB); - WebTimer = 20000+rand()%5000; - } else WebTimer -= diff; - DoMeleeAttackIfReady(); - } + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + + } + } + } + if (!UpdateVictim()) + return; + if (WebTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WEB); + WebTimer = 20000+rand()%5000; + } else WebTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_crypt_fiend(Creature* pCreature) -{ - return new mob_crypt_fiendAI(pCreature); -} #define SPELL_MANA_BURN 31729 - -struct mob_fel_stalkerAI : public hyjal_trashAI + class mob_fel_stalker : public CreatureScript { - mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) +public: + mob_fel_stalker() : CreatureScript("mob_fel_stalker") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); + return new mob_fel_stalkerAI(pCreature); } - bool pGo; - uint32 ManaBurnTimer; - uint32 pos; - void Reset() + struct mob_fel_stalkerAI : public hyjal_trashAI { - ManaBurnTimer = 9000+rand()%5000; - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 ManaBurnTimer; + uint32 pos; + void Reset() + { + ManaBurnTimer = 9000+rand()%5000; + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + + } + } + } + if (!UpdateVictim()) + return; + if (ManaBurnTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MANA_BURN); + ManaBurnTimer = 9000+rand()%5000; + } else ManaBurnTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + +}; + + +#define SPELL_FROST_BREATH 31688 + class mob_frost_wyrm : public CreatureScript +{ +public: + mob_frost_wyrm() : CreatureScript("mob_frost_wyrm") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_frost_wyrmAI(pCreature); + } + + struct mob_frost_wyrmAI : public hyjal_trashAI + { + mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 FrostBreathTimer; + uint32 pos; + uint32 MoveTimer; + + void Reset() + { + FrostBreathTimer = 5000; + MoveTimer = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 2 && pInstance && !IsOverrun) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } - } - } - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) - { - if (!pGo) - { - pGo = true; - if (pInstance) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } - + me->AddThreat(pTarget,0.0); + DoCast(pTarget, SPELL_FROST_BREATH, true); } } } - if (!UpdateVictim()) - return; - if (ManaBurnTimer <= diff) + + void JustDied(Unit * /*victim*/) { - DoCast(me->getVictim(), SPELL_MANA_BURN); - ManaBurnTimer = 9000+rand()%5000; - } else ManaBurnTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + if (pInstance && IsEvent) + pInstance->SetData(DATA_TRASH, 0);//signal trash is dead -CreatureAI* GetAI_mob_fel_stalker(Creature* pCreature) -{ - return new mob_fel_stalkerAI(pCreature); -} + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); + } -#define SPELL_FROST_BREATH 31688 + void EnterCombat(Unit* /*who*/) {} -struct mob_frost_wyrmAI : public hyjal_trashAI -{ - mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } - - bool pGo; - uint32 FrostBreathTimer; - uint32 pos; - uint32 MoveTimer; - - void Reset() - { - FrostBreathTimer = 5000; - MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 2 && pInstance && !IsOverrun) + void UpdateAI(const uint32 diff) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) { - me->AddThreat(pTarget,0.0); - DoCast(pTarget, SPELL_FROST_BREATH, true); + CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + npc_escortAI::UpdateAI(diff); } - } - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_TRASH, 0);//signal trash is dead - - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - } - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); - npc_escortAI::UpdateAI(diff); - } - if (IsEvent) - { - if (!pGo) + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (!useFlyPath) + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (!useFlyPath) + { + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else{//fly path FlyPathWPs + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } - } - if (!UpdateVictim()) - return; - if (!me->IsWithinDist(me->getVictim(), 25)){ - if (MoveTimer <= diff) - { - me->GetMotionMaster()->MoveChase(me->getVictim()); - MoveTimer = 2000; - } else MoveTimer-=diff; - } - - if (FrostBreathTimer <= diff) - { - if (!me->IsWithinDist(me->getVictim(), 25)) - { - DoCast(me->getVictim(), SPELL_FROST_BREATH); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - FrostBreathTimer = 4000; + if (!UpdateVictim()) + return; + if (!me->IsWithinDist(me->getVictim(), 25)){ + if (MoveTimer <= diff) + { + me->GetMotionMaster()->MoveChase(me->getVictim()); + MoveTimer = 2000; + } else MoveTimer-=diff; } - } else FrostBreathTimer -= diff; - } + + if (FrostBreathTimer <= diff) + { + if (!me->IsWithinDist(me->getVictim(), 25)) + { + DoCast(me->getVictim(), SPELL_FROST_BREATH); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + FrostBreathTimer = 4000; + } + } else FrostBreathTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_frost_wyrm(Creature* pCreature) -{ - return new mob_frost_wyrmAI(pCreature); -} #define SPELL_GARGOYLE_STRIKE 31664 - -struct mob_gargoyleAI : public hyjal_trashAI + class mob_gargoyle : public CreatureScript { - mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) +public: + mob_gargoyle() : CreatureScript("mob_gargoyle") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; - Reset(); + return new mob_gargoyleAI(pCreature); } - bool pGo; - uint32 StrikeTimer; - uint32 pos; - uint32 MoveTimer; - float Zpos; - bool forcemove; - - void Reset() + struct mob_gargoyleAI : public hyjal_trashAI { - forcemove = true; - Zpos = 10.0; - StrikeTimer = 2000+rand()%5000; - MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - } - - void WaypointReached(uint32 i) - { - pos = i; - if (i == 2 && pInstance && !IsOverrun) + mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; + Reset(); + } + + bool pGo; + uint32 StrikeTimer; + uint32 pos; + uint32 MoveTimer; + float Zpos; + bool forcemove; + + void Reset() + { + forcemove = true; + Zpos = 10.0; + StrikeTimer = 2000+rand()%5000; + MoveTimer = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 2 && pInstance && !IsOverrun) { - me->AddThreat(pTarget,0.0); - DoCast(pTarget, SPELL_GARGOYLE_STRIKE, true); + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + { + me->AddThreat(pTarget,0.0); + DoCast(pTarget, SPELL_GARGOYLE_STRIKE, true); + } } } - } - void JustDied(Unit *victim) - { - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - hyjal_trashAI::JustDied(victim); - } - - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) + void JustDied(Unit *victim) { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); - npc_escortAI::UpdateAI(diff); + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); + hyjal_trashAI::JustDied(victim); } - if (IsEvent) + + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) { - pGo = true; - if (pInstance) + CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + npc_escortAI::UpdateAI(diff); + } + if (IsEvent) + { + if (!pGo) { - if (!useFlyPath) + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (!useFlyPath) + { + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else{//fly path FlyPathWPs + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } - } - if (IsOverrun && !UpdateVictim()) - { - if (faction == 0)//alliance + if (IsOverrun && !UpdateVictim()) { - if (StrikeTimer <= diff) + if (faction == 0)//alliance { - me->CastSpell(DummyTarget[0],DummyTarget[1],DummyTarget[2],SPELL_GARGOYLE_STRIKE,false); - StrikeTimer = 2000+rand()%1000; - } else StrikeTimer -= diff; - } - } - if (!UpdateVictim()) - return; - if (!me->IsWithinDist(me->getVictim(), 20) || forcemove) - { - forcemove = false; - if (forcemove) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - me->Attack(pTarget,false); + if (StrikeTimer <= diff) + { + me->CastSpell(DummyTarget[0],DummyTarget[1],DummyTarget[2],SPELL_GARGOYLE_STRIKE,false); + StrikeTimer = 2000+rand()%1000; + } else StrikeTimer -= diff; + } } - if (MoveTimer <= diff) + if (!UpdateVictim()) + return; + if (!me->IsWithinDist(me->getVictim(), 20) || forcemove) { - float x,y,z; - me->getVictim()->GetPosition(x,y,z); - me->GetMotionMaster()->MovePoint(0,x,y,z+Zpos); - Zpos-=1.0; - if (Zpos <= 0)Zpos=0; - MoveTimer = 2000; - } else MoveTimer-=diff; + forcemove = false; + if (forcemove) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + me->Attack(pTarget,false); + } + if (MoveTimer <= diff) + { + float x,y,z; + me->getVictim()->GetPosition(x,y,z); + me->GetMotionMaster()->MovePoint(0,x,y,z+Zpos); + Zpos-=1.0; + if (Zpos <= 0)Zpos=0; + MoveTimer = 2000; + } else MoveTimer-=diff; + } + if (StrikeTimer <= diff) + { + if (me->IsWithinDist(me->getVictim(), 20)) + { + DoCast(me->getVictim(), SPELL_GARGOYLE_STRIKE); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + StrikeTimer = 2000+rand()%1000; + } else StrikeTimer=0; + } else StrikeTimer -= diff; } - if (StrikeTimer <= diff) - { - if (me->IsWithinDist(me->getVictim(), 20)) - { - DoCast(me->getVictim(), SPELL_GARGOYLE_STRIKE); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - StrikeTimer = 2000+rand()%1000; - } else StrikeTimer=0; - } else StrikeTimer -= diff; - } + }; + }; -CreatureAI* GetAI_mob_gargoyle(Creature* pCreature) -{ - return new mob_gargoyleAI(pCreature); -} #define SPELL_EXPLODING_SHOT 7896 - -struct alliance_riflemanAI : public Scripted_NoMovementAI + class alliance_rifleman : public CreatureScript { - alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c) +public: + alliance_rifleman() : CreatureScript("alliance_rifleman") { } + + CreatureAI* GetAI(Creature* pCreature) const { - Reset(); + return new alliance_riflemanAI(pCreature); } - uint32 ExplodeTimer; - - void JustDied(Unit* /*who*/) + struct alliance_riflemanAI : public Scripted_NoMovementAI { - } - - void Reset() - { - ExplodeTimer = 5000+rand()%5000; - } - - void MoveInLineOfSight(Unit *who) - { - if (!who || me->getVictim()) - return; - - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c) { - //float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, 30)) - AttackStart(who); + Reset(); } - } - void EnterCombat(Unit * /*who*/) - { - } + uint32 ExplodeTimer; - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - if (ExplodeTimer <= diff) + void JustDied(Unit* /*who*/) { - if (!me->IsWithinDistInMap(me->getVictim(), 30)) - { - EnterEvadeMode(); - return; - } - int dmg = 500+rand()%700; - me->CastCustomSpell(me->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false); - ExplodeTimer = 5000+rand()%5000; - } else ExplodeTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + } -CreatureAI* GetAI_alliance_rifleman(Creature* pCreature) -{ - return new alliance_riflemanAI(pCreature); -} + void Reset() + { + ExplodeTimer = 5000+rand()%5000; + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || me->getVictim()) + return; + + if (who->isTargetableForAttack() && me->IsHostileTo(who)) + { + //float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, 30)) + AttackStart(who); + } + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; + if (ExplodeTimer <= diff) + { + if (!me->IsWithinDistInMap(me->getVictim(), 30)) + { + EnterEvadeMode(); + return; + } + int dmg = 500+rand()%700; + me->CastCustomSpell(me->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false); + ExplodeTimer = 5000+rand()%5000; + } else ExplodeTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_hyjal_trash() { - Script *newscript = new Script; - newscript->Name = "mob_giant_infernal"; - newscript->GetAI = &GetAI_mob_giant_infernal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_abomination"; - newscript->GetAI = &GetAI_mob_abomination; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ghoul"; - newscript->GetAI = &GetAI_mob_ghoul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_necromancer"; - newscript->GetAI = &GetAI_mob_necromancer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_banshee"; - newscript->GetAI = &GetAI_mob_banshee; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crypt_fiend"; - newscript->GetAI = &GetAI_mob_crypt_fiend; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fel_stalker"; - newscript->GetAI = &GetAI_mob_fel_stalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frost_wyrm"; - newscript->GetAI = &GetAI_mob_frost_wyrm; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_gargoyle"; - newscript->GetAI = &GetAI_mob_gargoyle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "alliance_rifleman"; - newscript->GetAI = &GetAI_alliance_rifleman; - newscript->RegisterSelf(); + new mob_giant_infernal(); + new mob_abomination(); + new mob_ghoul(); + new mob_necromancer(); + new mob_banshee(); + new mob_crypt_fiend(); + new mob_fel_stalker(); + new mob_frost_wyrm(); + new mob_gargoyle(); + new alliance_rifleman(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h index b18fa74e6a4..ba66e8ed41a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h @@ -34,7 +34,7 @@ struct hyjal_trashAI : public npc_escortAI void DamageTaken(Unit *done_by, uint32 &damage); public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool IsEvent; uint32 Delay; uint32 LastOverronPos; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 65579498210..41045ed0bf0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -40,287 +40,289 @@ enum eEnums 3 - Azgalor event 4 - Archimonde event */ - -struct instance_mount_hyjal : public ScriptedInstance + class instance_hyjal : public InstanceMapScript { - instance_mount_hyjal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_hyjal() : InstanceMapScript("instance_hyjal") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - std::list m_uiAncientGemGUID; - - uint64 RageWinterchill; - uint64 Anetheron; - uint64 Kazrogal; - uint64 Azgalor; - uint64 Archimonde; - uint64 JainaProudmoore; - uint64 Thrall; - uint64 TyrandeWhisperwind; - uint64 HordeGate; - uint64 ElfGate; - - uint32 Trash; - - uint32 hordeRetreat; - uint32 allianceRetreat; - bool ArchiYell; - - uint32 RaidDamage; - - #define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." - #define YELL_EFFORTS_NAME "Archimonde" - - void Initialize() + InstanceScript* GetInstanceData_instance_mount_hyjal_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiAncientGemGUID.clear(); - - RageWinterchill = 0; - Anetheron = 0; - Kazrogal = 0; - Azgalor = 0; - Archimonde = 0; - JainaProudmoore = 0; - Thrall = 0; - TyrandeWhisperwind = 0; - HordeGate = 0; - ElfGate = 0; - ArchiYell = false; - RaidDamage = 0; - - Trash = 0; - - hordeRetreat = 0; - allianceRetreat = 0; + return new instance_mount_hyjal_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_mount_hyjal_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_mount_hyjal_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + std::list m_uiAncientGemGUID; + + uint64 RageWinterchill; + uint64 Anetheron; + uint64 Kazrogal; + uint64 Azgalor; + uint64 Archimonde; + uint64 JainaProudmoore; + uint64 Thrall; + uint64 TyrandeWhisperwind; + uint64 HordeGate; + uint64 ElfGate; + + uint32 Trash; + + uint32 hordeRetreat; + uint32 allianceRetreat; + bool ArchiYell; + + uint32 RaidDamage; + + #define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." + #define YELL_EFFORTS_NAME "Archimonde" + + void Initialize() { - case 182060: - HordeGate = pGo->GetGUID(); - if (allianceRetreat) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case 182061: - ElfGate = pGo->GetGUID(); - if (hordeRetreat) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case GO_ANCIENT_GEM: - m_uiAncientGemGUID.push_back(pGo->GetGUID()); - break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case 17767: RageWinterchill = pCreature->GetGUID(); break; - case 17808: Anetheron = pCreature->GetGUID(); break; - case 17888: Kazrogal = pCreature->GetGUID(); break; - case 17842: Azgalor = pCreature->GetGUID(); break; - case 17968: Archimonde = pCreature->GetGUID(); break; - case 17772: JainaProudmoore = pCreature->GetGUID(); break; - case 17852: Thrall = pCreature->GetGUID(); break; - case 17948: TyrandeWhisperwind = pCreature->GetGUID(); break; - } - } + m_uiAncientGemGUID.clear(); - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_RAGEWINTERCHILL: return RageWinterchill; - case DATA_ANETHERON: return Anetheron; - case DATA_KAZROGAL: return Kazrogal; - case DATA_AZGALOR: return Azgalor; - case DATA_ARCHIMONDE: return Archimonde; - case DATA_JAINAPROUDMOORE: return JainaProudmoore; - case DATA_THRALL: return Thrall; - case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; + RageWinterchill = 0; + Anetheron = 0; + Kazrogal = 0; + Azgalor = 0; + Archimonde = 0; + JainaProudmoore = 0; + Thrall = 0; + TyrandeWhisperwind = 0; + HordeGate = 0; + ElfGate = 0; + ArchiYell = false; + RaidDamage = 0; + + Trash = 0; + + hordeRetreat = 0; + allianceRetreat = 0; } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + bool IsEncounterInProgress() const { - case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break; - case DATA_ANETHERONEVENT: - m_auiEncounter[1] = data; - break; - case DATA_KAZROGALEVENT: m_auiEncounter[2] = data; break; - case DATA_AZGALOREVENT: - { - m_auiEncounter[3] = data; - if (data == DONE) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 182060: + HordeGate = pGo->GetGUID(); + if (allianceRetreat) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case 182061: + ElfGate = pGo->GetGUID(); + if (hordeRetreat) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case GO_ANCIENT_GEM: + m_uiAncientGemGUID.push_back(pGo->GetGUID()); + break; + } + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 17767: RageWinterchill = pCreature->GetGUID(); break; + case 17808: Anetheron = pCreature->GetGUID(); break; + case 17888: Kazrogal = pCreature->GetGUID(); break; + case 17842: Azgalor = pCreature->GetGUID(); break; + case 17968: Archimonde = pCreature->GetGUID(); break; + case 17772: JainaProudmoore = pCreature->GetGUID(); break; + case 17852: Thrall = pCreature->GetGUID(); break; + case 17948: TyrandeWhisperwind = pCreature->GetGUID(); break; + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_RAGEWINTERCHILL: return RageWinterchill; + case DATA_ANETHERON: return Anetheron; + case DATA_KAZROGAL: return Kazrogal; + case DATA_AZGALOR: return Azgalor; + case DATA_ARCHIMONDE: return Archimonde; + case DATA_JAINAPROUDMOORE: return JainaProudmoore; + case DATA_THRALL: return Thrall; + case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; + } + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break; + case DATA_ANETHERONEVENT: + m_auiEncounter[1] = data; + break; + case DATA_KAZROGALEVENT: m_auiEncounter[2] = data; break; + case DATA_AZGALOREVENT: { - if (ArchiYell)break; - ArchiYell = true; - - Creature* pCreature = instance->GetCreature(Azgalor); - if (pCreature) + m_auiEncounter[3] = data; + if (data == DONE) { - Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000); + if (ArchiYell)break; + ArchiYell = true; - Map* pMap = pCreature->GetMap(); - if (pMap->IsDungeon() && pUnit) + Creature* pCreature = instance->GetCreature(Azgalor); + if (pCreature) { - pUnit->SetVisibility(VISIBILITY_OFF); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) - return; + Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map* pMap = pCreature->GetMap(); + if (pMap->IsDungeon() && pUnit) { - if (i->getSource()) - { - WorldPacket data(SMSG_MESSAGECHAT, 200); - pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID()); - i->getSource()->GetSession()->SendPacket(&data); + pUnit->SetVisibility(VISIBILITY_OFF); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (PlayerList.isEmpty()) + return; - WorldPacket data2(SMSG_PLAY_SOUND, 4); - data2 << 10986; - i->getSource()->GetSession()->SendPacket(&data2); - } + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()) + { + WorldPacket data(SMSG_MESSAGECHAT, 200); + pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID()); + i->getSource()->GetSession()->SendPacket(&data); + + WorldPacket data2(SMSG_PLAY_SOUND, 4); + data2 << 10986; + i->getSource()->GetSession()->SendPacket(&data2); + } + } } } } } - } - break; - case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; - case DATA_RESET_TRASH_COUNT: Trash = 0; break; + break; + case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; + case DATA_RESET_TRASH_COUNT: Trash = 0; break; - case DATA_TRASH: - if (data) Trash = data; - else Trash--; - DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); - break; - case TYPE_RETREAT: - if (data == SPECIAL) - { - if (!m_uiAncientGemGUID.empty()) + case DATA_TRASH: + if (data) Trash = data; + else Trash--; + DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); + break; + case TYPE_RETREAT: + if (data == SPECIAL) { - for (std::list::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + if (!m_uiAncientGemGUID.empty()) { - //don't know how long it expected - DoRespawnGameObject(*itr,DAY); + for (std::list::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + { + //don't know how long it expected + DoRespawnGameObject(*itr,DAY); + } } } - } - break; - case DATA_ALLIANCE_RETREAT: - allianceRetreat = data; - HandleGameObject(HordeGate, true); + break; + case DATA_ALLIANCE_RETREAT: + allianceRetreat = data; + HandleGameObject(HordeGate, true); + SaveToDB(); + break; + case DATA_HORDE_RETREAT: + hordeRetreat = data; + HandleGameObject(ElfGate, true); + SaveToDB(); + break; + case DATA_RAIDDAMAGE: + RaidDamage += data; + if (RaidDamage >= MINRAIDDAMAGE) + RaidDamage = MINRAIDDAMAGE; + break; + case DATA_RESET_RAIDDAMAGE: + RaidDamage = 0; + break; + } + + sLog.outDebug("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] + << " " << allianceRetreat << " " << hordeRetreat + << " " << RaidDamage; + + str_data = saveStream.str(); + SaveToDB(); - break; - case DATA_HORDE_RETREAT: - hordeRetreat = data; - HandleGameObject(ElfGate, true); - SaveToDB(); - break; - case DATA_RAIDDAMAGE: - RaidDamage += data; - if (RaidDamage >= MINRAIDDAMAGE) - RaidDamage = MINRAIDDAMAGE; - break; - case DATA_RESET_RAIDDAMAGE: - RaidDamage = 0; - break; + OUT_SAVE_INST_DATA_COMPLETE; + } + } - sLog.outDebug("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); - - if (data == DONE) + uint32 GetData(uint32 type) { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] - << " " << allianceRetreat << " " << hordeRetreat - << " " << RaidDamage; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + switch(type) + { + case DATA_RAGEWINTERCHILLEVENT: return m_auiEncounter[0]; + case DATA_ANETHERONEVENT: return m_auiEncounter[1]; + case DATA_KAZROGALEVENT: return m_auiEncounter[2]; + case DATA_AZGALOREVENT: return m_auiEncounter[3]; + case DATA_ARCHIMONDEEVENT: return m_auiEncounter[4]; + case DATA_TRASH: return Trash; + case DATA_ALLIANCE_RETREAT: return allianceRetreat; + case DATA_HORDE_RETREAT: return hordeRetreat; + case DATA_RAIDDAMAGE: return RaidDamage; + } + return 0; } - } - - uint32 GetData(uint32 type) - { - switch(type) + std::string GetSaveData() { - case DATA_RAGEWINTERCHILLEVENT: return m_auiEncounter[0]; - case DATA_ANETHERONEVENT: return m_auiEncounter[1]; - case DATA_KAZROGALEVENT: return m_auiEncounter[2]; - case DATA_AZGALOREVENT: return m_auiEncounter[3]; - case DATA_ARCHIMONDEEVENT: return m_auiEncounter[4]; - case DATA_TRASH: return Trash; - case DATA_ALLIANCE_RETREAT: return allianceRetreat; - case DATA_HORDE_RETREAT: return hordeRetreat; - case DATA_RAIDDAMAGE: return RaidDamage; + return str_data; } - return 0; - } - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_mount_hyjal(Map* pMap) -{ - return new instance_mount_hyjal(pMap); -} void AddSC_instance_mount_hyjal() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_hyjal"; - newscript->GetInstanceData = &GetInstanceData_instance_mount_hyjal; - newscript->RegisterSelf(); + new instance_hyjal(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp index 7aa4b04a750..52f390e6232 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp @@ -48,108 +48,110 @@ enum Yells SAY_SLAY_3 = -1595007, //"You were destined to fail. " SAY_DEATH = -1595008 //"*gurgles*" }; - -struct boss_epochAI : public ScriptedAI + class boss_epoch : public CreatureScript { - boss_epochAI(Creature *c) : ScriptedAI(c) +public: + boss_epoch() : CreatureScript("boss_epoch") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_epochAI (pCreature); } - uint8 uiStep; - - uint32 uiStepTimer; - uint32 uiWoundingStrikeTimer; - uint32 uiTimeWarpTimer; - uint32 uiTimeStopTimer; - uint32 uiCurseOfExertionTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_epochAI : public ScriptedAI { - uiStep = 1; - uiStepTimer = 26000; - uiCurseOfExertionTimer = 9300; - uiTimeWarpTimer = 25300; - uiTimeStopTimer = 21300; - uiWoundingStrikeTimer = 5300; - - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiCurseOfExertionTimer < diff) + boss_epochAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CURSE_OF_EXERTION); + pInstance = c->GetInstanceScript(); + } + + uint8 uiStep; + + uint32 uiStepTimer; + uint32 uiWoundingStrikeTimer; + uint32 uiTimeWarpTimer; + uint32 uiTimeStopTimer; + uint32 uiCurseOfExertionTimer; + + InstanceScript* pInstance; + + void Reset() + { + uiStep = 1; + uiStepTimer = 26000; uiCurseOfExertionTimer = 9300; - } else uiCurseOfExertionTimer -= diff; - - if (uiWoundingStrikeTimer < diff) - { - DoCastVictim(SPELL_WOUNDING_STRIKE); - uiWoundingStrikeTimer = 5300; - } else uiWoundingStrikeTimer -= diff; - - if (uiTimeStopTimer < diff) - { - DoCastAOE(SPELL_TIME_STOP); - uiTimeStopTimer = 21300; - } else uiTimeStopTimer -= diff; - - if (uiTimeWarpTimer < diff) - { - DoScriptText(RAND(SAY_TIME_WARP_1,SAY_TIME_WARP_2,SAY_TIME_WARP_3), me); - DoCastAOE(SPELL_TIME_WARP); uiTimeWarpTimer = 25300; - } else uiTimeWarpTimer -= diff; + uiTimeStopTimer = 21300; + uiWoundingStrikeTimer = 5300; - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS); + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiCurseOfExertionTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CURSE_OF_EXERTION); + uiCurseOfExertionTimer = 9300; + } else uiCurseOfExertionTimer -= diff; + + if (uiWoundingStrikeTimer < diff) + { + DoCastVictim(SPELL_WOUNDING_STRIKE); + uiWoundingStrikeTimer = 5300; + } else uiWoundingStrikeTimer -= diff; + + if (uiTimeStopTimer < diff) + { + DoCastAOE(SPELL_TIME_STOP); + uiTimeStopTimer = 21300; + } else uiTimeStopTimer -= diff; + + if (uiTimeWarpTimer < diff) + { + DoScriptText(RAND(SAY_TIME_WARP_1,SAY_TIME_WARP_2,SAY_TIME_WARP_3), me); + DoCastAOE(SPELL_TIME_WARP); + uiTimeWarpTimer = 25300; + } else uiTimeWarpTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_epoch(Creature* pCreature) -{ - return new boss_epochAI (pCreature); -} void AddSC_boss_epoch() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_epoch"; - newscript->GetAI = &GetAI_boss_epoch; - newscript->RegisterSelf(); + new boss_epoch(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index 60a46159fa7..f6b7b06bf73 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -31,57 +31,59 @@ enum Yells SAY_DEATH = -1595047 }; - -struct boss_infinite_corruptorAI : public ScriptedAI + class boss_infinite_corruptor : public CreatureScript { - boss_infinite_corruptorAI(Creature *c) : ScriptedAI(c) +public: + boss_infinite_corruptor() : CreatureScript("boss_infinite_corruptor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_infinite_corruptorAI(pCreature); } - ScriptedInstance* pInstance; - - void Reset() + struct boss_infinite_corruptorAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, NOT_STARTED); - } + boss_infinite_corruptorAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS); - } + InstanceScript* pInstance; - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, NOT_STARTED); + } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, DONE); + } + }; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_infinite_corruptor(Creature* pCreature) -{ - return new boss_infinite_corruptorAI(pCreature); -} void AddSC_boss_infinite_corruptor() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_infinite_corruptor"; - newscript->GetAI = &GetAI_boss_infinite_corruptor; - newscript->RegisterSelf(); + new boss_infinite_corruptor(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index deabd11961f..c234c685980 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -66,196 +66,198 @@ enum CombatPhases COMBAT, OUTRO }; - -struct boss_mal_ganisAI : public ScriptedAI + class boss_mal_ganis : public CreatureScript { - boss_mal_ganisAI(Creature *c) : ScriptedAI(c) +public: + boss_mal_ganis() : CreatureScript("boss_mal_ganis") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_mal_ganisAI (pCreature); } - uint32 uiCarrionSwarmTimer; - uint32 uiMindBlastTimer; - uint32 uiVampiricTouchTimer; - uint32 uiSleepTimer; - - uint8 uiOutroStep; - uint32 uiOutroTimer; - - bool bYelled; - bool bYelled2; - - CombatPhases Phase; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_mal_ganisAI : public ScriptedAI { - bYelled = false; - bYelled2 = false; - Phase = COMBAT; - uiCarrionSwarmTimer = 6000; - uiMindBlastTimer = 11000; - uiVampiricTouchTimer = urand(10000,15000); - uiSleepTimer = urand(15000,20000); - uiOutroTimer = 1000; - - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = me->GetHealth()-1; - } - - void UpdateAI(const uint32 diff) - { - switch(Phase) + boss_mal_ganisAI(Creature *c) : ScriptedAI(c) { - case COMBAT: - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!bYelled && HealthBelowPct(30)) - { - DoScriptText(SAY_30HEALTH, me); - bYelled = true; - } - - if (!bYelled2 && HealthBelowPct(15)) - { - DoScriptText(SAY_15HEALTH, me); - bYelled2 = true; - } - - if (HealthBelowPct(1)) - { - //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - uiOutroStep = 1; - Phase = OUTRO; - return; - } - - if (Creature* pArthas = me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0)) - if (pArthas->isDead()) - { - EnterEvadeMode(); - me->DisappearAndDie(); - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, FAIL); - } - - if (uiCarrionSwarmTimer < diff) - { - DoCastVictim(SPELL_CARRION_SWARM); - uiCarrionSwarmTimer = 7000; - } else uiCarrionSwarmTimer -= diff; - - if (uiMindBlastTimer < diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MIND_BLAST); - uiMindBlastTimer = 6000; - } else uiMindBlastTimer -= diff; - - if (uiVampiricTouchTimer < diff) - { - DoCast(me, SPELL_VAMPIRIC_TOUCH); - uiVampiricTouchTimer = 32000; - } else uiVampiricTouchTimer -= diff; - - if (uiSleepTimer < diff) - { - DoScriptText(RAND(SAY_SLEEP_1,SAY_SLEEP_2), me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SLEEP); - uiSleepTimer = urand(15000,20000); - } else uiSleepTimer -= diff; - - DoMeleeAttackIfReady(); - break; - case OUTRO: - if (uiOutroTimer < diff) - { - switch(uiOutroStep) - { - case 1: - DoScriptText(SAY_ESCAPE_SPEECH_1, me); - me->GetMotionMaster()->MoveTargetedHome(); - ++uiOutroStep; - uiOutroTimer = 8000; - break; - case 2: - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); - me->HandleEmoteCommand(29); - DoScriptText(SAY_ESCAPE_SPEECH_2, me); - ++uiOutroStep; - uiOutroTimer = 9000; - break; - case 3: - DoScriptText(SAY_OUTRO, me); - ++uiOutroStep; - uiOutroTimer = 16000; - break; - case 4: - me->HandleEmoteCommand(33); - ++uiOutroStep; - uiOutroTimer = 500; - break; - case 5: - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); - break; - - } - } else uiOutroTimer -= diff; - break; + pInstance = c->GetInstanceScript(); } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + uint32 uiCarrionSwarmTimer; + uint32 uiMindBlastTimer; + uint32 uiVampiricTouchTimer; + uint32 uiSleepTimer; + + uint8 uiOutroStep; + uint32 uiOutroTimer; + + bool bYelled; + bool bYelled2; + + CombatPhases Phase; + + InstanceScript* pInstance; + + void Reset() { - pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); + bYelled = false; + bYelled2 = false; + Phase = COMBAT; + uiCarrionSwarmTimer = 6000; + uiMindBlastTimer = 11000; + uiVampiricTouchTimer = urand(10000,15000); + uiSleepTimer = urand(15000,20000); + uiOutroTimer = 1000; - // give achievement credit to players. criteria use spell 58630 which doesn't exist. + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); if (pInstance) - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = me->GetHealth()-1; + } + + void UpdateAI(const uint32 diff) + { + switch(Phase) + { + case COMBAT: + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bYelled && HealthBelowPct(30)) + { + DoScriptText(SAY_30HEALTH, me); + bYelled = true; + } + + if (!bYelled2 && HealthBelowPct(15)) + { + DoScriptText(SAY_15HEALTH, me); + bYelled2 = true; + } + + if (HealthBelowPct(1)) + { + //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + uiOutroStep = 1; + Phase = OUTRO; + return; + } + + if (Creature* pArthas = me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0)) + if (pArthas->isDead()) + { + EnterEvadeMode(); + me->DisappearAndDie(); + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, FAIL); + } + + if (uiCarrionSwarmTimer < diff) + { + DoCastVictim(SPELL_CARRION_SWARM); + uiCarrionSwarmTimer = 7000; + } else uiCarrionSwarmTimer -= diff; + + if (uiMindBlastTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MIND_BLAST); + uiMindBlastTimer = 6000; + } else uiMindBlastTimer -= diff; + + if (uiVampiricTouchTimer < diff) + { + DoCast(me, SPELL_VAMPIRIC_TOUCH); + uiVampiricTouchTimer = 32000; + } else uiVampiricTouchTimer -= diff; + + if (uiSleepTimer < diff) + { + DoScriptText(RAND(SAY_SLEEP_1,SAY_SLEEP_2), me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SLEEP); + uiSleepTimer = urand(15000,20000); + } else uiSleepTimer -= diff; + + DoMeleeAttackIfReady(); + break; + case OUTRO: + if (uiOutroTimer < diff) + { + switch(uiOutroStep) + { + case 1: + DoScriptText(SAY_ESCAPE_SPEECH_1, me); + me->GetMotionMaster()->MoveTargetedHome(); + ++uiOutroStep; + uiOutroTimer = 8000; + break; + case 2: + me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); + me->HandleEmoteCommand(29); + DoScriptText(SAY_ESCAPE_SPEECH_2, me); + ++uiOutroStep; + uiOutroTimer = 9000; + break; + case 3: + DoScriptText(SAY_OUTRO, me); + ++uiOutroStep; + uiOutroTimer = 16000; + break; + case 4: + me->HandleEmoteCommand(33); + ++uiOutroStep; + uiOutroTimer = 500; + break; + case 5: + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + break; + + } + } else uiOutroTimer -= diff; + break; + } + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); + + // give achievement credit to players. criteria use spell 58630 which doesn't exist. + if (pInstance) + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + } + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } }; -CreatureAI* GetAI_boss_mal_ganis(Creature* pCreature) -{ - return new boss_mal_ganisAI (pCreature); -} void AddSC_boss_mal_ganis() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_mal_ganis"; - newscript->GetAI = &GetAI_boss_mal_ganis; - newscript->RegisterSelf(); + new boss_mal_ganis(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index 4ab1c3023e6..65df6e4b6d0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -44,96 +44,98 @@ enum Yells SAY_SPAWN = -1595030, SAY_DEATH = -1595031 }; - -struct boss_meathookAI : public ScriptedAI + class boss_meathook : public CreatureScript { - boss_meathookAI(Creature *c) : ScriptedAI(c) +public: + boss_meathook() : CreatureScript("boss_meathook") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - if (pInstance) - DoScriptText(SAY_SPAWN,me); + return new boss_meathookAI (pCreature); } - uint32 uiChainTimer; - uint32 uiDiseaseTimer; - uint32 uiFrenzyTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_meathookAI : public ScriptedAI { - uiChainTimer = urand(12000,17000); //seen on video 13, 17, 15, 12, 16 - uiDiseaseTimer = urand(2000,4000); //approx 3s - uiFrenzyTimer = urand(21000,26000); //made it up - - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiDiseaseTimer <= diff) + boss_meathookAI(Creature *c) : ScriptedAI(c) { - DoCastAOE(SPELL_DISEASE_EXPULSION); - uiDiseaseTimer = urand(1500,4000); - } else uiDiseaseTimer -= diff; + pInstance = c->GetInstanceScript(); + if (pInstance) + DoScriptText(SAY_SPAWN,me); + } - if (uiFrenzyTimer <= diff) + uint32 uiChainTimer; + uint32 uiDiseaseTimer; + uint32 uiFrenzyTimer; + + InstanceScript* pInstance; + + void Reset() { - DoCast(me, SPELL_FRENZY); - uiFrenzyTimer = urand(21000,26000); - } else uiFrenzyTimer -= diff; + uiChainTimer = urand(12000,17000); //seen on video 13, 17, 15, 12, 16 + uiDiseaseTimer = urand(2000,4000); //approx 3s + uiFrenzyTimer = urand(21000,26000); //made it up - if (uiChainTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CONSTRICTING_CHAINS); //anyone but the tank - uiChainTimer = urand(2000,4000); - } else uiChainTimer -= diff; + DoScriptText(SAY_AGGRO, me); - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, DONE); - } + if (uiDiseaseTimer <= diff) + { + DoCastAOE(SPELL_DISEASE_EXPULSION); + uiDiseaseTimer = urand(1500,4000); + } else uiDiseaseTimer -= diff; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + if (uiFrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + uiFrenzyTimer = urand(21000,26000); + } else uiFrenzyTimer -= diff; + + if (uiChainTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CONSTRICTING_CHAINS); //anyone but the tank + uiChainTimer = urand(2000,4000); + } else uiChainTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_meathook(Creature* pCreature) -{ - return new boss_meathookAI (pCreature); -} void AddSC_boss_meathook() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_meathook"; - newscript->GetAI = &GetAI_boss_meathook; - newscript->RegisterSelf(); + new boss_meathook(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 98c8d34bb8a..f1b3d3899d9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -56,114 +56,116 @@ enum Yells SAY_SUMMON_GHOULS_1 = -1595043, SAY_SUMMON_GHOULS_2 = -1595044 }; - -struct boss_salrammAI : public ScriptedAI + class boss_salramm : public CreatureScript { - boss_salrammAI(Creature *c) : ScriptedAI(c) +public: + boss_salramm() : CreatureScript("boss_salramm") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - if (pInstance) - DoScriptText(SAY_SPAWN,me); + return new boss_salrammAI (pCreature); } - uint32 uiCurseFleshTimer; - uint32 uiExplodeGhoulTimer; - uint32 uiShadowBoltTimer; - uint32 uiStealFleshTimer; - uint32 uiSummonGhoulsTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_salrammAI : public ScriptedAI { - uiCurseFleshTimer = 30000; //30s DBM - uiExplodeGhoulTimer = urand(25000,28000); //approx 6 sec after summon ghouls - uiShadowBoltTimer = urand(8000,12000); // approx 10s - uiStealFleshTimer = 12345; - uiSummonGhoulsTimer = urand(19000,24000); //on a video approx 24s after aggro - - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Curse of twisted flesh timer - if (uiCurseFleshTimer <= diff) + boss_salrammAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_CURSE_OF_TWISTED_FLESH); - uiCurseFleshTimer = 37000; - } else uiCurseFleshTimer -= diff; + pInstance = c->GetInstanceScript(); + if (pInstance) + DoScriptText(SAY_SPAWN,me); + } - //Shadow bolt timer - if (uiShadowBoltTimer <= diff) + uint32 uiCurseFleshTimer; + uint32 uiExplodeGhoulTimer; + uint32 uiShadowBoltTimer; + uint32 uiStealFleshTimer; + uint32 uiSummonGhoulsTimer; + + InstanceScript* pInstance; + + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT); - uiShadowBoltTimer = urand(8000,12000); - } else uiShadowBoltTimer -= diff; + uiCurseFleshTimer = 30000; //30s DBM + uiExplodeGhoulTimer = urand(25000,28000); //approx 6 sec after summon ghouls + uiShadowBoltTimer = urand(8000,12000); // approx 10s + uiStealFleshTimer = 12345; + uiSummonGhoulsTimer = urand(19000,24000); //on a video approx 24s after aggro - //Steal Flesh timer - if (uiStealFleshTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), me); - if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(random_pTarget, SPELL_STEAL_FLESH); - uiStealFleshTimer = 10000; - } else uiStealFleshTimer -= diff; + DoScriptText(SAY_AGGRO, me); - //Summon ghouls timer - if (uiSummonGhoulsTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) { - DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), me); - if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(random_pTarget, SPELL_SUMMON_GHOULS); - uiSummonGhoulsTimer = 10000; - } else uiSummonGhoulsTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } + //Curse of twisted flesh timer + if (uiCurseFleshTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSE_OF_TWISTED_FLESH); + uiCurseFleshTimer = 37000; + } else uiCurseFleshTimer -= diff; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + //Shadow bolt timer + if (uiShadowBoltTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT); + uiShadowBoltTimer = urand(8000,12000); + } else uiShadowBoltTimer -= diff; - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, DONE); - } + //Steal Flesh timer + if (uiStealFleshTimer <= diff) + { + DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), me); + if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(random_pTarget, SPELL_STEAL_FLESH); + uiStealFleshTimer = 10000; + } else uiStealFleshTimer -= diff; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + //Summon ghouls timer + if (uiSummonGhoulsTimer <= diff) + { + DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), me); + if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(random_pTarget, SPELL_SUMMON_GHOULS); + uiSummonGhoulsTimer = 10000; + } else uiSummonGhoulsTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_salramm(Creature* pCreature) -{ - return new boss_salrammAI (pCreature); -} void AddSC_boss_salramm() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_salramm"; - newscript->GetAI = &GetAI_boss_salramm; - newscript->RegisterSelf(); + new boss_salramm(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index e2c3d9cde78..11d55f333f5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -218,992 +218,990 @@ float RiftAndSpawnsLocations[ENCOUNTER_CHRONO_SPAWNS][5]= {NPC_EPOCH, 2451.809326, 1112.901245, 149.220459, 3.363617} }; -struct npc_arthasAI : public npc_escortAI -{ - npc_arthasAI(Creature *pCreature) : npc_escortAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - Reset(); - } - - ScriptedInstance* pInstance; - - bool bStepping; - uint32 uiStep; - uint32 uiPhaseTimer; - uint32 uiGossipStep; - uint32 uiPlayerFaction; - uint32 uiBossEvent; - uint32 uiWave; - - uint64 uiUtherGUID; - uint64 uiJainaGUID; - uint64 uiCitymenGUID[2]; - uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; - uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; - uint64 uiStalkerGUID; - - uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID - uint64 uiEpochGUID; - uint64 uiMalganisGUID; - uint64 uiInfiniteGUID; - - uint32 uiExorcismTimer; - - void Reset() - { - uiUtherGUID = 0; - uiJainaGUID = 0; - - for (uint8 i = 0; i < 2; ++i) - uiCitymenGUID[i] = 0; - - for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - uiWaveGUID[i] = 0; - - for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) - uiInfiniteDraconianGUID[i] = 0; - - uiStalkerGUID = 0; - uiBossGUID = 0; - uiEpochGUID = 0; - uiMalganisGUID = 0; - uiInfiniteGUID = 0; - - if (pInstance) { - pInstance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); - switch(pInstance->GetData(DATA_ARTHAS_EVENT)) - { - case NOT_STARTED: - bStepping = true; - uiStep = 0; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - uiBossEvent = DATA_MEATHOOK_EVENT; - uiGossipStep = 0; - break; - } - uiPhaseTimer = 1000; - uiExorcismTimer = 7300; - uiWave = 0; - } - } - - void EnterCombat(Unit* /*who*/) - { - DoCast(me, SPELL_ARTHAS_AURA); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, FAIL); - } - - void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) - { - me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_DESPAWN,11000); - - for (uint32 i = timeRiftID+1; i < ENCOUNTER_CHRONO_SPAWNS; ++i) - { - if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_TIME_RIFT) break; - if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) - { - guidVector[i-timeRiftID-1] = pTemp->GetGUID(); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pTemp->SetReactState(REACT_PASSIVE); - pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); - if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) - uiEpochGUID = pTemp->GetGUID(); - } - } - } - - void SpawnWaveGroup(uint32 waveID, uint64* guidVector) - { - for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - { - if ((uint32)WavesLocations[waveID][i][0] == 0) break; - if (Creature* pTemp = me->SummonCreature((uint32)WavesLocations[waveID][i][0],WavesLocations[waveID][i][1],WavesLocations[waveID][i][2],WavesLocations[waveID][i][3],WavesLocations[waveID][i][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) - { - guidVector[i] = pTemp->GetGUID(); - } - } - } - - void SetHoldState(bool bOnHold) - { - SetEscortPaused(bOnHold); - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhaseTimer = uiTimer; - ++uiStep; - } - - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) - { - case 0: - case 1: - case 3: - case 9: - case 10: - case 11: - case 22: - case 23: - case 26: - case 55: - case 56: - SetHoldState(true); - bStepping = true; - break; - case 7: - if (Unit* pCityman0 = me->SummonCreature(NPC_CITY_MAN,2091.977f,1275.021f,140.757f,0.558f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) - uiCitymenGUID[0] = pCityman0->GetGUID(); - if (Unit* pCityman1 = me->SummonCreature(NPC_CITY_MAN2,2093.514f,1275.842f,140.408f,3.801f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) - uiCitymenGUID[1] = pCityman1->GetGUID(); - break; - case 8: - uiGossipStep = 1; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - case 12: - SetRun(true); - DoScriptText(SAY_PHASE210, me); - if (Unit* pDisguised0 = me->SummonCreature(NPC_CITY_MAN3,2398.14f,1207.81f,134.04f,5.155249f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID(); - if (Unit* pDisguised1 = me->SummonCreature(NPC_CITY_MAN4,2403.22f,1205.54f,134.04f,3.311264f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID(); - - if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN,2400.82f,1201.69f,134.01f,1.534082f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); - } - } - } - break; - case 20: - uiGossipStep = 2; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetRun(false); - SetHoldState(true); - break; - case 21: - DoScriptText(SAY_PHASE301, me); - break; - case 25: - SetRun(false); - SpawnTimeRift(0,&uiInfiniteDraconianGUID[0]); - DoScriptText(SAY_PHASE307,me); - break; - case 29: - SetRun(false); - SpawnTimeRift(5,&uiInfiniteDraconianGUID[0]); - SpawnTimeRift(8,&uiInfiniteDraconianGUID[2]); - DoScriptText(SAY_PHASE309,me); - SetHoldState(true); - bStepping = true; - break; - case 31: - SetRun(false); - SpawnTimeRift(11,&uiInfiniteDraconianGUID[0]); - SpawnTimeRift(14,&uiInfiniteDraconianGUID[2]); - DoScriptText(SAY_PHASE311,me); - SetHoldState(true); - bStepping = true; - break; - case 32: - DoScriptText(SAY_PHASE401,me); - break; - case 34: - DoScriptText(SAY_PHASE402,me); - break; - case 35: - DoScriptText(SAY_PHASE403,me); - break; - case 36: - if (pInstance) - { - GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE)); - pGate->SetGoState(GO_STATE_ACTIVE); - } - break; - case 45: - SetRun(true); - SetDespawnAtFar(false); - uiGossipStep = 4; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - case 47: - SetRun(false); - DoScriptText(SAY_PHASE405,me); - break; - case 48: - SetRun(true); - DoScriptText(SAY_PHASE406,me); - break; - case 53: - DoScriptText(SAY_PHASE407,me); - break; - case 54: - uiGossipStep = 5; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - DoMeleeAttackIfReady(); - - if (bStepping) - { - if (uiPhaseTimer <= diff) - { - switch(uiStep) - { - //After reset - case 0: - if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) - uiJainaGUID = pJaina->GetGUID(); - else if (Unit* pJaina = me->SummonCreature(NPC_JAINA,1895.48f,1292.66f,143.706f,0.023475f,TEMPSUMMON_DEAD_DESPAWN,180000)) - uiJainaGUID = pJaina->GetGUID(); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 0 - case 1: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (Unit* pUther = me->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiUtherGUID = pUther->GetGUID(); - pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); - pUther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); - } - JumpToNextStep(17000); - break; - case 2: - DoScriptText(SAY_PHASE101, me); - JumpToNextStep(2000); - break; - case 3: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - { - DoScriptText(SAY_PHASE102, pUther); - } - JumpToNextStep(8000); - break; - case 4: - SetEscortPaused(false); - bStepping = false; - SetRun(false); - DoScriptText(SAY_PHASE103, me); - JumpToNextStep(0); - break; - //After waypoint 1 - case 5: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - pJaina->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - DoScriptText(SAY_PHASE104, me); - JumpToNextStep(10000); - break; - case 6: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE105, pUther); - JumpToNextStep(1000); - break; - case 7: - DoScriptText(SAY_PHASE106, me); - JumpToNextStep(4000); - break; - case 8: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE107, pUther); - JumpToNextStep(6000); - break; - case 9: - DoScriptText(SAY_PHASE108, me); - JumpToNextStep(4000); - break; - case 10: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE109, pUther); - JumpToNextStep(8000); - break; - case 11: - DoScriptText(SAY_PHASE110, me); - JumpToNextStep(4000); - break; - case 12: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE111, pUther); - JumpToNextStep(4000); - break; - case 13: - DoScriptText(SAY_PHASE112, me); - JumpToNextStep(11000); - break; - case 14: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - DoScriptText(SAY_PHASE113, pJaina); - JumpToNextStep(3000); - break; - case 15: - DoScriptText(SAY_PHASE114, me); - JumpToNextStep(9000); - break; - case 16: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE115, pUther); - JumpToNextStep(4000); - break; - case 17: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - { - pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pUther->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); - } - JumpToNextStep(1000); - break; - case 18: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - { - me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); - pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pJaina->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); - } - JumpToNextStep(1000); - break; - case 19: - DoScriptText(SAY_PHASE116, me); - JumpToNextStep(1000); - break; - case 20: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - DoScriptText(SAY_PHASE117, pJaina); - JumpToNextStep(3000); - break; - case 21: - SetEscortPaused(false); - bStepping = false; - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After waypoint 3 - case 22: - DoScriptText(SAY_PHASE118, me); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); - JumpToNextStep(10000); - break; - case 23: - SetEscortPaused(false); - bStepping = false; - SetRun(true); - - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - pJaina->DisappearAndDie(); - - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - pUther->DisappearAndDie(); - - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After Gossip 1 (waypoint 8) - case 24: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2026.469f,1287.088f,143.596f,1.37f,TEMPSUMMON_TIMED_DESPAWN,14000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - JumpToNextStep(1000); - break; - case 25: - DoScriptText(SAY_PHASE201, me); - JumpToNextStep(12000); - break; - case 26: - SetEscortPaused(false); - bStepping = false; - SetRun(false); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After waypoint 9 - case 27: - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); - if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) - { - pCityman->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pCityman->GetMotionMaster()->MovePoint(0, 2088.625f,1279.191f,140.743f); - } - JumpToNextStep(2000); - break; - case 28: - if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) - DoScriptText(SAY_PHASE202, pCityman); - JumpToNextStep(4000); - break; - case 29: - SetEscortPaused(false); - bStepping = false; - DoScriptText(SAY_PHASE203, me); - JumpToNextStep(0); - break; - //After waypoint 10 - case 30: - me->HandleEmoteCommand(37); - JumpToNextStep(1000); - break; - case 31: - SetEscortPaused(false); - bStepping = false; - if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) - { - DoScriptText(SAY_PHASE204, pCityman1); - pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) - pCityman0->Kill(pCityman0); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); - } - JumpToNextStep(0); - break; - //After waypoint 11 - case 32: - me->HandleEmoteCommand(37); - JumpToNextStep(1000); - break; - case 33: - if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) - pCityman1->Kill(pCityman1); - JumpToNextStep(1000); - break; - case 34: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - DoScriptText(SAY_PHASE205, me); - JumpToNextStep(3000); - break; - case 35: - if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) - { - uiStalkerGUID = pStalkerM->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - JumpToNextStep(1000); - break; - case 36: - if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) - { - if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID)) - pMalganis->CastSpell(pStalkerM,63793,false); - - uiMalganisGUID = pMalganis->GetGUID(); - DoScriptText(SAY_PHASE206, pMalganis); - pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - pMalganis->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(11000); - break; - case 37: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - { - if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else //There's no one else to transform - uiStep++; - } - else - uiStep++; - uiPhaseTimer = 500; - break; - case 38: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - DoScriptText(SAY_PHASE207, pMalganis); - JumpToNextStep(17000); - break; - case 39: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - pMalganis->SetVisibility(VISIBILITY_OFF); - DoScriptText(SAY_PHASE208, me); - JumpToNextStep(7000); - break; - case 40: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - DoScriptText(SAY_PHASE209, me); - - uiBossEvent = DATA_MEATHOOK_EVENT; - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS); - - me->SetReactState(REACT_DEFENSIVE); - SetDespawnAtFar(false); - JumpToNextStep(5000); - break; - case 41: //Summon wave group - case 43: - case 45: - case 47: - case 51: - case 53: - case 55: - case 57: - if (pInstance->GetData(uiBossEvent) != DONE) - { - SpawnWaveGroup(uiWave, uiWaveGUID); - uiWave++; - } - JumpToNextStep(500); - break; - case 42: //Wait group to die - case 44: - case 46: - case 48: - case 52: - case 54: - case 56: - case 58: - if (pInstance->GetData(uiBossEvent) != DONE) - { - uint32 mobCounter = 0; - uint32 deadCounter = 0; - for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - { - if (uiWaveGUID[i] == 0) - break; - ++mobCounter; - Unit* pTemp = Unit::GetCreature(*me, uiWaveGUID[i]); - if (!pTemp || pTemp->isDead()) - ++deadCounter; - } - - if (mobCounter <= deadCounter) //If group is dead - JumpToNextStep(1000); - else - uiPhaseTimer = 1000; - } - else - JumpToNextStep(500); - break; - case 49: //Summon Boss - case 59: - if (pInstance->GetData(uiBossEvent) != DONE) - { - uint32 uiBossID = 0; - if (uiBossEvent == DATA_MEATHOOK_EVENT) - uiBossID = NPC_MEATHOOK; - else if (uiBossEvent == DATA_SALRAMM_EVENT) - uiBossID = NPC_SALRAMM; - - if (Unit* pBoss = me->SummonCreature(uiBossID,2232.19f,1331.933f,126.662f,3.15f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) - { - uiBossGUID = pBoss->GetGUID(); - pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pBoss->GetMotionMaster()->MovePoint(0, 2194.110f,1332.00f,130.00f); - } - } - JumpToNextStep(30000); - break; - case 50: //Wait Boss death - case 60: - if (pInstance) - { - if (pInstance->GetData(uiBossEvent) == DONE) - { - JumpToNextStep(1000); - if (uiBossEvent == DATA_MEATHOOK_EVENT) - uiBossEvent = DATA_SALRAMM_EVENT; - else if (uiBossEvent == DATA_SALRAMM_EVENT) - { - SetHoldState(false); - bStepping = false; - uiBossEvent = DATA_EPOCH_EVENT; - } - } - else if (pInstance->GetData(uiBossEvent) == FAIL) - npc_escortAI::EnterEvadeMode(); - else - uiPhaseTimer = 10000; - } - break; - //After Gossip 2 (waypoint 22) - case 61: - me->SetReactState(REACT_AGGRESSIVE); - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - JumpToNextStep(1000); - break; - case 62: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - DoScriptText(SAY_PHASE302, pDisguised0); - JumpToNextStep(7000); - break; - case 63: - DoScriptText(SAY_PHASE303, me); - SetHoldState(false); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 23 - case 64: - me->HandleEmoteCommand(54); - JumpToNextStep(1000); - break; - case 65: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - pDisguised0->HandleEmoteCommand(11); - JumpToNextStep(1000); - break; - case 66: - DoScriptText(SAY_PHASE304,me); - JumpToNextStep(2000); - break; - case 67: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - DoScriptText(SAY_PHASE305,pDisguised0); - JumpToNextStep(1000); - break; - case 68: - if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) - { - pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); - //Make them unattackable - pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised2->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 69: - if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) - { - pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); - //Make them unattackable - pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised1->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 70: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - { - pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); - //Make them unattackable - pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised0->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 71: - //After waypoint 26,29,31 - case 73: - case 75: - case 77: - //Make cratures attackable - for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pTemp->SetReactState(REACT_AGGRESSIVE); - } - JumpToNextStep(5000); - break; - case 72: - case 74: - case 76: - if (me->isInCombat()) - uiPhaseTimer = 1000; - else - { - if (uiStep == 72) DoScriptText(SAY_PHASE308,me); - if (uiStep == 74) DoScriptText(SAY_PHASE308,me); - if (uiStep == 76) DoScriptText(SAY_PHASE310,me); - SetHoldState(false); - bStepping = false; - SetRun(true); - JumpToNextStep(2000); - } - break; - case 78: - if (me->isInCombat()) - uiPhaseTimer = 1000; - else - { - DoScriptText(SAY_PHASE312,me); - JumpToNextStep(5000); - } - break; - case 79: - DoScriptText(SAY_PHASE313,me); - JumpToNextStep(1000); - break; - case 80: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) - { - SpawnTimeRift(17,&uiEpochGUID); - if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) - DoScriptText(SAY_PHASE314,pEpoch); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); - } - JumpToNextStep(18000); - break; - case 81: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) - DoScriptText(SAY_PHASE315, me); - JumpToNextStep(6000); - break; - case 82: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) - { - if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) - { - //Make Epoch attackable - pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pEpoch->SetReactState(REACT_AGGRESSIVE); - } - - } - JumpToNextStep(1000); - break; - case 83: - if (pInstance) - { - if (pInstance->GetData(DATA_EPOCH_EVENT) == DONE) - { - uiGossipStep = 3; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - bStepping = false; - uiBossEvent = DATA_MAL_GANIS_EVENT; - JumpToNextStep(15000); - } - else if (pInstance->GetData(DATA_EPOCH_EVENT) == FAIL) - npc_escortAI::EnterEvadeMode(); - else - uiPhaseTimer = 10000; - } - break; - //After Gossip 4 - case 84: - DoScriptText(SAY_PHASE404,me); - SetHoldState(false); - bStepping = false; - break; - //After Gossip 5 - case 85: - DoScriptText(SAY_PHASE501, me); - if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) - { - uiMalganisGUID = pMalganis->GetGUID(); - pMalganis->SetReactState(REACT_PASSIVE); - } - if (pInstance) - { - GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAL_GANIS_GATE_1)); - pGate->SetGoState(GO_STATE_ACTIVE); - } - SetHoldState(false); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 55 - case 86: - DoScriptText(SAY_PHASE502, me); - JumpToNextStep(6000); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); - break; - case 87: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - { - pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); - pMalganis->SetReactState(REACT_AGGRESSIVE); - } - JumpToNextStep(1000); - break; - case 88: - if (pInstance) - { - if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == DONE) - { - SetHoldState(false); - JumpToNextStep(1000); - } - else if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == FAIL) - npc_escortAI::EnterEvadeMode(); - else - uiPhaseTimer = 10000; - } - break; - //After waypoint 56 - case 89: - SetRun(true); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); - DoScriptText(SAY_PHASE503, me); - JumpToNextStep(7000); - break; - case 90: - if (pInstance) - { - pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind - } - DoScriptText(SAY_PHASE504, me); - bStepping = false; - break; - } - } else uiPhaseTimer -= diff; - } - - //Battling skills - if (!me->getVictim()) - return; - - if (uiExorcismTimer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target, SPELL_EXORCISM_N); - uiExorcismTimer = 7300; - } else uiExorcismTimer -= diff; - - if (HealthBelowPct(40)) - DoCast(me, SPELL_HOLY_LIGHT); - } -}; - -CreatureAI* GetAI_npc_arthas(Creature* pCreature) -{ - return new npc_arthasAI(pCreature); -} - #define GOSSIP_ITEM_ARTHAS_0 "I'm ready to start Culling of Stratholme." #define GOSSIP_ITEM_ARTHAS_1 "Yes, my Prince. We're ready." #define GOSSIP_ITEM_ARTHAS_2 "We're only doing what is best for Loarderon your Highness." #define GOSSIP_ITEM_ARTHAS_3 "I'm ready." #define GOSSIP_ITEM_ARTHAS_4 "For Lordaeron!" #define GOSSIP_ITEM_ARTHAS_5 "I'm ready to battle the dreadlord, sire." - -bool GossipHello_npc_arthas(Player* pPlayer, Creature* pCreature) + class npc_arthas : public CreatureScript { - npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); +public: + npc_arthas() : CreatureScript("npc_arthas") { } - if (pAI && pAI->bStepping == false) + bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 /*sender*/, uint32 action) { - switch (pAI->uiGossipStep) + npc_arthasAI* pAI = CAST_AI(npc_arthas::npc_arthasAI,pCreature->AI()); + + if (!pAI) + return false; + + switch (action) { - case 0: //This one is a workaround since the very beggining of the script is wrong. - if (pPlayer->GetQuestStatus(13149) != QUEST_STATUS_COMPLETE) - return false; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF: + pAI->Start(true,true,pPlayer->GetGUID(),0,false,false); + pAI->SetDespawnAtEnd(false); + pAI->bStepping = false; + pAI->uiStep = 1; break; - case 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF+1: + pAI->bStepping = true; + pAI->uiStep = 24; break; - case 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF+2: + pAI->SetHoldState(false); + pAI->bStepping = false; + pAI->uiStep = 61; break; - case 3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF+3: + pAI->SetHoldState(false); break; - case 4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF+4: + pAI->bStepping = true; + pAI->uiStep = 84; break; - case 5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, pCreature->GetGUID()); + case GOSSIP_ACTION_INFO_DEF+5: + pAI->bStepping = true; + pAI->uiStep = 85; break; - default: - return false; } + pPlayer->CLOSE_GOSSIP_MENU(); + pAI->SetDespawnAtFar(true); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; } - return true; -} - -bool GossipSelect_npc_arthas(Player *pPlayer, Creature *pCreature, uint32 /*sender*/, uint32 action) -{ - npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); - - if (!pAI) - return false; - - switch (action) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF: - pAI->Start(true,true,pPlayer->GetGUID(),0,false,false); - pAI->SetDespawnAtEnd(false); - pAI->bStepping = false; - pAI->uiStep = 1; - break; - case GOSSIP_ACTION_INFO_DEF+1: - pAI->bStepping = true; - pAI->uiStep = 24; - break; - case GOSSIP_ACTION_INFO_DEF+2: - pAI->SetHoldState(false); - pAI->bStepping = false; - pAI->uiStep = 61; - break; - case GOSSIP_ACTION_INFO_DEF+3: - pAI->SetHoldState(false); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pAI->bStepping = true; - pAI->uiStep = 84; - break; - case GOSSIP_ACTION_INFO_DEF+5: - pAI->bStepping = true; - pAI->uiStep = 85; - break; + npc_arthasAI* pAI = CAST_AI(npc_arthas::npc_arthasAI,pCreature->AI()); + + if (pAI && pAI->bStepping == false) + { + switch (pAI->uiGossipStep) + { + case 0: //This one is a workaround since the very beggining of the script is wrong. + if (pPlayer->GetQuestStatus(13149) != QUEST_STATUS_COMPLETE) + return false; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + break; + case 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, pCreature->GetGUID()); + break; + case 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, pCreature->GetGUID()); + break; + case 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, pCreature->GetGUID()); + break; + case 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, pCreature->GetGUID()); + break; + case 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, pCreature->GetGUID()); + break; + default: + return false; + } + } + return true; } - pPlayer->CLOSE_GOSSIP_MENU(); - pAI->SetDespawnAtFar(true); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - return true; -} + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_arthasAI(pCreature); + } + + struct npc_arthasAI : public npc_escortAI + { + npc_arthasAI(Creature *pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + Reset(); + } + + InstanceScript* pInstance; + + bool bStepping; + uint32 uiStep; + uint32 uiPhaseTimer; + uint32 uiGossipStep; + uint32 uiPlayerFaction; + uint32 uiBossEvent; + uint32 uiWave; + + uint64 uiUtherGUID; + uint64 uiJainaGUID; + uint64 uiCitymenGUID[2]; + uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; + uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; + uint64 uiStalkerGUID; + + uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID + uint64 uiEpochGUID; + uint64 uiMalganisGUID; + uint64 uiInfiniteGUID; + + uint32 uiExorcismTimer; + + void Reset() + { + uiUtherGUID = 0; + uiJainaGUID = 0; + + for (uint8 i = 0; i < 2; ++i) + uiCitymenGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + uiWaveGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) + uiInfiniteDraconianGUID[i] = 0; + + uiStalkerGUID = 0; + uiBossGUID = 0; + uiEpochGUID = 0; + uiMalganisGUID = 0; + uiInfiniteGUID = 0; + + if (pInstance) { + pInstance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); + switch(pInstance->GetData(DATA_ARTHAS_EVENT)) + { + case NOT_STARTED: + bStepping = true; + uiStep = 0; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + uiBossEvent = DATA_MEATHOOK_EVENT; + uiGossipStep = 0; + break; + } + uiPhaseTimer = 1000; + uiExorcismTimer = 7300; + uiWave = 0; + } + } + + void EnterCombat(Unit* /*who*/) + { + DoCast(me, SPELL_ARTHAS_AURA); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, FAIL); + } + + void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) + { + me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_DESPAWN,11000); + + for (uint32 i = timeRiftID+1; i < ENCOUNTER_CHRONO_SPAWNS; ++i) + { + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_TIME_RIFT) break; + if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i-timeRiftID-1] = pTemp->GetGUID(); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_PASSIVE); + pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) + uiEpochGUID = pTemp->GetGUID(); + } + } + } + + void SpawnWaveGroup(uint32 waveID, uint64* guidVector) + { + for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + { + if ((uint32)WavesLocations[waveID][i][0] == 0) break; + if (Creature* pTemp = me->SummonCreature((uint32)WavesLocations[waveID][i][0],WavesLocations[waveID][i][1],WavesLocations[waveID][i][2],WavesLocations[waveID][i][3],WavesLocations[waveID][i][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i] = pTemp->GetGUID(); + } + } + } + + void SetHoldState(bool bOnHold) + { + SetEscortPaused(bOnHold); + } + + void JumpToNextStep(uint32 uiTimer) + { + uiPhaseTimer = uiTimer; + ++uiStep; + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + case 1: + case 3: + case 9: + case 10: + case 11: + case 22: + case 23: + case 26: + case 55: + case 56: + SetHoldState(true); + bStepping = true; + break; + case 7: + if (Unit* pCityman0 = me->SummonCreature(NPC_CITY_MAN,2091.977f,1275.021f,140.757f,0.558f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[0] = pCityman0->GetGUID(); + if (Unit* pCityman1 = me->SummonCreature(NPC_CITY_MAN2,2093.514f,1275.842f,140.408f,3.801f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[1] = pCityman1->GetGUID(); + break; + case 8: + uiGossipStep = 1; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 12: + SetRun(true); + DoScriptText(SAY_PHASE210, me); + if (Unit* pDisguised0 = me->SummonCreature(NPC_CITY_MAN3,2398.14f,1207.81f,134.04f,5.155249f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID(); + if (Unit* pDisguised1 = me->SummonCreature(NPC_CITY_MAN4,2403.22f,1205.54f,134.04f,3.311264f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID(); + + if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN,2400.82f,1201.69f,134.01f,1.534082f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + } + } + } + break; + case 20: + uiGossipStep = 2; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetRun(false); + SetHoldState(true); + break; + case 21: + DoScriptText(SAY_PHASE301, me); + break; + case 25: + SetRun(false); + SpawnTimeRift(0,&uiInfiniteDraconianGUID[0]); + DoScriptText(SAY_PHASE307,me); + break; + case 29: + SetRun(false); + SpawnTimeRift(5,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(8,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE309,me); + SetHoldState(true); + bStepping = true; + break; + case 31: + SetRun(false); + SpawnTimeRift(11,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(14,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE311,me); + SetHoldState(true); + bStepping = true; + break; + case 32: + DoScriptText(SAY_PHASE401,me); + break; + case 34: + DoScriptText(SAY_PHASE402,me); + break; + case 35: + DoScriptText(SAY_PHASE403,me); + break; + case 36: + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + break; + case 45: + SetRun(true); + SetDespawnAtFar(false); + uiGossipStep = 4; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 47: + SetRun(false); + DoScriptText(SAY_PHASE405,me); + break; + case 48: + SetRun(true); + DoScriptText(SAY_PHASE406,me); + break; + case 53: + DoScriptText(SAY_PHASE407,me); + break; + case 54: + uiGossipStep = 5; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + } + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + DoMeleeAttackIfReady(); + + if (bStepping) + { + if (uiPhaseTimer <= diff) + { + switch(uiStep) + { + //After reset + case 0: + if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) + uiJainaGUID = pJaina->GetGUID(); + else if (Unit* pJaina = me->SummonCreature(NPC_JAINA,1895.48f,1292.66f,143.706f,0.023475f,TEMPSUMMON_DEAD_DESPAWN,180000)) + uiJainaGUID = pJaina->GetGUID(); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 0 + case 1: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (Unit* pUther = me->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiUtherGUID = pUther->GetGUID(); + pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); + pUther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); + } + JumpToNextStep(17000); + break; + case 2: + DoScriptText(SAY_PHASE101, me); + JumpToNextStep(2000); + break; + case 3: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + DoScriptText(SAY_PHASE102, pUther); + } + JumpToNextStep(8000); + break; + case 4: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + DoScriptText(SAY_PHASE103, me); + JumpToNextStep(0); + break; + //After waypoint 1 + case 5: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + DoScriptText(SAY_PHASE104, me); + JumpToNextStep(10000); + break; + case 6: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE105, pUther); + JumpToNextStep(1000); + break; + case 7: + DoScriptText(SAY_PHASE106, me); + JumpToNextStep(4000); + break; + case 8: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE107, pUther); + JumpToNextStep(6000); + break; + case 9: + DoScriptText(SAY_PHASE108, me); + JumpToNextStep(4000); + break; + case 10: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE109, pUther); + JumpToNextStep(8000); + break; + case 11: + DoScriptText(SAY_PHASE110, me); + JumpToNextStep(4000); + break; + case 12: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE111, pUther); + JumpToNextStep(4000); + break; + case 13: + DoScriptText(SAY_PHASE112, me); + JumpToNextStep(11000); + break; + case 14: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE113, pJaina); + JumpToNextStep(3000); + break; + case 15: + DoScriptText(SAY_PHASE114, me); + JumpToNextStep(9000); + break; + case 16: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE115, pUther); + JumpToNextStep(4000); + break; + case 17: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 18: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + { + me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pJaina->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 19: + DoScriptText(SAY_PHASE116, me); + JumpToNextStep(1000); + break; + case 20: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE117, pJaina); + JumpToNextStep(3000); + break; + case 21: + SetEscortPaused(false); + bStepping = false; + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 3 + case 22: + DoScriptText(SAY_PHASE118, me); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + JumpToNextStep(10000); + break; + case 23: + SetEscortPaused(false); + bStepping = false; + SetRun(true); + + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->DisappearAndDie(); + + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + pUther->DisappearAndDie(); + + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After Gossip 1 (waypoint 8) + case 24: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2026.469f,1287.088f,143.596f,1.37f,TEMPSUMMON_TIMED_DESPAWN,14000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 25: + DoScriptText(SAY_PHASE201, me); + JumpToNextStep(12000); + break; + case 26: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 9 + case 27: + me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + { + pCityman->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pCityman->GetMotionMaster()->MovePoint(0, 2088.625f,1279.191f,140.743f); + } + JumpToNextStep(2000); + break; + case 28: + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + DoScriptText(SAY_PHASE202, pCityman); + JumpToNextStep(4000); + break; + case 29: + SetEscortPaused(false); + bStepping = false; + DoScriptText(SAY_PHASE203, me); + JumpToNextStep(0); + break; + //After waypoint 10 + case 30: + me->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 31: + SetEscortPaused(false); + bStepping = false; + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + { + DoScriptText(SAY_PHASE204, pCityman1); + pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) + pCityman0->Kill(pCityman0); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); + } + JumpToNextStep(0); + break; + //After waypoint 11 + case 32: + me->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 33: + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + pCityman1->Kill(pCityman1); + JumpToNextStep(1000); + break; + case 34: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE205, me); + JumpToNextStep(3000); + break; + case 35: + if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + uiStalkerGUID = pStalkerM->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 36: + if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID)) + pMalganis->CastSpell(pStalkerM,63793,false); + + uiMalganisGUID = pMalganis->GetGUID(); + DoScriptText(SAY_PHASE206, pMalganis); + pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pMalganis->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(11000); + break; + case 37: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else //There's no one else to transform + uiStep++; + } + else + uiStep++; + uiPhaseTimer = 500; + break; + case 38: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + DoScriptText(SAY_PHASE207, pMalganis); + JumpToNextStep(17000); + break; + case 39: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + pMalganis->SetVisibility(VISIBILITY_OFF); + DoScriptText(SAY_PHASE208, me); + JumpToNextStep(7000); + break; + case 40: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE209, me); + + uiBossEvent = DATA_MEATHOOK_EVENT; + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS); + + me->SetReactState(REACT_DEFENSIVE); + SetDespawnAtFar(false); + JumpToNextStep(5000); + break; + case 41: //Summon wave group + case 43: + case 45: + case 47: + case 51: + case 53: + case 55: + case 57: + if (pInstance->GetData(uiBossEvent) != DONE) + { + SpawnWaveGroup(uiWave, uiWaveGUID); + uiWave++; + } + JumpToNextStep(500); + break; + case 42: //Wait group to die + case 44: + case 46: + case 48: + case 52: + case 54: + case 56: + case 58: + if (pInstance->GetData(uiBossEvent) != DONE) + { + uint32 mobCounter = 0; + uint32 deadCounter = 0; + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + { + if (uiWaveGUID[i] == 0) + break; + ++mobCounter; + Unit* pTemp = Unit::GetCreature(*me, uiWaveGUID[i]); + if (!pTemp || pTemp->isDead()) + ++deadCounter; + } + + if (mobCounter <= deadCounter) //If group is dead + JumpToNextStep(1000); + else + uiPhaseTimer = 1000; + } + else + JumpToNextStep(500); + break; + case 49: //Summon Boss + case 59: + if (pInstance->GetData(uiBossEvent) != DONE) + { + uint32 uiBossID = 0; + if (uiBossEvent == DATA_MEATHOOK_EVENT) + uiBossID = NPC_MEATHOOK; + else if (uiBossEvent == DATA_SALRAMM_EVENT) + uiBossID = NPC_SALRAMM; + + if (Unit* pBoss = me->SummonCreature(uiBossID,2232.19f,1331.933f,126.662f,3.15f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + uiBossGUID = pBoss->GetGUID(); + pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pBoss->GetMotionMaster()->MovePoint(0, 2194.110f,1332.00f,130.00f); + } + } + JumpToNextStep(30000); + break; + case 50: //Wait Boss death + case 60: + if (pInstance) + { + if (pInstance->GetData(uiBossEvent) == DONE) + { + JumpToNextStep(1000); + if (uiBossEvent == DATA_MEATHOOK_EVENT) + uiBossEvent = DATA_SALRAMM_EVENT; + else if (uiBossEvent == DATA_SALRAMM_EVENT) + { + SetHoldState(false); + bStepping = false; + uiBossEvent = DATA_EPOCH_EVENT; + } + } + else if (pInstance->GetData(uiBossEvent) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After Gossip 2 (waypoint 22) + case 61: + me->SetReactState(REACT_AGGRESSIVE); + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + JumpToNextStep(1000); + break; + case 62: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE302, pDisguised0); + JumpToNextStep(7000); + break; + case 63: + DoScriptText(SAY_PHASE303, me); + SetHoldState(false); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 23 + case 64: + me->HandleEmoteCommand(54); + JumpToNextStep(1000); + break; + case 65: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->HandleEmoteCommand(11); + JumpToNextStep(1000); + break; + case 66: + DoScriptText(SAY_PHASE304,me); + JumpToNextStep(2000); + break; + case 67: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE305,pDisguised0); + JumpToNextStep(1000); + break; + case 68: + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) + { + pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); + //Make them unattackable + pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised2->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 69: + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) + { + pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); + //Make them unattackable + pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised1->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 70: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + { + pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); + //Make them unattackable + pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised0->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(2000); + break; + case 71: + //After waypoint 26,29,31 + case 73: + case 75: + case 77: + //Make cratures attackable + for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) + { + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(5000); + break; + case 72: + case 74: + case 76: + if (me->isInCombat()) + uiPhaseTimer = 1000; + else + { + if (uiStep == 72) DoScriptText(SAY_PHASE308,me); + if (uiStep == 74) DoScriptText(SAY_PHASE308,me); + if (uiStep == 76) DoScriptText(SAY_PHASE310,me); + SetHoldState(false); + bStepping = false; + SetRun(true); + JumpToNextStep(2000); + } + break; + case 78: + if (me->isInCombat()) + uiPhaseTimer = 1000; + else + { + DoScriptText(SAY_PHASE312,me); + JumpToNextStep(5000); + } + break; + case 79: + DoScriptText(SAY_PHASE313,me); + JumpToNextStep(1000); + break; + case 80: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + SpawnTimeRift(17,&uiEpochGUID); + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + DoScriptText(SAY_PHASE314,pEpoch); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); + } + JumpToNextStep(18000); + break; + case 81: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + DoScriptText(SAY_PHASE315, me); + JumpToNextStep(6000); + break; + case 82: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + { + //Make Epoch attackable + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pEpoch->SetReactState(REACT_AGGRESSIVE); + } + + } + JumpToNextStep(1000); + break; + case 83: + if (pInstance) + { + if (pInstance->GetData(DATA_EPOCH_EVENT) == DONE) + { + uiGossipStep = 3; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + bStepping = false; + uiBossEvent = DATA_MAL_GANIS_EVENT; + JumpToNextStep(15000); + } + else if (pInstance->GetData(DATA_EPOCH_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After Gossip 4 + case 84: + DoScriptText(SAY_PHASE404,me); + SetHoldState(false); + bStepping = false; + break; + //After Gossip 5 + case 85: + DoScriptText(SAY_PHASE501, me); + if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + uiMalganisGUID = pMalganis->GetGUID(); + pMalganis->SetReactState(REACT_PASSIVE); + } + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAL_GANIS_GATE_1)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + SetHoldState(false); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 55 + case 86: + DoScriptText(SAY_PHASE502, me); + JumpToNextStep(6000); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + break; + case 87: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); + pMalganis->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(1000); + break; + case 88: + if (pInstance) + { + if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == DONE) + { + SetHoldState(false); + JumpToNextStep(1000); + } + else if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After waypoint 56 + case 89: + SetRun(true); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + DoScriptText(SAY_PHASE503, me); + JumpToNextStep(7000); + break; + case 90: + if (pInstance) + { + pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D + me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind + } + DoScriptText(SAY_PHASE504, me); + bStepping = false; + break; + } + } else uiPhaseTimer -= diff; + } + + //Battling skills + if (!me->getVictim()) + return; + + if (uiExorcismTimer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target, SPELL_EXORCISM_N); + uiExorcismTimer = 7300; + } else uiExorcismTimer -= diff; + + if (HealthBelowPct(40)) + DoCast(me, SPELL_HOLY_LIGHT); + } + }; + +}; void AddSC_culling_of_stratholme() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_arthas"; - newscript->GetAI = &GetAI_npc_arthas; - newscript->pGossipHello = &GossipHello_npc_arthas; - newscript->pGossipSelect = &GossipSelect_npc_arthas; - newscript->RegisterSelf(); + new npc_arthas(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index a64a0a03976..b325c0175c1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -27,217 +27,220 @@ 3 - Mal'Ganis 4 - Infinite Corruptor (Heroic only) */ - -struct instance_culling_of_stratholme : public ScriptedInstance + class instance_culling_of_stratholme : public InstanceMapScript { - instance_culling_of_stratholme(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_culling_of_stratholme() : InstanceMapScript("instance_culling_of_stratholme") { } - uint64 uiArthas; - uint64 uiMeathook; - uint64 uiSalramm; - uint64 uiEpoch; - uint64 uiMalGanis; - uint64 uiInfinite; - - uint64 uiShkafGate; - uint64 uiMalGanisGate1; - uint64 uiMalGanisGate2; - uint64 uiExitGate; - uint64 uiMalGanisChest; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - bool IsEncounterInProgress() const + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; - - return false; + return new instance_culling_of_stratholme_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_culling_of_stratholme_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_culling_of_stratholme_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 uiArthas; + uint64 uiMeathook; + uint64 uiSalramm; + uint64 uiEpoch; + uint64 uiMalGanis; + uint64 uiInfinite; + + uint64 uiShkafGate; + uint64 uiMalGanisGate1; + uint64 uiMalGanisGate2; + uint64 uiExitGate; + uint64 uiMalGanisChest; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + bool IsEncounterInProgress() const { - case NPC_ARTHAS: - uiArthas = pCreature->GetGUID(); - break; - case NPC_MEATHOOK: - uiMeathook = pCreature->GetGUID(); - break; - case NPC_SALRAMM: - uiSalramm = pCreature->GetGUID(); - break; - case NPC_EPOCH: - uiEpoch = pCreature->GetGUID(); - break; - case NPC_MAL_GANIS: - uiMalGanis = pCreature->GetGUID(); - break; - case NPC_INFINITE: - uiInfinite = pCreature->GetGUID(); - break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_SHKAF_GATE: - uiShkafGate = pGo->GetGUID(); - break; - case GO_MALGANIS_GATE_1: - uiMalGanisGate1 = pGo->GetGUID(); - break; - case GO_MALGANIS_GATE_2: - uiMalGanisGate2 = pGo->GetGUID(); - break; - case GO_EXIT_GATE: - uiExitGate = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(uiExitGate,true); - break; - case GO_MALGANIS_CHEST_N: - case GO_MALGANIS_CHEST_H: - uiMalGanisChest = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_MEATHOOK_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_SALRAMM_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_EPOCH_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_MAL_GANIS_EVENT: - m_auiEncounter[3] = data; - - switch(m_auiEncounter[3]) - { - case NOT_STARTED: - HandleGameObject(uiMalGanisGate2,true); - break; - case IN_PROGRESS: - HandleGameObject(uiMalGanisGate2,false); - break; - case DONE: - HandleGameObject(uiExitGate, true); - if (GameObject *pGo = instance->GetGameObject(uiMalGanisChest)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; - } - break; - case DATA_INFINITE_EVENT: - m_auiEncounter[4] = data; - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_MEATHOOK_EVENT: return m_auiEncounter[0]; - case DATA_SALRAMM_EVENT: return m_auiEncounter[1]; - case DATA_EPOCH_EVENT: return m_auiEncounter[2]; - case DATA_MAL_GANIS_EVENT: return m_auiEncounter[3]; - case DATA_INFINITE_EVENT: return m_auiEncounter[4]; - } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_ARTHAS: return uiArthas; - case DATA_MEATHOOK: return uiMeathook; - case DATA_SALRAMM: return uiSalramm; - case DATA_EPOCH: return uiEpoch; - case DATA_MAL_GANIS: return uiMalGanis; - case DATA_INFINITE: return uiInfinite; - case DATA_SHKAF_GATE: return uiShkafGate; - case DATA_MAL_GANIS_GATE_1: return uiMalGanisGate1; - case DATA_MAL_GANIS_GATE_2: return uiMalGanisGate2; - case DATA_EXIT_GATE: return uiExitGate; - case DATA_MAL_GANIS_CHEST: return uiMalGanisChest; - } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "C S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - - if (dataHead1 == 'C' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + if (m_auiEncounter[i] == IN_PROGRESS) return true; - } else OUT_LOAD_INST_DATA_FAIL; + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case NPC_ARTHAS: + uiArthas = pCreature->GetGUID(); + break; + case NPC_MEATHOOK: + uiMeathook = pCreature->GetGUID(); + break; + case NPC_SALRAMM: + uiSalramm = pCreature->GetGUID(); + break; + case NPC_EPOCH: + uiEpoch = pCreature->GetGUID(); + break; + case NPC_MAL_GANIS: + uiMalGanis = pCreature->GetGUID(); + break; + case NPC_INFINITE: + uiInfinite = pCreature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_SHKAF_GATE: + uiShkafGate = pGo->GetGUID(); + break; + case GO_MALGANIS_GATE_1: + uiMalGanisGate1 = pGo->GetGUID(); + break; + case GO_MALGANIS_GATE_2: + uiMalGanisGate2 = pGo->GetGUID(); + break; + case GO_EXIT_GATE: + uiExitGate = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(uiExitGate,true); + break; + case GO_MALGANIS_CHEST_N: + case GO_MALGANIS_CHEST_H: + uiMalGanisChest = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_MEATHOOK_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_SALRAMM_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_EPOCH_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_MAL_GANIS_EVENT: + m_auiEncounter[3] = data; + + switch(m_auiEncounter[3]) + { + case NOT_STARTED: + HandleGameObject(uiMalGanisGate2,true); + break; + case IN_PROGRESS: + HandleGameObject(uiMalGanisGate2,false); + break; + case DONE: + HandleGameObject(uiExitGate, true); + if (GameObject *pGo = instance->GetGameObject(uiMalGanisChest)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + } + break; + case DATA_INFINITE_EVENT: + m_auiEncounter[4] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_MEATHOOK_EVENT: return m_auiEncounter[0]; + case DATA_SALRAMM_EVENT: return m_auiEncounter[1]; + case DATA_EPOCH_EVENT: return m_auiEncounter[2]; + case DATA_MAL_GANIS_EVENT: return m_auiEncounter[3]; + case DATA_INFINITE_EVENT: return m_auiEncounter[4]; + } + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_ARTHAS: return uiArthas; + case DATA_MEATHOOK: return uiMeathook; + case DATA_SALRAMM: return uiSalramm; + case DATA_EPOCH: return uiEpoch; + case DATA_MAL_GANIS: return uiMalGanis; + case DATA_INFINITE: return uiInfinite; + case DATA_SHKAF_GATE: return uiShkafGate; + case DATA_MAL_GANIS_GATE_1: return uiMalGanisGate1; + case DATA_MAL_GANIS_GATE_2: return uiMalGanisGate2; + case DATA_EXIT_GATE: return uiExitGate; + case DATA_MAL_GANIS_CHEST: return uiMalGanisChest; + } + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "C S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + + if (dataHead1 == 'C' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_culling_of_stratholme(Map* pMap) -{ - return new instance_culling_of_stratholme(pMap); -} void AddSC_instance_culling_of_stratholme() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_culling_of_stratholme"; - newscript->GetInstanceData = &GetInstanceData_instance_culling_of_stratholme; - newscript->RegisterSelf(); + new instance_culling_of_stratholme(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp index e95c440a7aa..0ddd73e0a64 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp @@ -42,106 +42,108 @@ enum eEnums SPELL_SAND_BREATH = 31473, H_SPELL_SAND_BREATH = 39049 }; - -struct boss_aeonusAI : public ScriptedAI + class boss_aeonus : public CreatureScript { - boss_aeonusAI(Creature *c) : ScriptedAI(c) +public: + boss_aeonus() : CreatureScript("boss_aeonus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_aeonusAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 SandBreath_Timer; - uint32 TimeStop_Timer; - uint32 Frenzy_Timer; - - void Reset() + struct boss_aeonusAI : public ScriptedAI { - SandBreath_Timer = 15000+rand()%15000; - TimeStop_Timer = 10000+rand()%5000; - Frenzy_Timer = 30000+rand()%15000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + boss_aeonusAI(Creature *c) : ScriptedAI(c) { - if (me->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, me); - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + pInstance = c->GetInstanceScript(); } - ScriptedAI::MoveInLineOfSight(who); - } + InstanceScript *pInstance; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + uint32 SandBreath_Timer; + uint32 TimeStop_Timer; + uint32 Frenzy_Timer; - if (pInstance) - { - pInstance->SetData(TYPE_RIFT,DONE); - pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed - } - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Sand Breath - if (SandBreath_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SAND_BREATH); - SandBreath_Timer = 15000+rand()%10000; - } else SandBreath_Timer -= diff; + SandBreath_Timer = 15000+rand()%15000; + TimeStop_Timer = 10000+rand()%5000; + Frenzy_Timer = 30000+rand()%15000; + } - //Time Stop - if (TimeStop_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_TIME_STOP); - TimeStop_Timer = 20000+rand()%15000; - } else TimeStop_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } - //Frenzy - if (Frenzy_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_ENRAGE); - Frenzy_Timer = 20000+rand()%15000; - } else Frenzy_Timer -= diff; + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } + + ScriptedAI::MoveInLineOfSight(who); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + pInstance->SetData(TYPE_RIFT,DONE); + pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed + } + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sand Breath + if (SandBreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SAND_BREATH); + SandBreath_Timer = 15000+rand()%10000; + } else SandBreath_Timer -= diff; + + //Time Stop + if (TimeStop_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TIME_STOP); + TimeStop_Timer = 20000+rand()%15000; + } else TimeStop_Timer -= diff; + + //Frenzy + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_ENRAGE); + Frenzy_Timer = 20000+rand()%15000; + } else Frenzy_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_aeonus(Creature* pCreature) -{ - return new boss_aeonusAI (pCreature); -} void AddSC_boss_aeonus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_aeonus"; - newscript->GetAI = &GetAI_boss_aeonus; - newscript->RegisterSelf(); + new boss_aeonus(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp index 4845a39f2fe..6187c773e76 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp @@ -42,115 +42,117 @@ enum eEnums SPELL_TIME_LAPSE = 31467, SPELL_ATTRACTION = 38540 //Not Implemented (Heroic mode) }; - -struct boss_chrono_lord_dejaAI : public ScriptedAI + class boss_chrono_lord_deja : public CreatureScript { - boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) +public: + boss_chrono_lord_deja() : CreatureScript("boss_chrono_lord_deja") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_chrono_lord_dejaAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 ArcaneBlast_Timer; - uint32 TimeLapse_Timer; - uint32 Attraction_Timer; - uint32 ArcaneDischarge_Timer; - - void Reset() + struct boss_chrono_lord_dejaAI : public ScriptedAI { - ArcaneBlast_Timer = 18000+rand()%5000; - TimeLapse_Timer = 10000+rand()%5000; - ArcaneDischarge_Timer = 20000+rand()%10000; - Attraction_Timer = 25000+rand()%10000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) { - if (me->IsWithinDistInMap(who,20.0f)) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 ArcaneBlast_Timer; + uint32 TimeLapse_Timer; + uint32 Attraction_Timer; + uint32 ArcaneDischarge_Timer; + + void Reset() + { + ArcaneBlast_Timer = 18000+rand()%5000; + TimeLapse_Timer = 10000+rand()%5000; + ArcaneDischarge_Timer = 20000+rand()%10000; + Attraction_Timer = 25000+rand()%10000; + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void MoveInLineOfSight(Unit *who) + { + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } + + ScriptedAI::MoveInLineOfSight(who); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Arcane Blast + if (ArcaneBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BLAST); + ArcaneBlast_Timer = 15000+rand()%10000; + } else ArcaneBlast_Timer -= diff; + + //Arcane Discharge + if (ArcaneDischarge_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + DoCast(pTarget, SPELL_ARCANE_DISCHARGE); + ArcaneDischarge_Timer = 20000+rand()%10000; + } else ArcaneDischarge_Timer -= diff; + + //Time Lapse + if (TimeLapse_Timer <= diff) { DoScriptText(SAY_BANISH, me); - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } - } + DoCast(me, SPELL_TIME_LAPSE); + TimeLapse_Timer = 15000+rand()%10000; + } else TimeLapse_Timer -= diff; - ScriptedAI::MoveInLineOfSight(who); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Arcane Blast - if (ArcaneBlast_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_BLAST); - ArcaneBlast_Timer = 15000+rand()%10000; - } else ArcaneBlast_Timer -= diff; - - //Arcane Discharge - if (ArcaneDischarge_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - DoCast(pTarget, SPELL_ARCANE_DISCHARGE); - ArcaneDischarge_Timer = 20000+rand()%10000; - } else ArcaneDischarge_Timer -= diff; - - //Time Lapse - if (TimeLapse_Timer <= diff) - { - DoScriptText(SAY_BANISH, me); - DoCast(me, SPELL_TIME_LAPSE); - TimeLapse_Timer = 15000+rand()%10000; - } else TimeLapse_Timer -= diff; - - if (IsHeroic()) - { - if (Attraction_Timer <= diff) + if (IsHeroic()) { - DoCast(me, SPELL_ATTRACTION); - Attraction_Timer = 25000+rand()%10000; - } else Attraction_Timer -= diff; - } + if (Attraction_Timer <= diff) + { + DoCast(me, SPELL_ATTRACTION); + Attraction_Timer = 25000+rand()%10000; + } else Attraction_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_chrono_lord_deja(Creature* pCreature) -{ - return new boss_chrono_lord_dejaAI (pCreature); -} void AddSC_boss_chrono_lord_deja() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_chrono_lord_deja"; - newscript->GetAI = &GetAI_boss_chrono_lord_deja; - newscript->RegisterSelf(); + new boss_chrono_lord_deja(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp index 61888422d60..d2102ea7d5a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp @@ -41,114 +41,116 @@ enum eEnums H_SPELL_WING_BUFFET = 38593, SPELL_REFLECT = 38592 //Not Implemented (Heroic mod) }; - -struct boss_temporusAI : public ScriptedAI + class boss_temporus : public CreatureScript { - boss_temporusAI(Creature *c) : ScriptedAI(c) +public: + boss_temporus() : CreatureScript("boss_temporus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_temporusAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 Haste_Timer; - uint32 SpellReflection_Timer; - uint32 MortalWound_Timer; - uint32 WingBuffet_Timer; - - void Reset() + struct boss_temporusAI : public ScriptedAI { - Haste_Timer = 15000+rand()%8000; - SpellReflection_Timer = 30000; - MortalWound_Timer = 8000; - WingBuffet_Timer = 25000+rand()%10000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } - - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + boss_temporusAI(Creature *c) : ScriptedAI(c) { - if (me->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, me); + pInstance = c->GetInstanceScript(); + } - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + InstanceScript *pInstance; + + uint32 Haste_Timer; + uint32 SpellReflection_Timer; + uint32 MortalWound_Timer; + uint32 WingBuffet_Timer; + + void Reset() + { + Haste_Timer = 15000+rand()%8000; + SpellReflection_Timer = 30000; + MortalWound_Timer = 8000; + WingBuffet_Timer = 25000+rand()%10000; + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } + + void MoveInLineOfSight(Unit *who) + { + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); + + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } } + + ScriptedAI::MoveInLineOfSight(who); } - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Attack Haste - if (Haste_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_HASTE); - Haste_Timer = 20000+rand()%5000; - } else Haste_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //MortalWound_Timer - if (MortalWound_Timer <= diff) - { - DoCast(me, SPELL_MORTAL_WOUND); - MortalWound_Timer = 10000+rand()%10000; - } else MortalWound_Timer -= diff; - - //Wing ruffet - if (WingBuffet_Timer <= diff) - { - DoCast(me, SPELL_WING_BUFFET); - WingBuffet_Timer = 20000+rand()%10000; - } else WingBuffet_Timer -= diff; - - if (IsHeroic()) - { - if (SpellReflection_Timer <= diff) + //Attack Haste + if (Haste_Timer <= diff) { - DoCast(me, SPELL_REFLECT); - SpellReflection_Timer = 25000+rand()%10000; - } else SpellReflection_Timer -= diff; - } + DoCast(me, SPELL_HASTE); + Haste_Timer = 20000+rand()%5000; + } else Haste_Timer -= diff; + + //MortalWound_Timer + if (MortalWound_Timer <= diff) + { + DoCast(me, SPELL_MORTAL_WOUND); + MortalWound_Timer = 10000+rand()%10000; + } else MortalWound_Timer -= diff; + + //Wing ruffet + if (WingBuffet_Timer <= diff) + { + DoCast(me, SPELL_WING_BUFFET); + WingBuffet_Timer = 20000+rand()%10000; + } else WingBuffet_Timer -= diff; + + if (IsHeroic()) + { + if (SpellReflection_Timer <= diff) + { + DoCast(me, SPELL_REFLECT); + SpellReflection_Timer = 25000+rand()%10000; + } else SpellReflection_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_temporus(Creature* pCreature) -{ - return new boss_temporusAI (pCreature); -} void AddSC_boss_temporus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_temporus"; - newscript->GetAI = &GetAI_boss_temporus; - newscript->RegisterSelf(); + new boss_temporus(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index d0387eb5a34..812846d692b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -55,180 +55,187 @@ EndContentData */ #define SPELL_CORRUPT_AEONUS 37853 #define C_COUNCIL_ENFORCER 17023 - -struct npc_medivh_bmAI : public ScriptedAI + class npc_medivh_bm : public CreatureScript { - npc_medivh_bmAI(Creature *c) : ScriptedAI(c) +public: + npc_medivh_bm() : CreatureScript("npc_medivh_bm") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_medivh_bmAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 SpellCorrupt_Timer; - uint32 Check_Timer; - - bool Life75; - bool Life50; - bool Life25; - - void Reset() + struct npc_medivh_bmAI : public ScriptedAI { - SpellCorrupt_Timer = 0; - - if (!pInstance) - return; - - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - DoCast(me, SPELL_CHANNEL, true); - else if (me->HasAura(SPELL_CHANNEL)) - me->RemoveAura(SPELL_CHANNEL); - - DoCast(me, SPELL_PORTAL_RUNE, true); - } - - void MoveInLineOfSight(Unit *who) - { - if (!pInstance) - return; - - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) + npc_medivh_bmAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS || pInstance->GetData(TYPE_MEDIVH) == DONE) - return; - - DoScriptText(SAY_INTRO, me); - pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); - DoCast(me, SPELL_CHANNEL, false); - Check_Timer = 5000; - } - else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f)) - { - if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) - return; - - uint32 entry = who->GetEntry(); - if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) - { - who->StopMoving(); - who->CastSpell(me,SPELL_CORRUPT,false); - } - else if (entry == C_AEONUS) - { - who->StopMoving(); - who->CastSpell(me,SPELL_CORRUPT_AEONUS,false); - } - } - } - - void AttackStart(Unit * /*who*/) - { - //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - //return; - - //ScriptedAI::AttackStart(who); - } - - void EnterCombat(Unit * /*who*/) {} - - void SpellHit(Unit* /*caster*/, const SpellEntry* spell) - { - if (SpellCorrupt_Timer) - return; - - if (spell->Id == SPELL_CORRUPT_AEONUS) - SpellCorrupt_Timer = 1000; - - if (spell->Id == SPELL_CORRUPT) - SpellCorrupt_Timer = 3000; - } - - void JustDied(Unit* Killer) - { - if (Killer->GetEntry() == me->GetEntry()) - return; - - DoScriptText(SAY_DEATH, me); - } - - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; - - if (SpellCorrupt_Timer) - { - if (SpellCorrupt_Timer <= diff) - { - pInstance->SetData(TYPE_MEDIVH,SPECIAL); - - if (me->HasAura(SPELL_CORRUPT_AEONUS)) - SpellCorrupt_Timer = 1000; - else if (me->HasAura(SPELL_CORRUPT)) - SpellCorrupt_Timer = 3000; - else - SpellCorrupt_Timer = 0; - } else SpellCorrupt_Timer -= diff; + pInstance = c->GetInstanceScript(); } - if (Check_Timer) + InstanceScript *pInstance; + + uint32 SpellCorrupt_Timer; + uint32 Check_Timer; + + bool Life75; + bool Life50; + bool Life25; + + void Reset() { - if (Check_Timer <= diff) + SpellCorrupt_Timer = 0; + + if (!pInstance) + return; + + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + DoCast(me, SPELL_CHANNEL, true); + else if (me->HasAura(SPELL_CHANNEL)) + me->RemoveAura(SPELL_CHANNEL); + + DoCast(me, SPELL_PORTAL_RUNE, true); + } + + void MoveInLineOfSight(Unit *who) + { + if (!pInstance) + return; + + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) { - uint32 pct = pInstance->GetData(DATA_SHIELD); - - Check_Timer = 5000; - - if (Life25 && pct <= 25) - { - DoScriptText(SAY_WEAK25, me); - Life25 = false; - } - else if (Life50 && pct <= 50) - { - DoScriptText(SAY_WEAK50, me); - Life50 = false; - } - else if (Life75 && pct <= 75) - { - DoScriptText(SAY_WEAK75, me); - Life75 = false; - } - - //if we reach this it means event was running but at some point reset. - if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) - { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); - me->Respawn(); + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS || pInstance->GetData(TYPE_MEDIVH) == DONE) return; - } - if (pInstance->GetData(TYPE_RIFT) == DONE) + DoScriptText(SAY_INTRO, me); + pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); + DoCast(me, SPELL_CHANNEL, false); + Check_Timer = 5000; + } + else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f)) + { + if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + return; + + uint32 entry = who->GetEntry(); + if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) { - DoScriptText(SAY_WIN, me); - Check_Timer = 0; - - if (me->HasAura(SPELL_CHANNEL)) - me->RemoveAura(SPELL_CHANNEL); - - //TODO: start the post-event here - pInstance->SetData(TYPE_MEDIVH,DONE); + who->StopMoving(); + who->CastSpell(me,SPELL_CORRUPT,false); } - } else Check_Timer -= diff; + else if (entry == C_AEONUS) + { + who->StopMoving(); + who->CastSpell(me,SPELL_CORRUPT_AEONUS,false); + } + } } - //if (!UpdateVictim()) - //return; + void AttackStart(Unit * /*who*/) + { + //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + //return; + + //ScriptedAI::AttackStart(who); + } + + void EnterCombat(Unit * /*who*/) {} + + void SpellHit(Unit* /*caster*/, const SpellEntry* spell) + { + if (SpellCorrupt_Timer) + return; + + if (spell->Id == SPELL_CORRUPT_AEONUS) + SpellCorrupt_Timer = 1000; + + if (spell->Id == SPELL_CORRUPT) + SpellCorrupt_Timer = 3000; + } + + void JustDied(Unit* Killer) + { + if (Killer->GetEntry() == me->GetEntry()) + return; + + DoScriptText(SAY_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (SpellCorrupt_Timer) + { + if (SpellCorrupt_Timer <= diff) + { + pInstance->SetData(TYPE_MEDIVH,SPECIAL); + + if (me->HasAura(SPELL_CORRUPT_AEONUS)) + SpellCorrupt_Timer = 1000; + else if (me->HasAura(SPELL_CORRUPT)) + SpellCorrupt_Timer = 3000; + else + SpellCorrupt_Timer = 0; + } else SpellCorrupt_Timer -= diff; + } + + if (Check_Timer) + { + if (Check_Timer <= diff) + { + uint32 pct = pInstance->GetData(DATA_SHIELD); + + Check_Timer = 5000; + + if (Life25 && pct <= 25) + { + DoScriptText(SAY_WEAK25, me); + Life25 = false; + } + else if (Life50 && pct <= 50) + { + DoScriptText(SAY_WEAK50, me); + Life50 = false; + } + else if (Life75 && pct <= 75) + { + DoScriptText(SAY_WEAK75, me); + Life75 = false; + } + + //if we reach this it means event was running but at some point reset. + if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) + { + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + me->Respawn(); + return; + } + + if (pInstance->GetData(TYPE_RIFT) == DONE) + { + DoScriptText(SAY_WIN, me); + Check_Timer = 0; + + if (me->HasAura(SPELL_CHANNEL)) + me->RemoveAura(SPELL_CHANNEL); + + //TODO: start the post-event here + pInstance->SetData(TYPE_MEDIVH,DONE); + } + } else Check_Timer -= diff; + } + + //if (!UpdateVictim()) + //return; + + //DoMeleeAttackIfReady(); + } + }; - //DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_medivh_bm(Creature* pCreature) -{ - return new npc_medivh_bmAI (pCreature); -} struct Wave { @@ -241,166 +248,165 @@ static Wave PortalWaves[]= {C_EXECU, C_CHRON, C_WHELP, C_ASSAS}, {C_EXECU, C_VANQU, C_CHRON, C_ASSAS} }; - -struct npc_time_riftAI : public ScriptedAI + class npc_time_rift : public CreatureScript { - npc_time_riftAI(Creature *c) : ScriptedAI(c) +public: + npc_time_rift() : CreatureScript("npc_time_rift") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_time_riftAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 TimeRiftWave_Timer; - uint8 mRiftWaveCount; - uint8 mPortalCount; - uint8 mWaveId; - - void Reset() + struct npc_time_riftAI : public ScriptedAI { - - TimeRiftWave_Timer = 15000; - mRiftWaveCount = 0; - - if (!pInstance) - return; - - mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); - - if (mPortalCount < 6) - mWaveId = 0; - else if (mPortalCount > 12) - mWaveId = 2; - else mWaveId = 1; - - } - void EnterCombat(Unit * /*who*/) {} - - void DoSummonAtRift(uint32 creature_entry) - { - if (!creature_entry) - return; - - if (pInstance && pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + npc_time_riftAI(Creature *c) : ScriptedAI(c) { - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - return; + pInstance = c->GetInstanceScript(); } - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + InstanceScript *pInstance; - //normalize Z-level if we can, if rift is not at ground level. - pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); + uint32 TimeRiftWave_Timer; + uint8 mRiftWaveCount; + uint8 mPortalCount; + uint8 mWaveId; - if (Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) - if (Unit *temp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0)) - Summon->AddThreat(temp,0.0f); - } + void Reset() + { - void DoSelectSummon() - { - uint32 entry = 0; - - if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) + TimeRiftWave_Timer = 15000; mRiftWaveCount = 0; - entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - sLog.outDebug("TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).",mRiftWaveCount,entry); + if (!pInstance) + return; - ++mRiftWaveCount; + mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); - if (entry == C_WHELP) + if (mPortalCount < 6) + mWaveId = 0; + else if (mPortalCount > 12) + mWaveId = 2; + else mWaveId = 1; + + } + void EnterCombat(Unit * /*who*/) {} + + void DoSummonAtRift(uint32 creature_entry) { - for (uint8 i = 0; i < 3; ++i) - DoSummonAtRift(entry); - } else DoSummonAtRift(entry); - } + if (!creature_entry) + return; - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + if (pInstance && pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + { + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + return; + } - if (TimeRiftWave_Timer <= diff) + Position pos; + me->GetRandomNearPosition(pos, 10.0f); + + //normalize Z-level if we can, if rift is not at ground level. + pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); + + if (Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) + if (Unit *temp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0)) + Summon->AddThreat(temp,0.0f); + } + + void DoSelectSummon() { - DoSelectSummon(); - TimeRiftWave_Timer = 15000; - } else TimeRiftWave_Timer -= diff; + uint32 entry = 0; - if (me->IsNonMeleeSpellCasted(false)) - return; + if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) + mRiftWaveCount = 0; - sLog.outDebug("TSCR: npc_time_rift: not casting anylonger, i need to die."); - me->setDeathState(JUST_DIED); + entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; + sLog.outDebug("TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).",mRiftWaveCount,entry); + + ++mRiftWaveCount; + + if (entry == C_WHELP) + { + for (uint8 i = 0; i < 3; ++i) + DoSummonAtRift(entry); + } else DoSummonAtRift(entry); + } + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (TimeRiftWave_Timer <= diff) + { + DoSelectSummon(); + TimeRiftWave_Timer = 15000; + } else TimeRiftWave_Timer -= diff; + + if (me->IsNonMeleeSpellCasted(false)) + return; + + sLog.outDebug("TSCR: npc_time_rift: not casting anylonger, i need to die."); + me->setDeathState(JUST_DIED); + + if (pInstance->GetData(TYPE_RIFT) == IN_PROGRESS) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } + }; - if (pInstance->GetData(TYPE_RIFT) == IN_PROGRESS) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } }; -CreatureAI* GetAI_npc_time_rift(Creature* pCreature) -{ - return new npc_time_riftAI (pCreature); -} #define SAY_SAAT_WELCOME -1269019 #define GOSSIP_ITEM_OBTAIN "[PH] Obtain Chrono-Beacon" #define SPELL_CHRONO_BEACON 34975 #define ITEM_CHRONO_BEACON 24289 - -bool GossipHello_npc_saat(Player* pPlayer, Creature* pCreature) + class npc_saat : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_saat() : CreatureScript("npc_saat") { } - if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10000, pCreature->GetGUID()); - return true; - } - else if (pPlayer->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10001, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,SPELL_CHRONO_BEACON,false); + } return true; } - pPlayer->SEND_GOSSIP_MENU(10002, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_saat(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,SPELL_CHRONO_BEACON,false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(10000, pCreature->GetGUID()); + return true; + } + else if (pPlayer->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(10001, pCreature->GetGUID()); + return true; + } + + pPlayer->SEND_GOSSIP_MENU(10002, pCreature->GetGUID()); + return true; } - return true; -} + +}; + void AddSC_dark_portal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_medivh_bm"; - newscript->GetAI = &GetAI_npc_medivh_bm; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_time_rift"; - newscript->GetAI = &GetAI_npc_time_rift; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_saat"; - newscript->pGossipHello = &GossipHello_npc_saat; - newscript->pGossipSelect = &GossipSelect_npc_saat; - newscript->RegisterSelf(); + new npc_medivh_bm(); + new npc_time_rift(); + new npc_saat(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index b68310b4a18..9c8ab481a12 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -60,289 +60,290 @@ static Wave RiftWaves[]= {RIFT_BOSS, 120000}, {C_AEONUS, 0} }; - -struct instance_dark_portal : public ScriptedInstance + class instance_dark_portal : public InstanceMapScript { - instance_dark_portal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_dark_portal() : InstanceMapScript("instance_dark_portal") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint32 mRiftPortalCount; - uint32 mShieldPercent; - uint8 mRiftWaveCount; - uint8 mRiftWaveId; - - uint32 NextPortal_Timer; - - uint64 MedivhGUID; - uint8 CurrentRiftId; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - MedivhGUID = 0; - Clear(); + return new instance_dark_portal_InstanceMapScript(pMap); } - void Clear() + struct instance_dark_portal_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + instance_dark_portal_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - mRiftPortalCount = 0; - mShieldPercent = 100; - mRiftWaveCount = 0; - mRiftWaveId = 0; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - CurrentRiftId = 0; + uint32 mRiftPortalCount; + uint32 mShieldPercent; + uint8 mRiftWaveCount; + uint8 mRiftWaveId; - NextPortal_Timer = 0; - } + uint32 NextPortal_Timer; - void InitWorldState(bool Enable = true) - { - DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0); - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); - } + uint64 MedivhGUID; + uint8 CurrentRiftId; - bool IsEncounterInProgress() - { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) - return true; - - return false; - } - - void OnPlayerEnter(Player* pPlayer) - { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) - return; - - pPlayer->SendUpdateWorldState(WORLD_STATE_BM,0); - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - if (pCreature->GetEntry() == C_MEDIVH) - MedivhGUID = pCreature->GetGUID(); - } - - //what other conditions to check? - bool CanProgressEvent() - { - if (instance->GetPlayers().isEmpty()) - return false; - - return true; - } - - uint8 GetRiftWaveId() - { - switch(mRiftPortalCount) + void Initialize() { - case 6: - mRiftWaveId = 2; - return 1; - case 12: - mRiftWaveId = 4; - return 3; - case 18: - return 5; - default: - return mRiftWaveId; + MedivhGUID = 0; + Clear(); } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void Clear() { - case TYPE_MEDIVH: - if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS) + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + mRiftPortalCount = 0; + mShieldPercent = 100; + mRiftWaveCount = 0; + mRiftWaveId = 0; + + CurrentRiftId = 0; + + NextPortal_Timer = 0; + } + + void InitWorldState(bool Enable = true) + { + DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0); + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100); + DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); + } + + bool IsEncounterInProgress() + { + if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + return true; + + return false; + } + + void OnPlayerEnter(Player* pPlayer) + { + if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + return; + + pPlayer->SendUpdateWorldState(WORLD_STATE_BM,0); + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + if (pCreature->GetEntry() == C_MEDIVH) + MedivhGUID = pCreature->GetGUID(); + } + + //what other conditions to check? + bool CanProgressEvent() + { + if (instance->GetPlayers().isEmpty()) + return false; + + return true; + } + + uint8 GetRiftWaveId() + { + switch(mRiftPortalCount) { - --mShieldPercent; - - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent); - - if (!mShieldPercent) - { - if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) - { - if (pMedivh->isAlive()) - { - pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_auiEncounter[0] = FAIL; - m_auiEncounter[1] = NOT_STARTED; - } - } - } + case 6: + mRiftWaveId = 2; + return 1; + case 12: + mRiftWaveId = 4; + return 3; + case 18: + return 5; + default: + return mRiftWaveId; } - else + } + + void SetData(uint32 type, uint32 data) + { + switch(type) { - if (data == IN_PROGRESS) + case TYPE_MEDIVH: + if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS) { - sLog.outDebug("TSCR: Instance Dark Portal: Starting event."); - InitWorldState(); - m_auiEncounter[1] = IN_PROGRESS; - NextPortal_Timer = 15000; - } + --mShieldPercent; - if (data == DONE) - { - //this may be completed further out in the post-event - sLog.outDebug("TSCR: Instance Dark Portal: Event completed."); - Map::PlayerList const& players = instance->GetPlayers(); + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent); - if (!players.isEmpty()) + if (!mShieldPercent) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) { - if (Player* pPlayer = itr->getSource()) + if (pMedivh->isAlive()) { - if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); - - if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); + pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_auiEncounter[0] = FAIL; + m_auiEncounter[1] = NOT_STARTED; } } } } - - m_auiEncounter[0] = data; - } - break; - case TYPE_RIFT: - if (data == SPECIAL) - { - if (mRiftPortalCount < 7) - NextPortal_Timer = 5000; - } - else - m_auiEncounter[1] = data; - break; - } - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_MEDIVH: - return m_auiEncounter[0]; - case TYPE_RIFT: - return m_auiEncounter[1]; - case DATA_PORTAL_COUNT: - return mRiftPortalCount; - case DATA_SHIELD: - return mShieldPercent; - } - return 0; - } - - uint64 GetData64(uint32 data) - { - if (data == DATA_MEDIVH) - return MedivhGUID; - - return 0; - } - - Creature* SummonedPortalBoss(Creature* me) - { - uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss; - - if (entry == RIFT_BOSS) - entry = RandRiftBoss(); - - sLog.outDebug("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry); - - Position pos; - me->GetRandomNearPosition(pos, 10.0f); - - //normalize Z-level if we can, if rift is not at ground level. - pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); - - if (Creature *summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) - return summon; - - sLog.outDebug("TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); - return NULL; - } - - void DoSpawnPortal() - { - if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) - { - uint8 tmp = urand(0,2); - - if (tmp >= CurrentRiftId) - ++tmp; - - sLog.outDebug("TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).",tmp,CurrentRiftId); - - CurrentRiftId = tmp; - - Creature *pTemp = pMedivh->SummonCreature(C_TIME_RIFT, - PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3], - TEMPSUMMON_CORPSE_DESPAWN,0); - if (pTemp) - { - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (Creature *pBoss = SummonedPortalBoss(pTemp)) + else { - if (pBoss->GetEntry() == C_AEONUS) - pBoss->AddThreat(pMedivh,0.0f); - else + if (data == IN_PROGRESS) { - pBoss->AddThreat(pTemp,0.0f); - pTemp->CastSpell(pBoss,SPELL_RIFT_CHANNEL,false); + sLog.outDebug("TSCR: Instance Dark Portal: Starting event."); + InitWorldState(); + m_auiEncounter[1] = IN_PROGRESS; + NextPortal_Timer = 15000; + } + + if (data == DONE) + { + //this may be completed further out in the post-event + sLog.outDebug("TSCR: Instance Dark Portal: Event completed."); + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + { + if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); + + if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); + } + } + } + } + + m_auiEncounter[0] = data; + } + break; + case TYPE_RIFT: + if (data == SPECIAL) + { + if (mRiftPortalCount < 7) + NextPortal_Timer = 5000; + } + else + m_auiEncounter[1] = data; + break; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_MEDIVH: + return m_auiEncounter[0]; + case TYPE_RIFT: + return m_auiEncounter[1]; + case DATA_PORTAL_COUNT: + return mRiftPortalCount; + case DATA_SHIELD: + return mShieldPercent; + } + return 0; + } + + uint64 GetData64(uint32 data) + { + if (data == DATA_MEDIVH) + return MedivhGUID; + + return 0; + } + + Creature* SummonedPortalBoss(Creature* me) + { + uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss; + + if (entry == RIFT_BOSS) + entry = RandRiftBoss(); + + sLog.outDebug("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry); + + Position pos; + me->GetRandomNearPosition(pos, 10.0f); + + //normalize Z-level if we can, if rift is not at ground level. + pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); + + if (Creature *summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) + return summon; + + sLog.outDebug("TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); + return NULL; + } + + void DoSpawnPortal() + { + if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) + { + uint8 tmp = urand(0,2); + + if (tmp >= CurrentRiftId) + ++tmp; + + sLog.outDebug("TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).",tmp,CurrentRiftId); + + CurrentRiftId = tmp; + + Creature *pTemp = pMedivh->SummonCreature(C_TIME_RIFT, + PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3], + TEMPSUMMON_CORPSE_DESPAWN,0); + if (pTemp) + { + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (Creature *pBoss = SummonedPortalBoss(pTemp)) + { + if (pBoss->GetEntry() == C_AEONUS) + pBoss->AddThreat(pMedivh,0.0f); + else + { + pBoss->AddThreat(pTemp,0.0f); + pTemp->CastSpell(pBoss,SPELL_RIFT_CHANNEL,false); + } } } } } - } - void Update(uint32 diff) - { - if (m_auiEncounter[1] != IN_PROGRESS) - return; - - //add delay timer? - if (!CanProgressEvent()) + void Update(uint32 diff) { - Clear(); - return; - } + if (m_auiEncounter[1] != IN_PROGRESS) + return; - if (NextPortal_Timer) - { - if (NextPortal_Timer <= diff) + //add delay timer? + if (!CanProgressEvent()) { - ++mRiftPortalCount; + Clear(); + return; + } - DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); + if (NextPortal_Timer) + { + if (NextPortal_Timer <= diff) + { + ++mRiftPortalCount; - DoSpawnPortal(); - NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime; - } else NextPortal_Timer -= diff; + DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); + + DoSpawnPortal(); + NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime; + } else NextPortal_Timer -= diff; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_dark_portal(Map* pMap) -{ - return new instance_dark_portal(pMap); -} void AddSC_instance_dark_portal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_dark_portal"; - newscript->GetInstanceData = &GetInstanceData_instance_dark_portal; - newscript->RegisterSelf(); + new instance_dark_portal(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index 013846e576a..eeb4b5a0865 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -39,116 +39,118 @@ EndScriptData */ #define SPELL_HOLY_SHIELD 31904 #define SPELL_DEVOTION_AURA 8258 #define SPELL_CONSECRATION 38385 - -struct boss_captain_skarlocAI : public ScriptedAI + class boss_captain_skarloc : public CreatureScript { - boss_captain_skarlocAI(Creature *c) : ScriptedAI(c) +public: + boss_captain_skarloc() : CreatureScript("boss_captain_skarloc") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_captain_skarlocAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 Holy_Light_Timer; - uint32 Cleanse_Timer; - uint32 HammerOfJustice_Timer; - uint32 HolyShield_Timer; - uint32 DevotionAura_Timer; - uint32 Consecration_Timer; - - void Reset() + struct boss_captain_skarlocAI : public ScriptedAI { - Holy_Light_Timer = 20000 + rand()%10000; - Cleanse_Timer = 10000; - HammerOfJustice_Timer = 20000 + rand()%15000; - HolyShield_Timer = 240000; - DevotionAura_Timer = 3000; - Consecration_Timer = 8000; - } - - void EnterCombat(Unit * /*who*/) - { - //This is not correct. Should taunt Thrall before engage in combat - DoScriptText(SAY_TAUNT1, me); - DoScriptText(SAY_TAUNT2, me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) - pInstance->SetData(TYPE_THRALL_PART1, DONE); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Holy_Light - if (Holy_Light_Timer <= diff) + boss_captain_skarlocAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_HOLY_LIGHT); - Holy_Light_Timer = 30000; - } else Holy_Light_Timer -= diff; + pInstance = c->GetInstanceScript(); + } - //Cleanse - if (Cleanse_Timer <= diff) + InstanceScript *pInstance; + + uint32 Holy_Light_Timer; + uint32 Cleanse_Timer; + uint32 HammerOfJustice_Timer; + uint32 HolyShield_Timer; + uint32 DevotionAura_Timer; + uint32 Consecration_Timer; + + void Reset() { - DoCast(me, SPELL_CLEANSE); + Holy_Light_Timer = 20000 + rand()%10000; Cleanse_Timer = 10000; - } else Cleanse_Timer -= diff; - - //Hammer of Justice - if (HammerOfJustice_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); - HammerOfJustice_Timer = 60000; - } else HammerOfJustice_Timer -= diff; - - //Holy Shield - if (HolyShield_Timer <= diff) - { - DoCast(me, SPELL_HOLY_SHIELD); + HammerOfJustice_Timer = 20000 + rand()%15000; HolyShield_Timer = 240000; - } else HolyShield_Timer -= diff; + DevotionAura_Timer = 3000; + Consecration_Timer = 8000; + } - //Devotion_Aura - if (DevotionAura_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_DEVOTION_AURA); - DevotionAura_Timer = 45000 + rand()%10000; - } else DevotionAura_Timer -= diff; + //This is not correct. Should taunt Thrall before engage in combat + DoScriptText(SAY_TAUNT1, me); + DoScriptText(SAY_TAUNT2, me); + } - //Consecration - if (Consecration_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - //DoCast(me->getVictim(), SPELL_CONSECRATION); - Consecration_Timer = 5000 + rand()%5000; - } else Consecration_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + pInstance->SetData(TYPE_THRALL_PART1, DONE); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Holy_Light + if (Holy_Light_Timer <= diff) + { + DoCast(me, SPELL_HOLY_LIGHT); + Holy_Light_Timer = 30000; + } else Holy_Light_Timer -= diff; + + //Cleanse + if (Cleanse_Timer <= diff) + { + DoCast(me, SPELL_CLEANSE); + Cleanse_Timer = 10000; + } else Cleanse_Timer -= diff; + + //Hammer of Justice + if (HammerOfJustice_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); + HammerOfJustice_Timer = 60000; + } else HammerOfJustice_Timer -= diff; + + //Holy Shield + if (HolyShield_Timer <= diff) + { + DoCast(me, SPELL_HOLY_SHIELD); + HolyShield_Timer = 240000; + } else HolyShield_Timer -= diff; + + //Devotion_Aura + if (DevotionAura_Timer <= diff) + { + DoCast(me, SPELL_DEVOTION_AURA); + DevotionAura_Timer = 45000 + rand()%10000; + } else DevotionAura_Timer -= diff; + + //Consecration + if (Consecration_Timer <= diff) + { + //DoCast(me->getVictim(), SPELL_CONSECRATION); + Consecration_Timer = 5000 + rand()%5000; + } else Consecration_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_captain_skarloc(Creature* pCreature) -{ - return new boss_captain_skarlocAI (pCreature); -} void AddSC_boss_captain_skarloc() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_captain_skarloc"; - newscript->GetAI = &GetAI_boss_captain_skarloc; - newscript->RegisterSelf(); + new boss_captain_skarloc(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 92e0ac31a2b..b3c8624294c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -41,100 +41,102 @@ EndScriptData */ #define SPELL_IMPENDING_DEATH 31916 #define SPELL_MAGIC_DISRUPTION_AURA 33834 #define SPELL_WING_BUFFET 31475 - -struct boss_epoch_hunterAI : public ScriptedAI + class boss_epoch_hunter : public CreatureScript { - boss_epoch_hunterAI(Creature *c) : ScriptedAI(c) +public: + boss_epoch_hunter() : CreatureScript("boss_epoch_hunter") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_epoch_hunterAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 SandBreath_Timer; - uint32 ImpendingDeath_Timer; - uint32 WingBuffet_Timer; - uint32 Mda_Timer; - - void Reset() + struct boss_epoch_hunterAI : public ScriptedAI { - SandBreath_Timer = 8000 + rand()%8000; - ImpendingDeath_Timer = 25000 + rand()%5000; - WingBuffet_Timer = 35000; - Mda_Timer = 40000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) - pInstance->SetData(TYPE_THRALL_PART4, DONE); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Sand Breath - if (SandBreath_Timer <= diff) + boss_epoch_hunterAI(Creature *c) : ScriptedAI(c) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + pInstance = c->GetInstanceScript(); + } - DoCast(me->getVictim(), SPELL_SAND_BREATH); + InstanceScript *pInstance; - DoScriptText(RAND(SAY_BREATH1,SAY_BREATH2), me); + uint32 SandBreath_Timer; + uint32 ImpendingDeath_Timer; + uint32 WingBuffet_Timer; + uint32 Mda_Timer; - SandBreath_Timer = 10000 + rand()%10000; - } else SandBreath_Timer -= diff; - - if (ImpendingDeath_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_IMPENDING_DEATH); - ImpendingDeath_Timer = 25000+rand()%5000; - } else ImpendingDeath_Timer -= diff; + SandBreath_Timer = 8000 + rand()%8000; + ImpendingDeath_Timer = 25000 + rand()%5000; + WingBuffet_Timer = 35000; + Mda_Timer = 40000; + } - if (WingBuffet_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_WING_BUFFET); - WingBuffet_Timer = 25000+rand()%10000; - } else WingBuffet_Timer -= diff; + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); + } - if (Mda_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me, SPELL_MAGIC_DISRUPTION_AURA); - Mda_Timer = 15000; - } else Mda_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + pInstance->SetData(TYPE_THRALL_PART4, DONE); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sand Breath + if (SandBreath_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoCast(me->getVictim(), SPELL_SAND_BREATH); + + DoScriptText(RAND(SAY_BREATH1,SAY_BREATH2), me); + + SandBreath_Timer = 10000 + rand()%10000; + } else SandBreath_Timer -= diff; + + if (ImpendingDeath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMPENDING_DEATH); + ImpendingDeath_Timer = 25000+rand()%5000; + } else ImpendingDeath_Timer -= diff; + + if (WingBuffet_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_WING_BUFFET); + WingBuffet_Timer = 25000+rand()%10000; + } else WingBuffet_Timer -= diff; + + if (Mda_Timer <= diff) + { + DoCast(me, SPELL_MAGIC_DISRUPTION_AURA); + Mda_Timer = 15000; + } else Mda_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_epoch_hunter(Creature* pCreature) -{ - return new boss_epoch_hunterAI (pCreature); -} void AddSC_boss_epoch_hunter() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_epoch_hunter"; - newscript->GetAI = &GetAI_boss_epoch_hunter; - newscript->RegisterSelf(); + new boss_epoch_hunter(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 6fc67249925..caa70fb2bc8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -30,19 +30,25 @@ EndScriptData */ /*###### ## go_barrel_old_hillsbrad ######*/ - -bool GOHello_go_barrel_old_hillsbrad(Player* /*pPlayer*/, GameObject* pGO) + class go_barrel_old_hillsbrad : public GameObjectScript { - if (ScriptedInstance* pInstance = pGO->GetInstanceData()) - { - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) - return false; +public: + go_barrel_old_hillsbrad() : GameObjectScript("go_barrel_old_hillsbrad") { } - pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) + { + if (InstanceScript* pInstance = pGO->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) + return false; + + pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); + } + + return false; } - return false; -} +}; /*###### ## boss_lieutenant_drake @@ -91,102 +97,99 @@ static Location DrakeWP[]= {17, 2125.50, 88.9481, 54.7953}, {18, 2128.20, 70.9763, 64.4221} }; - -struct boss_lieutenant_drakeAI : public ScriptedAI + class boss_lieutenant_drake : public CreatureScript { - boss_lieutenant_drakeAI(Creature *c) : ScriptedAI(c) {} +public: + boss_lieutenant_drake() : CreatureScript("boss_lieutenant_drake") { } - bool CanPatrol; - uint32 wpId; - - uint32 Whirlwind_Timer; - uint32 Fear_Timer; - uint32 MortalStrike_Timer; - uint32 ExplodingShout_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CanPatrol = true; - wpId = 0; - - Whirlwind_Timer = 20000; - Fear_Timer = 30000; - MortalStrike_Timer = 45000; - ExplodingShout_Timer = 25000; + return new boss_lieutenant_drakeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_lieutenant_drakeAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_lieutenant_drakeAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } + bool CanPatrol; + uint32 wpId; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 Whirlwind_Timer; + uint32 Fear_Timer; + uint32 MortalStrike_Timer; + uint32 ExplodingShout_Timer; - void UpdateAI(const uint32 diff) - { - //TODO: make this work - if (CanPatrol && wpId == 0) + void Reset() { - me->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); - ++wpId; + CanPatrol = true; + wpId = 0; + + Whirlwind_Timer = 20000; + Fear_Timer = 30000; + MortalStrike_Timer = 45000; + ExplodingShout_Timer = 25000; } - //Return since we have no target - if (!UpdateVictim()) - return; - - //Whirlwind - if (Whirlwind_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WHIRLWIND); - Whirlwind_Timer = 20000+rand()%5000; - } else Whirlwind_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } - //Fear - if (Fear_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(SAY_SHOUT, me); - DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); - Fear_Timer = 25000+rand()%10000; - } else Fear_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - //Mortal Strike - if (MortalStrike_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoScriptText(SAY_MORTAL, me); - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 20000+rand()%10000; - } else MortalStrike_Timer -= diff; + DoScriptText(SAY_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + //TODO: make this work + if (CanPatrol && wpId == 0) + { + me->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); + ++wpId; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //Whirlwind + if (Whirlwind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLWIND); + Whirlwind_Timer = 20000+rand()%5000; + } else Whirlwind_Timer -= diff; + + //Fear + if (Fear_Timer <= diff) + { + DoScriptText(SAY_SHOUT, me); + DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); + Fear_Timer = 25000+rand()%10000; + } else Fear_Timer -= diff; + + //Mortal Strike + if (MortalStrike_Timer <= diff) + { + DoScriptText(SAY_MORTAL, me); + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + MortalStrike_Timer = 20000+rand()%10000; + } else MortalStrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lieutenant_drake(Creature* pCreature) -{ - return new boss_lieutenant_drakeAI (pCreature); -} void AddSC_boss_lieutenant_drake() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_barrel_old_hillsbrad"; - newscript->pGOHello = &GOHello_go_barrel_old_hillsbrad; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lieutenant_drake"; - newscript->GetAI = &GetAI_boss_lieutenant_drake; - newscript->RegisterSelf(); + new go_barrel_old_hillsbrad(); + new boss_lieutenant_drake(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index 85536bacd7e..22526baf940 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -36,205 +36,207 @@ EndScriptData */ #define QUEST_ENTRY_DIVERSION 10283 #define LODGE_QUEST_TRIGGER 20155 - -struct instance_old_hillsbrad : public ScriptedInstance + class instance_old_hillsbrad : public InstanceMapScript { - instance_old_hillsbrad(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_old_hillsbrad() : InstanceMapScript("instance_old_hillsbrad") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 mBarrelCount; - uint32 mThrallEventCount; - - uint64 ThrallGUID; - uint64 TarethaGUID; - uint64 EpochGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - mBarrelCount = 0; - mThrallEventCount = 0; - ThrallGUID = 0; - TarethaGUID = 0; - EpochGUID = 0; + return new instance_old_hillsbrad_InstanceMapScript(pMap); } - Player* GetPlayerInMap() + struct instance_old_hillsbrad_InstanceMapScript : public InstanceScript { - Map::PlayerList const& players = instance->GetPlayers(); + instance_old_hillsbrad_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - if (!players.isEmpty()) + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 mBarrelCount; + uint32 mThrallEventCount; + + uint64 ThrallGUID; + uint64 TarethaGUID; + uint64 EpochGUID; + + void Initialize() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + mBarrelCount = 0; + mThrallEventCount = 0; + ThrallGUID = 0; + TarethaGUID = 0; + EpochGUID = 0; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* plr = itr->getSource()) - return plr; - } - } - - sLog.outDebug("TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - void UpdateQuestCredit() - { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0); - } - } - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case THRALL_ENTRY: - ThrallGUID = pCreature->GetGUID(); - break; - case TARETHA_ENTRY: - TarethaGUID = pCreature->GetGUID(); - break; - case EPOCH_ENTRY: - EpochGUID = pCreature->GetGUID(); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - Player* pPlayer = GetPlayerInMap(); - - if (!pPlayer) - { - sLog.outDebug("TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; - } - - switch(type) - { - case TYPE_BARREL_DIVERSION: - { - if (data == IN_PROGRESS) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - if (mBarrelCount >= 5) - return; - - ++mBarrelCount; - DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - - sLog.outDebug("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); - - m_auiEncounter[0] = IN_PROGRESS; - - if (mBarrelCount == 5) - { - UpdateQuestCredit(); - pPlayer->SummonCreature(DRAKE_ENTRY, 2128.43, 71.01, 64.42, 1.74, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); - m_auiEncounter[0] = DONE; - } + if (Player* plr = itr->getSource()) + return plr; } - break; } - case TYPE_THRALL_EVENT: + + sLog.outDebug("TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void UpdateQuestCredit() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (data == FAIL) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - if (mThrallEventCount <= 20) + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0); + } + } + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case THRALL_ENTRY: + ThrallGUID = pCreature->GetGUID(); + break; + case TARETHA_ENTRY: + TarethaGUID = pCreature->GetGUID(); + break; + case EPOCH_ENTRY: + EpochGUID = pCreature->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + Player* pPlayer = GetPlayerInMap(); + + if (!pPlayer) + { + sLog.outDebug("TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } + + switch(type) + { + case TYPE_BARREL_DIVERSION: + { + if (data == IN_PROGRESS) { - ++mThrallEventCount; - m_auiEncounter[1] = NOT_STARTED; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); - m_auiEncounter[2] = NOT_STARTED; - m_auiEncounter[3] = NOT_STARTED; - m_auiEncounter[4] = NOT_STARTED; - m_auiEncounter[5] = NOT_STARTED; + if (mBarrelCount >= 5) + return; + + ++mBarrelCount; + DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); + + sLog.outDebug("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); + + m_auiEncounter[0] = IN_PROGRESS; + + if (mBarrelCount == 5) + { + UpdateQuestCredit(); + pPlayer->SummonCreature(DRAKE_ENTRY, 2128.43, 71.01, 64.42, 1.74, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); + m_auiEncounter[0] = DONE; + } } - else if (mThrallEventCount > 20) + break; + } + case TYPE_THRALL_EVENT: + { + if (data == FAIL) { + if (mThrallEventCount <= 20) + { + ++mThrallEventCount; + m_auiEncounter[1] = NOT_STARTED; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); + m_auiEncounter[2] = NOT_STARTED; + m_auiEncounter[3] = NOT_STARTED; + m_auiEncounter[4] = NOT_STARTED; + m_auiEncounter[5] = NOT_STARTED; + } + else if (mThrallEventCount > 20) + { + m_auiEncounter[1] = data; + m_auiEncounter[2] = data; + m_auiEncounter[3] = data; + m_auiEncounter[4] = data; + m_auiEncounter[5] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); + } + } + else m_auiEncounter[1] = data; - m_auiEncounter[2] = data; - m_auiEncounter[3] = data; - m_auiEncounter[4] = data; - m_auiEncounter[5] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); - } + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.",data); + break; } - else - m_auiEncounter[1] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.",data); - break; + case TYPE_THRALL_PART1: + m_auiEncounter[2] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.",data); + break; + case TYPE_THRALL_PART2: + m_auiEncounter[3] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.",data); + break; + case TYPE_THRALL_PART3: + m_auiEncounter[4] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.",data); + break; + case TYPE_THRALL_PART4: + m_auiEncounter[5] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.",data); + break; } - case TYPE_THRALL_PART1: - m_auiEncounter[2] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.",data); - break; - case TYPE_THRALL_PART2: - m_auiEncounter[3] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.",data); - break; - case TYPE_THRALL_PART3: - m_auiEncounter[4] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.",data); - break; - case TYPE_THRALL_PART4: - m_auiEncounter[5] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.",data); - break; } - } - uint32 GetData(uint32 data) - { - switch(data) + uint32 GetData(uint32 data) { - case TYPE_BARREL_DIVERSION: - return m_auiEncounter[0]; - case TYPE_THRALL_EVENT: - return m_auiEncounter[1]; - case TYPE_THRALL_PART1: - return m_auiEncounter[2]; - case TYPE_THRALL_PART2: - return m_auiEncounter[3]; - case TYPE_THRALL_PART3: - return m_auiEncounter[4]; - case TYPE_THRALL_PART4: - return m_auiEncounter[5]; + switch(data) + { + case TYPE_BARREL_DIVERSION: + return m_auiEncounter[0]; + case TYPE_THRALL_EVENT: + return m_auiEncounter[1]; + case TYPE_THRALL_PART1: + return m_auiEncounter[2]; + case TYPE_THRALL_PART2: + return m_auiEncounter[3]; + case TYPE_THRALL_PART3: + return m_auiEncounter[4]; + case TYPE_THRALL_PART4: + return m_auiEncounter[5]; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 data) - { - switch(data) + uint64 GetData64(uint32 data) { - case DATA_THRALL: - return ThrallGUID; - case DATA_TARETHA: - return TarethaGUID; - case DATA_EPOCH: - return EpochGUID; + switch(data) + { + case DATA_THRALL: + return ThrallGUID; + case DATA_TARETHA: + return TarethaGUID; + case DATA_EPOCH: + return EpochGUID; + } + return 0; } - return 0; - } + }; + }; -InstanceData* GetInstanceData_instance_old_hillsbrad(Map* pMap) -{ - return new instance_old_hillsbrad(pMap); -} void AddSC_instance_old_hillsbrad() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_old_hillsbrad"; - newscript->GetInstanceData = &GetInstanceData_instance_old_hillsbrad; - newscript->RegisterSelf(); + new instance_old_hillsbrad(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 801e79cb958..b802a17d45c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -45,42 +45,49 @@ EndContentData */ /*###### ## npc_erozion ######*/ - -bool GossipHello_npc_erozion(Player* pPlayer, Creature* pCreature) + class npc_erozion : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_erozion() : CreatureScript("npc_erozion") { } - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_BARREL_DIVERSION) != DONE && !pPlayer->HasItemCount(ITEM_ENTRY_BOMBS,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - if (!pPlayer->GetQuestRewardStatus(QUEST_ENTRY_RETURN) && pPlayer->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->SEND_GOSSIP_MENU(9778, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_ENTRY_BOMBS, 1); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, ITEM_ENTRY_BOMBS, true); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_ENTRY_BOMBS, 1); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, ITEM_ENTRY_BOMBS, true); + } + pPlayer->SEND_GOSSIP_MENU(9515, pCreature->GetGUID()); } - pPlayer->SEND_GOSSIP_MENU(9515, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + } + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_BARREL_DIVERSION) != DONE && !pPlayer->HasItemCount(ITEM_ENTRY_BOMBS,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + if (!pPlayer->GetQuestRewardStatus(QUEST_ENTRY_RETURN) && pPlayer->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(9778, pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_thrall_old_hillsbrad @@ -179,372 +186,381 @@ bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 /*uiS #define GOSSIP_ID_COMPLETE 9578 //Thank you friends, I owe my freedom to you. Where is Taretha? I hoped to see her #define GOSSIP_ITEM_WALKING "[PH] Start walking." - -struct npc_thrall_old_hillsbradAI : public npc_escortAI + class npc_thrall_old_hillsbrad : public CreatureScript { - npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) +public: + npc_thrall_old_hillsbrad() : CreatureScript("npc_thrall_old_hillsbrad") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - HadMount = false; - me->setActive(true); + return new npc_thrall_old_hillsbradAI(pCreature); } - ScriptedInstance *pInstance; - - uint64 TarethaGUID; - - bool LowHp; - bool HadMount; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!pInstance) - return; - - switch(i) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + switch(uiAction) { - case 8: - SetRun(false); - me->SummonCreature(18764,2181.87,112.46,89.45,0.26,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) + { + pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); + pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); + } + + DoScriptText(SAY_TH_START_EVENT_PART1, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + + CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); break; - case 9: - DoScriptText(SAY_TH_ARMORY, me); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038); + + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC2, pCreature->GetGUID()); break; - case 10: - me->SetDisplayId(THRALL_MODEL_EQUIPPED); + + case GOSSIP_ACTION_INFO_DEF+20: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, pCreature->GetGUID()); + pCreature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); + if (pInstance) + pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); + + DoScriptText(SAY_TH_START_EVENT_PART2, pCreature); + + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); break; - case 11: - SetRun(); + + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) + pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS); + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); break; - case 15: - me->SummonCreature(MOB_ENTRY_RIFLE,2200.28,137.37,87.93,5.07,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2197.44,131.83,87.93,0.78,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2203.62,135.40,87.93,3.70,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2200.75,130.13,87.93,1.48,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 21: - me->SummonCreature(MOB_ENTRY_RIFLE,2135.80,154.01,67.45,4.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2144.36,151.87,67.74,4.46,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2142.12,154.41,67.12,4.56,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2138.08,155.38,67.24,4.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 25: - me->SummonCreature(MOB_ENTRY_RIFLE,2102.98,192.17,65.24,6.02,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2108.48,198.75,65.18,5.15,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2106.11,197.29,65.18,5.63,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2104.18,194.82,65.18,5.75,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 29: - DoScriptText(SAY_TH_SKARLOC_MEET, me); - me->SummonCreature(ENTRY_SCARLOC,2036.48,271.22,63.43,5.27,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); - //temporary,skarloc should rather be triggered to walk up to thrall - break; - case 30: - SetEscortPaused(true); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetRun(false); - break; - case 31: - DoScriptText(SAY_TH_MOUNTS_UP, me); + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + { + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + pPlayer->SendPreparedQuest(pCreature->GetGUID()); + } + + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance) + { + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WALKING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START, pCreature->GetGUID()); + } + + if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && !pInstance->GetData(TYPE_THRALL_PART2)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC1, pCreature->GetGUID()); + } + + if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && !pInstance->GetData(TYPE_THRALL_PART3)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TARREN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_TARREN, pCreature->GetGUID()); + } + } + return true; + } + + struct npc_thrall_old_hillsbradAI : public npc_escortAI + { + npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + HadMount = false; + me->setActive(true); + } + + InstanceScript *pInstance; + + uint64 TarethaGUID; + + bool LowHp; + bool HadMount; + + void WaypointReached(uint32 i) + { + if (!pInstance) + return; + + switch(i) + { + case 8: + SetRun(false); + me->SummonCreature(18764,2181.87,112.46,89.45,0.26,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 9: + DoScriptText(SAY_TH_ARMORY, me); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038); + break; + case 10: + me->SetDisplayId(THRALL_MODEL_EQUIPPED); + break; + case 11: + SetRun(); + break; + case 15: + me->SummonCreature(MOB_ENTRY_RIFLE,2200.28,137.37,87.93,5.07,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2197.44,131.83,87.93,0.78,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2203.62,135.40,87.93,3.70,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2200.75,130.13,87.93,1.48,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 21: + me->SummonCreature(MOB_ENTRY_RIFLE,2135.80,154.01,67.45,4.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2144.36,151.87,67.74,4.46,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2142.12,154.41,67.12,4.56,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2138.08,155.38,67.24,4.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 25: + me->SummonCreature(MOB_ENTRY_RIFLE,2102.98,192.17,65.24,6.02,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2108.48,198.75,65.18,5.15,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2106.11,197.29,65.18,5.63,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2104.18,194.82,65.18,5.75,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 29: + DoScriptText(SAY_TH_SKARLOC_MEET, me); + me->SummonCreature(ENTRY_SCARLOC,2036.48,271.22,63.43,5.27,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); + //temporary,skarloc should rather be triggered to walk up to thrall + break; + case 30: + SetEscortPaused(true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetRun(false); + break; + case 31: + DoScriptText(SAY_TH_MOUNTS_UP, me); + DoMount(); + SetRun(); + break; + case 37: + //possibly regular patrollers? If so, remove this and let database handle them + me->SummonCreature(MOB_ENTRY_WATCHMAN,2124.26,522.16,56.87,3.99,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WATCHMAN,2121.69,525.37,57.11,4.01,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_SENTRY,2124.65,524.55,56.63,3.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 59: + me->SummonCreature(SKARLOC_MOUNT,2488.64,625.77,58.26,4.71,TEMPSUMMON_TIMED_DESPAWN,10000); + DoUnmount(); + HadMount = false; + SetRun(false); + break; + case 60: + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + //make horsie run off + SetEscortPaused(true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(TYPE_THRALL_PART2, DONE); + SetRun(); + break; + case 64: + SetRun(false); + break; + case 68: + me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22,692.60,55.50,2.84,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT,2500.13,696.55,55.51,3.38,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.55,693.64,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94,695.81,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 71: + SetRun(); + break; + case 81: + SetRun(false); + break; + case 83: + me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33,646.82,56.03,4.28,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT,2624.14,648.03,56.03,4.50,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2625.32,649.60,56.03,4.38,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2627.22,649.00,56.03,4.34,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + break; + case 84: + DoScriptText(SAY_TH_CHURCH_END, me); + SetRun(); + break; + case 91: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetRun(false); + break; + case 93: + me->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96,662.59,61.93,0.79,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2657.36,662.34,61.93,2.68,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39,659.77,61.93,2.61,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 94: + if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + { + if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) + DoScriptText(SAY_TA_ESCAPED, Taretha, me); + } + break; + case 95: + DoScriptText(SAY_TH_MEET_TARETHA, me); + pInstance->SetData(TYPE_THRALL_PART3,DONE); + SetEscortPaused(true); + break; + case 96: + DoScriptText(SAY_TH_EPOCH_WONDER, me); + break; + case 97: + DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me); + SetRun(); + break; + case 98: + //trigger epoch Yell("Thrall! Come outside and face your fate! ....") + //from here, thrall should not never be allowed to move to point 106 which he currently does. + break; + + case 106: + { + //trigger taretha to run down outside + if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) + { + if (Player* pPlayer = GetPlayerForEscort()) + CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); + } + + //kill credit Creature for quest + Map* pMap = me->GetMap(); + Map::PlayerList const& players = pMap->GetPlayers(); + if (!players.isEmpty() && pMap->IsDungeon()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonsterCredit(20156,me->GetGUID()); + } + } + + //alot will happen here, thrall and taretha talk, erozion appear at spot to explain + me->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); + } + break; + case 108: + //last waypoint, just set Thrall invisible, respawn is turned off + me->SetVisibility(VISIBILITY_OFF); + break; + } + } + + void Reset() + { + LowHp = false; + + if (HadMount) DoMount(); - SetRun(); - break; - case 37: - //possibly regular patrollers? If so, remove this and let database handle them - me->SummonCreature(MOB_ENTRY_WATCHMAN,2124.26,522.16,56.87,3.99,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WATCHMAN,2121.69,525.37,57.11,4.01,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_SENTRY,2124.65,524.55,56.63,3.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 59: - me->SummonCreature(SKARLOC_MOUNT,2488.64,625.77,58.26,4.71,TEMPSUMMON_TIMED_DESPAWN,10000); + + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { DoUnmount(); HadMount = false; - SetRun(false); - break; - case 60: - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - //make horsie run off - SetEscortPaused(true); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(TYPE_THRALL_PART2, DONE); - SetRun(); - break; - case 64: - SetRun(false); - break; - case 68: - me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22,692.60,55.50,2.84,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT,2500.13,696.55,55.51,3.38,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.55,693.64,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94,695.81,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 71: - SetRun(); - break; - case 81: - SetRun(false); - break; - case 83: - me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33,646.82,56.03,4.28,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT,2624.14,648.03,56.03,4.50,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2625.32,649.60,56.03,4.38,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2627.22,649.00,56.03,4.34,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - break; - case 84: - DoScriptText(SAY_TH_CHURCH_END, me); - SetRun(); - break; - case 91: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetRun(false); - break; - case 93: - me->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96,662.59,61.93,0.79,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2657.36,662.34,61.93,2.68,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39,659.77,61.93,2.61,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 94: - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) - { - if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) - DoScriptText(SAY_TA_ESCAPED, Taretha, me); - } - break; - case 95: - DoScriptText(SAY_TH_MEET_TARETHA, me); - pInstance->SetData(TYPE_THRALL_PART3,DONE); - SetEscortPaused(true); - break; - case 96: - DoScriptText(SAY_TH_EPOCH_WONDER, me); - break; - case 97: - DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me); - SetRun(); - break; - case 98: - //trigger epoch Yell("Thrall! Come outside and face your fate! ....") - //from here, thrall should not never be allowed to move to point 106 which he currently does. - break; - - case 106: - { - //trigger taretha to run down outside - if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) - { - if (Player* pPlayer = GetPlayerForEscort()) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); - } - - //kill credit Creature for quest - Map* pMap = me->GetMap(); - Map::PlayerList const& players = pMap->GetPlayers(); - if (!players.isEmpty() && pMap->IsDungeon()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonsterCredit(20156,me->GetGUID()); - } - } - - //alot will happen here, thrall and taretha talk, erozion appear at spot to explain - me->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); - } - break; - case 108: - //last waypoint, just set Thrall invisible, respawn is turned off - me->SetVisibility(VISIBILITY_OFF); - break; - } - } - - void Reset() - { - LowHp = false; - - if (HadMount) - DoMount(); - - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - DoUnmount(); - HadMount = false; - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); - me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); - } - if (HasEscortState(STATE_ESCORT_ESCORTING)) - { - DoScriptText(RAND(SAY_TH_LEAVE_COMBAT1,SAY_TH_LEAVE_COMBAT2,SAY_TH_LEAVE_COMBAT3), me); - } - } - void StartWP() - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetEscortPaused(false); - } - void DoMount() - { - me->Mount(SKARLOC_MOUNT_MODEL); - me->SetSpeed(MOVE_RUN,SPEED_MOUNT); - } - void DoUnmount() - { - me->Unmount(); - me->SetSpeed(MOVE_RUN,SPEED_RUN); - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(RAND(SAY_TH_RANDOM_AGGRO1,SAY_TH_RANDOM_AGGRO2,SAY_TH_RANDOM_AGGRO3,SAY_TH_RANDOM_AGGRO4), me); - if (me->IsMounted()) - { - DoUnmount(); - HadMount = true; - } - } - - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) - { - //TODO: make Scarloc start into event instead, and not start attack directly - case MOB_ENTRY_BARN_GUARDSMAN: - case MOB_ENTRY_BARN_PROTECTOR: - case MOB_ENTRY_BARN_LOOKOUT: - case SKARLOC_MOUNT: - case EROZION_ENTRY: - break; - default: - summoned->AI()->AttackStart(me); - break; - } - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_TH_RANDOM_KILL1,SAY_TH_RANDOM_KILL2,SAY_TH_RANDOM_KILL3), me); - } - void JustDied(Unit *slayer) - { - if (pInstance) - pInstance->SetData(TYPE_THRALL_EVENT,FAIL); - - // Don't do a yell if he kills self (if player goes too far or at the end). - if (slayer == me) - return; - - DoScriptText(RAND(SAY_TH_RANDOM_DIE1,SAY_TH_RANDOM_DIE2), me); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - //TODO: add his abilities'n-crap here - if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) - { - DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1,SAY_TH_RANDOM_LOW_HP2), me); - LowHp = true; + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); } - } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + DoScriptText(RAND(SAY_TH_LEAVE_COMBAT1,SAY_TH_LEAVE_COMBAT2,SAY_TH_LEAVE_COMBAT3), me); + } + } + void StartWP() + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetEscortPaused(false); + } + void DoMount() + { + me->Mount(SKARLOC_MOUNT_MODEL); + me->SetSpeed(MOVE_RUN,SPEED_MOUNT); + } + void DoUnmount() + { + me->Unmount(); + me->SetSpeed(MOVE_RUN,SPEED_RUN); + } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_TH_RANDOM_AGGRO1,SAY_TH_RANDOM_AGGRO2,SAY_TH_RANDOM_AGGRO3,SAY_TH_RANDOM_AGGRO4), me); + if (me->IsMounted()) + { + DoUnmount(); + HadMount = true; + } + } + + void JustSummoned(Creature* summoned) + { + switch(summoned->GetEntry()) + { + //TODO: make Scarloc start into event instead, and not start attack directly + case MOB_ENTRY_BARN_GUARDSMAN: + case MOB_ENTRY_BARN_PROTECTOR: + case MOB_ENTRY_BARN_LOOKOUT: + case SKARLOC_MOUNT: + case EROZION_ENTRY: + break; + default: + summoned->AI()->AttackStart(me); + break; + } + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_TH_RANDOM_KILL1,SAY_TH_RANDOM_KILL2,SAY_TH_RANDOM_KILL3), me); + } + void JustDied(Unit *slayer) + { + if (pInstance) + pInstance->SetData(TYPE_THRALL_EVENT,FAIL); + + // Don't do a yell if he kills self (if player goes too far or at the end). + if (slayer == me) + return; + + DoScriptText(RAND(SAY_TH_RANDOM_DIE1,SAY_TH_RANDOM_DIE2), me); + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + //TODO: add his abilities'n-crap here + if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) + { + DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1,SAY_TH_RANDOM_LOW_HP2), me); + LowHp = true; + } + } + }; + }; -CreatureAI* GetAI_npc_thrall_old_hillsbrad(Creature* pCreature) -{ - return new npc_thrall_old_hillsbradAI(pCreature); -} -bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - { - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SendPreparedQuest(pCreature->GetGUID()); - } - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance) - { - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WALKING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START, pCreature->GetGUID()); - } - - if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && !pInstance->GetData(TYPE_THRALL_PART2)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC1, pCreature->GetGUID()); - } - - if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && !pInstance->GetData(TYPE_THRALL_PART3)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TARREN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_TARREN, pCreature->GetGUID()); - } - } - return true; -} - -bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - { - pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); - pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); - } - - DoScriptText(SAY_TH_START_EVENT_PART1, pCreature); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - - CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); - break; - - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC2, pCreature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+20: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, pCreature->GetGUID()); - pCreature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); - if (pInstance) - pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); - - DoScriptText(SAY_TH_START_EVENT_PART2, pCreature); - - CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); - break; - - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS); - CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); - break; - } - return true; -} /*###### ## npc_taretha @@ -554,80 +570,89 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, #define GOSSIP_ITEM_EPOCH1 "Strange wizard?" #define GOSSIP_ID_EPOCH2 9613 //Yes, friends. This man was no wizard of #define GOSSIP_ITEM_EPOCH2 "We'll get you out. Taretha. Don't worry. I doubt the wizard would wander too far away." - -struct npc_tarethaAI : public npc_escortAI + class npc_taretha : public CreatureScript { - npc_tarethaAI(Creature *c) : npc_escortAI(c) +public: + npc_taretha() : CreatureScript("npc_taretha") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_tarethaAI(pCreature); } - ScriptedInstance *pInstance; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(i) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case 6: - DoScriptText(SAY_TA_FREE, me); - break; - case 7: - me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); - break; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, pCreature->GetGUID()); } - } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + { + pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); + if (pInstance->GetData64(DATA_EPOCH) == 0) + pCreature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + + if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) + { + Creature* Thrall = (Unit::GetCreature((*pCreature), ThrallGUID)); + if (Thrall) + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, Thrall->AI())->StartWP(); + } + } + } + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_THRALL_PART3) == DONE && pInstance->GetData(TYPE_THRALL_PART4) == NOT_STARTED) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH1, pCreature->GetGUID()); + } + return true; + } + + struct npc_tarethaAI : public npc_escortAI + { + npc_tarethaAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void WaypointReached(uint32 i) + { + switch(i) + { + case 6: + DoScriptText(SAY_TA_FREE, me); + break; + case 7: + me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); + break; + } + } + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_npc_taretha(Creature* pCreature) -{ - return new npc_tarethaAI(pCreature); -} -bool GossipHello_npc_taretha(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_THRALL_PART3) == DONE && pInstance->GetData(TYPE_THRALL_PART4) == NOT_STARTED) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH1, pCreature->GetGUID()); - } - return true; -} -bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, pCreature->GetGUID()); - } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) - { - pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); - if (pInstance->GetData64(DATA_EPOCH) == 0) - pCreature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); - - if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) - { - Creature* Thrall = (Unit::GetCreature((*pCreature), ThrallGUID)); - if (Thrall) - CAST_AI(npc_thrall_old_hillsbradAI, Thrall->AI())->StartWP(); - } - } - } - return true; -} /*###### ## AddSC @@ -635,26 +660,7 @@ bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 /*uiS void AddSC_old_hillsbrad() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_erozion"; - newscript->pGossipHello = &GossipHello_npc_erozion; - newscript->pGossipSelect = &GossipSelect_npc_erozion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall_old_hillsbrad"; - newscript->pGossipHello = &GossipHello_npc_thrall_old_hillsbrad; - newscript->pGossipSelect = &GossipSelect_npc_thrall_old_hillsbrad; - newscript->GetAI = &GetAI_npc_thrall_old_hillsbrad; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_taretha"; - newscript->pGossipHello = &GossipHello_npc_taretha; - newscript->pGossipSelect = &GossipSelect_npc_taretha; - newscript->GetAI = &GetAI_npc_taretha; - newscript->RegisterSelf(); + new npc_erozion(); + new npc_thrall_old_hillsbrad(); + new npc_taretha(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 61cd06f0f1c..47c8e18757b 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -28,73 +28,75 @@ EndScriptData */ #define SPELL_WRATH 21807 #define SPELL_ENTANGLINGROOTS 12747 #define SPELL_CORRUPT_FORCES 21968 - -struct celebras_the_cursedAI : public ScriptedAI + class celebras_the_cursed : public CreatureScript { - celebras_the_cursedAI(Creature *c) : ScriptedAI(c) {} +public: + celebras_the_cursed() : CreatureScript("celebras_the_cursed") { } - uint32 Wrath_Timer; - uint32 EntanglingRoots_Timer; - uint32 CorruptForces_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Wrath_Timer = 8000; - EntanglingRoots_Timer = 2000; - CorruptForces_Timer = 30000; + return new celebras_the_cursedAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void JustDied(Unit* /*Killer*/) + struct celebras_the_cursedAI : public ScriptedAI { - me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); - } + celebras_the_cursedAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Wrath_Timer; + uint32 EntanglingRoots_Timer; + uint32 CorruptForces_Timer; - //Wrath - if (Wrath_Timer <= diff) + void Reset() { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_WRATH); Wrath_Timer = 8000; - } else Wrath_Timer -= diff; + EntanglingRoots_Timer = 2000; + CorruptForces_Timer = 30000; + } - //EntanglingRoots - if (EntanglingRoots_Timer <= diff) + void EnterCombat(Unit * /*who*/) { } + + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); - EntanglingRoots_Timer = 20000; - } else EntanglingRoots_Timer -= diff; + me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); + } - //CorruptForces - if (CorruptForces_Timer <= diff) + void UpdateAI(const uint32 diff) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_CORRUPT_FORCES); - CorruptForces_Timer = 20000; - } else CorruptForces_Timer -= diff; + if (!UpdateVictim()) + return; + + //Wrath + if (Wrath_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_WRATH); + Wrath_Timer = 8000; + } else Wrath_Timer -= diff; + + //EntanglingRoots + if (EntanglingRoots_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); + EntanglingRoots_Timer = 20000; + } else EntanglingRoots_Timer -= diff; + + //CorruptForces + if (CorruptForces_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_CORRUPT_FORCES); + CorruptForces_Timer = 20000; + } else CorruptForces_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_celebras_the_cursed(Creature* pCreature) -{ - return new celebras_the_cursedAI (pCreature); -} void AddSC_boss_celebras_the_cursed() { - Script *newscript; - newscript = new Script; - newscript->Name = "celebras_the_cursed"; - newscript->GetAI = &GetAI_celebras_the_cursed; - newscript->RegisterSelf(); + new celebras_the_cursed(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index b7d89607857..1f94c146eb4 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -28,70 +28,72 @@ EndScriptData */ #define SPELL_KNOCKAWAY 18670 #define SPELL_TRAMPLE 5568 #define SPELL_LANDSLIDE 21808 - -struct boss_landslideAI : public ScriptedAI + class boss_landslide : public CreatureScript { - boss_landslideAI(Creature *c) : ScriptedAI(c) {} +public: + boss_landslide() : CreatureScript("boss_landslide") { } - uint32 KnockAway_Timer; - uint32 Trample_Timer; - uint32 Landslide_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - KnockAway_Timer = 8000; - Trample_Timer = 2000; - Landslide_Timer = 0; + return new boss_landslideAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_landslideAI : public ScriptedAI { - } + boss_landslideAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 KnockAway_Timer; + uint32 Trample_Timer; + uint32 Landslide_Timer; - //KnockAway_Timer - if (KnockAway_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 15000; - } else KnockAway_Timer -= diff; - - //Trample_Timer - if (Trample_Timer <= diff) - { - DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 8000; - } else Trample_Timer -= diff; - - //Landslide - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) - { - if (Landslide_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_LANDSLIDE); - Landslide_Timer = 60000; - } else Landslide_Timer -= diff; + KnockAway_Timer = 8000; + Trample_Timer = 2000; + Landslide_Timer = 0; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 15000; + } else KnockAway_Timer -= diff; + + //Trample_Timer + if (Trample_Timer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + Trample_Timer = 8000; + } else Trample_Timer -= diff; + + //Landslide + if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + if (Landslide_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_LANDSLIDE); + Landslide_Timer = 60000; + } else Landslide_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_landslide(Creature* pCreature) -{ - return new boss_landslideAI (pCreature); -} void AddSC_boss_landslide() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_landslide"; - newscript->GetAI = &GetAI_boss_landslide; - newscript->RegisterSelf(); + new boss_landslide(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index f2856e89fd1..c9b229b0c8b 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -27,107 +27,109 @@ EndScriptData */ #define SPELL_TOXICVOLLEY 21687 #define SPELL_UPPERCUT 22916 - -struct boss_noxxionAI : public ScriptedAI + class boss_noxxion : public CreatureScript { - boss_noxxionAI(Creature *c) : ScriptedAI(c) {} +public: + boss_noxxion() : CreatureScript("boss_noxxion") { } - uint32 ToxicVolley_Timer; - uint32 Uppercut_Timer; - uint32 Adds_Timer; - uint32 Invisible_Timer; - bool Invisible; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ToxicVolley_Timer = 7000; - Uppercut_Timer = 16000; - Adds_Timer = 19000; - Invisible_Timer = 15000; //Too much too low? - Invisible = false; + return new boss_noxxionAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_noxxionAI : public ScriptedAI { - } + boss_noxxionAI(Creature *c) : ScriptedAI(c) {} - void SummonAdds(Unit* pVictim) - { - if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000)) - Add->AI()->AttackStart(pVictim); - } + uint32 ToxicVolley_Timer; + uint32 Uppercut_Timer; + uint32 Adds_Timer; + uint32 Invisible_Timer; + bool Invisible; - void UpdateAI(const uint32 diff) - { - if (Invisible && Invisible_Timer <= diff) + void Reset() { - //Become visible again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //Noxxion model - me->SetDisplayId(11172); + ToxicVolley_Timer = 7000; + Uppercut_Timer = 16000; + Adds_Timer = 19000; + Invisible_Timer = 15000; //Too much too low? Invisible = false; - //me->m_canMove = true; - } else if (Invisible) - { - Invisible_Timer -= diff; - //Do nothing while invisible - return; } - //Return since we have no target - if (!UpdateVictim()) - return; - - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_TOXICVOLLEY); - ToxicVolley_Timer = 9000; - } else ToxicVolley_Timer -= diff; + } - //Uppercut_Timer - if (Uppercut_Timer <= diff) + void SummonAdds(Unit* pVictim) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 12000; - } else Uppercut_Timer -= diff; + if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000)) + Add->AI()->AttackStart(pVictim); + } - //Adds_Timer - if (!Invisible && Adds_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Interrupt any spell casting - //me->m_canMove = true; - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - // Invisible Model - me->SetDisplayId(11686); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - Invisible = true; - Invisible_Timer = 15000; + if (Invisible && Invisible_Timer <= diff) + { + //Become visible again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //Noxxion model + me->SetDisplayId(11172); + Invisible = false; + //me->m_canMove = true; + } else if (Invisible) + { + Invisible_Timer -= diff; + //Do nothing while invisible + return; + } - Adds_Timer = 40000; - } else Adds_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //ToxicVolley_Timer + if (ToxicVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TOXICVOLLEY); + ToxicVolley_Timer = 9000; + } else ToxicVolley_Timer -= diff; + + //Uppercut_Timer + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 12000; + } else Uppercut_Timer -= diff; + + //Adds_Timer + if (!Invisible && Adds_Timer <= diff) + { + //Interrupt any spell casting + //me->m_canMove = true; + me->InterruptNonMeleeSpells(false); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + // Invisible Model + me->SetDisplayId(11686); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + Invisible = true; + Invisible_Timer = 15000; + + Adds_Timer = 40000; + } else Adds_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_noxxion(Creature* pCreature) -{ - return new boss_noxxionAI (pCreature); -} void AddSC_boss_noxxion() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_noxxion"; - newscript->GetAI = &GetAI_boss_noxxion; - newscript->RegisterSelf(); + new boss_noxxion(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 9bd8735f4d2..e8c96242c21 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -29,83 +29,85 @@ EndScriptData */ #define SPELL_BOULDER 21832 #define SPELL_THRASH 3391 #define SPELL_REPULSIVEGAZE 21869 - -struct boss_ptheradrasAI : public ScriptedAI + class boss_princess_theradras : public CreatureScript { - boss_ptheradrasAI(Creature *c) : ScriptedAI(c) {} +public: + boss_princess_theradras() : CreatureScript("boss_princess_theradras") { } - uint32 Dustfield_Timer; - uint32 Boulder_Timer; - uint32 Thrash_Timer; - uint32 RepulsiveGaze_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Dustfield_Timer = 8000; - Boulder_Timer = 2000; - Thrash_Timer = 5000; - RepulsiveGaze_Timer = 23000; + return new boss_ptheradrasAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ptheradrasAI : public ScriptedAI { - } + boss_ptheradrasAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*killer*/) - { - me->SummonCreature(12238,28.067,61.875,-123.405,4.67,TEMPSUMMON_TIMED_DESPAWN,600000); - } + uint32 Dustfield_Timer; + uint32 Boulder_Timer; + uint32 Thrash_Timer; + uint32 RepulsiveGaze_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Dustfield_Timer - if (Dustfield_Timer <= diff) + void Reset() { - DoCast(me, SPELL_DUSTFIELD); - Dustfield_Timer = 14000; - } else Dustfield_Timer -= diff; + Dustfield_Timer = 8000; + Boulder_Timer = 2000; + Thrash_Timer = 5000; + RepulsiveGaze_Timer = 23000; + } - //Boulder_Timer - if (Boulder_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_BOULDER); - Boulder_Timer = 10000; - } else Boulder_Timer -= diff; + } - //RepulsiveGaze_Timer - if (RepulsiveGaze_Timer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); - RepulsiveGaze_Timer = 20000; - } else RepulsiveGaze_Timer -= diff; + me->SummonCreature(12238,28.067,61.875,-123.405,4.67,TEMPSUMMON_TIMED_DESPAWN,600000); + } - //Thrash_Timer - if (Thrash_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_THRASH); - Thrash_Timer = 18000; - } else Thrash_Timer -= diff; + if (!UpdateVictim()) + return; + + //Dustfield_Timer + if (Dustfield_Timer <= diff) + { + DoCast(me, SPELL_DUSTFIELD); + Dustfield_Timer = 14000; + } else Dustfield_Timer -= diff; + + //Boulder_Timer + if (Boulder_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_BOULDER); + Boulder_Timer = 10000; + } else Boulder_Timer -= diff; + + //RepulsiveGaze_Timer + if (RepulsiveGaze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); + RepulsiveGaze_Timer = 20000; + } else RepulsiveGaze_Timer -= diff; + + //Thrash_Timer + if (Thrash_Timer <= diff) + { + DoCast(me, SPELL_THRASH); + Thrash_Timer = 18000; + } else Thrash_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ptheradras(Creature* pCreature) -{ - return new boss_ptheradrasAI (pCreature); -} void AddSC_boss_ptheradras() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_princess_theradras"; - newscript->GetAI = &GetAI_boss_ptheradras; - newscript->RegisterSelf(); + new boss_princess_theradras(); } - diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index b346f848510..a78997410dc 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -98,404 +98,406 @@ static Position aSpawnLocations[3]= //Lair Guard {-145.950, -212.831, -68.659} }; - -struct boss_onyxiaAI : public ScriptedAI + class boss_onyxia : public CreatureScript { - boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me) +public: + boss_onyxia() : CreatureScript("boss_onyxia") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - Reset(); + return new boss_onyxiaAI (pCreature); } - ScriptedInstance* m_pInstance; - SummonList Summons; - - uint32 m_uiPhase; - - uint32 m_uiFlameBreathTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiWingBuffetTimer; - - uint32 m_uiMovePoint; - uint32 m_uiMovementTimer; - sOnyxMove* m_pPointData; - - uint32 m_uiFireballTimer; - uint32 m_uiWhelpTimer; - uint32 m_uiLairGuardTimer; - uint32 m_uiDeepBreathTimer; - - uint32 m_uiBellowingRoarTimer; - - uint8 m_uiSummonWhelpCount; - uint8 m_uiSummonLairGuardCount; - bool m_bIsMoving; - - void Reset() + struct boss_onyxiaAI : public ScriptedAI { - if (!IsCombatMovement()) - SetCombatMovement(true); - - m_uiPhase = PHASE_START; - - m_uiFlameBreathTimer = urand(10000, 20000); - m_uiTailSweepTimer = urand(15000, 20000); - m_uiCleaveTimer = urand(2000, 5000); - m_uiWingBuffetTimer = urand(10000, 20000); - - m_uiMovePoint = urand(0, 5); - m_uiMovementTimer = 20000; - m_pPointData = GetMoveData(); - - m_uiFireballTimer = 15000; - m_uiWhelpTimer = 1000; - m_uiLairGuardTimer = 15000; - m_uiDeepBreathTimer = 85000; - - m_uiBellowingRoarTimer = 30000; - - Summons.DespawnAll(); - m_uiSummonWhelpCount = 0; - m_uiSummonLairGuardCount = 0; - m_bIsMoving = false; - - if (m_pInstance) + boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me) { - m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); - m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + m_pInstance = pCreature->GetInstanceScript(); + Reset(); } - } - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_AGGRO, me); - me->SetInCombatWithZone(); + InstanceScript* m_pInstance; + SummonList Summons; + + uint32 m_uiPhase; + + uint32 m_uiFlameBreathTimer; + uint32 m_uiCleaveTimer; + uint32 m_uiTailSweepTimer; + uint32 m_uiWingBuffetTimer; + + uint32 m_uiMovePoint; + uint32 m_uiMovementTimer; + sOnyxMove* m_pPointData; + + uint32 m_uiFireballTimer; + uint32 m_uiWhelpTimer; + uint32 m_uiLairGuardTimer; + uint32 m_uiDeepBreathTimer; + + uint32 m_uiBellowingRoarTimer; + + uint8 m_uiSummonWhelpCount; + uint8 m_uiSummonLairGuardCount; + bool m_bIsMoving; - if (m_pInstance) + void Reset() { - m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - sLog.outBasic("[Onyxia] DoStartTimedAchievement(%u,%u)",ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - } + if (!IsCombatMovement()) + SetCombatMovement(true); - void JustDied(Unit* killer) - { - if (m_pInstance) - m_pInstance->SetData(DATA_ONYXIA, DONE); + m_uiPhase = PHASE_START; - Summons.DespawnAll(); - } + m_uiFlameBreathTimer = urand(10000, 20000); + m_uiTailSweepTimer = urand(15000, 20000); + m_uiCleaveTimer = urand(2000, 5000); + m_uiWingBuffetTimer = urand(10000, 20000); - void JustSummoned(Creature *pSummoned) - { - pSummoned->SetInCombatWithZone(); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - pSummoned->AI()->AttackStart(pTarget); - - switch (pSummoned->GetEntry()) - { - case NPC_WHELP: - ++m_uiSummonWhelpCount; - break; - case NPC_LAIRGUARD: - pSummoned->setActive(true); - ++m_uiSummonLairGuardCount; - break; - } - Summons.Summon(pSummoned); - } - - void SummonedCreatureDespawn(Creature *summon) - { - Summons.Despawn(summon); - } - - void KilledUnit(Unit* pVictim) - { - DoScriptText(SAY_KILL, me); - } - - void SpellHit(Unit *pCaster, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || - pSpell->Id == SPELL_BREATH_WEST_TO_EAST || - pSpell->Id == SPELL_BREATH_SE_TO_NW || - pSpell->Id == SPELL_BREATH_NW_TO_SE || - pSpell->Id == SPELL_BREATH_SW_TO_NE || - pSpell->Id == SPELL_BREATH_NE_TO_SW) - { + m_uiMovePoint = urand(0, 5); + m_uiMovementTimer = 20000; m_pPointData = GetMoveData(); - m_uiMovePoint = m_pPointData->uiLocIdEnd; - me->SetSpeed(MOVE_FLIGHT, 1.5f); - me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); - } - } + m_uiFireballTimer = 15000; + m_uiWhelpTimer = 1000; + m_uiLairGuardTimer = 15000; + m_uiDeepBreathTimer = 85000; - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE) - { - switch (id) - { - case 8: - m_pPointData = GetMoveData(); - if (m_pPointData) - { - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - } - break; - case 9: - me->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiBellowingRoarTimer = 1000; - break; - default: - m_bIsMoving = false; - break; - } - } - } - - void SpellHitTarget(Unit* target, const SpellEntry* pSpell) - { - //Workaround - Couldn't find a way to group this spells (All Eruption) - if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || - (pSpell->Id == 17097) || - (pSpell->Id >= 18351 && pSpell->Id <= 18361) || - (pSpell->Id >= 18564 && pSpell->Id <= 18576) || - (pSpell->Id >= 18578 && pSpell->Id <= 18607) || - (pSpell->Id == 18609) || - (pSpell->Id >= 18611 && pSpell->Id <= 18628) || - (pSpell->Id >= 21132 && pSpell->Id <= 21133) || - (pSpell->Id >= 21135 && pSpell->Id <= 21139) || - (pSpell->Id >= 22191 && pSpell->Id <= 22202) || - (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && - (target->GetTypeId() == TYPEID_PLAYER)) - { + m_uiBellowingRoarTimer = 30000; + + Summons.DespawnAll(); + m_uiSummonWhelpCount = 0; + m_uiSummonLairGuardCount = 0; + m_bIsMoving = false; + if (m_pInstance) { - m_pInstance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); + m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); + m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } - } - sOnyxMove* GetMoveData() - { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); - - for (uint32 i = 0; i < uiMaxCount; ++i) + void EnterCombat(Unit* pWho) { - if (aMoveData[i].uiLocId == m_uiMovePoint) - return &aMoveData[i]; + DoScriptText(SAY_AGGRO, me); + me->SetInCombatWithZone(); + + if (m_pInstance) + { + m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + sLog.outBasic("[Onyxia] DoStartTimedAchievement(%u,%u)",ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } } - return NULL; - } - - void SetNextRandomPoint() - { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); - - int iTemp = rand()%(uiMaxCount-1); - - if (iTemp >= m_uiMovePoint) - ++iTemp; - - m_uiMovePoint = iTemp; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //Common to PHASE_START && PHASE_END - if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) + void JustDied(Unit* killer) { - //Specific to PHASE_START || PHASE_END - if (m_uiPhase == PHASE_START) + if (m_pInstance) + m_pInstance->SetData(DATA_ONYXIA, DONE); + + Summons.DespawnAll(); + } + + void JustSummoned(Creature *pSummoned) + { + pSummoned->SetInCombatWithZone(); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + pSummoned->AI()->AttackStart(pTarget); + + switch (pSummoned->GetEntry()) { - if (me->GetHealth()*100 / me->GetMaxHealth() < 60) + case NPC_WHELP: + ++m_uiSummonWhelpCount; + break; + case NPC_LAIRGUARD: + pSummoned->setActive(true); + ++m_uiSummonLairGuardCount; + break; + } + Summons.Summon(pSummoned); + } + + void SummonedCreatureDespawn(Creature *summon) + { + Summons.Despawn(summon); + } + + void KilledUnit(Unit* pVictim) + { + DoScriptText(SAY_KILL, me); + } + + void SpellHit(Unit *pCaster, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || + pSpell->Id == SPELL_BREATH_WEST_TO_EAST || + pSpell->Id == SPELL_BREATH_SE_TO_NW || + pSpell->Id == SPELL_BREATH_NW_TO_SE || + pSpell->Id == SPELL_BREATH_SW_TO_NE || + pSpell->Id == SPELL_BREATH_NE_TO_SW) + { + m_pPointData = GetMoveData(); + m_uiMovePoint = m_pPointData->uiLocIdEnd; + + me->SetSpeed(MOVE_FLIGHT, 1.5f); + me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (type == POINT_MOTION_TYPE) + { + switch (id) { - m_uiPhase = PHASE_BREATH; - + case 8: + m_pPointData = GetMoveData(); + if (m_pPointData) + { + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + } + break; + case 9: + me->GetMotionMaster()->MoveChase(me->getVictim()); + m_uiBellowingRoarTimer = 1000; + break; + default: + m_bIsMoving = false; + break; + } + } + } + + void SpellHitTarget(Unit* target, const SpellEntry* pSpell) + { + //Workaround - Couldn't find a way to group this spells (All Eruption) + if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || + (pSpell->Id == 17097) || + (pSpell->Id >= 18351 && pSpell->Id <= 18361) || + (pSpell->Id >= 18564 && pSpell->Id <= 18576) || + (pSpell->Id >= 18578 && pSpell->Id <= 18607) || + (pSpell->Id == 18609) || + (pSpell->Id >= 18611 && pSpell->Id <= 18628) || + (pSpell->Id >= 21132 && pSpell->Id <= 21133) || + (pSpell->Id >= 21135 && pSpell->Id <= 21139) || + (pSpell->Id >= 22191 && pSpell->Id <= 22202) || + (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && + (target->GetTypeId() == TYPEID_PLAYER)) + { + if (m_pInstance) + { + m_pInstance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); + } + } + } + + sOnyxMove* GetMoveData() + { + uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + + for (uint32 i = 0; i < uiMaxCount; ++i) + { + if (aMoveData[i].uiLocId == m_uiMovePoint) + return &aMoveData[i]; + } + + return NULL; + } + + void SetNextRandomPoint() + { + uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + + int iTemp = rand()%(uiMaxCount-1); + + if (iTemp >= m_uiMovePoint) + ++iTemp; + + m_uiMovePoint = iTemp; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //Common to PHASE_START && PHASE_END + if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) + { + //Specific to PHASE_START || PHASE_END + if (m_uiPhase == PHASE_START) + { + if (me->GetHealth()*100 / me->GetMaxHealth() < 60) + { + m_uiPhase = PHASE_BREATH; + + if (m_pInstance) + m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + + SetCombatMovement(false); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->SetFlying(true); + + DoScriptText(SAY_PHASE_2_TRANS, me); + + if (m_pPointData) + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + + m_uiWhelpTimer = 1000; + return; + } + } + else + { + if (m_uiBellowingRoarTimer <= uiDiff) + { + DoCastVictim(SPELL_BELLOWING_ROAR); + // Eruption + GameObject* pFloor = NULL; + Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); + Trinity::GameObjectLastSearcher searcher(me, pFloor, check); + me->VisitNearbyGridObject(30, searcher); + if (m_pInstance && pFloor) + m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); + m_uiBellowingRoarTimer = 30000; + } + else + m_uiBellowingRoarTimer -= uiDiff; + } + + if (m_uiFlameBreathTimer <= uiDiff) + { + DoCastVictim(SPELL_FLAME_BREATH); + m_uiFlameBreathTimer = urand(10000, 20000); + } + else + m_uiFlameBreathTimer -= uiDiff; + + if (m_uiTailSweepTimer <= uiDiff) + { + DoCastAOE(SPELL_TAIL_SWEEP); + m_uiTailSweepTimer = urand(15000, 20000); + } + else + m_uiTailSweepTimer -= uiDiff; + + if (m_uiCleaveTimer <= uiDiff) + { + DoCastVictim(SPELL_CLEAVE); + m_uiCleaveTimer = urand(2000, 5000); + } + else + m_uiCleaveTimer -= uiDiff; + + if (m_uiWingBuffetTimer <= uiDiff) + { + DoCastVictim(SPELL_WING_BUFFET); + m_uiWingBuffetTimer = urand(15000, 30000); + } + else + m_uiWingBuffetTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + else + { + if (me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + m_uiPhase = PHASE_END; if (m_pInstance) m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + DoScriptText(SAY_PHASE_3_TRANS, me); - SetCombatMovement(false); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->SetFlying(true); - - DoScriptText(SAY_PHASE_2_TRANS, me); - - if (m_pPointData) - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - - m_uiWhelpTimer = 1000; + SetCombatMovement(true); + me->SetFlying(false); + m_bIsMoving = false; + me->GetMotionMaster()->MovePoint(9,me->GetHomePosition()); return; } - } - else - { - if (m_uiBellowingRoarTimer <= uiDiff) + + if (m_uiDeepBreathTimer <= uiDiff) { - DoCastVictim(SPELL_BELLOWING_ROAR); - // Eruption - GameObject* pFloor = NULL; - Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); - Trinity::GameObjectLastSearcher searcher(me, pFloor, check); - me->VisitNearbyGridObject(30, searcher); - if (m_pInstance && pFloor) - m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); - m_uiBellowingRoarTimer = 30000; + if (!m_bIsMoving) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoScriptText(EMOTE_BREATH, me); + DoCast(me, m_pPointData->uiSpellId); + m_uiDeepBreathTimer = 70000; + } } else - m_uiBellowingRoarTimer -= uiDiff; - } + m_uiDeepBreathTimer -= uiDiff; - if (m_uiFlameBreathTimer <= uiDiff) - { - DoCastVictim(SPELL_FLAME_BREATH); - m_uiFlameBreathTimer = urand(10000, 20000); - } - else - m_uiFlameBreathTimer -= uiDiff; + if (m_uiMovementTimer <= uiDiff) + { + if (!m_bIsMoving) + { + SetNextRandomPoint(); + m_pPointData = GetMoveData(); - if (m_uiTailSweepTimer <= uiDiff) - { - DoCastAOE(SPELL_TAIL_SWEEP); - m_uiTailSweepTimer = urand(15000, 20000); - } - else - m_uiTailSweepTimer -= uiDiff; + if (!m_pPointData) + return; - if (m_uiCleaveTimer <= uiDiff) - { - DoCastVictim(SPELL_CLEAVE); - m_uiCleaveTimer = urand(2000, 5000); - } - else - m_uiCleaveTimer -= uiDiff; + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + m_bIsMoving = true; + m_uiMovementTimer = 25000; + } + } + else + m_uiMovementTimer -= uiDiff; - if (m_uiWingBuffetTimer <= uiDiff) - { - DoCastVictim(SPELL_WING_BUFFET); - m_uiWingBuffetTimer = urand(15000, 30000); - } - else - m_uiWingBuffetTimer -= uiDiff; + if (m_uiFireballTimer <= uiDiff) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FIREBALL); - DoMeleeAttackIfReady(); + m_uiFireballTimer = 8000; + } + } + else + m_uiFireballTimer -= uiDiff; + + if (m_uiLairGuardTimer <= uiDiff) + { + me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + if (m_uiSummonLairGuardCount >= RAID_MODE(1,2)) + { + m_uiSummonLairGuardCount = 0; + m_uiLairGuardTimer = 30000; + } + else + m_uiLairGuardTimer = 2000; + } + else + m_uiLairGuardTimer -= uiDiff; + + if (m_uiWhelpTimer <= uiDiff) + { + me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + if (m_uiSummonWhelpCount >= RAID_MODE(20,40)) + { + m_uiSummonWhelpCount = 0; + m_uiWhelpTimer = 90000; + } + else + m_uiWhelpTimer = 500; + } + else + m_uiWhelpTimer -= uiDiff; + } } - else - { - if (me->GetHealth()*100 / me->GetMaxHealth() < 40) - { - m_uiPhase = PHASE_END; - if (m_pInstance) - m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - DoScriptText(SAY_PHASE_3_TRANS, me); + }; - SetCombatMovement(true); - me->SetFlying(false); - m_bIsMoving = false; - me->GetMotionMaster()->MovePoint(9,me->GetHomePosition()); - return; - } - - if (m_uiDeepBreathTimer <= uiDiff) - { - if (!m_bIsMoving) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - DoScriptText(EMOTE_BREATH, me); - DoCast(me, m_pPointData->uiSpellId); - m_uiDeepBreathTimer = 70000; - } - } - else - m_uiDeepBreathTimer -= uiDiff; - - if (m_uiMovementTimer <= uiDiff) - { - if (!m_bIsMoving) - { - SetNextRandomPoint(); - m_pPointData = GetMoveData(); - - if (!m_pPointData) - return; - - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - m_bIsMoving = true; - m_uiMovementTimer = 25000; - } - } - else - m_uiMovementTimer -= uiDiff; - - if (m_uiFireballTimer <= uiDiff) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FIREBALL); - - m_uiFireballTimer = 8000; - } - } - else - m_uiFireballTimer -= uiDiff; - - if (m_uiLairGuardTimer <= uiDiff) - { - me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonLairGuardCount >= RAID_MODE(1,2)) - { - m_uiSummonLairGuardCount = 0; - m_uiLairGuardTimer = 30000; - } - else - m_uiLairGuardTimer = 2000; - } - else - m_uiLairGuardTimer -= uiDiff; - - if (m_uiWhelpTimer <= uiDiff) - { - me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonWhelpCount >= RAID_MODE(20,40)) - { - m_uiSummonWhelpCount = 0; - m_uiWhelpTimer = 90000; - } - else - m_uiWhelpTimer = 500; - } - else - m_uiWhelpTimer -= uiDiff; - } - } }; -CreatureAI* GetAI_boss_onyxiaAI(Creature* pCreature) -{ - return new boss_onyxiaAI (pCreature); -} - void AddSC_boss_onyxia() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_onyxia"; - newscript->GetAI = &GetAI_boss_onyxiaAI; - newscript->RegisterSelf(); + new boss_onyxia(); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 36a2712fe6d..7aebe80247c 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -24,227 +24,230 @@ EndScriptData */ #include "ScriptPCH.h" #include "onyxias_lair.h" - -struct instance_onyxias_lair : public ScriptedInstance + class instance_onyxias_lair : public InstanceMapScript { - instance_onyxias_lair(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_onyxias_lair() : InstanceMapScript("instance_onyxias_lair") { } - //Eruption is a BFS graph problem - //One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed - std::map FloorEruptionGUID[2]; - std::queue FloorEruptionGUIDQueue; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_onyxias_lair_InstanceMapScript(pMap); + } + + struct instance_onyxias_lair_InstanceMapScript : public InstanceScript + { + instance_onyxias_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + //Eruption is a BFS graph problem + //One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed + std::map FloorEruptionGUID[2]; + std::queue FloorEruptionGUIDQueue; - uint64 m_uiOnyxiasGUID; - uint32 m_uiOnyxiaLiftoffTimer; - uint32 m_uiManyWhelpsCounter; - uint32 m_uiEruptTimer; + uint64 m_uiOnyxiasGUID; + uint32 m_uiOnyxiaLiftoffTimer; + uint32 m_uiManyWhelpsCounter; + uint32 m_uiEruptTimer; - uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 m_auiEncounter[MAX_ENCOUNTER]; - bool m_bAchievManyWhelpsHandleIt; - bool m_bAchievSheDeepBreathMore; + bool m_bAchievManyWhelpsHandleIt; + bool m_bAchievSheDeepBreathMore; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiOnyxiasGUID = 0; - m_uiOnyxiaLiftoffTimer = 0; - m_uiManyWhelpsCounter = 0; - m_bAchievManyWhelpsHandleIt = false; - m_bAchievSheDeepBreathMore = true; - - m_uiEruptTimer = 0; - } - - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch (pCreature->GetEntry()) + void Initialize() { - case NPC_ONYXIA: - m_uiOnyxiasGUID = pCreature->GetGUID(); - break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if ((pGo->GetGOInfo()->displayId == 4392 || pGo->GetGOInfo()->displayId == 4472) && pGo->GetGOInfo()->trap.spellId == 17731) - { - if (add) - FloorEruptionGUID[0].insert(std::make_pair(pGo->GetGUID(),0)); - else - FloorEruptionGUID[0].erase(pGo->GetGUID()); - return; + m_uiOnyxiasGUID = 0; + m_uiOnyxiaLiftoffTimer = 0; + m_uiManyWhelpsCounter = 0; + m_bAchievManyWhelpsHandleIt = false; + m_bAchievSheDeepBreathMore = true; + + m_uiEruptTimer = 0; } - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool add) { - case GO_WHELP_SPAWNER: - Position pGoPos; - pGo->GetPosition(&pGoPos); - if (Creature* pTemp = pGo->SummonCreature(NPC_WHELP,pGoPos,TEMPSUMMON_CORPSE_DESPAWN)) - { - pTemp->SetInCombatWithZone(); - ++m_uiManyWhelpsCounter; - } - break; - } - } - - void FloorEruption(uint64 floorEruptedGUID) - { - if (GameObject *pFloorEruption = instance->GetGameObject(floorEruptedGUID)) - { - //THIS GOB IS A TRAP - What shall i do? =( - //Cast it spell? Copyed Heigan method - pFloorEruption->SendCustomAnim(); - pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId - - //Get all immediatly nearby floors - std::list nearFloorList; - Trinity::GameObjectInRangeCheck check(pFloorEruption->GetPositionX(), pFloorEruption->GetPositionY(), pFloorEruption->GetPositionZ(), 15); - Trinity::GameObjectListSearcher searcher(pFloorEruption, nearFloorList, check); - pFloorEruption->VisitNearbyGridObject(999, searcher); - //remove all that are not present on FloorEruptionGUID[1] and update treeLen on each GUID - for (std::list::const_iterator itr = nearFloorList.begin(); itr != nearFloorList.end(); ++itr) + switch (pCreature->GetEntry()) { - if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731) - { - uint64 nearFloorGUID = (*itr)->GetGUID(); - if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0) + case NPC_ONYXIA: + m_uiOnyxiasGUID = pCreature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + if ((pGo->GetGOInfo()->displayId == 4392 || pGo->GetGOInfo()->displayId == 4472) && pGo->GetGOInfo()->trap.spellId == 17731) + { + if (add) + FloorEruptionGUID[0].insert(std::make_pair(pGo->GetGUID(),0)); + else + FloorEruptionGUID[0].erase(pGo->GetGUID()); + return; + } + + switch(pGo->GetEntry()) + { + case GO_WHELP_SPAWNER: + Position pGoPos; + pGo->GetPosition(&pGoPos); + if (Creature* pTemp = pGo->SummonCreature(NPC_WHELP,pGoPos,TEMPSUMMON_CORPSE_DESPAWN)) { - (*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1; - FloorEruptionGUIDQueue.push(nearFloorGUID); + pTemp->SetInCombatWithZone(); + ++m_uiManyWhelpsCounter; + } + break; + } + } + + void FloorEruption(uint64 floorEruptedGUID) + { + if (GameObject *pFloorEruption = instance->GetGameObject(floorEruptedGUID)) + { + //THIS GOB IS A TRAP - What shall i do? =( + //Cast it spell? Copyed Heigan method + pFloorEruption->SendCustomAnim(); + pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId + + //Get all immediatly nearby floors + std::list nearFloorList; + Trinity::GameObjectInRangeCheck check(pFloorEruption->GetPositionX(), pFloorEruption->GetPositionY(), pFloorEruption->GetPositionZ(), 15); + Trinity::GameObjectListSearcher searcher(pFloorEruption, nearFloorList, check); + pFloorEruption->VisitNearbyGridObject(999, searcher); + //remove all that are not present on FloorEruptionGUID[1] and update treeLen on each GUID + for (std::list::const_iterator itr = nearFloorList.begin(); itr != nearFloorList.end(); ++itr) + { + if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731) + { + uint64 nearFloorGUID = (*itr)->GetGUID(); + if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0) + { + (*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1; + FloorEruptionGUIDQueue.push(nearFloorGUID); + } } } } - } - FloorEruptionGUID[1].erase(floorEruptedGUID); - } - - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) - { - case DATA_ONYXIA: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) - SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); - break; - case DATA_ONYXIA_PHASE: - if (uiData == PHASE_BREATH) //Used to mark the liftoff phase - { - m_bAchievManyWhelpsHandleIt = false; - m_uiManyWhelpsCounter = 0; - m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; - } - break; - case DATA_SHE_DEEP_BREATH_MORE: - if (uiData == IN_PROGRESS) - { - m_bAchievSheDeepBreathMore = true; - } - else if (uiData == FAIL) - { - m_bAchievSheDeepBreathMore = false; - } - break; + FloorEruptionGUID[1].erase(floorEruptedGUID); } - if (uiType < MAX_ENCOUNTER && uiData == DONE) - SaveToDB(); - } - - void SetData64(uint32 uiType, uint64 uiData) - { - switch(uiType) + void SetData(uint32 uiType, uint32 uiData) { - case DATA_FLOOR_ERUPTION_GUID: - FloorEruptionGUID[1] = FloorEruptionGUID[0]; - FloorEruptionGUIDQueue.push(uiData); - m_uiEruptTimer = 2500; - break; - } - } - - uint32 GetData(uint32 uiType) - { - switch(uiType) - { - case DATA_ONYXIA: - return m_auiEncounter[0]; - } - - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) - { - case DATA_ONYXIA_GUID: - return m_uiOnyxiasGUID; - } - - return 0; - } - - void Update(uint32 uiDiff) - { - if (GetData(DATA_ONYXIA) == IN_PROGRESS) - { - if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) + switch(uiType) { - m_uiOnyxiaLiftoffTimer = 0; - if (m_uiManyWhelpsCounter >= 50) - m_bAchievManyWhelpsHandleIt = true; - } else m_uiOnyxiaLiftoffTimer -= uiDiff; - } - - if (!FloorEruptionGUIDQueue.empty()) - { - if (m_uiEruptTimer <= uiDiff) - { - uint32 treeHeight = 0; - do - { - treeHeight = (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second; - FloorEruption(FloorEruptionGUIDQueue.front()); - FloorEruptionGUIDQueue.pop(); - } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); - m_uiEruptTimer = 1000; + case DATA_ONYXIA: + m_auiEncounter[0] = uiData; + if (uiData == IN_PROGRESS) + SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); + break; + case DATA_ONYXIA_PHASE: + if (uiData == PHASE_BREATH) //Used to mark the liftoff phase + { + m_bAchievManyWhelpsHandleIt = false; + m_uiManyWhelpsCounter = 0; + m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; + } + break; + case DATA_SHE_DEEP_BREATH_MORE: + if (uiData == IN_PROGRESS) + { + m_bAchievSheDeepBreathMore = true; + } + else if (uiData == FAIL) + { + m_bAchievSheDeepBreathMore = false; + } + break; } - else - m_uiEruptTimer -= uiDiff; - } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) - { - case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s - case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s - return m_bAchievManyWhelpsHandleIt; - case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath - case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath - return m_bAchievSheDeepBreathMore; + if (uiType < MAX_ENCOUNTER && uiData == DONE) + SaveToDB(); } - return false; - } + + void SetData64(uint32 uiType, uint64 uiData) + { + switch(uiType) + { + case DATA_FLOOR_ERUPTION_GUID: + FloorEruptionGUID[1] = FloorEruptionGUID[0]; + FloorEruptionGUIDQueue.push(uiData); + m_uiEruptTimer = 2500; + break; + } + } + + uint32 GetData(uint32 uiType) + { + switch(uiType) + { + case DATA_ONYXIA: + return m_auiEncounter[0]; + } + + return 0; + } + + uint64 GetData64(uint32 uiData) + { + switch(uiData) + { + case DATA_ONYXIA_GUID: + return m_uiOnyxiasGUID; + } + + return 0; + } + + void Update(uint32 uiDiff) + { + if (GetData(DATA_ONYXIA) == IN_PROGRESS) + { + if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) + { + m_uiOnyxiaLiftoffTimer = 0; + if (m_uiManyWhelpsCounter >= 50) + m_bAchievManyWhelpsHandleIt = true; + } else m_uiOnyxiaLiftoffTimer -= uiDiff; + } + + if (!FloorEruptionGUIDQueue.empty()) + { + if (m_uiEruptTimer <= uiDiff) + { + uint32 treeHeight = 0; + do + { + treeHeight = (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second; + FloorEruption(FloorEruptionGUIDQueue.front()); + FloorEruptionGUIDQueue.pop(); + } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); + m_uiEruptTimer = 1000; + } + else + m_uiEruptTimer -= uiDiff; + } + } + + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) + { + switch(criteria_id) + { + case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s + case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s + return m_bAchievManyWhelpsHandleIt; + case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath + case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath + return m_bAchievSheDeepBreathMore; + } + return false; + } + }; + }; -InstanceData* GetInstanceData_instance_onyxias_lair(Map* pMap) -{ - return new instance_onyxias_lair(pMap); -} void AddSC_instance_onyxias_lair() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_onyxias_lair"; - newscript->GetInstanceData = &GetInstanceData_instance_onyxias_lair; - newscript->RegisterSelf(); + new instance_onyxias_lair(); } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index 4157903bf75..69cadd776cf 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -35,98 +35,100 @@ EndScriptData */ #define SPELL_FROSTBOLT 15530 #define SPELL_FROST_NOVA 15531 #define SPELL_FROST_SPECTRES 12642 - -struct boss_amnennar_the_coldbringerAI : public ScriptedAI + class boss_amnennar_the_coldbringer : public CreatureScript { - boss_amnennar_the_coldbringerAI(Creature *c) : ScriptedAI(c) {} +public: + boss_amnennar_the_coldbringer() : CreatureScript("boss_amnennar_the_coldbringer") { } - uint32 AmnenarsWrath_Timer; - uint32 FrostBolt_Timer; - uint32 FrostNova_Timer; - bool Spectrals60; - bool Spectrals30; - bool Hp; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - AmnenarsWrath_Timer = 8000; - FrostBolt_Timer = 1000; - FrostNova_Timer = 10000 + rand()%5000; - Spectrals30 = false; - Spectrals60 = false; - Hp = false; + return new boss_amnennar_the_coldbringerAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_amnennar_the_coldbringerAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_amnennar_the_coldbringerAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit() - { - DoScriptText(SAY_KILL, me); - } + uint32 AmnenarsWrath_Timer; + uint32 FrostBolt_Timer; + uint32 FrostNova_Timer; + bool Spectrals60; + bool Spectrals30; + bool Hp; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //AmnenarsWrath_Timer - if (AmnenarsWrath_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_AMNENNARSWRATH); - AmnenarsWrath_Timer = 12000; - } else AmnenarsWrath_Timer -= diff; - - //FrostBolt_Timer - if (FrostBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - FrostBolt_Timer = 8000; - } else FrostBolt_Timer -= diff; - - if (FrostNova_Timer <= diff) - { - DoCast(me, SPELL_FROST_NOVA); - FrostNova_Timer = 15000; - } else FrostNova_Timer -= diff; - - if (!Spectrals60 && me->GetHealth()*100 / me->GetMaxHealth() < 60) - { - DoScriptText(SAY_SUMMON60, me); - DoCast(me->getVictim(), SPELL_FROST_SPECTRES); - Spectrals60 = true; + AmnenarsWrath_Timer = 8000; + FrostBolt_Timer = 1000; + FrostNova_Timer = 10000 + rand()%5000; + Spectrals30 = false; + Spectrals60 = false; + Hp = false; } - if (!Hp && me->GetHealth()*100 / me->GetMaxHealth() < 50) + void EnterCombat(Unit * /*who*/) { - DoScriptText(SAY_HP, me); - Hp = true; + DoScriptText(SAY_AGGRO, me); } - if (!Spectrals30 && me->GetHealth()*100 / me->GetMaxHealth() < 30) + void KilledUnit() { - DoScriptText(SAY_SUMMON30, me); - DoCast(me->getVictim(), SPELL_FROST_SPECTRES); - Spectrals30 = true; + DoScriptText(SAY_KILL, me); } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //AmnenarsWrath_Timer + if (AmnenarsWrath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AMNENNARSWRATH); + AmnenarsWrath_Timer = 12000; + } else AmnenarsWrath_Timer -= diff; + + //FrostBolt_Timer + if (FrostBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + FrostBolt_Timer = 8000; + } else FrostBolt_Timer -= diff; + + if (FrostNova_Timer <= diff) + { + DoCast(me, SPELL_FROST_NOVA); + FrostNova_Timer = 15000; + } else FrostNova_Timer -= diff; + + if (!Spectrals60 && me->GetHealth()*100 / me->GetMaxHealth() < 60) + { + DoScriptText(SAY_SUMMON60, me); + DoCast(me->getVictim(), SPELL_FROST_SPECTRES); + Spectrals60 = true; + } + + if (!Hp && me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + DoScriptText(SAY_HP, me); + Hp = true; + } + + if (!Spectrals30 && me->GetHealth()*100 / me->GetMaxHealth() < 30) + { + DoScriptText(SAY_SUMMON30, me); + DoCast(me->getVictim(), SPELL_FROST_SPECTRES); + Spectrals30 = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_amnennar_the_coldbringer(Creature* pCreature) -{ - return new boss_amnennar_the_coldbringerAI (pCreature); -} void AddSC_boss_amnennar_the_coldbringer() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_amnennar_the_coldbringer"; - newscript->GetAI = &GetAI_boss_amnennar_the_coldbringer; - newscript->RegisterSelf(); + new boss_amnennar_the_coldbringer(); } - diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index 6e67569f6d8..aa8ce61a908 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -19,196 +19,198 @@ #include "razorfen_downs.h" #define MAX_ENCOUNTER 1 - -struct instance_razorfen_downs : public ScriptedInstance + class instance_razorfen_downs : public InstanceMapScript { - instance_razorfen_downs(Map* pMap) : ScriptedInstance(pMap) +public: + instance_razorfen_downs() : InstanceMapScript("instance_razorfen_downs") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - Initialize(); - }; - - uint64 uiGongGUID; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint8 uiGongWaves; - - std::string str_data; - - void Initialize() - { - uiGongGUID = 0; - - uiGongWaves = 0; - - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + return new instance_razorfen_downs_InstanceMapScript(pMap); } - std::string GetSaveData() + struct instance_razorfen_downs_InstanceMapScript : public InstanceScript { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - - saveStream << "T C " << m_auiEncounter[0] - << " " << uiGongWaves; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) + instance_razorfen_downs_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { - OUT_LOAD_INST_DATA_FAIL; - return; + Initialize(); + }; + + uint64 uiGongGUID; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint8 uiGongWaves; + + std::string str_data; + + void Initialize() + { + uiGongGUID = 0; + + uiGongWaves = 0; + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; - - if (dataHead1 == 'T' && dataHead2 == 'C') + std::string GetSaveData() { - m_auiEncounter[0] = data0; + OUT_SAVE_INST_DATA; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + std::ostringstream saveStream; - uiGongWaves = data1; - } else OUT_LOAD_INST_DATA_FAIL; + saveStream << "T C " << m_auiEncounter[0] + << " " << uiGongWaves; - OUT_LOAD_INST_DATA_COMPLETE; - } + str_data = saveStream.str(); - void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) - { - switch(pGo->GetEntry()) - { - case GO_GONG: - uiGongGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - break; - default: - break; + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; } - } - void SetData(uint32 uiType, uint32 uiData) - { - if (uiType == DATA_GONG_WAVES) + void Load(const char* in) { - uiGongWaves = uiData; - - switch(uiGongWaves) + if (!in) { - case 9: - case 14: - if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; + + if (dataHead1 == 'T' && dataHead2 == 'C') + { + m_auiEncounter[0] = data0; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + uiGongWaves = data1; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) + { + switch(pGo->GetEntry()) + { + case GO_GONG: + uiGongGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); break; - case 1: - case 10: - case 16: - { - GameObject* pGo = instance->GetGameObject(uiGongGUID); - - if (!pGo) - return; - - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - - uint32 uiCreature = 0; - uint8 uiSummonTimes = 0; - - switch(uiGongWaves) - { - case 1: - uiCreature = CREATURE_TOMB_FIEND; - uiSummonTimes = 7; - break; - case 10: - uiCreature = CREATURE_TOMB_REAVER; - uiSummonTimes = 3; - break; - case 16: - uiCreature = CREATURE_TUTEN_KASH; - break; - default: - break; - } - - - if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) - { - if (uiGongWaves == 10 || uiGongWaves == 1) - { - for (uint8 i = 0; i < uiSummonTimes; ++i) - { - if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) - pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); - } - } - pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); - } - break; - } default: break; } } - if (uiType == BOSS_TUTEN_KASH) + void SetData(uint32 uiType, uint32 uiData) { - m_auiEncounter[0] = uiData; + if (uiType == DATA_GONG_WAVES) + { + uiGongWaves = uiData; - if (uiData == DONE) - SaveToDB(); - } - } + switch(uiGongWaves) + { + case 9: + case 14: + if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + break; + case 1: + case 10: + case 16: + { + GameObject* pGo = instance->GetGameObject(uiGongGUID); - uint32 GetData(uint32 uiType) - { - switch(uiType) - { - case DATA_GONG_WAVES: - return uiGongWaves; + if (!pGo) + return; + + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + + uint32 uiCreature = 0; + uint8 uiSummonTimes = 0; + + switch(uiGongWaves) + { + case 1: + uiCreature = CREATURE_TOMB_FIEND; + uiSummonTimes = 7; + break; + case 10: + uiCreature = CREATURE_TOMB_REAVER; + uiSummonTimes = 3; + break; + case 16: + uiCreature = CREATURE_TUTEN_KASH; + break; + default: + break; + } + + + if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) + { + if (uiGongWaves == 10 || uiGongWaves == 1) + { + for (uint8 i = 0; i < uiSummonTimes; ++i) + { + if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) + pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + } + } + pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + } + break; + } + default: + break; + } + } + + if (uiType == BOSS_TUTEN_KASH) + { + m_auiEncounter[0] = uiData; + + if (uiData == DONE) + SaveToDB(); + } } - return 0; - } - - uint64 GetData64(uint32 uiType) - { - switch(uiType) + uint32 GetData(uint32 uiType) { - case DATA_GONG: return uiGongGUID; + switch(uiType) + { + case DATA_GONG_WAVES: + return uiGongWaves; + } + + return 0; } - return 0; - } + uint64 GetData64(uint32 uiType) + { + switch(uiType) + { + case DATA_GONG: return uiGongGUID; + } + + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_razorfen_downs(Map* pMap) -{ - return new instance_razorfen_downs(pMap); -} void AddSC_instance_razorfen_downs() { - Script* newscript; - - newscript = new Script; - newscript->Name = "instance_razorfen_downs"; - newscript->GetInstanceData = &GetInstanceData_instance_razorfen_downs; - newscript->RegisterSelf(); + new instance_razorfen_downs(); } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 3eed9ee07f9..d69794ce3f7 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -46,122 +46,128 @@ enum eEnums #define GOSSIP_ITEM_TEA "Teach me the cooking recipe" #define GOSSIP_ITEM_POTION "Teach me the alchemy recipe" - -bool GossipHello_npc_henry_stern (Player* pPlayer, Creature* pCreature) + class npc_henry_stern : public CreatureScript { - if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); +public: + npc_henry_stern() : CreatureScript("npc_henry_stern") { } - if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + bool OnGossipSelect (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID()); + } + + if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) + { + pPlayer->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID()); + } + + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) + bool OnGossipHello (Player* pPlayer, Creature* pCreature) { - pPlayer->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID()); + if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} +}; + /*###### ## go_gong ######*/ - -bool GOHello_go_gong(Player* /*pPlayer*/, GameObject* pGO) + class go_gong : public GameObjectScript { - //basic support, not blizzlike data is missing... - ScriptedInstance* pInstance = pGO->GetInstanceData(); +public: + go_gong() : GameObjectScript("go_gong") { } - if (pInstance) + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) { - pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); - return true; + //basic support, not blizzlike data is missing... + InstanceScript* pInstance = pGO->GetInstanceScript(); + + if (pInstance) + { + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + return true; + } + + return false; } - return false; -} +}; enum eTombCreature { SPELL_WEB = 745 }; - -struct npc_tomb_creatureAI : public ScriptedAI + class npc_tomb_creature : public CreatureScript { - npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_tomb_creature() : CreatureScript("npc_tomb_creature") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new npc_tomb_creatureAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiWebTimer; - - void Reset() + struct npc_tomb_creatureAI : public ScriptedAI { - uiWebTimer = urand(5000,8000); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - //from acid - if (me->GetEntry() == CREATURE_TOMB_REAVER) + npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (uiWebTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_WEB); - uiWebTimer = urand(7000,16000); - } else uiWebTimer -= uiDiff; + pInstance = pCreature->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + InstanceScript* pInstance; + + uint32 uiWebTimer; + + void Reset() + { + uiWebTimer = urand(5000,8000); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + //from acid + if (me->GetEntry() == CREATURE_TOMB_REAVER) + { + if (uiWebTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_WEB); + uiWebTimer = urand(7000,16000); + } else uiWebTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + } + }; - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); - } }; -CreatureAI* GetAI_npc_tomb_creature(Creature* pCreature) -{ - return new npc_tomb_creatureAI (pCreature); -} void AddSC_razorfen_downs() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_henry_stern"; - newscript->pGossipHello = &GossipHello_npc_henry_stern; - newscript->pGossipSelect = &GossipSelect_npc_henry_stern; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_gong"; - newscript->pGOHello = &GOHello_go_gong; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tomb_creature"; - newscript->GetAI = &GetAI_npc_tomb_creature; - newscript->RegisterSelf(); + new npc_henry_stern(); + new go_gong(); + new npc_tomb_creature(); } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 691462e595d..253bfd1d3fc 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -27,80 +27,83 @@ EndScriptData */ #include "razorfen_kraul.h" #define WARD_KEEPERS_NR 2 - -struct instance_razorfen_kraul : public ScriptedInstance + class instance_razorfen_kraul : public InstanceMapScript { - instance_razorfen_kraul(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_razorfen_kraul() : InstanceMapScript("instance_razorfen_kraul") { } - uint64 DoorWardGUID; - uint32 WardCheck_Timer; - int WardKeeperAlive; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - WardKeeperAlive = 1; - WardCheck_Timer = 4000; - DoorWardGUID = 0; + return new instance_razorfen_kraul_InstanceMapScript(pMap); } - Player* GetPlayerInMap() + struct instance_razorfen_kraul_InstanceMapScript : public InstanceScript { - Map::PlayerList const& players = instance->GetPlayers(); + instance_razorfen_kraul_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - if (!players.isEmpty()) + uint64 DoorWardGUID; + uint32 WardCheck_Timer; + int WardKeeperAlive; + + void Initialize() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + WardKeeperAlive = 1; + WardCheck_Timer = 4000; + DoorWardGUID = 0; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* plr = itr->getSource()) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + sLog.outDebug("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) + { + switch(pGo->GetEntry()) + { + case 21099: DoorWardGUID = pGo->GetGUID(); break; } } - sLog.outDebug("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) - { - switch(pGo->GetEntry()) + void Update(uint32 diff) { - case 21099: DoorWardGUID = pGo->GetGUID(); break; + if (WardCheck_Timer <= diff) + { + HandleGameObject(DoorWardGUID, WardKeeperAlive); + WardKeeperAlive = 0; + WardCheck_Timer = 4000; + }else + WardCheck_Timer -= diff; } - } - void Update(uint32 diff) - { - if (WardCheck_Timer <= diff) + void SetData(uint32 type, uint32 data) { - HandleGameObject(DoorWardGUID, WardKeeperAlive); - WardKeeperAlive = 0; - WardCheck_Timer = 4000; - }else - WardCheck_Timer -= diff; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case TYPE_WARD_KEEPERS: - if (data == NOT_STARTED) - WardKeeperAlive = 1; - break; + switch(type) + { + case TYPE_WARD_KEEPERS: + if (data == NOT_STARTED) + WardKeeperAlive = 1; + break; + } } - } + + }; }; -InstanceData* GetInstanceData_instance_razorfen_kraul(Map* pMap) -{ - return new instance_razorfen_kraul(pMap); -} void AddSC_instance_razorfen_kraul() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_razorfen_kraul"; - newscript->GetInstanceData = &GetInstanceData_instance_razorfen_kraul; - newscript->RegisterSelf(); + new instance_razorfen_kraul(); } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index a2aa56fb2d2..78c94dcbcfb 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -46,151 +46,155 @@ EndContentData */ #define QUEST_WILLIX_THE_IMPORTER 1144 #define ENTRY_BOAR 4514 #define SPELL_QUILLBOAR_CHANNELING 7083 - -struct npc_willixAI : public npc_escortAI + class npc_willix : public CreatureScript { - npc_willixAI(Creature *c) : npc_escortAI(c) {} +public: + npc_willix() : CreatureScript("npc_willix") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) { - case 3: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - DoScriptText(SAY_POINT, me, pPlayer); - break; - case 4: - me->SummonCreature(ENTRY_BOAR, 2137.66, 1843.98, 48.08, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 8: - DoScriptText(SAY_BLUELEAF, me, pPlayer); - break; - case 9: - DoScriptText(SAY_DANGER, me, pPlayer); - break; - case 13: - DoScriptText(SAY_BAD, me, pPlayer); - break; - case 14: - me->SummonCreature(ENTRY_BOAR, 2078.91, 1704.54, 56.77, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 25: - DoScriptText(SAY_THINK, me, pPlayer); - break; - case 31: - DoScriptText(SAY_SOON, me, pPlayer); - break; - case 42: - DoScriptText(SAY_FINALY, me, pPlayer); - break; - case 43: - me->SummonCreature(ENTRY_BOAR, 1956.43, 1596.97, 81.75, 1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 45: - DoScriptText(SAY_WIN, me, pPlayer); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER,me); - break; - case 46: - DoScriptText(SAY_END, me, pPlayer); - break; + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + DoScriptText(SAY_READY, pCreature, pPlayer); + pCreature->setFaction(113); } + + return true; } - void Reset() {} - - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO1, me, NULL); + return new npc_willixAI(pCreature); } - void JustSummoned(Creature* summoned) + struct npc_willixAI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_willixAI(Creature *c) : npc_escortAI(c) {} - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) - CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); - } -}; - -bool QuestAccept_npc_willix(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - DoScriptText(SAY_READY, pCreature, pPlayer); - pCreature->setFaction(113); - } - - return true; -} - -struct npc_deaths_head_ward_keeperAI : public ScriptedAI -{ - npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - uint32 QuillboarChanneling_Timer; - - void Reset() - { - QuillboarChanneling_Timer = 1500; - } - - void UpdateAI(const uint32 diff) - { - if (!me->isAlive()) - return; - - if (pInstance) - pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED); - - if (QuillboarChanneling_Timer <= diff) + void WaypointReached(uint32 i) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_QUILLBOAR_CHANNELING); - QuillboarChanneling_Timer = 1100; - } else QuillboarChanneling_Timer -= diff; + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 3: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + DoScriptText(SAY_POINT, me, pPlayer); + break; + case 4: + me->SummonCreature(ENTRY_BOAR, 2137.66, 1843.98, 48.08, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 8: + DoScriptText(SAY_BLUELEAF, me, pPlayer); + break; + case 9: + DoScriptText(SAY_DANGER, me, pPlayer); + break; + case 13: + DoScriptText(SAY_BAD, me, pPlayer); + break; + case 14: + me->SummonCreature(ENTRY_BOAR, 2078.91, 1704.54, 56.77, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 25: + DoScriptText(SAY_THINK, me, pPlayer); + break; + case 31: + DoScriptText(SAY_SOON, me, pPlayer); + break; + case 42: + DoScriptText(SAY_FINALY, me, pPlayer); + break; + case 43: + me->SummonCreature(ENTRY_BOAR, 1956.43, 1596.97, 81.75, 1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 45: + DoScriptText(SAY_WIN, me, pPlayer); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER,me); + break; + case 46: + DoScriptText(SAY_END, me, pPlayer); + break; + } + } + + void Reset() {} + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO1, me, NULL); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); + } + }; - } }; -CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) + class npc_deaths_head_ward_keeper : public CreatureScript { - return new npc_deaths_head_ward_keeperAI(pCreature); -} +public: + npc_deaths_head_ward_keeper() : CreatureScript("npc_deaths_head_ward_keeper") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_deaths_head_ward_keeperAI(pCreature); + } + + struct npc_deaths_head_ward_keeperAI : public ScriptedAI + { + npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + uint32 QuillboarChanneling_Timer; + + void Reset() + { + QuillboarChanneling_Timer = 1500; + } + + void UpdateAI(const uint32 diff) + { + if (!me->isAlive()) + return; + + if (pInstance) + pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED); + + if (QuillboarChanneling_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_QUILLBOAR_CHANNELING); + QuillboarChanneling_Timer = 1100; + } else QuillboarChanneling_Timer -= diff; + + } + }; + +}; + -CreatureAI* GetAI_npc_willix(Creature* pCreature) -{ - return new npc_willixAI(pCreature); -} void AddSC_razorfen_kraul() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_willix"; - newscript->GetAI = &GetAI_npc_willix; - newscript->pQuestAccept = &QuestAccept_npc_willix; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deaths_head_ward_keeper"; - newscript->GetAI = &GetAI_npc_deaths_head_ward_keeper; - newscript->RegisterSelf(); + new npc_willix(); + new npc_deaths_head_ward_keeper(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index 9e1c4e1af53..27cf6c0057f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -38,90 +38,92 @@ enum Spells SPELL_SUMMONSWARMER = 25844, //might be 25708 SPELL_PARALYZE = 23414 //doesnt work correct (core) }; - -struct boss_ayamissAI : public ScriptedAI + class boss_ayamiss : public CreatureScript { - boss_ayamissAI(Creature *c) : ScriptedAI(c) +public: + boss_ayamiss() : CreatureScript("boss_ayamiss") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ayamissAI (pCreature); } - uint32 STINGERSPRAY_Timer; - uint32 POISONSTINGER_Timer; - uint32 SUMMONSWARMER_Timer; - uint32 phase; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_ayamissAI : public ScriptedAI { - STINGERSPRAY_Timer = 30000; - POISONSTINGER_Timer = 30000; - SUMMONSWARMER_Timer = 60000; - phase=1; - - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, IN_PROGRESS); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If he is 70% start phase 2 - if (phase == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 70 && !me->IsNonMeleeSpellCasted(false)) + boss_ayamissAI(Creature *c) : ScriptedAI(c) { - phase=2; + pInstance = c->GetInstanceScript(); } - //STINGERSPRAY_Timer (only in phase2) - if (phase == 2 && STINGERSPRAY_Timer <= diff) + uint32 STINGERSPRAY_Timer; + uint32 POISONSTINGER_Timer; + uint32 SUMMONSWARMER_Timer; + uint32 phase; + + InstanceScript *pInstance; + + void Reset() { - DoCast(me->getVictim(), SPELL_STINGERSPRAY); STINGERSPRAY_Timer = 30000; - } else STINGERSPRAY_Timer -= diff; - - //POISONSTINGER_Timer (only in phase1) - if (phase == 1 && POISONSTINGER_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_POISONSTINGER); POISONSTINGER_Timer = 30000; - } else POISONSTINGER_Timer -= diff; - - //SUMMONSWARMER_Timer (only in phase1) - if (SUMMONSWARMER_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SUMMONSWARMER); SUMMONSWARMER_Timer = 60000; - } else SUMMONSWARMER_Timer -= diff; + phase=1; + + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //If he is 70% start phase 2 + if (phase == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 70 && !me->IsNonMeleeSpellCasted(false)) + { + phase=2; + } + + //STINGERSPRAY_Timer (only in phase2) + if (phase == 2 && STINGERSPRAY_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STINGERSPRAY); + STINGERSPRAY_Timer = 30000; + } else STINGERSPRAY_Timer -= diff; + + //POISONSTINGER_Timer (only in phase1) + if (phase == 1 && POISONSTINGER_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_POISONSTINGER); + POISONSTINGER_Timer = 30000; + } else POISONSTINGER_Timer -= diff; + + //SUMMONSWARMER_Timer (only in phase1) + if (SUMMONSWARMER_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUMMONSWARMER); + SUMMONSWARMER_Timer = 60000; + } else SUMMONSWARMER_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ayamiss(Creature* pCreature) -{ - return new boss_ayamissAI (pCreature); -} void AddSC_boss_ayamiss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ayamiss"; - newscript->GetAI = &GetAI_boss_ayamiss; - newscript->RegisterSelf(); + new boss_ayamiss(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index d8f6bece646..706653fd443 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -30,45 +30,47 @@ enum Yells { EMOTE_TARGET = -1509002 }; - -struct boss_buruAI : public ScriptedAI + class boss_buru : public CreatureScript { - boss_buruAI(Creature *c) : ScriptedAI(c) +public: + boss_buru() : CreatureScript("boss_buru") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_buruAI (pCreature); } - ScriptedInstance *pInstance; - - void Reset() + struct boss_buruAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, NOT_STARTED); - } + boss_buruAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, IN_PROGRESS); - } + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_buru(Creature* pCreature) -{ - return new boss_buruAI (pCreature); -} void AddSC_boss_buru() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_buru"; - newscript->GetAI = &GetAI_boss_buru; - newscript->RegisterSelf(); + new boss_buru(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index c1dba225462..ace0da87556 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -35,111 +35,113 @@ enum Spells SPELL_TRASH = 3391, SPELL_WIDE_SLASH = 25814 }; - -struct boss_kurinnaxxAI : public ScriptedAI + class boss_kurinnaxx : public CreatureScript { - boss_kurinnaxxAI(Creature *c) : ScriptedAI(c) +public: + boss_kurinnaxx() : CreatureScript("boss_kurinnaxx") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kurinnaxxAI (pCreature); } - uint32 uiMortalWoundTimer; - uint32 uiSandtrapTimer; - uint32 uiWideSlashTimer; - uint32 uiSummonPlayerTimer; - uint32 uiTrashTimer; - bool bIsEnraged; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_kurinnaxxAI : public ScriptedAI { - bIsEnraged = false; - uiMortalWoundTimer = urand(2000,7000); - uiSandtrapTimer = urand(20000,30000); - uiWideSlashTimer = urand(10000,15000); - uiTrashTimer = urand(20000,25000); - uiSummonPlayerTimer = urand(30000,40000); - - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, IN_PROGRESS); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are <30% cast enrage - if (!bIsEnraged && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + boss_kurinnaxxAI(Creature *c) : ScriptedAI(c) { - bIsEnraged = true; - DoCast(me, SPELL_ENRAGE); + pInstance = c->GetInstanceScript(); } - //Mortal Wound spell - if (uiMortalWoundTimer <= diff) + uint32 uiMortalWoundTimer; + uint32 uiSandtrapTimer; + uint32 uiWideSlashTimer; + uint32 uiSummonPlayerTimer; + uint32 uiTrashTimer; + bool bIsEnraged; + + InstanceScript* pInstance; + + void Reset() { - DoCast(me->getVictim(), SPELL_MORTALWOUND); + bIsEnraged = false; uiMortalWoundTimer = urand(2000,7000); - } else uiMortalWoundTimer -= diff; - - //Santrap spell - if (uiSandtrapTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SANDTRAP); - uiSandtrapTimer = 30000; - } else uiSandtrapTimer -= diff; - - //Wide Slash spell - if (uiWideSlashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WIDE_SLASH); + uiSandtrapTimer = urand(20000,30000); uiWideSlashTimer = urand(10000,15000); - } else uiWideSlashTimer -= diff; - - //Trash spell - if (uiTrashTimer <= diff) - { - DoCast(me, SPELL_TRASH); uiTrashTimer = urand(20000,25000); - } else uiTrashTimer -= diff; - - //Summon Player spell - if (uiSummonPlayerTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SUMMON_PLAYER); uiSummonPlayerTimer = urand(30000,40000); - } else uiSummonPlayerTimer -= diff; - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //If we are <30% cast enrage + if (!bIsEnraged && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + { + bIsEnraged = true; + DoCast(me, SPELL_ENRAGE); + } + + //Mortal Wound spell + if (uiMortalWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALWOUND); + uiMortalWoundTimer = urand(2000,7000); + } else uiMortalWoundTimer -= diff; + + //Santrap spell + if (uiSandtrapTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SANDTRAP); + uiSandtrapTimer = 30000; + } else uiSandtrapTimer -= diff; + + //Wide Slash spell + if (uiWideSlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WIDE_SLASH); + uiWideSlashTimer = urand(10000,15000); + } else uiWideSlashTimer -= diff; + + //Trash spell + if (uiTrashTimer <= diff) + { + DoCast(me, SPELL_TRASH); + uiTrashTimer = urand(20000,25000); + } else uiTrashTimer -= diff; + + //Summon Player spell + if (uiSummonPlayerTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SUMMON_PLAYER); + uiSummonPlayerTimer = urand(30000,40000); + } else uiSummonPlayerTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_kurinnaxx(Creature* pCreature) -{ - return new boss_kurinnaxxAI (pCreature); -} void AddSC_boss_kurinnaxx() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kurinnaxx"; - newscript->GetAI = &GetAI_boss_kurinnaxx; - newscript->RegisterSelf(); + new boss_kurinnaxx(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 361bb149ce7..0977440d89d 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -51,114 +51,116 @@ enum CombatPhase NORMAL, STONE }; - -struct boss_moamAI : public ScriptedAI + class boss_moam : public CreatureScript { - boss_moamAI(Creature *c) : ScriptedAI(c) +public: + boss_moam() : CreatureScript("boss_moam") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_moamAI (pCreature); } - uint32 uiTrampleTimer; - uint32 uiDrainManaTimer; - uint32 uiPhaseTimer; - CombatPhase Phase; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_moamAI : public ScriptedAI { - uiTrampleTimer = urand(3000,7000); - uiDrainManaTimer = urand(3000,7000); - uiPhaseTimer = 90000; - Phase = NORMAL; - me->SetPower(POWER_MANA,0); - - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(EMOTE_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, IN_PROGRESS); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, DONE); - } - - void DrainMana() - { - for (uint8 i=0;i<6;++i) + boss_moamAI(Creature *c) : ScriptedAI(c) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + pInstance = c->GetInstanceScript(); + } + + uint32 uiTrampleTimer; + uint32 uiDrainManaTimer; + uint32 uiPhaseTimer; + CombatPhase Phase; + + InstanceScript *pInstance; + + void Reset() + { + uiTrampleTimer = urand(3000,7000); + uiDrainManaTimer = urand(3000,7000); + uiPhaseTimer = 90000; + Phase = NORMAL; + me->SetPower(POWER_MANA,0); + + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(EMOTE_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, DONE); + } + + void DrainMana() + { + for (uint8 i=0;i<6;++i) { - pTarget->ModifyPower(POWER_MANA, -500); - me->ModifyPower(POWER_MANA, 1000); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + pTarget->ModifyPower(POWER_MANA, -500); + me->ModifyPower(POWER_MANA, 1000); + } } } - } - void UpdateAI(const uint32 diff) - { - if (Phase == NORMAL) + void UpdateAI(const uint32 diff) { - if (!UpdateVictim()) - return; - - //If we are 100%MANA cast Arcane Erruption - if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) + if (Phase == NORMAL) { - DoCast(me->getVictim(), SPELL_ARCANEERUPTION); - DoScriptText(EMOTE_MANA_FULL, me); - me->SetPower(POWER_MANA,0); + if (!UpdateVictim()) + return; + + //If we are 100%MANA cast Arcane Erruption + if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) + { + DoCast(me->getVictim(), SPELL_ARCANEERUPTION); + DoScriptText(EMOTE_MANA_FULL, me); + me->SetPower(POWER_MANA,0); + } + + //Trample Spell + if (uiTrampleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + uiTrampleTimer = urand(3000,7000); + } else uiTrampleTimer -= diff; + + //Drain Mana + if (uiDrainManaTimer <= diff) + { + DrainMana(); + uiDrainManaTimer = urand(3000,7000); + } else uiDrainManaTimer -= diff; + + DoMeleeAttackIfReady(); + + //After 90secs change phase + if (uiPhaseTimer <= diff) + { + Phase = STONE; + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_GRDRSLEEP); + } else uiPhaseTimer -= diff; } - - //Trample Spell - if (uiTrampleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TRAMPLE); - uiTrampleTimer = urand(3000,7000); - } else uiTrampleTimer -= diff; - - //Drain Mana - if (uiDrainManaTimer <= diff) - { - DrainMana(); - uiDrainManaTimer = urand(3000,7000); - } else uiDrainManaTimer -= diff; - - DoMeleeAttackIfReady(); - - //After 90secs change phase - if (uiPhaseTimer <= diff) - { - Phase = STONE; - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_GRDRSLEEP); - } else uiPhaseTimer -= diff; } - } + }; + }; -CreatureAI* GetAI_boss_moam(Creature* pCreature) -{ - return new boss_moamAI (pCreature); -} void AddSC_boss_moam() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_moam"; - newscript->GetAI = &GetAI_boss_moam; - newscript->RegisterSelf(); + new boss_moam(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 9b4f0430c4a..84efd150153 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -38,44 +38,47 @@ enum Yells SAY_SLAY = -1509026, SAY_DEATH = -1509027 }; - -struct boss_ossirianAI : public ScriptedAI + class boss_ossirian : public CreatureScript { - boss_ossirianAI(Creature *c) : ScriptedAI(c) +public: + boss_ossirian() : CreatureScript("boss_ossirian") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ossirianAI (pCreature); } - ScriptedInstance *pInstance; - - void Reset() + struct boss_ossirianAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, NOT_STARTED); - } + boss_ossirianAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, IN_PROGRESS); - } + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_ossirian(Creature* pCreature) -{ - return new boss_ossirianAI (pCreature); -} void AddSC_boss_ossirian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ossirian"; - newscript->GetAI = &GetAI_boss_ossirian; - newscript->RegisterSelf(); + new boss_ossirian(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index 3346e57685f..cdcca79ab5a 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -44,44 +44,47 @@ enum Yells SAY_KILLS_ANDOROV = -1509016, SAY_COMPLETE_QUEST = -1509017 //Yell when realm complete quest 8743 for world event }; - -struct boss_rajaxxAI : public ScriptedAI + class boss_rajaxx : public CreatureScript { - boss_rajaxxAI(Creature *c) : ScriptedAI(c) +public: + boss_rajaxx() : CreatureScript("boss_rajaxx") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_rajaxxAI (pCreature); } - ScriptedInstance *pInstance; - - void Reset() + struct boss_rajaxxAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, NOT_STARTED); - } + boss_rajaxxAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, IN_PROGRESS); - } + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_rajaxx(Creature* pCreature) -{ - return new boss_rajaxxAI (pCreature); -} void AddSC_boss_rajaxx() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rajaxx"; - newscript->GetAI = &GetAI_boss_rajaxx; - newscript->RegisterSelf(); + new boss_rajaxx(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index 26ac218e298..8b0c78ea269 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -35,181 +35,184 @@ EndScriptData */ 3 - Buru the Gorger 4 - Ayamiss the Hunter 5 - Ossirian the Unscarred */ - -struct instance_ruins_of_ahn_qiraj : public ScriptedInstance + class instance_ruins_of_ahnqiraj : public InstanceMapScript { - instance_ruins_of_ahn_qiraj(Map* pMap) : ScriptedInstance(pMap) { Initialize(); } +public: + instance_ruins_of_ahnqiraj() : InstanceMapScript("instance_ruins_of_ahnqiraj") { } - uint64 uiKurinaxx; - uint64 uiRajaxx; - uint64 uiMoam; - uint64 uiBuru; - uint64 uiAyamiss; - uint64 uiOssirian; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - void Initialize() + InstanceScript* GetInstanceData_instance_ruins_of_ahn_qiraj_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - uiKurinaxx = 0; - uiRajaxx = 0; - uiMoam = 0; - uiBuru = 0; - uiAyamiss = 0; - uiOssirian = 0; + return new instance_ruins_of_ahn_qiraj_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_ruins_of_ahn_qiraj_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_ruins_of_ahn_qiraj_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - return false; - } + uint64 uiKurinaxx; + uint64 uiRajaxx; + uint64 uiMoam; + uint64 uiBuru; + uint64 uiAyamiss; + uint64 uiOssirian; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) + uint8 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + void Initialize() { - case CREATURE_KURINAXX: - uiKurinaxx = pCreature->GetGUID(); - break; - case CREATURE_RAJAXX: - uiRajaxx = pCreature->GetGUID(); - break; - case CREATURE_MOAM: - uiMoam = pCreature->GetGUID(); - break; - case CREATURE_BURU: - uiBuru = pCreature->GetGUID(); - break; - case CREATURE_AYAMISS: - uiAyamiss = pCreature->GetGUID(); - break; - case CREATURE_OSSIRIAN: - uiOssirian = pCreature->GetGUID(); - break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - uint32 GetData(uint32 identifier) - { - switch(identifier) - { - case DATA_KURINNAXX_EVENT: return m_auiEncounter[0]; - case DATA_RAJAXX_EVENT: return m_auiEncounter[1]; - case DATA_MOAM_EVENT: return m_auiEncounter[2]; - case DATA_BURU_EVENT: return m_auiEncounter[3]; - case DATA_AYAMISS_EVENT: return m_auiEncounter[4]; - case DATA_OSSIRIAN_EVENT: return m_auiEncounter[5]; + uiKurinaxx = 0; + uiRajaxx = 0; + uiMoam = 0; + uiBuru = 0; + uiAyamiss = 0; + uiOssirian = 0; } - return 0; - } - - void SetData(uint32 identifier, uint32 data) - { - switch(identifier) + bool IsEncounterInProgress() const { - case DATA_KURINNAXX_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_RAJAXX_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_MOAM_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_BURU_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_AYAMISS_EVENT: - m_auiEncounter[4] = data; - break; - case DATA_OSSIRIAN_EVENT: - m_auiEncounter[5] = data; - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint64 GetData64(uint32 uiIdentifier) - { - switch(uiIdentifier) - { - case DATA_KURINNAXX: return uiKurinaxx; - case DATA_RAJAXX: return uiRajaxx; - case DATA_MOAM: return uiMoam; - case DATA_BURU: return uiBuru; - case DATA_AYAMISS: return uiAyamiss; - case DATA_OSSIRIAN: return uiOssirian; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "R A " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - - if (dataHead1 == 'R' && dataHead2 == 'A') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; - m_auiEncounter[5] = data5; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch (pCreature->GetEntry()) + { + case CREATURE_KURINAXX: + uiKurinaxx = pCreature->GetGUID(); + break; + case CREATURE_RAJAXX: + uiRajaxx = pCreature->GetGUID(); + break; + case CREATURE_MOAM: + uiMoam = pCreature->GetGUID(); + break; + case CREATURE_BURU: + uiBuru = pCreature->GetGUID(); + break; + case CREATURE_AYAMISS: + uiAyamiss = pCreature->GetGUID(); + break; + case CREATURE_OSSIRIAN: + uiOssirian = pCreature->GetGUID(); + break; + } + } + + uint32 GetData(uint32 identifier) + { + switch(identifier) + { + case DATA_KURINNAXX_EVENT: return m_auiEncounter[0]; + case DATA_RAJAXX_EVENT: return m_auiEncounter[1]; + case DATA_MOAM_EVENT: return m_auiEncounter[2]; + case DATA_BURU_EVENT: return m_auiEncounter[3]; + case DATA_AYAMISS_EVENT: return m_auiEncounter[4]; + case DATA_OSSIRIAN_EVENT: return m_auiEncounter[5]; + } + + return 0; + } + + void SetData(uint32 identifier, uint32 data) + { + switch(identifier) + { + case DATA_KURINNAXX_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_RAJAXX_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_MOAM_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_BURU_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_AYAMISS_EVENT: + m_auiEncounter[4] = data; + break; + case DATA_OSSIRIAN_EVENT: + m_auiEncounter[5] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint64 GetData64(uint32 uiIdentifier) + { + switch(uiIdentifier) + { + case DATA_KURINNAXX: return uiKurinaxx; + case DATA_RAJAXX: return uiRajaxx; + case DATA_MOAM: return uiMoam; + case DATA_BURU: return uiBuru; + case DATA_AYAMISS: return uiAyamiss; + case DATA_OSSIRIAN: return uiOssirian; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "R A " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + + if (dataHead1 == 'R' && dataHead2 == 'A') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + m_auiEncounter[5] = data5; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + } + }; - } else OUT_LOAD_INST_DATA_FAIL; - } }; -InstanceData* GetInstanceData_instance_ruins_of_ahn_qiraj(Map* pMap) -{ - return new instance_ruins_of_ahn_qiraj(pMap); -} void AddSC_instance_ruins_of_ahnqiraj() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_ruins_of_ahnqiraj"; - newscript->GetInstanceData = &GetInstanceData_instance_ruins_of_ahn_qiraj; - newscript->RegisterSelf(); + new instance_ruins_of_ahnqiraj(); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index fe7a66ddb1f..826a18a5638 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -36,313 +36,321 @@ EndScriptData */ #define SPELL_HEAL 25807 #define SPELL_FEAR 19408 - -struct boss_kriAI : public ScriptedAI + class boss_kri : public CreatureScript { - boss_kriAI(Creature *c) : ScriptedAI(c) +public: + boss_kri() : CreatureScript("boss_kri") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kriAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 Cleave_Timer; - uint32 ToxicVolley_Timer; - uint32 Check_Timer; - - bool VemDead; - bool Death; - - void Reset() + struct boss_kriAI : public ScriptedAI { - Cleave_Timer = 4000 + rand()%4000; - ToxicVolley_Timer = 6000 + rand()%6000; - Check_Timer = 2000; - - VemDead = false; - Death = false; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) + boss_kriAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); - } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 5000 + rand()%7000; - } else Cleave_Timer -= diff; - - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY); - ToxicVolley_Timer = 10000 + rand()%5000; - } else ToxicVolley_Timer -= diff; - - if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death) - { - DoCast(me->getVictim(), SPELL_POISON_CLOUD); - Death = true; + pInstance = c->GetInstanceScript(); } - if (!VemDead) + InstanceScript *pInstance; + + uint32 Cleave_Timer; + uint32 ToxicVolley_Timer; + uint32 Check_Timer; + + bool VemDead; + bool Death; + + void Reset() { - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) - { - if (pInstance && pInstance->GetData(DATA_VEMISDEAD)) - { - DoCast(me, SPELL_ENRAGE); - VemDead = true; - } - Check_Timer = 2000; - } else Check_Timer -=diff; + Cleave_Timer = 4000 + rand()%4000; + ToxicVolley_Timer = 6000 + rand()%6000; + Check_Timer = 2000; + + VemDead = false; + Death = false; } - DoMeleeAttackIfReady(); - } -}; - -struct boss_vemAI : public ScriptedAI -{ - boss_vemAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 Charge_Timer; - uint32 KnockBack_Timer; - uint32 Enrage_Timer; - - bool Enraged; - - void Reset() - { - Charge_Timer = 15000 + rand()%12000; - KnockBack_Timer = 8000 + rand()%12000; - Enrage_Timer = 120000; - - Enraged = false; - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) + void EnterCombat(Unit * /*who*/) { - pInstance->SetData(DATA_VEM_DEATH, 0); - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); - } - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Charge_Timer - if (Charge_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - { - DoCast(pTarget, SPELL_CHARGE); - //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); - AttackStart(pTarget); - } - - Charge_Timer = 8000 + rand()%8000; - } else Charge_Timer -= diff; - - //KnockBack_Timer - if (KnockBack_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKBACK); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-80); - KnockBack_Timer = 15000 + rand()%10000; - } else KnockBack_Timer -= diff; - - //Enrage_Timer - if (!Enraged && Enrage_Timer <= diff) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else Charge_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_yaujAI : public ScriptedAI -{ - boss_yaujAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 Heal_Timer; - uint32 Fear_Timer; - uint32 Check_Timer; - - bool VemDead; - - void Reset() - { - Heal_Timer = 25000 + rand()%15000; - Fear_Timer = 12000 + rand()%12000; - Check_Timer = 2000; - - VemDead = false; - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - { - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); } - for (uint8 i = 0; i < 10; ++i) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000); - if (Summoned && pTarget) - Summoned->AI()->AttackStart(pTarget); - } - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //Fear_Timer - if (Fear_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); - DoResetThreat(); - Fear_Timer = 20000; - } else Fear_Timer -= diff; - - //Casting Heal to other twins or herself. - if (Heal_Timer <= diff) + void JustDied(Unit* /*killer*/) { if (pInstance) { - Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI)); - Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM)); + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - switch (urand(0,2)) - { - case 0: - if (pKri) - DoCast(pKri, SPELL_HEAL); - break; - case 1: - if (pVem) - DoCast(pVem, SPELL_HEAL); - break; - case 2: - DoCast(me, SPELL_HEAL); - break; - } + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + } + } + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 5000 + rand()%7000; + } else Cleave_Timer -= diff; + + //ToxicVolley_Timer + if (ToxicVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY); + ToxicVolley_Timer = 10000 + rand()%5000; + } else ToxicVolley_Timer -= diff; + + if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death) + { + DoCast(me->getVictim(), SPELL_POISON_CLOUD); + Death = true; } - Heal_Timer = 15000+rand()%15000; - } else Heal_Timer -= diff; - - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) - { if (!VemDead) { - if (pInstance) + //Checking if Vem is dead. If yes we will enrage. + if (Check_Timer <= diff) { - if (pInstance->GetData(DATA_VEMISDEAD)) + if (pInstance && pInstance->GetData(DATA_VEMISDEAD)) { DoCast(me, SPELL_ENRAGE); VemDead = true; } - } + Check_Timer = 2000; + } else Check_Timer -=diff; } - Check_Timer = 2000; - } else Check_Timer -= diff; - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_vem : public CreatureScript +{ +public: + boss_vem() : CreatureScript("boss_vem") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_vemAI (pCreature); } + + struct boss_vemAI : public ScriptedAI + { + boss_vemAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 Charge_Timer; + uint32 KnockBack_Timer; + uint32 Enrage_Timer; + + bool Enraged; + + void Reset() + { + Charge_Timer = 15000 + rand()%12000; + KnockBack_Timer = 8000 + rand()%12000; + Enrage_Timer = 120000; + + Enraged = false; + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + { + pInstance->SetData(DATA_VEM_DEATH, 0); + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + } + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Charge_Timer + if (Charge_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + { + DoCast(pTarget, SPELL_CHARGE); + //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); + AttackStart(pTarget); + } + + Charge_Timer = 8000 + rand()%8000; + } else Charge_Timer -= diff; + + //KnockBack_Timer + if (KnockBack_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKBACK); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-80); + KnockBack_Timer = 15000 + rand()%10000; + } else KnockBack_Timer -= diff; + + //Enrage_Timer + if (!Enraged && Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else Charge_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_yauj : public CreatureScript +{ +public: + boss_yauj() : CreatureScript("boss_yauj") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_yaujAI (pCreature); + } + + struct boss_yaujAI : public ScriptedAI + { + boss_yaujAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 Heal_Timer; + uint32 Fear_Timer; + uint32 Check_Timer; + + bool VemDead; + + void Reset() + { + Heal_Timer = 25000 + rand()%15000; + Fear_Timer = 12000 + rand()%12000; + Check_Timer = 2000; + + VemDead = false; + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + { + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + } + + for (uint8 i = 0; i < 10; ++i) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000); + if (Summoned && pTarget) + Summoned->AI()->AttackStart(pTarget); + } + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + DoResetThreat(); + Fear_Timer = 20000; + } else Fear_Timer -= diff; + + //Casting Heal to other twins or herself. + if (Heal_Timer <= diff) + { + if (pInstance) + { + Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI)); + Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM)); + + switch (urand(0,2)) + { + case 0: + if (pKri) + DoCast(pKri, SPELL_HEAL); + break; + case 1: + if (pVem) + DoCast(pVem, SPELL_HEAL); + break; + case 2: + DoCast(me, SPELL_HEAL); + break; + } + } + + Heal_Timer = 15000+rand()%15000; + } else Heal_Timer -= diff; + + //Checking if Vem is dead. If yes we will enrage. + if (Check_Timer <= diff) + { + if (!VemDead) + { + if (pInstance) + { + if (pInstance->GetData(DATA_VEMISDEAD)) + { + DoCast(me, SPELL_ENRAGE); + VemDead = true; + } + } + } + Check_Timer = 2000; + } else Check_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_yauj(Creature* pCreature) -{ - return new boss_yaujAI (pCreature); -} -CreatureAI* GetAI_boss_vem(Creature* pCreature) -{ - return new boss_vemAI (pCreature); -} -CreatureAI* GetAI_boss_kri(Creature* pCreature) -{ - return new boss_kriAI (pCreature); -} void AddSC_bug_trio() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kri"; - newscript->GetAI = &GetAI_boss_kri; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_vem"; - newscript->GetAI = &GetAI_boss_vem; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_yauj"; - newscript->GetAI = &GetAI_boss_yauj; - newscript->RegisterSelf(); + new boss_kri(); + new boss_vem(); + new boss_yauj(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 40314e012e8..27e3c6d0d82 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -163,584 +163,567 @@ const Position FleshTentaclePos[2] = //Kick out position const Position KickPos = { -8545.0f, 1984.0f, -96.0f}; - -struct eye_of_cthunAI : public Scripted_NoMovementAI + class boss_eye_of_cthun : public CreatureScript { - eye_of_cthunAI(Creature *c) : Scripted_NoMovementAI(c) +public: + boss_eye_of_cthun() : CreatureScript("boss_eye_of_cthun") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInst = c->GetInstanceData(); - if (!pInst) - sLog.outError("TSCR: No Instance eye_of_cthunAI"); + return new eye_of_cthunAI (pCreature); } - ScriptedInstance* pInst; - - //Global variables - uint32 PhaseTimer; - - //Eye beam phase - uint32 BeamTimer; - uint32 EyeTentacleTimer; - uint32 ClawTentacleTimer; - - //Dark Glare phase - uint32 DarkGlareTick; - uint32 DarkGlareTickTimer; - float DarkGlareAngle; - bool ClockWise; - - void Reset() + struct eye_of_cthunAI : public Scripted_NoMovementAI { - //Phase information - PhaseTimer = 50000; //First dark glare in 50 seconds - - //Eye beam phase 50 seconds - BeamTimer = 3000; - EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam - ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) - - //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) - DarkGlareTick = 0; - DarkGlareTickTimer = 1000; - DarkGlareAngle = 0; - ClockWise = false; - - //Reset flags - me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_ON); - - //Reset Phase - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); - - //to avoid having a following void zone - Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); - if (pPortal) - pPortal->SetReactState(REACT_PASSIVE); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); - } - - void SpawnEyeTentacle(float x, float y) - { - if (Creature* Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (Spawned->AI()) - Spawned->AI()->AttackStart(pTarget); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - - //No instance - if (!pInst) - return; - - uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); - if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM) + eye_of_cthunAI(Creature *c) : Scripted_NoMovementAI(c) { - // EyeTentacleTimer - if (EyeTentacleTimer <= diff) - { - //Spawn the 8 Eye Tentacles in the corret spots - SpawnEyeTentacle(0, 20); //south - SpawnEyeTentacle(10, 10); //south west - SpawnEyeTentacle(20, 0); //west - SpawnEyeTentacle(10, -10); //north west - - SpawnEyeTentacle(0, -20); //north - SpawnEyeTentacle(-10, -10); //north east - SpawnEyeTentacle(-20, 0); // east - SpawnEyeTentacle(-10, 10); // south east - - EyeTentacleTimer = 45000; - } else EyeTentacleTimer -= diff; + pInst = c->GetInstanceScript(); + if (!pInst) + sLog.outError("TSCR: No Instance eye_of_cthunAI"); } - switch (currentPhase) + InstanceScript* pInst; + + //Global variables + uint32 PhaseTimer; + + //Eye beam phase + uint32 BeamTimer; + uint32 EyeTentacleTimer; + uint32 ClawTentacleTimer; + + //Dark Glare phase + uint32 DarkGlareTick; + uint32 DarkGlareTickTimer; + float DarkGlareAngle; + bool ClockWise; + + void Reset() { - case PHASE_EYE_GREEN_BEAM: - //BeamTimer - if (BeamTimer <= diff) + //Phase information + PhaseTimer = 50000; //First dark glare in 50 seconds + + //Eye beam phase 50 seconds + BeamTimer = 3000; + EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam + ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + + //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) + DarkGlareTick = 0; + DarkGlareTickTimer = 1000; + DarkGlareAngle = 0; + ClockWise = false; + + //Reset flags + me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_ON); + + //Reset Phase + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); + + //to avoid having a following void zone + Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); + if (pPortal) + pPortal->SetReactState(REACT_PASSIVE); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); + } + + void SpawnEyeTentacle(float x, float y) + { + if (Creature* Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Spawned->AI()) + Spawned->AI()->AttackStart(pTarget); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; + + //No instance + if (!pInst) + return; + + uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); + if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM) + { + // EyeTentacleTimer + if (EyeTentacleTimer <= diff) { - //SPELL_GREEN_BEAM - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + //Spawn the 8 Eye Tentacles in the corret spots + SpawnEyeTentacle(0, 20); //south + SpawnEyeTentacle(10, 10); //south west + SpawnEyeTentacle(20, 0); //west + SpawnEyeTentacle(10, -10); //north west + + SpawnEyeTentacle(0, -20); //north + SpawnEyeTentacle(-10, -10); //north east + SpawnEyeTentacle(-20, 0); // east + SpawnEyeTentacle(-10, 10); // south east + + EyeTentacleTimer = 45000; + } else EyeTentacleTimer -= diff; + } + + switch (currentPhase) + { + case PHASE_EYE_GREEN_BEAM: + //BeamTimer + if (BeamTimer <= diff) { + //SPELL_GREEN_BEAM + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + me->InterruptNonMeleeSpells(false); + DoCast(pTarget, SPELL_GREEN_BEAM); + + //Correctly update our target + me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID()); + } + + //Beam every 3 seconds + BeamTimer = 3000; + } else BeamTimer -= diff; + + //ClawTentacleTimer + if (ClawTentacleTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + Creature* Spawned = NULL; + + //Spawn claw tentacle on the random target + Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500); + + if (Spawned && Spawned->AI()) + Spawned->AI()->AttackStart(pTarget); + } + + //One claw tentacle every 12.5 seconds + ClawTentacleTimer = 12500; + } else ClawTentacleTimer -= diff; + + //PhaseTimer + if (PhaseTimer <= diff) + { + //Switch to Dark Beam + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM); + me->InterruptNonMeleeSpells(false); - DoCast(pTarget, SPELL_GREEN_BEAM); + me->SetReactState(REACT_PASSIVE); - //Correctly update our target - me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID()); - } + //Remove any target + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Beam every 3 seconds - BeamTimer = 3000; - } else BeamTimer -= diff; + //Select random target for dark beam to start on + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + //Face our target + DarkGlareAngle = me->GetAngle(pTarget); + DarkGlareTickTimer = 1000; + DarkGlareTick = 0; + ClockWise = RAND(true, false); + } - //ClawTentacleTimer - if (ClawTentacleTimer <= diff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - Creature* Spawned = NULL; - - //Spawn claw tentacle on the random target - Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500); - - if (Spawned && Spawned->AI()) - Spawned->AI()->AttackStart(pTarget); - } - - //One claw tentacle every 12.5 seconds - ClawTentacleTimer = 12500; - } else ClawTentacleTimer -= diff; - - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch to Dark Beam - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM); - - me->InterruptNonMeleeSpells(false); - me->SetReactState(REACT_PASSIVE); - - //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - - //Select random target for dark beam to start on - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - //Face our target - DarkGlareAngle = me->GetAngle(pTarget); - DarkGlareTickTimer = 1000; - DarkGlareTick = 0; - ClockWise = RAND(true, false); - } - - //Add red coloration to C'thun - DoCast(me, SPELL_RED_COLORATION, true); - - //Freeze animation - DoCast(me, SPELL_FREEZE_ANIM); - me->SetOrientation(DarkGlareAngle); - me->StopMoving(); - - //Darkbeam for 35 seconds - PhaseTimer = 35000; - } else PhaseTimer -= diff; - - break; - - case PHASE_EYE_RED_BEAM: - if (DarkGlareTick < 35) - if (DarkGlareTickTimer <= diff) - { - //Set angle and cast - if (ClockWise) - me->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35)); - else - me->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35)); + //Add red coloration to C'thun + DoCast(me, SPELL_RED_COLORATION, true); + //Freeze animation + DoCast(me, SPELL_FREEZE_ANIM); + me->SetOrientation(DarkGlareAngle); me->StopMoving(); - //Actual dark glare cast, maybe something missing here? - DoCast(me, SPELL_DARK_GLARE, false); + //Darkbeam for 35 seconds + PhaseTimer = 35000; + } else PhaseTimer -= diff; - //Increase tick - ++DarkGlareTick; + break; - //1 second per tick - DarkGlareTickTimer = 1000; - } else DarkGlareTickTimer -= diff; + case PHASE_EYE_RED_BEAM: + if (DarkGlareTick < 35) + if (DarkGlareTickTimer <= diff) + { + //Set angle and cast + if (ClockWise) + me->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35)); + else + me->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35)); - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch to Eye Beam - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); + me->StopMoving(); - BeamTimer = 3000; - ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + //Actual dark glare cast, maybe something missing here? + DoCast(me, SPELL_DARK_GLARE, false); + //Increase tick + ++DarkGlareTick; + + //1 second per tick + DarkGlareTickTimer = 1000; + } else DarkGlareTickTimer -= diff; + + //PhaseTimer + if (PhaseTimer <= diff) + { + //Switch to Eye Beam + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); + + BeamTimer = 3000; + ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + + me->InterruptNonMeleeSpells(false); + + //Remove Red coloration from c'thun + me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + + //set it back to aggressive + me->SetReactState(REACT_AGGRESSIVE); + + //Eye Beam for 50 seconds + PhaseTimer = 50000; + } else PhaseTimer -= diff; + + break; + + //Transition phase + case PHASE_CTHUN_TRANSITION: + //Remove any target + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetHealth(0); + me->SetVisibility(VISIBILITY_OFF); + break; + + //Dead phase + case PHASE_CTHUN_DONE: + Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); + if (pPortal) + pPortal->ForcedDespawn(); + + me->ForcedDespawn(); + break; + } + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + //No instance + if (!pInst) + return; + + switch (pInst->GetData(DATA_CTHUN_PHASE)) + { + case PHASE_EYE_GREEN_BEAM: + case PHASE_EYE_RED_BEAM: + //Only if it will kill + if (damage < me->GetHealth()) + return; + + //Fake death in phase 0 or 1 (green beam or dark glare phase) me->InterruptNonMeleeSpells(false); //Remove Red coloration from c'thun me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - //set it back to aggressive - me->SetReactState(REACT_AGGRESSIVE); + //Reset to normal emote state and prevent select and attack + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - //Eye Beam for 50 seconds - PhaseTimer = 50000; - } else PhaseTimer -= diff; + //Remove Target field + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - break; + //Death animation/respawning; + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); - //Transition phase - case PHASE_CTHUN_TRANSITION: - //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - me->SetHealth(0); - me->SetVisibility(VISIBILITY_OFF); - break; + me->SetHealth(0); + damage = 0; - //Dead phase - case PHASE_CTHUN_DONE: - Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); - if (pPortal) - pPortal->ForcedDespawn(); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + break; - me->ForcedDespawn(); - break; - } - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - //No instance - if (!pInst) - return; - - switch (pInst->GetData(DATA_CTHUN_PHASE)) - { - case PHASE_EYE_GREEN_BEAM: - case PHASE_EYE_RED_BEAM: - //Only if it will kill - if (damage < me->GetHealth()) + case PHASE_CTHUN_DONE: + //Allow death here return; - //Fake death in phase 0 or 1 (green beam or dark glare phase) - me->InterruptNonMeleeSpells(false); - - //Remove Red coloration from c'thun - me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - - //Reset to normal emote state and prevent select and attack - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - - //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - - //Death animation/respawning; - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); - - me->SetHealth(0); - damage = 0; - - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - break; - - case PHASE_CTHUN_DONE: - //Allow death here - return; - - default: - //Prevent death in these phases - damage = 0; - return; + default: + //Prevent death in these phases + damage = 0; + return; + } } - } + }; + }; - -struct cthunAI : public Scripted_NoMovementAI + class boss_cthun : public CreatureScript { - cthunAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); +public: + boss_cthun() : CreatureScript("boss_cthun") { } - pInst = c->GetInstanceData(); - if (!pInst) - sLog.outError("TSCR: No Instance eye_of_cthunAI"); + CreatureAI* GetAI(Creature* pCreature) const + { + return new cthunAI (pCreature); } - ScriptedInstance* pInst; - - //Out of combat whisper timer - uint32 WisperTimer; - - //Global variables - uint32 PhaseTimer; - - //------------------- - - //Phase transition - uint64 HoldPlayer; - - //Body Phase - uint32 EyeTentacleTimer; - uint8 FleshTentaclesKilled; - uint32 GiantClawTentacleTimer; - uint32 GiantEyeTentacleTimer; - uint32 StomachAcidTimer; - uint32 StomachEnterTimer; - uint32 StomachEnterVisTimer; - uint64 StomachEnterTarget; - - //Stomach map, bool = true then in stomach - UNORDERED_MAP Stomach_Map; - - void Reset() + struct cthunAI : public Scripted_NoMovementAI { - //One random wisper every 90 - 300 seconds - WisperTimer = 90000; + cthunAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); - //Phase information - PhaseTimer = 10000; //Emerge in 10 seconds + pInst = c->GetInstanceScript(); + if (!pInst) + sLog.outError("TSCR: No Instance eye_of_cthunAI"); + } - //No hold player for transition - HoldPlayer = 0; + InstanceScript* pInst; + + //Out of combat whisper timer + uint32 WisperTimer; + + //Global variables + uint32 PhaseTimer; + + //------------------- + + //Phase transition + uint64 HoldPlayer; //Body Phase - EyeTentacleTimer = 30000; - FleshTentaclesKilled = 0; - GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) - GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) - StomachAcidTimer = 4000; //Every 4 seconds - StomachEnterTimer = 10000; //Every 10 seconds - StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer - StomachEnterTarget = 0; //Target to be teleported to stomach + uint32 EyeTentacleTimer; + uint8 FleshTentaclesKilled; + uint32 GiantClawTentacleTimer; + uint32 GiantEyeTentacleTimer; + uint32 StomachAcidTimer; + uint32 StomachEnterTimer; + uint32 StomachEnterVisTimer; + uint64 StomachEnterTarget; - //Clear players in stomach and outside - Stomach_Map.clear(); + //Stomach map, bool = true then in stomach + UNORDERED_MAP Stomach_Map; - //Reset flags - me->RemoveAurasDueToSpell(SPELL_TRANSFORM); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_OFF); - - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } - - void SpawnEyeTentacle(float x, float y) - { - Creature* Spawned; - Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500); - if (Spawned && Spawned->AI()) - if (Unit *pTarget = SelectRandomNotStomach()) - Spawned->AI()->AttackStart(pTarget); - } - - Unit* SelectRandomNotStomach() - { - if (Stomach_Map.empty()) - return NULL; - - UNORDERED_MAP::const_iterator i = Stomach_Map.begin(); - - std::list temp; - std::list::const_iterator j; - - //Get all players in map - while (i != Stomach_Map.end()) + void Reset() { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + //One random wisper every 90 - 300 seconds + WisperTimer = 90000; - //Only units out of stomach - if (pUnit && i->second == false) - temp.push_back(pUnit); + //Phase information + PhaseTimer = 10000; //Emerge in 10 seconds - ++i; - } - - if (temp.empty()) - return NULL; - - j = temp.begin(); - - //Get random but only if we have more than one unit on threat list - if (temp.size() > 1) - advance (j , rand() % (temp.size() - 1)); - - return (*j); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - { - //No target so we'll use this section to do our random wispers instance wide - //WisperTimer - if (WisperTimer <= diff) - { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return; - - //Play random sound to the zone - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) - { - if (Player* pPlr = itr->getSource()) - pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER,pPlr); - } - } - - //One random wisper every 90 - 300 seconds - WisperTimer = urand(90000,300000); - } else WisperTimer -= diff; - - return; - } - - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - - //No instance - if (!pInst) - return; - - uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); - if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) - { - // EyeTentacleTimer - if (EyeTentacleTimer <= diff) - { - //Spawn the 8 Eye Tentacles in the corret spots - SpawnEyeTentacle(0, 20); //south - SpawnEyeTentacle(10, 10); //south west - SpawnEyeTentacle(20, 0); //west - SpawnEyeTentacle(10, -10); //north west - - SpawnEyeTentacle(0, -20); //north - SpawnEyeTentacle(-10, -10); //north east - SpawnEyeTentacle(-20, 0); // east - SpawnEyeTentacle(-10, 10); // south east - - EyeTentacleTimer = 30000; // every 30sec in phase 2 - } else EyeTentacleTimer -= diff; - } - - switch (currentPhase) - { - //Transition phase - case PHASE_CTHUN_TRANSITION: - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - - //Switch to c'thun model - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_TRANSFORM, false); - me->SetHealth(me->GetMaxHealth()); - - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - - //Emerging phase - //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); - DoZoneInCombat(); - - //Place all units in threat list on outside of stomach - Stomach_Map.clear(); - - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - { - //Outside stomach - Stomach_Map[(*i)->getUnitGuid()] = false; - } - - //Spawn 2 flesh tentacles - FleshTentaclesKilled = 0; - - //Spawn flesh tentacle - for (uint8 i = 0; i < 2; i++) - { - Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); - if (!spawned) - ++FleshTentaclesKilled; - } - - PhaseTimer = 0; - } else PhaseTimer -= diff; - - break; + //No hold player for transition + HoldPlayer = 0; //Body Phase - case PHASE_CTHUN_STOMACH: - //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + EyeTentacleTimer = 30000; + FleshTentaclesKilled = 0; + GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) + GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) + StomachAcidTimer = 4000; //Every 4 seconds + StomachEnterTimer = 10000; //Every 10 seconds + StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer + StomachEnterTarget = 0; //Target to be teleported to stomach - //Weaken - if (FleshTentaclesKilled > 1) + //Clear players in stomach and outside + Stomach_Map.clear(); + + //Reset flags + me->RemoveAurasDueToSpell(SPELL_TRANSFORM); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_OFF); + + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void SpawnEyeTentacle(float x, float y) + { + Creature* Spawned; + Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500); + if (Spawned && Spawned->AI()) + if (Unit *pTarget = SelectRandomNotStomach()) + Spawned->AI()->AttackStart(pTarget); + } + + Unit* SelectRandomNotStomach() + { + if (Stomach_Map.empty()) + return NULL; + + UNORDERED_MAP::const_iterator i = Stomach_Map.begin(); + + std::list temp; + std::list::const_iterator j; + + //Get all players in map + while (i != Stomach_Map.end()) + { + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); + + //Only units out of stomach + if (pUnit && i->second == false) + temp.push_back(pUnit); + + ++i; + } + + if (temp.empty()) + return NULL; + + j = temp.begin(); + + //Get random but only if we have more than one unit on threat list + if (temp.size() > 1) + advance (j , rand() % (temp.size() - 1)); + + return (*j); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + { + //No target so we'll use this section to do our random wispers instance wide + //WisperTimer + if (WisperTimer <= diff) { - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return; - DoScriptText(EMOTE_WEAKENED, me); - PhaseTimer = 45000; + //Play random sound to the zone + Map::PlayerList const &PlayerList = pMap->GetPlayers(); - DoCast(me, SPELL_PURPLE_COLORATION, true); - - UNORDERED_MAP::iterator i = Stomach_Map.begin(); - - //Kick all players out of stomach - while (i != Stomach_Map.end()) + if (!PlayerList.isEmpty()) { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); - - //Only move units in stomach - if (pUnit && i->second == true) + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) { - //Teleport each player out - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); - - //Cast knockback on them - DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); - - //Remove the acid debuff - pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); - - i->second = false; + if (Player* pPlr = itr->getSource()) + pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER,pPlr); } - ++i; } - return; - } + //One random wisper every 90 - 300 seconds + WisperTimer = urand(90000,300000); + } else WisperTimer -= diff; - //Stomach acid - if (StomachAcidTimer <= diff) + return; + } + + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + + //No instance + if (!pInst) + return; + + uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); + if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) + { + // EyeTentacleTimer + if (EyeTentacleTimer <= diff) { - //Apply aura to all players in stomach - UNORDERED_MAP::iterator i = Stomach_Map.begin(); + //Spawn the 8 Eye Tentacles in the corret spots + SpawnEyeTentacle(0, 20); //south + SpawnEyeTentacle(10, 10); //south west + SpawnEyeTentacle(20, 0); //west + SpawnEyeTentacle(10, -10); //north west - while (i != Stomach_Map.end()) + SpawnEyeTentacle(0, -20); //north + SpawnEyeTentacle(-10, -10); //north east + SpawnEyeTentacle(-20, 0); // east + SpawnEyeTentacle(-10, 10); // south east + + EyeTentacleTimer = 30000; // every 30sec in phase 2 + } else EyeTentacleTimer -= diff; + } + + switch (currentPhase) + { + //Transition phase + case PHASE_CTHUN_TRANSITION: + //PhaseTimer + if (PhaseTimer <= diff) { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + //Switch + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - //Only apply to units in stomach - if (pUnit && i->second == true) + //Switch to c'thun model + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_TRANSFORM, false); + me->SetHealth(me->GetMaxHealth()); + + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + + //Emerging phase + //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); + DoZoneInCombat(); + + //Place all units in threat list on outside of stomach + Stomach_Map.clear(); + + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - //Cast digestive acid on them - DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); + //Outside stomach + Stomach_Map[(*i)->getUnitGuid()] = false; + } - //Check if player should be kicked from stomach - if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) + //Spawn 2 flesh tentacles + FleshTentaclesKilled = 0; + + //Spawn flesh tentacle + for (uint8 i = 0; i < 2; i++) + { + Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); + if (!spawned) + ++FleshTentaclesKilled; + } + + PhaseTimer = 0; + } else PhaseTimer -= diff; + + break; + + //Body Phase + case PHASE_CTHUN_STOMACH: + //Remove Target field + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + + //Weaken + if (FleshTentaclesKilled > 1) + { + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); + + DoScriptText(EMOTE_WEAKENED, me); + PhaseTimer = 45000; + + DoCast(me, SPELL_PURPLE_COLORATION, true); + + UNORDERED_MAP::iterator i = Stomach_Map.begin(); + + //Kick all players out of stomach + while (i != Stomach_Map.end()) + { + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); + + //Only move units in stomach + if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); @@ -753,259 +736,427 @@ struct cthunAI : public Scripted_NoMovementAI i->second = false; } + ++i; } - ++i; + + return; } - StomachAcidTimer = 4000; - } else StomachAcidTimer -= diff; - - //Stomach Enter Timer - if (StomachEnterTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + //Stomach acid + if (StomachAcidTimer <= diff) { - //Set target in stomach - Stomach_Map[pTarget->GetGUID()] = true; - pTarget->InterruptNonMeleeSpells(false); - pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); - StomachEnterTarget = pTarget->GetGUID(); - StomachEnterVisTimer = 3800; - } + //Apply aura to all players in stomach + UNORDERED_MAP::iterator i = Stomach_Map.begin(); - StomachEnterTimer = 13800; - } else StomachEnterTimer -= diff; - - if (StomachEnterVisTimer && StomachEnterTarget) - if (StomachEnterVisTimer <= diff) - { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); - - if (pUnit) + while (i != Stomach_Map.end()) { - DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); + + //Only apply to units in stomach + if (pUnit && i->second == true) + { + //Cast digestive acid on them + DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); + + //Check if player should be kicked from stomach + if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) + { + //Teleport each player out + DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); + + //Cast knockback on them + DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); + + //Remove the acid debuff + pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + + i->second = false; + } + } + ++i; } - StomachEnterTarget = 0; - StomachEnterVisTimer = 0; - } else StomachEnterVisTimer -= diff; + StomachAcidTimer = 4000; + } else StomachAcidTimer -= diff; - //GientClawTentacleTimer - if (GiantClawTentacleTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + //Stomach Enter Timer + if (StomachEnterTimer <= diff) { - //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (spawned->AI()) - spawned->AI()->AttackStart(pTarget); - } + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Set target in stomach + Stomach_Map[pTarget->GetGUID()] = true; + pTarget->InterruptNonMeleeSpells(false); + pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); + StomachEnterTarget = pTarget->GetGUID(); + StomachEnterVisTimer = 3800; + } - //One giant claw tentacle every minute - GiantClawTentacleTimer = 60000; - } else GiantClawTentacleTimer -= diff; + StomachEnterTimer = 13800; + } else StomachEnterTimer -= diff; - //GiantEyeTentacleTimer - if (GiantEyeTentacleTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + if (StomachEnterVisTimer && StomachEnterTarget) + if (StomachEnterVisTimer <= diff) + { + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); + + if (pUnit) + { + DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); + } + + StomachEnterTarget = 0; + StomachEnterVisTimer = 0; + } else StomachEnterVisTimer -= diff; + + //GientClawTentacleTimer + if (GiantClawTentacleTimer <= diff) { - //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (spawned->AI()) - spawned->AI()->AttackStart(pTarget); - } + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Spawn claw tentacle on the random target + if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (spawned->AI()) + spawned->AI()->AttackStart(pTarget); + } - //One giant eye tentacle every minute - GiantEyeTentacleTimer = 60000; - } else GiantEyeTentacleTimer -= diff; + //One giant claw tentacle every minute + GiantClawTentacleTimer = 60000; + } else GiantClawTentacleTimer -= diff; - break; - - //Weakened state - case PHASE_CTHUN_WEAK: - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - - //Remove purple coloration - me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); - - //Spawn 2 flesh tentacles - FleshTentaclesKilled = 0; - - //Spawn flesh tentacle - for (uint8 i = 0; i < 2; i++) + //GiantEyeTentacleTimer + if (GiantEyeTentacleTimer <= diff) { - Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); - if (!spawned) - ++FleshTentaclesKilled; - } + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Spawn claw tentacle on the random target + if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (spawned->AI()) + spawned->AI()->AttackStart(pTarget); + } - PhaseTimer = 0; - } else PhaseTimer -= diff; + //One giant eye tentacle every minute + GiantEyeTentacleTimer = 60000; + } else GiantEyeTentacleTimer -= diff; - break; + break; + + //Weakened state + case PHASE_CTHUN_WEAK: + //PhaseTimer + if (PhaseTimer <= diff) + { + //Switch + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); + + //Remove purple coloration + me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); + + //Spawn 2 flesh tentacles + FleshTentaclesKilled = 0; + + //Spawn flesh tentacle + for (uint8 i = 0; i < 2; i++) + { + Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); + if (!spawned) + ++FleshTentaclesKilled; + } + + PhaseTimer = 0; + } else PhaseTimer -= diff; + + break; + } } - } - void JustDied(Unit* /*pKiller*/) - { - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_DONE); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - //No instance - if (!pInst) - return; - - switch (pInst->GetData(DATA_CTHUN_PHASE)) + void JustDied(Unit* /*pKiller*/) { - case PHASE_CTHUN_STOMACH: - //Not weakened so reduce damage by 99% - damage /= 100; - if (damage == 0) - damage = 1; + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_DONE); + } - //Prevent death in non-weakened state - if (damage >= me->GetHealth()) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + //No instance + if (!pInst) + return; + + switch (pInst->GetData(DATA_CTHUN_PHASE)) + { + case PHASE_CTHUN_STOMACH: + //Not weakened so reduce damage by 99% + damage /= 100; + if (damage == 0) + damage = 1; + + //Prevent death in non-weakened state + if (damage >= me->GetHealth()) + damage = 0; + + return; + + case PHASE_CTHUN_WEAK: + //Weakened - takes normal damage + return; + + default: damage = 0; + break; + } + } + void DoAction(const int32 param) + { + switch(param) + { + case ACTION_FLESH_TENTACLE_KILLED: + ++FleshTentaclesKilled; + break; + } + } + }; + +}; + class mob_eye_tentacle : public CreatureScript +{ +public: + mob_eye_tentacle() : CreatureScript("mob_eye_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new eye_tentacleAI (pCreature); + } + + struct eye_tentacleAI : public Scripted_NoMovementAI + { + eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } + + uint32 MindflayTimer; + uint32 KillSelfTimer; + uint64 Portal; + + void JustDied(Unit* /*who*/) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } + + void Reset() + { + //Mind flay half a second after we spawn + MindflayTimer = 500; + + //This prevents eyes from overlapping + KillSelfTimer = 35000; + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) return; - case PHASE_CTHUN_WEAK: - //Weakened - takes normal damage + //KillSelfTimer + if (KillSelfTimer <= diff) + { + me->Kill(me); + return; + } else KillSelfTimer -= diff; + + //MindflayTimer + if (MindflayTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + DoCast(pTarget, SPELL_MIND_FLAY); + + //Mindflay every 10 seconds + MindflayTimer = 10000; + } else MindflayTimer -= diff; + } + }; + +}; + class mob_claw_tentacle : public CreatureScript +{ +public: + mob_claw_tentacle() : CreatureScript("mob_claw_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new claw_tentacleAI (pCreature); + } + + struct claw_tentacleAI : public Scripted_NoMovementAI + { + claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); + + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } + + uint32 GroundRuptureTimer; + uint32 HamstringTimer; + uint32 EvadeTimer; + uint64 Portal; + + void JustDied(Unit* /*who*/) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } + + void Reset() + { + //First rupture should happen half a second after we spawn + GroundRuptureTimer = 500; + HamstringTimer = 2000; + EvadeTimer = 5000; + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) return; - default: - damage = 0; - break; - } - } + //EvadeTimer + if (!me->IsWithinMeleeRange(me->getVictim())) + if (EvadeTimer <= diff) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); - void DoAction(const int32 param) - { - switch(param) - { - case ACTION_FLESH_TENTACLE_KILLED: - ++FleshTentaclesKilled; - break; + //Dissapear and reappear at new position + me->SetVisibility(VISIBILITY_OFF); + + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget) + { + me->Kill(me); + return; + } + + if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + { + me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + + GroundRuptureTimer = 500; + HamstringTimer = 2000; + EvadeTimer = 5000; + AttackStart(pTarget); + } + + me->SetVisibility(VISIBILITY_ON); + } else EvadeTimer -= diff; + + //GroundRuptureTimer + if (GroundRuptureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + GroundRuptureTimer = 30000; + } else GroundRuptureTimer -= diff; + + //HamstringTimer + if (HamstringTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamstringTimer = 5000; + } else HamstringTimer -= diff; + + DoMeleeAttackIfReady(); } - } + }; + }; - -struct eye_tentacleAI : public Scripted_NoMovementAI + class mob_giant_claw_tentacle : public CreatureScript { - eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) +public: + mob_giant_claw_tentacle() : CreatureScript("mob_giant_claw_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const { - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + return new giant_claw_tentacleAI (pCreature); + } + + struct giant_claw_tentacleAI : public Scripted_NoMovementAI + { + giant_claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + SetCombatMovement(false); + + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } } - } - uint32 MindflayTimer; - uint32 KillSelfTimer; - uint64 Portal; + uint32 GroundRuptureTimer; + uint32 ThrashTimer; + uint32 HamstringTimer; + uint32 EvadeTimer; + uint64 Portal; - void JustDied(Unit* /*who*/) - { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } - - void Reset() - { - //Mind flay half a second after we spawn - MindflayTimer = 500; - - //This prevents eyes from overlapping - KillSelfTimer = 35000; - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - - //KillSelfTimer - if (KillSelfTimer <= diff) + void JustDied(Unit* /*who*/) { - me->Kill(me); - return; - } else KillSelfTimer -= diff; - - //MindflayTimer - if (MindflayTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) - DoCast(pTarget, SPELL_MIND_FLAY); - - //Mindflay every 10 seconds - MindflayTimer = 10000; - } else MindflayTimer -= diff; - } -}; - -struct claw_tentacleAI : public Scripted_NoMovementAI -{ - claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); - - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); } - } - uint32 GroundRuptureTimer; - uint32 HamstringTimer; - uint32 EvadeTimer; - uint64 Portal; + void Reset() + { + //First rupture should happen half a second after we spawn + GroundRuptureTimer = 500; + HamstringTimer = 2000; + ThrashTimer = 5000; + EvadeTimer = 5000; + } - void JustDied(Unit* /*who*/) - { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } - void Reset() - { - //First rupture should happen half a second after we spawn - GroundRuptureTimer = 500; - HamstringTimer = 2000; - EvadeTimer = 5000; - } + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - - //EvadeTimer - if (!me->IsWithinMeleeRange(me->getVictim())) - if (EvadeTimer <= diff) + //EvadeTimer + if (!me->IsWithinMeleeRange(me->getVictim())) + if (EvadeTimer <= diff) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1013,7 +1164,7 @@ struct claw_tentacleAI : public Scripted_NoMovementAI //Dissapear and reappear at new position me->SetVisibility(VISIBILITY_OFF); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!pTarget) { me->Kill(me); @@ -1023,7 +1174,7 @@ struct claw_tentacleAI : public Scripted_NoMovementAI if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) { me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); Portal = pPortal->GetGUID(); @@ -1031,279 +1182,147 @@ struct claw_tentacleAI : public Scripted_NoMovementAI GroundRuptureTimer = 500; HamstringTimer = 2000; + ThrashTimer = 5000; EvadeTimer = 5000; AttackStart(pTarget); } me->SetVisibility(VISIBILITY_ON); + } else EvadeTimer -= diff; - //GroundRuptureTimer - if (GroundRuptureTimer <= diff) - { - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); - GroundRuptureTimer = 30000; - } else GroundRuptureTimer -= diff; + //GroundRuptureTimer + if (GroundRuptureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + GroundRuptureTimer = 30000; + } else GroundRuptureTimer -= diff; - //HamstringTimer - if (HamstringTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamstringTimer = 5000; - } else HamstringTimer -= diff; + //ThrashTimer + if (ThrashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_THRASH); + ThrashTimer = 10000; + } else ThrashTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + //HamstringTimer + if (HamstringTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamstringTimer = 10000; + } else HamstringTimer -= diff; -struct giant_claw_tentacleAI : public Scripted_NoMovementAI -{ - giant_claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); - - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + DoMeleeAttackIfReady(); } + }; + +}; + class mob_giant_eye_tentacle : public CreatureScript +{ +public: + mob_giant_eye_tentacle() : CreatureScript("mob_giant_eye_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new giant_eye_tentacleAI (pCreature); } - uint32 GroundRuptureTimer; - uint32 ThrashTimer; - uint32 HamstringTimer; - uint32 EvadeTimer; - uint64 Portal; - - void JustDied(Unit* /*who*/) + struct giant_eye_tentacleAI : public Scripted_NoMovementAI { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } + giant_eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); - void Reset() - { - //First rupture should happen half a second after we spawn - GroundRuptureTimer = 500; - HamstringTimer = 2000; - ThrashTimer = 5000; - EvadeTimer = 5000; - } + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } + uint32 BeamTimer; + uint64 Portal; - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - - //EvadeTimer - if (!me->IsWithinMeleeRange(me->getVictim())) - if (EvadeTimer <= diff) + void JustDied(Unit* /*who*/) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); - - //Dissapear and reappear at new position - me->SetVisibility(VISIBILITY_OFF); - - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget) - { - me->Kill(me); - return; - } - - if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) - { - me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); - } - - GroundRuptureTimer = 500; - HamstringTimer = 2000; - ThrashTimer = 5000; - EvadeTimer = 5000; - AttackStart(pTarget); - } - - me->SetVisibility(VISIBILITY_ON); - - } else EvadeTimer -= diff; - - //GroundRuptureTimer - if (GroundRuptureTimer <= diff) - { - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); - GroundRuptureTimer = 30000; - } else GroundRuptureTimer -= diff; - - //ThrashTimer - if (ThrashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_THRASH); - ThrashTimer = 10000; - } else ThrashTimer -= diff; - - //HamstringTimer - if (HamstringTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamstringTimer = 10000; - } else HamstringTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct giant_eye_tentacleAI : public Scripted_NoMovementAI -{ - giant_eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); - - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); } - } - uint32 BeamTimer; - uint64 Portal; - - void JustDied(Unit* /*who*/) - { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } - - void Reset() - { - //Green Beam half a second after we spawn - BeamTimer = 500; - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - - //BeamTimer - if (BeamTimer <= diff) + void Reset() { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) - DoCast(pTarget, SPELL_GREEN_BEAM); + //Green Beam half a second after we spawn + BeamTimer = 500; + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; + + //BeamTimer + if (BeamTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + DoCast(pTarget, SPELL_GREEN_BEAM); + + //Beam every 2 seconds + BeamTimer = 2100; + } else BeamTimer -= diff; + } + }; - //Beam every 2 seconds - BeamTimer = 2100; - } else BeamTimer -= diff; - } }; - -struct flesh_tentacleAI : public Scripted_NoMovementAI + class mob_giant_flesh_tentacle : public CreatureScript { - flesh_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) +public: + mob_giant_flesh_tentacle() : CreatureScript("mob_giant_flesh_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const { - SetCombatMovement(false); + return new flesh_tentacleAI (pCreature); } - void JustDied(Unit* /*killer*/) + struct flesh_tentacleAI : public Scripted_NoMovementAI { - if (CAST_SUM(me)) - if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) - if (pSummoner->AI()) - pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); - } + flesh_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); + } + + void JustDied(Unit* /*killer*/) + { + if (CAST_SUM(me)) + if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) + if (pSummoner->AI()) + pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); + } + }; + }; //GetAIs -CreatureAI* GetAI_eye_of_cthun(Creature* pCreature) -{ - return new eye_of_cthunAI (pCreature); -} -CreatureAI* GetAI_cthun(Creature* pCreature) -{ - return new cthunAI (pCreature); -} -CreatureAI* GetAI_eye_tentacle(Creature* pCreature) -{ - return new eye_tentacleAI (pCreature); -} -CreatureAI* GetAI_claw_tentacle(Creature* pCreature) -{ - return new claw_tentacleAI (pCreature); -} -CreatureAI* GetAI_giant_claw_tentacle(Creature* pCreature) -{ - return new giant_claw_tentacleAI (pCreature); -} -CreatureAI* GetAI_giant_eye_tentacle(Creature* pCreature) -{ - return new giant_eye_tentacleAI (pCreature); -} -CreatureAI* GetAI_flesh_tentacle(Creature* pCreature) -{ - return new flesh_tentacleAI (pCreature); -} void AddSC_boss_cthun() { - Script *newscript; - - //Eye - newscript = new Script; - newscript->Name = "boss_eye_of_cthun"; - newscript->GetAI = &GetAI_eye_of_cthun; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_cthun"; - newscript->GetAI = &GetAI_cthun; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_eye_tentacle"; - newscript->GetAI = &GetAI_eye_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_claw_tentacle"; - newscript->GetAI = &GetAI_claw_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_claw_tentacle"; - newscript->GetAI = &GetAI_giant_claw_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_eye_tentacle"; - newscript->GetAI = &GetAI_giant_eye_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_flesh_tentacle"; - newscript->GetAI = &GetAI_flesh_tentacle; - newscript->RegisterSelf(); + new boss_eye_of_cthun(); + new boss_cthun(); + new mob_eye_tentacle(); + new mob_claw_tentacle(); + new mob_giant_claw_tentacle(); + new mob_giant_eye_tentacle(); + new mob_giant_flesh_tentacle(); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp index 5bcc9598ebf..deddb038909 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp @@ -36,173 +36,175 @@ EndScriptData */ // Enrage for his spawns #define SPELL_ENRAGE 28798 - -struct boss_fankrissAI : public ScriptedAI + class boss_fankriss : public CreatureScript { - boss_fankrissAI(Creature *c) : ScriptedAI(c) {} +public: + boss_fankriss() : CreatureScript("boss_fankriss") { } - uint32 MortalWound_Timer; - uint32 SpawnHatchlings_Timer; - uint32 SpawnSpawns_Timer; - int Rand; - int RandX; - int RandY; - - Creature* Hatchling; - Creature* Spawn; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MortalWound_Timer = 10000 + rand()%5000; - SpawnHatchlings_Timer = 6000 + rand()%6000; - SpawnSpawns_Timer = 15000 + rand()%30000; + return new boss_fankrissAI (pCreature); } - void SummonSpawn(Unit* victim) + struct boss_fankrissAI : public ScriptedAI { - if (!victim) - return; + boss_fankrissAI(Creature *c) : ScriptedAI(c) {} - Rand = 10 + (rand()%10); - switch (rand()%2) + uint32 MortalWound_Timer; + uint32 SpawnHatchlings_Timer; + uint32 SpawnSpawns_Timer; + int Rand; + int RandX; + int RandY; + + Creature* Hatchling; + Creature* Spawn; + + void Reset() { - case 0: RandX = 0 - Rand; break; - case 1: RandX = 0 + Rand; break; + MortalWound_Timer = 10000 + rand()%5000; + SpawnHatchlings_Timer = 6000 + rand()%6000; + SpawnSpawns_Timer = 15000 + rand()%30000; } - Rand = 0; - Rand = 10 + (rand()%10); - switch (rand()%2) + + void SummonSpawn(Unit* victim) { - case 0: RandY = 0 - Rand; break; - case 1: RandY = 0 + Rand; break; - } - Rand = 0; - Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if (Spawn) - Spawn->AI()->AttackStart(victim); - } + if (!victim) + return; - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //MortalWound_Timer - if (MortalWound_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - MortalWound_Timer = 10000 + rand()%10000; - } else MortalWound_Timer -= diff; - - //Summon 1-3 Spawns of Fankriss at random time. - if (SpawnSpawns_Timer <= diff) - { - switch (urand(0,2)) + Rand = 10 + (rand()%10); + switch (rand()%2) { - case 0: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; - case 1: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; - case 2: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; + case 0: RandX = 0 - Rand; break; + case 1: RandX = 0 + Rand; break; } - SpawnSpawns_Timer = 30000 + rand()%30000; - } else SpawnSpawns_Timer -= diff; - - // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. - //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. - if (me->GetHealth()*100 / me->GetMaxHealth() > 3) - { - if (SpawnHatchlings_Timer <= diff) + Rand = 0; + Rand = 10 + (rand()%10); + switch (rand()%2) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - { - DoCast(pTarget, SPELL_ROOT); - - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); - - switch(urand(0,2)) - { - case 0: - DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; - case 1: - DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; - case 2: - DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; - } - } - SpawnHatchlings_Timer = 45000 + rand()%15000; - } else SpawnHatchlings_Timer -= diff; + case 0: RandY = 0 - Rand; break; + case 1: RandY = 0 + Rand; break; + } + Rand = 0; + Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + if (Spawn) + Spawn->AI()->AttackStart(victim); } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //MortalWound_Timer + if (MortalWound_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + MortalWound_Timer = 10000 + rand()%10000; + } else MortalWound_Timer -= diff; + + //Summon 1-3 Spawns of Fankriss at random time. + if (SpawnSpawns_Timer <= diff) + { + switch (urand(0,2)) + { + case 0: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + case 1: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + case 2: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + } + SpawnSpawns_Timer = 30000 + rand()%30000; + } else SpawnSpawns_Timer -= diff; + + // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. + //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. + if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + { + if (SpawnHatchlings_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoCast(pTarget, SPELL_ROOT); + + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + + switch(urand(0,2)) + { + case 0: + DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + case 1: + DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + case 2: + DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + } + } + SpawnHatchlings_Timer = 45000 + rand()%15000; + } else SpawnHatchlings_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_fankriss(Creature* pCreature) -{ - return new boss_fankrissAI (pCreature); -} void AddSC_boss_fankriss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_fankriss"; - newscript->GetAI = &GetAI_boss_fankriss; - newscript->RegisterSelf(); + new boss_fankriss(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 468d535c48a..9c4345144fd 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -34,117 +34,119 @@ EndScriptData */ #define SPELL_NOXIOUSPOISON 26053 #define SPELL_WYVERNSTING 26180 #define SPELL_ACIDSPIT 26050 - -struct boss_huhuranAI : public ScriptedAI + class boss_huhuran : public CreatureScript { - boss_huhuranAI(Creature *c) : ScriptedAI(c) {} +public: + boss_huhuran() : CreatureScript("boss_huhuran") { } - uint32 Frenzy_Timer; - uint32 Wyvern_Timer; - uint32 Spit_Timer; - uint32 PoisonBolt_Timer; - uint32 NoxiousPoison_Timer; - uint32 FrenzyBack_Timer; - - bool Frenzy; - bool Berserk; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Frenzy_Timer = 25000 + rand()%10000; - Wyvern_Timer = 18000 + rand()%10000; - Spit_Timer = 8000; - PoisonBolt_Timer = 4000; - NoxiousPoison_Timer = 10000 + rand()%10000; - FrenzyBack_Timer = 15000; - - Frenzy = false; - Berserk = false; + return new boss_huhuranAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_huhuranAI : public ScriptedAI { - } + boss_huhuranAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Frenzy_Timer; + uint32 Wyvern_Timer; + uint32 Spit_Timer; + uint32 PoisonBolt_Timer; + uint32 NoxiousPoison_Timer; + uint32 FrenzyBack_Timer; - //Frenzy_Timer - if (!Frenzy && Frenzy_Timer <= diff) + bool Frenzy; + bool Berserk; + + void Reset() { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); - Frenzy = true; - PoisonBolt_Timer = 3000; Frenzy_Timer = 25000 + rand()%10000; - } else Frenzy_Timer -= diff; - - // Wyvern Timer - if (Wyvern_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_WYVERNSTING); - Wyvern_Timer = 15000 + rand()%17000; - } else Wyvern_Timer -= diff; - - //Spit Timer - if (Spit_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ACIDSPIT); - Spit_Timer = 5000 + rand()%5000; - } else Spit_Timer -= diff; - - //NoxiousPoison_Timer - if (NoxiousPoison_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_NOXIOUSPOISON); - NoxiousPoison_Timer = 12000 + rand()%12000; - } else NoxiousPoison_Timer -= diff; - - //PoisonBolt only if frenzy or berserk - if (Frenzy || Berserk) - { - if (PoisonBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_POISONBOLT); - PoisonBolt_Timer = 3000; - } else PoisonBolt_Timer -= diff; - } - - //FrenzyBack_Timer - if (Frenzy && FrenzyBack_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - Frenzy = false; + Wyvern_Timer = 18000 + rand()%10000; + Spit_Timer = 8000; + PoisonBolt_Timer = 4000; + NoxiousPoison_Timer = 10000 + rand()%10000; FrenzyBack_Timer = 15000; - } else FrenzyBack_Timer -= diff; - if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31) - { - me->InterruptNonMeleeSpells(false); - DoScriptText(EMOTE_GENERIC_BERSERK, me); - DoCast(me, SPELL_BERSERK); - Berserk = true; + Frenzy = false; + Berserk = false; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Frenzy_Timer + if (!Frenzy && Frenzy_Timer <= diff) + { + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + Frenzy = true; + PoisonBolt_Timer = 3000; + Frenzy_Timer = 25000 + rand()%10000; + } else Frenzy_Timer -= diff; + + // Wyvern Timer + if (Wyvern_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_WYVERNSTING); + Wyvern_Timer = 15000 + rand()%17000; + } else Wyvern_Timer -= diff; + + //Spit Timer + if (Spit_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ACIDSPIT); + Spit_Timer = 5000 + rand()%5000; + } else Spit_Timer -= diff; + + //NoxiousPoison_Timer + if (NoxiousPoison_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSPOISON); + NoxiousPoison_Timer = 12000 + rand()%12000; + } else NoxiousPoison_Timer -= diff; + + //PoisonBolt only if frenzy or berserk + if (Frenzy || Berserk) + { + if (PoisonBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_POISONBOLT); + PoisonBolt_Timer = 3000; + } else PoisonBolt_Timer -= diff; + } + + //FrenzyBack_Timer + if (Frenzy && FrenzyBack_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + Frenzy = false; + FrenzyBack_Timer = 15000; + } else FrenzyBack_Timer -= diff; + + if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31) + { + me->InterruptNonMeleeSpells(false); + DoScriptText(EMOTE_GENERIC_BERSERK, me); + DoCast(me, SPELL_BERSERK); + Berserk = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_huhuran(Creature* pCreature) -{ - return new boss_huhuranAI (pCreature); -} void AddSC_boss_huhuran() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_huhuran"; - newscript->GetAI = &GetAI_boss_huhuran; - newscript->RegisterSelf(); + new boss_huhuran(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 7a07c8f81a3..5365c349791 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -32,111 +32,113 @@ EndScriptData */ #define SPELL_BIRTH 26262 //The Birth Animation #define SPELL_DIRTMOUND_PASSIVE 26092 - -struct boss_ouroAI : public ScriptedAI + class boss_ouro : public CreatureScript { - boss_ouroAI(Creature *c) : ScriptedAI(c) {} +public: + boss_ouro() : CreatureScript("boss_ouro") { } - uint32 Sweep_Timer; - uint32 SandBlast_Timer; - uint32 Submerge_Timer; - uint32 Back_Timer; - uint32 ChangeTarget_Timer; - uint32 Spawn_Timer; - - bool Enrage; - bool Submerged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Sweep_Timer = 5000 + rand()%5000; - SandBlast_Timer = 20000 + rand()%15000; - Submerge_Timer = 90000 + rand()%60000; - Back_Timer = 30000 + rand()%15000; - ChangeTarget_Timer = 5000 + rand()%3000; - Spawn_Timer = 10000 + rand()%10000; - - Enrage = false; - Submerged = false; + return new boss_ouroAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ouroAI : public ScriptedAI { - DoCast(me->getVictim(), SPELL_BIRTH); - } + boss_ouroAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Sweep_Timer; + uint32 SandBlast_Timer; + uint32 Submerge_Timer; + uint32 Back_Timer; + uint32 ChangeTarget_Timer; + uint32 Spawn_Timer; - //Sweep_Timer - if (!Submerged && Sweep_Timer <= diff) + bool Enrage; + bool Submerged; + + void Reset() { - DoCast(me->getVictim(), SPELL_SWEEP); - Sweep_Timer = 15000 + rand()%15000; - } else Sweep_Timer -= diff; - - //SandBlast_Timer - if (!Submerged && SandBlast_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SANDBLAST); + Sweep_Timer = 5000 + rand()%5000; SandBlast_Timer = 20000 + rand()%15000; - } else SandBlast_Timer -= diff; - - //Submerge_Timer - if (!Submerged && Submerge_Timer <= diff) - { - //Cast - me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(35); - DoCast(me, SPELL_DIRTMOUND_PASSIVE); - - Submerged = true; + Submerge_Timer = 90000 + rand()%60000; Back_Timer = 30000 + rand()%15000; - } else Submerge_Timer -= diff; - - //ChangeTarget_Timer - if (Submerged && ChangeTarget_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - if (pTarget) - DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); - - ChangeTarget_Timer = 10000 + rand()%10000; - } else ChangeTarget_Timer -= diff; - - //Back_Timer - if (Submerged && Back_Timer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(14); - - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + ChangeTarget_Timer = 5000 + rand()%3000; + Spawn_Timer = 10000 + rand()%10000; + Enrage = false; Submerged = false; - Submerge_Timer = 60000 + rand()%60000; - } else Back_Timer -= diff; + } + + void EnterCombat(Unit * /*who*/) + { + DoCast(me->getVictim(), SPELL_BIRTH); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sweep_Timer + if (!Submerged && Sweep_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SWEEP); + Sweep_Timer = 15000 + rand()%15000; + } else Sweep_Timer -= diff; + + //SandBlast_Timer + if (!Submerged && SandBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SANDBLAST); + SandBlast_Timer = 20000 + rand()%15000; + } else SandBlast_Timer -= diff; + + //Submerge_Timer + if (!Submerged && Submerge_Timer <= diff) + { + //Cast + me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(35); + DoCast(me, SPELL_DIRTMOUND_PASSIVE); + + Submerged = true; + Back_Timer = 30000 + rand()%15000; + } else Submerge_Timer -= diff; + + //ChangeTarget_Timer + if (Submerged && ChangeTarget_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + if (pTarget) + DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + + ChangeTarget_Timer = 10000 + rand()%10000; + } else ChangeTarget_Timer -= diff; + + //Back_Timer + if (Submerged && Back_Timer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(14); + + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + + Submerged = false; + Submerge_Timer = 60000 + rand()%60000; + } else Back_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ouro(Creature* pCreature) -{ - return new boss_ouroAI (pCreature); -} void AddSC_boss_ouro() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ouro"; - newscript->GetAI = &GetAI_boss_ouro; - newscript->RegisterSelf(); + new boss_ouro(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index 18bd1af71a5..0fb6aedb6a8 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -36,104 +36,248 @@ EndScriptData */ //Guard Spell #define SPELL_WHIRLWINDADD 26038 #define SPELL_KNOCKBACK 26027 - -struct boss_sarturaAI : public ScriptedAI + class boss_sartura : public CreatureScript { - boss_sarturaAI(Creature *c) : ScriptedAI(c) {} +public: + boss_sartura() : CreatureScript("boss_sartura") { } - uint32 WhirlWind_Timer; - uint32 WhirlWindRandom_Timer; - uint32 WhirlWindEnd_Timer; - uint32 AggroReset_Timer; - uint32 AggroResetEnd_Timer; - uint32 EnrageHard_Timer; - - bool Enraged; - bool EnragedHard; - bool WhirlWind; - bool AggroReset; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = 3000 + rand()%4000; - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = 45000 + rand()%10000; - AggroResetEnd_Timer = 5000; - EnrageHard_Timer = 10*60000; - - WhirlWind = false; - AggroReset = false; - Enraged = false; - EnragedHard = false; - + return new boss_sarturaAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_sarturaAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_sarturaAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 WhirlWind_Timer; + uint32 WhirlWindRandom_Timer; + uint32 WhirlWindEnd_Timer; + uint32 AggroReset_Timer; + uint32 AggroResetEnd_Timer; + uint32 EnrageHard_Timer; - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + bool Enraged; + bool EnragedHard; + bool WhirlWind; + bool AggroReset; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (WhirlWind) + void Reset() { - if (WhirlWindRandom_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = 3000 + rand()%4000; + WhirlWindEnd_Timer = 15000; + AggroReset_Timer = 45000 + rand()%10000; + AggroResetEnd_Timer = 5000; + EnrageHard_Timer = 10*60000; - WhirlWindRandom_Timer = 3000 + rand()%4000; - } else WhirlWindRandom_Timer -= diff; + WhirlWind = false; + AggroReset = false; + Enraged = false; + EnragedHard = false; - if (WhirlWindEnd_Timer <= diff) - { - WhirlWind = false; - WhirlWind_Timer = 25000 + rand()%15000; - } else WhirlWindEnd_Timer -= diff; } - if (!WhirlWind) + void EnterCombat(Unit * /*who*/) { - if (WhirlWind_Timer <= diff) + DoScriptText(SAY_AGGRO, me); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_SLAY, me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (WhirlWind) { - DoCast(me, SPELL_WHIRLWIND); + if (WhirlWindRandom_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + WhirlWindRandom_Timer = 3000 + rand()%4000; + } else WhirlWindRandom_Timer -= diff; + + if (WhirlWindEnd_Timer <= diff) + { + WhirlWind = false; + WhirlWind_Timer = 25000 + rand()%15000; + } else WhirlWindEnd_Timer -= diff; + } + + if (!WhirlWind) + { + if (WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + WhirlWind = true; + WhirlWindEnd_Timer = 15000; + } else WhirlWind_Timer -= diff; + + if (AggroReset_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + AggroReset = true; + AggroReset_Timer = 2000 + rand()%3000; + } else AggroReset_Timer -= diff; + + if (AggroReset) + { + if (AggroResetEnd_Timer <= diff) + { + AggroReset = false; + AggroResetEnd_Timer = 5000; + AggroReset_Timer = 35000 + rand()%10000; + } else AggroResetEnd_Timer -= diff; + } + + //If she is 20% enrage + if (!Enraged) + { + if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + } + + //After 10 minutes hard enrage + if (!EnragedHard) + { + if (EnrageHard_Timer <= diff) + { + DoCast(me, SPELL_ENRAGEHARD); + EnragedHard = true; + } else EnrageHard_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + } + }; + +}; + class mob_sartura_royal_guard : public CreatureScript +{ +public: + mob_sartura_royal_guard() : CreatureScript("mob_sartura_royal_guard") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_sartura_royal_guardAI (pCreature); + } + + struct mob_sartura_royal_guardAI : public ScriptedAI + { + mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {} + + uint32 WhirlWind_Timer; + uint32 WhirlWindRandom_Timer; + uint32 WhirlWindEnd_Timer; + uint32 AggroReset_Timer; + uint32 AggroResetEnd_Timer; + uint32 KnockBack_Timer; + + bool WhirlWind; + bool AggroReset; + + void Reset() + { + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = 3000 + rand()%4000; + WhirlWindEnd_Timer = 15000; + AggroReset_Timer = 45000 + rand()%10000; + AggroResetEnd_Timer = 5000; + KnockBack_Timer = 10000; + + WhirlWind = false; + AggroReset = false; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!WhirlWind && WhirlWind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWINDADD); WhirlWind = true; + WhirlWind_Timer = 25000 + rand()%15000; WhirlWindEnd_Timer = 15000; } else WhirlWind_Timer -= diff; - if (AggroReset_Timer <= diff) + if (WhirlWind) { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); + if (WhirlWindRandom_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + WhirlWindRandom_Timer = 3000 + rand()%4000; + } else WhirlWindRandom_Timer -= diff; + + if (WhirlWindEnd_Timer <= diff) + { + WhirlWind = false; + } else WhirlWindEnd_Timer -= diff; + } + + if (!WhirlWind) + { + if (AggroReset_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); AggroReset = true; AggroReset_Timer = 2000 + rand()%3000; - } else AggroReset_Timer -= diff; + } else AggroReset_Timer -= diff; + + if (KnockBack_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWINDADD); + KnockBack_Timer = 10000 + rand()%10000; + } else KnockBack_Timer -= diff; + } if (AggroReset) { @@ -141,159 +285,20 @@ struct boss_sarturaAI : public ScriptedAI { AggroReset = false; AggroResetEnd_Timer = 5000; - AggroReset_Timer = 35000 + rand()%10000; + AggroReset_Timer = 30000 + rand()%10000; } else AggroResetEnd_Timer -= diff; } - //If she is 20% enrage - if (!Enraged) - { - if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false)) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } - } - - //After 10 minutes hard enrage - if (!EnragedHard) - { - if (EnrageHard_Timer <= diff) - { - DoCast(me, SPELL_ENRAGEHARD); - EnragedHard = true; - } else EnrageHard_Timer -= diff; - } - DoMeleeAttackIfReady(); } - } + }; + }; -struct mob_sartura_royal_guardAI : public ScriptedAI -{ - mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {} - uint32 WhirlWind_Timer; - uint32 WhirlWindRandom_Timer; - uint32 WhirlWindEnd_Timer; - uint32 AggroReset_Timer; - uint32 AggroResetEnd_Timer; - uint32 KnockBack_Timer; - - bool WhirlWind; - bool AggroReset; - - void Reset() - { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = 3000 + rand()%4000; - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = 45000 + rand()%10000; - AggroResetEnd_Timer = 5000; - KnockBack_Timer = 10000; - - WhirlWind = false; - AggroReset = false; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!WhirlWind && WhirlWind_Timer <= diff) - { - DoCast(me, SPELL_WHIRLWINDADD); - WhirlWind = true; - WhirlWind_Timer = 25000 + rand()%15000; - WhirlWindEnd_Timer = 15000; - } else WhirlWind_Timer -= diff; - - if (WhirlWind) - { - if (WhirlWindRandom_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - - WhirlWindRandom_Timer = 3000 + rand()%4000; - } else WhirlWindRandom_Timer -= diff; - - if (WhirlWindEnd_Timer <= diff) - { - WhirlWind = false; - } else WhirlWindEnd_Timer -= diff; - } - - if (!WhirlWind) - { - if (AggroReset_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - - AggroReset = true; - AggroReset_Timer = 2000 + rand()%3000; - } else AggroReset_Timer -= diff; - - if (KnockBack_Timer <= diff) - { - DoCast(me, SPELL_WHIRLWINDADD); - KnockBack_Timer = 10000 + rand()%10000; - } else KnockBack_Timer -= diff; - } - - if (AggroReset) - { - if (AggroResetEnd_Timer <= diff) - { - AggroReset = false; - AggroResetEnd_Timer = 5000; - AggroReset_Timer = 30000 + rand()%10000; - } else AggroResetEnd_Timer -= diff; - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_sartura(Creature* pCreature) -{ - return new boss_sarturaAI (pCreature); -} - -CreatureAI* GetAI_mob_sartura_royal_guard(Creature* pCreature) -{ - return new mob_sartura_royal_guardAI (pCreature); -} void AddSC_boss_sartura() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_sartura"; - newscript->GetAI = &GetAI_boss_sartura; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_sartura_royal_guard"; - newscript->GetAI = &GetAI_mob_sartura_royal_guard; - newscript->RegisterSelf(); + new boss_sartura(); + new mob_sartura_royal_guard(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 06b753bd5f5..a9bc909df98 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -50,251 +50,253 @@ class ov_mycoordinates x = cx; y = cy; z = cz; r = cr; } }; - -struct boss_skeramAI : public ScriptedAI + class boss_skeram : public CreatureScript { - boss_skeramAI(Creature *c) : ScriptedAI(c) +public: + boss_skeram() : CreatureScript("boss_skeram") { } + + CreatureAI* GetAI(Creature* pCreature) const { - IsImage = false; + return new boss_skeramAI (pCreature); } - uint32 ArcaneExplosion_Timer; - uint32 EarthShock_Timer; - uint32 FullFillment_Timer; - uint32 Blink_Timer; - uint32 Invisible_Timer; - - bool Images75; - bool Images50; - bool Images25; - bool IsImage; - bool Invisible; - - void Reset() + struct boss_skeramAI : public ScriptedAI { - ArcaneExplosion_Timer = 6000 + rand()%6000; - EarthShock_Timer = 2000; - FullFillment_Timer = 15000; - Blink_Timer = 8000 + rand()%12000; - Invisible_Timer = 500; - - Images75 = false; - Images50 = false; - Images25 = false; - Invisible = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); - - if (IsImage) - me->setDeathState(JUST_DIED); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit* /*Killer*/) - { - if (!IsImage) - DoScriptText(SAY_DEATH, me); - } - - void EnterCombat(Unit * /*who*/) - { - if (IsImage || Images75) - return; - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) + boss_skeramAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); - ArcaneExplosion_Timer = 8000 + rand()%10000; - } else ArcaneExplosion_Timer -= diff; - - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) - { - //Make sure our attack is ready and we arn't currently casting - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) - { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - }else - { - //EarthShock_Timer - if (EarthShock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_EARTH_SHOCK); - EarthShock_Timer = 1000; - } else EarthShock_Timer -= diff; + IsImage = false; } - //Blink_Timer - if (Blink_Timer <= diff) + uint32 ArcaneExplosion_Timer; + uint32 EarthShock_Timer; + uint32 FullFillment_Timer; + uint32 Blink_Timer; + uint32 Invisible_Timer; + + bool Images75; + bool Images50; + bool Images25; + bool IsImage; + bool Invisible; + + void Reset() { - //DoCast(me, SPELL_BLINK); + ArcaneExplosion_Timer = 6000 + rand()%6000; + EarthShock_Timer = 2000; + FullFillment_Timer = 15000; + Blink_Timer = 8000 + rand()%12000; + Invisible_Timer = 500; + + Images75 = false; + Images50 = false; + Images25 = false; + Invisible = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); + + if (IsImage) + me->setDeathState(JUST_DIED); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } + + void JustDied(Unit* /*Killer*/) + { + if (!IsImage) + DoScriptText(SAY_DEATH, me); + } + + void EnterCombat(Unit * /*who*/) + { + if (IsImage || Images75) + return; + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); + ArcaneExplosion_Timer = 8000 + rand()%10000; + } else ArcaneExplosion_Timer -= diff; + + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + //Make sure our attack is ready and we arn't currently casting + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + }else + { + //EarthShock_Timer + if (EarthShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_EARTH_SHOCK); + EarthShock_Timer = 1000; + } else EarthShock_Timer -= diff; + } + + //Blink_Timer + if (Blink_Timer <= diff) + { + //DoCast(me, SPELL_BLINK); + switch (urand(0,2)) + { + case 0: + me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f); + DoResetThreat(); + break; + case 1: + me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f); + DoResetThreat(); + break; + case 2: + me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f); + DoResetThreat(); + break; + } + DoStopAttack(); + + Blink_Timer= 20000 + rand()%20000; + } else Blink_Timer -= diff; + + int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5); + + //Summoning 2 Images and teleporting to a random position on 75% health + if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70)) + DoSplit(75); + + //Summoning 2 Images and teleporting to a random position on 50% health + if ((!Images50 && !IsImage) && + (procent <= 50 && procent > 45)) + DoSplit(50); + + //Summoning 2 Images and teleporting to a random position on 25% health + if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20)) + DoSplit(25); + + //Invisible_Timer + if (Invisible) + { + if (Invisible_Timer <= diff) + { + //Making Skeram visible after telporting + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + Invisible_Timer = 2500; + Invisible = false; + } else Invisible_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + + void DoSplit(int atPercent /* 75 50 25 */) + { + DoScriptText(SAY_SPLIT, me); + + ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); + ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); + ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0); + + ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; + switch (urand(0,2)) { case 0: - me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f); - DoResetThreat(); + bossc=place1; + i1=place2; + i2=place3; break; case 1: - me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f); - DoResetThreat(); + bossc=place2; + i1=place1; + i2=place3; break; case 2: - me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f); - DoResetThreat(); + bossc=place3; + i1=place1; + i2=place2; break; } + + for (uint16 i = 0; i < 41; ++i) + { + if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) + { + if (Group *pGrp = pTarget->GetGroup()) + for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) + { + //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( + pGrp->SetTargetIcon(ico, 0, 0); + } + + break; + } + } + + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_OFF); + me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r); + Invisible = true; + delete place1; + delete place2; + delete place3; + DoResetThreat(); DoStopAttack(); - Blink_Timer= 20000 + rand()%20000; - } else Blink_Timer -= diff; - - int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5); - - //Summoning 2 Images and teleporting to a random position on 75% health - if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70)) - DoSplit(75); - - //Summoning 2 Images and teleporting to a random position on 50% health - if ((!Images50 && !IsImage) && - (procent <= 50 && procent > 45)) - DoSplit(50); - - //Summoning 2 Images and teleporting to a random position on 25% health - if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20)) - DoSplit(25); - - //Invisible_Timer - if (Invisible) - { - if (Invisible_Timer <= diff) + switch (atPercent) { - //Making Skeram visible after telporting - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - Invisible_Timer = 2500; - Invisible = false; - } else Invisible_Timer -= diff; - } - - DoMeleeAttackIfReady(); - } - - void DoSplit(int atPercent /* 75 50 25 */) - { - DoScriptText(SAY_SPLIT, me); - - ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); - ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); - ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0); - - ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; - - switch (urand(0,2)) - { - case 0: - bossc=place1; - i1=place2; - i2=place3; - break; - case 1: - bossc=place2; - i1=place1; - i2=place3; - break; - case 2: - bossc=place3; - i1=place1; - i2=place2; - break; - } - - for (uint16 i = 0; i < 41; ++i) - { - if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) - { - if (Group *pGrp = pTarget->GetGroup()) - for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) - { - //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( - pGrp->SetTargetIcon(ico, 0, 0); - } - - break; + case 75: Images75 = true; break; + case 50: Images50 = true; break; + case 25: Images25 = true; break; } + + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); + if (Image1) + { + Image1->SetMaxHealth(me->GetMaxHealth() / 5); + Image1->SetHealth(me->GetHealth() / 5); + if (pTarget) + Image1->AI()->AttackStart(pTarget); + CAST_AI(boss_skeram::boss_skeramAI, Image1->AI())->IsImage = true; + } + + Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); + if (Image2) + { + Image2->SetMaxHealth(me->GetMaxHealth() / 5); + Image2->SetHealth(me->GetHealth() / 5); + if (pTarget) + Image2->AI()->AttackStart(pTarget); + CAST_AI(boss_skeram::boss_skeramAI, Image2->AI())->IsImage = true; + } + Invisible = true; } - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_OFF); - me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r); - Invisible = true; - delete place1; - delete place2; - delete place3; - DoResetThreat(); - DoStopAttack(); - - switch (atPercent) - { - case 75: Images75 = true; break; - case 50: Images50 = true; break; - case 25: Images25 = true; break; - } - - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); - if (Image1) - { - Image1->SetMaxHealth(me->GetMaxHealth() / 5); - Image1->SetHealth(me->GetHealth() / 5); - if (pTarget) - Image1->AI()->AttackStart(pTarget); - CAST_AI(boss_skeramAI, Image1->AI())->IsImage = true; - } - - Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); - if (Image2) - { - Image2->SetMaxHealth(me->GetMaxHealth() / 5); - Image2->SetHealth(me->GetHealth() / 5); - if (pTarget) - Image2->AI()->AttackStart(pTarget); - CAST_AI(boss_skeramAI, Image2->AI())->IsImage = true; - } - Invisible = true; - } + }; }; -CreatureAI* GetAI_boss_skeram(Creature* pCreature) -{ - return new boss_skeramAI (pCreature); -} void AddSC_boss_skeram() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_skeram"; - newscript->GetAI = &GetAI_boss_skeram; - newscript->RegisterSelf(); + new boss_skeram(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 39938d64dc5..13c188e455b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -63,10 +63,10 @@ struct boss_twinemperorsAI : public ScriptedAI { boss_twinemperorsAI(Creature *c): ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 Heal_Timer; uint32 Teleport_Timer; @@ -382,217 +382,221 @@ struct boss_twinemperorsAI : public ScriptedAI } else EnrageTimer-=diff; } }; - -struct boss_veknilashAI : public boss_twinemperorsAI + class boss_veknilash : public CreatureScript { - bool IAmVeklor() {return false;} - boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {} +public: + boss_veknilash() : CreatureScript("boss_veknilash") { } - uint32 UpperCut_Timer; - uint32 UnbalancingStrike_Timer; - uint32 Scarabs_Timer; - int Rand; - int RandX; - int RandY; - - Creature* Summoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - TwinReset(); - UpperCut_Timer = 14000 + rand()%15000; - UnbalancingStrike_Timer = 8000 + rand()%10000; - Scarabs_Timer = 7000 + rand()%7000; - - //Added. Can be removed if its included in DB. - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + return new boss_veknilashAI (pCreature); } - void CastSpellOnBug(Creature *pTarget) + struct boss_veknilashAI : public boss_twinemperorsAI { - pTarget->setFaction(14); - pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget()); - pTarget->AddAura(SPELL_MUTATE_BUG, pTarget); - pTarget->SetHealth(pTarget->GetMaxHealth()); - } + bool IAmVeklor() {return false;} + boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 UpperCut_Timer; + uint32 UnbalancingStrike_Timer; + uint32 Scarabs_Timer; + int Rand; + int RandX; + int RandY; - if (!TryActivateAfterTTelep(diff)) - return; + Creature* Summoned; - //UnbalancingStrike_Timer - if (UnbalancingStrike_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); - UnbalancingStrike_Timer = 8000+rand()%12000; - } else UnbalancingStrike_Timer -= diff; + TwinReset(); + UpperCut_Timer = 14000 + rand()%15000; + UnbalancingStrike_Timer = 8000 + rand()%10000; + Scarabs_Timer = 7000 + rand()%7000; - if (UpperCut_Timer <= diff) + //Added. Can be removed if its included in DB. + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + } + + void CastSpellOnBug(Creature *pTarget) { - Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true); - if (randomMelee) - DoCast(randomMelee, SPELL_UPPERCUT); - UpperCut_Timer = 15000+rand()%15000; - } else UpperCut_Timer -= diff; + pTarget->setFaction(14); + pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget()); + pTarget->AddAura(SPELL_MUTATE_BUG, pTarget); + pTarget->SetHealth(pTarget->GetMaxHealth()); + } - HandleBugs(diff); - - //Heal brother when 60yrds close - TryHealBrother(diff); - - //Teleporting to brother - if (Teleport_Timer <= diff) + void UpdateAI(const uint32 diff) { - TeleportToMyBrother(); - } else Teleport_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - CheckEnrage(diff); + if (!TryActivateAfterTTelep(diff)) + return; + + //UnbalancingStrike_Timer + if (UnbalancingStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); + UnbalancingStrike_Timer = 8000+rand()%12000; + } else UnbalancingStrike_Timer -= diff; + + if (UpperCut_Timer <= diff) + { + Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true); + if (randomMelee) + DoCast(randomMelee, SPELL_UPPERCUT); + UpperCut_Timer = 15000+rand()%15000; + } else UpperCut_Timer -= diff; + + HandleBugs(diff); + + //Heal brother when 60yrds close + TryHealBrother(diff); + + //Teleporting to brother + if (Teleport_Timer <= diff) + { + TeleportToMyBrother(); + } else Teleport_Timer -= diff; + + CheckEnrage(diff); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; - -struct boss_veklorAI : public boss_twinemperorsAI + class boss_veklor : public CreatureScript { - bool IAmVeklor() {return true;} - boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {} +public: + boss_veklor() : CreatureScript("boss_veklor") { } - uint32 ShadowBolt_Timer; - uint32 Blizzard_Timer; - uint32 ArcaneBurst_Timer; - uint32 Scorpions_Timer; - int Rand; - int RandX; - int RandY; - - Creature* Summoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - TwinReset(); - ShadowBolt_Timer = 0; - Blizzard_Timer = 15000 + rand()%5000; - ArcaneBurst_Timer = 1000; - Scorpions_Timer = 7000 + rand()%7000; - - //Added. Can be removed if its included in DB. - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0); + return new boss_veklorAI (pCreature); } - void CastSpellOnBug(Creature *pTarget) + struct boss_veklorAI : public boss_twinemperorsAI { - pTarget->setFaction(14); - pTarget->AddAura(SPELL_EXPLODEBUG, pTarget); - pTarget->SetHealth(pTarget->GetMaxHealth()); - } + bool IAmVeklor() {return true;} + boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 ShadowBolt_Timer; + uint32 Blizzard_Timer; + uint32 ArcaneBurst_Timer; + uint32 Scorpions_Timer; + int Rand; + int RandX; + int RandY; - // reset arcane burst after teleport - we need to do this because - // when VL jumps to VN's location there will be a warrior who will get only 2s to run away - // which is almost impossible - if (AfterTeleport) - ArcaneBurst_Timer = 5000; - if (!TryActivateAfterTTelep(diff)) - return; + Creature* Summoned; - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + void Reset() { - if (!me->IsWithinDist(me->getVictim(), 45.0f)) - me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0); - else - DoCast(me->getVictim(), SPELL_SHADOWBOLT); - ShadowBolt_Timer = 2000; - } else ShadowBolt_Timer -= diff; + TwinReset(); + ShadowBolt_Timer = 0; + Blizzard_Timer = 15000 + rand()%5000; + ArcaneBurst_Timer = 1000; + Scorpions_Timer = 7000 + rand()%7000; - //Blizzard_Timer - if (Blizzard_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true); - if (pTarget) - DoCast(pTarget, SPELL_BLIZZARD); - Blizzard_Timer = 15000+rand()%15000; - } else Blizzard_Timer -= diff; + //Added. Can be removed if its included in DB. + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0); + } - if (ArcaneBurst_Timer <= diff) + void CastSpellOnBug(Creature *pTarget) { - Unit *mvic; - if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL) - { - DoCast(mvic, SPELL_ARCANEBURST); + pTarget->setFaction(14); + pTarget->AddAura(SPELL_EXPLODEBUG, pTarget); + pTarget->SetHealth(pTarget->GetMaxHealth()); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + // reset arcane burst after teleport - we need to do this because + // when VL jumps to VN's location there will be a warrior who will get only 2s to run away + // which is almost impossible + if (AfterTeleport) ArcaneBurst_Timer = 5000; - } - } else ArcaneBurst_Timer -= diff; + if (!TryActivateAfterTTelep(diff)) + return; - HandleBugs(diff); - - //Heal brother when 60yrds close - TryHealBrother(diff); - - //Teleporting to brother - if (Teleport_Timer <= diff) - { - TeleportToMyBrother(); - } else Teleport_Timer -= diff; - - CheckEnrage(diff); - - //VL doesn't melee - //DoMeleeAttackIfReady(); - } - - void AttackStart(Unit* who) - { - if (!who) - return; - - if (who->isTargetableForAttack()) - { - // VL doesn't melee - if (me->Attack(who, false)) + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) { - me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0); - me->AddThreat(who, 0.0f); + if (!me->IsWithinDist(me->getVictim(), 45.0f)) + me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0); + else + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 2000; + } else ShadowBolt_Timer -= diff; + + //Blizzard_Timer + if (Blizzard_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true); + if (pTarget) + DoCast(pTarget, SPELL_BLIZZARD); + Blizzard_Timer = 15000+rand()%15000; + } else Blizzard_Timer -= diff; + + if (ArcaneBurst_Timer <= diff) + { + Unit *mvic; + if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL) + { + DoCast(mvic, SPELL_ARCANEBURST); + ArcaneBurst_Timer = 5000; + } + } else ArcaneBurst_Timer -= diff; + + HandleBugs(diff); + + //Heal brother when 60yrds close + TryHealBrother(diff); + + //Teleporting to brother + if (Teleport_Timer <= diff) + { + TeleportToMyBrother(); + } else Teleport_Timer -= diff; + + CheckEnrage(diff); + + //VL doesn't melee + //DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (who->isTargetableForAttack()) + { + // VL doesn't melee + if (me->Attack(who, false)) + { + me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0); + me->AddThreat(who, 0.0f); + } } } - } + }; + }; -CreatureAI* GetAI_boss_veknilash(Creature* pCreature) -{ - return new boss_veknilashAI (pCreature); -} -CreatureAI* GetAI_boss_veklor(Creature* pCreature) -{ - return new boss_veklorAI (pCreature); -} void AddSC_boss_twinemperors() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_veknilash"; - newscript->GetAI = &GetAI_boss_veknilash; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_veklor"; - newscript->GetAI = &GetAI_boss_veklor; - newscript->RegisterSelf(); + new boss_veknilash(); + new boss_veklor(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 9f105e27a1d..772aadd458a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -25,144 +25,146 @@ EndScriptData */ #include "ScriptPCH.h" #include "temple_of_ahnqiraj.h" - -struct instance_temple_of_ahnqiraj : public ScriptedInstance + class instance_temple_of_ahnqiraj : public InstanceMapScript { - instance_temple_of_ahnqiraj(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj") { } - //If Vem is dead... - bool IsBossDied[3]; - - //Storing Skeram, Vem and Kri. - uint64 SkeramGUID; - uint64 VemGUID; - uint64 KriGUID; - uint64 VeklorGUID; - uint64 VeknilashGUID; - - uint32 BugTrioDeathCount; - - uint32 CthunPhase; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; - - SkeramGUID = 0; - VemGUID = 0; - KriGUID = 0; - VeklorGUID = 0; - VeknilashGUID = 0; - - BugTrioDeathCount = 0; - - CthunPhase = 0; + return new instance_temple_of_ahnqiraj_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_temple_of_ahnqiraj_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + //If Vem is dead... + bool IsBossDied[3]; + + //Storing Skeram, Vem and Kri. + uint64 SkeramGUID; + uint64 VemGUID; + uint64 KriGUID; + uint64 VeklorGUID; + uint64 VeknilashGUID; + + uint32 BugTrioDeathCount; + + uint32 CthunPhase; + + void Initialize() { - case 15263: SkeramGUID = pCreature->GetGUID(); break; - case 15544: VemGUID = pCreature->GetGUID(); break; - case 15511: KriGUID = pCreature->GetGUID(); break; - case 15276: VeklorGUID = pCreature->GetGUID(); break; - case 15275: VeknilashGUID = pCreature->GetGUID(); break; + IsBossDied[0] = false; + IsBossDied[1] = false; + IsBossDied[2] = false; + + SkeramGUID = 0; + VemGUID = 0; + KriGUID = 0; + VeklorGUID = 0; + VeknilashGUID = 0; + + BugTrioDeathCount = 0; + + CthunPhase = 0; } - } - bool IsEncounterInProgress() const - { - //not active in AQ40 - return false; - } - - uint32 GetData(uint32 type) - { - switch(type) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_VEMISDEAD: - if (IsBossDied[0]) - return 1; - break; - - case DATA_VEKLORISDEAD: - if (IsBossDied[1]) - return 1; - break; - - case DATA_VEKNILASHISDEAD: - if (IsBossDied[2]) - return 1; - break; - - case DATA_BUG_TRIO_DEATH: - return BugTrioDeathCount; - - case DATA_CTHUN_PHASE: - return CthunPhase; + switch (pCreature->GetEntry()) + { + case 15263: SkeramGUID = pCreature->GetGUID(); break; + case 15544: VemGUID = pCreature->GetGUID(); break; + case 15511: KriGUID = pCreature->GetGUID(); break; + case 15276: VeklorGUID = pCreature->GetGUID(); break; + case 15275: VeknilashGUID = pCreature->GetGUID(); break; + } } - return 0; - } - uint64 GetData64 (uint32 identifier) - { - switch(identifier) + bool IsEncounterInProgress() const { - case DATA_SKERAM: - return SkeramGUID; - case DATA_VEM: - return VemGUID; - case DATA_KRI: - return KriGUID; - case DATA_VEKLOR: - return VeklorGUID; - case DATA_VEKNILASH: - return VeknilashGUID; + //not active in AQ40 + return false; } - return 0; - } // end GetData64 - void SetData(uint32 type, uint32 data) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_VEM_DEATH: - IsBossDied[0] = true; - break; + switch(type) + { + case DATA_VEMISDEAD: + if (IsBossDied[0]) + return 1; + break; - case DATA_BUG_TRIO_DEATH: - ++BugTrioDeathCount; - break; + case DATA_VEKLORISDEAD: + if (IsBossDied[1]) + return 1; + break; - case DATA_VEKLOR_DEATH: - IsBossDied[1] = true; - break; + case DATA_VEKNILASHISDEAD: + if (IsBossDied[2]) + return 1; + break; - case DATA_VEKNILASH_DEATH: - IsBossDied[2] = true; - break; + case DATA_BUG_TRIO_DEATH: + return BugTrioDeathCount; - case DATA_CTHUN_PHASE: - CthunPhase = data; - break; + case DATA_CTHUN_PHASE: + return CthunPhase; + } + return 0; } - } + + uint64 GetData64 (uint32 identifier) + { + switch(identifier) + { + case DATA_SKERAM: + return SkeramGUID; + case DATA_VEM: + return VemGUID; + case DATA_KRI: + return KriGUID; + case DATA_VEKLOR: + return VeklorGUID; + case DATA_VEKNILASH: + return VeknilashGUID; + } + return 0; + } // end GetData64 + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_VEM_DEATH: + IsBossDied[0] = true; + break; + + case DATA_BUG_TRIO_DEATH: + ++BugTrioDeathCount; + break; + + case DATA_VEKLOR_DEATH: + IsBossDied[1] = true; + break; + + case DATA_VEKNILASH_DEATH: + IsBossDied[2] = true; + break; + + case DATA_CTHUN_PHASE: + CthunPhase = data; + break; + } + } + }; + }; -InstanceData* GetInstanceData_instance_temple_of_ahnqiraj(Map* pMap) -{ - return new instance_temple_of_ahnqiraj(pMap); -} void AddSC_instance_temple_of_ahnqiraj() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_temple_of_ahnqiraj"; - newscript->GetInstanceData = &GetInstanceData_instance_temple_of_ahnqiraj; - newscript->RegisterSelf(); + new instance_temple_of_ahnqiraj(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index e0ce8834b6d..ea24f7e7e5c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -54,245 +54,247 @@ EndScriptData */ #define SPELL_STORM_BUFF 2148 #define SPELL_STORM 26546 - -struct aqsentinelAI : public ScriptedAI + class mob_anubisath_sentinel : public CreatureScript { - uint32 ability; - int abselected; +public: + mob_anubisath_sentinel() : CreatureScript("mob_anubisath_sentinel") { } - void selectAbility(int asel) + CreatureAI* GetAI(Creature* pCreature) const { - switch (asel) + return new aqsentinelAI (pCreature); + } + + struct aqsentinelAI : public ScriptedAI + { + uint32 ability; + int abselected; + + void selectAbility(int asel) { - case 0: ability = SPELL_MENDING_BUFF;break; - case 1: ability = SPELL_KNOCK_BUFF;break; - case 2: ability = SPELL_MANAB_BUFF;break; - case 3: ability = SPELL_REFLECTAF_BUFF;break; - case 4: ability = SPELL_REFLECTSFr_BUFF;break; - case 5: ability = SPELL_THORNS_BUFF;break; - case 6: ability = SPELL_THUNDER_BUFF;break; - case 7: ability = SPELL_MSTRIKE_BUFF;break; - case 8: ability = SPELL_STORM_BUFF;break; - } - } - - aqsentinelAI(Creature *c) : ScriptedAI(c) - { - ClearBuddyList(); - abselected = 0; // just initialization of variable - } - - uint64 NearbyGUID[3]; - - void ClearBuddyList() - { - NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0; - } - - void AddBuddyToList(uint64 CreatureGUID) - { - if (CreatureGUID == me->GetGUID()) - return; - - for (int i=0; i<3; ++i) - { - if (NearbyGUID[i] == CreatureGUID) - return; - if (!NearbyGUID[i]) + switch (asel) { - NearbyGUID[i] = CreatureGUID; - return; + case 0: ability = SPELL_MENDING_BUFF;break; + case 1: ability = SPELL_KNOCK_BUFF;break; + case 2: ability = SPELL_MANAB_BUFF;break; + case 3: ability = SPELL_REFLECTAF_BUFF;break; + case 4: ability = SPELL_REFLECTSFr_BUFF;break; + case 5: ability = SPELL_THORNS_BUFF;break; + case 6: ability = SPELL_THUNDER_BUFF;break; + case 7: ability = SPELL_MSTRIKE_BUFF;break; + case 8: ability = SPELL_STORM_BUFF;break; } } - } - void GiveBuddyMyList(Creature *c) - { - aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); - for (int i=0; i<3; ++i) - if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) - cai->AddBuddyToList(NearbyGUID[i]); - cai->AddBuddyToList(me->GetGUID()); - } - - void SendMyListToBuddies() - { - for (int i=0; i<3; ++i) - if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) - GiveBuddyMyList(pNearby); - } - - void CallBuddiesToAttack(Unit *who) - { - for (int i=0; i<3; ++i) + aqsentinelAI(Creature *c) : ScriptedAI(c) { - Creature *c = Unit::GetCreature(*me, NearbyGUID[i]); - if (c) + ClearBuddyList(); + abselected = 0; // just initialization of variable + } + + uint64 NearbyGUID[3]; + + void ClearBuddyList() + { + NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0; + } + + void AddBuddyToList(uint64 CreatureGUID) + { + if (CreatureGUID == me->GetGUID()) + return; + + for (int i=0; i<3; ++i) { - if (!c->isInCombat()) + if (NearbyGUID[i] == CreatureGUID) + return; + if (!NearbyGUID[i]) { - c->SetNoCallAssistance(true); - if (c->AI()) - c->AI()->AttackStart(who); + NearbyGUID[i] = CreatureGUID; + return; } } } - } - void AddSentinelsNear(Unit * /*nears*/) - { - std::list assistList; - me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f); - - if (assistList.empty()) - return; - - for (std::list::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) - AddBuddyToList((*iter)->GetGUID()); - } - - int pickAbilityRandom(bool *chosenAbilities) - { - for (int t = 0; t < 2; ++t) + void GiveBuddyMyList(Creature *c) { - for (int i = !t ? (rand()%9) : 0; i < 9; ++i) - { - if (!chosenAbilities[i]) - { - chosenAbilities[i] = true; - return i; - } - } + aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); + for (int i=0; i<3; ++i) + if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) + cai->AddBuddyToList(NearbyGUID[i]); + cai->AddBuddyToList(me->GetGUID()); } - return 0; // should never happen - } - void GetOtherSentinels(Unit *who) - { - bool *chosenAbilities = new bool[9]; - memset(chosenAbilities, 0, 9*sizeof(bool)); - selectAbility(pickAbilityRandom(chosenAbilities)); - - ClearBuddyList(); - AddSentinelsNear(me); - int bli; - for (bli = 0; bli < 3; ++bli) + void SendMyListToBuddies() { - if (!NearbyGUID[bli]) - break; - - Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); - if (!pNearby) - break; - - AddSentinelsNear(pNearby); - CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; - CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); + for (int i=0; i<3; ++i) + if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + GiveBuddyMyList(pNearby); } - /*if (bli < 3) - DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ - SendMyListToBuddies(); - CallBuddiesToAttack(who); - delete[] chosenAbilities; - } - - bool gatherOthersWhenAggro; - - void Reset() - { - if (!me->isDead()) + void CallBuddiesToAttack(Unit *who) { for (int i=0; i<3; ++i) { - if (!NearbyGUID[i]) - continue; - if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + Creature *c = Unit::GetCreature(*me, NearbyGUID[i]); + if (c) { - if (pNearby->isDead()) - pNearby->Respawn(); + if (!c->isInCombat()) + { + c->SetNoCallAssistance(true); + if (c->AI()) + c->AI()->AttackStart(who); + } } } } - ClearBuddyList(); - gatherOthersWhenAggro = true; - } - void GainSentinelAbility(uint32 id) - { - me->AddAura(id, me); - } - - void EnterCombat(Unit * who) - { - if (gatherOthersWhenAggro) - GetOtherSentinels(who); - - GainSentinelAbility(ability); - DoZoneInCombat(); - } - - void JustDied(Unit* /*who*/) - { - for (int ni=0; ni<3; ++ni) + void AddSentinelsNear(Unit * /*nears*/) { - Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]); - if (!sent) - continue; - if (sent->isDead()) - continue; - int h = sent->GetHealth() + (sent->GetMaxHealth() / 2); - if (h > sent->GetMaxHealth()) - h = sent->GetMaxHealth(); - sent->SetHealth(h); - CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); - } - } + std::list assistList; + me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f); - Unit *GetHatedManaUser() const - { - std::list::const_iterator i; - for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + if (assistList.empty()) + return; + + for (std::list::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + AddBuddyToList((*iter)->GetGUID()); + } + + int pickAbilityRandom(bool *chosenAbilities) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit->getPowerType() == POWER_MANA) - return pUnit; + for (int t = 0; t < 2; ++t) + { + for (int i = !t ? (rand()%9) : 0; i < 9; ++i) + { + if (!chosenAbilities[i]) + { + chosenAbilities[i] = true; + return i; + } + } + } + return 0; // should never happen } - return NULL; - } - Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const - { - switch (spellId) + void GetOtherSentinels(Unit *who) { - case SPELL_KNOCK_BUFF: - case SPELL_THUNDER_BUFF: - case SPELL_MSTRIKE_BUFF: - case SPELL_STORM_BUFF: - return me->getVictim(); + bool *chosenAbilities = new bool[9]; + memset(chosenAbilities, 0, 9*sizeof(bool)); + selectAbility(pickAbilityRandom(chosenAbilities)); - case SPELL_MANAB_BUFF: - return GetHatedManaUser(); + ClearBuddyList(); + AddSentinelsNear(me); + int bli; + for (bli = 0; bli < 3; ++bli) + { + if (!NearbyGUID[bli]) + break; - case SPELL_MENDING_BUFF: - case SPELL_REFLECTAF_BUFF: - case SPELL_REFLECTSFr_BUFF: - case SPELL_THORNS_BUFF: - default: - return me; + Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); + if (!pNearby) + break; + + AddSentinelsNear(pNearby); + CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; + CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); + } + /*if (bli < 3) + DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ + SendMyListToBuddies(); + CallBuddiesToAttack(who); + + delete[] chosenAbilities; } - } + + bool gatherOthersWhenAggro; + + void Reset() + { + if (!me->isDead()) + { + for (int i=0; i<3; ++i) + { + if (!NearbyGUID[i]) + continue; + if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + { + if (pNearby->isDead()) + pNearby->Respawn(); + } + } + } + ClearBuddyList(); + gatherOthersWhenAggro = true; + } + + void GainSentinelAbility(uint32 id) + { + me->AddAura(id, me); + } + + void EnterCombat(Unit * who) + { + if (gatherOthersWhenAggro) + GetOtherSentinels(who); + + GainSentinelAbility(ability); + DoZoneInCombat(); + } + + void JustDied(Unit* /*who*/) + { + for (int ni=0; ni<3; ++ni) + { + Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]); + if (!sent) + continue; + if (sent->isDead()) + continue; + int h = sent->GetHealth() + (sent->GetMaxHealth() / 2); + if (h > sent->GetMaxHealth()) + h = sent->GetMaxHealth(); + sent->SetHealth(h); + CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); + } + } + + Unit *GetHatedManaUser() const + { + std::list::const_iterator i; + for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit->getPowerType() == POWER_MANA) + return pUnit; + } + return NULL; + } + + Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const + { + switch (spellId) + { + case SPELL_KNOCK_BUFF: + case SPELL_THUNDER_BUFF: + case SPELL_MSTRIKE_BUFF: + case SPELL_STORM_BUFF: + return me->getVictim(); + + case SPELL_MANAB_BUFF: + return GetHatedManaUser(); + + case SPELL_MENDING_BUFF: + case SPELL_REFLECTAF_BUFF: + case SPELL_REFLECTSFr_BUFF: + case SPELL_THORNS_BUFF: + default: + return me; + } + } + }; }; -CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature) -{ - return new aqsentinelAI (pCreature); -} void AddSC_mob_anubisath_sentinel() { - Script *newscript; - newscript = new Script; - newscript->Name = "mob_anubisath_sentinel"; - newscript->GetAI = &GetAI_mob_anubisath_sentinelAI; - newscript->RegisterSelf(); + new mob_anubisath_sentinel(); } diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index 6edcf9b72cf..6f6a5cb64c8 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -27,118 +27,121 @@ EndScriptData */ #include "wailing_caverns.h" #define MAX_ENCOUNTER 9 - -struct instance_wailing_caverns : public ScriptedInstance + class instance_wailing_caverns : public InstanceMapScript { - instance_wailing_caverns(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - bool yelled; - uint64 NaralexGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - yelled = false; - NaralexGUID = 0; + return new instance_wailing_caverns_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_wailing_caverns_InstanceMapScript : public InstanceScript { - if (pCreature->GetEntry() == DATA_NARALEX) - NaralexGUID = pCreature->GetGUID(); - } + instance_wailing_caverns_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - void SetData(uint32 type, uint32 data) - { - switch (type) + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + bool yelled; + uint64 NaralexGUID; + + void Initialize() { - case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; - case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; - case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; - case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; - case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; - case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; - case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; - case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; - case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; - case TYPE_NARALEX_YELLED: yelled = true; break; - } - if (data == DONE)SaveToDB(); - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - uint32 GetData(uint32 type) - { - switch (type) - { - case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; - case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; - case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; - case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; - case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; - case TYPE_NARALEX_PART1: return m_auiEncounter[5]; - case TYPE_NARALEX_PART2: return m_auiEncounter[6]; - case TYPE_NARALEX_PART3: return m_auiEncounter[7]; - case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; - case TYPE_NARALEX_YELLED: return yelled; - } - return 0; - } - - uint64 GetData64(uint32 data) - { - if (data == DATA_NARALEX)return NaralexGUID; - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " - << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + yelled = false; + NaralexGUID = 0; } - OUT_LOAD_INST_DATA(in); + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + if (pCreature->GetEntry() == DATA_NARALEX) + NaralexGUID = pCreature->GetGUID(); + } - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; + case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; + case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; + case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; + case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; + case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; + case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; + case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; + case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; + case TYPE_NARALEX_YELLED: yelled = true; break; + } + if (data == DONE)SaveToDB(); + } - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] != DONE) - m_auiEncounter[i] = NOT_STARTED; + uint32 GetData(uint32 type) + { + switch (type) + { + case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; + case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; + case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; + case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; + case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; + case TYPE_NARALEX_PART1: return m_auiEncounter[5]; + case TYPE_NARALEX_PART2: return m_auiEncounter[6]; + case TYPE_NARALEX_PART3: return m_auiEncounter[7]; + case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; + case TYPE_NARALEX_YELLED: return yelled; + } + return 0; + } - OUT_LOAD_INST_DATA_COMPLETE; - } + uint64 GetData64(uint32 data) + { + if (data == DATA_NARALEX)return NaralexGUID; + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " + << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] != DONE) + m_auiEncounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + }; }; -InstanceData* GetInstanceData_instance_wailing_caverns(Map* pMap) -{ - return new instance_wailing_caverns(pMap); -} void AddSC_instance_wailing_caverns() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_wailing_caverns"; - newscript->GetInstanceData = &GetInstanceData_instance_wailing_caverns; - newscript->RegisterSelf(); + new instance_wailing_caverns(); } diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 18efcbfdd04..e7909840b75 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -74,325 +74,327 @@ enum eEnums #define GOSSIP_ID_START_2 699 //The fanglords are dead! #define GOSSIP_ITEM_NARALEX "Let the event begin!" #define ACHIEVEMENT_WAILING_CAVERNS 630 - -struct npc_disciple_of_naralexAI : public npc_escortAI + class npc_disciple_of_naralex : public CreatureScript { - npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c) +public: + npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - eventTimer = 0; - currentEvent = 0; - eventProgress = 0; - me->setActive(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new npc_disciple_of_naralexAI(pCreature); } - uint32 eventTimer; - uint32 currentEvent; - uint32 eventProgress; - ScriptedInstance *pInstance; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!pInstance) - return; - - switch (i) + InstanceScript *pInstance = pCreature->GetInstanceScript(); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - case 4: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART1; - pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); - break; - case 5: - DoScriptText(SAY_MUST_CONTINUE, me); - pInstance->SetData(TYPE_NARALEX_PART1, DONE); - break; - case 11: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART2; - pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); - break; - case 19: - DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me); - break; - case 24: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART3; - pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) + pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); + + DoScriptText(SAY_MAKE_PREPARATIONS, pCreature); + + pCreature->setFaction(250); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); } + return true; } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { + InstanceScript *pInstance = pCreature->GetInstanceScript(); - } - - void EnterCombat(Unit* who) - { - DoScriptText(SAY_ATTACKED, me, who); - } - - void JustDied(Unit * /*slayer*/) - { if (pInstance) { - pInstance->SetData(TYPE_NARALEX_EVENT, FAIL); - pInstance->SetData(TYPE_NARALEX_PART1, FAIL); - pInstance->SetData(TYPE_NARALEX_PART2, FAIL); - pInstance->SetData(TYPE_NARALEX_PART3, FAIL); - } - } - - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(me); - } - - void UpdateAI(const uint32 diff) - { - if (currentEvent != TYPE_NARALEX_PART3) - npc_escortAI::UpdateAI(diff); - - if (!pInstance) - return; - if (eventTimer <= diff) - { - eventTimer = 0; - if (pInstance->GetData(currentEvent) == IN_PROGRESS) + pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true); + if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) && + (pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE)) { - switch (currentEvent) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID()); + + if (!pInstance->GetData(TYPE_NARALEX_YELLED)) { - case TYPE_NARALEX_PART1: - if (eventProgress == 1) - { - ++eventProgress; - DoScriptText(SAY_TEMPLE_OF_PROMISE, me); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } - break; - case TYPE_NARALEX_PART2: - if (eventProgress == 1) - { - ++eventProgress; - DoScriptText(SAY_BANISH_THE_SPIRITS, me); - DoCast(me, SPELL_SERPENTINE_CLEANSING); - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false); - eventTimer = 30000; - me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } - else - if (eventProgress == 2) - { - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(true); - DoScriptText(SAY_CAVERNS_PURIFIED, me); - pInstance->SetData(TYPE_NARALEX_PART2, DONE); - if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) - me->RemoveAura(SPELL_SERPENTINE_CLEANSING); - } - break; - case TYPE_NARALEX_PART3: - if (eventProgress == 1) - { - ++eventProgress; - eventTimer = 4000; - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_EMERALD_DREAM, me); - } - else - if (eventProgress == 2) - { - ++eventProgress; - eventTimer = 15000; - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false); - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); - DoScriptText(EMOTE_AWAKENING_RITUAL, me); - } - else - if (eventProgress == 3) - { - ++eventProgress; - eventTimer = 15000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_TROUBLED_SLEEP, naralex); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - } - else - if (eventProgress == 4) - { - ++eventProgress; - eventTimer = 30000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - } - else - if (eventProgress == 5) - { - ++eventProgress; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_HORRENDOUS_VISION, naralex); - me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - DoScriptText(SAY_MUTANUS_THE_DEVOURER, me); - pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); - } - else - if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) - { - ++eventProgress; - eventTimer = 3000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - { - AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); - if (AchievWC) - { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) - { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievWC); - } - } - if (me->HasAura(SPELL_NARALEXS_AWAKENING)) - me->RemoveAura(SPELL_NARALEXS_AWAKENING); - naralex->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_I_AM_AWAKE, naralex); - } - DoScriptText(SAY_NARALEX_AWAKES, me); - } - else - if (eventProgress == 7) - { - ++eventProgress; - eventTimer = 6000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(SAY_THANK_YOU, naralex); - } - else - if (eventProgress == 8) - { - ++eventProgress; - eventTimer = 8000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - { - DoScriptText(SAY_FAREWELL, naralex); - naralex->AddAura(SPELL_FLIGHT_FORM, naralex); - } - SetRun(); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->AddAura(SPELL_FLIGHT_FORM, me); - } - else - if (eventProgress == 9) - { - ++eventProgress; - eventTimer = 1500; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); - } - else - if (eventProgress == 10) - { - ++eventProgress; - eventTimer = 2500; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - { - naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870); - naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801); - } - me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870); - me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135); - } - else - if (eventProgress == 11) - { - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - naralex->SetVisibility(VISIBILITY_OFF); - me->SetVisibility(VISIBILITY_OFF); - pInstance->SetData(TYPE_NARALEX_PART3, DONE); - } - break; + DoScriptText(SAY_AT_LAST, pCreature); + pInstance->SetData(TYPE_NARALEX_YELLED, 1); } } - } else eventTimer -= diff; - } -}; - -CreatureAI* GetAI_npc_disciple_of_naralex(Creature* pCreature) -{ - return new npc_disciple_of_naralexAI(pCreature); -} - -bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance *pInstance = pCreature->GetInstanceData(); - - if (pInstance) - { - pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true); - if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) && - (pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID()); - - if (!pInstance->GetData(TYPE_NARALEX_YELLED)) + else { - DoScriptText(SAY_AT_LAST, pCreature); - pInstance->SetData(TYPE_NARALEX_YELLED, 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID()); } } - else - { - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID()); - } + return true; } - return true; -} -bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance *pInstance = pCreature->GetInstanceData(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + struct npc_disciple_of_naralexAI : public npc_escortAI { - pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); + npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + eventTimer = 0; + currentEvent = 0; + eventProgress = 0; + me->setActive(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + uint32 eventTimer; + uint32 currentEvent; + uint32 eventProgress; + InstanceScript *pInstance; + + void WaypointReached(uint32 i) + { + if (!pInstance) + return; + + switch (i) + { + case 4: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART1; + pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); + break; + case 5: + DoScriptText(SAY_MUST_CONTINUE, me); + pInstance->SetData(TYPE_NARALEX_PART1, DONE); + break; + case 11: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART2; + pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); + break; + case 19: + DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me); + break; + case 24: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART3; + pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); + break; + } + } + + void Reset() + { + + } + + void EnterCombat(Unit* who) + { + DoScriptText(SAY_ATTACKED, me, who); + } + + void JustDied(Unit * /*slayer*/) + { + if (pInstance) + { + pInstance->SetData(TYPE_NARALEX_EVENT, FAIL); + pInstance->SetData(TYPE_NARALEX_PART1, FAIL); + pInstance->SetData(TYPE_NARALEX_PART2, FAIL); + pInstance->SetData(TYPE_NARALEX_PART3, FAIL); + } + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void UpdateAI(const uint32 diff) + { + if (currentEvent != TYPE_NARALEX_PART3) + npc_escortAI::UpdateAI(diff); + + if (!pInstance) + return; + if (eventTimer <= diff) + { + eventTimer = 0; + if (pInstance->GetData(currentEvent) == IN_PROGRESS) + { + switch (currentEvent) + { + case TYPE_NARALEX_PART1: + if (eventProgress == 1) + { + ++eventProgress; + DoScriptText(SAY_TEMPLE_OF_PROMISE, me); + me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } + break; + case TYPE_NARALEX_PART2: + if (eventProgress == 1) + { + ++eventProgress; + DoScriptText(SAY_BANISH_THE_SPIRITS, me); + DoCast(me, SPELL_SERPENTINE_CLEANSING); + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); + eventTimer = 30000; + me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } + else + if (eventProgress == 2) + { + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true); + DoScriptText(SAY_CAVERNS_PURIFIED, me); + pInstance->SetData(TYPE_NARALEX_PART2, DONE); + if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) + me->RemoveAura(SPELL_SERPENTINE_CLEANSING); + } + break; + case TYPE_NARALEX_PART3: + if (eventProgress == 1) + { + ++eventProgress; + eventTimer = 4000; + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_EMERALD_DREAM, me); + } + else + if (eventProgress == 2) + { + ++eventProgress; + eventTimer = 15000; + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); + DoScriptText(EMOTE_AWAKENING_RITUAL, me); + } + else + if (eventProgress == 3) + { + ++eventProgress; + eventTimer = 15000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_TROUBLED_SLEEP, naralex); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + } + else + if (eventProgress == 4) + { + ++eventProgress; + eventTimer = 30000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + } + else + if (eventProgress == 5) + { + ++eventProgress; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_HORRENDOUS_VISION, naralex); + me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + DoScriptText(SAY_MUTANUS_THE_DEVOURER, me); + pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); + } + else + if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) + { + ++eventProgress; + eventTimer = 3000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + { + AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); + if (AchievWC) + { + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievWC); + } + } + if (me->HasAura(SPELL_NARALEXS_AWAKENING)) + me->RemoveAura(SPELL_NARALEXS_AWAKENING); + naralex->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_I_AM_AWAKE, naralex); + } + DoScriptText(SAY_NARALEX_AWAKES, me); + } + else + if (eventProgress == 7) + { + ++eventProgress; + eventTimer = 6000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(SAY_THANK_YOU, naralex); + } + else + if (eventProgress == 8) + { + ++eventProgress; + eventTimer = 8000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + { + DoScriptText(SAY_FAREWELL, naralex); + naralex->AddAura(SPELL_FLIGHT_FORM, naralex); + } + SetRun(); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->AddAura(SPELL_FLIGHT_FORM, me); + } + else + if (eventProgress == 9) + { + ++eventProgress; + eventTimer = 1500; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); + } + else + if (eventProgress == 10) + { + ++eventProgress; + eventTimer = 2500; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + { + naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870); + naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801); + } + me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870); + me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135); + } + else + if (eventProgress == 11) + { + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + naralex->SetVisibility(VISIBILITY_OFF); + me->SetVisibility(VISIBILITY_OFF); + pInstance->SetData(TYPE_NARALEX_PART3, DONE); + } + break; + } + } + } else eventTimer -= diff; + } + }; + +}; - DoScriptText(SAY_MAKE_PREPARATIONS, pCreature); - pCreature->setFaction(250); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); - } - return true; -} void AddSC_wailing_caverns() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_disciple_of_naralex"; - newscript->pGossipHello = &GossipHello_npc_disciple_of_naralex; - newscript->pGossipSelect = &GossipSelect_npc_disciple_of_naralex; - newscript->GetAI = &GetAI_npc_disciple_of_naralex; - newscript->RegisterSelf(); + new npc_disciple_of_naralex(); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 8849d9ca83f..cba513bf520 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -86,276 +86,279 @@ float Spawnsway[2][3] = {1884.86,1228.62,9}, {1887.53,1263,41} }; - -struct instance_zulfarrak : public ScriptedInstance + class instance_zulfarrak : public InstanceMapScript { - instance_zulfarrak(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_zulfarrak() : InstanceMapScript("instance_zulfarrak") { } - 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() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - GahzRillaEncounter = NOT_STARTED; + return new instance_zulfarrak_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_zulfarrak_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_zulfarrak_InstanceMapScript(Map* pMap) : InstanceScript(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() { - 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; + GahzRillaEncounter = NOT_STARTED; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_END_DOOR: - EndDoorGUID = pGo->GetGUID(); - break; + 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; + } } - } - uint32 GetData(uint32 type) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) { - case EVENT_PYRAMID: - return PyramidPhase; + switch(pGo->GetEntry()) + { + case GO_END_DOOR: + EndDoorGUID = pGo->GetGUID(); + break; + } } - return 0; - } - uint64 GetData64(uint32 data) - { - switch(data) + uint32 GetData(uint32 type) { - 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; + switch(type) + { + case EVENT_PYRAMID: + return PyramidPhase; + } + return 0; } - return 0; - } - void SetData(uint32 type, uint32 data) - { - switch(type) + uint64 GetData64(uint32 data) { - case EVENT_PYRAMID: - PyramidPhase=data; - break; - }; - } + 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; + } - virtual void Update(uint32 diff) - { - switch (PyramidPhase) + void SetData(uint32 type, uint32 data) { - 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 addsAtBase,movedadds; + std::list addsAtBase,movedadds; - void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o) - { - if (Creature* npc = instance->GetCreature(GetData64(entry))) - { - if (npc->isAlive()) + void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o) + { + if (Creature* npc = instance->GetCreature(GetData64(entry))) { - npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - npc->GetMotionMaster()->MovePoint(1,x,y,z); - npc->SetHomePosition(x,y,z,o); - } + if (npc->isAlive()) + { + npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + 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) + void SpawnPyramidWave(uint32 wave){ + for (int i = 0; i < pyramidSpawnTotal; i++) { - 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()); + 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::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) - { - if (Creature* add = instance->GetCreature((*itr))) + bool IsWaveAllDead(){ + for(std::list::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) { - if (add->isAlive()) - return false; + if (Creature* add = instance->GetCreature((*itr))) + { + if (add->isAlive()) + return false; + } } - } - for(std::list::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) - { - if (Creature* add = instance->GetCreature(((*itr)))) + for(std::list::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) { - if (add->isAlive()) - return false; + if (Creature* add = instance->GetCreature(((*itr)))) + { + if (add->isAlive()) + return false; + } } + return true; } - return true; - } - void SendAddsUpStairs(uint32 count) - { - //pop a add from list, send him up the stairs... - for (uint32 addCount = 0; addCountGetCreature(*addsAtBase.begin())) + //pop a add from list, send him up the stairs... + for (uint32 addCount = 0; addCountGetMotionMaster()->MovePath(PATH_ADDS,false); - movedadds.push_back(add->GetGUID()); + if (Creature* add = instance->GetCreature(*addsAtBase.begin())) + { + add->GetMotionMaster()->MovePath(PATH_ADDS,false); + movedadds.push_back(add->GetGUID()); + } + addsAtBase.erase(addsAtBase.begin()); } - addsAtBase.erase(addsAtBase.begin()); } - } + }; + }; -InstanceData* GetInstanceData_instance_zulfarrak(Map* pMap) -{ - return new instance_zulfarrak(pMap); -} void AddSC_instance_zulfarrak() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_zulfarrak"; - newscript->GetInstanceData = &GetInstanceData_instance_zulfarrak; - newscript->RegisterSelf(); + new instance_zulfarrak(); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index bed8bafe096..71e2a6906b7 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -55,143 +55,152 @@ enum blySpells }; #define GOSSIP_BLY "[PH] In that case, I will take my reward!" - -struct npc_sergeant_blyAI : public ScriptedAI + class npc_sergeant_bly : public CreatureScript { - npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_sergeant_bly() : CreatureScript("npc_sergeant_bly") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - pInstance = pCreature->GetInstanceData(); - postGossipStep = 0; - } - - 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() - { - ShieldBash_Timer = 5000; - Revenge_Timer = 8000; - - me->setFaction(FACTION_FRIENDLY); - } - - void UpdateAI(const uint32 diff) - { - if (postGossipStep>0 && postGossipStep<4) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - if (Text_Timerinstance->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(*me, PlayerGUID)) - AttackStart(pTarget); - - if (pInstance) - { - switchFactionIfAlive(pInstance, ENTRY_RAVEN); - switchFactionIfAlive(pInstance, ENTRY_ORO); - switchFactionIfAlive(pInstance, ENTRY_MURTA); - } - } - postGossipStep++; - } - else Text_Timer -= diff; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_sergeant_bly::npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + pCreature->AI()->DoAction(); } - - if (!UpdateVictim()) - return; - - if (ShieldBash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHIELD_BASH); - ShieldBash_Timer = 15000; - } - else - ShieldBash_Timer -= diff; - - if (Revenge_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_REVENGE); - Revenge_Timer = 10000; - } - 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); -} - -bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature) -{ - 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) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - pCreature->AI()->DoAction(); + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + 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; } - return true; -} + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_sergeant_blyAI (pCreature); + } + + struct npc_sergeant_blyAI : public ScriptedAI + { + npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + postGossipStep = 0; + } + + InstanceScript* 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() + { + ShieldBash_Timer = 5000; + Revenge_Timer = 8000; + + me->setFaction(FACTION_FRIENDLY); + } + + void UpdateAI(const uint32 diff) + { + if (postGossipStep>0 && postGossipStep<4) + { + if (Text_Timerinstance->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(*me, 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; + + if (ShieldBash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHIELD_BASH); + ShieldBash_Timer = 15000; + } + else + ShieldBash_Timer -= diff; + + if (Revenge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REVENGE); + Revenge_Timer = 10000; + } + else + Revenge_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + void DoAction(const int32 param) + { + postGossipStep=1; + Text_Timer = 0; + } + + void switchFactionIfAlive(InstanceScript* pInstance,uint32 entry) + { + if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) + if (crew->isAlive()) + crew->setFaction(FACTION_HOSTILE); + } + }; + +}; + + + /*###### +## go_troll_cage +######*/ -void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y, float z) +void initBlyCrewMember(InstanceScript* pInstance, uint32 entry,float x,float y, float z) { if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) { @@ -202,21 +211,27 @@ void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y crew->setFaction(FACTION_FREED); } } - -bool GOHello_go_troll_cage(Player* pPlayer, GameObject* pGo) + class go_troll_cage : public GameObjectScript { - if (ScriptedInstance* pInstance = pGo->GetInstanceData()) +public: + go_troll_cage() : GameObjectScript("go_troll_cage") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - 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); + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + { + 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; } - return false; -} + +}; /*###### ## npc_weegli_blastfuse @@ -237,137 +252,146 @@ enum weegliSays }; #define GOSSIP_WEEGLI "[PH] Please blow up the door." - -struct npc_weegli_blastfuseAI : public ScriptedAI + class npc_weegli_blastfuse : public CreatureScript { - npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_weegli_blastfuse() : CreatureScript("npc_weegli_blastfuse") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - pInstance = pCreature->GetInstanceData(); - destroyingDoor=false; - Bomb_Timer = 10000; - LandMine_Timer = 30000; - } - - uint32 Bomb_Timer; - uint32 LandMine_Timer; - bool destroyingDoor; - ScriptedInstance* pInstance; - - void Reset() - { - /*if (pInstance) - pInstance->SetData(0, NOT_STARTED);*/ - } - - void AttackStart(Unit *victim) - { - AttackStartCaster(victim,10);//keep back & toss bombs/shoot - } - - void JustDied(Unit * /*victim*/) - { - /*if (pInstance) - pInstance->SetData(0, DONE);*/ - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Bomb_Timer < diff) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - 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) -{ - return new npc_weegli_blastfuseAI (pCreature); -} - -bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - 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 + 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; } - return false; -} -bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - //here we make him run to door, set the charge and run away off to nowhere - pCreature->AI()->DoAction(); + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + 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; + } + return false; } - return true; -} + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_weegli_blastfuseAI (pCreature); + } + + struct npc_weegli_blastfuseAI : public ScriptedAI + { + npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + destroyingDoor=false; + Bomb_Timer = 10000; + LandMine_Timer = 30000; + } + + uint32 Bomb_Timer; + uint32 LandMine_Timer; + bool destroyingDoor; + InstanceScript* pInstance; + + void Reset() + { + /*if (pInstance) + pInstance->SetData(0, NOT_STARTED);*/ + } + + void AttackStart(Unit *victim) + { + AttackStartCaster(victim,10);//keep back & toss bombs/shoot + } + + void JustDied(Unit * /*victim*/) + { + /*if (pInstance) + pInstance->SetData(0, DONE);*/ + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + 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; + } + } + }; + +}; + + /*###### ## go_shallow_grave @@ -380,22 +404,28 @@ enum ZOMBIE_CHANCE = 65, DEAD_HERO_CHANCE = 10 }; - -bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo) + class go_shallow_grave : public GameObjectScript { - // randomly summon a zombie or dead hero the first time a grave is used - if (pGo->GetUseCount() == 0) +public: + go_shallow_grave() : GameObjectScript("go_shallow_grave") { } + + bool OnGossipHello(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); + // randomly summon a zombie or dead hero the first time a grave is used + if (pGo->GetUseCount() == 0) + { + 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); + } + pGo->AddUse(); + return false; } - pGo->AddUse(); - return false; -} + +}; /*###### ## at_zumrah @@ -406,49 +436,29 @@ enum zumrahConsts ZUMRAH_ID = 7271, ZUMRAH_HOSTILE_FACTION = 37 }; - -bool AreaTrigger_at_zumrah(Player* pPlayer,const AreaTriggerEntry *at) + class at_zumrah : public AreaTriggerScript { - Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); +public: + at_zumrah() : AreaTriggerScript("at_zumrah") { } - if (!pZumrah) - return false; + bool OnTrigger(Player* pPlayer,const AreaTriggerEntry *at) + { + Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); - pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); - return true; -} + if (!pZumrah) + return false; + + pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); + return true; + } + +}; void AddSC_zulfarrak() { - Script *newscript; - - newscript = new Script; - 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->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->pGOHello = &GOHello_go_shallow_grave; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_zumrah"; - newscript->pAreaTrigger = &AreaTrigger_at_zumrah; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_troll_cage"; - newscript->pGOHello = &GOHello_go_troll_cage; - newscript->RegisterSelf(); - + new npc_sergeant_bly(); + new npc_weegli_blastfuse(); + new go_shallow_grave(); + new at_zumrah(); + new go_troll_cage(); } diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 422f7fc54da..26a354a6bb0 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -37,63 +37,70 @@ EndContentData */ /*###### ## mobs_spitelashes ######*/ - -struct mobs_spitelashesAI : public ScriptedAI + class mobs_spitelashes : public CreatureScript { - mobs_spitelashesAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_spitelashes() : CreatureScript("mobs_spitelashes") { } - uint32 morphtimer; - bool spellhit; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - morphtimer = 0; - spellhit = false; + return new mobs_spitelashesAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + struct mobs_spitelashesAI : public ScriptedAI { - if (!spellhit && - Hitter->GetTypeId() == TYPEID_PLAYER && - CAST_PLR(Hitter)->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE && - (Spellkind->Id == 118 || Spellkind->Id == 12824 || Spellkind->Id == 12825 || Spellkind->Id == 12826)) - { - spellhit=true; - DoCast(me, 29124); //become a sheep - } - } + mobs_spitelashesAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - // we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons - if (spellhit && morphtimer >= 5000) + uint32 morphtimer; + bool spellhit; + + void Reset() { - me->ForcedDespawn(); - return; + morphtimer = 0; + spellhit = false; } - // walk 5 seconds before summoning - if (spellhit && morphtimer<5000) + + void EnterCombat(Unit * /*who*/) { } + + void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { - morphtimer+=diff; - if (morphtimer >= 5000) + if (!spellhit && + Hitter->GetTypeId() == TYPEID_PLAYER && + CAST_PLR(Hitter)->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE && + (Spellkind->Id == 118 || Spellkind->Id == 12824 || Spellkind->Id == 12825 || Spellkind->Id == 12826)) { - DoCast(me, 28406); //summon copies - DoCast(me, 6924); //visual explosion + spellhit=true; + DoCast(me, 29124); //become a sheep } } - if (!UpdateVictim()) - return; - //TODO: add abilities for the different creatures - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + // we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons + if (spellhit && morphtimer >= 5000) + { + me->ForcedDespawn(); + return; + } + // walk 5 seconds before summoning + if (spellhit && morphtimer<5000) + { + morphtimer+=diff; + if (morphtimer >= 5000) + { + DoCast(me, 28406); //summon copies + DoCast(me, 6924); //visual explosion + } + } + if (!UpdateVictim()) + return; + + //TODO: add abilities for the different creatures + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) -{ - return new mobs_spitelashesAI (pCreature); -} /*###### ## npc_loramus_thalipedes @@ -106,59 +113,66 @@ CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) #define GOSSIP_SELECT_LT3 "Indeed" #define GOSSIP_SELECT_LT4 "I will do this with or your help, Loramus" #define GOSSIP_SELECT_LT5 "Yes" - -bool GossipHello_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature) + class npc_loramus_thalipedes : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_loramus_thalipedes() : CreatureScript("npc_loramus_thalipedes") { } - if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2744); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2744); + break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - pPlayer->SEND_GOSSIP_MENU(1813, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(1814, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - pPlayer->SEND_GOSSIP_MENU(1815, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+23: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); - pPlayer->SEND_GOSSIP_MENU(1816, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+24: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); - pPlayer->SEND_GOSSIP_MENU(1817, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+25: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3141); - break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + pPlayer->SEND_GOSSIP_MENU(1813, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+21: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(1814, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + pPlayer->SEND_GOSSIP_MENU(1815, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+23: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); + pPlayer->SEND_GOSSIP_MENU(1816, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+24: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); + pPlayer->SEND_GOSSIP_MENU(1817, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+25: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3141); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*#### # mob_rizzle_sprysprocket @@ -243,274 +257,269 @@ float WPs[58][4] = {1927.09, -3679.56, 33.9118, 3.42}, {1873.57, -3695.32, 33.9118, 3.44} }; - -struct mob_rizzle_sprysprocketAI : public ScriptedAI + class mob_rizzle_sprysprocket : public CreatureScript { - mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {} +public: + mob_rizzle_sprysprocket() : CreatureScript("mob_rizzle_sprysprocket") { } - uint32 spellEscape_Timer; - uint32 Teleport_Timer; - uint32 Check_Timer; - uint32 Grenade_Timer; - uint32 Must_Die_Timer; - uint32 CurrWP; - - uint64 PlayerGUID; - - bool Must_Die; - bool Escape; - bool ContinueWP; - bool Reached; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - spellEscape_Timer = 1300; - Teleport_Timer = 3500; - Check_Timer = 10000; - Grenade_Timer = 30000; - Must_Die_Timer = 3000; - CurrWP = 0; - - PlayerGUID = 0; - - Must_Die = false; - Escape = false; - ContinueWP = false; - Reached = false; + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && pPlayer->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die_Timer = 3000; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die = true; + } + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (Must_Die) - if (Must_Die_Timer <= diff) - { - me->ForcedDespawn(); - return; - } else Must_Die_Timer -= diff; + if (pPlayer->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) + return true; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(10811, pCreature->GetGUID()); + return true; + } - if (!Escape) + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_rizzle_sprysprocketAI (pCreature); + } + + struct mob_rizzle_sprysprocketAI : public ScriptedAI + { + mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {} + + uint32 spellEscape_Timer; + uint32 Teleport_Timer; + uint32 Check_Timer; + uint32 Grenade_Timer; + uint32 Must_Die_Timer; + uint32 CurrWP; + + uint64 PlayerGUID; + + bool Must_Die; + bool Escape; + bool ContinueWP; + bool Reached; + + void Reset() { - if (!PlayerGUID) - return; - - if (spellEscape_Timer <= diff) - { - DoCast(me, SPELL_RIZZLE_ESCAPE, false); - spellEscape_Timer = 10000; - } else spellEscape_Timer -= diff; - - if (Teleport_Timer <= diff) - { - //temp solution - unit can't be teleported by core using spelleffect 5, only players - Map* pMap = me->GetMap(); - if (pMap) - { - pMap->CreatureRelocation(me, 3706.39, -3969.15, 35.9118, 0); - me->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); - } - //begin swimming and summon depth charges - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - SendText(MSG_ESCAPE_NOTICE, pPlayer); - DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE); - me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); - me->SetSpeed(MOVE_RUN, 0.85f, true); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); - Escape = true; - } else Teleport_Timer -= diff; - - return; - } - - if (ContinueWP) - { - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); - ContinueWP = false; - } - - if (Grenade_Timer <= diff) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - { - DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer); - DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true); - } + spellEscape_Timer = 1300; + Teleport_Timer = 3500; + Check_Timer = 10000; Grenade_Timer = 30000; - } else Grenade_Timer -= diff; + Must_Die_Timer = 3000; + CurrWP = 0; - if (Check_Timer <= diff) + PlayerGUID = 0; + + Must_Die = false; + Escape = false; + ContinueWP = false; + Reached = false; + } + + void UpdateAI(const uint32 diff) { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer) + if (Must_Die) + if (Must_Die_Timer <= diff) + { + me->ForcedDespawn(); + return; + } else Must_Die_Timer -= diff; + + if (!Escape) + { + if (!PlayerGUID) + return; + + if (spellEscape_Timer <= diff) + { + DoCast(me, SPELL_RIZZLE_ESCAPE, false); + spellEscape_Timer = 10000; + } else spellEscape_Timer -= diff; + + if (Teleport_Timer <= diff) + { + //temp solution - unit can't be teleported by core using spelleffect 5, only players + Map* pMap = me->GetMap(); + if (pMap) + { + pMap->CreatureRelocation(me, 3706.39, -3969.15, 35.9118, 0); + me->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); + } + //begin swimming and summon depth charges + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + SendText(MSG_ESCAPE_NOTICE, pPlayer); + DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE); + me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); + me->SetSpeed(MOVE_RUN, 0.85f, true); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + Escape = true; + } else Teleport_Timer -= diff; + + return; + } + + if (ContinueWP) + { + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + ContinueWP = false; + } + + if (Grenade_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + { + DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer); + DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true); + } + Grenade_Timer = 30000; + } else Grenade_Timer -= diff; + + if (Check_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (!pPlayer) + { + me->ForcedDespawn(); + return; + } + + if (me->IsWithinDist(pPlayer, 10) && me->GetPositionX() > pPlayer->GetPositionX() && !Reached) + { + DoScriptText(SAY_RIZZLE_FINAL, me); + me->SetUInt32Value(UNIT_NPC_FLAGS, 1); + me->setFaction(35); + me->GetMotionMaster()->MoveIdle(); + me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); + Reached = true; + } + + Check_Timer = 1000; + } else Check_Timer -= diff; + + } + + void SendText(const char *text, Player* pPlayer) + { + WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size + data << text; + if (pPlayer) + pPlayer->GetSession()->SendPacket(&data); + } + + void AttackStart(Unit *who) + { + if (!who || PlayerGUID) + return; + + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + DoScriptText(SAY_RIZZLE_START, me); + DoCast(who, SPELL_RIZZLE_BLACKJACK, false); + return; + } + } + + void EnterCombat(Unit* /*who*/) {} + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 57) { me->ForcedDespawn(); return; } - if (me->IsWithinDist(pPlayer, 10) && me->GetPositionX() > pPlayer->GetPositionX() && !Reached) - { - DoScriptText(SAY_RIZZLE_FINAL, me); - me->SetUInt32Value(UNIT_NPC_FLAGS, 1); - me->setFaction(35); - me->GetMotionMaster()->MoveIdle(); - me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); - Reached = true; - } - - Check_Timer = 1000; - } else Check_Timer -= diff; - - } - - void SendText(const char *text, Player* pPlayer) - { - WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size - data << text; - if (pPlayer) - pPlayer->GetSession()->SendPacket(&data); - } - - void AttackStart(Unit *who) - { - if (!who || PlayerGUID) - return; - - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) - { - PlayerGUID = who->GetGUID(); - DoScriptText(SAY_RIZZLE_START, me); - DoCast(who, SPELL_RIZZLE_BLACKJACK, false); - return; - } - } - - void EnterCombat(Unit* /*who*/) {} - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (id == 57) - { - me->ForcedDespawn(); - return; + ++CurrWP; + ContinueWP = true; } - ++CurrWP; - ContinueWP = true; - } + }; }; -bool GossipHello_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) - return true; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(10811, pCreature->GetGUID()); - return true; -} -bool GossipSelect_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && pPlayer->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); - CAST_AI(mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die_Timer = 3000; - CAST_AI(mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die = true; - } - return true; -} -CreatureAI* GetAI_mob_rizzle_sprysprocket(Creature* pCreature) -{ - return new mob_rizzle_sprysprocketAI (pCreature); -} /*#### # mob_depth_charge ####*/ - -struct mob_depth_chargeAI : public ScriptedAI + class mob_depth_charge : public CreatureScript { - mob_depth_chargeAI(Creature *c) : ScriptedAI(c) {} +public: + mob_depth_charge() : CreatureScript("mob_depth_charge") { } - bool we_must_die; - uint32 must_die_timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - we_must_die = false; - must_die_timer = 1000; + return new mob_depth_chargeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_depth_chargeAI : public ScriptedAI { - if (we_must_die) - if (must_die_timer <= diff) - { - me->ForcedDespawn(); - } else must_die_timer -= diff; - return; - } + mob_depth_chargeAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit *who) - { - if (!who) - return; + bool we_must_die; + uint32 must_die_timer; - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) + void Reset() { - DoCast(who, SPELL_DEPTH_CHARGE_TRAP); - we_must_die = true; + me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + we_must_die = false; + must_die_timer = 1000; + } + + void UpdateAI(const uint32 diff) + { + if (we_must_die) + if (must_die_timer <= diff) + { + me->ForcedDespawn(); + } else must_die_timer -= diff; return; } - } - void AttackStart(Unit * /*who*/) - { - } + void MoveInLineOfSight(Unit *who) + { + if (!who) + return; + + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) + { + DoCast(who, SPELL_DEPTH_CHARGE_TRAP); + we_must_die = true; + return; + } + } + + void AttackStart(Unit * /*who*/) + { + } + + void EnterCombat(Unit* /*who*/) + { + } + }; - void EnterCombat(Unit* /*who*/) - { - } }; -CreatureAI* GetAI_mob_depth_charge(Creature* pCreature) -{ - return new mob_depth_chargeAI (pCreature); -} void AddSC_azshara() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_spitelashes"; - newscript->GetAI = &GetAI_mobs_spitelashes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_loramus_thalipedes"; - newscript->pGossipHello = &GossipHello_npc_loramus_thalipedes; - newscript->pGossipSelect = &GossipSelect_npc_loramus_thalipedes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_rizzle_sprysprocket"; - newscript->GetAI = &GetAI_mob_rizzle_sprysprocket; - newscript->pGossipHello = &GossipHello_mob_rizzle_sprysprocket; - newscript->pGossipSelect = &GossipSelect_mob_rizzle_sprysprocket; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_depth_charge"; - newscript->GetAI = &GetAI_mob_depth_charge; - newscript->RegisterSelf(); + new mobs_spitelashes(); + new npc_loramus_thalipedes(); + new mob_rizzle_sprysprocket(); + new mob_depth_charge(); } - diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 6b0ee66e9ea..dd6b27dc7d2 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -29,8 +29,7 @@ npc_engineer_spark_overgrind npc_injured_draenei npc_magwin npc_geezle -mob_nestlewood_owlkin -go_ravager_cage +mob_nestlewood_owlkin go_ravager_cage npc_death_ravager EndContentData */ @@ -57,112 +56,119 @@ enum eEnums SPELL_IRRIDATION = 35046, SPELL_STUNNED = 28630 }; - -struct npc_draenei_survivorAI : public ScriptedAI + class npc_draenei_survivor : public CreatureScript { - npc_draenei_survivorAI(Creature *c) : ScriptedAI(c) {} +public: + npc_draenei_survivor() : CreatureScript("npc_draenei_survivor") { } - uint64 pCaster; - - uint32 SayThanksTimer; - uint32 RunAwayTimer; - uint32 SayHelpTimer; - - bool CanSayHelp; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - pCaster = 0; - - SayThanksTimer = 0; - RunAwayTimer = 0; - SayHelpTimer = 10000; - - CanSayHelp = true; - - DoCast(me, SPELL_IRRIDATION, true); - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->SetHealth(int(me->GetMaxHealth()*.1)); - me->SetStandState(UNIT_STAND_STATE_SLEEP); + return new npc_draenei_survivorAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit *who) + struct npc_draenei_survivorAI : public ScriptedAI { - if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f)) + npc_draenei_survivorAI(Creature *c) : ScriptedAI(c) {} + + uint64 pCaster; + + uint32 SayThanksTimer; + uint32 RunAwayTimer; + uint32 SayHelpTimer; + + bool CanSayHelp; + + void Reset() { - //Random switch between 4 texts - DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), me, who); + pCaster = 0; - SayHelpTimer = 20000; - CanSayHelp = false; - } - } + SayThanksTimer = 0; + RunAwayTimer = 0; + SayHelpTimer = 10000; - void SpellHit(Unit *Caster, const SpellEntry *Spell) - { - if (Spell->SpellFamilyFlags[2] & 0x080000000) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - - DoCast(me, SPELL_STUNNED, true); - - pCaster = Caster->GetGUID(); - - SayThanksTimer = 5000; - } - } - - void UpdateAI(const uint32 diff) - { - if (SayThanksTimer) - { - if (SayThanksTimer <= diff) - { - me->RemoveAurasDueToSpell(SPELL_IRRIDATION); - - if (Player* pPlayer = Unit::GetPlayer(*me, pCaster)) - { - DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), me, pPlayer); - - pPlayer->TalkedToCreature(me->GetEntry(),me->GetGUID()); - } - - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, -4115.053711f, -13754.831055f, 73.508949f); - - RunAwayTimer = 10000; - SayThanksTimer = 0; - } else SayThanksTimer -= diff; - - return; - } - - if (RunAwayTimer) - { - if (RunAwayTimer <= diff) - me->ForcedDespawn(); - else - RunAwayTimer -= diff; - - return; - } - - if (SayHelpTimer <= diff) - { CanSayHelp = true; - SayHelpTimer = 20000; - } else SayHelpTimer -= diff; - } + + DoCast(me, SPELL_IRRIDATION, true); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetHealth(int(me->GetMaxHealth()*.1)); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit *who) + { + if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f)) + { + //Random switch between 4 texts + DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), me, who); + + SayHelpTimer = 20000; + CanSayHelp = false; + } + } + + void SpellHit(Unit *Caster, const SpellEntry *Spell) + { + if (Spell->SpellFamilyFlags[2] & 0x080000000) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + + DoCast(me, SPELL_STUNNED, true); + + pCaster = Caster->GetGUID(); + + SayThanksTimer = 5000; + } + } + + void UpdateAI(const uint32 diff) + { + if (SayThanksTimer) + { + if (SayThanksTimer <= diff) + { + me->RemoveAurasDueToSpell(SPELL_IRRIDATION); + + if (Player* pPlayer = Unit::GetPlayer(*me, pCaster)) + { + DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), me, pPlayer); + + pPlayer->TalkedToCreature(me->GetEntry(),me->GetGUID()); + } + + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, -4115.053711f, -13754.831055f, 73.508949f); + + RunAwayTimer = 10000; + SayThanksTimer = 0; + } else SayThanksTimer -= diff; + + return; + } + + if (RunAwayTimer) + { + if (RunAwayTimer <= diff) + me->ForcedDespawn(); + else + RunAwayTimer -= diff; + + return; + } + + if (SayHelpTimer <= diff) + { + CanSayHelp = true; + SayHelpTimer = 20000; + } else SayHelpTimer -= diff; + } + }; + }; -CreatureAI* GetAI_npc_draenei_survivor(Creature* pCreature) -{ - return new npc_draenei_survivorAI (pCreature); -} /*###### ## npc_engineer_spark_overgrind @@ -182,128 +188,144 @@ enum eOvergrind }; #define GOSSIP_FIGHT "Traitor! You will be brought to justice!" - -struct npc_engineer_spark_overgrindAI : public ScriptedAI + class npc_engineer_spark_overgrind : public CreatureScript { - npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) +public: + npc_engineer_spark_overgrind() : CreatureScript("npc_engineer_spark_overgrind") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - NormFaction = c->getFaction(); - NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); - - if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) - IsTreeEvent = true; - } - - uint32 NormFaction; - uint32 NpcFlags; - - uint32 Dynamite_Timer; - uint32 Emote_Timer; - - bool IsTreeEvent; - - void Reset() - { - Dynamite_Timer = 8000; - Emote_Timer = 120000 + rand()%30000; - - me->setFaction(NormFaction); - me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); - - IsTreeEvent = false; - } - - void EnterCombat(Unit* who) - { - DoScriptText(ATTACK_YELL, me, who); - } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat() && !IsTreeEvent) + if (uiAction == GOSSIP_ACTION_INFO_DEF) { - if (Emote_Timer <= diff) - { - DoScriptText(SAY_TEXT, me); - DoScriptText(SAY_EMOTE, me); - Emote_Timer = 120000 + rand()%30000; - } else Emote_Timer -= diff; + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(FACTION_HOSTILE); + CAST_AI(npc_engineer_spark_overgrind::npc_engineer_spark_overgrindAI, pCreature->AI())->AttackStart(pPlayer); } - else if (IsTreeEvent) - return; - - if (!UpdateVictim()) - return; - - if (Dynamite_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DYNAMITE); - Dynamite_Timer = 8000; - } else Dynamite_Timer -= diff; - - DoMeleeAttackIfReady(); + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_engineer_spark_overgrindAI (pCreature); + } + + struct npc_engineer_spark_overgrindAI : public ScriptedAI + { + npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) + { + NormFaction = c->getFaction(); + NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); + + if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) + IsTreeEvent = true; + } + + uint32 NormFaction; + uint32 NpcFlags; + + uint32 Dynamite_Timer; + uint32 Emote_Timer; + + bool IsTreeEvent; + + void Reset() + { + Dynamite_Timer = 8000; + Emote_Timer = 120000 + rand()%30000; + + me->setFaction(NormFaction); + me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); + + IsTreeEvent = false; + } + + void EnterCombat(Unit* who) + { + DoScriptText(ATTACK_YELL, me, who); + } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat() && !IsTreeEvent) + { + if (Emote_Timer <= diff) + { + DoScriptText(SAY_TEXT, me); + DoScriptText(SAY_EMOTE, me); + Emote_Timer = 120000 + rand()%30000; + } else Emote_Timer -= diff; + } + else if (IsTreeEvent) + return; + + if (!UpdateVictim()) + return; + + if (Dynamite_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DYNAMITE); + Dynamite_Timer = 8000; + } else Dynamite_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_engineer_spark_overgrind(Creature* pCreature) -{ - return new npc_engineer_spark_overgrindAI (pCreature); -} -bool GossipHello_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_engineer_spark_overgrindAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} /*###### ## npc_injured_draenei ######*/ - -struct npc_injured_draeneiAI : public ScriptedAI + class npc_injured_draenei : public CreatureScript { - npc_injured_draeneiAI(Creature *c) : ScriptedAI(c) {} +public: + npc_injured_draenei() : CreatureScript("npc_injured_draenei") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->SetHealth(int(me->GetMaxHealth()*.15)); - switch (rand()%2) + return new npc_injured_draeneiAI (pCreature); + } + + struct npc_injured_draeneiAI : public ScriptedAI + { + npc_injured_draeneiAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { - case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break; - case 1: me->SetStandState(UNIT_STAND_STATE_SLEEP); break; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetHealth(int(me->GetMaxHealth()*.15)); + switch (rand()%2) + { + case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break; + case 1: me->SetStandState(UNIT_STAND_STATE_SLEEP); break; + } } - } - void EnterCombat(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) - { - } + void MoveInLineOfSight(Unit * /*who*/) + { + } - void UpdateAI(const uint32 /*diff*/) - { - } + void UpdateAI(const uint32 /*diff*/) + { + } + + }; }; -CreatureAI* GetAI_npc_injured_draenei(Creature* pCreature) -{ - return new npc_injured_draeneiAI (pCreature); -} /*###### ## npc_magwin @@ -320,60 +342,67 @@ enum eMagwin QUEST_A_CRY_FOR_SAY_HELP = 9528 }; - -struct npc_magwinAI : public npc_escortAI + class npc_magwin : public CreatureScript { - npc_magwinAI(Creature *c) : npc_escortAI(c) {} +public: + npc_magwin() : CreatureScript("npc_magwin") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) + if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP) { - case 0: - DoScriptText(SAY_START, me, pPlayer); - break; - case 17: - DoScriptText(SAY_PROGRESS, me, pPlayer); - break; - case 28: - DoScriptText(SAY_END1, me, pPlayer); - break; - case 29: - DoScriptText(EMOTE_HUG, me, pPlayer); - DoScriptText(SAY_END2, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,me); - break; + pCreature->setFaction(113); + if (npc_escortAI* pEscortAI = CAST_AI(npc_escortAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); } + return true; } - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me, who); + return new npc_magwinAI(pCreature); } - void Reset() { } + struct npc_magwinAI : public npc_escortAI + { + npc_magwinAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 0: + DoScriptText(SAY_START, me, pPlayer); + break; + case 17: + DoScriptText(SAY_PROGRESS, me, pPlayer); + break; + case 28: + DoScriptText(SAY_END1, me, pPlayer); + break; + case 29: + DoScriptText(EMOTE_HUG, me, pPlayer); + DoScriptText(SAY_END2, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,me); + break; + } + } + + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me, who); + } + + void Reset() { } + }; + }; -bool QuestAccept_npc_magwin(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP) - { - pCreature->setFaction(113); - if (npc_escortAI* pEscortAI = CAST_AI(npc_escortAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} - -CreatureAI* GetAI_npc_magwinAI(Creature* pCreature) -{ - return new npc_magwinAI(pCreature); -} /*###### ## npc_geezle @@ -400,139 +429,145 @@ enum eGeezle }; static float SparkPos[3] = {-5029.91, -11291.79, 8.096}; - -struct npc_geezleAI : public ScriptedAI + class npc_geezle : public CreatureScript { - npc_geezleAI(Creature *c) : ScriptedAI(c) {} +public: + npc_geezle() : CreatureScript("npc_geezle") { } - uint64 SparkGUID; - - uint32 Step; - uint32 SayTimer; - - bool EventStarted; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SparkGUID = 0; - Step = 0; - StartEvent(); + return new npc_geezleAI(pCreature); } - void EnterCombat(Unit* /*who*/){} - - void StartEvent() + struct npc_geezleAI : public ScriptedAI { - Step = 0; - EventStarted = true; - Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - if (Spark) + npc_geezleAI(Creature *c) : ScriptedAI(c) {} + + uint64 SparkGUID; + + uint32 Step; + uint32 SayTimer; + + bool EventStarted; + + void Reset() { - SparkGUID = Spark->GetGUID(); - Spark->setActive(true); - Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SparkGUID = 0; + Step = 0; + StartEvent(); } - SayTimer = 8000; - } - uint32 NextStep(uint32 Step) - { - Creature* Spark = Unit::GetCreature(*me, SparkGUID); + void EnterCombat(Unit* /*who*/){} - switch(Step) + void StartEvent() { - case 0: - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); - me->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); - return 9000; // NPCs are walking up to fire - case 1: - DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, me, Spark); + Step = 0; + EventStarted = true; + Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); if (Spark) { - Spark->SetInFront(me); - me->SetInFront(Spark); + SparkGUID = Spark->GetGUID(); + Spark->setActive(true); + Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; - case 9: - me->GetMotionMaster()->MoveTargetedHome(); - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); - CompleteQuest(); - return 9000; - case 10: - if (Spark) - Spark->DisappearAndDie(); - DespawnNagaFlag(false); - me->DisappearAndDie(); - default: return 99999999; + SayTimer = 8000; } - } - // will complete Tree's company quest for all nearby players that are disguised as trees - void CompleteQuest() - { - float radius = 50.0f; - std::list players; - Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); - Trinity::PlayerListSearcher searcher(me, players, checker); - me->VisitNearbyWorldObject(radius, searcher); - - for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) + uint32 NextStep(uint32 Step) { - if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) - { - (*itr)->KilledMonsterCredit(MOB_SPARK,0); - } - } - } + Creature* Spark = Unit::GetCreature(*me, SparkGUID); - void DespawnNagaFlag(bool despawn) - { - std::list FlagList; - me->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 100.0f); - - if (!FlagList.empty()) - { - for (std::list::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + switch(Step) { - if (despawn) + case 0: + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); + me->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); + return 9000; // NPCs are walking up to fire + case 1: + DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, me, Spark); + if (Spark) { - (*itr)->SetLootState(GO_JUST_DEACTIVATED); + Spark->SetInFront(me); + me->SetInFront(Spark); } - else - (*itr)->Respawn(); + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; + case 9: + me->GetMotionMaster()->MoveTargetedHome(); + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); + CompleteQuest(); + return 9000; + case 10: + if (Spark) + Spark->DisappearAndDie(); + DespawnNagaFlag(false); + me->DisappearAndDie(); + default: return 99999999; } - } else sLog.outError("SD2 ERROR: FlagList is empty!"); - } + } - void UpdateAI(const uint32 diff) - { - if (SayTimer <= diff) + // will complete Tree's company quest for all nearby players that are disguised as trees + void CompleteQuest() { - if (EventStarted) - { - SayTimer = NextStep(Step++); - } - } else SayTimer -= diff; - } -}; + float radius = 50.0f; + std::list players; + Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); + Trinity::PlayerListSearcher searcher(me, players, checker); + me->VisitNearbyWorldObject(radius, searcher); -CreatureAI* GetAI_npc_geezleAI(Creature* pCreature) -{ - return new npc_geezleAI(pCreature); -} + for (std::list::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE + &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) + { + (*itr)->KilledMonsterCredit(MOB_SPARK,0); + } + } + } + + void DespawnNagaFlag(bool despawn) + { + std::list FlagList; + me->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 100.0f); + + if (!FlagList.empty()) + { + for (std::list::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + { + if (despawn) + { + (*itr)->SetLootState(GO_JUST_DEACTIVATED); + } + else + (*itr)->Respawn(); + } + } else sLog.outError("SD2 ERROR: FlagList is empty!"); + } + + void UpdateAI(const uint32 diff) + { + if (SayTimer <= diff) + { + if (EventStarted) + { + SayTimer = NextStep(Step++); + } + } else SayTimer -= diff; + } + }; + +}; /*###### ## mob_nestlewood_owlkin @@ -544,61 +579,68 @@ enum eOwlkin ENTRY_OWLKIN = 16518, ENTRY_OWLKIN_INOC = 16534 }; - -struct npc_nestlewood_owlkinAI : public ScriptedAI + class npc_nestlewood_owlkin : public CreatureScript { - npc_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {} +public: + npc_nestlewood_owlkin() : CreatureScript("npc_nestlewood_owlkin") { } - uint32 DespawnTimer; - - void Reset() + struct npc_nestlewood_owlkinAI : public ScriptedAI { - DespawnTimer = 0; - } + npc_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //timer gets adjusted by the triggered aura effect - if (DespawnTimer) + uint32 DespawnTimer; + + void Reset() { - if (DespawnTimer <= diff) - { - //once we are able to, despawn us - me->ForcedDespawn(); - return; - } else DespawnTimer -= diff; + DespawnTimer = 0; } - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //timer gets adjusted by the triggered aura effect + if (DespawnTimer) + { + if (DespawnTimer <= diff) + { + //once we are able to, despawn us + me->ForcedDespawn(); + return; + } else DespawnTimer -= diff; + } - DoMeleeAttackIfReady(); + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; + + bool EffectDummyCreature(Unit * /*pCaster*/, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) + { + //always check spellid and effectindex + if (spellId == SPELL_INOCULATE_OWLKIN && effIndex == 0) + { + if (pCreatureTarget->GetEntry() != ENTRY_OWLKIN) + return true; + + pCreatureTarget->UpdateEntry(ENTRY_OWLKIN_INOC); + + //set despawn timer, since we want to remove Creature after a short time + CAST_AI(npc_nestlewood_owlkin::npc_nestlewood_owlkinAI, pCreatureTarget->AI())->DespawnTimer = 15000; + + //always return true when we are handling this spell and effect + return true; + } + return false; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_nestlewood_owlkinAI (pCreature); + } + }; -CreatureAI* GetAI_npc_nestlewood_owlkinAI(Creature* pCreature) -{ - return new npc_nestlewood_owlkinAI (pCreature); -} - -bool EffectDummyCreature_npc_nestlewood_owlkin(Unit * /*pCaster*/, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) -{ - //always check spellid and effectindex - if (spellId == SPELL_INOCULATE_OWLKIN && effIndex == 0) - { - if (pCreatureTarget->GetEntry() != ENTRY_OWLKIN) - return true; - - pCreatureTarget->UpdateEntry(ENTRY_OWLKIN_INOC); - - //set despawn timer, since we want to remove Creature after a short time - CAST_AI(npc_nestlewood_owlkinAI, pCreatureTarget->AI())->DespawnTimer = 15000; - - //always return true when we are handling this spell and effect - return true; - } - return false; -} enum eRavegerCage { @@ -610,64 +652,75 @@ enum eRavegerCage QUEST_STRENGTH_ONE = 9582 }; -bool go_ravager_cage(Player* pPlayer, GameObject* pGo) +class go_ravager_cage : public GameObjectScript { +public: + go_ravager_cage() : GameObjectScript("go_ravager_cage") { } - if (pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - if (Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true)) + if (pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE) { - ravager->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - ravager->SetReactState(REACT_AGGRESSIVE); - ravager->AI()->AttackStart(pPlayer); + if (Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true)) + { + ravager->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + ravager->SetReactState(REACT_AGGRESSIVE); + ravager->AI()->AttackStart(pPlayer); + } } - } - return true ; -} - -struct npc_death_ravagerAI : public ScriptedAI -{ - npc_death_ravagerAI(Creature *c) : ScriptedAI(c){} - - uint32 RendTimer; - uint32 EnragingBiteTimer; - - void Reset() - { - RendTimer = 30000; - EnragingBiteTimer = 20000; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (RendTimer <= diff) - { - DoCast(me->getVictim(), SPELL_REND); - RendTimer = 30000; - } - else RendTimer -= diff; - - if (EnragingBiteTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ENRAGING_BITE); - EnragingBiteTimer = 15000; - } - else EnragingBiteTimer -= diff; - - DoMeleeAttackIfReady(); + return true ; } }; - -CreatureAI* GetAI_npc_death_ravagerAI(Creature* pCreature) + class npc_death_ravager : public CreatureScript { - return new npc_death_ravagerAI(pCreature); -} +public: + npc_death_ravager() : CreatureScript("npc_death_ravager") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_death_ravagerAI(pCreature); + } + + struct npc_death_ravagerAI : public ScriptedAI + { + npc_death_ravagerAI(Creature *c) : ScriptedAI(c){} + + uint32 RendTimer; + uint32 EnragingBiteTimer; + + void Reset() + { + RendTimer = 30000; + EnragingBiteTimer = 20000; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (RendTimer <= diff) + { + DoCast(me->getVictim(), SPELL_REND); + RendTimer = 30000; + } + else RendTimer -= diff; + + if (EnragingBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ENRAGING_BITE); + EnragingBiteTimer = 15000; + } + else EnragingBiteTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; /*######## ## Quest: The Prophecy of Akida @@ -681,111 +734,76 @@ enum BristlelimbCage CAPITIVE_SAY_2 = -1000475, CAPITIVE_SAY_3 = -1000476 }; - - -struct npc_stillpine_capitiveAI : public ScriptedAI + class npc_stillpine_capitive : public CreatureScript { - npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){} +public: + npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { } - uint32 FleeTimer; - - void Reset() + struct npc_stillpine_capitiveAI : public ScriptedAI { - FleeTimer = 0; - GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f); - if(cage) - cage->ResetDoorOrButton(); - } + npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){} - void UpdateAI(const uint32 diff) - { - if(FleeTimer) + uint32 FleeTimer; + + void Reset() { - if(FleeTimer <= diff) - me->ForcedDespawn(); - else FleeTimer -= diff; + FleeTimer = 0; + GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f); + if(cage) + cage->ResetDoorOrButton(); } + + void UpdateAI(const uint32 diff) + { + if(FleeTimer) + { + if(FleeTimer <= diff) + me->ForcedDespawn(); + else FleeTimer -= diff; + } + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_stillpine_capitiveAI(pCreature); } + }; - -CreatureAI* GetAI_npc_stillpine_capitiveAI(Creature* pCreature) + class go_bristlelimb_cage : public GameObjectScript { - return new npc_stillpine_capitiveAI(pCreature); -} +public: + go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { } -bool go_bristlelimb_cage(Player* pPlayer, GameObject* pGo) -{ - if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true); - if(pCreature) + if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) { - DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer); - pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500); - pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID()); - CAST_AI(npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500; - return false; + Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true); + if(pCreature) + { + DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer); + pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500); + pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID()); + CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500; + return false; + } } + return true; } - return true; -} + +}; void AddSC_azuremyst_isle() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_draenei_survivor"; - newscript->GetAI = &GetAI_npc_draenei_survivor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_engineer_spark_overgrind"; - newscript->GetAI = &GetAI_npc_engineer_spark_overgrind; - newscript->pGossipHello = &GossipHello_npc_engineer_spark_overgrind; - newscript->pGossipSelect = &GossipSelect_npc_engineer_spark_overgrind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_injured_draenei"; - newscript->GetAI = &GetAI_npc_injured_draenei; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_magwin"; - newscript->GetAI = &GetAI_npc_magwinAI; - newscript->pQuestAccept = &QuestAccept_npc_magwin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_geezle"; - newscript->GetAI = &GetAI_npc_geezleAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nestlewood_owlkin"; - newscript->GetAI = &GetAI_npc_nestlewood_owlkinAI; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_nestlewood_owlkin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_death_ravager"; - newscript->GetAI = &GetAI_npc_death_ravagerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_ravager_cage"; - newscript->pGOHello = &go_ravager_cage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_stillpine_capitive"; - newscript->GetAI = &GetAI_npc_stillpine_capitiveAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_bristlelimb_cage"; - newscript->pGOHello = &go_bristlelimb_cage; - newscript->RegisterSelf(); + new npc_draenei_survivor(); + new npc_engineer_spark_overgrind(); + new npc_injured_draenei(); + new npc_magwin(); + new npc_geezle(); + new npc_nestlewood_owlkin(); + new npc_death_ravager(); + new go_ravager_cage(); + new npc_stillpine_capitive(); + new go_bristlelimb_cage(); } - diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index 9e8c7bbe563..5ac9dfa4a37 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -36,44 +36,51 @@ EndContentData */ //possible creatures to be spawned const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; - -struct mob_webbed_creatureAI : public ScriptedAI + class mob_webbed_creature : public CreatureScript { - mob_webbed_creatureAI(Creature *c) : ScriptedAI(c) {} +public: + mob_webbed_creature() : CreatureScript("mob_webbed_creature") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_webbed_creatureAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_webbed_creatureAI : public ScriptedAI { - } + mob_webbed_creatureAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* Killer) - { - uint32 spawnCreatureID = 0; - - switch (urand(0,2)) + void Reset() { - case 0: - spawnCreatureID = 17681; - if (Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(spawnCreatureID, me->GetGUID()); - break; - case 1: - case 2: - spawnCreatureID = possibleSpawns[urand(0,30)]; - break; } - if (spawnCreatureID) - me->SummonCreature(spawnCreatureID, 0.0f, 0.0f, 0.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - } + void EnterCombat(Unit* /*who*/) + { + } + + void JustDied(Unit* Killer) + { + uint32 spawnCreatureID = 0; + + switch (urand(0,2)) + { + case 0: + spawnCreatureID = 17681; + if (Killer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(Killer)->KilledMonsterCredit(spawnCreatureID, me->GetGUID()); + break; + case 1: + case 2: + spawnCreatureID = possibleSpawns[urand(0,30)]; + break; + } + + if (spawnCreatureID) + me->SummonCreature(spawnCreatureID, 0.0f, 0.0f, 0.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + } + }; + }; -CreatureAI* GetAI_mob_webbed_creature(Creature* pCreature) -{ - return new mob_webbed_creatureAI (pCreature); -} /*###### ## npc_captured_sunhawk_agent @@ -87,65 +94,61 @@ CreatureAI* GetAI_mob_webbed_creature(Creature* pCreature) #define GOSSIP_SELECT_CSA3 "[PH] " #define GOSSIP_SELECT_CSA4 "[PH] " #define GOSSIP_SELECT_CSA5 "[PH] " - -bool GossipHello_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature) + class npc_captured_sunhawk_agent : public CreatureScript { - if (pPlayer->HasAura(31609) && pPlayer->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_CSA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9136, pCreature->GetGUID()); - } - else - pPlayer->SEND_GOSSIP_MENU(9134, pCreature->GetGUID()); +public: + npc_captured_sunhawk_agent() : CreatureScript("npc_captured_sunhawk_agent") { } - return true; -} - -bool GossipSelect_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(9137, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(9138, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(9139, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(9140, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(9141, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->TalkedToCreature(C_SUNHAWK_TRIGGER, pCreature->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(9137, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(9138, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(9139, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(9140, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(9141, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TalkedToCreature(C_SUNHAWK_TRIGGER, pCreature->GetGUID()); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->HasAura(31609) && pPlayer->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_CSA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(9136, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(9134, pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_bloodmyst_isle() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_webbed_creature"; - newscript->GetAI = &GetAI_mob_webbed_creature; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_captured_sunhawk_agent"; - newscript->pGossipHello = &GossipHello_npc_captured_sunhawk_agent; - newscript->pGossipSelect = &GossipSelect_npc_captured_sunhawk_agent; - newscript->RegisterSelf(); + new mob_webbed_creature(); + new npc_captured_sunhawk_agent(); } - diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index b8b40e3c510..c7a3412133b 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -34,124 +34,126 @@ EndScriptData */ #define SPELL_REFLECT 22067 #define SPELL_CLEAVE 8255 //Perhaps not right ID #define SPELL_ENRAGE 23537 - -struct boss_azuregosAI : public ScriptedAI + class boss_azuregos : public CreatureScript { - boss_azuregosAI(Creature *c) : ScriptedAI(c) {} +public: + boss_azuregos() : CreatureScript("boss_azuregos") { } - uint32 MarkOfFrost_Timer; - uint32 ManaStorm_Timer; - uint32 Chill_Timer; - uint32 Breath_Timer; - uint32 Teleport_Timer; - uint32 Reflect_Timer; - uint32 Cleave_Timer; - uint32 Enrage_Timer; - bool Enraged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MarkOfFrost_Timer = 35000; - ManaStorm_Timer = 5000 + rand()%12000; - Chill_Timer = 10000 + rand()%20000; - Breath_Timer = 2000 + rand()%6000; - Teleport_Timer = 30000; - Reflect_Timer = 15000 + rand()%15000; - Cleave_Timer = 7000; - Enrage_Timer = 0; - Enraged = false; + return new boss_azuregosAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct boss_azuregosAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_azuregosAI(Creature *c) : ScriptedAI(c) {} - if (Teleport_Timer <= diff) + uint32 MarkOfFrost_Timer; + uint32 ManaStorm_Timer; + uint32 Chill_Timer; + uint32 Breath_Timer; + uint32 Teleport_Timer; + uint32 Reflect_Timer; + uint32 Cleave_Timer; + uint32 Enrage_Timer; + bool Enraged; + + void Reset() { - DoScriptText(SAY_TELEPORT, me); - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - { - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation()); - } - } - - DoResetThreat(); + MarkOfFrost_Timer = 35000; + ManaStorm_Timer = 5000 + rand()%12000; + Chill_Timer = 10000 + rand()%20000; + Breath_Timer = 2000 + rand()%6000; Teleport_Timer = 30000; - } else Teleport_Timer -= diff; - - // //MarkOfFrost_Timer - // if (MarkOfFrost_Timer <= diff) - // { - // DoCast(me->getVictim(), SPELL_MARKOFFROST); - // MarkOfFrost_Timer = 25000; - // } else MarkOfFrost_Timer -= diff; - - //Chill_Timer - if (Chill_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CHILL); - Chill_Timer = 13000 + rand()%12000; - } else Chill_Timer -= diff; - - //Breath_Timer - if (Breath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBREATH); - Breath_Timer = 10000 + rand()%5000; - } else Breath_Timer -= diff; - - //ManaStorm_Timer - if (ManaStorm_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_MANASTORM); - ManaStorm_Timer = 7500 + rand()%5000; - } else ManaStorm_Timer -= diff; - - //Reflect_Timer - if (Reflect_Timer <= diff) - { - DoCast(me, SPELL_REFLECT); - Reflect_Timer = 20000 + rand()%15000; - } else Reflect_Timer -= diff; - - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); + Reflect_Timer = 15000 + rand()%15000; Cleave_Timer = 7000; - } else Cleave_Timer -= diff; - - //Enrage_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + Enrage_Timer = 0; + Enraged = false; } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (Teleport_Timer <= diff) + { + DoScriptText(SAY_TELEPORT, me); + std::list& m_threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = m_threatlist.begin(); + for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + { + DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation()); + } + } + + DoResetThreat(); + Teleport_Timer = 30000; + } else Teleport_Timer -= diff; + + // //MarkOfFrost_Timer + // if (MarkOfFrost_Timer <= diff) + // { + // DoCast(me->getVictim(), SPELL_MARKOFFROST); + // MarkOfFrost_Timer = 25000; + // } else MarkOfFrost_Timer -= diff; + + //Chill_Timer + if (Chill_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHILL); + Chill_Timer = 13000 + rand()%12000; + } else Chill_Timer -= diff; + + //Breath_Timer + if (Breath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBREATH); + Breath_Timer = 10000 + rand()%5000; + } else Breath_Timer -= diff; + + //ManaStorm_Timer + if (ManaStorm_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_MANASTORM); + ManaStorm_Timer = 7500 + rand()%5000; + } else ManaStorm_Timer -= diff; + + //Reflect_Timer + if (Reflect_Timer <= diff) + { + DoCast(me, SPELL_REFLECT); + Reflect_Timer = 20000 + rand()%15000; + } else Reflect_Timer -= diff; + + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + //Enrage_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_azuregos(Creature* pCreature) -{ - return new boss_azuregosAI (pCreature); -} void AddSC_boss_azuregos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azuregos"; - newscript->GetAI = &GetAI_boss_azuregos; - newscript->RegisterSelf(); + new boss_azuregos(); } - diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index 8cdb8990dbd..8ba4b2ed235 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -64,111 +64,119 @@ enum eKerlonian FACTION_KER_ESCORTEE = 113 }; -//TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road. -struct npc_kerlonianAI : public FollowerAI +//TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road. class npc_kerlonian : public CreatureScript { - npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_kerlonian() : CreatureScript("npc_kerlonian") { } - uint32 m_uiFallAsleepTimer; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_uiFallAsleepTimer = urand(10000, 45000); - } - - void MoveInLineOfSight(Unit *pWho) - { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) + if (pQuest->GetQuestId() == QUEST_SLEEPER_AWAKENED) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) + if (npc_kerlonianAI* pKerlonianAI = CAST_AI(npc_kerlonian::npc_kerlonianAI, pCreature->AI())) { - if (Player* pPlayer = GetLeaderForFollower()) - { - if (pPlayer->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me); - - DoScriptText(SAY_KER_END, me); - } - - SetFollowComplete(); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_KER_START, pCreature, pPlayer); + pKerlonianAI->StartFollow(pPlayer, FACTION_KER_ESCORTEE, pQuest); } } + + return true; } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + CreatureAI* GetAI(Creature* pCreature) const { - if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN) - ClearSleeping(); + return new npc_kerlonianAI(pCreature); } - void SetSleeping() + struct npc_kerlonianAI : public FollowerAI { - SetFollowPaused(true); + npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { } - DoScriptText(RAND(EMOTE_KER_SLEEP_1,EMOTE_KER_SLEEP_2,EMOTE_KER_SLEEP_3), me); + uint32 m_uiFallAsleepTimer; - DoScriptText(RAND(SAY_KER_SLEEP_1,SAY_KER_SLEEP_2,SAY_KER_SLEEP_3,SAY_KER_SLEEP_4), me); - - me->SetStandState(UNIT_STAND_STATE_SLEEP); - DoCast(me, SPELL_SLEEP_VISUAL, false); - } - - void ClearSleeping() - { - me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL); - me->SetStandState(UNIT_STAND_STATE_STAND); - - DoScriptText(EMOTE_KER_AWAKEN, me); - - SetFollowPaused(false); - } - - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void Reset() { - if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) + m_uiFallAsleepTimer = urand(10000, 45000); + } + + void MoveInLineOfSight(Unit *pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) + { + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) + { + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me); + + DoScriptText(SAY_KER_END, me); + } + + SetFollowComplete(); + } + } + } + + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN) + ClearSleeping(); + } + + void SetSleeping() + { + SetFollowPaused(true); + + DoScriptText(RAND(EMOTE_KER_SLEEP_1,EMOTE_KER_SLEEP_2,EMOTE_KER_SLEEP_3), me); + + DoScriptText(RAND(SAY_KER_SLEEP_1,SAY_KER_SLEEP_2,SAY_KER_SLEEP_3,SAY_KER_SLEEP_4), me); + + me->SetStandState(UNIT_STAND_STATE_SLEEP); + DoCast(me, SPELL_SLEEP_VISUAL, false); + } + + void ClearSleeping() + { + me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL); + me->SetStandState(UNIT_STAND_STATE_STAND); + + DoScriptText(EMOTE_KER_AWAKEN, me); + + SetFollowPaused(false); + } + + void UpdateFollowerAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) + return; + + if (!HasFollowState(STATE_FOLLOW_PAUSED)) + { + if (m_uiFallAsleepTimer <= uiDiff) + { + SetSleeping(); + m_uiFallAsleepTimer = urand(25000, 90000); + } + else + m_uiFallAsleepTimer -= uiDiff; + } + return; - - if (!HasFollowState(STATE_FOLLOW_PAUSED)) - { - if (m_uiFallAsleepTimer <= uiDiff) - { - SetSleeping(); - m_uiFallAsleepTimer = urand(25000, 90000); - } - else - m_uiFallAsleepTimer -= uiDiff; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_kerlonian(Creature* pCreature) -{ - return new npc_kerlonianAI(pCreature); -} -bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_SLEEPER_AWAKENED) - { - if (npc_kerlonianAI* pKerlonianAI = CAST_AI(npc_kerlonianAI, pCreature->AI())) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_KER_START, pCreature, pPlayer); - pKerlonianAI->StartFollow(pPlayer, FACTION_KER_ESCORTEE, pQuest); - } - } - - return true; -} /*#### # npc_prospector_remtravel @@ -196,106 +204,114 @@ enum eRemtravel NPC_GRAVEL_BONE = 2159, NPC_GRAVEL_GEO = 2160 }; - -struct npc_prospector_remtravelAI : public npc_escortAI + class npc_prospector_remtravel : public CreatureScript { - npc_prospector_remtravelAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_prospector_remtravel() : CreatureScript("npc_prospector_remtravel") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) + if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) { - case 0: - DoScriptText(SAY_REM_START, me, pPlayer); - break; - case 5: - DoScriptText(SAY_REM_RAMP1_1, me, pPlayer); - break; - case 6: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - DoScriptText(SAY_REM_RAMP1_2, me, pPlayer); - break; - case 14: - //depend quest rewarded? - DoScriptText(SAY_REM_BOOK, me, pPlayer); - break; - case 15: - DoScriptText(SAY_REM_TENT1_1, me, pPlayer); - break; - case 16: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 17: - DoScriptText(SAY_REM_TENT1_2, me, pPlayer); - break; - case 26: - DoScriptText(SAY_REM_MOSS, me, pPlayer); - break; - case 27: - DoScriptText(EMOTE_REM_MOSS, me, pPlayer); - break; - case 28: - DoScriptText(SAY_REM_MOSS_PROGRESS, me, pPlayer); - break; - case 29: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 31: - DoScriptText(SAY_REM_PROGRESS, me, pPlayer); - break; - case 41: - DoScriptText(SAY_REM_REMEMBER, me, pPlayer); - break; - case 42: - DoScriptText(EMOTE_REM_END, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravel::npc_prospector_remtravelAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + + pCreature->setFaction(FACTION_ESCORTEE); } + + return true; } - void Reset() {} - - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - if (rand()%2) - DoScriptText(SAY_REM_AGGRO, me, who); + return new npc_prospector_remtravelAI(pCreature); } - void JustSummoned(Creature* /*pSummoned*/) + struct npc_prospector_remtravelAI : public npc_escortAI { - //unsure if it should be any - //pSummoned->AI()->AttackStart(me); - } + npc_prospector_remtravelAI(Creature* pCreature) : npc_escortAI(pCreature) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 0: + DoScriptText(SAY_REM_START, me, pPlayer); + break; + case 5: + DoScriptText(SAY_REM_RAMP1_1, me, pPlayer); + break; + case 6: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + DoScriptText(SAY_REM_RAMP1_2, me, pPlayer); + break; + case 14: + //depend quest rewarded? + DoScriptText(SAY_REM_BOOK, me, pPlayer); + break; + case 15: + DoScriptText(SAY_REM_TENT1_1, me, pPlayer); + break; + case 16: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 17: + DoScriptText(SAY_REM_TENT1_2, me, pPlayer); + break; + case 26: + DoScriptText(SAY_REM_MOSS, me, pPlayer); + break; + case 27: + DoScriptText(EMOTE_REM_MOSS, me, pPlayer); + break; + case 28: + DoScriptText(SAY_REM_MOSS_PROGRESS, me, pPlayer); + break; + case 29: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 31: + DoScriptText(SAY_REM_PROGRESS, me, pPlayer); + break; + case 41: + DoScriptText(SAY_REM_REMEMBER, me, pPlayer); + break; + case 42: + DoScriptText(EMOTE_REM_END, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); + break; + } + } + + void Reset() {} + + void EnterCombat(Unit* who) + { + if (rand()%2) + DoScriptText(SAY_REM_AGGRO, me, who); + } + + void JustSummoned(Creature* /*pSummoned*/) + { + //unsure if it should be any + //pSummoned->AI()->AttackStart(me); + } + }; + }; -CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) -{ - return new npc_prospector_remtravelAI(pCreature); -} -bool QuestAccept_npc_prospector_remtravel(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravelAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - - pCreature->setFaction(FACTION_ESCORTEE); - } - - return true; -} /*#### # npc_threshwackonator @@ -311,90 +327,81 @@ enum eThreshwackonator }; #define GOSSIP_ITEM_INSERT_KEY "[PH] Insert key" - -struct npc_threshwackonatorAI : public FollowerAI + class npc_threshwackonator : public CreatureScript { - npc_threshwackonatorAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_threshwackonator() : CreatureScript("npc_threshwackonator") { } - void Reset() { } - - void MoveInLineOfSight(Unit* pWho) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - if (me->IsWithinDistInMap(pWho, 10.0f)) + pPlayer->CLOSE_GOSSIP_MENU(); + + if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonator::npc_threshwackonatorAI, pCreature->AI())) { - DoScriptText(SAY_AT_CLOSE, pWho); - DoAtEnd(); + DoScriptText(EMOTE_START, pCreature); + pThreshAI->StartFollow(pPlayer); } } + + return true; } - void DoAtEnd() + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->setFaction(FACTION_HOSTILE); + if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (Player* pHolder = GetLeaderForFollower()) - me->AI()->AttackStart(pHolder); - - SetFollowComplete(); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_threshwackonatorAI(pCreature); + } + + struct npc_threshwackonatorAI : public FollowerAI + { + npc_threshwackonatorAI(Creature* pCreature) : FollowerAI(pCreature) { } + + void Reset() { } + + void MoveInLineOfSight(Unit* pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) + { + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(SAY_AT_CLOSE, pWho); + DoAtEnd(); + } + } + } + + void DoAtEnd() + { + me->setFaction(FACTION_HOSTILE); + + if (Player* pHolder = GetLeaderForFollower()) + me->AI()->AttackStart(pHolder); + + SetFollowComplete(); + } + }; + }; -CreatureAI* GetAI_npc_threshwackonator(Creature* pCreature) -{ - return new npc_threshwackonatorAI(pCreature); -} -bool GossipHello_npc_threshwackonator(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_threshwackonator(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonatorAI, pCreature->AI())) - { - DoScriptText(EMOTE_START, pCreature); - pThreshAI->StartFollow(pPlayer); - } - } - - return true; -} void AddSC_darkshore() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kerlonian"; - newscript->GetAI = &GetAI_npc_kerlonian; - newscript->pQuestAccept = &QuestAccept_npc_kerlonian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prospector_remtravel"; - newscript->GetAI = &GetAI_npc_prospector_remtravel; - newscript->pQuestAccept = &QuestAccept_npc_prospector_remtravel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_threshwackonator"; - newscript->GetAI = &GetAI_npc_threshwackonator; - newscript->pGossipHello = &GossipHello_npc_threshwackonator; - newscript->pGossipSelect = &GossipSelect_npc_threshwackonator; - newscript->pGossipSelect = &GossipSelect_npc_threshwackonator; - newscript->RegisterSelf(); + new npc_kerlonian(); + new npc_prospector_remtravel(); + new npc_threshwackonator(); } - diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index f9f79ffc917..565a16169b2 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -51,211 +51,217 @@ enum eDyingKodo SPELL_KODO_KOMBO_GOSSIP = 18362 }; - -struct npc_aged_dying_ancient_kodoAI : public ScriptedAI + class npc_aged_dying_ancient_kodo : public CreatureScript { - npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } +public: + npc_aged_dying_ancient_kodo() : CreatureScript("npc_aged_dying_ancient_kodo") { } - uint32 m_uiDespawnTimer; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - m_uiDespawnTimer = 0; - } - - void MoveInLineOfSight(Unit* pWho) - { - if (pWho->GetEntry() == NPC_SMEED) + if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) { - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; + //the expected quest objective + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - if (me->IsWithinDistInMap(pWho, 10.0f)) - { - DoScriptText(RAND(SAY_SMEED_HOME_1,SAY_SMEED_HOME_2,SAY_SMEED_HOME_3), pWho); - - //spell have no implemented effect (dummy), so useful to notify spellHit - DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true); - } - } - } - - void SpellHit(Unit* /*pCaster*/, SpellEntry const* pSpell) - { - if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_uiDespawnTimer = 60000; - } - } - - void UpdateAI(const uint32 diff) - { - //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. - if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) - { - if (!me->getVictim() && me->isAlive()) - { - Reset(); - me->setDeathState(JUST_DIED); - me->Respawn(); - return; - } - } else m_uiDespawnTimer -= diff; - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_npc_aged_dying_ancient_kodo(Creature* pCreature) -{ - return new npc_aged_dying_ancient_kodoAI(pCreature); -} - -bool EffectDummyCreature_npc_aged_dying_ancient_kodo(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) -{ - //always check spellid and effectindex - if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0) - { - //no effect if player/creature already have aura from spells - if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) - return true; - - if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || - pCreatureTarget->GetEntry() == NPC_DYING_KODO || - pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) - { - pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); - - pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); - pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); - - if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - pCreatureTarget->GetMotionMaster()->MoveIdle(); - - pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, pCreatureTarget->GetFollowAngle()); + pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); + pCreature->GetMotionMaster()->MoveIdle(); } - //always return true when we are handling this spell and effect + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; } - return false; -} -bool GossipHello_npc_aged_dying_ancient_kodo(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + bool EffectDummyCreature(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) { - //the expected quest objective - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + //always check spellid and effectindex + if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0) + { + //no effect if player/creature already have aura from spells + if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + return true; - pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); - pCreature->GetMotionMaster()->MoveIdle(); + if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || + pCreatureTarget->GetEntry() == NPC_DYING_KODO || + pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) + { + pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); + + pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); + pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); + + if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + pCreatureTarget->GetMotionMaster()->MoveIdle(); + + pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, pCreatureTarget->GetFollowAngle()); + } + + //always return true when we are handling this spell and effect + return true; + } + return false; } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_aged_dying_ancient_kodoAI(pCreature); + } + + struct npc_aged_dying_ancient_kodoAI : public ScriptedAI + { + npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + + uint32 m_uiDespawnTimer; + + void Reset() + { + m_uiDespawnTimer = 0; + } + + void MoveInLineOfSight(Unit* pWho) + { + if (pWho->GetEntry() == NPC_SMEED) + { + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; + + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(RAND(SAY_SMEED_HOME_1,SAY_SMEED_HOME_2,SAY_SMEED_HOME_3), pWho); + + //spell have no implemented effect (dummy), so useful to notify spellHit + DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true); + } + } + } + + void SpellHit(Unit* /*pCaster*/, SpellEntry const* pSpell) + { + if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + m_uiDespawnTimer = 60000; + } + } + + void UpdateAI(const uint32 diff) + { + //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. + if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + { + if (!me->getVictim() && me->isAlive()) + { + Reset(); + me->setDeathState(JUST_DIED); + me->Respawn(); + return; + } + } else m_uiDespawnTimer -= diff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; + +}; + + + /*###### ## go_iruxos. Quest 5381 ######*/ - -bool GOHello_go_iruxos(Player *pPlayer, GameObject* /*pGO*/) + class go_iruxos : public GameObjectScript { - if (pPlayer->GetQuestStatus(5381) == QUEST_STATUS_INCOMPLETE) - pPlayer->SummonCreature(11876, pPlayer->GetInnPosX(),pPlayer->GetInnPosY(),pPlayer->GetInnPosZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); +public: + go_iruxos() : GameObjectScript("go_iruxos") { } - return true; -} + bool OnGossipHello(Player *pPlayer, GameObject* /*pGO*/) + { + if (pPlayer->GetQuestStatus(5381) == QUEST_STATUS_INCOMPLETE) + pPlayer->SummonCreature(11876, pPlayer->GetInnPosX(),pPlayer->GetInnPosY(),pPlayer->GetInnPosZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + + return true; + } + +}; /*###### ## npc_dalinda_malem. Quest 1440 ######*/ #define QUEST_RETURN_TO_VAHLARRIEL 1440 - -struct npc_dalindaAI : public npc_escortAI + class npc_dalinda : public CreatureScript { - npc_dalindaAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void WaypointReached(uint32 i) +public: + npc_dalinda() : CreatureScript("npc_dalinda") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - switch (i) - { - case 1: - me->IsStandState(); - break; - case 15: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); - break; + if (quest->GetQuestId() == QUEST_RETURN_TO_VAHLARRIEL) + { + if (npc_escortAI* pEscortAI = CAST_AI(npc_dalinda::npc_dalindaAI, pCreature->AI())) + { + pEscortAI->Start(true, false, pPlayer->GetGUID()); + pCreature->setFaction(113); + } } + return true; } - void EnterCombat(Unit* /*pWho*/) { } - - void Reset() {} - - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->FailQuest(QUEST_RETURN_TO_VAHLARRIEL); - return; + return new npc_dalindaAI(pCreature); } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) + struct npc_dalindaAI : public npc_escortAI + { + npc_dalindaAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 1: + me->IsStandState(); + break; + case 15: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); + break; + } + } + + void EnterCombat(Unit* /*pWho*/) { } + + void Reset() {} + + void JustDied(Unit* /*pKiller*/) + { + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->FailQuest(QUEST_RETURN_TO_VAHLARRIEL); return; - DoMeleeAttackIfReady(); - } + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_dalinda(Creature* pCreature) -{ - return new npc_dalindaAI(pCreature); -} -bool QuestAccept_npc_dalinda(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_RETURN_TO_VAHLARRIEL) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_dalindaAI, pCreature->AI())) - { - pEscortAI->Start(true, false, pPlayer->GetGUID()); - pCreature->setFaction(113); - } - } - return true; -} void AddSC_desolace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_aged_dying_ancient_kodo"; - newscript->GetAI = &GetAI_npc_aged_dying_ancient_kodo; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_aged_dying_ancient_kodo; - newscript->pGossipHello = &GossipHello_npc_aged_dying_ancient_kodo; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_iruxos"; - newscript->pGOHello = &GOHello_go_iruxos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dalinda"; - newscript->GetAI = &GetAI_npc_dalinda; - newscript->pQuestAccept = &QuestAccept_npc_dalinda; - newscript->RegisterSelf(); - + new npc_aged_dying_ancient_kodo(); + new go_iruxos(); + new npc_dalinda(); } diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index fd2ed655f05..7369f061cd7 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -36,69 +36,71 @@ enum LazyPeon SPELL_BUFF_SLEEP = 17743, SPELL_AWAKEN_PEON = 19938 }; - -struct npc_lazy_peonAI : public ScriptedAI + class npc_lazy_peon : public CreatureScript { - npc_lazy_peonAI(Creature *c) : ScriptedAI(c) {} +public: + npc_lazy_peon() : CreatureScript("npc_lazy_peon") { } - uint64 uiPlayerGUID; - - uint32 m_uiRebuffTimer; - bool work; - - void Reset () + CreatureAI* GetAI(Creature* pCreature) const { - uiPlayerGUID = 0; - work = false; + return new npc_lazy_peonAI(pCreature); } - void MovementInform(uint32 /*type*/, uint32 id) + struct npc_lazy_peonAI : public ScriptedAI { - if (id == 1) - work = true; - } + npc_lazy_peonAI(Creature *c) : ScriptedAI(c) {} - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER - && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE) + uint64 uiPlayerGUID; + + uint32 m_uiRebuffTimer; + bool work; + + void Reset () { - caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); - DoScriptText(SAY_SPELL_HIT, me, caster); - me->RemoveAllAuras(); - if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20)) - me->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ()); + uiPlayerGUID = 0; + work = false; } - } - void UpdateAI(const uint32 uiDiff) - { - if (work == true) - me->HandleEmoteCommand(466); - if (m_uiRebuffTimer <= uiDiff) + void MovementInform(uint32 /*type*/, uint32 id) { - DoCast(me, SPELL_BUFF_SLEEP); - m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + if (id == 1) + work = true; } - else - m_uiRebuffTimer -= uiDiff; - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER + && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE) + { + caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); + DoScriptText(SAY_SPELL_HIT, me, caster); + me->RemoveAllAuras(); + if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20)) + me->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ()); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (work == true) + me->HandleEmoteCommand(466); + if (m_uiRebuffTimer <= uiDiff) + { + DoCast(me, SPELL_BUFF_SLEEP); + m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + } + else + m_uiRebuffTimer -= uiDiff; + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_lazy_peon(Creature* pCreature) -{ - return new npc_lazy_peonAI(pCreature); -} void AddSC_durotar() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_lazy_peon"; - newscript->GetAI = &GetAI_npc_lazy_peon; - newscript->RegisterSelf(); -} \ No newline at end of file + new npc_lazy_peon(); +} diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index a5190cbdd30..827d2122621 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -51,63 +51,70 @@ enum eHuskSpirit NPC_RISEN_SPIRIT = 23554, NPC_RESTLESS_APPARITION = 23861 }; - -struct mobs_risen_husk_spiritAI : public ScriptedAI + class mobs_risen_husk_spirit : public CreatureScript { - mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_risen_husk_spirit() : CreatureScript("mobs_risen_husk_spirit") { } - uint32 m_uiConsumeFlesh_Timer; - uint32 m_uiIntangiblePresence_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiConsumeFlesh_Timer = 10000; - m_uiIntangiblePresence_Timer = 5000; + return new mobs_risen_husk_spiritAI (pCreature); } - void UpdateAI(const uint32 uiDiff) + struct mobs_risen_husk_spiritAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {} - if (m_uiConsumeFlesh_Timer <= uiDiff) + uint32 m_uiConsumeFlesh_Timer; + uint32 m_uiIntangiblePresence_Timer; + + void Reset() { - if (me->GetEntry() == NPC_RISEN_HUSK) - DoCast(me->getVictim(), SPELL_CONSUME_FLESH); - - m_uiConsumeFlesh_Timer = 15000; + m_uiConsumeFlesh_Timer = 10000; + m_uiIntangiblePresence_Timer = 5000; } - else - m_uiConsumeFlesh_Timer -= uiDiff; - if (m_uiIntangiblePresence_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (me->GetEntry() == NPC_RISEN_SPIRIT) - DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + if (!UpdateVictim()) + return; - m_uiIntangiblePresence_Timer = 20000; - } - else - m_uiIntangiblePresence_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* pKiller) - { - if (pKiller->GetTypeId() == TYPEID_PLAYER) - if (CAST_PLR(pKiller)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE) + if (m_uiConsumeFlesh_Timer <= uiDiff) { - DoCast(pKiller, SPELL_SUMMON_RESTLESS_APPARITION, true); - CAST_PLR(pKiller)->KilledMonsterCredit(NPC_RESTLESS_APPARITION,0); + if (me->GetEntry() == NPC_RISEN_HUSK) + DoCast(me->getVictim(), SPELL_CONSUME_FLESH); + + m_uiConsumeFlesh_Timer = 15000; } - } + else + m_uiConsumeFlesh_Timer -= uiDiff; + + if (m_uiIntangiblePresence_Timer <= uiDiff) + { + if (me->GetEntry() == NPC_RISEN_SPIRIT) + DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + + m_uiIntangiblePresence_Timer = 20000; + } + else + m_uiIntangiblePresence_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) + { + if (pKiller->GetTypeId() == TYPEID_PLAYER) + if (CAST_PLR(pKiller)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE) + { + DoCast(pKiller, SPELL_SUMMON_RESTLESS_APPARITION, true); + CAST_PLR(pKiller)->KilledMonsterCredit(NPC_RESTLESS_APPARITION,0); + } + } + }; + }; -CreatureAI* GetAI_mobs_risen_husk_spirit(Creature* pCreature) -{ - return new mobs_risen_husk_spiritAI (pCreature); -} /*###### ## npc_restless_apparition @@ -119,21 +126,28 @@ enum eRestlessApparition SAY_RESTLESS_2 = -1000470, SAY_RESTLESS_3 = -1000471 }; - -struct npc_restless_apparitionAI : public ScriptedAI + class npc_restless_apparition : public CreatureScript { - npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_restless_apparition() : CreatureScript("npc_restless_apparition") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_RESTLESS_1,SAY_RESTLESS_2,SAY_RESTLESS_3), me); + return new npc_restless_apparitionAI (pCreature); } + + struct npc_restless_apparitionAI : public ScriptedAI + { + npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + void Reset() + { + DoScriptText(RAND(SAY_RESTLESS_1,SAY_RESTLESS_2,SAY_RESTLESS_3), me); + } + }; + }; -CreatureAI* GetAI_npc_restless_apparition(Creature* pCreature) -{ - return new npc_restless_apparitionAI (pCreature); -} /*###### ## npc_deserter_agitator @@ -144,34 +158,42 @@ enum eAgitator QUEST_TRAITORS_AMONG_US = 11126, FACTION_THER_DESERTER = 1883 }; - -struct npc_deserter_agitatorAI : public ScriptedAI + class npc_deserter_agitator : public CreatureScript { - npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_deserter_agitator() : CreatureScript("npc_deserter_agitator") { } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->RestoreFaction(); + if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) + { + pCreature->setFaction(FACTION_THER_DESERTER); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_deserter_agitatorAI (pCreature); + } + + struct npc_deserter_agitatorAI : public ScriptedAI + { + npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + void Reset() + { + me->RestoreFaction(); + } + }; + }; -CreatureAI* GetAI_npc_deserter_agitator(Creature* pCreature) -{ - return new npc_deserter_agitatorAI (pCreature); -} -bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) - { - pCreature->setFaction(FACTION_THER_DESERTER); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} /*###### ## npc_lady_jaina_proudmoore @@ -184,29 +206,36 @@ enum eLadyJaina }; #define GOSSIP_ITEM_JAINA "I know this is rather silly but i have a young ward who is a bit shy and would like your autograph." - -bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature) + class npc_lady_jaina_proudmoore : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lady_jaina_proudmoore() : CreatureScript("npc_lady_jaina_proudmoore") { } - if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_SENDER_INFO) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->SEND_GOSSIP_MENU(7012, pCreature->GetGUID()); - pPlayer->CastSpell(pPlayer, SPELL_JAINAS_AUTOGRAPH, false); + if (uiAction == GOSSIP_SENDER_INFO) + { + pPlayer->SEND_GOSSIP_MENU(7012, pCreature->GetGUID()); + pPlayer->CastSpell(pPlayer, SPELL_JAINAS_AUTOGRAPH, false); + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_nat_pagle @@ -216,30 +245,37 @@ enum eNatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; - -bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature) + class npc_nat_pagle : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_nat_pagle() : CreatureScript("npc_nat_pagle") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(7640, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - else - pPlayer->SEND_GOSSIP_MENU(7638, pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(7640, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(7638, pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_private_hendel @@ -262,54 +298,62 @@ enum eHendel NPC_TERVOSH = 4967 }; -//TODO: develop this further, end event not created -struct npc_private_hendelAI : public ScriptedAI +//TODO: develop this further, end event not created class npc_private_hendel : public CreatureScript { - npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_private_hendel() : CreatureScript("npc_private_hendel") { } - void Reset() + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, const Quest* pQuest) { - me->RestoreFaction(); + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16) + pCreature->setFaction(FACTION_HOSTILE); + + return true; } - void AttackedBy(Unit* pAttacker) + CreatureAI* GetAI(Creature* pCreature) const { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); + return new npc_private_hendelAI(pCreature); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + struct npc_private_hendelAI : public ScriptedAI { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 20)) + npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + void Reset() { - uiDamage = 0; - - if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); - - DoScriptText(EMOTE_SURRENDER, me); - EnterEvadeMode(); + me->RestoreFaction(); } - } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; + + if (me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 20)) + { + uiDamage = 0; + + if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); + + DoScriptText(EMOTE_SURRENDER, me); + EnterEvadeMode(); + } + } + }; + }; -bool QuestAccept_npc_private_hendel(Player* /*pPlayer*/, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16) - pCreature->setFaction(FACTION_HOSTILE); - return true; -} - -CreatureAI* GetAI_npc_private_hendel(Creature* pCreature) -{ - return new npc_private_hendelAI(pCreature); -} /*###### ## npc_zelfrax @@ -322,106 +366,79 @@ enum eZelfrax SAY_ZELFRAX = -1000472, SAY_ZELFRAX_2 = -1000473 }; - -struct npc_zelfraxAI : public ScriptedAI + class npc_zelfrax : public CreatureScript { - npc_zelfraxAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_zelfrax() : CreatureScript("npc_zelfrax") { } + + CreatureAI* GetAI(Creature* pCreature) const { - MoveToDock(); + return new npc_zelfraxAI(pCreature); } - void AttackStart(Unit* pWho) + struct npc_zelfraxAI : public ScriptedAI { - if (!pWho) - return; - - if (me->Attack(pWho, true)) + npc_zelfraxAI(Creature* pCreature) : ScriptedAI(pCreature) { - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - - if (IsCombatMovement()) - me->GetMotionMaster()->MoveChase(pWho); + MoveToDock(); } - } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + void AttackStart(Unit* pWho) + { + if (!pWho) + return; - me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - SetCombatMovement(true); + if (me->Attack(pWho, true)) + { + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (me->isInCombat()) - if (Unit* pUnit = me->getVictim()) - me->GetMotionMaster()->MoveChase(pUnit); - } + if (IsCombatMovement()) + me->GetMotionMaster()->MoveChase(pWho); + } + } - void MoveToDock() - { - SetCombatMovement(false); - me->GetMotionMaster()->MovePoint(0,MovePosition); - DoScriptText(SAY_ZELFRAX,me); - DoScriptText(SAY_ZELFRAX_2,me); - } + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - void UpdateAI(uint32 const /*uiDiff*/) - { - if (!UpdateVictim()) - return; + me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + SetCombatMovement(true); + + if (me->isInCombat()) + if (Unit* pUnit = me->getVictim()) + me->GetMotionMaster()->MoveChase(pUnit); + } + + void MoveToDock() + { + SetCombatMovement(false); + me->GetMotionMaster()->MovePoint(0,MovePosition); + DoScriptText(SAY_ZELFRAX,me); + DoScriptText(SAY_ZELFRAX_2,me); + } + + void UpdateAI(uint32 const /*uiDiff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_zelfrax(Creature* pCreature) -{ - return new npc_zelfraxAI(pCreature); -} void AddSC_dustwallow_marsh() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_risen_husk_spirit"; - newscript->GetAI = &GetAI_mobs_risen_husk_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_restless_apparition"; - newscript->GetAI = &GetAI_npc_restless_apparition; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deserter_agitator"; - newscript->GetAI = &GetAI_npc_deserter_agitator; - newscript->pGossipHello = &GossipHello_npc_deserter_agitator; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lady_jaina_proudmoore"; - newscript->pGossipHello = &GossipHello_npc_lady_jaina_proudmoore; - newscript->pGossipSelect = &GossipSelect_npc_lady_jaina_proudmoore; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nat_pagle"; - newscript->pGossipHello = &GossipHello_npc_nat_pagle; - newscript->pGossipSelect = &GossipSelect_npc_nat_pagle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_private_hendel"; - newscript->GetAI = &GetAI_npc_private_hendel; - newscript->pQuestAccept = &QuestAccept_npc_private_hendel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zelfrax"; - newscript->GetAI = &GetAI_npc_zelfrax; - newscript->RegisterSelf(); + new mobs_risen_husk_spirit(); + new npc_restless_apparition(); + new npc_deserter_agitator(); + new npc_lady_jaina_proudmoore(); + new npc_nat_pagle(); + new npc_private_hendel(); + new npc_zelfrax(); } - diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index 66757e0de36..d08304a20a9 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -34,59 +34,59 @@ EndContentData */ ######*/ #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" - -bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature) + class npcs_riverbreeze_and_silversky : public CreatureScript { - uint32 eCreature = pCreature->GetEntry(); +public: + npcs_riverbreeze_and_silversky() : CreatureScript("npcs_riverbreeze_and_silversky") { } - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (eCreature == 9528) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (pPlayer->GetQuestRewardStatus(4101)) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(2848, pCreature->GetGUID()); - } else if (pPlayer->GetTeam() == HORDE) - pPlayer->SEND_GOSSIP_MENU(2845, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2844, pCreature->GetGUID()); + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 15120, false); + } + return true; } - if (eCreature == 9529) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestRewardStatus(4102)) + uint32 eCreature = pCreature->GetEntry(); + + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (eCreature == 9528) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(2849, pCreature->GetGUID()); - } else if (pPlayer->GetTeam() == ALLIANCE) - pPlayer->SEND_GOSSIP_MENU(2843, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2842, pCreature->GetGUID()); + if (pPlayer->GetQuestRewardStatus(4101)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(2848, pCreature->GetGUID()); + } else if (pPlayer->GetTeam() == HORDE) + pPlayer->SEND_GOSSIP_MENU(2845, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2844, pCreature->GetGUID()); + } + + if (eCreature == 9529) + { + if (pPlayer->GetQuestRewardStatus(4102)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(2849, pCreature->GetGUID()); + } else if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->SEND_GOSSIP_MENU(2843, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2842, pCreature->GetGUID()); + } + + return true; } - return true; -} +}; -bool GossipSelect_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 15120, false); - } - return true; -} void AddSC_felwood() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npcs_riverbreeze_and_silversky"; - newscript->pGossipHello = &GossipHello_npcs_riverbreeze_and_silversky; - newscript->pGossipSelect = &GossipSelect_npcs_riverbreeze_and_silversky; - newscript->RegisterSelf(); + new npcs_riverbreeze_and_silversky(); } - diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 86117e80616..94a64bc8a58 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -31,30 +31,37 @@ EndScriptData */ ######*/ #define GOSSIP_HELLO "Buy somethin', will ya?" - -bool GossipHello_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature) + class npc_gregan_brewspewer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_gregan_brewspewer() : CreatureScript("npc_gregan_brewspewer") { } - if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(2434, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(2434, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; } - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_oox22fe @@ -80,105 +87,119 @@ enum eOOX FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - -struct npc_oox22feAI : public npc_escortAI + class npc_oox22fe : public CreatureScript { - npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_oox22fe() : CreatureScript("npc_oox22fe") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch (i) + if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE) { - // First Ambush(3 Yetis) - case 11: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_YETI, -4841.01, 1593.91, 73.42, 3.98, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_YETI, -4837.61, 1568.58, 78.21, 3.13, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_YETI, -4841.89, 1569.95, 76.53, 0.68, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - //Second Ambush(3 Gorillas) - case 21: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_GORILLA, -4595.81, 2005.99, 53.08, 3.74, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_GORILLA, -4597.53, 2008.31, 52.70, 3.78, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_GORILLA, -4599.37, 2010.59, 52.77, 3.84, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - //Third Ambush(4 Gnolls) - case 30: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_WOODPAW_REAVER, -4425.14, 2075.87, 47.77, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_BRUTE , -4426.68, 2077.98, 47.57, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33, 2080.24, 47.43, 3.87, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_ALPHA , -4430.04, 2075.54, 46.83, 3.81, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - case 37: - DoScriptText(SAY_OOX_END, me); - // Award quest credit - if (Player* pPlayer = GetPlayerForEscort()) - { - pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); - } - break; + DoScriptText(SAY_OOX_START, pCreature); + //change that the npc is not lying dead on the ground + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + + if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_oox22fe::npc_oox22feAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - me->SetStandState(UNIT_STAND_STATE_DEAD); + return new npc_oox22feAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_oox22feAI : public npc_escortAI { - //For an small probability the npc says something when he get aggro - if (urand(0,9) > 7) - DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); - } + npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void WaypointReached(uint32 i) + { + switch (i) + { + // First Ambush(3 Yetis) + case 11: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_YETI, -4841.01, 1593.91, 73.42, 3.98, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_YETI, -4837.61, 1568.58, 78.21, 3.13, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_YETI, -4841.89, 1569.95, 76.53, 0.68, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + //Second Ambush(3 Gorillas) + case 21: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_GORILLA, -4595.81, 2005.99, 53.08, 3.74, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_GORILLA, -4597.53, 2008.31, 52.70, 3.78, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_GORILLA, -4599.37, 2010.59, 52.77, 3.84, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + //Third Ambush(4 Gnolls) + case 30: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_WOODPAW_REAVER, -4425.14, 2075.87, 47.77, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_BRUTE , -4426.68, 2077.98, 47.57, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33, 2080.24, 47.43, 3.87, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_ALPHA , -4430.04, 2075.54, 46.83, 3.81, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + case 37: + DoScriptText(SAY_OOX_END, me); + // Award quest credit + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); + } + break; + } + } + + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + me->SetStandState(UNIT_STAND_STATE_DEAD); + } + + void EnterCombat(Unit* /*who*/) + { + //For an small probability the npc says something when he get aggro + if (urand(0,9) > 7) + DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + }; - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(me); - } }; -CreatureAI* GetAI_npc_oox22fe(Creature* pCreature) -{ - return new npc_oox22feAI(pCreature); -} -bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE) - { - DoScriptText(SAY_OOX_START, pCreature); - //change that the npc is not lying dead on the ground - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - - if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORTEE_A); - - if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORTEE_H); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_oox22feAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - - } - return true; -} /*###### ## npc_screecher_spirit ######*/ - -bool GossipHello_npc_screecher_spirit(Player* pPlayer, Creature* pCreature) + class npc_screecher_spirit : public CreatureScript { - pPlayer->SEND_GOSSIP_MENU(2039, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +public: + npc_screecher_spirit() : CreatureScript("npc_screecher_spirit") { } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->SEND_GOSSIP_MENU(2039, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + return true; + } + +}; /*###### ## AddSC @@ -186,23 +207,7 @@ bool GossipHello_npc_screecher_spirit(Player* pPlayer, Creature* pCreature) void AddSC_feralas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_gregan_brewspewer"; - newscript->pGossipHello = &GossipHello_npc_gregan_brewspewer; - newscript->pGossipSelect = &GossipSelect_npc_gregan_brewspewer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_oox22fe"; - newscript->GetAI = &GetAI_npc_oox22fe; - newscript->pQuestAccept = &QuestAccept_npc_oox22fe; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_screecher_spirit"; - newscript->pGossipHello = &GossipHello_npc_screecher_spirit; - newscript->RegisterSelf(); + new npc_gregan_brewspewer(); + new npc_oox22fe(); + new npc_screecher_spirit(); } - diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 75f484abc15..adbe055300f 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -48,48 +48,55 @@ enum eBunthen #define GOSSIP_ITEM_THUNDER "I'd like to fly to Thunder Bluff." #define GOSSIP_ITEM_AQ_END "Do you know where I can find Half Pendant of Aquatic Endurance?" - -bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) + class npc_bunthen_plainswind : public CreatureScript { - if (pPlayer->getClass() != CLASS_DRUID) - pPlayer->SEND_GOSSIP_MENU(4916, pCreature->GetGUID()); - else if (pPlayer->GetTeam() != HORDE) +public: + npc_bunthen_plainswind() : CreatureScript("npc_bunthen_plainswind") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->SEND_GOSSIP_MENU(5373, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(5376, pCreature->GetGUID()); + break; + } + return true; } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->getClass() != CLASS_DRUID) + pPlayer->SEND_GOSSIP_MENU(4916, pCreature->GetGUID()); + else if (pPlayer->GetTeam() != HORDE) + { + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); + } + else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4918, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + pPlayer->SEND_GOSSIP_MENU(4918, pCreature->GetGUID()); + } + return true; } - return true; -} -bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) - pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->SEND_GOSSIP_MENU(5373, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(5376, pCreature->GetGUID()); - break; - } - return true; -} +}; + /*###### ## npc_great_bear_spirit @@ -99,47 +106,54 @@ bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, u #define GOSSIP_BEAR2 "I seek to understand the importance of strength of the body." #define GOSSIP_BEAR3 "I seek to understand the importance of strength of the heart." #define GOSSIP_BEAR4 "I have heard your words, Great Bear Spirit, and I understand. I now seek your blessings to fully learn the way of the Claw." - -bool GossipHello_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature) + class npc_great_bear_spirit : public CreatureScript { - //ally or horde quest - if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(4719, pCreature->GetGUID()); - } - else - pPlayer->SEND_GOSSIP_MENU(4718, pCreature->GetGUID()); +public: + npc_great_bear_spirit() : CreatureScript("npc_great_bear_spirit") { } - return true; -} - -bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4721, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4733, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4734, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(4735, pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(5929); - if (pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(5930); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(4721, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(4733, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4734, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(4735, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(5929); + if (pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(5930); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + //ally or horde quest + if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(4719, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(4718, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_silva_filnaveth @@ -147,48 +161,55 @@ bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, ui #define GOSSIP_ITEM_RUTHERAN "I'd like to fly to Rut'theran Village." #define GOSSIP_ITEM_AQ_AGI "Do you know where I can find Half Pendant of Aquatic Agility?" - -bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) + class npc_silva_filnaveth : public CreatureScript { - if (pPlayer->getClass() != CLASS_DRUID) - pPlayer->SEND_GOSSIP_MENU(4913, pCreature->GetGUID()); - else if (pPlayer->GetTeam() != ALLIANCE) +public: + npc_silva_filnaveth() : CreatureScript("npc_silva_filnaveth") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - - pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->SEND_GOSSIP_MENU(5374, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(5375, pCreature->GetGUID()); + break; + } + return true; } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->getClass() != CLASS_DRUID) + pPlayer->SEND_GOSSIP_MENU(4913, pCreature->GetGUID()); + else if (pPlayer->GetTeam() != ALLIANCE) + { + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); + } + else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4914, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + pPlayer->SEND_GOSSIP_MENU(4914, pCreature->GetGUID()); + } + return true; } - return true; -} -bool GossipSelect_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) - pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->SEND_GOSSIP_MENU(5374, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(5375, pCreature->GetGUID()); - break; - } - return true; -} +}; + /*###### ## npc_clintar_spirit @@ -258,281 +279,294 @@ float Clintar_spirit_WP[41][5] = #define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 #define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 #define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 - -struct npc_clintar_spiritAI : public npc_escortAI + class npc_clintar_spirit : public CreatureScript { public: - npc_clintar_spiritAI(Creature *c) : npc_escortAI(c) {} + npc_clintar_spirit() : CreatureScript("npc_clintar_spirit") { } - uint32 Step; - uint32 CurrWP; - uint32 Event_Timer; - uint32 checkPlayer_Timer; - - uint64 PlayerGUID; - - bool Event_onWait; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!PlayerGUID) - { - Step = 0; - CurrWP = 0; - Event_Timer = 0; - PlayerGUID = 0; - checkPlayer_Timer = 1000; - Event_onWait = false; - } + return new npc_clintar_spiritAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct npc_clintar_spiritAI : public npc_escortAI { - if (!PlayerGUID) - return; + public: + npc_clintar_spiritAI(Creature *c) : npc_escortAI(c) {} - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->FailQuest(10965); - PlayerGUID = 0; - Reset(); - } - } + uint32 Step; + uint32 CurrWP; + uint32 Event_Timer; + uint32 checkPlayer_Timer; - void EnterEvadeMode() - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) - { - AttackStart(pPlayer->getAttackerForHelper()); - return; - } - npc_escortAI::EnterEvadeMode(); - } + uint64 PlayerGUID; - void EnterCombat(Unit* who) - { - uint32 rnd = rand()%2; - switch(rnd) - { - case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; - case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; - } - } + bool Event_onWait; - void StartEvent(Player* pPlayer) - { - if (!pPlayer) - return; - if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + void Reset() { - for (uint8 i = 0; i < 41; ++i) + if (!PlayerGUID) { - AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); - } - PlayerGUID = pPlayer->GetGUID(); - Start(true,false,PlayerGUID); - } - return; - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (!PlayerGUID) - { - me->setDeathState(JUST_DIED); - return; - } - - if (!me->isInCombat() && !Event_onWait) - { - if (checkPlayer_Timer <= diff) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) - AttackStart(pPlayer->getAttackerForHelper()); + Step = 0; + CurrWP = 0; + Event_Timer = 0; + PlayerGUID = 0; checkPlayer_Timer = 1000; - } else checkPlayer_Timer -= diff; + Event_onWait = false; + } } - if (Event_onWait && Event_Timer <= diff) + void JustDied(Unit * /*killer*/) { + if (!PlayerGUID) + return; Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) + if (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->FailQuest(10965); + PlayerGUID = 0; + Reset(); + } + } + + void EnterEvadeMode() + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) + { + AttackStart(pPlayer->getAttackerForHelper()); + return; + } + npc_escortAI::EnterEvadeMode(); + } + + void EnterCombat(Unit* who) + { + uint32 rnd = rand()%2; + switch(rnd) + { + case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; + case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; + } + } + + void StartEvent(Player* pPlayer) + { + if (!pPlayer) + return; + if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + { + for (uint8 i = 0; i < 41; ++i) + { + AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); + } + PlayerGUID = pPlayer->GetGUID(); + Start(true,false,PlayerGUID); + } + return; + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + if (!PlayerGUID) { me->setDeathState(JUST_DIED); return; } - switch(CurrWP) + if (!me->isInCombat() && !Event_onWait) { - case 0: - switch(Step) - { - case 0: - me->Say(CLINTAR_SPIRIT_SAY_START,0,PlayerGUID); - Event_Timer = 8000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 6: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, pPlayer); - Event_onWait = false; - break; - } - break; - case 15: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; - break; - } - break; - case 16: - switch(Step) - { - case 0: - DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, pPlayer); - Event_Timer = 15000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 20: - switch(Step) - { - case 0: - { - Creature *mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); - if (mob) - { - mob->AddThreat(me,10000.0f); - mob->AI()->AttackStart(me); - } - Event_Timer = 2000; - Step = 1; - break; - } - case 1: - Event_onWait = false; - break; - } - break; - case 24: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; - break; - } - break; - case 25: - switch(Step) - { - case 0: - DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, pPlayer); - Event_Timer = 4000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 40: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); - DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, pPlayer); - pPlayer->CompleteQuest(10965); - Event_Timer = 1500; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_Timer = 3000; - Step = 2; - break; - case 2: - pPlayer->TalkedToCreature(me->GetEntry(), me->GetGUID()); - PlayerGUID = 0; - Reset(); - me->setDeathState(JUST_DIED); - break; - } - break; - default: - Event_onWait = false; - break; + if (checkPlayer_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) + AttackStart(pPlayer->getAttackerForHelper()); + checkPlayer_Timer = 1000; + } else checkPlayer_Timer -= diff; } - } else if (Event_onWait) Event_Timer -= diff; - } + if (Event_onWait && Event_Timer <= diff) + { + + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) + { + me->setDeathState(JUST_DIED); + return; + } + + switch(CurrWP) + { + case 0: + switch(Step) + { + case 0: + me->Say(CLINTAR_SPIRIT_SAY_START,0,PlayerGUID); + Event_Timer = 8000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 6: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, pPlayer); + Event_onWait = false; + break; + } + break; + case 15: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_onWait = false; + break; + } + break; + case 16: + switch(Step) + { + case 0: + DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, pPlayer); + Event_Timer = 15000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 20: + switch(Step) + { + case 0: + { + Creature *mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); + if (mob) + { + mob->AddThreat(me,10000.0f); + mob->AI()->AttackStart(me); + } + Event_Timer = 2000; + Step = 1; + break; + } + case 1: + Event_onWait = false; + break; + } + break; + case 24: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_onWait = false; + break; + } + break; + case 25: + switch(Step) + { + case 0: + DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, pPlayer); + Event_Timer = 4000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 40: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, pPlayer); + pPlayer->CompleteQuest(10965); + Event_Timer = 1500; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_Timer = 3000; + Step = 2; + break; + case 2: + pPlayer->TalkedToCreature(me->GetEntry(), me->GetGUID()); + PlayerGUID = 0; + Reset(); + me->setDeathState(JUST_DIED); + break; + } + break; + default: + Event_onWait = false; + break; + } + + } else if (Event_onWait) Event_Timer -= diff; + } + + void WaypointReached(uint32 id) + { + CurrWP = id; + Event_Timer = 0; + Step = 0; + Event_onWait = true; + } + }; - void WaypointReached(uint32 id) - { - CurrWP = id; - Event_Timer = 0; - Step = 0; - Event_onWait = true; - } }; -CreatureAI* GetAI_npc_clintar_spirit(Creature* pCreature) -{ - return new npc_clintar_spiritAI (pCreature); -} /*#### # npc_clintar_dreamwalker ####*/ #define CLINTAR_SPIRIT 22916 - -bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Quest const *quest) + class npc_clintar_dreamwalker : public CreatureScript { - if (quest->GetQuestId() == 10965) +public: + npc_clintar_dreamwalker() : CreatureScript("npc_clintar_dreamwalker") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { - Creature *clintar_spirit = pCreature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); - if (clintar_spirit) - CAST_AI(npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(pPlayer); + if (quest->GetQuestId() == 10965) + { + Creature *clintar_spirit = pCreature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); + if (clintar_spirit) + CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(pPlayer); + } + return true; } - return true; -} + +}; /*#### # @@ -540,34 +574,9 @@ bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Q void AddSC_moonglade() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_bunthen_plainswind"; - newscript->pGossipHello = &GossipHello_npc_bunthen_plainswind; - newscript->pGossipSelect = &GossipSelect_npc_bunthen_plainswind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_great_bear_spirit"; - newscript->pGossipHello = &GossipHello_npc_great_bear_spirit; - newscript->pGossipSelect = &GossipSelect_npc_great_bear_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_silva_filnaveth"; - newscript->pGossipHello = &GossipHello_npc_silva_filnaveth; - newscript->pGossipSelect = &GossipSelect_npc_silva_filnaveth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_clintar_dreamwalker"; - newscript->pQuestAccept = &QuestAccept_npc_clintar_dreamwalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_clintar_spirit"; - newscript->GetAI = &GetAI_npc_clintar_spirit; - newscript->RegisterSelf(); + new npc_bunthen_plainswind(); + new npc_great_bear_spirit(); + new npc_silva_filnaveth(); + new npc_clintar_dreamwalker(); + new npc_clintar_spirit(); } - diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index 0021643eb53..049abbce363 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -37,27 +37,34 @@ EndContentData */ ######*/ #define GOSSIP_SW "Tell me a story, Skorn." - -bool GossipHello_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature) + class npc_skorn_whitecloud : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_skorn_whitecloud() : CreatureScript("npc_skorn_whitecloud") { } - if (!pPlayer->GetQuestRewardStatus(770)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + pPlayer->SEND_GOSSIP_MENU(523, pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(522, pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - pPlayer->SEND_GOSSIP_MENU(523, pCreature->GetGUID()); + if (!pPlayer->GetQuestRewardStatus(770)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(522, pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*##### # npc_kyle_frenzied @@ -75,114 +82,121 @@ enum eKyleFrenzied NPC_KYLE_FRIENDLY = 23622, POINT_ID = 1 }; - -struct npc_kyle_frenziedAI : public ScriptedAI + class npc_kyle_frenzied : public CreatureScript { - npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} +public: + npc_kyle_frenzied() : CreatureScript("npc_kyle_frenzied") { } - bool bEvent; - bool m_bIsMovingToLunch; - uint64 uiPlayerGUID; - uint32 uiEventTimer; - uint8 uiEventPhase; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - bEvent = false; - m_bIsMovingToLunch = false; - uiPlayerGUID = 0; - uiEventTimer = 5000; - uiEventPhase = 0; - - if (me->GetEntry() == NPC_KYLE_FRIENDLY) - me->UpdateEntry(NPC_KYLE_FRENZIED); + return new npc_kyle_frenziedAI (pCreature); } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + struct npc_kyle_frenziedAI : public ScriptedAI { - if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} + + bool bEvent; + bool m_bIsMovingToLunch; + uint64 uiPlayerGUID; + uint32 uiEventTimer; + uint8 uiEventPhase; + + void Reset() { - if (pCaster->GetTypeId() == TYPEID_PLAYER) - uiPlayerGUID = pCaster->GetGUID(); - - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - { - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - } - - bEvent = true; - DoScriptText(EMOTE_SEE_LUNCH, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); - } - } - - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE || !bEvent) - return; - - if (uiPointId == POINT_ID) + bEvent = false; m_bIsMovingToLunch = false; - } + uiPlayerGUID = 0; + uiEventTimer = 5000; + uiEventPhase = 0; - void UpdateAI(const uint32 diff) - { - if (bEvent) + if (me->GetEntry() == NPC_KYLE_FRIENDLY) + me->UpdateEntry(NPC_KYLE_FRENZIED); + } + + void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { - if (m_bIsMovingToLunch) + if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + { + if (pCaster->GetTypeId() == TYPEID_PLAYER) + uiPlayerGUID = pCaster->GetGUID(); + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + } + + bEvent = true; + DoScriptText(EMOTE_SEE_LUNCH, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); + } + } + + void MovementInform(uint32 uiType, uint32 uiPointId) + { + if (uiType != POINT_MOTION_TYPE || !bEvent) return; - if (uiEventTimer <= diff) - { - uiEventTimer = 5000; - ++uiEventPhase; - - switch(uiEventPhase) - { - case 1: - if (Unit* pUnit = Unit::GetUnit(*me,uiPlayerGUID)) - { - if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) - { - m_bIsMovingToLunch = true; - me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); - } - } - break; - case 2: - DoScriptText(EMOTE_EAT_LUNCH, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); - break; - case 3: - if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID)) - pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID()); - - me->UpdateEntry(NPC_KYLE_FRIENDLY); - break; - case 4: - uiEventTimer = 30000; - DoScriptText(EMOTE_DANCE, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); - break; - case 5: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - Reset(); - me->GetMotionMaster()->Clear(); - break; - } - } - else - uiEventTimer -= diff; + if (uiPointId == POINT_ID) + m_bIsMovingToLunch = false; } - } + + void UpdateAI(const uint32 diff) + { + if (bEvent) + { + if (m_bIsMovingToLunch) + return; + + if (uiEventTimer <= diff) + { + uiEventTimer = 5000; + ++uiEventPhase; + + switch(uiEventPhase) + { + case 1: + if (Unit* pUnit = Unit::GetUnit(*me,uiPlayerGUID)) + { + if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) + { + m_bIsMovingToLunch = true; + me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); + } + } + break; + case 2: + DoScriptText(EMOTE_EAT_LUNCH, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + break; + case 3: + if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID)) + pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID()); + + me->UpdateEntry(NPC_KYLE_FRIENDLY); + break; + case 4: + uiEventTimer = 30000; + DoScriptText(EMOTE_DANCE, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); + break; + case 5: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + Reset(); + me->GetMotionMaster()->Clear(); + break; + } + } + else + uiEventTimer -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_kyle_frenzied(Creature* pCreature) -{ - return new npc_kyle_frenziedAI (pCreature); -} /*##### # npc_plains_vision @@ -241,55 +255,62 @@ float wp_plain_vision[50][3] = {-1511.39, 362.537, 62.4539}, {-1508.68, 366.822, 62.733} }; - -struct npc_plains_visionAI : public ScriptedAI + class npc_plains_vision : public CreatureScript { - npc_plains_visionAI(Creature *c) : ScriptedAI(c) {} +public: + npc_plains_vision() : CreatureScript("npc_plains_vision") { } - bool newWaypoint; - uint8 WayPointId; - uint8 amountWP; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WayPointId = 0; - newWaypoint = true; - amountWP = 49; + return new npc_plains_visionAI (pCreature); } - void EnterCombat(Unit* /*who*/){} - - void MovementInform(uint32 type, uint32 id) + struct npc_plains_visionAI : public ScriptedAI { - if (type != POINT_MOTION_TYPE) - return; + npc_plains_visionAI(Creature *c) : ScriptedAI(c) {} - if (id < amountWP) + bool newWaypoint; + uint8 WayPointId; + uint8 amountWP; + + void Reset() { - ++WayPointId; + WayPointId = 0; newWaypoint = true; + amountWP = 49; } - else - { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - } - } - void UpdateAI(const uint32 /*diff*/) - { - if (newWaypoint) + void EnterCombat(Unit* /*who*/){} + + void MovementInform(uint32 type, uint32 id) { - me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); - newWaypoint = false; + if (type != POINT_MOTION_TYPE) + return; + + if (id < amountWP) + { + ++WayPointId; + newWaypoint = true; + } + else + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + } } - } + + void UpdateAI(const uint32 /*diff*/) + { + if (newWaypoint) + { + me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); + newWaypoint = false; + } + } + }; + }; -CreatureAI* GetAI_npc_plains_vision(Creature* pCreature) -{ - return new npc_plains_visionAI (pCreature); -} /*##### # @@ -297,22 +318,7 @@ CreatureAI* GetAI_npc_plains_vision(Creature* pCreature) void AddSC_mulgore() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_skorn_whitecloud"; - newscript->pGossipHello = &GossipHello_npc_skorn_whitecloud; - newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kyle_frenzied"; - newscript->GetAI = &GetAI_npc_kyle_frenzied; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_plains_vision"; - newscript->GetAI = &GetAI_npc_plains_vision; - newscript->RegisterSelf(); + new npc_skorn_whitecloud(); + new npc_kyle_frenzied(); + new npc_plains_vision(); } - diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index 24879f9e38f..e8ab1a6e241 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -38,34 +38,41 @@ EndContentData */ #define QUEST_5727 5727 #define GOSSIP_HNF "You may speak frankly, Neeru..." -#define GOSSIP_SNF "[PH] ..." -bool GossipHello_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature) +#define GOSSIP_SNF "[PH] ..." class npc_neeru_fireblade : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_neeru_fireblade() : CreatureScript("npc_neeru_fireblade") { } - if (pPlayer->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(QUEST_5727); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(QUEST_5727); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_shenthul @@ -75,86 +82,94 @@ enum eShenthul { QUEST_SHATTERED_SALUTE = 2460 }; - -struct npc_shenthulAI : public ScriptedAI + class npc_shenthul : public CreatureScript { - npc_shenthulAI(Creature* c) : ScriptedAI(c) {} +public: + npc_shenthul() : CreatureScript("npc_shenthul") { } - bool CanTalk; - bool CanEmote; - uint32 Salute_Timer; - uint32 Reset_Timer; - uint64 PlayerGUID; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - CanTalk = false; - CanEmote = false; - Salute_Timer = 6000; - Reset_Timer = 0; - PlayerGUID = 0; + if (quest->GetQuestId() == QUEST_SHATTERED_SALUTE) + { + CAST_AI(npc_shenthul::npc_shenthulAI, pCreature->AI())->CanTalk = true; + CAST_AI(npc_shenthul::npc_shenthulAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + } + return true; } - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (CanEmote) - { - if (Reset_Timer <= diff) - { - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - { - if (pPlayer->GetTypeId() == TYPEID_PLAYER && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_SHATTERED_SALUTE); - } - Reset(); - } else Reset_Timer -= diff; - } - - if (CanTalk && !CanEmote) - { - if (Salute_Timer <= diff) - { - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - CanEmote = true; - Reset_Timer = 60000; - } else Salute_Timer -= diff; - } - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + return new npc_shenthulAI (pCreature); } - void ReceiveEmote(Player* pPlayer, uint32 emote) + struct npc_shenthulAI : public ScriptedAI { - if (emote == TEXTEMOTE_SALUTE && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) + npc_shenthulAI(Creature* c) : ScriptedAI(c) {} + + bool CanTalk; + bool CanEmote; + uint32 Salute_Timer; + uint32 Reset_Timer; + uint64 PlayerGUID; + + void Reset() + { + CanTalk = false; + CanEmote = false; + Salute_Timer = 6000; + Reset_Timer = 0; + PlayerGUID = 0; + } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { if (CanEmote) { - pPlayer->AreaExploredOrEventHappens(QUEST_SHATTERED_SALUTE); - Reset(); + if (Reset_Timer <= diff) + { + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_SHATTERED_SALUTE); + } + Reset(); + } else Reset_Timer -= diff; + } + + if (CanTalk && !CanEmote) + { + if (Salute_Timer <= diff) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + CanEmote = true; + Reset_Timer = 60000; + } else Salute_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void ReceiveEmote(Player* pPlayer, uint32 emote) + { + if (emote == TEXTEMOTE_SALUTE && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) + { + if (CanEmote) + { + pPlayer->AreaExploredOrEventHappens(QUEST_SHATTERED_SALUTE); + Reset(); + } } } - } + }; + }; -CreatureAI* GetAI_npc_shenthul(Creature* pCreature) -{ - return new npc_shenthulAI (pCreature); -} -bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_SHATTERED_SALUTE) - { - CAST_AI(npc_shenthulAI, pCreature->AI())->CanTalk = true; - CAST_AI(npc_shenthulAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - return true; -} /*###### ## npc_thrall_warchief @@ -173,116 +188,107 @@ bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* #define GOSSIP_STW5 "I live only to serve, Warchief! My life is empty and meaningless without your guidance." #define GOSSIP_STW6 "Of course, Warchief!" -//TODO: verify abilities/timers -struct npc_thrall_warchiefAI : public ScriptedAI +//TODO: verify abilities/timers class npc_thrall_warchief : public CreatureScript { - npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} +public: + npc_thrall_warchief() : CreatureScript("npc_thrall_warchief") { } - uint32 ChainLightning_Timer; - uint32 Shock_Timer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - ChainLightning_Timer = 2000; - Shock_Timer = 8000; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(5733, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(5734, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(5735, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(5736, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(5737, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->SEND_GOSSIP_MENU(5738, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(QUEST_6566); + break; + } + return true; } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!UpdateVictim()) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (ChainLightning_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 9000; - } else ChainLightning_Timer -= diff; + if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (Shock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 15000; - } else Shock_Timer -= diff; - - DoMeleeAttackIfReady(); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_thrall_warchiefAI (pCreature); + } + + struct npc_thrall_warchiefAI : public ScriptedAI + { + npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} + + uint32 ChainLightning_Timer; + uint32 Shock_Timer; + + void Reset() + { + ChainLightning_Timer = 2000; + Shock_Timer = 8000; + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (ChainLightning_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + ChainLightning_Timer = 9000; + } else ChainLightning_Timer -= diff; + + if (Shock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOCK); + Shock_Timer = 15000; + } else Shock_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_thrall_warchief(Creature* pCreature) -{ - return new npc_thrall_warchiefAI (pCreature); -} -bool GossipHello_npc_thrall_warchief(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_thrall_warchief(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(5733, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(5734, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(5735, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(5736, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(5737, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - pPlayer->SEND_GOSSIP_MENU(5738, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(QUEST_6566); - break; - } - return true; -} void AddSC_orgrimmar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_neeru_fireblade"; - newscript->pGossipHello = &GossipHello_npc_neeru_fireblade; - newscript->pGossipSelect = &GossipSelect_npc_neeru_fireblade; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shenthul"; - newscript->GetAI = &GetAI_npc_shenthul; - newscript->pQuestAccept = &QuestAccept_npc_shenthul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall_warchief"; - newscript->GetAI = &GetAI_npc_thrall_warchief; - newscript->pGossipHello = &GossipHello_npc_thrall_warchief; - newscript->pGossipSelect = &GossipSelect_npc_thrall_warchief; - newscript->RegisterSelf(); + new npc_neeru_fireblade(); + new npc_shenthul(); + new npc_thrall_warchief(); } - diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index f96c8140772..f86d5dfd4a1 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -42,59 +42,66 @@ EndContentData */ #define GOSSIP_DEMITRIAN5 "" #define GOSSIP_DEMITRIAN6 "Caught unaware? How?" #define GOSSIP_DEMITRIAN7 "So what did Ragnaros do next?" - -bool GossipHello_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature) + class npc_highlord_demitrian : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_highlord_demitrian() : CreatureScript("npc_highlord_demitrian") { } - if (pPlayer->GetQuestStatus(7785) == QUEST_STATUS_NONE && - (pPlayer->HasItemCount(18563,1,false) || pPlayer->HasItemCount(18564,1,false))) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(6812, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(6842, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(6843, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(6844, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(6867, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(6868, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(6869, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->SEND_GOSSIP_MENU(6870, pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(6842, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(6843, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(6844, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(6867, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(6868, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(6869, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->SEND_GOSSIP_MENU(6870, pCreature->GetGUID()); - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, 19016, true); - break; + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, 19016, true); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(7785) == QUEST_STATUS_NONE && + (pPlayer->HasItemCount(18563,1,false) || pPlayer->HasItemCount(18564,1,false))) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(6812, pCreature->GetGUID()); + return true; + } + +}; + /*### ## npcs_rutgar_and_frankal @@ -119,89 +126,96 @@ bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, u //trigger creatures to kill #define TRIGGER_RUTGAR 15222 #define TRIGGER_FRANKAL 15221 - -bool GossipHello_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature) + class npcs_rutgar_and_frankal : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npcs_rutgar_and_frankal() : CreatureScript("npcs_rutgar_and_frankal") { } - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && - pCreature->GetEntry() == 15170 && - !pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && - pCreature->GetEntry() == 15171 && - pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); - - pPlayer->SEND_GOSSIP_MENU(7754, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(7755, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(7756, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(7757, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(7758, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(7759, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(7760, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - pPlayer->SEND_GOSSIP_MENU(7761, pCreature->GetGUID()); - //'kill' our trigger to update quest status - pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(7755, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(7756, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(7757, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(7758, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(7759, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(7760, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + pPlayer->SEND_GOSSIP_MENU(7761, pCreature->GetGUID()); + //'kill' our trigger to update quest status + pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID()); + break; - case GOSSIP_ACTION_INFO_DEF + 9: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(7762, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM12, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(7763, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 11: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM13, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(7764, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 12: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM14, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - pPlayer->SEND_GOSSIP_MENU(7765, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 13: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM15, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - pPlayer->SEND_GOSSIP_MENU(7766, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 14: - pPlayer->SEND_GOSSIP_MENU(7767, pCreature->GetGUID()); - //'kill' our trigger to update quest status - pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, pCreature->GetGUID()); - break; + case GOSSIP_ACTION_INFO_DEF + 9: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(7762, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM12, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(7763, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 11: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM13, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + pPlayer->SEND_GOSSIP_MENU(7764, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 12: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM14, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + pPlayer->SEND_GOSSIP_MENU(7765, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 13: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM15, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + pPlayer->SEND_GOSSIP_MENU(7766, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 14: + pPlayer->SEND_GOSSIP_MENU(7767, pCreature->GetGUID()); + //'kill' our trigger to update quest status + pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, pCreature->GetGUID()); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && + pCreature->GetEntry() == 15170 && + !pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && + pCreature->GetEntry() == 15171 && + pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); + + pPlayer->SEND_GOSSIP_MENU(7754, pCreature->GetGUID()); + + return true; + } + +}; + /*#### # quest_a_pawn_on_the_eternal_board (Defines) @@ -467,676 +481,674 @@ static SpawnSpells SpawnCast[]=// }; /*##### # npc_anachronos_the_ancient -######*/ -struct npc_anachronos_the_ancientAI : public ScriptedAI +######*/ class npc_anachronos_the_ancient : public CreatureScript { - npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} +public: + npc_anachronos_the_ancient() : CreatureScript("npc_anachronos_the_ancient") { } - uint32 AnimationTimer; - uint8 AnimationCount; - - uint64 AnachronosQuestTriggerGUID; - uint64 MerithraGUID; - uint64 ArygosGUID; - uint64 CaelestraszGUID; - uint64 FandralGUID; - uint64 PlayerGUID; - bool eventEnd; - - void Reset() + CreatureAI* GetAI(Creature* c) { - AnimationTimer = 1500; - AnimationCount = 0; - AnachronosQuestTriggerGUID = 0; - MerithraGUID = 0; - ArygosGUID = 0; - CaelestraszGUID = 0; - FandralGUID = 0; - PlayerGUID = 0; - eventEnd = false; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + return new npc_anachronos_the_ancientAI(c); } - void HandleAnimation() + struct npc_anachronos_the_ancientAI : public ScriptedAI { - Player* plr = Unit::GetPlayer(*me, PlayerGUID); - if (!plr) - return; + npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} - Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, me); - Unit* Arygos = plr->FindNearestCreature(C_ARYGOS, 100,me); - Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, me); - Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,me); + uint32 AnimationTimer; + uint8 AnimationCount; - if (!Fandral || !Arygos || !Caelestrasz || !Merithra) - return; + uint64 AnachronosQuestTriggerGUID; + uint64 MerithraGUID; + uint64 ArygosGUID; + uint64 CaelestraszGUID; + uint64 FandralGUID; + uint64 PlayerGUID; + bool eventEnd; - Unit* mob; - AnimationTimer = EventAnim[AnimationCount].Timer; - if (eventEnd == false) + void Reset() { - switch(AnimationCount) + AnimationTimer = 1500; + AnimationCount = 0; + AnachronosQuestTriggerGUID = 0; + MerithraGUID = 0; + ArygosGUID = 0; + CaelestraszGUID = 0; + FandralGUID = 0; + PlayerGUID = 0; + eventEnd = false; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void HandleAnimation() + { + Player* plr = Unit::GetPlayer(*me, PlayerGUID); + if (!plr) + return; + + Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, me); + Unit* Arygos = plr->FindNearestCreature(C_ARYGOS, 100,me); + Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, me); + Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,me); + + if (!Fandral || !Arygos || !Caelestrasz || !Merithra) + return; + + Unit* mob; + AnimationTimer = EventAnim[AnimationCount].Timer; + if (eventEnd == false) { - case 0: - DoScriptText(ANACHRONOS_SAY_1, me , Fandral); - break; - case 1: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - DoScriptText(FANDRAL_SAY_1, Fandral,me); - break; - case 2: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET,NULL); - DoScriptText(MERITHRA_EMOTE_1,Merithra); - break; - case 3: - DoScriptText(MERITHRA_SAY_1,Merithra); - break; - case 4: - DoScriptText(ARYGOS_EMOTE_1,Arygos); - break; - case 5: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, Fandral->GetGUID()); - DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz); - break; - case 6: - DoScriptText(MERITHRA_SAY_2, Merithra); - break; - case 7: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, NULL); - Merithra->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - break; - case 8: - DoScriptText(MERITHRA_YELL_1,Merithra); - break; - case 9: - Merithra->CastSpell(Merithra,25105,true); - break; - case 10: - Merithra->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Merithra->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Merithra->GetMotionMaster()->MoveCharge(-8065,1530,6.61,3); - break; - case 11: - Merithra->CastSpell(Merithra,24818,false); - break; - case 12: - Merithra->GetMotionMaster()->MoveCharge(-8100,1530,50,42); - break; - case 13: - break; - case 14: - DoScriptText(ARYGOS_SAY_1,Arygos); - Merithra->SetVisibility(VISIBILITY_OFF); - break; - case 15: - Arygos->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - Merithra->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); - break; - case 16: - DoScriptText(ARYGOS_YELL_1, Arygos); - break; - case 17: - Arygos->CastSpell(Arygos,25107,true); - break; - case 18: - Arygos->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Arygos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Arygos->GetMotionMaster()->MoveCharge(-8065,1530,6.61,42); - break; - case 19: - Arygos->CastSpell(Arygos,50505,false); - break; - case 20: - Arygos->GetMotionMaster()->MoveCharge(-8095,1530,50,42); - break; - case 21: - break; - case 22: - DoScriptText(CAELESTRASZ_SAY_2,Caelestrasz, Fandral); - break; - case 23: - Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - Arygos->SetVisibility(VISIBILITY_OFF); - Arygos->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,10); - break; - case 24: - DoScriptText(CAELESTRASZ_YELL_1, Caelestrasz); - break; - case 25: - Caelestrasz->CastSpell(Caelestrasz,25106,true); - break; - case 26: - Caelestrasz->HandleEmoteCommand(254); - Caelestrasz->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,7.61,4); - break; - case 27: - Caelestrasz->CastSpell(Caelestrasz,54293,false); - break; - case 28: - DoScriptText(ANACHRONOS_SAY_2,me, Fandral); - break; - case 29: - Caelestrasz->GetMotionMaster()->MoveCharge(-8095,1530,50,42); - DoScriptText(FANDRAL_SAY_2, Fandral, me); - break; - case 30: - break; - case 31: - DoScriptText(ANACHRONOS_SAY_3, me, Fandral); - break; - case 32: - Caelestrasz->SetVisibility(VISIBILITY_OFF); - Caelestrasz->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); - Fandral->GetMotionMaster()->MoveCharge(-8108,1529,2.77,8); - me->GetMotionMaster()->MoveCharge(-8113,1525,2.77,8); - break;//both run to the gate - case 33: - DoScriptText(ANACHRONOS_SAY_4, me); - Caelestrasz->GetMotionMaster()->MoveCharge(-8050,1473,65,15); - break; //Text: sands will stop - case 34: - DoCast(plr, 23017, true);//Arcane Channeling - break; - case 35: - me->CastSpell(-8088,1520.43,2.67,25158,true); - break; - case 36: - DoCast(plr, 25159, true); - break; - case 37: - me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - break; - case 38: - DoCast(plr, 25166, true); - me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - break; - case 39: - DoScriptText(ANACHRONOS_SAY_5, me, Fandral); - break; - case 40: - Fandral->CastSpell(me, 25167, true); - break; - case 41: - Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - DoScriptText(FANDRAL_SAY_3, Fandral); - break; - case 42: - me->CastStop(); - DoScriptText(FANDRAL_EMOTE_1, Fandral); - break; - case 43: - Fandral->CastStop(); - break; - case 44: - DoScriptText(ANACHRONOS_SAY_6, me); - break; - case 45: - DoScriptText(ANACHRONOS_SAY_7, me); - break; - case 46: - DoScriptText(ANACHRONOS_SAY_8, me); - me->GetMotionMaster()->MoveCharge(-8110,1527,2.77,4); - break; - case 47: - DoScriptText(ANACHRONOS_EMOTE_1, me); - break; - case 48: - DoScriptText(FANDRAL_SAY_4,Fandral,me); - break; - case 49: - DoScriptText(FANDRAL_SAY_5,Fandral,me); - break; - case 50: - DoScriptText(FANDRAL_EMOTE_2,Fandral); - Fandral->CastSpell(-8127,1525,17.5,33806,true); - break; - case 51: + switch(AnimationCount) { - uint32 entries[4] = { 15423, 15424, 15414, 15422 }; - for (uint8 i = 0; i < 4; ++i) + case 0: + DoScriptText(ANACHRONOS_SAY_1, me , Fandral); + break; + case 1: + Fandral->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + DoScriptText(FANDRAL_SAY_1, Fandral,me); + break; + case 2: + Fandral->SetUInt64Value(UNIT_FIELD_TARGET,NULL); + DoScriptText(MERITHRA_EMOTE_1,Merithra); + break; + case 3: + DoScriptText(MERITHRA_SAY_1,Merithra); + break; + case 4: + DoScriptText(ARYGOS_EMOTE_1,Arygos); + break; + case 5: + Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, Fandral->GetGUID()); + DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz); + break; + case 6: + DoScriptText(MERITHRA_SAY_2, Merithra); + break; + case 7: + Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, NULL); + Merithra->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + break; + case 8: + DoScriptText(MERITHRA_YELL_1,Merithra); + break; + case 9: + Merithra->CastSpell(Merithra,25105,true); + break; + case 10: + Merithra->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Merithra->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Merithra->GetMotionMaster()->MoveCharge(-8065,1530,6.61,3); + break; + case 11: + Merithra->CastSpell(Merithra,24818,false); + break; + case 12: + Merithra->GetMotionMaster()->MoveCharge(-8100,1530,50,42); + break; + case 13: + break; + case 14: + DoScriptText(ARYGOS_SAY_1,Arygos); + Merithra->SetVisibility(VISIBILITY_OFF); + break; + case 15: + Arygos->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + Merithra->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); + break; + case 16: + DoScriptText(ARYGOS_YELL_1, Arygos); + break; + case 17: + Arygos->CastSpell(Arygos,25107,true); + break; + case 18: + Arygos->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Arygos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Arygos->GetMotionMaster()->MoveCharge(-8065,1530,6.61,42); + break; + case 19: + Arygos->CastSpell(Arygos,50505,false); + break; + case 20: + Arygos->GetMotionMaster()->MoveCharge(-8095,1530,50,42); + break; + case 21: + break; + case 22: + DoScriptText(CAELESTRASZ_SAY_2,Caelestrasz, Fandral); + break; + case 23: + Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + Arygos->SetVisibility(VISIBILITY_OFF); + Arygos->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,10); + break; + case 24: + DoScriptText(CAELESTRASZ_YELL_1, Caelestrasz); + break; + case 25: + Caelestrasz->CastSpell(Caelestrasz,25106,true); + break; + case 26: + Caelestrasz->HandleEmoteCommand(254); + Caelestrasz->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,7.61,4); + break; + case 27: + Caelestrasz->CastSpell(Caelestrasz,54293,false); + break; + case 28: + DoScriptText(ANACHRONOS_SAY_2,me, Fandral); + break; + case 29: + Caelestrasz->GetMotionMaster()->MoveCharge(-8095,1530,50,42); + DoScriptText(FANDRAL_SAY_2, Fandral, me); + break; + case 30: + break; + case 31: + DoScriptText(ANACHRONOS_SAY_3, me, Fandral); + break; + case 32: + Caelestrasz->SetVisibility(VISIBILITY_OFF); + Caelestrasz->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); + Fandral->GetMotionMaster()->MoveCharge(-8108,1529,2.77,8); + me->GetMotionMaster()->MoveCharge(-8113,1525,2.77,8); + break;//both run to the gate + case 33: + DoScriptText(ANACHRONOS_SAY_4, me); + Caelestrasz->GetMotionMaster()->MoveCharge(-8050,1473,65,15); + break; //Text: sands will stop + case 34: + DoCast(plr, 23017, true);//Arcane Channeling + break; + case 35: + me->CastSpell(-8088,1520.43,2.67,25158,true); + break; + case 36: + DoCast(plr, 25159, true); + break; + case 37: + me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + break; + case 38: + DoCast(plr, 25166, true); + me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + break; + case 39: + DoScriptText(ANACHRONOS_SAY_5, me, Fandral); + break; + case 40: + Fandral->CastSpell(me, 25167, true); + break; + case 41: + Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + DoScriptText(FANDRAL_SAY_3, Fandral); + break; + case 42: + me->CastStop(); + DoScriptText(FANDRAL_EMOTE_1, Fandral); + break; + case 43: + Fandral->CastStop(); + break; + case 44: + DoScriptText(ANACHRONOS_SAY_6, me); + break; + case 45: + DoScriptText(ANACHRONOS_SAY_7, me); + break; + case 46: + DoScriptText(ANACHRONOS_SAY_8, me); + me->GetMotionMaster()->MoveCharge(-8110,1527,2.77,4); + break; + case 47: + DoScriptText(ANACHRONOS_EMOTE_1, me); + break; + case 48: + DoScriptText(FANDRAL_SAY_4,Fandral,me); + break; + case 49: + DoScriptText(FANDRAL_SAY_5,Fandral,me); + break; + case 50: + DoScriptText(FANDRAL_EMOTE_2,Fandral); + Fandral->CastSpell(-8127,1525,17.5,33806,true); + break; + case 51: { - mob = plr->FindNearestCreature(entries[i],50,me); - while (mob) + uint32 entries[4] = { 15423, 15424, 15414, 15422 }; + for (uint8 i = 0; i < 4; ++i) { - mob->RemoveFromWorld(); - mob = plr->FindNearestCreature(15423,50,me); + mob = plr->FindNearestCreature(entries[i],50,me); + while (mob) + { + mob->RemoveFromWorld(); + mob = plr->FindNearestCreature(15423,50,me); + } } + break; } - break; + case 52: + Fandral->GetMotionMaster()->MoveCharge(-8028.75, 1538.795, 2.61,4); + DoScriptText(ANACHRONOS_SAY_9, me,Fandral); + break; + case 53: + DoScriptText(FANDRAL_SAY_6,Fandral); + break; + case 54: + DoScriptText(ANACHRONOS_EMOTE_2,me); + break; + case 55: + Fandral->SetVisibility(VISIBILITY_OFF); + break; + case 56: + DoScriptText(ANACHRONOS_EMOTE_3, me); + me->GetMotionMaster()->MoveCharge(-8116,1522,3.65,4); + break; + case 57: + me->GetMotionMaster()->MoveCharge(-8116.7,1527,3.7,4); + break; + case 58: + me->GetMotionMaster()->MoveCharge(-8112.67,1529.9,2.86,4); + break; + case 59: + me->GetMotionMaster()->MoveCharge(-8117.99,1532.24,3.94,4); + break; + case 60: + if (plr) + DoScriptText(ANACHRONOS_SAY_10, me,plr); + me->GetMotionMaster()->MoveCharge(-8113.46,1524.16,2.89,4); + break; + case 61: + me->GetMotionMaster()->MoveCharge(-8057.1,1470.32,2.61,6); + if (plr->IsInRange(me,0,15)) + plr->GroupEventHappens(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD ,me); + break; + case 62: + me->SetDisplayId(15500); + break; + case 63: + me->HandleEmoteCommand(254); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + break; + case 64: + me->GetMotionMaster()->MoveCharge(-8000,1400,150,9); + break; + case 65: + me->SetVisibility(VISIBILITY_OFF); + if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID))) + { + DoScriptText(ARYGOS_YELL_1,me); + AnachronosQuestTrigger->AI()->EnterEvadeMode(); + eventEnd=true; + } + break; } - case 52: - Fandral->GetMotionMaster()->MoveCharge(-8028.75, 1538.795, 2.61,4); - DoScriptText(ANACHRONOS_SAY_9, me,Fandral); - break; - case 53: - DoScriptText(FANDRAL_SAY_6,Fandral); - break; - case 54: - DoScriptText(ANACHRONOS_EMOTE_2,me); - break; - case 55: - Fandral->SetVisibility(VISIBILITY_OFF); - break; - case 56: - DoScriptText(ANACHRONOS_EMOTE_3, me); - me->GetMotionMaster()->MoveCharge(-8116,1522,3.65,4); - break; - case 57: - me->GetMotionMaster()->MoveCharge(-8116.7,1527,3.7,4); - break; - case 58: - me->GetMotionMaster()->MoveCharge(-8112.67,1529.9,2.86,4); - break; - case 59: - me->GetMotionMaster()->MoveCharge(-8117.99,1532.24,3.94,4); - break; - case 60: - if (plr) - DoScriptText(ANACHRONOS_SAY_10, me,plr); - me->GetMotionMaster()->MoveCharge(-8113.46,1524.16,2.89,4); - break; - case 61: - me->GetMotionMaster()->MoveCharge(-8057.1,1470.32,2.61,6); - if (plr->IsInRange(me,0,15)) - plr->GroupEventHappens(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD ,me); - break; - case 62: - me->SetDisplayId(15500); - break; - case 63: - me->HandleEmoteCommand(254); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - break; - case 64: - me->GetMotionMaster()->MoveCharge(-8000,1400,150,9); - break; - case 65: - me->SetVisibility(VISIBILITY_OFF); - if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID))) - { - DoScriptText(ARYGOS_YELL_1,me); - AnachronosQuestTrigger->AI()->EnterEvadeMode(); - eventEnd=true; - } - break; } + ++AnimationCount; } - ++AnimationCount; - } - void UpdateAI(const uint32 diff) - { - if (AnimationTimer) + void UpdateAI(const uint32 diff) { - if (AnimationTimer <= diff) - HandleAnimation(); - else AnimationTimer -= diff; + if (AnimationTimer) + { + if (AnimationTimer <= diff) + HandleAnimation(); + else AnimationTimer -= diff; + } + if (AnimationCount < 65) + me->CombatStop(); + if (AnimationCount == 65 || eventEnd) + me->AI()->EnterEvadeMode(); } - if (AnimationCount < 65) - me->CombatStop(); - if (AnimationCount == 65 || eventEnd) - me->AI()->EnterEvadeMode(); - } + }; + }; /*###### # mob_qiraj_war_spawn ######*/ - -struct mob_qiraj_war_spawnAI : public ScriptedAI + class mob_qiraj_war_spawn : public CreatureScript { - mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} +public: + mob_qiraj_war_spawn() : CreatureScript("mob_qiraj_war_spawn") { } - uint64 MobGUID; - uint64 PlayerGUID; - uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; - bool Timers; - bool hasTarget; - - void Reset() + CreatureAI* GetAI(Creature* c) { - MobGUID = 0; - PlayerGUID = 0; - Timers = false; - hasTarget = false; + return new mob_qiraj_war_spawnAI(c); } - void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* slayer); - - void UpdateAI(const uint32 diff) + struct mob_qiraj_war_spawnAI : public ScriptedAI { - Unit *pTarget = NULL; - //Player* plr = me->GetPlayer(PlayerGUID); + mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} - if (!Timers) + uint64 MobGUID; + uint64 PlayerGUID; + uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; + bool Timers; + bool hasTarget; + + void Reset() { - if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers + MobGUID = 0; + PlayerGUID = 0; + Timers = false; + hasTarget = false; + } + + void EnterCombat(Unit* /*who*/) {} + void JustDied(Unit* /*slayer*/); + + void UpdateAI(const uint32 diff) + { + Unit *pTarget = NULL; + //Player* plr = me->GetPlayer(PlayerGUID); + + if (!Timers) { - SpellTimer1 = SpawnCast[1].Timer1; - SpellTimer2 = SpawnCast[2].Timer1; - SpellTimer3 = SpawnCast[3].Timer1; + if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers + { + SpellTimer1 = SpawnCast[1].Timer1; + SpellTimer2 = SpawnCast[2].Timer1; + SpellTimer3 = SpawnCast[3].Timer1; + } + if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) + SpellTimer4 = SpawnCast[0].Timer1; + Timers = true; + } + if (me->GetEntry() == 15424 || me->GetEntry() == 15422|| me->GetEntry() == 15414) + { + if (SpellTimer1 <= diff) + { + DoCast(me, SpawnCast[1].SpellId); + DoCast(me, 24319); + SpellTimer1 = SpawnCast[1].Timer2; + } else SpellTimer1 -= diff; + if (SpellTimer2 <= diff) + { + DoCast(me, SpawnCast[2].SpellId); + SpellTimer2 = SpawnCast[2].Timer2; + } else SpellTimer2 -= diff; + if (SpellTimer3 <= diff) + { + DoCast(me, SpawnCast[3].SpellId); + SpellTimer3 = SpawnCast[3].Timer2; + } else SpellTimer3 -= diff; } if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - SpellTimer4 = SpawnCast[0].Timer1; - Timers = true; - } - if (me->GetEntry() == 15424 || me->GetEntry() == 15422|| me->GetEntry() == 15414) - { - if (SpellTimer1 <= diff) { - DoCast(me, SpawnCast[1].SpellId); - DoCast(me, 24319); - SpellTimer1 = SpawnCast[1].Timer2; - } else SpellTimer1 -= diff; - if (SpellTimer2 <= diff) - { - DoCast(me, SpawnCast[2].SpellId); - SpellTimer2 = SpawnCast[2].Timer2; - } else SpellTimer2 -= diff; - if (SpellTimer3 <= diff) - { - DoCast(me, SpawnCast[3].SpellId); - SpellTimer3 = SpawnCast[3].Timer2; - } else SpellTimer3 -= diff; - } - if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - { - if (SpellTimer4 <= diff) - { - me->RemoveAllAttackers(); - me->AttackStop(); - DoCast(me, 15533); - SpellTimer4 = SpawnCast[0].Timer2; - } else SpellTimer4 -= diff; - } - if (!hasTarget) - { - if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - pTarget = me->FindNearestCreature(15423,20,true); - if (me->GetEntry() == 15423) - { - uint8 tar = urand(0,2); - - if (tar == 0) - pTarget = me->FindNearestCreature(15422,20,true); - else if (tar == 1) - pTarget = me->FindNearestCreature(15424,20,true); - else if (tar == 2) - pTarget = me->FindNearestCreature(15414,20,true); + if (SpellTimer4 <= diff) + { + me->RemoveAllAttackers(); + me->AttackStop(); + DoCast(me, 15533); + SpellTimer4 = SpawnCast[0].Timer2; + } else SpellTimer4 -= diff; } - hasTarget = true; - if (pTarget) - me->AI()->AttackStart(pTarget); - } - if (!(me->FindNearestCreature(15379,60))) - DoCast(me, 33652); + if (!hasTarget) + { + if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) + pTarget = me->FindNearestCreature(15423,20,true); + if (me->GetEntry() == 15423) + { + uint8 tar = urand(0,2); - if (!UpdateVictim()) - { - hasTarget = false; - return; - } + if (tar == 0) + pTarget = me->FindNearestCreature(15422,20,true); + else if (tar == 1) + pTarget = me->FindNearestCreature(15424,20,true); + else if (tar == 2) + pTarget = me->FindNearestCreature(15414,20,true); + } + hasTarget = true; + if (pTarget) + me->AI()->AttackStart(pTarget); + } + if (!(me->FindNearestCreature(15379,60))) + DoCast(me, 33652); + + if (!UpdateVictim()) + { + hasTarget = false; + return; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; /*##### # npc_anachronos_quest_trigger #####*/ - -struct npc_anachronos_quest_triggerAI : public ScriptedAI + class npc_anachronos_quest_trigger : public CreatureScript { - npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} +public: + npc_anachronos_quest_trigger() : CreatureScript("npc_anachronos_quest_trigger") { } - uint64 PlayerGUID; - - uint32 WaveTimer; - uint32 AnnounceTimer; - - int8 LiveCount; - uint8 WaveCount; - - bool EventStarted; - bool Announced; - bool Failed; - - void Reset() + CreatureAI* GetAI(Creature* c) { - PlayerGUID = 0; - - WaveTimer = 2000; - AnnounceTimer = 1000; - LiveCount = 0; - WaveCount = 0; - - EventStarted = false; - Announced = false; - Failed = false; - - me->SetVisibility(VISIBILITY_OFF); + return new npc_anachronos_quest_triggerAI(c); } - void SummonNextWave() + struct npc_anachronos_quest_triggerAI : public ScriptedAI { - //uint8 count = WavesInfo[WaveCount].SpawnCount; - uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; - srand(time(NULL));//initializing random seed - //uint8 KaldoreiSoldierCount = 0; - //uint8 AnubisathConquerorCount = 0; - //uint8 QirajiWaspCount = 0; - for (uint8 i = 0; i < 67; ++i) + npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} + + uint64 PlayerGUID; + + uint32 WaveTimer; + uint32 AnnounceTimer; + + int8 LiveCount; + uint8 WaveCount; + + bool EventStarted; + bool Announced; + bool Failed; + + void Reset() { - Creature* Spawn = NULL; - float X = SpawnLocation[locIndex + i].x; - float Y = SpawnLocation[locIndex + i].y; - float Z = SpawnLocation[locIndex + i].z; - float O = SpawnLocation[locIndex + i].o; - uint32 desptimer = WavesInfo[WaveCount].DespTimer; - Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer); + PlayerGUID = 0; - if (Spawn) - { - Spawn->LoadCreaturesAddon(); - if (Spawn->GetGUID() == 15423) - Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,15427+rand()%4); - if (i >= 30) WaveCount = 1; - if (i >= 33) WaveCount = 2; - if (i >= 45) WaveCount = 3; - if (i >= 51) WaveCount = 4; + WaveTimer = 2000; + AnnounceTimer = 1000; + LiveCount = 0; + WaveCount = 0; - if (WaveCount < 5) //1-4 Wave - { - CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->MobGUID = me->GetGUID(); - CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->PlayerGUID = PlayerGUID; - } - } - } - WaveTimer = WavesInfo[WaveCount].SpawnTimer; - AnnounceTimer = WavesInfo[WaveCount].YellTimer; - } - - void CheckEventFail() - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - - if (!pPlayer) - return; - - if (Group *EventGroup = pPlayer->GetGroup()) - { - Player* GroupMember; - - uint8 GroupMemberCount = 0; - uint8 DeadMemberCount = 0; - uint8 FailedMemberCount = 0; - - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - - for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) - { - GroupMember = (Unit::GetPlayer(*me, itr->guid)); - if (!GroupMember) - continue; - if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) - { - GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); - GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE); - ++FailedMemberCount; - } - ++GroupMemberCount; - - if (GroupMember->isDead()) - ++DeadMemberCount; - } - - if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) - Failed = true; //only so event can restart - } - } - - void LiveCounter() - { - --LiveCount; - if (!LiveCount) + EventStarted = false; Announced = false; - } + Failed = false; - void UpdateAI(const uint32 diff) - { - if (!PlayerGUID || !EventStarted) - return; - - if (WaveCount < 4) - { - if (!Announced && AnnounceTimer <= diff) - { - DoScriptText(WavesInfo[WaveCount].WaveTextId, me); - Announced = true; - } else AnnounceTimer -= diff; - - if (WaveTimer <= diff) - SummonNextWave(); - else WaveTimer -= diff; + me->SetVisibility(VISIBILITY_OFF); } - CheckEventFail(); - if (WaveCount == 4 || Failed) - EnterEvadeMode(); + + void SummonNextWave() + { + //uint8 count = WavesInfo[WaveCount].SpawnCount; + uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; + srand(time(NULL));//initializing random seed + //uint8 KaldoreiSoldierCount = 0; + //uint8 AnubisathConquerorCount = 0; + //uint8 QirajiWaspCount = 0; + for (uint8 i = 0; i < 67; ++i) + { + Creature* Spawn = NULL; + float X = SpawnLocation[locIndex + i].x; + float Y = SpawnLocation[locIndex + i].y; + float Z = SpawnLocation[locIndex + i].z; + float O = SpawnLocation[locIndex + i].o; + uint32 desptimer = WavesInfo[WaveCount].DespTimer; + Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer); + + if (Spawn) + { + Spawn->LoadCreaturesAddon(); + if (Spawn->GetGUID() == 15423) + Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,15427+rand()%4); + if (i >= 30) WaveCount = 1; + if (i >= 33) WaveCount = 2; + if (i >= 45) WaveCount = 3; + if (i >= 51) WaveCount = 4; + + if (WaveCount < 5) //1-4 Wave + { + CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, Spawn->AI())->MobGUID = me->GetGUID(); + CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, Spawn->AI())->PlayerGUID = PlayerGUID; + } + } + } + WaveTimer = WavesInfo[WaveCount].SpawnTimer; + AnnounceTimer = WavesInfo[WaveCount].YellTimer; + } + + void CheckEventFail() + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + + if (!pPlayer) + return; + + if (Group *EventGroup = pPlayer->GetGroup()) + { + Player* GroupMember; + + uint8 GroupMemberCount = 0; + uint8 DeadMemberCount = 0; + uint8 FailedMemberCount = 0; + + const Group::MemberSlotList members = EventGroup->GetMemberSlots(); + + for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) + { + GroupMember = (Unit::GetPlayer(*me, itr->guid)); + if (!GroupMember) + continue; + if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) + { + GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); + GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE); + ++FailedMemberCount; + } + ++GroupMemberCount; + + if (GroupMember->isDead()) + ++DeadMemberCount; + } + + if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) + Failed = true; //only so event can restart + } + } + + void LiveCounter() + { + --LiveCount; + if (!LiveCount) + Announced = false; + } + + void UpdateAI(const uint32 diff) + { + if (!PlayerGUID || !EventStarted) + return; + + if (WaveCount < 4) + { + if (!Announced && AnnounceTimer <= diff) + { + DoScriptText(WavesInfo[WaveCount].WaveTextId, me); + Announced = true; + } else AnnounceTimer -= diff; + + if (WaveTimer <= diff) + SummonNextWave(); + else WaveTimer -= diff; + } + CheckEventFail(); + if (WaveCount == 4 || Failed) + EnterEvadeMode(); + }; }; + }; -void mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) + +void mob_qiraj_war_spawn::mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) { me->RemoveCorpse(); if (Creature* Mob = (Unit::GetCreature(*me, MobGUID))) - CAST_AI(npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter(); }; + /*##### # go_crystalline_tear ######*/ - -bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* quest) + class go_crystalline_tear : public GameObjectScript { - if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) - { +public: + go_crystalline_tear() : GameObjectScript("go_crystalline_tear") { } - if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) + bool OnQuestAccept(Player* plr, GameObject* go, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) { - Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - - if (Merithra) + if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) { - Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID,15420); - Merithra->setFaction(35); - } - if (Caelestrasz) - { - Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID,15419); - Caelestrasz->setFaction(35); - } + Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - if (Arygos) - { - Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID,15418); - Arygos->setFaction(35); - } + if (Merithra) + { + Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID,15420); + Merithra->setFaction(35); + } - if (Anachronos) - { - CAST_AI(npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID(); - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = plr->GetGUID(); - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; + if (Caelestrasz) + { + Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID,15419); + Caelestrasz->setFaction(35); + } + + if (Arygos) + { + Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID,15418); + Arygos->setFaction(35); + } + + if (Anachronos) + { + CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = plr->GetGUID(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; + } } } + return true; } - return true; -} -CreatureAI* GetAI_npc_anachronos_quest_trigger(Creature* c) -{ - return new npc_anachronos_quest_triggerAI(c); -} - -CreatureAI* GetAI_mob_qiraj_war_spawn(Creature* c) -{ - return new mob_qiraj_war_spawnAI(c); -} - -CreatureAI* GetAI_npc_anachronos_the_ancient(Creature* c) -{ - return new npc_anachronos_the_ancientAI(c); -} +}; void AddSC_silithus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_crystalline_tear"; - newscript->pGOQuestAccept = &GOQuestAccept_GO_crystalline_tear; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anachronos_quest_trigger"; - newscript->GetAI = &GetAI_npc_anachronos_quest_trigger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anachronos_the_ancient"; - newscript->GetAI = &GetAI_npc_anachronos_the_ancient; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_qiraj_war_spawn"; - newscript->GetAI = &GetAI_mob_qiraj_war_spawn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_highlord_demitrian"; - newscript->pGossipHello = &GossipHello_npc_highlord_demitrian; - newscript->pGossipSelect = &GossipSelect_npc_highlord_demitrian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npcs_rutgar_and_frankal"; - newscript->pGossipHello = &GossipHello_npcs_rutgar_and_frankal; - newscript->pGossipSelect = &GossipSelect_npcs_rutgar_and_frankal; - newscript->RegisterSelf(); + new go_crystalline_tear(); + new npc_anachronos_quest_trigger(); + new npc_anachronos_the_ancient(); + new mob_qiraj_war_spawn(); + new npc_highlord_demitrian(); + new npcs_rutgar_and_frankal(); } - diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index 17ad95c2cee..cbc5dada3e1 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -40,43 +40,50 @@ EndContentData */ #define GOSSIP_HBD3 "Nozdormu" #define GOSSIP_HBD4 "Alexstrasza" #define GOSSIP_HBD5 "Malygos" - -bool GossipHello_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature) + class npc_braug_dimspirit : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_braug_dimspirit() : CreatureScript("npc_braug_dimspirit") { } - if (pPlayer->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,6766,false); - pPlayer->SEND_GOSSIP_MENU(5820, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(6627); + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(5819, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,6766,false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(5820, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(5819, pCreature->GetGUID()); + + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(6627); - } - return true; -} + +}; + /*###### ## npc_kaya_flathoof @@ -96,60 +103,67 @@ enum eKaya QUEST_PROTECT_KAYA = 6523 }; - -struct npc_kaya_flathoofAI : public npc_escortAI + class npc_kaya_flathoof : public CreatureScript { - npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} +public: + npc_kaya_flathoof() : CreatureScript("npc_kaya_flathoof") { } - void WaypointReached(uint32 i) + struct npc_kaya_flathoofAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 16: - DoScriptText(SAY_AMBUSH, me); - me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 18: me->SetInFront(pPlayer); - DoScriptText(SAY_END, me, pPlayer); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, me); - break; + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 16: + DoScriptText(SAY_AMBUSH, me); + me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 18: me->SetInFront(pPlayer); + DoScriptText(SAY_END, me, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, me); + break; + } } - } - void JustSummoned(Creature* summoned) + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void Reset(){} + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - summoned->AI()->AttackStart(me); + if (quest->GetQuestId() == QUEST_PROTECT_KAYA) + { + if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoof::npc_kaya_flathoofAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + + DoScriptText(SAY_START, pCreature); + pCreature->setFaction(113); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_kaya_flathoofAI(pCreature); } - void Reset(){} }; -bool QuestAccept_npc_kaya_flathoof(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_PROTECT_KAYA) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoofAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - - DoScriptText(SAY_START, pCreature); - pCreature->setFaction(113); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - return true; -} - -CreatureAI* GetAI_npc_kaya_flathoofAI(Creature* pCreature) -{ - return new npc_kaya_flathoofAI(pCreature); -} /*###### ## AddSC @@ -157,18 +171,6 @@ CreatureAI* GetAI_npc_kaya_flathoofAI(Creature* pCreature) void AddSC_stonetalon_mountains() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_braug_dimspirit"; - newscript->pGossipHello = &GossipHello_npc_braug_dimspirit; - newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kaya_flathoof"; - newscript->GetAI = &GetAI_npc_kaya_flathoofAI; - newscript->pQuestAccept = &QuestAccept_npc_kaya_flathoof; - newscript->RegisterSelf(); + new npc_braug_dimspirit(); + new npc_kaya_flathoof(); } - diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index 7ef9e5039d9..f60fa90a29d 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -45,91 +45,98 @@ EndContentData */ #define SPELL_AQUA_JET 13586 #define SPELL_FROST_SHOCK 15089 - -struct mob_aquementasAI : public ScriptedAI + class mob_aquementas : public CreatureScript { - mob_aquementasAI(Creature *c) : ScriptedAI(c) {} +public: + mob_aquementas() : CreatureScript("mob_aquementas") { } - uint32 SendItem_Timer; - uint32 SwitchFaction_Timer; - bool isFriendly; - - uint32 FrostShock_Timer; - uint32 AquaJet_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SendItem_Timer = 0; - SwitchFaction_Timer = 10000; - me->setFaction(35); - isFriendly = true; - - AquaJet_Timer = 5000; - FrostShock_Timer = 1000; + return new mob_aquementasAI (pCreature); } - void SendItem(Unit* receiver) + struct mob_aquementasAI : public ScriptedAI { - if (CAST_PLR(receiver)->HasItemCount(11169,1,false) && - CAST_PLR(receiver)->HasItemCount(11172,11,false) && - CAST_PLR(receiver)->HasItemCount(11173,1,false) && - !CAST_PLR(receiver)->HasItemCount(11522,1,true)) + mob_aquementasAI(Creature *c) : ScriptedAI(c) {} + + uint32 SendItem_Timer; + uint32 SwitchFaction_Timer; + bool isFriendly; + + uint32 FrostShock_Timer; + uint32 AquaJet_Timer; + + void Reset() { - ItemPosCountVec dest; - uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, false); - if (msg == EQUIP_ERR_OK) - CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true); + SendItem_Timer = 0; + SwitchFaction_Timer = 10000; + me->setFaction(35); + isFriendly = true; + + AquaJet_Timer = 5000; + FrostShock_Timer = 1000; } - } - void EnterCombat(Unit* who) - { - DoScriptText(AGGRO_YELL_AQUE, me, who); - } - - void UpdateAI(const uint32 diff) - { - if (isFriendly) + void SendItem(Unit* receiver) { - if (SwitchFaction_Timer <= diff) + if (CAST_PLR(receiver)->HasItemCount(11169,1,false) && + CAST_PLR(receiver)->HasItemCount(11172,11,false) && + CAST_PLR(receiver)->HasItemCount(11173,1,false) && + !CAST_PLR(receiver)->HasItemCount(11522,1,true)) { - me->setFaction(91); - isFriendly = false; - } else SwitchFaction_Timer -= diff; + ItemPosCountVec dest; + uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, false); + if (msg == EQUIP_ERR_OK) + CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true); + } } - if (!UpdateVictim()) - return; - - if (!isFriendly) + void EnterCombat(Unit* who) { - if (SendItem_Timer <= diff) + DoScriptText(AGGRO_YELL_AQUE, me, who); + } + + void UpdateAI(const uint32 diff) + { + if (isFriendly) { - if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) - SendItem(me->getVictim()); - SendItem_Timer = 5000; - } else SendItem_Timer -= diff; + if (SwitchFaction_Timer <= diff) + { + me->setFaction(91); + isFriendly = false; + } else SwitchFaction_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + if (!isFriendly) + { + if (SendItem_Timer <= diff) + { + if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) + SendItem(me->getVictim()); + SendItem_Timer = 5000; + } else SendItem_Timer -= diff; + } + + if (FrostShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + FrostShock_Timer = 15000; + } else FrostShock_Timer -= diff; + + if (AquaJet_Timer <= diff) + { + DoCast(me, SPELL_AQUA_JET); + AquaJet_Timer = 15000; + } else AquaJet_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (FrostShock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 15000; - } else FrostShock_Timer -= diff; - - if (AquaJet_Timer <= diff) - { - DoCast(me, SPELL_AQUA_JET); - AquaJet_Timer = 15000; - } else AquaJet_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_aquementas(Creature* pCreature) -{ - return new mob_aquementasAI (pCreature); -} /*###### ## npc_custodian_of_time @@ -149,139 +156,161 @@ CreatureAI* GetAI_mob_aquementas(Creature* pCreature) #define WHISPER_CUSTODIAN_12 -1000228 #define WHISPER_CUSTODIAN_13 -1000229 #define WHISPER_CUSTODIAN_14 -1000230 - -struct npc_custodian_of_timeAI : public npc_escortAI + class npc_custodian_of_time : public CreatureScript { - npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {} +public: + npc_custodian_of_time() : CreatureScript("npc_custodian_of_time") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { - Player *pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - - switch(i) - { - case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, pPlayer); break; - case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, pPlayer); break; - case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, pPlayer); break; - case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, pPlayer); break; - case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, pPlayer); break; - case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, pPlayer); break; - case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, pPlayer); break; - case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, pPlayer); break; - case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, pPlayer); break; - case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, pPlayer); break; - case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, pPlayer); break; - case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, pPlayer); break; - case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 24: - DoScriptText(WHISPER_CUSTODIAN_14, me, pPlayer); - DoCast(pPlayer, 34883); - // below here is temporary workaround, to be removed when spell works properly - pPlayer->AreaExploredOrEventHappens(10277); - break; - } + return new npc_custodian_of_timeAI(pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_custodian_of_timeAI : public npc_escortAI { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; + npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {} - if (who->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE) + Player *pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + + switch(i) { - float Radius = 10.0; - if (me->IsWithinDistInMap(who, Radius)) + case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, pPlayer); break; + case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, pPlayer); break; + case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, pPlayer); break; + case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, pPlayer); break; + case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, pPlayer); break; + case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, pPlayer); break; + case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, pPlayer); break; + case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, pPlayer); break; + case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, pPlayer); break; + case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, pPlayer); break; + case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, pPlayer); break; + case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, pPlayer); break; + case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 24: + DoScriptText(WHISPER_CUSTODIAN_14, me, pPlayer); + DoCast(pPlayer, 34883); + // below here is temporary workaround, to be removed when spell works properly + pPlayer->AreaExploredOrEventHappens(10277); + break; + } + } + + void MoveInLineOfSight(Unit *who) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) + { + if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE) { - Start(false, false, who->GetGUID()); + float Radius = 10.0; + if (me->IsWithinDistInMap(who, Radius)) + { + Start(false, false, who->GetGUID()); + } } } } - } - void EnterCombat(Unit* /*who*/) {} - void Reset() { } + void EnterCombat(Unit* /*who*/) {} + void Reset() { } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature) -{ - return new npc_custodian_of_timeAI(pCreature); -} /*###### ## npc_marin_noggenfogger ######*/ - -bool GossipHello_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature) + class npc_marin_noggenfogger : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_marin_noggenfogger() : CreatureScript("npc_marin_noggenfogger") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_steward_of_time ######*/ #define GOSSIP_ITEM_FLIGHT "Please take me to the master's lair." - -bool GossipHello_npc_steward_of_time(Player* pPlayer, Creature* pCreature) + class npc_steward_of_time : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_steward_of_time() : CreatureScript("npc_steward_of_time") { } - if (pPlayer->GetQuestStatus(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279)) + bool OnQuestAccept(Player* pPlayer, Creature* /*pCreature*/, Quest const *quest) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); + if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair + pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) + + return false; } - else - pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) -bool QuestAccept_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, Quest const *quest) -{ - if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair - pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) + return true; + } - return false; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID()); + + return true; + } + +}; -bool GossipSelect_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) - return true; -} /*###### ## npc_stone_watcher_of_norgannon @@ -293,51 +322,58 @@ bool GossipSelect_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, #define GOSSIP_ITEM_NORGANNON_4 "Excuse me? We've been \"reschedueled for visitations\"? What does that mean?!" #define GOSSIP_ITEM_NORGANNON_5 "So, what's inside Uldum?" #define GOSSIP_ITEM_NORGANNON_6 "I will return when i have the Plates of Uldum." - -bool GossipHello_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature) + class npc_stone_watcher_of_norgannon : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_stone_watcher_of_norgannon() : CreatureScript("npc_stone_watcher_of_norgannon") { } - if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1675, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(1676, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(1677, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(1678, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(1679, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2954); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1675, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(1676, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(1677, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(1678, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(1679, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2954); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_OOX17 @@ -358,78 +394,86 @@ enum e00X17 SPAWN_SECOND_1 = 5617, SPAWN_SECOND_2 = 7805 }; - -struct npc_OOX17AI : public npc_escortAI + class npc_OOX17 : public CreatureScript { - npc_OOX17AI(Creature *c) : npc_escortAI(c) {} +public: + npc_OOX17() : CreatureScript("npc_OOX17") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); + if (quest->GetQuestId() == Q_OOX17) + { + pCreature->setFaction(113); + pCreature->SetHealth(pCreature->GetMaxHealth()); + pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + DoScriptText(SAY_OOX_START, pCreature); - if (!pPlayer) - return; - - switch(i) { - case 23: - me->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - break; - - case 56: - me->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) - DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); - break; - - case 86: - if (pPlayer) - { - DoScriptText(SAY_OOX_END, me); - pPlayer->GroupEventHappens(Q_OOX17, me); - } - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17::npc_OOX17AI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); } + return true; } - void Reset(){} - - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + return new npc_OOX17AI(pCreature); } - void JustSummoned(Creature* summoned) + struct npc_OOX17AI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_OOX17AI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { + case 23: + me->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + break; + + case 56: + me->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) + DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); + break; + + case 86: + if (pPlayer) + { + DoScriptText(SAY_OOX_END, me); + pPlayer->GroupEventHappens(Q_OOX17, me); + } + break; + } + } + + void Reset(){} + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + }; + }; -bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == Q_OOX17) - { - pCreature->setFaction(113); - pCreature->SetHealth(pCreature->GetMaxHealth()); - pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - DoScriptText(SAY_OOX_START, pCreature); - if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17AI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} - -CreatureAI* GetAI_npc_OOX17(Creature* pCreature) -{ - return new npc_OOX17AI(pCreature); -} /*#### # npc_tooga @@ -454,184 +498,156 @@ enum eTooga }; const float m_afToWaterLoc[] = {-7032.664551, -4906.199219, -1.606446}; - -struct npc_toogaAI : public FollowerAI + class npc_tooga : public CreatureScript { - npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_tooga() : CreatureScript("npc_tooga") { } - uint32 m_uiCheckSpeechTimer; - uint32 m_uiPostEventTimer; - uint32 m_uiPhasePostEvent; - - uint64 TortaGUID; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_uiCheckSpeechTimer = 2500; - m_uiPostEventTimer = 1000; - m_uiPhasePostEvent = 0; - - TortaGUID = 0; - } - - void MoveInLineOfSight(Unit *pWho) - { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) + if (pQuest->GetQuestId() == QUEST_TOOGA) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) - { - if (Player* pPlayer = GetLeaderForFollower()) - { - if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_TOOGA, me); - } - - TortaGUID = pWho->GetGUID(); - SetFollowComplete(true); - } - } - } - - void MovementInform(uint32 uiMotionType, uint32 uiPointId) - { - FollowerAI::MovementInform(uiMotionType, uiPointId); - - if (uiMotionType != POINT_MOTION_TYPE) - return; - - if (uiPointId == POINT_ID_TO_WATER) - SetFollowComplete(); - } - - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - { - //we are doing the post-event, or... - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) - { - if (m_uiPostEventTimer <= uiDiff) - { - m_uiPostEventTimer = 5000; - - Unit *pTorta = Unit::GetUnit(*me, TortaGUID); - if (!pTorta || !pTorta->isAlive()) - { - //something happened, so just complete - SetFollowComplete(); - return; - } - - switch(m_uiPhasePostEvent) - { - case 1: - DoScriptText(SAY_TOOG_POST_1, me); - break; - case 2: - DoScriptText(SAY_TORT_POST_2, pTorta); - break; - case 3: - DoScriptText(SAY_TOOG_POST_3, me); - break; - case 4: - DoScriptText(SAY_TORT_POST_4, pTorta); - break; - case 5: - DoScriptText(SAY_TOOG_POST_5, me); - break; - case 6: - DoScriptText(SAY_TORT_POST_6, pTorta); - me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); - break; - } - - ++m_uiPhasePostEvent; - } - else - m_uiPostEventTimer -= uiDiff; - } - //...we are doing regular speech check - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) - { - if (m_uiCheckSpeechTimer <= uiDiff) - { - m_uiCheckSpeechTimer = 5000; - - if (urand(0,9) > 8) - DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), me); - } - else - m_uiCheckSpeechTimer -= uiDiff; - } - - return; + if (npc_toogaAI* pToogaAI = CAST_AI(npc_tooga::npc_toogaAI, pCreature->AI())) + pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest); } - DoMeleeAttackIfReady(); + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_toogaAI(pCreature); + } + + struct npc_toogaAI : public FollowerAI + { + npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { } + + uint32 m_uiCheckSpeechTimer; + uint32 m_uiPostEventTimer; + uint32 m_uiPhasePostEvent; + + uint64 TortaGUID; + + void Reset() + { + m_uiCheckSpeechTimer = 2500; + m_uiPostEventTimer = 1000; + m_uiPhasePostEvent = 0; + + TortaGUID = 0; + } + + void MoveInLineOfSight(Unit *pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) + { + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + { + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_TOOGA, me); + } + + TortaGUID = pWho->GetGUID(); + SetFollowComplete(true); + } + } + } + + void MovementInform(uint32 uiMotionType, uint32 uiPointId) + { + FollowerAI::MovementInform(uiMotionType, uiPointId); + + if (uiMotionType != POINT_MOTION_TYPE) + return; + + if (uiPointId == POINT_ID_TO_WATER) + SetFollowComplete(); + } + + void UpdateFollowerAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + //we are doing the post-event, or... + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + { + if (m_uiPostEventTimer <= uiDiff) + { + m_uiPostEventTimer = 5000; + + Unit *pTorta = Unit::GetUnit(*me, TortaGUID); + if (!pTorta || !pTorta->isAlive()) + { + //something happened, so just complete + SetFollowComplete(); + return; + } + + switch(m_uiPhasePostEvent) + { + case 1: + DoScriptText(SAY_TOOG_POST_1, me); + break; + case 2: + DoScriptText(SAY_TORT_POST_2, pTorta); + break; + case 3: + DoScriptText(SAY_TOOG_POST_3, me); + break; + case 4: + DoScriptText(SAY_TORT_POST_4, pTorta); + break; + case 5: + DoScriptText(SAY_TOOG_POST_5, me); + break; + case 6: + DoScriptText(SAY_TORT_POST_6, pTorta); + me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + break; + } + + ++m_uiPhasePostEvent; + } + else + m_uiPostEventTimer -= uiDiff; + } + //...we are doing regular speech check + else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + { + if (m_uiCheckSpeechTimer <= uiDiff) + { + m_uiCheckSpeechTimer = 5000; + + if (urand(0,9) > 8) + DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), me); + } + else + m_uiCheckSpeechTimer -= uiDiff; + } + + return; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_tooga(Creature* pCreature) -{ - return new npc_toogaAI(pCreature); -} -bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOOGA) - { - if (npc_toogaAI* pToogaAI = CAST_AI(npc_toogaAI, pCreature->AI())) - pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest); - } - - return true; -} void AddSC_tanaris() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_aquementas"; - newscript->GetAI = &GetAI_mob_aquementas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_custodian_of_time"; - newscript->GetAI = &GetAI_npc_custodian_of_time; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marin_noggenfogger"; - newscript->pGossipHello = &GossipHello_npc_marin_noggenfogger; - newscript->pGossipSelect = &GossipSelect_npc_marin_noggenfogger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_steward_of_time"; - newscript->pGossipHello = &GossipHello_npc_steward_of_time; - newscript->pGossipSelect = &GossipSelect_npc_steward_of_time; - newscript->pQuestAccept = &QuestAccept_npc_steward_of_time; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_stone_watcher_of_norgannon"; - newscript->pGossipHello = &GossipHello_npc_stone_watcher_of_norgannon; - newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_OOX17"; - newscript->GetAI = &GetAI_npc_OOX17; - newscript->pQuestAccept = &QuestAccept_npc_OOX17; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tooga"; - newscript->GetAI = &GetAI_npc_tooga; - newscript->pQuestAccept = &QuestAccept_npc_tooga; - newscript->RegisterSelf(); + new mob_aquementas(); + new npc_custodian_of_time(); + new npc_marin_noggenfogger(); + new npc_steward_of_time(); + new npc_stone_watcher_of_norgannon(); + new npc_OOX17(); + new npc_tooga(); } - diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index a6659dcd6d9..7e64623a9e2 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -42,75 +42,76 @@ enum eMist NPC_ARYNIA = 3519, FACTION_DARNASSUS = 79 }; - -struct npc_mistAI : public FollowerAI + class npc_mist : public CreatureScript { - npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_mist() : CreatureScript("npc_mist") { } - void Reset() { } - - void MoveInLineOfSight(Unit *pWho) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) + if (pQuest->GetQuestId() == QUEST_MIST) { - if (me->IsWithinDistInMap(pWho, 10.0f)) + if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, pCreature->AI())) + pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); + } + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_mistAI(pCreature); + } + + struct npc_mistAI : public FollowerAI + { + npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } + + void Reset() { } + + void MoveInLineOfSight(Unit *pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) { - DoScriptText(SAY_AT_HOME, pWho); - DoComplete(); + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(SAY_AT_HOME, pWho); + DoComplete(); + } } } - } - void DoComplete() - { - DoScriptText(EMOTE_AT_HOME, me); - - if (Player* pPlayer = GetLeaderForFollower()) + void DoComplete() { - if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_MIST, me); + DoScriptText(EMOTE_AT_HOME, me); + + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_MIST, me); + } + + //The follow is over (and for later development, run off to the woods before really end) + SetFollowComplete(); } - //The follow is over (and for later development, run off to the woods before really end) - SetFollowComplete(); - } + //call not needed here, no known abilities + /*void UpdateFollowerAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; - //call not needed here, no known abilities - /*void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + }*/ + }; - DoMeleeAttackIfReady(); - }*/ }; -CreatureAI* GetAI_npc_mist(Creature* pCreature) -{ - return new npc_mistAI(pCreature); -} -bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MIST) - { - if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI())) - pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); - } - - return true; -} void AddSC_teldrassil() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_mist"; - newscript->GetAI = &GetAI_npc_mist; - newscript->pQuestAccept = &QuestAccept_npc_mist; - newscript->RegisterSelf(); + new npc_mist(); } - diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index a41e046618b..956a76e8130 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -45,25 +45,32 @@ enum eQuests { QUEST_LOST_IN_BATTLE = 4921 }; - -bool GossipHello_npc_beaten_corpse(Player* pPlayer, Creature* pCreature) + class npc_beaten_corpse : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_beaten_corpse() : CreatureScript("npc_beaten_corpse") { } - pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->SEND_GOSSIP_MENU(3558, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + { + pPlayer->SEND_GOSSIP_MENU(3558, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID()); + return true; + } + +}; + /*###### # npc_gilthares @@ -87,106 +94,121 @@ enum eGilthares AREA_MERCHANT_COAST = 391, FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest }; - -struct npc_giltharesAI : public npc_escortAI + class npc_gilthares : public CreatureScript { - npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_gilthares() : CreatureScript("npc_gilthares") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) { - case 16: - DoScriptText(SAY_GIL_AT_LAST, me, pPlayer); - break; - case 17: - DoScriptText(SAY_GIL_PROCEED, me, pPlayer); - break; - case 18: - DoScriptText(SAY_GIL_FREEBOOTERS, me, pPlayer); - break; - case 37: - DoScriptText(SAY_GIL_ALMOST, me, pPlayer); - break; - case 47: - DoScriptText(SAY_GIL_SWEET, me, pPlayer); - break; - case 53: - DoScriptText(SAY_GIL_FREED, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, me); - break; + pCreature->setFaction(FACTION_ESCORTEE); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + DoScriptText(SAY_GIL_START, pCreature, pPlayer); + + if (npc_giltharesAI* pEscortAI = CAST_AI(npc_gilthares::npc_giltharesAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void EnterCombat(Unit* pWho) + CreatureAI* GetAI(Creature* pCreature) const { - //not always use - if (rand()%4) - return; - - //only aggro text if not player and only in this area - if (pWho->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST) - { - //appears to be pretty much random (possible only if escorter not in combat with pWho yet?) - DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), me, pWho); - } + return new npc_giltharesAI(pCreature); } + + struct npc_giltharesAI : public npc_escortAI + { + npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 16: + DoScriptText(SAY_GIL_AT_LAST, me, pPlayer); + break; + case 17: + DoScriptText(SAY_GIL_PROCEED, me, pPlayer); + break; + case 18: + DoScriptText(SAY_GIL_FREEBOOTERS, me, pPlayer); + break; + case 37: + DoScriptText(SAY_GIL_ALMOST, me, pPlayer); + break; + case 47: + DoScriptText(SAY_GIL_SWEET, me, pPlayer); + break; + case 53: + DoScriptText(SAY_GIL_FREED, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, me); + break; + } + } + + void EnterCombat(Unit* pWho) + { + //not always use + if (rand()%4) + return; + + //only aggro text if not player and only in this area + if (pWho->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST) + { + //appears to be pretty much random (possible only if escorter not in combat with pWho yet?) + DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), me, pWho); + } + } + }; + }; -CreatureAI* GetAI_npc_gilthares(Creature* pCreature) -{ - return new npc_giltharesAI(pCreature); -} -bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) - { - pCreature->setFaction(FACTION_ESCORTEE); - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - - DoScriptText(SAY_GIL_START, pCreature, pPlayer); - - if (npc_giltharesAI* pEscortAI = CAST_AI(npc_giltharesAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*###### ## npc_sputtervalve ######*/ #define GOSSIP_SPUTTERVALVE "Can you tell me about this shard?" - -bool GossipHello_npc_sputtervalve(Player* pPlayer, Creature* pCreature) + class npc_sputtervalve : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_sputtervalve() : CreatureScript("npc_sputtervalve") { } - if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_sputtervalve(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->SEND_GOSSIP_MENU(2013, pCreature->GetGUID()); - pPlayer->AreaExploredOrEventHappens(6981); + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->SEND_GOSSIP_MENU(2013, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(6981); + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_taskmaster_fizzule @@ -198,89 +220,96 @@ enum eEnums SPELL_FLARE = 10113, SPELL_FOLLY = 10137, }; - -struct npc_taskmaster_fizzuleAI : public ScriptedAI + class npc_taskmaster_fizzule : public CreatureScript { - npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) +public: + npc_taskmaster_fizzule() : CreatureScript("npc_taskmaster_fizzule") { } + + CreatureAI* GetAI(Creature* pCreature) const { - factionNorm = c->getFaction(); + return new npc_taskmaster_fizzuleAI(pCreature); } - uint32 factionNorm; - bool IsFriend; - uint32 Reset_Timer; - uint8 FlareCount; - - void Reset() + struct npc_taskmaster_fizzuleAI : public ScriptedAI { - IsFriend = false; - Reset_Timer = 120000; - FlareCount = 0; - me->setFaction(factionNorm); - } - - void DoFriend() - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - - me->StopMoving(); - me->GetMotionMaster()->MoveIdle(); - - me->setFaction(FACTION_FRIENDLY_F); - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) + npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) { - ++FlareCount; - - if (FlareCount >= 2) - IsFriend = true; - } - } - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (IsFriend) - { - if (Reset_Timer <= diff) - { - EnterEvadeMode(); - return; - } else Reset_Timer -= diff; + factionNorm = c->getFaction(); } - if (!UpdateVictim()) - return; + uint32 factionNorm; + bool IsFriend; + uint32 Reset_Timer; + uint8 FlareCount; - DoMeleeAttackIfReady(); - } - - void ReceiveEmote(Player* /*pPlayer*/, uint32 emote) - { - if (emote == TEXTEMOTE_SALUTE) + void Reset() { - if (FlareCount >= 2) - { - if (me->getFaction() == FACTION_FRIENDLY_F) - return; + IsFriend = false; + Reset_Timer = 120000; + FlareCount = 0; + me->setFaction(factionNorm); + } - DoFriend(); + void DoFriend() + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + + me->StopMoving(); + me->GetMotionMaster()->MoveIdle(); + + me->setFaction(FACTION_FRIENDLY_F); + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + } + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) + { + ++FlareCount; + + if (FlareCount >= 2) + IsFriend = true; } } - } + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (IsFriend) + { + if (Reset_Timer <= diff) + { + EnterEvadeMode(); + return; + } else Reset_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void ReceiveEmote(Player* /*pPlayer*/, uint32 emote) + { + if (emote == TEXTEMOTE_SALUTE) + { + if (FlareCount >= 2) + { + if (me->getFaction() == FACTION_FRIENDLY_F) + return; + + DoFriend(); + } + } + } + }; + }; -CreatureAI* GetAI_npc_taskmaster_fizzule(Creature* pCreature) -{ - return new npc_taskmaster_fizzuleAI(pCreature); -} /*##### ## npc_twiggy_flathead @@ -307,199 +336,206 @@ float AffrayChallengerLoc[6][4]= {-1674, -4326, 2.79, 3.49}, {-1677, -4334, 2.79, 1.66} }; - -struct npc_twiggy_flatheadAI : public ScriptedAI + class npc_twiggy_flathead : public CreatureScript { - npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {} +public: + npc_twiggy_flathead() : CreatureScript("npc_twiggy_flathead") { } - bool EventInProgress; - bool EventGrate; - bool EventBigWill; - bool Challenger_down[6]; - uint32 Wave; - uint32 Wave_Timer; - uint32 Challenger_checker; - uint64 PlayerGUID; - uint64 AffrayChallenger[6]; - uint64 BigWill; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - EventInProgress = false; - EventGrate = false; - EventBigWill = false; - Wave_Timer = 600000; - Challenger_checker = 0; - Wave = 0; - PlayerGUID = 0; - - for (uint8 i = 0; i < 6; ++i) - { - AffrayChallenger[i] = 0; - Challenger_down[i] = false; - } - BigWill = 0; + return new npc_twiggy_flatheadAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void MoveInLineOfSight(Unit *who) + struct npc_twiggy_flatheadAI : public ScriptedAI { - if (!who || (!who->isAlive())) return; + npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {} - if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) + bool EventInProgress; + bool EventGrate; + bool EventBigWill; + bool Challenger_down[6]; + uint32 Wave; + uint32 Wave_Timer; + uint32 Challenger_checker; + uint64 PlayerGUID; + uint64 AffrayChallenger[6]; + uint64 BigWill; + + void Reset() { - PlayerGUID = who->GetGUID(); - EventInProgress = true; + EventInProgress = false; + EventGrate = false; + EventBigWill = false; + Wave_Timer = 600000; + Challenger_checker = 0; + Wave = 0; + PlayerGUID = 0; + + for (uint8 i = 0; i < 6; ++i) + { + AffrayChallenger[i] = 0; + Challenger_down[i] = false; + } + BigWill = 0; } - } - void KilledUnit(Unit * /*victim*/) { } + void EnterCombat(Unit * /*who*/) { } - void UpdateAI(const uint32 diff) - { - if (EventInProgress) { - Player* pWarrior = NULL; + void MoveInLineOfSight(Unit *who) + { + if (!who || (!who->isAlive())) return; - if (PlayerGUID) - pWarrior = Unit::GetPlayer(*me, PlayerGUID); + if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) + { + PlayerGUID = who->GetGUID(); + EventInProgress = true; + } + } - if (!pWarrior) - return; + void KilledUnit(Unit * /*victim*/) { } - if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { - EventInProgress = false; - DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - pWarrior->FailQuest(1719); + void UpdateAI(const uint32 diff) + { + if (EventInProgress) { + Player* pWarrior = NULL; - for (uint8 i = 0; i < 6; ++i) - { - if (AffrayChallenger[i]) + if (PlayerGUID) + pWarrior = Unit::GetPlayer(*me, PlayerGUID); + + if (!pWarrior) + return; + + if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { + EventInProgress = false; + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); + pWarrior->FailQuest(1719); + + for (uint8 i = 0; i < 6; ++i) { - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + if (AffrayChallenger[i]) + { + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + if (pCreature) { + if (pCreature->isAlive()) + { + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->setDeathState(JUST_DIED); + } + } + } + AffrayChallenger[i] = 0; + Challenger_down[i] = false; + } + + if (BigWill) + { + Creature* pCreature = Unit::GetCreature((*me), BigWill); if (pCreature) { - if (pCreature->isAlive()) - { + if (pCreature->isAlive()) { pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->setDeathState(JUST_DIED); } } } - AffrayChallenger[i] = 0; - Challenger_down[i] = false; + BigWill = 0; } - if (BigWill) + if (!EventGrate && EventInProgress) { - Creature* pCreature = Unit::GetCreature((*me), BigWill); - if (pCreature) { - if (pCreature->isAlive()) { - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->setDeathState(JUST_DIED); - } - } - } - BigWill = 0; - } + float x,y,z; + pWarrior->GetPosition(x, y, z); - if (!EventGrate && EventInProgress) - { - float x,y,z; - pWarrior->GetPosition(x, y, z); + if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { + pWarrior->AreaExploredOrEventHappens(1719); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); - if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { - pWarrior->AreaExploredOrEventHappens(1719); - DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); - - for (uint8 i = 0; i < 6; ++i) - { - Creature* pCreature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - if (!pCreature) - continue; - pCreature->setFaction(35); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - AffrayChallenger[i] = pCreature->GetGUID(); - } - Wave_Timer = 5000; - Challenger_checker = 1000; - EventGrate = true; - } - } - else if (EventInProgress) - { - if (Challenger_checker <= diff) - { - for (uint8 i = 0; i < 6; ++i) - { - if (AffrayChallenger[i]) + for (uint8 i = 0; i < 6; ++i) { - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); - if ((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) + Creature* pCreature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + if (!pCreature) + continue; + pCreature->setFaction(35); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + AffrayChallenger[i] = pCreature->GetGUID(); + } + Wave_Timer = 5000; + Challenger_checker = 1000; + EventGrate = true; + } + } + else if (EventInProgress) + { + if (Challenger_checker <= diff) + { + for (uint8 i = 0; i < 6; ++i) + { + if (AffrayChallenger[i]) { - DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - Challenger_down[i] = true; + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + if ((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); + Challenger_down[i] = true; + } } } - } - Challenger_checker = 1000; - } else Challenger_checker -= diff; + Challenger_checker = 1000; + } else Challenger_checker -= diff; - if (Wave_Timer <= diff) - { - if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) + if (Wave_Timer <= diff) { - DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me); - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[Wave]); - if (pCreature && (pCreature->isAlive())) + if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) { - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - pCreature->setFaction(14); - pCreature->AI()->AttackStart(pWarrior); - ++Wave; - Wave_Timer = 20000; + DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me); + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[Wave]); + if (pCreature && (pCreature->isAlive())) + { + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + pCreature->setFaction(14); + pCreature->AI()->AttackStart(pWarrior); + ++Wave; + Wave_Timer = 20000; + } } - } - else if (Wave >= 6 && !EventBigWill) { - if (Creature* pCreature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12, 6.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000)) + else if (Wave >= 6 && !EventBigWill) { + if (Creature* pCreature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12, 6.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000)) + { + BigWill = pCreature->GetGUID(); + //pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32); + //pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78); + pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79); + pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); + EventBigWill = true; + Wave_Timer = 1000; + } + } + else if (Wave >= 6 && EventBigWill && BigWill) { - BigWill = pCreature->GetGUID(); - //pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32); - //pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78); - pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79); - pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); - EventBigWill = true; - Wave_Timer = 1000; + Creature* pCreature = Unit::GetCreature((*me), BigWill); + if (!pCreature || !pCreature->isAlive()) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); + EventInProgress = false; + EventBigWill = false; + EventGrate = false; + PlayerGUID = 0; + Wave = 0; + } } - } - else if (Wave >= 6 && EventBigWill && BigWill) - { - Creature* pCreature = Unit::GetCreature((*me), BigWill); - if (!pCreature || !pCreature->isAlive()) - { - DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); - EventInProgress = false; - EventBigWill = false; - EventGrate = false; - PlayerGUID = 0; - Wave = 0; - } - } - } else Wave_Timer -= diff; + } else Wave_Timer -= diff; + } } } - } + }; + }; -CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) -{ - return new npc_twiggy_flatheadAI (pCreature); -} /*##### ## npc_wizzlecrank_shredder @@ -521,183 +557,160 @@ enum eEnums_Wizzlecrank NPC_PILOT_WIZZ = 3451, NPC_MERCENARY = 3282, }; - -struct npc_wizzlecrank_shredderAI : public npc_escortAI + class npc_wizzlecrank_shredder : public CreatureScript { - npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) - { - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; - } +public: + npc_wizzlecrank_shredder() : CreatureScript("npc_wizzlecrank_shredder") { } - bool m_bIsPostEvent; - uint32 m_uiPostEventTimer; - uint32 m_uiPostEventCount; - - void Reset() + struct npc_wizzlecrank_shredderAI : public npc_escortAI { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (me->getStandState() == UNIT_STAND_STATE_DEAD) - me->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; m_uiPostEventTimer = 1000; m_uiPostEventCount = 0; } - } - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); + bool m_bIsPostEvent; + uint32 m_uiPostEventTimer; + uint32 m_uiPostEventCount; - if (!pPlayer) - return; - - switch(uiPointId) + void Reset() { - case 0: - DoScriptText(SAY_STARTUP1, me); - break; - case 9: - SetRun(false); - break; - case 17: - if (Creature* pTemp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - DoScriptText(SAY_MERCENARY, pTemp); - me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (me->getStandState() == UNIT_STAND_STATE_DEAD) + me->SetStandState(UNIT_STAND_STATE_STAND); + + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; } - break; - case 24: - m_bIsPostEvent = true; - break; } - } - void WaypointStart(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(uiPointId) + void WaypointReached(uint32 uiPointId) { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 0: + DoScriptText(SAY_STARTUP1, me); + break; case 9: - DoScriptText(SAY_STARTUP2, me, pPlayer); + SetRun(false); break; - case 18: - DoScriptText(SAY_PROGRESS_1, me, pPlayer); - SetRun(); - break; - } - } - - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) - me->SetStandState(UNIT_STAND_STATE_DEAD); - - if (pSummoned->GetEntry() == NPC_MERCENARY) - pSummoned->AI()->AttackStart(me); - } - - void UpdateEscortAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - { - if (m_bIsPostEvent) - { - if (m_uiPostEventTimer <= uiDiff) + case 17: + if (Creature* pTemp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) { - switch(m_uiPostEventCount) - { - case 0: - DoScriptText(SAY_PROGRESS_2, me); - break; - case 1: - DoScriptText(SAY_PROGRESS_3, me); - break; - case 2: - DoScriptText(SAY_END, me); - break; - case 3: - if (Player* pPlayer = GetPlayerForEscort()) - { - pPlayer->GroupEventHappens(QUEST_ESCAPE, me); - me->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); - } - break; - } - - ++m_uiPostEventCount; - m_uiPostEventTimer = 5000; + DoScriptText(SAY_MERCENARY, pTemp); + me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); } - else - m_uiPostEventTimer -= uiDiff; + break; + case 24: + m_bIsPostEvent = true; + break; + } + } + + void WaypointStart(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 9: + DoScriptText(SAY_STARTUP2, me, pPlayer); + break; + case 18: + DoScriptText(SAY_PROGRESS_1, me, pPlayer); + SetRun(); + break; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) + me->SetStandState(UNIT_STAND_STATE_DEAD); + + if (pSummoned->GetEntry() == NPC_MERCENARY) + pSummoned->AI()->AttackStart(me); + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (m_bIsPostEvent) + { + if (m_uiPostEventTimer <= uiDiff) + { + switch(m_uiPostEventCount) + { + case 0: + DoScriptText(SAY_PROGRESS_2, me); + break; + case 1: + DoScriptText(SAY_PROGRESS_3, me); + break; + case 2: + DoScriptText(SAY_END, me); + break; + case 3: + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_ESCAPE, me); + me->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + } + break; + } + + ++m_uiPostEventCount; + m_uiPostEventTimer = 5000; + } + else + m_uiPostEventTimer -= uiDiff; + } + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_ESCAPE) + { + pCreature->setFaction(FACTION_RATCHET); + if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_wizzlecrank_shredderAI(pCreature); + } + }; -bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCAPE) - { - pCreature->setFaction(FACTION_RATCHET); - if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredderAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} - -CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) -{ - return new npc_wizzlecrank_shredderAI(pCreature); -} void AddSC_the_barrens() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_beaten_corpse"; - newscript->pGossipHello = &GossipHello_npc_beaten_corpse; - newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_gilthares"; - newscript->GetAI = &GetAI_npc_gilthares; - newscript->pQuestAccept = &QuestAccept_npc_gilthares; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_sputtervalve"; - newscript->pGossipHello = &GossipHello_npc_sputtervalve; - newscript->pGossipSelect = &GossipSelect_npc_sputtervalve; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_taskmaster_fizzule"; - newscript->GetAI = &GetAI_npc_taskmaster_fizzule; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_twiggy_flathead"; - newscript->GetAI = &GetAI_npc_twiggy_flathead; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_wizzlecrank_shredder"; - newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI; - newscript->pQuestAccept = &QuestAccept_npc_wizzlecrank_shredder; - newscript->RegisterSelf(); + new npc_beaten_corpse(); + new npc_gilthares(); + new npc_sputtervalve(); + new npc_taskmaster_fizzule(); + new npc_twiggy_flathead(); + new npc_wizzlecrank_shredder(); } - diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index 6aded229ddd..7938bf293f2 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -27,9 +27,8 @@ EndScriptData */ npc_kanati npc_lakota_windsong npc_swiftmountain -npc_plucky +npc_plucky npc_enraged_panther go_panther_cage -npc_enraged_panther EndContentData */ #include "ScriptPCH.h" @@ -48,56 +47,64 @@ enum eKanati }; const float m_afGalakLoc[]= {-4867.387695, -1357.353760, -48.226 }; - -struct npc_kanatiAI : public npc_escortAI + class npc_kanati : public CreatureScript { - npc_kanatiAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_kanati() : CreatureScript("npc_kanati") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_PROTECT_KANATI) { - case 0: - DoScriptText(SAY_KAN_START, me); - DoSpawnGalak(); - break; - case 1: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, me); - break; + if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest, true); } + return true; } - void DoSpawnGalak() + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_GALAK_ASS, - m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + return new npc_kanatiAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct npc_kanatiAI : public npc_escortAI { - pSummoned->AI()->AttackStart(me); - } + npc_kanatiAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + DoScriptText(SAY_KAN_START, me); + DoSpawnGalak(); + break; + case 1: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, me); + break; + } + } + + void DoSpawnGalak() + { + for (int i = 0; i < 3; ++i) + me->SummonCreature(NPC_GALAK_ASS, + m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->AI()->AttackStart(me); + } + }; + }; -CreatureAI* GetAI_npc_kanati(Creature* pCreature) -{ - return new npc_kanatiAI(pCreature); -} -bool QuestAccept_npc_kanati(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_PROTECT_KANATI) - { - if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanatiAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest, true); - } - return true; -} /*###### # npc_lakota_windsong @@ -129,62 +136,70 @@ float m_afBanditLoc[6][6]= {-4767.985352, -1873.169189, 90.192}, {-4788.861328, -1888.007813, 89.888} }; - -struct npc_lakota_windsongAI : public npc_escortAI + class npc_lakota_windsong : public CreatureScript { - npc_lakota_windsongAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_lakota_windsong() : CreatureScript("npc_lakota_windsong") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) { - case 8: - DoScriptText(SAY_LAKO_LOOK_OUT, me); - DoSpawnBandits(ID_AMBUSH_1); - break; - case 14: - DoScriptText(SAY_LAKO_HERE_COME, me); - DoSpawnBandits(ID_AMBUSH_2); - break; - case 21: - DoScriptText(SAY_LAKO_MORE, me); - DoSpawnBandits(ID_AMBUSH_3); - break; - case 45: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, me); - break; + DoScriptText(SAY_LAKO_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_ESCORTEE_LAKO); + + if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsong::npc_lakota_windsongAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void DoSpawnBandits(int uiAmbushId) + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 2; ++i) - me->SummonCreature(NPC_GRIM_BANDIT, - m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + return new npc_lakota_windsongAI(pCreature); } + + struct npc_lakota_windsongAI : public npc_escortAI + { + npc_lakota_windsongAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 8: + DoScriptText(SAY_LAKO_LOOK_OUT, me); + DoSpawnBandits(ID_AMBUSH_1); + break; + case 14: + DoScriptText(SAY_LAKO_HERE_COME, me); + DoSpawnBandits(ID_AMBUSH_2); + break; + case 21: + DoScriptText(SAY_LAKO_MORE, me); + DoSpawnBandits(ID_AMBUSH_3); + break; + case 45: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, me); + break; + } + } + + void DoSpawnBandits(int uiAmbushId) + { + for (int i = 0; i < 2; ++i) + me->SummonCreature(NPC_GRIM_BANDIT, + m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + } + }; + }; -CreatureAI* GetAI_npc_lakota_windsong(Creature* pCreature) -{ - return new npc_lakota_windsongAI(pCreature); -} -bool QuestAccept_npc_lakota_windsong(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) - { - DoScriptText(SAY_LAKO_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORTEE_LAKO); - - if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsongAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*###### # npc_paoka_swiftmountain @@ -207,57 +222,65 @@ float m_afWyvernLoc[3][3]= {-4970.241, -927.378, -4.951}, {-4985.364, -952.528, -5.199} }; - -struct npc_paoka_swiftmountainAI : public npc_escortAI + class npc_paoka_swiftmountain : public CreatureScript { - npc_paoka_swiftmountainAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_paoka_swiftmountain() : CreatureScript("npc_paoka_swiftmountain") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_HOMEWARD) { - case 15: - DoScriptText(SAY_WYVERN, me); - DoSpawnWyvern(); - break; - case 26: - DoScriptText(SAY_COMPLETE, me); - break; - case 27: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_HOMEWARD, me); - break; + DoScriptText(SAY_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_ESCORTEE); + + if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountain::npc_paoka_swiftmountainAI,pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void DoSpawnWyvern() + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_WYVERN, - m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + return new npc_paoka_swiftmountainAI(pCreature); } + + struct npc_paoka_swiftmountainAI : public npc_escortAI + { + npc_paoka_swiftmountainAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 15: + DoScriptText(SAY_WYVERN, me); + DoSpawnWyvern(); + break; + case 26: + DoScriptText(SAY_COMPLETE, me); + break; + case 27: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_HOMEWARD, me); + break; + } + } + + void DoSpawnWyvern() + { + for (int i = 0; i < 3; ++i) + me->SummonCreature(NPC_WYVERN, + m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + } + }; + }; -CreatureAI* GetAI_npc_paoka_swiftmountain(Creature* pCreature) -{ - return new npc_paoka_swiftmountainAI(pCreature); -} -bool QuestAccept_npc_paoka_swiftmountain(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_HOMEWARD) - { - DoScriptText(SAY_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORTEE); - - if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountainAI,pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*##### # npc_plucky @@ -272,185 +295,173 @@ enum ePlucky SPELL_PLUCKY_HUMAN = 9192, SPELL_PLUCKY_CHICKEN = 9220 }; - -struct npc_pluckyAI : public ScriptedAI + class npc_plucky : public CreatureScript { - npc_pluckyAI(Creature *c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } +public: + npc_plucky() : CreatureScript("npc_plucky") { } - uint32 m_uiNormFaction; - uint32 m_uiResetTimer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - m_uiResetTimer = 120000; - - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); - - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - DoCast(me, SPELL_PLUCKY_CHICKEN, false); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CompleteQuest(QUEST_SCOOP); + break; + } + return true; } - void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(738, pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pluckyAI(pCreature); + } + + struct npc_pluckyAI : public ScriptedAI + { + npc_pluckyAI(Creature *c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } + + uint32 m_uiNormFaction; + uint32 m_uiResetTimer; + + void Reset() { - if (uiTextEmote == TEXTEMOTE_BECKON) + m_uiResetTimer = 120000; + + if (me->getFaction() != m_uiNormFaction) + me->setFaction(m_uiNormFaction); + + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + DoCast(me, SPELL_PLUCKY_CHICKEN, false); + } + + void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) + { + if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) { - me->setFaction(FACTION_FRIENDLY); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoCast(me, SPELL_PLUCKY_HUMAN, false); + if (uiTextEmote == TEXTEMOTE_BECKON) + { + me->setFaction(FACTION_FRIENDLY); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoCast(me, SPELL_PLUCKY_HUMAN, false); + } + } + + if (uiTextEmote == TEXTEMOTE_CHICKEN) + { + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; + else + { + me->setFaction(FACTION_FRIENDLY); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoCast(me, SPELL_PLUCKY_HUMAN, false); + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + } } } - if (uiTextEmote == TEXTEMOTE_CHICKEN) + void UpdateAI(const uint32 uiDiff) { if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; - else { - me->setFaction(FACTION_FRIENDLY); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoCast(me, SPELL_PLUCKY_HUMAN, false); - me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); - } - } - } + if (m_uiResetTimer <= uiDiff) + { + if (!me->getVictim()) + EnterEvadeMode(); + else + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - void UpdateAI(const uint32 uiDiff) - { - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - { - if (m_uiResetTimer <= uiDiff) - { - if (!me->getVictim()) - EnterEvadeMode(); + return; + } else - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - return; + m_uiResetTimer -= uiDiff; } - else - m_uiResetTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } }; -bool GossipHello_npc_plucky(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(738, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_plucky(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CompleteQuest(QUEST_SCOOP); - break; - } - return true; -} - -CreatureAI* GetAI_npc_plucky(Creature* pCreature) -{ - return new npc_pluckyAI(pCreature); -} - enum ePantherCage { ENRAGED_PANTHER = 10992 }; -bool go_panther_cage(Player* pPlayer, GameObject* pGo) +class go_panther_cage : public GameObjectScript { +public: + go_panther_cage() : GameObjectScript("go_panther_cage") { } - if (pPlayer->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - if (Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true)) + + if (pPlayer->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE) { - panther->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - panther->SetReactState(REACT_AGGRESSIVE); - panther->AI()->AttackStart(pPlayer); + if (Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true)) + { + panther->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + panther->SetReactState(REACT_AGGRESSIVE); + panther->AI()->AttackStart(pPlayer); + } } - } - return true ; -} - -struct npc_enraged_pantherAI : public ScriptedAI -{ - npc_enraged_pantherAI(Creature *c) : ScriptedAI(c) {} - - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + return true ; } }; - -CreatureAI* GetAI_npc_enraged_panther(Creature* pCreature) + class npc_enraged_panther : public CreatureScript { - return new npc_enraged_pantherAI(pCreature); -} +public: + npc_enraged_panther() : CreatureScript("npc_enraged_panther") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_enraged_pantherAI(pCreature); + } + + struct npc_enraged_pantherAI : public ScriptedAI + { + npc_enraged_pantherAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; + +}; + void AddSC_thousand_needles() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kanati"; - newscript->GetAI = &GetAI_npc_kanati; - newscript->pQuestAccept = &QuestAccept_npc_kanati; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lakota_windsong"; - newscript->GetAI = &GetAI_npc_lakota_windsong; - newscript->pQuestAccept = &QuestAccept_npc_lakota_windsong; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_paoka_swiftmountain"; - newscript->GetAI = &GetAI_npc_paoka_swiftmountain; - newscript->pQuestAccept = &QuestAccept_npc_paoka_swiftmountain; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_plucky"; - newscript->GetAI = &GetAI_npc_plucky; - newscript->pGossipHello = &GossipHello_npc_plucky; - newscript->pGossipSelect = &GossipSelect_npc_plucky; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_enraged_panther"; - newscript->GetAI = &GetAI_npc_enraged_panther; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_panther_cage"; - newscript->pGOHello = &go_panther_cage; - newscript->RegisterSelf(); + new npc_kanati(); + new npc_lakota_windsong(); + new npc_paoka_swiftmountain(); + new npc_plucky(); + new npc_enraged_panther(); + new go_panther_cage(); } - diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index 71c2c174fc7..a0588735c64 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -36,105 +36,106 @@ EndScriptData */ #define SPELL_UPPERCUT 22916 #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." -//TODO: verify abilities/timers -struct npc_cairne_bloodhoofAI : public ScriptedAI +//TODO: verify abilities/timers class npc_cairne_bloodhoof : public CreatureScript { - npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} +public: + npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { } - uint32 BerserkerCharge_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - uint32 Thunderclap_Timer; - uint32 Uppercut_Timer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - BerserkerCharge_Timer = 30000; - Cleave_Timer = 5000; - MortalStrike_Timer = 10000; - Thunderclap_Timer = 15000; - Uppercut_Timer = 10000; + if (uiAction == GOSSIP_SENDER_INFO) + { + pPlayer->CastSpell(pPlayer, 23123, false); + pPlayer->SEND_GOSSIP_MENU(7014, pCreature->GetGUID()); + } + return true; } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (!UpdateVictim()) - return; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (BerserkerCharge_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_BERSERKER_CHARGE); - BerserkerCharge_Timer = 25000; - } else BerserkerCharge_Timer -= diff; + if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - if (Uppercut_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 20000; - } else Uppercut_Timer -= diff; + pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID()); - if (Thunderclap_Timer <= diff) + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_cairne_bloodhoofAI (pCreature); + } + + struct npc_cairne_bloodhoofAI : public ScriptedAI + { + npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} + + uint32 BerserkerCharge_Timer; + uint32 Cleave_Timer; + uint32 MortalStrike_Timer; + uint32 Thunderclap_Timer; + uint32 Uppercut_Timer; + + void Reset() { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); + BerserkerCharge_Timer = 30000; + Cleave_Timer = 5000; + MortalStrike_Timer = 10000; Thunderclap_Timer = 15000; - } else Thunderclap_Timer -= diff; + Uppercut_Timer = 10000; + } - if (MortalStrike_Timer <= diff) + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + if (!UpdateVictim()) + return; - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + if (BerserkerCharge_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_BERSERKER_CHARGE); + BerserkerCharge_Timer = 25000; + } else BerserkerCharge_Timer -= diff; + + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 20000; + } else Uppercut_Timer -= diff; + + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 15000; + } else Thunderclap_Timer -= diff; + + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + MortalStrike_Timer = 15000; + } else MortalStrike_Timer -= diff; + + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_cairne_bloodhoof(Creature* pCreature) -{ - return new npc_cairne_bloodhoofAI (pCreature); -} -bool GossipHello_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - - pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_SENDER_INFO) - { - pPlayer->CastSpell(pPlayer, 23123, false); - pPlayer->SEND_GOSSIP_MENU(7014, pCreature->GetGUID()); - } - return true; -} void AddSC_thunder_bluff() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_cairne_bloodhoof"; - newscript->GetAI = &GetAI_npc_cairne_bloodhoof; - newscript->pGossipHello = &GossipHello_npc_cairne_bloodhoof; - newscript->pGossipSelect = &GossipSelect_npc_cairne_bloodhoof; - newscript->RegisterSelf(); + new npc_cairne_bloodhoof(); } - diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 19181ba570f..63db08ed1c5 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -45,95 +45,103 @@ EndContentData */ #define ENTRY_TARLORD 6519 #define ENTRY_TARLORD1 6519 #define ENTRY_STOMPER 6513 - -struct npc_ameAI : public npc_escortAI + class npc_ame : public CreatureScript { - npc_ameAI(Creature *c) : npc_escortAI(c) {} +public: + npc_ame() : CreatureScript("npc_ame") { } - uint32 DEMORALIZINGSHOUT_Timer; - - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_CHASING_AME) { + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + DoScriptText(SAY_READY, pCreature, pPlayer); + pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + // Change faction so mobs attack + pCreature->setFaction(113); + } + return true; + } - case 19: - me->SummonCreature(ENTRY_STOMPER, -6391.69, -1730.49, -272.83, 4.96, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO1, me, pPlayer); - break; - case 28: - DoScriptText(SAY_SEARCH, me, pPlayer); - break; - case 38: - me->SummonCreature(ENTRY_TARLORD, -6370.75, -1382.84, -270.51, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO2, me, pPlayer); - break; - case 49: - me->SummonCreature(ENTRY_TARLORD1, -6324.44, -1181.05, -270.17, 4.34, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO3, me, pPlayer); - break; - case 55: - DoScriptText(SAY_FINISH, me, pPlayer); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_CHASING_AME,me); - break; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ameAI(pCreature); + } + + struct npc_ameAI : public npc_escortAI + { + npc_ameAI(Creature *c) : npc_escortAI(c) {} + + uint32 DEMORALIZINGSHOUT_Timer; + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + + case 19: + me->SummonCreature(ENTRY_STOMPER, -6391.69, -1730.49, -272.83, 4.96, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO1, me, pPlayer); + break; + case 28: + DoScriptText(SAY_SEARCH, me, pPlayer); + break; + case 38: + me->SummonCreature(ENTRY_TARLORD, -6370.75, -1382.84, -270.51, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO2, me, pPlayer); + break; + case 49: + me->SummonCreature(ENTRY_TARLORD1, -6324.44, -1181.05, -270.17, 4.34, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO3, me, pPlayer); + break; + case 55: + DoScriptText(SAY_FINISH, me, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_CHASING_AME,me); + break; + + } + } + + void Reset() + { + DEMORALIZINGSHOUT_Timer = 5000; + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_CHASING_AME); + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + if (!UpdateVictim()) + return; + + if (DEMORALIZINGSHOUT_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); + DEMORALIZINGSHOUT_Timer = 70000; + } else DEMORALIZINGSHOUT_Timer -= diff; } - } + }; - void Reset() - { - DEMORALIZINGSHOUT_Timer = 5000; - } - - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(me); - } - - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->FailQuest(QUEST_CHASING_AME); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; - - if (DEMORALIZINGSHOUT_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DEMORALIZINGSHOUT_Timer = 70000; - } else DEMORALIZINGSHOUT_Timer -= diff; - - } }; -bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_CHASING_AME) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - DoScriptText(SAY_READY, pCreature, pPlayer); - pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - // Change faction so mobs attack - pCreature->setFaction(113); - } - return true; -} -CreatureAI* GetAI_npc_ame(Creature* pCreature) -{ - return new npc_ameAI(pCreature); -} /*#### # npc_ringo @@ -168,191 +176,187 @@ enum eRingo NPC_SPRAGGLE = 9997, FACTION_ESCORTEE = 113 }; - -struct npc_ringoAI : public FollowerAI + class npc_ringo : public CreatureScript { - npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_ringo() : CreatureScript("npc_ringo") { } - uint32 m_uiFaintTimer; - uint32 m_uiEndEventProgress; - uint32 m_uiEndEventTimer; - - uint64 SpraggleGUID; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_uiFaintTimer = urand(30000, 60000); - m_uiEndEventProgress = 0; - m_uiEndEventTimer = 1000; - SpraggleGUID = 0; - } - - void MoveInLineOfSight(Unit *pWho) - { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) + if (pQuest->GetQuestId() == QUEST_A_LITTLE_HELP) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + if (npc_ringoAI* pRingoAI = CAST_AI(npc_ringo::npc_ringoAI, pCreature->AI())) { - if (Player* pPlayer = GetLeaderForFollower()) - { - if (pPlayer->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, me); - } - - SpraggleGUID = pWho->GetGUID(); - SetFollowComplete(true); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + pRingoAI->StartFollow(pPlayer, FACTION_ESCORTEE, pQuest); } } + + return true; } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + CreatureAI* GetAI(Creature* pCreature) const { - if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO) - ClearFaint(); + return new npc_ringoAI(pCreature); } - void SetFaint() + struct npc_ringoAI : public FollowerAI { - if (!HasFollowState(STATE_FOLLOW_POSTEVENT)) + npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } + + uint32 m_uiFaintTimer; + uint32 m_uiEndEventProgress; + uint32 m_uiEndEventTimer; + + uint64 SpraggleGUID; + + void Reset() { - SetFollowPaused(true); - - DoScriptText(RAND(SAY_FAINT_1,SAY_FAINT_2,SAY_FAINT_3,SAY_FAINT_4), me); + m_uiFaintTimer = urand(30000, 60000); + m_uiEndEventProgress = 0; + m_uiEndEventTimer = 1000; + SpraggleGUID = 0; } - //what does actually happen here? Emote? Aura? - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } - - void ClearFaint() - { - me->SetStandState(UNIT_STAND_STATE_STAND); - - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) - return; - - DoScriptText(RAND(SAY_WAKE_1,SAY_WAKE_2,SAY_WAKE_3,SAY_WAKE_4), me); - - SetFollowPaused(false); - } - - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void MoveInLineOfSight(Unit *pWho) { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) + { + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + { + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, me); + } + + SpraggleGUID = pWho->GetGUID(); + SetFollowComplete(true); + } + } + } + + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO) + ClearFaint(); + } + + void SetFaint() + { + if (!HasFollowState(STATE_FOLLOW_POSTEVENT)) + { + SetFollowPaused(true); + + DoScriptText(RAND(SAY_FAINT_1,SAY_FAINT_2,SAY_FAINT_3,SAY_FAINT_4), me); + } + + //what does actually happen here? Emote? Aura? + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } + + void ClearFaint() + { + me->SetStandState(UNIT_STAND_STATE_STAND); + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) - { - if (m_uiEndEventTimer <= uiDiff) - { - Unit *pSpraggle = Unit::GetUnit(*me, SpraggleGUID); - if (!pSpraggle || !pSpraggle->isAlive()) - { - SetFollowComplete(); - return; - } + return; - switch(m_uiEndEventProgress) + DoScriptText(RAND(SAY_WAKE_1,SAY_WAKE_2,SAY_WAKE_3,SAY_WAKE_4), me); + + SetFollowPaused(false); + } + + void UpdateFollowerAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + { + if (m_uiEndEventTimer <= uiDiff) { - case 1: - DoScriptText(SAY_RIN_END_1, me); - m_uiEndEventTimer = 3000; - break; - case 2: - DoScriptText(SAY_SPR_END_2, pSpraggle); - m_uiEndEventTimer = 5000; - break; - case 3: - DoScriptText(SAY_RIN_END_3, me); - m_uiEndEventTimer = 1000; - break; - case 4: - DoScriptText(EMOTE_RIN_END_4, me); - SetFaint(); - m_uiEndEventTimer = 9000; - break; - case 5: - DoScriptText(EMOTE_RIN_END_5, me); - ClearFaint(); - m_uiEndEventTimer = 1000; - break; - case 6: - DoScriptText(SAY_RIN_END_6, me); - m_uiEndEventTimer = 3000; - break; - case 7: - DoScriptText(SAY_SPR_END_7, pSpraggle); - m_uiEndEventTimer = 10000; - break; - case 8: - DoScriptText(EMOTE_RIN_END_8, me); - m_uiEndEventTimer = 5000; - break; - case 9: + Unit *pSpraggle = Unit::GetUnit(*me, SpraggleGUID); + if (!pSpraggle || !pSpraggle->isAlive()) + { SetFollowComplete(); - break; - } + return; + } - ++m_uiEndEventProgress; - } - else - m_uiEndEventTimer -= uiDiff; - } - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) - { - if (!HasFollowState(STATE_FOLLOW_PAUSED)) - { - if (m_uiFaintTimer <= uiDiff) - { - SetFaint(); - m_uiFaintTimer = urand(60000, 120000); + switch(m_uiEndEventProgress) + { + case 1: + DoScriptText(SAY_RIN_END_1, me); + m_uiEndEventTimer = 3000; + break; + case 2: + DoScriptText(SAY_SPR_END_2, pSpraggle); + m_uiEndEventTimer = 5000; + break; + case 3: + DoScriptText(SAY_RIN_END_3, me); + m_uiEndEventTimer = 1000; + break; + case 4: + DoScriptText(EMOTE_RIN_END_4, me); + SetFaint(); + m_uiEndEventTimer = 9000; + break; + case 5: + DoScriptText(EMOTE_RIN_END_5, me); + ClearFaint(); + m_uiEndEventTimer = 1000; + break; + case 6: + DoScriptText(SAY_RIN_END_6, me); + m_uiEndEventTimer = 3000; + break; + case 7: + DoScriptText(SAY_SPR_END_7, pSpraggle); + m_uiEndEventTimer = 10000; + break; + case 8: + DoScriptText(EMOTE_RIN_END_8, me); + m_uiEndEventTimer = 5000; + break; + case 9: + SetFollowComplete(); + break; + } + + ++m_uiEndEventProgress; } else - m_uiFaintTimer -= uiDiff; + m_uiEndEventTimer -= uiDiff; } + else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) + { + if (!HasFollowState(STATE_FOLLOW_PAUSED)) + { + if (m_uiFaintTimer <= uiDiff) + { + SetFaint(); + m_uiFaintTimer = urand(60000, 120000); + } + else + m_uiFaintTimer -= uiDiff; + } + } + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_ringo(Creature* pCreature) -{ - return new npc_ringoAI(pCreature); -} -bool QuestAccept_npc_ringo(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_A_LITTLE_HELP) - { - if (npc_ringoAI* pRingoAI = CAST_AI(npc_ringoAI, pCreature->AI())) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - pRingoAI->StartFollow(pPlayer, FACTION_ESCORTEE, pQuest); - } - } - - return true; -} void AddSC_ungoro_crater() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_ame"; - newscript->GetAI = &GetAI_npc_ame; - newscript->pQuestAccept = &QuestAccept_npc_ame; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ringo"; - newscript->GetAI = &GetAI_npc_ringo; - newscript->pQuestAccept = &QuestAccept_npc_ringo; - newscript->RegisterSelf(); + new npc_ame(); + new npc_ringo(); } - diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index c07f80b7c91..e72435a6797 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -42,129 +42,133 @@ EndContentData */ #define GOSSIP_SL3 "What deal?" #define GOSSIP_SL4 "Then what happened?" #define GOSSIP_SL5 "He is not safe, i'll make sure of that." - -bool GossipHello_npc_lorax(Player* pPlayer, Creature* pCreature) + class npc_lorax : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lorax() : CreatureScript("npc_lorax") { } - if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lorax(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(3759, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(3760, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(3761, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(3762, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(3763, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(5126); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(3759, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(3760, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(3761, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(3762, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(3763, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(5126); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_rivern_frostwind ######*/ - -bool GossipHello_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature) + class npc_rivern_frostwind : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rivern_frostwind() : CreatureScript("npc_rivern_frostwind") { } - if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_witch_doctor_mauari ######*/ #define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please." - -bool GossipHello_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature) + class npc_witch_doctor_mauari : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_witch_doctor_mauari() : CreatureScript("npc_witch_doctor_mauari") { } - if (pPlayer->GetQuestRewardStatus(975)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(3377, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(3375, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 16351, false); + } - return true; -} - -bool GossipSelect_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 16351, false); + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestRewardStatus(975)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(3377, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(3375, pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_winterspring() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_lorax"; - newscript->pGossipHello = &GossipHello_npc_lorax; - newscript->pGossipSelect = &GossipSelect_npc_lorax; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rivern_frostwind"; - newscript->pGossipHello = &GossipHello_npc_rivern_frostwind; - newscript->pGossipSelect = &GossipSelect_npc_rivern_frostwind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_witch_doctor_mauari"; - newscript->pGossipHello = &GossipHello_npc_witch_doctor_mauari; - newscript->pGossipSelect = &GossipSelect_npc_witch_doctor_mauari; - newscript->RegisterSelf(); + new npc_lorax(); + new npc_rivern_frostwind(); + new npc_witch_doctor_mauari(); } - diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 76ffba26391..7ea4afbcb4b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -95,10 +95,10 @@ public: { boss_anub_arakAI(Creature *c) : ScriptedAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; bool bChanneling; bool bGuardianSummoned; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index bd83605cb80..223c75d1a27 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -53,12 +53,12 @@ public: { boss_hadronoxAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); fMaxDistance = 50.0f; bFirstTime = true; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiAcidTimer; uint32 uiLeechTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 183721ba62c..0e1b103aa55 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -101,10 +101,10 @@ public: { boss_krik_thirAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiMindFlayTimer; uint32 uiCurseFatigueTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index a845d609b61..bc0d56cceae 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -31,9 +31,9 @@ class instance_azjol_nerub : public InstanceMapScript public: instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub") { } - struct instance_azjol_nerub_ScriptedInstance : public ScriptedInstance + struct instance_azjol_nerub_InstanceScript : public InstanceScript { - instance_azjol_nerub_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_azjol_nerub_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 uiKrikthir; uint64 uiHadronox; @@ -204,9 +204,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_azjol_nerub_ScriptedInstance(map); + return new instance_azjol_nerub_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp index 1bf1fcdfdf0..cdceaeb1f81 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp @@ -50,11 +50,11 @@ public: { boss_amanitarAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bFirstTime = true; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiRootTimer; uint32 uiBashTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp index c9259da2298..3845ad53c2f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp @@ -64,7 +64,7 @@ public: { boss_elder_nadoxAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiPlagueTimer; @@ -76,7 +76,7 @@ public: bool bGuardSpawned; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { @@ -197,10 +197,10 @@ public: { mob_ahnkahar_nerubianAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 uiSprintTimer; void Reset() diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp index 4d7cb87a8d4..f3d14a1cbe6 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp @@ -69,10 +69,10 @@ public: { boss_volazjAI(Creature* pCreature) : ScriptedAI(pCreature),Summons(me) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 uiMindFlayTimer; uint32 uiShadowBoltVolleyTimer; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 06f28d7d5f3..df6801fcac4 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -72,12 +72,12 @@ public: { boss_jedoga_shadowseekerAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bFirstTime = true; bPreDone = false; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiOpFerTimer; uint32 uiCycloneTimer; @@ -339,10 +339,10 @@ public: { mob_jedoga_initiandAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 bCheckTimer; @@ -504,14 +504,14 @@ public: { npc_jedogas_aufseher_triggerAI(Creature* c) : Scripted_NoMovementAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bRemoved = false; bRemoved2 = false; bCasted = false; bCasted2 = false; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool bRemoved; bool bRemoved2; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index 63e99dac63f..12e8791848a 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -81,7 +81,7 @@ public: { boss_taldaramAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -98,7 +98,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -339,11 +339,11 @@ public: { mob_taldaram_flamesphereAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiDespawnTimer; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -387,7 +387,7 @@ public: bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - ScriptedInstance *pInstance = pGO->GetInstanceData(); + InstanceScript *pInstance = pGO->GetInstanceScript(); Creature *pPrinceTaldaram = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_PRINCE_TALDARAM) : 0); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp index cb7bc940bf2..b505b7236ba 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp @@ -38,9 +38,9 @@ class instance_ahnkahet : public InstanceMapScript public: instance_ahnkahet() : InstanceMapScript("instance_ahnkahet") { } - struct instance_ahnkahet_ScriptedInstance : public ScriptedInstance + struct instance_ahnkahet_InstanceScript : public InstanceScript { - instance_ahnkahet_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_ahnkahet_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 Elder_Nadox; uint64 Prince_Taldaram; @@ -302,9 +302,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_ahnkahet_ScriptedInstance(map); + return new instance_ahnkahet_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index adc3449862b..7113194ea33 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -56,456 +56,461 @@ enum eSpells SPELL_WAKING_NIGHTMARE_H = 67677 }; -struct boss_eadricAI : public ScriptedAI +class boss_eadric : public CreatureScript { - boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_eadric() : CreatureScript("boss_eadric") { } + struct boss_eadricAI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - pCreature->SetReactState(REACT_PASSIVE); - pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint32 uiVenganceTimer; - uint32 uiRadianceTimer; - uint32 uiHammerJusticeTimer; - uint32 uiResetTimer; - - bool bDone; - - void Reset() - { - uiVenganceTimer = 10000; - uiRadianceTimer = 16000; - uiHammerJusticeTimer = 25000; - uiResetTimer = 5000; - - bDone = false; - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + boss_eadricAI(Creature* pCreature) : ScriptedAI(pCreature) { - damage = 0; - EnterEvadeMode(); - me->setFaction(35); - bDone = true; + pInstance = pCreature->GetInstanceScript(); + pCreature->SetReactState(REACT_PASSIVE); + pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); } - } - void MovementInform(uint32 MovementType, uint32 /*Data*/) - { - if (MovementType != POINT_MOTION_TYPE) - return; + InstanceScript* pInstance; - if (pInstance) - pInstance->SetData(BOSS_ARGENT_CHALLENGE_E, DONE); + uint32 uiVenganceTimer; + uint32 uiRadianceTimer; + uint32 uiHammerJusticeTimer; + uint32 uiResetTimer; - me->DisappearAndDie(); - } + bool bDone; - void UpdateAI(const uint32 uiDiff) - { - if (bDone && uiResetTimer <= uiDiff) + void Reset() { - me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); - bDone = false; - } else uiResetTimer -= uiDiff; - - if (!UpdateVictim()) - return; - - if (uiHammerJusticeTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); - - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) - { - if (pTarget && pTarget->isAlive()) - { - DoCast(pTarget, SPELL_HAMMER_JUSTICE); - DoCast(pTarget, SPELL_HAMMER_RIGHTEOUS); - } - } - uiHammerJusticeTimer = 25000; - } else uiHammerJusticeTimer -= uiDiff; - - if (uiVenganceTimer <= uiDiff) - { - DoCast(me,SPELL_VENGEANCE); - uiVenganceTimer = 10000; - } else uiVenganceTimer -= uiDiff; - - if (uiRadianceTimer <= uiDiff) - { - DoCastAOE(SPELL_RADIANCE); - uiRadianceTimer = 16000; - } else uiRadianceTimer -= uiDiff; + uiHammerJusticeTimer = 25000; + uiResetTimer = 5000; - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_eadric(Creature* pCreature) -{ - return new boss_eadricAI(pCreature); -} - -struct boss_paletressAI : public ScriptedAI -{ - boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - MemoryGUID = 0; - pCreature->SetReactState(REACT_PASSIVE); - pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pCreature->RestoreFaction(); - } - - ScriptedInstance* pInstance; - - Creature* pMemory; - uint64 MemoryGUID; - - bool bHealth; - bool bDone; - - uint32 uiHolyFireTimer; - uint32 uiHolySmiteTimer; - uint32 uiRenewTimer; - uint32 uiResetTimer; - - void Reset() - { - me->RemoveAllAuras(); - - uiHolyFireTimer = urand(9000,12000); - uiHolySmiteTimer = urand(5000,7000); - uiRenewTimer = urand(2000,5000); - - uiResetTimer = 7000; - - bHealth = false; - bDone = false; - - if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) - if (pMemory->isAlive()) - pMemory->RemoveFromWorld(); - } - - void SetData(uint32 uiId, uint32 /*uiValue*/) - { - if (uiId == 1) - me->RemoveAura(SPELL_SHIELD); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) - { - damage = 0; - EnterEvadeMode(); - me->setFaction(35); - bDone = true; - } - } - - void MovementInform(uint32 MovementType, uint32 Point) - { - if (MovementType != POINT_MOTION_TYPE || Point != 0) - return; - - if (pInstance) - pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE); - - me->DisappearAndDie(); - } - - void UpdateAI(const uint32 uiDiff) - { - if (bDone && uiResetTimer <= uiDiff) - { - me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); bDone = false; - } else uiResetTimer -= uiDiff; + } - if (!UpdateVictim()) - return; - - if (uiHolyFireTimer <= uiDiff) + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + if (damage >= me->GetHealth()) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_HOLY_FIRE); + damage = 0; + EnterEvadeMode(); + me->setFaction(35); + bDone = true; } - if (me->HasAura(SPELL_SHIELD)) - uiHolyFireTimer = 13000; - else - uiHolyFireTimer = urand(9000,12000); - } else uiHolyFireTimer -= uiDiff; + } - if (uiHolySmiteTimer <= uiDiff) + void MovementInform(uint32 MovementType, uint32 /*Data*/) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_SMITE); - } - if (me->HasAura(SPELL_SHIELD)) - uiHolySmiteTimer = 9000; - else - uiHolySmiteTimer = urand(5000,7000); - } else uiHolySmiteTimer -= uiDiff; + if (MovementType != POINT_MOTION_TYPE) + return; - if (me->HasAura(SPELL_SHIELD)) - if (uiRenewTimer <= uiDiff) + if (pInstance) + pInstance->SetData(BOSS_ARGENT_CHALLENGE_E, DONE); + + me->DisappearAndDie(); + } + + void UpdateAI(const uint32 uiDiff) + { + if (bDone && uiResetTimer <= uiDiff) + { + me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); + bDone = false; + } else uiResetTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + if (uiHammerJusticeTimer <= uiDiff) { me->InterruptNonMeleeSpells(true); - uint8 uiTarget = urand(0,1); - switch(uiTarget) + + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) { - case 0: - DoCast(me,SPELL_RENEW); - break; - case 1: - if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) - if (pMemory->isAlive()) - DoCast(pMemory, SPELL_RENEW); - break; + if (pTarget && pTarget->isAlive()) + { + DoCast(pTarget, SPELL_HAMMER_JUSTICE); + DoCast(pTarget, SPELL_HAMMER_RIGHTEOUS); + } } - uiRenewTimer = urand(15000,17000); - } else uiRenewTimer -= uiDiff; + uiHammerJusticeTimer = 25000; + } else uiHammerJusticeTimer -= uiDiff; + if (uiVenganceTimer <= uiDiff) + { + DoCast(me,SPELL_VENGEANCE); - if (!bHealth && me->GetHealth()*100 / me->GetMaxHealth() <= 25) - { - me->InterruptNonMeleeSpells(true); - DoCastAOE(SPELL_HOLY_NOVA,false); - DoCast(me, SPELL_SHIELD); - DoCastAOE(SPELL_SUMMON_MEMORY,false); - DoCastAOE(SPELL_CONFESS,false); + uiVenganceTimer = 10000; + } else uiVenganceTimer -= uiDiff; - bHealth = true; + if (uiRadianceTimer <= uiDiff) + { + DoCastAOE(SPELL_RADIANCE); + + uiRadianceTimer = 16000; + } else uiRadianceTimer -= uiDiff; + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } - - void JustSummoned(Creature* pSummon) + CreatureAI* GetAI(Creature* pCreature) const { - MemoryGUID = pSummon->GetGUID(); + return new boss_eadricAI(pCreature); } }; -CreatureAI* GetAI_boss_paletress(Creature* pCreature) +class boss_paletress : public CreatureScript { - return new boss_paletressAI(pCreature); -} +public: + boss_paletress() : CreatureScript("boss_paletress") { } -struct npc_memoryAI : public ScriptedAI -{ - npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiOldWoundsTimer; - uint32 uiShadowPastTimer; - uint32 uiWakingNightmare; - - void Reset() + struct boss_paletressAI : public ScriptedAI { - uiOldWoundsTimer = 12000; - uiShadowPastTimer = 5000; - uiWakingNightmare = 7000; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (uiOldWoundsTimer <= uiDiff) + boss_paletressAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + pInstance = pCreature->GetInstanceScript(); + + MemoryGUID = 0; + pCreature->SetReactState(REACT_PASSIVE); + pCreature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pCreature->RestoreFaction(); + } + + InstanceScript* pInstance; + + Creature* pMemory; + uint64 MemoryGUID; + + bool bHealth; + bool bDone; + + uint32 uiHolyFireTimer; + uint32 uiHolySmiteTimer; + uint32 uiRenewTimer; + uint32 uiResetTimer; + + void Reset() + { + me->RemoveAllAuras(); + + uiHolyFireTimer = urand(9000,12000); + uiHolySmiteTimer = urand(5000,7000); + uiRenewTimer = urand(2000,5000); + + uiResetTimer = 7000; + + bHealth = false; + bDone = false; + + if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (pMemory->isAlive()) + pMemory->RemoveFromWorld(); + } + + void SetData(uint32 uiId, uint32 /*uiValue*/) + { + if (uiId == 1) + me->RemoveAura(SPELL_SHIELD); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage >= me->GetHealth()) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, SPELL_OLD_WOUNDS); + damage = 0; + EnterEvadeMode(); + me->setFaction(35); + bDone = true; } + } + + void MovementInform(uint32 MovementType, uint32 Point) + { + if (MovementType != POINT_MOTION_TYPE || Point != 0) + return; + + if (pInstance) + pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE); + + me->DisappearAndDie(); + } + + void UpdateAI(const uint32 uiDiff) + { + if (bDone && uiResetTimer <= uiDiff) + { + me->GetMotionMaster()->MovePoint(0,746.87,665.87,411.75); + bDone = false; + } else uiResetTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + if (uiHolyFireTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_HOLY_FIRE); + } + if (me->HasAura(SPELL_SHIELD)) + uiHolyFireTimer = 13000; + else + uiHolyFireTimer = urand(9000,12000); + } else uiHolyFireTimer -= uiDiff; + + if (uiHolySmiteTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_SMITE); + } + if (me->HasAura(SPELL_SHIELD)) + uiHolySmiteTimer = 9000; + else + uiHolySmiteTimer = urand(5000,7000); + } else uiHolySmiteTimer -= uiDiff; + + if (me->HasAura(SPELL_SHIELD)) + if (uiRenewTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); + uint8 uiTarget = urand(0,1); + switch(uiTarget) + { + case 0: + DoCast(me,SPELL_RENEW); + break; + case 1: + if (Creature *pMemory = Unit::GetCreature(*me, MemoryGUID)) + if (pMemory->isAlive()) + DoCast(pMemory, SPELL_RENEW); + break; + } + uiRenewTimer = urand(15000,17000); + } else uiRenewTimer -= uiDiff; + + + if (!bHealth && me->GetHealth()*100 / me->GetMaxHealth() <= 25) + { + me->InterruptNonMeleeSpells(true); + DoCastAOE(SPELL_HOLY_NOVA,false); + DoCast(me, SPELL_SHIELD); + DoCastAOE(SPELL_SUMMON_MEMORY,false); + DoCastAOE(SPELL_CONFESS,false); + + bHealth = true; + } + + DoMeleeAttackIfReady(); + } + + void JustSummoned(Creature* pSummon) + { + MemoryGUID = pSummon->GetGUID(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_paletressAI(pCreature); + } +}; + +class npc_memory : public CreatureScript +{ +public: + npc_memory() : CreatureScript("npc_memory") { } + + struct npc_memoryAI : public ScriptedAI + { + npc_memoryAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + uint32 uiOldWoundsTimer; + uint32 uiShadowPastTimer; + uint32 uiWakingNightmare; + + void Reset() + { uiOldWoundsTimer = 12000; - }else uiOldWoundsTimer -= uiDiff; - - if (uiWakingNightmare <= uiDiff) - { - DoCast(me, SPELL_WAKING_NIGHTMARE); - uiWakingNightmare = 7000; - }else uiWakingNightmare -= uiDiff; - - if (uiShadowPastTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_SHADOWS_PAST); - } uiShadowPastTimer = 5000; - }else uiShadowPastTimer -= uiDiff; + uiWakingNightmare = 7000; + } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (me->isSummon()) + void UpdateAI(const uint32 uiDiff) { - if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + if (!UpdateVictim()) + return; + + if (uiOldWoundsTimer <= uiDiff) { - if (pSummoner && pSummoner->isAlive()) - CAST_CRE(pSummoner)->AI()->SetData(1,0); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, SPELL_OLD_WOUNDS); + } + uiOldWoundsTimer = 12000; + }else uiOldWoundsTimer -= uiDiff; + + if (uiWakingNightmare <= uiDiff) + { + DoCast(me, SPELL_WAKING_NIGHTMARE); + uiWakingNightmare = 7000; + }else uiWakingNightmare -= uiDiff; + + if (uiShadowPastTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_SHADOWS_PAST); + } + uiShadowPastTimer = 5000; + }else uiShadowPastTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (me->isSummon()) + { + if (Unit* pSummoner = CAST_SUM(me)->GetSummoner()) + { + if (pSummoner && pSummoner->isAlive()) + CAST_CRE(pSummoner)->AI()->SetData(1,0); + } } } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_memoryAI(pCreature); } }; -CreatureAI* GetAI_npc_memory(Creature* pCreature) +class npc_argent_soldier : public CreatureScript { - return new npc_memoryAI(pCreature); -} +public: + npc_argent_soldier() : CreatureScript("npc_argent_soldier") { } -// THIS AI NEEDS MORE IMPROVEMENTS -struct npc_argent_soldierAI : public npc_escortAI -{ - npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) + // THIS AI NEEDS MORE IMPROVEMENTS + struct npc_argent_soldierAI : public npc_escortAI { - pInstance = pCreature->GetInstanceData(); - me->SetReactState(REACT_DEFENSIVE); - SetDespawnAtEnd(false); - uiWaypoint = 0; - } - - ScriptedInstance* pInstance; - - uint8 uiWaypoint; - - void WaypointReached(uint32 uiPoint) - { - if (uiPoint == 0) + npc_argent_soldierAI(Creature* pCreature) : npc_escortAI(pCreature) { - switch(uiWaypoint) + pInstance = pCreature->GetInstanceScript(); + me->SetReactState(REACT_DEFENSIVE); + SetDespawnAtEnd(false); + uiWaypoint = 0; + } + + InstanceScript* pInstance; + + uint8 uiWaypoint; + + void WaypointReached(uint32 uiPoint) + { + if (uiPoint == 0) { - case 0: - me->SetOrientation(5.81); + switch(uiWaypoint) + { + case 0: + me->SetOrientation(5.81); + break; + case 1: + me->SetOrientation(4.60); + break; + case 2: + me->SetOrientation(2.79); + break; + } + + me->SendMovementFlagUpdate(); + } + } + + void SetData(uint32 uiType, uint32 /*uiData*/) + { + switch(me->GetEntry()) + { + case NPC_ARGENT_LIGHWIELDER: + switch(uiType) + { + case 0: + AddWaypoint(0,712.14,628.42,411.88); + break; + case 1: + AddWaypoint(0,742.44,650.29,411.79); + break; + case 2: + AddWaypoint(0,783.33,615.29,411.84); + break; + } break; - case 1: - me->SetOrientation(4.60); + case NPC_ARGENT_MONK: + switch(uiType) + { + case 0: + AddWaypoint(0,713.12,632.97,411.90); + break; + case 1: + AddWaypoint(0,746.73,650.24,411.56); + break; + case 2: + AddWaypoint(0,781.32,610.54,411.82); + break; + } break; - case 2: - me->SetOrientation(2.79); + case NPC_PRIESTESS: + switch(uiType) + { + case 0: + AddWaypoint(0,715.06,637.07,411.91); + break; + case 1: + AddWaypoint(0,750.72,650.20,411.77); + break; + case 2: + AddWaypoint(0,779.77,607.03,411.81); + break; + } break; } - me->SendMovementFlagUpdate(); + Start(false,true,0); + uiWaypoint = uiType; } - } - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch(me->GetEntry()) + void UpdateAI(const uint32 uiDiff) { - case NPC_ARGENT_LIGHWIELDER: - switch(uiType) - { - case 0: - AddWaypoint(0,712.14,628.42,411.88); - break; - case 1: - AddWaypoint(0,742.44,650.29,411.79); - break; - case 2: - AddWaypoint(0,783.33,615.29,411.84); - break; - } - break; - case NPC_ARGENT_MONK: - switch(uiType) - { - case 0: - AddWaypoint(0,713.12,632.97,411.90); - break; - case 1: - AddWaypoint(0,746.73,650.24,411.56); - break; - case 2: - AddWaypoint(0,781.32,610.54,411.82); - break; - } - break; - case NPC_PRIESTESS: - switch(uiType) - { - case 0: - AddWaypoint(0,715.06,637.07,411.91); - break; - case 1: - AddWaypoint(0,750.72,650.20,411.77); - break; - case 2: - AddWaypoint(0,779.77,607.03,411.81); - break; - } - break; + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } - Start(false,true,0); - uiWaypoint = uiType; - } + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED,pInstance->GetData(DATA_ARGENT_SOLDIER_DEFEATED) + 1); + } + }; - void UpdateAI(const uint32 uiDiff) + CreatureAI* GetAI(Creature* pCreature) const { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED,pInstance->GetData(DATA_ARGENT_SOLDIER_DEFEATED) + 1); + return new npc_argent_soldierAI(pCreature); } }; -CreatureAI* GetAI_npc_argent_soldier(Creature* pCreature) -{ - return new npc_argent_soldierAI(pCreature); -} - void AddSC_boss_argent_challenge() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "boss_eadric"; - NewScript->GetAI = &GetAI_boss_eadric; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_paletress"; - NewScript->GetAI = &GetAI_boss_paletress; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_memory"; - NewScript->GetAI = &GetAI_npc_memory; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_argent_soldier"; - NewScript->GetAI = &GetAI_npc_argent_soldier; - NewScript->RegisterSelf(); + new boss_paletress(); + new npc_memory(); + new npc_argent_soldier(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 14b44079719..ee06c38ed9e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -71,302 +71,306 @@ enum ePhases PHASE_GHOST = 3 }; -struct boss_black_knightAI : public ScriptedAI +class boss_black_knight : public CreatureScript { - boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_black_knight() : CreatureScript("boss_black_knight") { } + + struct boss_black_knightAI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - std::list SummonList; - - bool bEventInProgress; - bool bEvent; - bool bSummonArmy; - bool bDeathArmyDone; - - uint8 uiPhase; - - uint32 uiPlagueStrikeTimer; - uint32 uiIcyTouchTimer; - uint32 uiDeathRespiteTimer; - uint32 uiObliterateTimer; - uint32 uiDesecration; - uint32 uiResurrectTimer; - uint32 uiDeathArmyCheckTimer; - uint32 uiGhoulExplodeTimer; - uint32 uiDeathBiteTimer; - uint32 uiMarkedDeathTimer; - - void Reset() - { - RemoveSummons(); - me->SetDisplayId(me->GetNativeDisplayId()); - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - - bEventInProgress = false; - bEvent = false; - bSummonArmy = false; - bDeathArmyDone = false; - - uiPhase = PHASE_UNDEAD; - - uiIcyTouchTimer = urand(5000,9000); - uiPlagueStrikeTimer = urand(10000,13000); - uiDeathRespiteTimer = urand(15000,16000); - uiObliterateTimer = urand(17000,19000); - uiDesecration = urand(15000,16000); - uiDeathArmyCheckTimer = 7000; - uiResurrectTimer = 4000; - uiGhoulExplodeTimer = 8000; - uiDeathBiteTimer = urand (2000,4000); - uiMarkedDeathTimer = urand (5000,7000); - } - - void RemoveSummons() - { - if (SummonList.empty()) - return; - - for (std::list::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) + boss_black_knightAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - if (pTemp) - pTemp->DisappearAndDie(); + pInstance = pCreature->GetInstanceScript(); } - SummonList.clear(); - } - void JustSummoned(Creature* pSummon) - { - SummonList.push_back(pSummon->GetGUID()); - pSummon->AI()->AttackStart(me->getVictim()); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + std::list SummonList; - if (bEventInProgress) - if (uiResurrectTimer <= uiDiff) - { - me->SetHealth(me->GetMaxHealth()); - DoCast(me,SPELL_BLACK_KNIGHT_RES,true); - uiPhase++; - uiResurrectTimer = 4000; - bEventInProgress = false; - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - } else uiResurrectTimer -= uiDiff; + bool bEventInProgress; + bool bEvent; + bool bSummonArmy; + bool bDeathArmyDone; - switch(uiPhase) + uint8 uiPhase; + + uint32 uiPlagueStrikeTimer; + uint32 uiIcyTouchTimer; + uint32 uiDeathRespiteTimer; + uint32 uiObliterateTimer; + uint32 uiDesecration; + uint32 uiResurrectTimer; + uint32 uiDeathArmyCheckTimer; + uint32 uiGhoulExplodeTimer; + uint32 uiDeathBiteTimer; + uint32 uiMarkedDeathTimer; + + void Reset() { - case PHASE_UNDEAD: - case PHASE_SKELETON: + RemoveSummons(); + me->SetDisplayId(me->GetNativeDisplayId()); + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + + bEventInProgress = false; + bEvent = false; + bSummonArmy = false; + bDeathArmyDone = false; + + uiPhase = PHASE_UNDEAD; + + uiIcyTouchTimer = urand(5000,9000); + uiPlagueStrikeTimer = urand(10000,13000); + uiDeathRespiteTimer = urand(15000,16000); + uiObliterateTimer = urand(17000,19000); + uiDesecration = urand(15000,16000); + uiDeathArmyCheckTimer = 7000; + uiResurrectTimer = 4000; + uiGhoulExplodeTimer = 8000; + uiDeathBiteTimer = urand (2000,4000); + uiMarkedDeathTimer = urand (5000,7000); + } + + void RemoveSummons() + { + if (SummonList.empty()) + return; + + for (std::list::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) { - if (uiIcyTouchTimer <= uiDiff) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (pTemp) + pTemp->DisappearAndDie(); + } + SummonList.clear(); + } + + void JustSummoned(Creature* pSummon) + { + SummonList.push_back(pSummon->GetGUID()); + pSummon->AI()->AttackStart(me->getVictim()); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (bEventInProgress) + if (uiResurrectTimer <= uiDiff) { - DoCastVictim(SPELL_ICY_TOUCH); - uiIcyTouchTimer = urand(5000,7000); - } else uiIcyTouchTimer -= uiDiff; - if (uiPlagueStrikeTimer <= uiDiff) + me->SetHealth(me->GetMaxHealth()); + DoCast(me,SPELL_BLACK_KNIGHT_RES,true); + uiPhase++; + uiResurrectTimer = 4000; + bEventInProgress = false; + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + } else uiResurrectTimer -= uiDiff; + + switch(uiPhase) + { + case PHASE_UNDEAD: + case PHASE_SKELETON: { - DoCastVictim(SPELL_ICY_TOUCH); - uiPlagueStrikeTimer = urand(12000,15000); - } else uiPlagueStrikeTimer -= uiDiff; - if (uiObliterateTimer <= uiDiff) - { - DoCastVictim(SPELL_OBLITERATE); - uiObliterateTimer = urand(17000,19000); - } else uiObliterateTimer -= uiDiff; - switch(uiPhase) - { - case PHASE_UNDEAD: + if (uiIcyTouchTimer <= uiDiff) { - if (uiDeathRespiteTimer <= uiDiff) + DoCastVictim(SPELL_ICY_TOUCH); + uiIcyTouchTimer = urand(5000,7000); + } else uiIcyTouchTimer -= uiDiff; + if (uiPlagueStrikeTimer <= uiDiff) + { + DoCastVictim(SPELL_ICY_TOUCH); + uiPlagueStrikeTimer = urand(12000,15000); + } else uiPlagueStrikeTimer -= uiDiff; + if (uiObliterateTimer <= uiDiff) + { + DoCastVictim(SPELL_OBLITERATE); + uiObliterateTimer = urand(17000,19000); + } else uiObliterateTimer -= uiDiff; + switch(uiPhase) + { + case PHASE_UNDEAD: { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiDeathRespiteTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_DEATH_RESPITE); - } - uiDeathRespiteTimer = urand(15000,16000); - } else uiDeathRespiteTimer -= uiDiff; - break; - } - case PHASE_SKELETON: - { - if (!bSummonArmy) - { - bSummonArmy = true; - me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - DoCast(me, SPELL_ARMY_DEAD); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_DEATH_RESPITE); + } + uiDeathRespiteTimer = urand(15000,16000); + } else uiDeathRespiteTimer -= uiDiff; + break; } - if (!bDeathArmyDone) - if (uiDeathArmyCheckTimer <= uiDiff) - { - me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - uiDeathArmyCheckTimer = 0; - bDeathArmyDone = true; - } else uiDeathArmyCheckTimer -= uiDiff; - if (uiDesecration <= uiDiff) + case PHASE_SKELETON: { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!bSummonArmy) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_DESECRATION); + bSummonArmy = true; + me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + DoCast(me, SPELL_ARMY_DEAD); } - uiDesecration = urand(15000,16000); - } else uiDesecration -= uiDiff; - if (uiGhoulExplodeTimer <= uiDiff) - { - DoCast(me, SPELL_GHOUL_EXPLODE); - uiGhoulExplodeTimer = 8000; - } else uiGhoulExplodeTimer -= uiDiff; + if (!bDeathArmyDone) + if (uiDeathArmyCheckTimer <= uiDiff) + { + me->clearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + uiDeathArmyCheckTimer = 0; + bDeathArmyDone = true; + } else uiDeathArmyCheckTimer -= uiDiff; + if (uiDesecration <= uiDiff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_DESECRATION); + } + uiDesecration = urand(15000,16000); + } else uiDesecration -= uiDiff; + if (uiGhoulExplodeTimer <= uiDiff) + { + DoCast(me, SPELL_GHOUL_EXPLODE); + uiGhoulExplodeTimer = 8000; + } else uiGhoulExplodeTimer -= uiDiff; + break; + } break; } break; } - break; - } - case PHASE_GHOST: - { - if (uiDeathBiteTimer <= uiDiff) + case PHASE_GHOST: { - DoCastAOE(SPELL_DEATH_BITE); - uiDeathBiteTimer = urand (2000, 4000); - } else uiDeathBiteTimer -= uiDiff; - if (uiMarkedDeathTimer <= uiDiff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (uiDeathBiteTimer <= uiDiff) { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget,SPELL_MARKED_DEATH); - } - uiMarkedDeathTimer = urand (5000, 7000); - } else uiMarkedDeathTimer -= uiDiff; - break; + DoCastAOE(SPELL_DEATH_BITE); + uiDeathBiteTimer = urand (2000, 4000); + } else uiDeathBiteTimer -= uiDiff; + if (uiMarkedDeathTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget,SPELL_MARKED_DEATH); + } + uiMarkedDeathTimer = urand (5000, 7000); + } else uiMarkedDeathTimer -= uiDiff; + break; + } } + + if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0) + DoMeleeAttackIfReady(); } - if (!me->hasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0) - DoMeleeAttackIfReady(); - } - - void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) - { - if (uiDamage > me->GetHealth() && uiPhase <= PHASE_SKELETON) + void DamageTaken(Unit* /*pDoneBy*/, uint32& uiDamage) { - uiDamage = 0; - me->SetHealth(0); - me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); - RemoveSummons(); - switch(uiPhase) + if (uiDamage > me->GetHealth() && uiPhase <= PHASE_SKELETON) { - case PHASE_UNDEAD: - me->SetDisplayId(MODEL_SKELETON); - break; - case PHASE_SKELETON: - me->SetDisplayId(MODEL_GHOST); - break; + uiDamage = 0; + me->SetHealth(0); + me->addUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + RemoveSummons(); + switch(uiPhase) + { + case PHASE_UNDEAD: + me->SetDisplayId(MODEL_SKELETON); + break; + case PHASE_SKELETON: + me->SetDisplayId(MODEL_GHOST); + break; + } + bEventInProgress = true; } - bEventInProgress = true; } - } - void JustDied(Unit* /*pKiller*/) + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_BLACK_KNIGHT,DONE); + } + }; + + CreatureAI* GetAI(Creature *pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_BLACK_KNIGHT,DONE); + return new boss_black_knightAI (pCreature); } }; -CreatureAI* GetAI_boss_black_knight(Creature *pCreature) +class npc_risen_ghoul : public CreatureScript { - return new boss_black_knightAI (pCreature); -} +public: + npc_risen_ghoul() : CreatureScript("npc_risen_ghoul") { } -struct npc_risen_ghoulAI : public ScriptedAI -{ - npc_risen_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiAttackTimer; - - void Reset() + struct npc_risen_ghoulAI : public ScriptedAI { - uiAttackTimer = 3500; - } + npc_risen_ghoulAI(Creature* pCreature) : ScriptedAI(pCreature) {} - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + uint32 uiAttackTimer; - if (uiAttackTimer <= uiDiff) + void Reset() { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - { - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, (SPELL_LEAP)); - } uiAttackTimer = 3500; - } else uiAttackTimer -= uiDiff; + } - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (uiAttackTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + { + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, (SPELL_LEAP)); + } + uiAttackTimer = 3500; + } else uiAttackTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_risen_ghoulAI(pCreature); } }; -CreatureAI* GetAI_npc_risen_ghoul(Creature* pCreature) +class npc_black_knight_skeletal_gryphon : public CreatureScript { - return new npc_risen_ghoulAI(pCreature); -} +public: + npc_black_knight_skeletal_gryphon() : CreatureScript("npc_black_knight_skeletal_gryphon") { } -struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI -{ - npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) + struct npc_black_knight_skeletal_gryphonAI : public npc_escortAI { - Start(false,true,0,NULL); - } + npc_black_knight_skeletal_gryphonAI(Creature* pCreature) : npc_escortAI(pCreature) + { + Start(false,true,0,NULL); + } - void WaypointReached(uint32 /*i*/) + void WaypointReached(uint32 /*i*/) + { + + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + } + + }; + + CreatureAI* GetAI(Creature* pCreature) const { - + return new npc_black_knight_skeletal_gryphonAI(pCreature); } - - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - } - }; -CreatureAI* GetAI_npc_black_knight_skeletal_gryphon(Creature* pCreature) -{ - return new npc_black_knight_skeletal_gryphonAI(pCreature); -} - void AddSC_boss_black_knight() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "boss_black_knight"; - NewScript->GetAI = &GetAI_boss_black_knight; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_risen_ghoul"; - NewScript->GetAI = &GetAI_npc_risen_ghoul; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "npc_black_knight_skeletal_gryphon"; - NewScript->GetAI = &GetAI_npc_black_knight_skeletal_gryphon; - NewScript->RegisterSelf(); + new npc_risen_ghoul(); + new npc_black_knight_skeletal_gryphon(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 53b71a5760e..9569a68476f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -118,7 +118,7 @@ void AggroAllPlayers(Creature* pTemp) bool GrandChampionsOutVehicle(Creature* me) { - ScriptedInstance* pInstance = me->GetInstanceData(); + InstanceScript* pInstance = me->GetInstanceScript(); if (!pInstance) return false; @@ -143,129 +143,107 @@ bool GrandChampionsOutVehicle(Creature* me) * Script Complete: 25%. * */ -struct generic_vehicleAI_toc5AI : public npc_escortAI +class generic_vehicleAI_toc5 : public CreatureScript { - generic_vehicleAI_toc5AI(Creature* pCreature) : npc_escortAI(pCreature) +public: + generic_vehicleAI_toc5() : CreatureScript("generic_vehicleAI_toc5") { } + + struct generic_vehicleAI_toc5AI : public npc_escortAI { - SetDespawnAtEnd(false); - uiWaypointPath = 0; - - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiChargeTimer; - uint32 uiShieldBreakerTimer; - uint32 uiBuffTimer; - - uint32 uiWaypointPath; - - void Reset() - { - uiChargeTimer = 5000; - uiShieldBreakerTimer = 8000; - uiBuffTimer = urand(30000,60000); - } - - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch(uiType) + generic_vehicleAI_toc5AI(Creature* pCreature) : npc_escortAI(pCreature) { - case 1: - AddWaypoint(0,747.36,634.07,411.572); - AddWaypoint(1,780.43,607.15,411.82); - AddWaypoint(2,785.99,599.41,411.92); - AddWaypoint(3,778.44,601.64,411.79); - uiWaypointPath = 1; - break; - case 2: - AddWaypoint(0,747.35,634.07,411.57); - AddWaypoint(1,768.72,581.01,411.92); - AddWaypoint(2,763.55,590.52,411.71); - uiWaypointPath = 2; - break; - case 3: - AddWaypoint(0,747.35,634.07,411.57); - AddWaypoint(1,784.02,645.33,412.39); - AddWaypoint(2,775.67,641.91,411.91); - uiWaypointPath = 3; - break; + SetDespawnAtEnd(false); + uiWaypointPath = 0; + + pInstance = pCreature->GetInstanceScript(); } - if (uiType <= 3) - Start(false,true,0,NULL); - } + InstanceScript* pInstance; - void WaypointReached(uint32 i) - { - switch(i) + uint32 uiChargeTimer; + uint32 uiShieldBreakerTimer; + uint32 uiBuffTimer; + + uint32 uiWaypointPath; + + void Reset() { - case 2: - if (pInstance && uiWaypointPath == 3 || uiWaypointPath == 2) - pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); - break; - case 3: - if (pInstance) - pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); - break; - } - } - - void EnterCombat(Unit* /*pWho*/) - { - DoCastSpellShield(); - } - - void DoCastSpellShield() - { - for (uint8 i = 0; i < 3; ++i) - DoCast(me,SPELL_SHIELD,true); - } - - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - if (uiBuffTimer <= uiDiff) - { - if (!me->HasAura(SPELL_SHIELD)) - DoCastSpellShield(); - - uiBuffTimer = urand(30000,45000); - }else uiBuffTimer -= uiDiff; - - if (uiChargeTimer <= uiDiff) - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) - { - DoResetThreat(); - me->AddThreat(pPlayer,1.0f); - DoCast(pPlayer, SPELL_CHARGE); - break; - } - } - } uiChargeTimer = 5000; - }else uiChargeTimer -= uiDiff; + uiShieldBreakerTimer = 8000; + uiBuffTimer = urand(30000,60000); + } - //dosen't work at all - if (uiShieldBreakerTimer <= uiDiff) + void SetData(uint32 uiType, uint32 /*uiData*/) { - Vehicle *pVehicle = me->GetVehicleKit(); - if (!pVehicle) + switch(uiType) + { + case 1: + AddWaypoint(0,747.36,634.07,411.572); + AddWaypoint(1,780.43,607.15,411.82); + AddWaypoint(2,785.99,599.41,411.92); + AddWaypoint(3,778.44,601.64,411.79); + uiWaypointPath = 1; + break; + case 2: + AddWaypoint(0,747.35,634.07,411.57); + AddWaypoint(1,768.72,581.01,411.92); + AddWaypoint(2,763.55,590.52,411.71); + uiWaypointPath = 2; + break; + case 3: + AddWaypoint(0,747.35,634.07,411.57); + AddWaypoint(1,784.02,645.33,412.39); + AddWaypoint(2,775.67,641.91,411.91); + uiWaypointPath = 3; + break; + } + + if (uiType <= 3) + Start(false,true,0,NULL); + } + + void WaypointReached(uint32 i) + { + switch(i) + { + case 2: + if (pInstance && uiWaypointPath == 3 || uiWaypointPath == 2) + pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); + break; + case 3: + if (pInstance) + pInstance->SetData(DATA_MOVEMENT_DONE, pInstance->GetData(DATA_MOVEMENT_DONE)+1); + break; + } + } + + void EnterCombat(Unit* /*pWho*/) + { + DoCastSpellShield(); + } + + void DoCastSpellShield() + { + for (uint8 i = 0; i < 3; ++i) + DoCast(me,SPELL_SHIELD,true); + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) return; - if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) + if (uiBuffTimer <= uiDiff) + { + if (!me->HasAura(SPELL_SHIELD)) + DoCastSpellShield(); + + uiBuffTimer = urand(30000,45000); + }else uiBuffTimer -= uiDiff; + + if (uiChargeTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) @@ -273,544 +251,140 @@ struct generic_vehicleAI_toc5AI : public npc_escortAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,10.0f,30.0f,false)) + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) { - pPassenger->CastSpell(pPlayer,SPELL_SHIELD_BREAKER,true); + DoResetThreat(); + me->AddThreat(pPlayer,1.0f); + DoCast(pPlayer, SPELL_CHARGE); break; } } } - } - uiShieldBreakerTimer = 7000; - }else uiShieldBreakerTimer -= uiDiff; + uiChargeTimer = 5000; + }else uiChargeTimer -= uiDiff; - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_generic_vehicleAI_toc5(Creature* pCreature) -{ - return new generic_vehicleAI_toc5AI(pCreature); -} - -// Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior -struct boss_warrior_toc5AI : public ScriptedAI -{ - boss_warrior_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiPhaseTimer; - - uint32 uiBladeStormTimer; - uint32 uiInterceptTimer; - uint32 uiMortalStrikeTimer; - uint32 uiAttackTimer; - - bool bDone; - bool bHome; - - void Reset() - { - uiBladeStormTimer = urand(15000,20000); - uiInterceptTimer = 7000; - uiMortalStrikeTimer = urand(8000,12000); - } - - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) - { - bDone = true; - - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); - - EnterEvadeMode(); - bHome = true; - } - - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) + //dosen't work at all + if (uiShieldBreakerTimer <= uiDiff) { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; + Vehicle *pVehicle = me->GetVehicleKit(); + if (!pVehicle) + return; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; - - if (uiInterceptTimer <= uiDiff) - { - Map::PlayerList const& players = me->GetMap()->GetPlayers(); - if (me->GetMap()->IsDungeon() && !players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0)) { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (me->GetMap()->IsDungeon() && !players.isEmpty()) { - DoResetThreat(); - me->AddThreat(pPlayer,5.0f); - DoCast(pPlayer,SPELL_INTERCEPT); - break; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,10.0f,30.0f,false)) + { + pPassenger->CastSpell(pPlayer,SPELL_SHIELD_BREAKER,true); + break; + } + } } } - } - uiInterceptTimer = 7000; - } else uiInterceptTimer -= uiDiff; + uiShieldBreakerTimer = 7000; + }else uiShieldBreakerTimer -= uiDiff; - if (uiBladeStormTimer <= uiDiff) - { - DoCastVictim(SPELL_BLADESTORM); - uiBladeStormTimer = urand(15000,20000); - } else uiBladeStormTimer -= uiDiff; - - if (uiMortalStrikeTimer <= uiDiff) - { - DoCastVictim(SPELL_MORTAL_STRIKE); - uiMortalStrikeTimer = urand(8000,12000); - } else uiMortalStrikeTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); - } -}; - -CreatureAI* GetAI_boss_warrior_toc5(Creature* pCreature) -{ - return new boss_warrior_toc5AI(pCreature); -} - -// Ambrose Boltspark && Eressea Dawnsinger || Mage -struct boss_mage_toc5AI : public ScriptedAI -{ - boss_mage_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiPhaseTimer; - - uint32 uiFireBallTimer; - uint32 uiBlastWaveTimer; - uint32 uiHasteTimer; - uint32 uiPolymorphTimer; - - bool bDone; - bool bHome; - - void Reset() - { - uiFireBallTimer = 5000; - uiPolymorphTimer = 8000; - uiBlastWaveTimer = 12000; - uiHasteTimer = 22000; - } - - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) - { - bDone = true; - - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); - - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - - EnterEvadeMode(); - bHome = true; + DoMeleeAttackIfReady(); } - - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) - { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; - - if (uiFireBallTimer <= uiDiff) - { - if (me->getVictim()) - DoCastVictim(SPELL_FIREBALL); - uiFireBallTimer = 5000; - } else uiFireBallTimer -= uiDiff; - - - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; - - if (uiFireBallTimer <= uiDiff) - { - DoCastVictim(SPELL_FIREBALL); - uiFireBallTimer = 5000; - } else uiFireBallTimer -= uiDiff; - - if (uiPolymorphTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_POLYMORPH); - uiPolymorphTimer = 8000; - } else uiPolymorphTimer -= uiDiff; - - if (uiBlastWaveTimer <= uiDiff) - { - DoCastAOE(SPELL_BLAST_WAVE,false); - uiBlastWaveTimer = 13000; - } else uiBlastWaveTimer -= uiDiff; - - if (uiHasteTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); - - DoCast(me,SPELL_HASTE); - uiHasteTimer = 22000; - } else uiHasteTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); - } -}; - -CreatureAI* GetAI_boss_mage_toc5(Creature* pCreature) -{ - return new boss_mage_toc5AI(pCreature); -} - -// Colosos && Runok Wildmane || Shaman -struct boss_shaman_toc5AI : public ScriptedAI -{ - boss_shaman_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiPhaseTimer; - - uint32 uiChainLightningTimer; - uint32 uiEartShieldTimer; - uint32 uiHealingWaveTimer; - uint32 uiHexMendingTimer; - - bool bDone; - bool bHome; - - void Reset() - { - uiChainLightningTimer = 16000; - uiHealingWaveTimer = 12000; - uiEartShieldTimer = urand(30000,35000); - uiHexMendingTimer = urand(20000,25000); - } - - void EnterCombat(Unit* pWho) - { - DoCast(me,SPELL_EARTH_SHIELD); - DoCast(pWho,SPELL_HEX_OF_MENDING); }; - void JustReachedHome() + CreatureAI* GetAI(Creature* pCreature) const { - ScriptedAI::JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) - { - bDone = true; - - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); - - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - - EnterEvadeMode(); - bHome = true; - } - - if (uiPhaseTimer <= uiDiff) - { - if (uiPhase == 1) - { - AggroAllPlayers(me); - uiPhase = 0; - } - }else uiPhaseTimer -= uiDiff; - - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; - - if (uiChainLightningTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget,SPELL_CHAIN_LIGHTNING); - - uiChainLightningTimer = 16000; - } else uiChainLightningTimer -= uiDiff; - - if (uiHealingWaveTimer <= uiDiff) - { - bool bChance = urand(0,1); - - if (!bChance) - { - if (Unit* pFriend = DoSelectLowestHpFriendly(40)) - DoCast(pFriend,SPELL_HEALING_WAVE); - } else - DoCast(me,SPELL_HEALING_WAVE); - - uiHealingWaveTimer = 12000; - } else uiHealingWaveTimer -= uiDiff; - - if (uiEartShieldTimer <= uiDiff) - { - DoCast(me,SPELL_EARTH_SHIELD); - - uiEartShieldTimer = urand(30000,35000); - } else uiEartShieldTimer -= uiDiff; - - if (uiHexMendingTimer <= uiDiff) - { - DoCastVictim(SPELL_HEX_OF_MENDING,true); - - uiHexMendingTimer = urand(20000,25000); - } else uiHexMendingTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new generic_vehicleAI_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_shaman_toc5(Creature* pCreature) +class boss_warrior_toc5 : public CreatureScript { - return new boss_shaman_toc5AI(pCreature); -} +public: + boss_warrior_toc5() : CreatureScript("boss_warrior_toc5") { } -// Jaelyne Evensong && Zul'tore || Hunter -struct boss_hunter_toc5AI : public ScriptedAI -{ - boss_hunter_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + // Marshal Jacob Alerius && Mokra the Skullcrusher || Warrior + struct boss_warrior_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiPhaseTimer; - - uint32 uiShootTimer; - uint32 uiMultiShotTimer; - uint32 uiLightningArrowsTimer; - - uint64 uiTargetGUID; - - bool bShoot; - bool bDone; - bool bHome; - - void Reset() - { - uiShootTimer = 12000; - uiMultiShotTimer = 0; - uiLightningArrowsTimer = 7000; - - uiTargetGUID = 0; - - bShoot = false; - } - - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) + boss_warrior_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) { - bDone = true; + pInstance = pCreature->GetInstanceScript(); - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); + bDone = false; + bHome = false; - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + uiPhase = 0; + uiPhaseTimer = 0; - EnterEvadeMode(); - bHome = true; + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); } - if (uiPhaseTimer <= uiDiff) + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiPhaseTimer; + + uint32 uiBladeStormTimer; + uint32 uiInterceptTimer; + uint32 uiMortalStrikeTimer; + uint32 uiAttackTimer; + + bool bDone; + bool bHome; + + void Reset() { - if (uiPhase == 1) + uiBladeStormTimer = urand(15000,20000); + uiInterceptTimer = 7000; + uiMortalStrikeTimer = urand(8000,12000); + } + + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + + if (!bHome) + return; + + uiPhaseTimer = 15000; + uiPhase = 1; + + bHome = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bDone && GrandChampionsOutVehicle(me)) { - AggroAllPlayers(me); - uiPhase = 0; + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + EnterEvadeMode(); + bHome = true; } - }else uiPhaseTimer -= uiDiff; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; - - if (uiLightningArrowsTimer <= uiDiff) - { - DoCastAOE(SPELL_LIGHTNING_ARROWS,false); - uiLightningArrowsTimer = 7000; - } else uiLightningArrowsTimer -= uiDiff; - - if (uiShootTimer <= uiDiff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_FARTHEST,0,30.0f)) + if (uiPhaseTimer <= uiDiff) { - uiTargetGUID = pTarget->GetGUID(); - DoCast(pTarget, SPELL_SHOOT); - } - uiShootTimer = 12000; - uiMultiShotTimer = 3000; - bShoot = true; - } else uiShootTimer -= uiDiff; + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; - if (bShoot && uiMultiShotTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(true); - Unit* pTarget = Unit::GetUnit(*me, uiTargetGUID); + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; - if (pTarget && me->IsInRange(pTarget,5.0f,30.0f,false)) - { - DoCast(pTarget,SPELL_MULTI_SHOT); - } else + if (uiInterceptTimer <= uiDiff) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) @@ -818,178 +392,617 @@ struct boss_hunter_toc5AI : public ScriptedAI for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,5.0f,30.0f,false)) + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,8.0f,25.0f,false)) { - DoCast(pTarget,SPELL_MULTI_SHOT); + DoResetThreat(); + me->AddThreat(pPlayer,5.0f); + DoCast(pPlayer,SPELL_INTERCEPT); break; } } } - } - bShoot = false; - } else uiMultiShotTimer -= uiDiff; + uiInterceptTimer = 7000; + } else uiInterceptTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + if (uiBladeStormTimer <= uiDiff) + { + DoCastVictim(SPELL_BLADESTORM); + uiBladeStormTimer = urand(15000,20000); + } else uiBladeStormTimer -= uiDiff; - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); - } -}; + if (uiMortalStrikeTimer <= uiDiff) + { + DoCastVictim(SPELL_MORTAL_STRIKE); + uiMortalStrikeTimer = urand(8000,12000); + } else uiMortalStrikeTimer -= uiDiff; -CreatureAI* GetAI_boss_hunter_toc5(Creature* pCreature) -{ - return new boss_hunter_toc5AI(pCreature); -} - -// Lana Stouthammer Evensong && Deathstalker Visceri || Rouge -struct boss_rouge_toc5AI : public ScriptedAI -{ - boss_rouge_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - - bDone = false; - bHome = false; - - uiPhase = 0; - uiPhaseTimer = 0; - - me->SetReactState(REACT_PASSIVE); - // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiPhaseTimer; - uint32 uiEviscerateTimer; - uint32 uiFanKivesTimer; - uint32 uiPosionBottleTimer; - - bool bDone; - bool bHome; - - void Reset() - { - uiEviscerateTimer = 8000; - uiFanKivesTimer = 14000; - uiPosionBottleTimer = 19000; - } - - void JustReachedHome() - { - ScriptedAI::JustReachedHome(); - - if (!bHome) - return; - - uiPhaseTimer = 15000; - uiPhase = 1; - - bHome = false; - } - - void UpdateAI(const uint32 uiDiff) - { - if (!bDone && GrandChampionsOutVehicle(me)) - { - bDone = true; - - if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) - me->SetHomePosition(739.678,662.541,412.393,4.49); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) - me->SetHomePosition(746.71,661.02,411.69,4.6); - else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) - me->SetHomePosition(754.34,660.70,412.39,4.79); - - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); - - EnterEvadeMode(); - bHome = true; + DoMeleeAttackIfReady(); } - if (uiPhaseTimer <= uiDiff) + void JustDied(Unit* /*pKiller*/) { - if (uiPhase == 1) - { - AggroAllPlayers(me); - uiPhase = 0; - } - } else uiPhaseTimer -= uiDiff; + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; - if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) - return; - - if (uiEviscerateTimer <= uiDiff) - { - DoCast(me->getVictim(),SPELL_EVISCERATE); - uiEviscerateTimer = 8000; - } else uiEviscerateTimer -= uiDiff; - - if (uiFanKivesTimer <= uiDiff) - { - DoCastAOE(SPELL_FAN_OF_KNIVES,false); - uiFanKivesTimer = 14000; - } else uiFanKivesTimer -= uiDiff; - - if (uiPosionBottleTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget,SPELL_POISON_BOTTLE); - uiPosionBottleTimer = 19000; - } else uiPosionBottleTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + return new boss_warrior_toc5AI(pCreature); } }; -CreatureAI* GetAI_boss_rouge_toc5(Creature* pCreature) +class boss_mage_toc5 : public CreatureScript { - return new boss_rouge_toc5AI(pCreature); -} +public: + boss_mage_toc5() : CreatureScript("boss_mage_toc5") { } + + // Ambrose Boltspark && Eressea Dawnsinger || Mage + struct boss_mage_toc5AI : public ScriptedAI + { + boss_mage_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + + bDone = false; + bHome = false; + + uiPhase = 0; + uiPhaseTimer = 0; + + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiPhaseTimer; + + uint32 uiFireBallTimer; + uint32 uiBlastWaveTimer; + uint32 uiHasteTimer; + uint32 uiPolymorphTimer; + + bool bDone; + bool bHome; + + void Reset() + { + uiFireBallTimer = 5000; + uiPolymorphTimer = 8000; + uiBlastWaveTimer = 12000; + uiHasteTimer = 22000; + } + + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + + if (!bHome) + return; + + uiPhaseTimer = 15000; + uiPhase = 1; + + bHome = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + + EnterEvadeMode(); + bHome = true; + } + + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; + + if (uiFireBallTimer <= uiDiff) + { + if (me->getVictim()) + DoCastVictim(SPELL_FIREBALL); + uiFireBallTimer = 5000; + } else uiFireBallTimer -= uiDiff; + + + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; + + if (uiFireBallTimer <= uiDiff) + { + DoCastVictim(SPELL_FIREBALL); + uiFireBallTimer = 5000; + } else uiFireBallTimer -= uiDiff; + + if (uiPolymorphTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_POLYMORPH); + uiPolymorphTimer = 8000; + } else uiPolymorphTimer -= uiDiff; + + if (uiBlastWaveTimer <= uiDiff) + { + DoCastAOE(SPELL_BLAST_WAVE,false); + uiBlastWaveTimer = 13000; + } else uiBlastWaveTimer -= uiDiff; + + if (uiHasteTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); + + DoCast(me,SPELL_HASTE); + uiHasteTimer = 22000; + } else uiHasteTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_mage_toc5AI(pCreature); + } +}; + +class boss_shaman_toc5 : public CreatureScript +{ +public: + boss_shaman_toc5() : CreatureScript("boss_shaman_toc5") { } + + // Colosos && Runok Wildmane || Shaman + struct boss_shaman_toc5AI : public ScriptedAI + { + boss_shaman_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + + bDone = false; + bHome = false; + + uiPhase = 0; + uiPhaseTimer = 0; + + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiPhaseTimer; + + uint32 uiChainLightningTimer; + uint32 uiEartShieldTimer; + uint32 uiHealingWaveTimer; + uint32 uiHexMendingTimer; + + bool bDone; + bool bHome; + + void Reset() + { + uiChainLightningTimer = 16000; + uiHealingWaveTimer = 12000; + uiEartShieldTimer = urand(30000,35000); + uiHexMendingTimer = urand(20000,25000); + } + + void EnterCombat(Unit* pWho) + { + DoCast(me,SPELL_EARTH_SHIELD); + DoCast(pWho,SPELL_HEX_OF_MENDING); + }; + + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + + if (!bHome) + return; + + uiPhaseTimer = 15000; + uiPhase = 1; + + bHome = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + + EnterEvadeMode(); + bHome = true; + } + + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; + + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; + + if (uiChainLightningTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget,SPELL_CHAIN_LIGHTNING); + + uiChainLightningTimer = 16000; + } else uiChainLightningTimer -= uiDiff; + + if (uiHealingWaveTimer <= uiDiff) + { + bool bChance = urand(0,1); + + if (!bChance) + { + if (Unit* pFriend = DoSelectLowestHpFriendly(40)) + DoCast(pFriend,SPELL_HEALING_WAVE); + } else + DoCast(me,SPELL_HEALING_WAVE); + + uiHealingWaveTimer = 12000; + } else uiHealingWaveTimer -= uiDiff; + + if (uiEartShieldTimer <= uiDiff) + { + DoCast(me,SPELL_EARTH_SHIELD); + + uiEartShieldTimer = urand(30000,35000); + } else uiEartShieldTimer -= uiDiff; + + if (uiHexMendingTimer <= uiDiff) + { + DoCastVictim(SPELL_HEX_OF_MENDING,true); + + uiHexMendingTimer = urand(20000,25000); + } else uiHexMendingTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_shaman_toc5AI(pCreature); + } +}; + + +class boss_hunter_toc5 : public CreatureScript +{ +public: + boss_hunter_toc5() : CreatureScript("boss_hunter_toc5") { } + + // Jaelyne Evensong && Zul'tore || Hunter + struct boss_hunter_toc5AI : public ScriptedAI + { + boss_hunter_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + + bDone = false; + bHome = false; + + uiPhase = 0; + uiPhaseTimer = 0; + + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiPhaseTimer; + + uint32 uiShootTimer; + uint32 uiMultiShotTimer; + uint32 uiLightningArrowsTimer; + + uint64 uiTargetGUID; + + bool bShoot; + bool bDone; + bool bHome; + + void Reset() + { + uiShootTimer = 12000; + uiMultiShotTimer = 0; + uiLightningArrowsTimer = 7000; + + uiTargetGUID = 0; + + bShoot = false; + } + + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + + if (!bHome) + return; + + uiPhaseTimer = 15000; + uiPhase = 1; + + bHome = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + + EnterEvadeMode(); + bHome = true; + } + + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + }else uiPhaseTimer -= uiDiff; + + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; + + if (uiLightningArrowsTimer <= uiDiff) + { + DoCastAOE(SPELL_LIGHTNING_ARROWS,false); + uiLightningArrowsTimer = 7000; + } else uiLightningArrowsTimer -= uiDiff; + + if (uiShootTimer <= uiDiff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_FARTHEST,0,30.0f)) + { + uiTargetGUID = pTarget->GetGUID(); + DoCast(pTarget, SPELL_SHOOT); + } + uiShootTimer = 12000; + uiMultiShotTimer = 3000; + bShoot = true; + } else uiShootTimer -= uiDiff; + + if (bShoot && uiMultiShotTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(true); + Unit* pTarget = Unit::GetUnit(*me, uiTargetGUID); + + if (pTarget && me->IsInRange(pTarget,5.0f,30.0f,false)) + { + DoCast(pTarget,SPELL_MULTI_SHOT); + } else + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (me->GetMap()->IsDungeon() && !players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer && !pPlayer->isGameMaster() && me->IsInRange(pPlayer,5.0f,30.0f,false)) + { + DoCast(pTarget,SPELL_MULTI_SHOT); + break; + } + } + } + } + bShoot = false; + } else uiMultiShotTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_hunter_toc5AI(pCreature); + } +}; + + +class boss_rouge_toc5 : public CreatureScript +{ +public: + boss_rouge_toc5() : CreatureScript("boss_rouge_toc5") { } + + // Lana Stouthammer Evensong && Deathstalker Visceri || Rouge + struct boss_rouge_toc5AI : public ScriptedAI + { + boss_rouge_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + + bDone = false; + bHome = false; + + uiPhase = 0; + uiPhaseTimer = 0; + + me->SetReactState(REACT_PASSIVE); + // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiPhaseTimer; + uint32 uiEviscerateTimer; + uint32 uiFanKivesTimer; + uint32 uiPosionBottleTimer; + + bool bDone; + bool bHome; + + void Reset() + { + uiEviscerateTimer = 8000; + uiFanKivesTimer = 14000; + uiPosionBottleTimer = 19000; + } + + void JustReachedHome() + { + ScriptedAI::JustReachedHome(); + + if (!bHome) + return; + + uiPhaseTimer = 15000; + uiPhase = 1; + + bHome = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bDone && GrandChampionsOutVehicle(me)) + { + bDone = true; + + if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_1)) + me->SetHomePosition(739.678,662.541,412.393,4.49); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_2)) + me->SetHomePosition(746.71,661.02,411.69,4.6); + else if (pInstance && me->GetGUID() == pInstance->GetData64(DATA_GRAND_CHAMPION_3)) + me->SetHomePosition(754.34,660.70,412.39,4.79); + + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS); + + EnterEvadeMode(); + bHome = true; + } + + if (uiPhaseTimer <= uiDiff) + { + if (uiPhase == 1) + { + AggroAllPlayers(me); + uiPhase = 0; + } + } else uiPhaseTimer -= uiDiff; + + if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) + return; + + if (uiEviscerateTimer <= uiDiff) + { + DoCast(me->getVictim(),SPELL_EVISCERATE); + uiEviscerateTimer = 8000; + } else uiEviscerateTimer -= uiDiff; + + if (uiFanKivesTimer <= uiDiff) + { + DoCastAOE(SPELL_FAN_OF_KNIVES,false); + uiFanKivesTimer = 14000; + } else uiFanKivesTimer -= uiDiff; + + if (uiPosionBottleTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget,SPELL_POISON_BOTTLE); + uiPosionBottleTimer = 19000; + } else uiPosionBottleTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(BOSS_GRAND_CHAMPIONS, DONE); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_rouge_toc5AI(pCreature); + } +}; void AddSC_boss_grand_champions() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "generic_vehicleAI_toc5"; - NewScript->GetAI = &GetAI_generic_vehicleAI_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_warrior_toc5"; - NewScript->GetAI = &GetAI_boss_warrior_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_mage_toc5"; - NewScript->GetAI = &GetAI_boss_mage_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_shaman_toc5"; - NewScript->GetAI = &GetAI_boss_shaman_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_hunter_toc5"; - NewScript->GetAI = &GetAI_boss_hunter_toc5; - NewScript->RegisterSelf(); - - NewScript = new Script; - NewScript->Name = "boss_rouge_toc5"; - NewScript->GetAI = &GetAI_boss_rouge_toc5; - NewScript->RegisterSelf(); + new generic_vehicleAI_toc5(); + new boss_warrior_toc5(); + new boss_mage_toc5(); + new boss_shaman_toc5(); + new boss_hunter_toc5(); + new boss_rouge_toc5(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 45cab67c0f4..b7cf807b77a 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -26,314 +26,317 @@ EndScriptData */ #include "trial_of_the_champion.h" #define MAX_ENCOUNTER 4 - -struct instance_trial_of_the_champion : public ScriptedInstance + class instance_trial_of_the_champion : public InstanceMapScript { - instance_trial_of_the_champion(Map* pMap) : ScriptedInstance(pMap) {Initialize();} +public: + instance_trial_of_the_champion() : InstanceMapScript("instance_trial_of_the_champion") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint8 uiMovementDone; - uint8 uiGrandChampionsDeaths; - uint8 uiArgentSoldierDeaths; - - uint64 uiAnnouncerGUID; - uint64 uiMainGateGUID; - uint64 uiGrandChampionVehicle1GUID; - uint64 uiGrandChampionVehicle2GUID; - uint64 uiGrandChampionVehicle3GUID; - uint64 uiGrandChampion1GUID; - uint64 uiGrandChampion2GUID; - uint64 uiGrandChampion3GUID; - uint64 uiChampionLootGUID; - uint64 uiArgentChampionGUID; - - std::list VehicleList; - - std::string str_data; - - bool bDone; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - uiMovementDone = 0; - uiGrandChampionsDeaths = 0; - uiArgentSoldierDeaths = 0; - - uiAnnouncerGUID = 0; - uiMainGateGUID = 0; - uiGrandChampionVehicle1GUID = 0; - uiGrandChampionVehicle2GUID = 0; - uiGrandChampionVehicle3GUID = 0; - uiGrandChampion1GUID = 0; - uiGrandChampion2GUID = 0; - uiGrandChampion3GUID = 0; - uiChampionLootGUID = 0; - uiArgentChampionGUID = 0; - - bDone = false; - - VehicleList.clear(); - - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + return new instance_trial_of_the_champion_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_trial_of_the_champion_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + instance_trial_of_the_champion_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + uint8 uiMovementDone; + uint8 uiGrandChampionsDeaths; + uint8 uiArgentSoldierDeaths; + + uint64 uiAnnouncerGUID; + uint64 uiMainGateGUID; + uint64 uiGrandChampionVehicle1GUID; + uint64 uiGrandChampionVehicle2GUID; + uint64 uiGrandChampionVehicle3GUID; + uint64 uiGrandChampion1GUID; + uint64 uiGrandChampion2GUID; + uint64 uiGrandChampion3GUID; + uint64 uiChampionLootGUID; + uint64 uiArgentChampionGUID; + + std::list VehicleList; + + std::string str_data; + + bool bDone; + + void Initialize() { - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + uiMovementDone = 0; + uiGrandChampionsDeaths = 0; + uiArgentSoldierDeaths = 0; + + uiAnnouncerGUID = 0; + uiMainGateGUID = 0; + uiGrandChampionVehicle1GUID = 0; + uiGrandChampionVehicle2GUID = 0; + uiGrandChampionVehicle3GUID = 0; + uiGrandChampion1GUID = 0; + uiGrandChampion2GUID = 0; + uiGrandChampion3GUID = 0; + uiChampionLootGUID = 0; + uiArgentChampionGUID = 0; + + bDone = false; + + VehicleList.clear(); + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - return false; - } - - void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) - { - Map::PlayerList const &players = instance->GetPlayers(); - uint32 TeamInInstance = 0; - - if (!players.isEmpty()) + bool IsEncounterInProgress() const { - if (Player* pPlayer = players.begin()->getSource()) - TeamInInstance = pPlayer->GetTeam(); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + if (m_auiEncounter[i] == IN_PROGRESS) + return true; + } + + return false; } - switch(pCreature->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*bAdd*/) { - // Champions - case VEHICLE_MOKRA_SKILLCRUSHER_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT, ALLIANCE); - break; - case VEHICLE_ERESSEA_DAWNSINGER_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_AMBROSE_BOLTSPARK_MOUNT, ALLIANCE); - break; - case VEHICLE_RUNOK_WILDMANE_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_COLOSOS_MOUNT, ALLIANCE); - break; - case VEHICLE_ZUL_TORE_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_EVENSONG_MOUNT, ALLIANCE); - break; - case VEHICLE_DEATHSTALKER_VESCERI_MOUNT: - if (TeamInInstance == HORDE) - pCreature->UpdateEntry(VEHICLE_LANA_STOUTHAMMER_MOUNT, ALLIANCE); - break; - // Coliseum Announcer || Just NPC_JAEREN must be spawned. - case NPC_JAEREN: - uiAnnouncerGUID = pCreature->GetGUID(); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_ARELAS,ALLIANCE); - break; - case VEHICLE_ARGENT_WARHORSE: - case VEHICLE_ARGENT_BATTLEWORG: - VehicleList.push_back(pCreature->GetGUID()); - break; - case NPC_EADRIC: - case NPC_PALETRESS: - uiArgentChampionGUID = pCreature->GetGUID(); - break; - } - } + Map::PlayerList const &players = instance->GetPlayers(); + uint32 TeamInInstance = 0; - void OnGameObjectCreate(GameObject* pGO, bool /*bAdd*/) - { - switch(pGO->GetEntry()) - { - case GO_MAIN_GATE: - uiMainGateGUID = pGO->GetGUID(); - break; - case GO_CHAMPIONS_LOOT: - case GO_CHAMPIONS_LOOT_H: - uiChampionLootGUID = pGO->GetGUID(); - break; - } - } + if (!players.isEmpty()) + { + if (Player* pPlayer = players.begin()->getSource()) + TeamInInstance = pPlayer->GetTeam(); + } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + switch(pCreature->GetEntry()) + { + // Champions + case VEHICLE_MOKRA_SKILLCRUSHER_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_MARSHAL_JACOB_ALERIUS_MOUNT, ALLIANCE); + break; + case VEHICLE_ERESSEA_DAWNSINGER_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_AMBROSE_BOLTSPARK_MOUNT, ALLIANCE); + break; + case VEHICLE_RUNOK_WILDMANE_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_COLOSOS_MOUNT, ALLIANCE); + break; + case VEHICLE_ZUL_TORE_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_EVENSONG_MOUNT, ALLIANCE); + break; + case VEHICLE_DEATHSTALKER_VESCERI_MOUNT: + if (TeamInInstance == HORDE) + pCreature->UpdateEntry(VEHICLE_LANA_STOUTHAMMER_MOUNT, ALLIANCE); + break; + // Coliseum Announcer || Just NPC_JAEREN must be spawned. + case NPC_JAEREN: + uiAnnouncerGUID = pCreature->GetGUID(); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_ARELAS,ALLIANCE); + break; + case VEHICLE_ARGENT_WARHORSE: + case VEHICLE_ARGENT_BATTLEWORG: + VehicleList.push_back(pCreature->GetGUID()); + break; + case NPC_EADRIC: + case NPC_PALETRESS: + uiArgentChampionGUID = pCreature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* pGO, bool /*bAdd*/) { - case DATA_MOVEMENT_DONE: - uiMovementDone = uiData; - if (uiMovementDone == 3) - { - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - pAnnouncer->AI()->SetData(DATA_IN_POSITION,0); - } - break; - case BOSS_GRAND_CHAMPIONS: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) - { - for (std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) - if (Creature* pSummon = instance->GetCreature(*itr)) - pSummon->RemoveFromWorld(); - }else if (uiData == DONE) - { - ++uiGrandChampionsDeaths; - if (uiGrandChampionsDeaths == 3) + switch(pGO->GetEntry()) + { + case GO_MAIN_GATE: + uiMainGateGUID = pGO->GetGUID(); + break; + case GO_CHAMPIONS_LOOT: + case GO_CHAMPIONS_LOOT_H: + uiChampionLootGUID = pGO->GetGUID(); + break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case DATA_MOVEMENT_DONE: + uiMovementDone = uiData; + if (uiMovementDone == 3) { if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + pAnnouncer->AI()->SetData(DATA_IN_POSITION,0); + } + break; + case BOSS_GRAND_CHAMPIONS: + m_auiEncounter[0] = uiData; + if (uiData == IN_PROGRESS) + { + for (std::list::const_iterator itr = VehicleList.begin(); itr != VehicleList.end(); ++itr) + if (Creature* pSummon = instance->GetCreature(*itr)) + pSummon->RemoveFromWorld(); + }else if (uiData == DONE) + { + ++uiGrandChampionsDeaths; + if (uiGrandChampionsDeaths == 3) { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_CHAMPIONS_LOOT_H : GO_CHAMPIONS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } } } - } - break; - case DATA_ARGENT_SOLDIER_DEFEATED: - uiArgentSoldierDeaths = uiData; - if (uiArgentSoldierDeaths == 9) - { - if (Creature* pBoss = instance->GetCreature(uiArgentChampionGUID)) + break; + case DATA_ARGENT_SOLDIER_DEFEATED: + uiArgentSoldierDeaths = uiData; + if (uiArgentSoldierDeaths == 9) { - pBoss->GetMotionMaster()->MovePoint(0,746.88,618.74,411.06); - pBoss->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pBoss->SetReactState(REACT_AGGRESSIVE); + if (Creature* pBoss = instance->GetCreature(uiArgentChampionGUID)) + { + pBoss->GetMotionMaster()->MovePoint(0,746.88,618.74,411.06); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetReactState(REACT_AGGRESSIVE); + } } - } - break; - case BOSS_ARGENT_CHALLENGE_E: - m_auiEncounter[1] = uiData; - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); - } - break; - case BOSS_ARGENT_CHALLENGE_P: - m_auiEncounter[2] = uiData; - if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) - { - pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); - pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); - } - break; + break; + case BOSS_ARGENT_CHALLENGE_E: + m_auiEncounter[1] = uiData; + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_EADRIC_LOOT_H : GO_EADRIC_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } + break; + case BOSS_ARGENT_CHALLENGE_P: + m_auiEncounter[2] = uiData; + if (Creature* pAnnouncer = instance->GetCreature(uiAnnouncerGUID)) + { + pAnnouncer->GetMotionMaster()->MovePoint(0,748.309,619.487,411.171); + pAnnouncer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pAnnouncer->SummonGameObject(instance->IsHeroic()? GO_PALETRESS_LOOT_H : GO_PALETRESS_LOOT,746.59,618.49,411.09,1.42,0, 0, 0, 0,90000000); + } + break; + } + + if (uiData == DONE) + SaveToDB(); } - if (uiData == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 uiData) - { - switch(uiData) + uint32 GetData(uint32 uiData) { - case BOSS_GRAND_CHAMPIONS: return m_auiEncounter[0]; - case BOSS_ARGENT_CHALLENGE_E: return m_auiEncounter[1]; - case BOSS_ARGENT_CHALLENGE_P: return m_auiEncounter[2]; - case BOSS_BLACK_KNIGHT: return m_auiEncounter[3]; + switch(uiData) + { + case BOSS_GRAND_CHAMPIONS: return m_auiEncounter[0]; + case BOSS_ARGENT_CHALLENGE_E: return m_auiEncounter[1]; + case BOSS_ARGENT_CHALLENGE_P: return m_auiEncounter[2]; + case BOSS_BLACK_KNIGHT: return m_auiEncounter[3]; - case DATA_MOVEMENT_DONE: return uiMovementDone; - case DATA_ARGENT_SOLDIER_DEFEATED: return uiArgentSoldierDeaths; + case DATA_MOVEMENT_DONE: return uiMovementDone; + case DATA_ARGENT_SOLDIER_DEFEATED: return uiArgentSoldierDeaths; + } + + return 0; } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint64 GetData64(uint32 uiData) { - case DATA_ANNOUNCER: return uiAnnouncerGUID; - case DATA_MAIN_GATE: return uiMainGateGUID; + switch(uiData) + { + case DATA_ANNOUNCER: return uiAnnouncerGUID; + case DATA_MAIN_GATE: return uiMainGateGUID; - case DATA_GRAND_CHAMPION_1: return uiGrandChampion1GUID; - case DATA_GRAND_CHAMPION_2: return uiGrandChampion2GUID; - case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID; + case DATA_GRAND_CHAMPION_1: return uiGrandChampion1GUID; + case DATA_GRAND_CHAMPION_2: return uiGrandChampion2GUID; + case DATA_GRAND_CHAMPION_3: return uiGrandChampion3GUID; + } + + return 0; } - return 0; - } - - void SetData64(uint32 uiType, uint64 uiData) - { - switch(uiType) + void SetData64(uint32 uiType, uint64 uiData) { - case DATA_GRAND_CHAMPION_1: - uiGrandChampion1GUID = uiData; - break; - case DATA_GRAND_CHAMPION_2: - uiGrandChampion2GUID = uiData; - break; - case DATA_GRAND_CHAMPION_3: - uiGrandChampion3GUID = uiData; - break; - } - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - - saveStream << "T C " << m_auiEncounter[0] - << " " << m_auiEncounter[1] - << " " << m_auiEncounter[2] - << " " << m_auiEncounter[3] - << " " << uiGrandChampionsDeaths - << " " << uiMovementDone; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + switch(uiType) + { + case DATA_GRAND_CHAMPION_1: + uiGrandChampion1GUID = uiData; + break; + case DATA_GRAND_CHAMPION_2: + uiGrandChampion2GUID = uiData; + break; + case DATA_GRAND_CHAMPION_3: + uiGrandChampion3GUID = uiData; + break; + } } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - - if (dataHead1 == 'T' && dataHead2 == 'C') + std::string GetSaveData() { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + OUT_SAVE_INST_DATA; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + std::ostringstream saveStream; - uiGrandChampionsDeaths = data4; - uiMovementDone = data5; - } else OUT_LOAD_INST_DATA_FAIL; + saveStream << "T C " << m_auiEncounter[0] + << " " << m_auiEncounter[1] + << " " << m_auiEncounter[2] + << " " << m_auiEncounter[3] + << " " << uiGrandChampionsDeaths + << " " << uiMovementDone; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + + if (dataHead1 == 'T' && dataHead2 == 'C') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + uiGrandChampionsDeaths = data4; + uiMovementDone = data5; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_trial_of_the_champion(Map* pMap) -{ - return new instance_trial_of_the_champion(pMap); -} void AddSC_instance_trial_of_the_champion() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_trial_of_the_champion"; - newscript->GetInstanceData = &GetInstanceData_instance_trial_of_the_champion; - newscript->RegisterSelf(); + new instance_trial_of_the_champion(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 0ebe340a691..ec10c3991e2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -41,471 +41,470 @@ EndContentData */ const Position SpawnPosition = {746.261,657.401,411.681,4.65}; -struct npc_announcer_toc5AI : public ScriptedAI +class npc_announcer_toc5 : public CreatureScript { - npc_announcer_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_announcer_toc5() : CreatureScript("CreatureScript") { } + + struct npc_announcer_toc5AI : public ScriptedAI { - pInstance = pCreature->GetInstanceData(); - - uiSummonTimes = 0; - uiPosition = 0; - uiLesserChampions = 0; - - uiFirstBoss = 0; - uiSecondBoss = 0; - uiThirdBoss = 0; - - uiArgentChampion = 0; - - uiPhase = 0; - uiTimer = 0; - - uiVehicle1GUID = 0; - uiVehicle2GUID = 0; - uiVehicle3GUID = 0; - - Champion1List.clear(); - Champion2List.clear(); - Champion3List.clear(); - - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - SetGrandChampionsForEncounter(); - SetArgentChampion(); - } - - ScriptedInstance* pInstance; - - uint8 uiSummonTimes; - uint8 uiPosition; - uint8 uiLesserChampions; - - uint32 uiArgentChampion; - - uint32 uiFirstBoss; - uint32 uiSecondBoss; - uint32 uiThirdBoss; - - uint32 uiPhase; - uint32 uiTimer; - - uint64 uiVehicle1GUID; - uint64 uiVehicle2GUID; - uint64 uiVehicle3GUID; - - uint64 uiGrandChampionBoss1; - - std::list Champion1List; - std::list Champion2List; - std::list Champion3List; - - void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) - { - uiTimer = uiTimerStep; - if (bNextStep) - ++uiPhase; - else - uiPhase = uiPhaseStep; - } - - void SetData(uint32 uiType, uint32 /*uiData*/) - { - switch (uiType) + npc_announcer_toc5AI(Creature* pCreature) : ScriptedAI(pCreature) { - case DATA_START: - DoSummonGrandChampion(uiFirstBoss); - NextStep(10000,false,1); - break; - case DATA_IN_POSITION: //movement done. - me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); - if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) - pInstance->HandleGameObject(pGO->GetGUID(),false); - NextStep(10000,false,3); - break; - case DATA_LESSER_CHAMPIONS_DEFEATED: + pInstance = pCreature->GetInstanceScript(); + + uiSummonTimes = 0; + uiPosition = 0; + uiLesserChampions = 0; + + uiFirstBoss = 0; + uiSecondBoss = 0; + uiThirdBoss = 0; + + uiArgentChampion = 0; + + uiPhase = 0; + uiTimer = 0; + + uiVehicle1GUID = 0; + uiVehicle2GUID = 0; + uiVehicle3GUID = 0; + + Champion1List.clear(); + Champion2List.clear(); + Champion3List.clear(); + + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + SetGrandChampionsForEncounter(); + SetArgentChampion(); + } + + InstanceScript* pInstance; + + uint8 uiSummonTimes; + uint8 uiPosition; + uint8 uiLesserChampions; + + uint32 uiArgentChampion; + + uint32 uiFirstBoss; + uint32 uiSecondBoss; + uint32 uiThirdBoss; + + uint32 uiPhase; + uint32 uiTimer; + + uint64 uiVehicle1GUID; + uint64 uiVehicle2GUID; + uint64 uiVehicle3GUID; + + uint64 uiGrandChampionBoss1; + + std::list Champion1List; + std::list Champion2List; + std::list Champion3List; + + void NextStep(uint32 uiTimerStep,bool bNextStep = true,uint8 uiPhaseStep = 0) + { + uiTimer = uiTimerStep; + if (bNextStep) + ++uiPhase; + else + uiPhase = uiPhaseStep; + } + + void SetData(uint32 uiType, uint32 /*uiData*/) + { + switch (uiType) { - ++uiLesserChampions; - std::list TempList; - if (uiLesserChampions == 3 || uiLesserChampions == 6) + case DATA_START: + DoSummonGrandChampion(uiFirstBoss); + NextStep(10000,false,1); + break; + case DATA_IN_POSITION: //movement done. + me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); + if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) + pInstance->HandleGameObject(pGO->GetGUID(),false); + NextStep(10000,false,3); + break; + case DATA_LESSER_CHAMPIONS_DEFEATED: { - switch(uiLesserChampions) + ++uiLesserChampions; + std::list TempList; + if (uiLesserChampions == 3 || uiLesserChampions == 6) { - case 3: - TempList = Champion2List; - break; - case 6: - TempList = Champion3List; - break; - } + switch(uiLesserChampions) + { + case 3: + TempList = Champion2List; + break; + case 6: + TempList = Champion3List; + break; + } - for (std::list::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - AggroAllPlayers(pSummon); - }else if (uiLesserChampions == 9) - StartGrandChampionsAttack(); + for (std::list::const_iterator itr = TempList.begin(); itr != TempList.end(); ++itr) + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + AggroAllPlayers(pSummon); + }else if (uiLesserChampions == 9) + StartGrandChampionsAttack(); - break; + break; + } } } - } - void StartGrandChampionsAttack() - { - Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID); - Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID); - Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID); - - if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) + void StartGrandChampionsAttack() { - AggroAllPlayers(pGrandChampion1); - AggroAllPlayers(pGrandChampion2); - AggroAllPlayers(pGrandChampion3); - } - } + Creature* pGrandChampion1 = Unit::GetCreature(*me, uiVehicle1GUID); + Creature* pGrandChampion2 = Unit::GetCreature(*me, uiVehicle2GUID); + Creature* pGrandChampion3 = Unit::GetCreature(*me, uiVehicle3GUID); - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE) - return; - - if (uiPointId == 1) - { - me->SetOrientation(ORIENTATION); - me->SendMovementFlagUpdate(); - } - } - - void DoSummonGrandChampion(uint32 uiBoss) - { - ++uiSummonTimes; - uint32 VEHICLE_TO_SUMMON1 = 0; - uint32 VEHICLE_TO_SUMMON2 = 0; - switch(uiBoss) - { - case 0: - VEHICLE_TO_SUMMON1 = VEHICLE_MOKRA_SKILLCRUSHER_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_ORGRIMMAR_WOLF; - break; - case 1: - VEHICLE_TO_SUMMON1 = VEHICLE_ERESSEA_DAWNSINGER_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_SILVERMOON_HAWKSTRIDER; - break; - case 2: - VEHICLE_TO_SUMMON1 = VEHICLE_RUNOK_WILDMANE_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_THUNDER_BLUFF_KODO; - break; - case 3: - VEHICLE_TO_SUMMON1 = VEHICLE_ZUL_TORE_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_DARKSPEAR_RAPTOR; - break; - case 4: - VEHICLE_TO_SUMMON1 = VEHICLE_DEATHSTALKER_VESCERI_MOUNT; - VEHICLE_TO_SUMMON2 = VEHICLE_FORSAKE_WARHORSE; - break; - default: - return; - } - - if (Creature* pBoss = me->SummonCreature(VEHICLE_TO_SUMMON1,SpawnPosition)) - { - switch(uiSummonTimes) + if (pGrandChampion1 && pGrandChampion2 && pGrandChampion3) { + AggroAllPlayers(pGrandChampion1); + AggroAllPlayers(pGrandChampion2); + AggroAllPlayers(pGrandChampion3); + } + } + + void MovementInform(uint32 uiType, uint32 uiPointId) + { + if (uiType != POINT_MOTION_TYPE) + return; + + if (uiPointId == 1) + { + me->SetOrientation(ORIENTATION); + me->SendMovementFlagUpdate(); + } + } + + void DoSummonGrandChampion(uint32 uiBoss) + { + ++uiSummonTimes; + uint32 VEHICLE_TO_SUMMON1 = 0; + uint32 VEHICLE_TO_SUMMON2 = 0; + switch(uiBoss) + { + case 0: + VEHICLE_TO_SUMMON1 = VEHICLE_MOKRA_SKILLCRUSHER_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_ORGRIMMAR_WOLF; + break; case 1: - { - uiVehicle1GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss1 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss1 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1,uiVehicle1GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_1,uiGrandChampionBoss1); - } - pBoss->AI()->SetData(1,0); + VEHICLE_TO_SUMMON1 = VEHICLE_ERESSEA_DAWNSINGER_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_SILVERMOON_HAWKSTRIDER; break; - } case 2: - { - uiVehicle2GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss2 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss2 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2,uiVehicle2GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_2,uiGrandChampionBoss2); - } - pBoss->AI()->SetData(2,0); + VEHICLE_TO_SUMMON1 = VEHICLE_RUNOK_WILDMANE_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_THUNDER_BLUFF_KODO; break; - } case 3: - { - uiVehicle3GUID = pBoss->GetGUID(); - uint64 uiGrandChampionBoss3 = 0; - if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) - if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss3 = pUnit->GetGUID(); - if (pInstance) - { - pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3,uiVehicle3GUID); - pInstance->SetData64(DATA_GRAND_CHAMPION_3,uiGrandChampionBoss3); - } - pBoss->AI()->SetData(3,0); + VEHICLE_TO_SUMMON1 = VEHICLE_ZUL_TORE_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_DARKSPEAR_RAPTOR; + break; + case 4: + VEHICLE_TO_SUMMON1 = VEHICLE_DEATHSTALKER_VESCERI_MOUNT; + VEHICLE_TO_SUMMON2 = VEHICLE_FORSAKE_WARHORSE; break; - } default: return; } - for (uint8 i = 0; i < 3; ++i) + if (Creature* pBoss = me->SummonCreature(VEHICLE_TO_SUMMON1,SpawnPosition)) { - if (Creature* pAdd = me->SummonCreature(VEHICLE_TO_SUMMON2,SpawnPosition,TEMPSUMMON_CORPSE_DESPAWN)) + switch(uiSummonTimes) { - switch(uiSummonTimes) + case 1: { - case 1: - Champion1List.push_back(pAdd->GetGUID()); - break; - case 2: - Champion2List.push_back(pAdd->GetGUID()); - break; - case 3: - Champion3List.push_back(pAdd->GetGUID()); - break; + uiVehicle1GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss1 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss1 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1,uiVehicle1GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_1,uiGrandChampionBoss1); + } + pBoss->AI()->SetData(1,0); + break; } - - switch(i) + case 2: { - case 0: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI); - break; - case 1: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2); - break; - case 2: - pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2 + M_PI); - break; + uiVehicle2GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss2 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss2 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2,uiVehicle2GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_2,uiGrandChampionBoss2); + } + pBoss->AI()->SetData(2,0); + break; } + case 3: + { + uiVehicle3GUID = pBoss->GetGUID(); + uint64 uiGrandChampionBoss3 = 0; + if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) + if (Vehicle* pVehicle = pBoss->GetVehicleKit()) + if (Unit* pUnit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss3 = pUnit->GetGUID(); + if (pInstance) + { + pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3,uiVehicle3GUID); + pInstance->SetData64(DATA_GRAND_CHAMPION_3,uiGrandChampionBoss3); + } + pBoss->AI()->SetData(3,0); + break; + } + default: + return; } - } - } - } - - void DoStartArgentChampionEncounter() - { - me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); - - if (Creature* pBoss = me->SummonCreature(uiArgentChampion,SpawnPosition)) - { - for (uint8 i = 0; i < 3; ++i) - { - if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_LIGHWIELDER,SpawnPosition)) - pTrash->AI()->SetData(i,0); - if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_MONK,SpawnPosition)) - pTrash->AI()->SetData(i,0); - if (Creature* pTrash = me->SummonCreature(NPC_PRIESTESS,SpawnPosition)) - pTrash->AI()->SetData(i,0); - } - } - } - - void SetGrandChampionsForEncounter() - { - uiFirstBoss = urand(0,4); - - while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss) - { - uiSecondBoss = urand(0,4); - uiThirdBoss = urand(0,4); - } - } - - void SetArgentChampion() - { - uint8 uiTempBoss = urand(0,1); - - switch(uiTempBoss) - { - case 0: - uiArgentChampion = NPC_EADRIC; - break; - case 1: - uiArgentChampion = NPC_PALETRESS; - break; - } - } - - void StartEncounter() - { - if (!pInstance) - return; - - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - - if (pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) - { - if (pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED) - { - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) - me->AI()->SetData(DATA_START,0); - - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE) - DoStartArgentChampionEncounter(); - } - - if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) - me->SummonCreature(VEHICLE_BLACK_KNIGHT,769.834,651.915,447.035,0); - } - } - - void AggroAllPlayers(Creature* pTemp) - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - - if (PlList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) - { - if (Player* pPlayer = i->getSource()) - { - if (pPlayer->isGameMaster()) - continue; - - if (pPlayer->isAlive()) + for (uint8 i = 0; i < 3; ++i) { - pTemp->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetReactState(REACT_AGGRESSIVE); - pTemp->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(pTemp); - pTemp->AddThreat(pPlayer, 0.0f); + if (Creature* pAdd = me->SummonCreature(VEHICLE_TO_SUMMON2,SpawnPosition,TEMPSUMMON_CORPSE_DESPAWN)) + { + switch(uiSummonTimes) + { + case 1: + Champion1List.push_back(pAdd->GetGUID()); + break; + case 2: + Champion2List.push_back(pAdd->GetGUID()); + break; + case 3: + Champion3List.push_back(pAdd->GetGUID()); + break; + } + + switch(i) + { + case 0: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI); + break; + case 1: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2); + break; + case 2: + pAdd->GetMotionMaster()->MoveFollow(pBoss,2.0f,M_PI / 2 + M_PI); + break; + } + } + } } } - } - - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); - - if (uiTimer <= uiDiff) + void DoStartArgentChampionEncounter() { - switch(uiPhase) + me->GetMotionMaster()->MovePoint(1,735.81,661.92,412.39); + + if (Creature* pBoss = me->SummonCreature(uiArgentChampion,SpawnPosition)) { + for (uint8 i = 0; i < 3; ++i) + { + if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_LIGHWIELDER,SpawnPosition)) + pTrash->AI()->SetData(i,0); + if (Creature* pTrash = me->SummonCreature(NPC_ARGENT_MONK,SpawnPosition)) + pTrash->AI()->SetData(i,0); + if (Creature* pTrash = me->SummonCreature(NPC_PRIESTESS,SpawnPosition)) + pTrash->AI()->SetData(i,0); + } + } + } + + void SetGrandChampionsForEncounter() + { + uiFirstBoss = urand(0,4); + + while (uiSecondBoss == uiFirstBoss || uiThirdBoss == uiFirstBoss || uiThirdBoss == uiSecondBoss) + { + uiSecondBoss = urand(0,4); + uiThirdBoss = urand(0,4); + } + } + + void SetArgentChampion() + { + uint8 uiTempBoss = urand(0,1); + + switch(uiTempBoss) + { + case 0: + uiArgentChampion = NPC_EADRIC; + break; case 1: - DoSummonGrandChampion(uiSecondBoss); - NextStep(10000,true); + uiArgentChampion = NPC_PALETRESS; break; - case 2: - DoSummonGrandChampion(uiThirdBoss); - NextStep(0,false); - break; - case 3: - if (!Champion1List.empty()) + } + } + + void StartEncounter() + { + if (!pInstance) + return; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + if (pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) + { + if (pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED) + { + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) + me->AI()->SetData(DATA_START,0); + + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE) + DoStartArgentChampionEncounter(); + } + + if (pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) + me->SummonCreature(VEHICLE_BLACK_KNIGHT,769.834,651.915,447.035,0); + } + } + + void AggroAllPlayers(Creature* pTemp) + { + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + { + if (Player* pPlayer = i->getSource()) + { + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) { - for (std::list::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) - if (Creature* pSummon = Unit::GetCreature(*me, *itr)) - AggroAllPlayers(pSummon); - NextStep(0,false); + pTemp->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + pTemp->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetReactState(REACT_AGGRESSIVE); + pTemp->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(pTemp); + pTemp->AddThreat(pPlayer, 0.0f); } + } + } + } + + + void UpdateAI(const uint32 uiDiff) + { + ScriptedAI::UpdateAI(uiDiff); + + if (uiTimer <= uiDiff) + { + switch(uiPhase) + { + case 1: + DoSummonGrandChampion(uiSecondBoss); + NextStep(10000,true); + break; + case 2: + DoSummonGrandChampion(uiThirdBoss); + NextStep(0,false); + break; + case 3: + if (!Champion1List.empty()) + { + for (std::list::const_iterator itr = Champion1List.begin(); itr != Champion1List.end(); ++itr) + if (Creature* pSummon = Unit::GetCreature(*me, *itr)) + AggroAllPlayers(pSummon); + NextStep(0,false); + } + break; + } + } else uiTimer -= uiDiff; + + if (!UpdateVictim()) + return; + } + + void JustSummoned(Creature* pSummon) + { + if (pInstance && pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) + { + pSummon->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + pSummon->SetReactState(REACT_PASSIVE); + } + } + + void SummonedCreatureDespawn(Creature* pSummon) + { + switch(pSummon->GetEntry()) + { + case VEHICLE_DARNASSIA_NIGHTSABER: + case VEHICLE_EXODAR_ELEKK: + case VEHICLE_STORMWIND_STEED: + case VEHICLE_GNOMEREGAN_MECHANOSTRIDER: + case VEHICLE_IRONFORGE_RAM: + case VEHICLE_FORSAKE_WARHORSE: + case VEHICLE_THUNDER_BLUFF_KODO: + case VEHICLE_ORGRIMMAR_WOLF: + case VEHICLE_SILVERMOON_HAWKSTRIDER: + case VEHICLE_DARKSPEAR_RAPTOR: + me->AI()->SetData(DATA_LESSER_CHAMPIONS_DEFEATED,0); break; } - } else uiTimer -= uiDiff; + } + }; - if (!UpdateVictim()) - return; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_announcer_toc5AI(pCreature); } - void JustSummoned(Creature* pSummon) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pInstance && pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED) - { - pSummon->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - pSummon->SetReactState(REACT_PASSIVE); - } + InstanceScript* pInstance = pCreature->GetInstanceScript(); + + if (pInstance && + pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && + pInstance->GetData(BOSS_BLACK_KNIGHT) == DONE && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) + return false; + + if (pInstance && + pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && + pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED && + pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + else if (pInstance) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - void SummonedCreatureDespawn(Creature* pSummon) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(pSummon->GetEntry()) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case VEHICLE_DARNASSIA_NIGHTSABER: - case VEHICLE_EXODAR_ELEKK: - case VEHICLE_STORMWIND_STEED: - case VEHICLE_GNOMEREGAN_MECHANOSTRIDER: - case VEHICLE_IRONFORGE_RAM: - case VEHICLE_FORSAKE_WARHORSE: - case VEHICLE_THUNDER_BLUFF_KODO: - case VEHICLE_ORGRIMMAR_WOLF: - case VEHICLE_SILVERMOON_HAWKSTRIDER: - case VEHICLE_DARKSPEAR_RAPTOR: - me->AI()->SetData(DATA_LESSER_CHAMPIONS_DEFEATED,0); - break; + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_announcer_toc5::npc_announcer_toc5AI, pCreature->AI())->StartEncounter(); } + + return true; } }; -CreatureAI* GetAI_npc_announcer_toc5(Creature* pCreature) -{ - return new npc_announcer_toc5AI(pCreature); -} - -bool GossipHello_npc_announcer_toc5(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - - if (pInstance && - pInstance->GetData(BOSS_GRAND_CHAMPIONS) == DONE && - pInstance->GetData(BOSS_BLACK_KNIGHT) == DONE && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == DONE || - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == DONE) - return false; - - if (pInstance && - pInstance->GetData(BOSS_GRAND_CHAMPIONS) == NOT_STARTED && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_E) == NOT_STARTED && - pInstance->GetData(BOSS_ARGENT_CHALLENGE_P) == NOT_STARTED && - pInstance->GetData(BOSS_BLACK_KNIGHT) == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - else if (pInstance) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_START_EVENT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_announcer_toc5(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_announcer_toc5AI, pCreature->AI())->StartEncounter(); - } - - return true; -} - void AddSC_trial_of_the_champion() { - Script* NewScript; - - NewScript = new Script; - NewScript->Name = "npc_announcer_toc5"; - NewScript->GetAI = &GetAI_npc_announcer_toc5; - NewScript->pGossipHello = &GossipHello_npc_announcer_toc5; - NewScript->pGossipSelect = &GossipSelect_npc_announcer_toc5; - NewScript->RegisterSelf(); + new npc_announcer_toc5(); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp index c2234a4e4d0..4db4526d5bb 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_dred.cpp @@ -55,7 +55,7 @@ public: { boss_dredAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiBellowingRoarTimer; @@ -65,7 +65,7 @@ public: uint32 uiPiercingSlashTimer; uint32 uiRaptorCallTimer; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -167,10 +167,10 @@ public: { npc_drakkari_gutripperAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 GutRipTimer; @@ -221,10 +221,10 @@ public: { npc_drakkari_scytheclawAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiRendTimer; diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 815c60d72cf..c6bca04f95b 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -72,7 +72,7 @@ public: { boss_novosAI(Creature *c) : Scripted_NoMovementAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiTimer; @@ -86,7 +86,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { @@ -243,12 +243,12 @@ public: { mob_crystal_handlerAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiFlashOfDarknessTimer; - ScriptedInstance *pInstance; + InstanceScript *pInstance; void Reset() { @@ -300,10 +300,10 @@ public: { mob_novos_minionAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; void MovementInform(uint32 type, uint32 id) { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index be211cc3560..0da57724115 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -73,7 +73,7 @@ public: { boss_tharon_jaAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiPhaseTimer; @@ -86,7 +86,7 @@ public: CombatPhase Phase; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index fe32748c07b..4d003d3c2c4 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -63,7 +63,7 @@ public: { boss_trollgoreAI(Creature *c) : ScriptedAI(c), lSummons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } uint32 uiConsumeTimer; @@ -77,7 +77,7 @@ public: SummonList lSummons; - ScriptedInstance* pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 3ac82b58b47..15ae879fa4b 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -47,9 +47,9 @@ class instance_drak_tharon : public InstanceMapScript public: instance_drak_tharon() : InstanceMapScript("instance_drak_tharon") { } - struct instance_drak_tharon_ScriptedInstance : public ScriptedInstance + struct instance_drak_tharon_InstanceScript : public InstanceScript { - instance_drak_tharon_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_drak_tharon_InstanceScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint8 uiDredAchievCounter; @@ -232,9 +232,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_drak_tharon_ScriptedInstance(map); + return new instance_drak_tharon_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 2555d8a6985..24812b58c6e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -71,10 +71,10 @@ public: { boss_bronjahmAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; CombatPhases phase; @@ -209,10 +209,10 @@ public: { mob_corrupted_soul_fragmentAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 uiCheckTimer; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index dd6d15dc901..11f4a454622 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -128,12 +128,12 @@ public: { boss_devourer_of_soulsAI(Creature *c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } bool bThreeFaceAchievement; - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; // wailing soul event diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index d329f0d7858..c829554bc26 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -156,11 +156,11 @@ public: { npc_sylvanas_fosAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; Phase phase; @@ -281,11 +281,11 @@ public: { npc_jaina_fosAI(Creature *c) : ScriptedAI(c) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; EventMap events; Phase phase; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index b1797806d89..5128799fd1f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -30,9 +30,9 @@ class instance_forge_of_souls : public InstanceMapScript public: instance_forge_of_souls() : InstanceMapScript("instance_forge_of_souls") { } - struct instance_forge_of_souls_ScriptedInstance : public ScriptedInstance + struct instance_forge_of_souls_InstanceScript : public InstanceScript { - instance_forge_of_souls_ScriptedInstance(Map* pMap) : ScriptedInstance(pMap) {}; + instance_forge_of_souls_InstanceScript(Map* pMap) : InstanceScript(pMap) {}; uint64 uiBronjahm; uint64 uiDevourer; @@ -159,9 +159,9 @@ public: } }; - InstanceData* GetInstanceData(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap *map) const { - return new instance_forge_of_souls_ScriptedInstance(map); + return new instance_forge_of_souls_InstanceScript(map); } }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index ddb6191c999..5ed714e897e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -44,100 +44,103 @@ enum Events EVENT_IMPENDING_DESPAIR, EVENT_DEFILING_HORROR, }; - -struct boss_falricAI : public boss_horAI + class boss_falric : public CreatureScript { - boss_falricAI(Creature *pCreature) : boss_horAI(pCreature) {} +public: + boss_falric() : CreatureScript("boss_falric") { } - uint8 uiHopelessnessCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - boss_horAI::Reset(); - - uiHopelessnessCount = 0; - - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, NOT_STARTED); + return new boss_falricAI(pCreature); } - void EnterCombat(Unit* who) + struct boss_falricAI : public boss_horAI { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS); + boss_falricAI(Creature *pCreature) : boss_horAI(pCreature) {} - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000); - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000); - events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. - } + uint8 uiHopelessnessCount; - void JustDied(Unit* killer) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_FALRIC_EVENT, DONE); - } - - void KilledUnit(Unit *victim) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void UpdateAI(const uint32 diff) - { - // Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - switch (events.ExecuteEvent()) + void Reset() { - case EVENT_QUIVERING_STRIKE: - DoCast(SPELL_QUIVERING_STRIKE); - events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000); - break; - case EVENT_IMPENDING_DESPAIR: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - { - DoScriptText(SAY_IMPENDING_DESPAIR, me); - DoCast(pTarget, SPELL_IMPENDING_DESPAIR); - } - events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 13000); - break; - case EVENT_DEFILING_HORROR: - DoCast(SPELL_DEFILING_HORROR); - events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. - break; + boss_horAI::Reset(); + + uiHopelessnessCount = 0; + + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, NOT_STARTED); } - if ((uiHopelessnessCount < 1 && HealthBelowPct(66)) - || (uiHopelessnessCount < 2 && HealthBelowPct(33)) - || (uiHopelessnessCount < 3 && HealthBelowPct(10))) + void EnterCombat(Unit* who) { - uiHopelessnessCount++; - DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS,H_SPELL_HOPELESSNESS)); + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 23000); + events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 9000); + events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* killer) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_FALRIC_EVENT, DONE); + } + + void KilledUnit(Unit *victim) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void UpdateAI(const uint32 diff) + { + // Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + case EVENT_QUIVERING_STRIKE: + DoCast(SPELL_QUIVERING_STRIKE); + events.ScheduleEvent(EVENT_QUIVERING_STRIKE, 10000); + break; + case EVENT_IMPENDING_DESPAIR: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + { + DoScriptText(SAY_IMPENDING_DESPAIR, me); + DoCast(pTarget, SPELL_IMPENDING_DESPAIR); + } + events.ScheduleEvent(EVENT_IMPENDING_DESPAIR, 13000); + break; + case EVENT_DEFILING_HORROR: + DoCast(SPELL_DEFILING_HORROR); + events.ScheduleEvent(EVENT_DEFILING_HORROR, urand(25000,45000)); // TODO adjust timer. + break; + } + + if ((uiHopelessnessCount < 1 && HealthBelowPct(66)) + || (uiHopelessnessCount < 2 && HealthBelowPct(33)) + || (uiHopelessnessCount < 3 && HealthBelowPct(10))) + { + uiHopelessnessCount++; + DoCast(DUNGEON_MODE(SPELL_HOPELESSNESS,H_SPELL_HOPELESSNESS)); + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_falric(Creature* pCreature) -{ - return new boss_falricAI(pCreature); -} void AddSC_boss_falric() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_falric"; - newscript->GetAI = &GetAI_boss_falric; - newscript->RegisterSelf(); + new boss_falric(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index 47af8fd19c0..cbdae031db8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -44,91 +44,94 @@ enum Events EVENT_CORRUPTED_FLESH, EVENT_SHARED_SUFFERING, }; - -struct boss_marwynAI : public boss_horAI + class boss_marwyn : public CreatureScript { - boss_marwynAI(Creature *pCreature) : boss_horAI(pCreature) {} +public: + boss_marwyn() : CreatureScript("boss_marwyn") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - boss_horAI::Reset(); - - if (pInstance) - pInstance->SetData(DATA_MARWYN_EVENT, NOT_STARTED); + return new boss_marwynAI(pCreature); } - void EnterCombat(Unit* who) + struct boss_marwynAI : public boss_horAI { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS); + boss_marwynAI(Creature *pCreature) : boss_horAI(pCreature) {} - events.ScheduleEvent(EVENT_OBLITERATE, 30000); // TODO Check timer - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); // TODO Check timer - } - - void JustDied(Unit* killer) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_MARWYN_EVENT, DONE); - } - - void KilledUnit(Unit *victim) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void UpdateAI(const uint32 diff) - { - // Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - switch (events.ExecuteEvent()) + void Reset() { - case EVENT_OBLITERATE: - DoCast(SPELL_OBLITERATE); - events.ScheduleEvent(EVENT_OBLITERATE, 30000); - break; - case EVENT_WELL_OF_CORRUPTION: - DoCast(SPELL_WELL_OF_CORRUPTION); - events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); - break; - case EVENT_CORRUPTED_FLESH: - DoScriptText(RAND(SAY_CORRUPTED_FLESH_1,SAY_CORRUPTED_FLESH_2), me); - DoCast(SPELL_CORRUPTED_FLESH); - events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); - break; - case EVENT_SHARED_SUFFERING: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_SHARED_SUFFERING); - events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); - break; + boss_horAI::Reset(); + + if (pInstance) + pInstance->SetData(DATA_MARWYN_EVENT, NOT_STARTED); } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_MARWYN_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_OBLITERATE, 30000); // TODO Check timer + events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); + events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); + events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); // TODO Check timer + } + + void JustDied(Unit* killer) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_MARWYN_EVENT, DONE); + } + + void KilledUnit(Unit *victim) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void UpdateAI(const uint32 diff) + { + // Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + case EVENT_OBLITERATE: + DoCast(SPELL_OBLITERATE); + events.ScheduleEvent(EVENT_OBLITERATE, 30000); + break; + case EVENT_WELL_OF_CORRUPTION: + DoCast(SPELL_WELL_OF_CORRUPTION); + events.ScheduleEvent(EVENT_WELL_OF_CORRUPTION, 13000); + break; + case EVENT_CORRUPTED_FLESH: + DoScriptText(RAND(SAY_CORRUPTED_FLESH_1,SAY_CORRUPTED_FLESH_2), me); + DoCast(SPELL_CORRUPTED_FLESH); + events.ScheduleEvent(EVENT_CORRUPTED_FLESH, 20000); + break; + case EVENT_SHARED_SUFFERING: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_SHARED_SUFFERING); + events.ScheduleEvent(EVENT_SHARED_SUFFERING, 20000); + break; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_marwyn(Creature* pCreature) -{ - return new boss_marwynAI(pCreature); -} void AddSC_boss_marwyn() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_marwyn"; - newscript->GetAI = &GetAI_boss_marwyn; - newscript->RegisterSelf(); + new boss_marwyn(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 65f326e924f..89c47a344ed 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -148,405 +148,402 @@ static Position UtherSpawnPos = {5308.310059, 2003.857178, 709.341431, static Position LichKingSpawnPos = {5362.917480, 2062.307129, 707.695374, 3.945812}; static Position LichKingMoveThronePos = {5312.080566, 2009.172119, 709.341431, 3.973301}; // Lich King walks to throne static Position LichKingMoveAwayPos = {5400.069824, 2102.7131689, 707.69525, 0.843803}; // Lich King walks away - -// AI of Part1: handle the intro till start of gauntlet event. -struct npc_jaina_or_sylvanas_horAI : public ScriptedAI + class npc_jaina_or_sylvanas_hor : public CreatureScript { - npc_jaina_or_sylvanas_horAI(Creature *pCreature) : ScriptedAI(pCreature) +private: + bool m_isSylvana; + +public: + npc_jaina_or_sylvanas_hor(bool isSylvana, const char* name) : CreatureScript(name), m_isSylvana(isSylvana) { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - pInstance = me->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint64 uiUther; - uint64 uiLichKing; - - EventMap events; - - void Reset() - { - events.Reset(); - - uiUther = 0; - uiLichKing = 0; - - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->SetVisibility(VISIBILITY_ON); - } - - void DoAction(const int32 actionId) - { - switch(actionId) + switch (uiAction) { - case ACTION_START_INTRO: - events.ScheduleEvent(EVENT_START_INTRO, 0); + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->AI()) + pCreature->AI()->DoAction(ACTION_START_INTRO); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; - case ACTION_SKIP_INTRO: - events.ScheduleEvent(EVENT_SKIP_INTRO, 0); + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->AI()) + pCreature->AI()->DoAction(ACTION_SKIP_INTRO); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); break; } + + return true; } - void UpdateAI(const uint32 diff) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - events.Update(diff); - switch(events.ExecuteEvent()) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(m_isSylvana ? QUEST_DELIVRANCE_FROM_THE_PIT_H2 : QUEST_DELIVRANCE_FROM_THE_PIT_A2) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + // once last quest is completed, she offers this shortcut of the starting event + if (pPlayer->GetQuestStatus(m_isSylvana ? QUEST_WRATH_OF_THE_LICH_KING_H2 : QUEST_WRATH_OF_THE_LICH_KING_A2) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM( 0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_jaina_or_sylvanas_horAI(pCreature); + } + + // AI of Part1: handle the intro till start of gauntlet event. + struct npc_jaina_or_sylvanas_horAI : public ScriptedAI + { + npc_jaina_or_sylvanas_horAI(Creature *pCreature) : ScriptedAI(pCreature) { - case EVENT_START_INTRO: - me->GetMotionMaster()->MovePoint(0, MoveThronePos); - // Begining of intro is differents between factions as the speech sequence and timers are differents. - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - events.ScheduleEvent(EVENT_INTRO_A2_1, 0); - else - events.ScheduleEvent(EVENT_INTRO_H2_1, 0); - break; + pInstance = me->GetInstanceScript(); + } - // A2 Intro Events - case EVENT_INTRO_A2_1: - DoScriptText(SAY_JAINA_INTRO_3, me); - events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); - break; - case EVENT_INTRO_A2_2: - DoScriptText(SAY_JAINA_INTRO_4, me); - events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); - break; - case EVENT_INTRO_A2_3: - // TODO: she's doing some kind of spell casting emote - pInstance->HandleGameObject(pInstance->GetData64(DATA_FROSTMOURNE), true); - events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); - break; - case EVENT_INTRO_A2_4: - // spawn UTHER during speach 2 - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pUther->GetMotionMaster()->MoveIdle(); - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas - uiUther = pUther->GetGUID(); - } - events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); - break; - case EVENT_INTRO_A2_5: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_1, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); - break; - case EVENT_INTRO_A2_6: - DoScriptText(SAY_JAINA_INTRO_5, me); - events.ScheduleEvent(EVENT_INTRO_A2_7, 6000); - break; - case EVENT_INTRO_A2_7: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_2, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_8, 6500); - break; - case EVENT_INTRO_A2_8: - DoScriptText(SAY_JAINA_INTRO_6, me); - events.ScheduleEvent(EVENT_INTRO_A2_9, 2000); - break; - case EVENT_INTRO_A2_9: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_3, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_10, 9000); - break; - case EVENT_INTRO_A2_10: - DoScriptText(SAY_JAINA_INTRO_7, me); - events.ScheduleEvent(EVENT_INTRO_A2_11, 5000); - break; - case EVENT_INTRO_A2_11: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_4, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_12, 11000); - break; - case EVENT_INTRO_A2_12: - DoScriptText(SAY_JAINA_INTRO_8, me); - events.ScheduleEvent(EVENT_INTRO_A2_13, 4000); - break; - case EVENT_INTRO_A2_13: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_5, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_14, 12500); - break; - case EVENT_INTRO_A2_14: - DoScriptText(SAY_JAINA_INTRO_9, me); - events.ScheduleEvent(EVENT_INTRO_A2_15, 10000); - break; - case EVENT_INTRO_A2_15: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_6, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_16, 22000); - break; - case EVENT_INTRO_A2_16: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_A2_7, pUther); - events.ScheduleEvent(EVENT_INTRO_A2_17, 4000); - break; - case EVENT_INTRO_A2_17: - DoScriptText(SAY_JAINA_INTRO_10, me); - events.ScheduleEvent(EVENT_INTRO_A2_18, 2000); - break; - case EVENT_INTRO_A2_18: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - DoScriptText(SAY_UTHER_INTRO_A2_8, pUther); - } - events.ScheduleEvent(EVENT_INTRO_A2_19, 11000); - break; - case EVENT_INTRO_A2_19: - DoScriptText(SAY_JAINA_INTRO_11, me); - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); - break; + InstanceScript* pInstance; + uint64 uiUther; + uint64 uiLichKing; - // H2 Intro Events - case EVENT_INTRO_H2_1: - DoScriptText(SAY_SYLVANAS_INTRO_1, me); - events.ScheduleEvent(EVENT_INTRO_H2_2, 8000); - break; - case EVENT_INTRO_H2_2: - DoScriptText(SAY_SYLVANAS_INTRO_2, me); - events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); - break; - case EVENT_INTRO_H2_3: - DoScriptText(SAY_SYLVANAS_INTRO_3, me); - // TODO: she's doing some kind of spell casting emote - events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); - break; - case EVENT_INTRO_H2_4: - // spawn UTHER during speach 2 - if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pUther->GetMotionMaster()->MoveIdle(); - pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas - uiUther = pUther->GetGUID(); - } - events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); - break; - case EVENT_INTRO_H2_5: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_H2_1, pUther); - events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); - break; - case EVENT_INTRO_H2_6: - DoScriptText(SAY_SYLVANAS_INTRO_4, me); - events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); - break; - case EVENT_INTRO_H2_7: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_H2_2, pUther); - events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); - break; - case EVENT_INTRO_H2_8: - DoScriptText(SAY_SYLVANAS_INTRO_5, me); - events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); - break; - case EVENT_INTRO_H2_9: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_H2_3, pUther); - events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); - break; - case EVENT_INTRO_H2_10: - DoScriptText(SAY_SYLVANAS_INTRO_6, me); - events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); - break; - case EVENT_INTRO_H2_11: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_H2_4, pUther); - events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); - break; - case EVENT_INTRO_H2_12: - DoScriptText(SAY_SYLVANAS_INTRO_7, me); - events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); - break; - case EVENT_INTRO_H2_13: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - { - pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); - DoScriptText(SAY_UTHER_INTRO_H2_5, pUther); - } - events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); - break; - case EVENT_INTRO_H2_14: - if (Creature* pUther = me->GetCreature(*me, uiUther)) - DoScriptText(SAY_UTHER_INTRO_H2_6, pUther); - events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); - break; - case EVENT_INTRO_H2_15: - DoScriptText(SAY_SYLVANAS_INTRO_8, me); - events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); - break; - - // Remaining Intro Events common for both faction - case EVENT_INTRO_LK_1: - // Spawn LK in front of door, and make him move to the sword. - if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos); - pLichKing->SetReactState(REACT_PASSIVE); - uiLichKing = pLichKing->GetGUID(); - } + EventMap events; - if (Creature* pUther = me->GetCreature(*me, uiUther)) + void Reset() + { + events.Reset(); + + uiUther = 0; + uiLichKing = 0; + + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->SetVisibility(VISIBILITY_ON); + } + + void DoAction(const int32 actionId) + { + switch(actionId) + { + case ACTION_START_INTRO: + events.ScheduleEvent(EVENT_START_INTRO, 0); + break; + case ACTION_SKIP_INTRO: + events.ScheduleEvent(EVENT_SKIP_INTRO, 0); + break; + } + } + + void UpdateAI(const uint32 diff) + { + events.Update(diff); + switch(events.ExecuteEvent()) + { + case EVENT_START_INTRO: + me->GetMotionMaster()->MovePoint(0, MoveThronePos); + // Begining of intro is differents between factions as the speech sequence and timers are differents. if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - DoScriptText(SAY_UTHER_INTRO_A2_9, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_1, 0); else - DoScriptText(SAY_UTHER_INTRO_H2_7, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_1, 0); + break; - events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); - break; + // A2 Intro Events + case EVENT_INTRO_A2_1: + DoScriptText(SAY_JAINA_INTRO_3, me); + events.ScheduleEvent(EVENT_INTRO_A2_2, 5000); + break; + case EVENT_INTRO_A2_2: + DoScriptText(SAY_JAINA_INTRO_4, me); + events.ScheduleEvent(EVENT_INTRO_A2_3, 10000); + break; + case EVENT_INTRO_A2_3: + // TODO: she's doing some kind of spell casting emote + pInstance->HandleGameObject(pInstance->GetData64(DATA_FROSTMOURNE), true); + events.ScheduleEvent(EVENT_INTRO_A2_4, 10000); + break; + case EVENT_INTRO_A2_4: + // spawn UTHER during speach 2 + if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pUther->GetMotionMaster()->MoveIdle(); + pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas + uiUther = pUther->GetGUID(); + } + events.ScheduleEvent(EVENT_INTRO_A2_5, 2000); + break; + case EVENT_INTRO_A2_5: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_1, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_6, 3000); + break; + case EVENT_INTRO_A2_6: + DoScriptText(SAY_JAINA_INTRO_5, me); + events.ScheduleEvent(EVENT_INTRO_A2_7, 6000); + break; + case EVENT_INTRO_A2_7: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_2, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_8, 6500); + break; + case EVENT_INTRO_A2_8: + DoScriptText(SAY_JAINA_INTRO_6, me); + events.ScheduleEvent(EVENT_INTRO_A2_9, 2000); + break; + case EVENT_INTRO_A2_9: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_3, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_10, 9000); + break; + case EVENT_INTRO_A2_10: + DoScriptText(SAY_JAINA_INTRO_7, me); + events.ScheduleEvent(EVENT_INTRO_A2_11, 5000); + break; + case EVENT_INTRO_A2_11: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_4, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_12, 11000); + break; + case EVENT_INTRO_A2_12: + DoScriptText(SAY_JAINA_INTRO_8, me); + events.ScheduleEvent(EVENT_INTRO_A2_13, 4000); + break; + case EVENT_INTRO_A2_13: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_5, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_14, 12500); + break; + case EVENT_INTRO_A2_14: + DoScriptText(SAY_JAINA_INTRO_9, me); + events.ScheduleEvent(EVENT_INTRO_A2_15, 10000); + break; + case EVENT_INTRO_A2_15: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_6, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_16, 22000); + break; + case EVENT_INTRO_A2_16: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_A2_7, pUther); + events.ScheduleEvent(EVENT_INTRO_A2_17, 4000); + break; + case EVENT_INTRO_A2_17: + DoScriptText(SAY_JAINA_INTRO_10, me); + events.ScheduleEvent(EVENT_INTRO_A2_18, 2000); + break; + case EVENT_INTRO_A2_18: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + DoScriptText(SAY_UTHER_INTRO_A2_8, pUther); + } + events.ScheduleEvent(EVENT_INTRO_A2_19, 11000); + break; + case EVENT_INTRO_A2_19: + DoScriptText(SAY_JAINA_INTRO_11, me); + events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); + break; - case EVENT_INTRO_LK_2: - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) - DoScriptText(SAY_LK_INTRO_1, pLichKing); - events.ScheduleEvent(EVENT_INTRO_LK_3, 2000); - break; + // H2 Intro Events + case EVENT_INTRO_H2_1: + DoScriptText(SAY_SYLVANAS_INTRO_1, me); + events.ScheduleEvent(EVENT_INTRO_H2_2, 8000); + break; + case EVENT_INTRO_H2_2: + DoScriptText(SAY_SYLVANAS_INTRO_2, me); + events.ScheduleEvent(EVENT_INTRO_H2_3, 6000); + break; + case EVENT_INTRO_H2_3: + DoScriptText(SAY_SYLVANAS_INTRO_3, me); + // TODO: she's doing some kind of spell casting emote + events.ScheduleEvent(EVENT_INTRO_H2_4, 6000); + break; + case EVENT_INTRO_H2_4: + // spawn UTHER during speach 2 + if (Creature* pUther = me->SummonCreature(NPC_UTHER, UtherSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pUther->GetMotionMaster()->MoveIdle(); + pUther->SetReactState(REACT_PASSIVE); // be sure he will not aggro arthas + uiUther = pUther->GetGUID(); + } + events.ScheduleEvent(EVENT_INTRO_H2_5, 2000); + break; + case EVENT_INTRO_H2_5: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_H2_1, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_6, 11000); + break; + case EVENT_INTRO_H2_6: + DoScriptText(SAY_SYLVANAS_INTRO_4, me); + events.ScheduleEvent(EVENT_INTRO_H2_7, 3000); + break; + case EVENT_INTRO_H2_7: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_H2_2, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_8, 6000); + break; + case EVENT_INTRO_H2_8: + DoScriptText(SAY_SYLVANAS_INTRO_5, me); + events.ScheduleEvent(EVENT_INTRO_H2_9, 5000); + break; + case EVENT_INTRO_H2_9: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_H2_3, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_10, 19000); + break; + case EVENT_INTRO_H2_10: + DoScriptText(SAY_SYLVANAS_INTRO_6, me); + events.ScheduleEvent(EVENT_INTRO_H2_11, 1500); + break; + case EVENT_INTRO_H2_11: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_H2_4, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_12, 19500); + break; + case EVENT_INTRO_H2_12: + DoScriptText(SAY_SYLVANAS_INTRO_7, me); + events.ScheduleEvent(EVENT_INTRO_H2_13, 2000); + break; + case EVENT_INTRO_H2_13: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + { + pUther->HandleEmoteCommand(EMOTE_ONESHOT_NO); + DoScriptText(SAY_UTHER_INTRO_H2_5, pUther); + } + events.ScheduleEvent(EVENT_INTRO_H2_14, 12000); + break; + case EVENT_INTRO_H2_14: + if (Creature* pUther = me->GetCreature(*me, uiUther)) + DoScriptText(SAY_UTHER_INTRO_H2_6, pUther); + events.ScheduleEvent(EVENT_INTRO_H2_15, 8000); + break; + case EVENT_INTRO_H2_15: + DoScriptText(SAY_SYLVANAS_INTRO_8, me); + events.ScheduleEvent(EVENT_INTRO_LK_1, 2000); + break; + + // Remaining Intro Events common for both faction + case EVENT_INTRO_LK_1: + // Spawn LK in front of door, and make him move to the sword. + if (Creature* pLichKing = me->SummonCreature(NPC_LICH_KING_EVENT, LichKingSpawnPos, TEMPSUMMON_MANUAL_DESPAWN)) + { + pLichKing->GetMotionMaster()->MovePoint(0, LichKingMoveThronePos); + pLichKing->SetReactState(REACT_PASSIVE); + uiLichKing = pLichKing->GetGUID(); + } - case EVENT_INTRO_LK_3: - // The Lich King banishes Uther to the abyss. - if (Creature* pUther = me->GetCreature(*me, uiUther)) - { - pUther->DisappearAndDie(); - uiUther = 0; - } - - // He steps forward and removes the runeblade from the heap of skulls. - - events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); - break; - - case EVENT_INTRO_LK_4: - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) - DoScriptText(SAY_LK_INTRO_2, pLichKing); - events.ScheduleEvent(EVENT_INTRO_LK_5, 10000); - break; - - case EVENT_INTRO_LK_5: - // summon Falric and Marwyn. then go back to the door - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->SetVisibility(VISIBILITY_ON); - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - pMarwyn->SetVisibility(VISIBILITY_ON); + if (Creature* pUther = me->GetCreature(*me, uiUther)) + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + DoScriptText(SAY_UTHER_INTRO_A2_9, pUther); + else + DoScriptText(SAY_UTHER_INTRO_H2_7, pUther); + + events.ScheduleEvent(EVENT_INTRO_LK_2, 11000); + break; + + case EVENT_INTRO_LK_2: + if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) + DoScriptText(SAY_LK_INTRO_1, pLichKing); + events.ScheduleEvent(EVENT_INTRO_LK_3, 2000); + break; + + case EVENT_INTRO_LK_3: + // The Lich King banishes Uther to the abyss. + if (Creature* pUther = me->GetCreature(*me, uiUther)) + { + pUther->DisappearAndDie(); + uiUther = 0; + } + + // He steps forward and removes the runeblade from the heap of skulls. + + events.ScheduleEvent(EVENT_INTRO_LK_4, 4000); + break; + + case EVENT_INTRO_LK_4: + if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) + DoScriptText(SAY_LK_INTRO_2, pLichKing); + events.ScheduleEvent(EVENT_INTRO_LK_5, 10000); + break; + + case EVENT_INTRO_LK_5: + // summon Falric and Marwyn. then go back to the door + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->SetVisibility(VISIBILITY_ON); + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + pMarwyn->SetVisibility(VISIBILITY_ON); + + if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) + { + pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + DoScriptText(SAY_LK_INTRO_3, pLichKing); + } + + events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); + break; + + case EVENT_INTRO_LK_6: + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + DoScriptText(SAY_FALRIC_INTRO_1, pFalric); + + events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); + break; + + case EVENT_INTRO_LK_7: + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn); + + events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); + break; + + case EVENT_INTRO_LK_8: + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + DoScriptText(SAY_FALRIC_INTRO_2, pFalric); + + events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); + break; + + case EVENT_INTRO_LK_9: + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) + DoScriptText(SAY_JAINA_INTRO_END, me); + else + DoScriptText(SAY_SYLVANAS_INTRO_END, me); + + me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + // TODO: Loralen/Koreln shall run also + events.ScheduleEvent(EVENT_INTRO_END, 10000); + break; - if (Creature* pLichKing = me->GetCreature(*me, uiLichKing)) - { - pLichKing->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - DoScriptText(SAY_LK_INTRO_3, pLichKing); - } - - events.ScheduleEvent(EVENT_INTRO_LK_6, 8000); - break; - - case EVENT_INTRO_LK_6: - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - DoScriptText(SAY_FALRIC_INTRO_1, pFalric); + case EVENT_INTRO_END: + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave - events.ScheduleEvent(EVENT_INTRO_LK_7, 2000); - break; + // Loralen or Koreln disappearAndDie() + me->DisappearAndDie(); + break; - case EVENT_INTRO_LK_7: - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - DoScriptText(SAY_MARWYN_INTRO_1, pMarwyn); + case EVENT_SKIP_INTRO: + // TODO: implement - events.ScheduleEvent(EVENT_INTRO_LK_8, 2000); - break; - - case EVENT_INTRO_LK_8: - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - DoScriptText(SAY_FALRIC_INTRO_2, pFalric); + if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) + pFalric->SetVisibility(VISIBILITY_ON); + if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) + pMarwyn->SetVisibility(VISIBILITY_ON); - events.ScheduleEvent(EVENT_INTRO_LK_9, 5000); - break; + me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); + // TODO: Loralen/Koreln shall run also - case EVENT_INTRO_LK_9: - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) - DoScriptText(SAY_JAINA_INTRO_END, me); - else - DoScriptText(SAY_SYLVANAS_INTRO_END, me); - - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - // TODO: Loralen/Koreln shall run also - events.ScheduleEvent(EVENT_INTRO_END, 10000); - break; - - case EVENT_INTRO_END: - if (pInstance) - pInstance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave - - // Loralen or Koreln disappearAndDie() - me->DisappearAndDie(); - break; - - case EVENT_SKIP_INTRO: - // TODO: implement - - if (Creature* pFalric = me->GetCreature(*me, pInstance->GetData64(DATA_FALRIC))) - pFalric->SetVisibility(VISIBILITY_ON); - if (Creature* pMarwyn = me->GetCreature(*me, pInstance->GetData64(DATA_MARWYN))) - pMarwyn->SetVisibility(VISIBILITY_ON); - - me->GetMotionMaster()->MovePoint(0, LichKingSpawnPos); - // TODO: Loralen/Koreln shall run also - - events.ScheduleEvent(EVENT_INTRO_END, 15000); - break; + events.ScheduleEvent(EVENT_INTRO_END, 15000); + break; + } } - } + }; + }; -bool GossipHello_npc_sylvanas_hor(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(QUEST_DELIVRANCE_FROM_THE_PIT_H2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - // once last quest is completed, she offers this shortcut of the starting event - if (pPlayer->GetQuestStatus(QUEST_WRATH_OF_THE_LICH_KING_H2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "Dark Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); - - return true; -} - -bool GossipHello_npc_jaina_hor(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(QUEST_DELIVRANCE_FROM_THE_PIT_A2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "Can you remove the sword?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - // once last quest of the series is completed, she offers this shortcut of the starting event - if (pPlayer->GetQuestStatus(QUEST_WRATH_OF_THE_LICH_KING_A2) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM( 0, "My Lady, I think I hear Arthas coming. Whatever you're going to do, do it quickly.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_jaina_or_sylvanas_hor(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pCreature->AI()) - pCreature->AI()->DoAction(ACTION_START_INTRO); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pCreature->AI()) - pCreature->AI()->DoAction(ACTION_SKIP_INTRO); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - break; - } - - return true; -} - enum TrashSpells { // Ghostly Priest @@ -617,407 +614,401 @@ enum TrashEvents EVENT_FROST_TRAP, EVENT_ICE_SHOT, }; - -struct npc_ghostly_priestAI: public ScriptedAI + class npc_ghostly_priest : public CreatureScript { - npc_ghostly_priestAI(Creature *c) : ScriptedAI(c) +public: + npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new npc_ghostly_priestAI(pCreature); } - EventMap events; - - void Reset() + struct npc_ghostly_priestAI: public ScriptedAI { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); // TODO: adjust timers - events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); - events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); - events.ScheduleEvent(EVENT_DARK_MENDING, 20000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + npc_ghostly_priestAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_SHADOW_WORD_PAIN: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_SHADOW_WORD_PAIN); - events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); - return; - case EVENT_CIRCLE_OF_DESTRUCTION: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_CIRCLE_OF_DESTRUCTION); - events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); - return; - case EVENT_COWER_IN_FEAR: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_COWER_IN_FEAR); - events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); - return; - case EVENT_DARK_MENDING: - // find an ally with missing HP - if (Unit *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000,50000))) - { - DoCast(pTarget, SPELL_DARK_MENDING); - events.ScheduleEvent(EVENT_DARK_MENDING, 20000); - } - else - { - // no friendly unit with missing hp. re-check in just 5 sec. - events.ScheduleEvent(EVENT_DARK_MENDING, 5000); - } - return; - } } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct npc_phantom_mageAI: public ScriptedAI -{ - npc_phantom_mageAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FIREBALL, 3000); // TODO: adjust timers - events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); - events.ScheduleEvent(EVENT_FROSTBOLT, 9000); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); - events.ScheduleEvent(EVENT_HALLUCINATION, 40000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_FIREBALL: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FIREBALL); - events.ScheduleEvent(EVENT_FIREBALL, 15000); - return; - case EVENT_FLAMESTRIKE: - DoCast(SPELL_FLAMESTRIKE); - events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); - return; - case EVENT_FROSTBOLT: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FROSTBOLT); - events.ScheduleEvent(EVENT_FROSTBOLT, 15000); - return; - case EVENT_CHAINS_OF_ICE: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_CHAINS_OF_ICE); - events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); - return; - case EVENT_HALLUCINATION: - DoCast(SPELL_HALLUCINATION); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct npc_phantom_hallucinationAI: public npc_phantom_mageAI -{ - npc_phantom_hallucinationAI(Creature *c) : npc_phantom_mageAI(c) - { - } - - void JustDied(Unit * /*pWho*/) - { - DoCast(SPELL_HALLUCINATION_2); - } -}; - -struct npc_shadowy_mercenaryAI: public ScriptedAI -{ - npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); // TODO: adjust timers - events.ScheduleEvent(EVENT_DEADLY_POISON, 5000); - events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 12000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_SHADOW_STEP: - DoCast(SPELL_SHADOW_STEP); - events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); - return; - case EVENT_DEADLY_POISON: - DoCast(me->getVictim(), SPELL_DEADLY_POISON); - events.ScheduleEvent(EVENT_DEADLY_POISON, 10000); - return; - case EVENT_ENVENOMED_DAGGER_THROW: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_ENVENOMED_DAGGER_THROW); - events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); - return; - case EVENT_KIDNEY_SHOT: - DoCast(me->getVictim(), SPELL_KIDNEY_SHOT); - events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); - return; - } + events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); // TODO: adjust timers + events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); + events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); + events.ScheduleEvent(EVENT_DARK_MENDING, 20000); } - DoMeleeAttackIfReady(); - } -}; - -struct npc_spectral_footmanAI: public ScriptedAI -{ - npc_spectral_footmanAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); // TODO: adjust timers - events.ScheduleEvent(EVENT_SHIELD_BASH, 10000); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SPECTRAL_STRIKE: - DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE); - events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); - return; - case EVENT_SHIELD_BASH: - DoCast(me->getVictim(), SPELL_SHIELD_BASH); - events.ScheduleEvent(EVENT_SHIELD_BASH, 5000); - return; - case EVENT_TORTURED_ENRAGE: - DoCast(SPELL_TORTURED_ENRAGE); - events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); - return; + switch(eventId) + { + case EVENT_SHADOW_WORD_PAIN: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_SHADOW_WORD_PAIN); + events.ScheduleEvent(EVENT_SHADOW_WORD_PAIN, 8000); + return; + case EVENT_CIRCLE_OF_DESTRUCTION: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_CIRCLE_OF_DESTRUCTION); + events.ScheduleEvent(EVENT_CIRCLE_OF_DESTRUCTION, 12000); + return; + case EVENT_COWER_IN_FEAR: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_COWER_IN_FEAR); + events.ScheduleEvent(EVENT_COWER_IN_FEAR, 10000); + return; + case EVENT_DARK_MENDING: + // find an ally with missing HP + if (Unit *pTarget = DoSelectLowestHpFriendly(40, DUNGEON_MODE(30000,50000))) + { + DoCast(pTarget, SPELL_DARK_MENDING); + events.ScheduleEvent(EVENT_DARK_MENDING, 20000); + } + else + { + // no friendly unit with missing hp. re-check in just 5 sec. + events.ScheduleEvent(EVENT_DARK_MENDING, 5000); + } + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class npc_phantom_mage : public CreatureScript +{ +public: + npc_phantom_mage() : CreatureScript("npc_phantom_mage") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_phantom_mageAI(pCreature); + } + + struct npc_phantom_mageAI: public ScriptedAI + { + npc_phantom_mageAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct npc_tortured_riflemanAI : public ScriptedAI -{ - npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHOOT, 2000); // TODO: adjust timers - events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); - events.ScheduleEvent(EVENT_FROST_TRAP, 1000); - events.ScheduleEvent(EVENT_ICE_SHOT, 15000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_SHOOT: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_SHOOT); - events.ScheduleEvent(EVENT_SHOOT, 2000); - return; - case EVENT_CURSED_ARROW: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_CURSED_ARROW); - events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); - return; - case EVENT_FROST_TRAP: - DoCast(SPELL_FROST_TRAP); - events.ScheduleEvent(EVENT_FROST_TRAP, 30000); - return; - case EVENT_ICE_SHOT: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_ICE_SHOT); - events.ScheduleEvent(EVENT_ICE_SHOT, 15000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FIREBALL, 3000); // TODO: adjust timers + events.ScheduleEvent(EVENT_FLAMESTRIKE, 6000); + events.ScheduleEvent(EVENT_FROSTBOLT, 9000); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 12000); + events.ScheduleEvent(EVENT_HALLUCINATION, 40000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FIREBALL: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_FIREBALL); + events.ScheduleEvent(EVENT_FIREBALL, 15000); + return; + case EVENT_FLAMESTRIKE: + DoCast(SPELL_FLAMESTRIKE); + events.ScheduleEvent(EVENT_FLAMESTRIKE, 15000); + return; + case EVENT_FROSTBOLT: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_FROSTBOLT); + events.ScheduleEvent(EVENT_FROSTBOLT, 15000); + return; + case EVENT_CHAINS_OF_ICE: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_CHAINS_OF_ICE); + events.ScheduleEvent(EVENT_CHAINS_OF_ICE, 15000); + return; + case EVENT_HALLUCINATION: + DoCast(SPELL_HALLUCINATION); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; - -CreatureAI* GetAI_npc_jaina_or_sylvanas_horAI(Creature* pCreature) + class npc_phantom_hallucination : public CreatureScript { - return new npc_jaina_or_sylvanas_horAI(pCreature); -} +public: + npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { } -CreatureAI* GetAI_npc_ghostly_priestAI(Creature* pCreature) -{ - return new npc_ghostly_priestAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_phantom_hallucinationAI(pCreature); + } -CreatureAI* GetAI_npc_phantom_mageAI(Creature* pCreature) -{ - return new npc_phantom_mageAI(pCreature); -} + struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI + { + npc_phantom_hallucinationAI(Creature *c) : npc_phantom_mage::npc_phantom_mageAI(c) + { + } -CreatureAI* GetAI_npc_phantom_hallucinationAI(Creature* pCreature) -{ - return new npc_phantom_hallucinationAI(pCreature); -} + void JustDied(Unit * /*pWho*/) + { + DoCast(SPELL_HALLUCINATION_2); + } + }; -CreatureAI* GetAI_npc_shadowy_mercenaryAI(Creature* pCreature) +}; + class npc_shadowy_mercenary : public CreatureScript { - return new npc_shadowy_mercenaryAI(pCreature); -} +public: + npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { } -CreatureAI* GetAI_npc_spectral_footmanAI(Creature* pCreature) -{ - return new npc_spectral_footmanAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_shadowy_mercenaryAI(pCreature); + } -CreatureAI* GetAI_npc_tortured_riflemanAI(Creature* pCreature) + struct npc_shadowy_mercenaryAI: public ScriptedAI + { + npc_shadowy_mercenaryAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); // TODO: adjust timers + events.ScheduleEvent(EVENT_DEADLY_POISON, 5000); + events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 12000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHADOW_STEP: + DoCast(SPELL_SHADOW_STEP); + events.ScheduleEvent(EVENT_SHADOW_STEP, 8000); + return; + case EVENT_DEADLY_POISON: + DoCast(me->getVictim(), SPELL_DEADLY_POISON); + events.ScheduleEvent(EVENT_DEADLY_POISON, 10000); + return; + case EVENT_ENVENOMED_DAGGER_THROW: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_ENVENOMED_DAGGER_THROW); + events.ScheduleEvent(EVENT_ENVENOMED_DAGGER_THROW, 10000); + return; + case EVENT_KIDNEY_SHOT: + DoCast(me->getVictim(), SPELL_KIDNEY_SHOT); + events.ScheduleEvent(EVENT_KIDNEY_SHOT, 10000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class npc_spectral_footman : public CreatureScript { - return new npc_tortured_riflemanAI(pCreature); -} +public: + npc_spectral_footman() : CreatureScript("npc_spectral_footman") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_spectral_footmanAI(pCreature); + } + + struct npc_spectral_footmanAI: public ScriptedAI + { + npc_spectral_footmanAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); // TODO: adjust timers + events.ScheduleEvent(EVENT_SHIELD_BASH, 10000); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SPECTRAL_STRIKE: + DoCast(me->getVictim(), SPELL_SPECTRAL_STRIKE); + events.ScheduleEvent(EVENT_SPECTRAL_STRIKE, 5000); + return; + case EVENT_SHIELD_BASH: + DoCast(me->getVictim(), SPELL_SHIELD_BASH); + events.ScheduleEvent(EVENT_SHIELD_BASH, 5000); + return; + case EVENT_TORTURED_ENRAGE: + DoCast(SPELL_TORTURED_ENRAGE); + events.ScheduleEvent(EVENT_TORTURED_ENRAGE, 15000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class npc_tortured_rifleman : public CreatureScript +{ +public: + npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_tortured_riflemanAI(pCreature); + } + + struct npc_tortured_riflemanAI : public ScriptedAI + { + npc_tortured_riflemanAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHOOT, 2000); // TODO: adjust timers + events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); + events.ScheduleEvent(EVENT_FROST_TRAP, 1000); + events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHOOT: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_SHOOT); + events.ScheduleEvent(EVENT_SHOOT, 2000); + return; + case EVENT_CURSED_ARROW: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_CURSED_ARROW); + events.ScheduleEvent(EVENT_CURSED_ARROW, 10000); + return; + case EVENT_FROST_TRAP: + DoCast(SPELL_FROST_TRAP); + events.ScheduleEvent(EVENT_FROST_TRAP, 30000); + return; + case EVENT_ICE_SHOT: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_ICE_SHOT); + events.ScheduleEvent(EVENT_ICE_SHOT, 15000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_halls_of_reflection() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_sylvanas_hor_part1"; - newscript->GetAI = &GetAI_npc_jaina_or_sylvanas_horAI; - newscript->pGossipHello = &GossipHello_npc_sylvanas_hor; - newscript->pGossipSelect = &GossipSelect_npc_jaina_or_sylvanas_hor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_jaina_hor_part1"; - newscript->GetAI = &GetAI_npc_jaina_or_sylvanas_horAI; - newscript->pGossipHello = &GossipHello_npc_jaina_hor; - newscript->pGossipSelect = &GossipSelect_npc_jaina_or_sylvanas_hor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ghostly_priest"; - newscript->GetAI = &GetAI_npc_ghostly_priestAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_phantom_mage"; - newscript->GetAI = &GetAI_npc_phantom_mageAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_phantom_hallucination"; - newscript->GetAI = &GetAI_npc_phantom_hallucinationAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shadowy_mercenary"; - newscript->GetAI = &GetAI_npc_shadowy_mercenaryAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_spectral_footman"; - newscript->GetAI = &GetAI_npc_spectral_footmanAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tortured_rifleman"; - newscript->GetAI = &GetAI_npc_tortured_riflemanAI; - newscript->RegisterSelf(); + new npc_jaina_or_sylvanas_hor(true, "npc_sylvanas_hor_part1"); + new npc_jaina_or_sylvanas_hor(false, "npc_jaina_hor_part1"); + new npc_ghostly_priest(); + new npc_phantom_mage(); + new npc_phantom_hallucination(); + new npc_shadowy_mercenary(); + new npc_spectral_footman(); + new npc_tortured_rifleman(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 0e4dc94b826..29fc462b15b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -76,15 +76,15 @@ enum Actions }; // Base class for FALRIC and MARWYN -// handled the summonList and the notification events to/from the InstanceData +// handled the summonList and the notification events to/from the InstanceScript struct boss_horAI : ScriptedAI { boss_horAI(Creature *pCreature) : ScriptedAI(pCreature), summons(pCreature) { - pInstance = me->GetInstanceData(); + pInstance = me->GetInstanceScript(); } - InstanceData* pInstance; + InstanceScript* pInstance; EventMap events; SummonList summons; @@ -106,8 +106,8 @@ struct boss_horAI : ScriptedAI { switch(actionID) { - case ACTION_ENTER_COMBAT: // called by InstanceData when boss shall enter in combat. - // Just in case. Should have been done by InstanceData + case ACTION_ENTER_COMBAT: // called by InstanceScript when boss shall enter in combat. + // Just in case. Should have been done by InstanceScript me->SetVisibility(VISIBILITY_ON); // Reset flags diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 8a6ffb82fc2..babfa9eaa51 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -95,338 +95,341 @@ static Position RiflemanSpawnPos[ENCOUNTER_WAVE_RIFLEMAN] = {5295.64,1973.76,707.778,1.18682}, {5282.9,2019.6,707.778,5.88176}, }; - -struct instance_halls_of_reflection : public ScriptedInstance + class instance_halls_of_reflection : public InstanceMapScript { - instance_halls_of_reflection(Map* pMap) : ScriptedInstance(pMap) {}; +public: + instance_halls_of_reflection() : InstanceMapScript("instance_halls_of_reflection") { } - uint64 uiFalric; - uint64 uiMarwyn; - uint64 uiLichKingEvent; - uint64 uiJainaPart1; - uint64 uiSylvanasPart1; - - uint64 uiFrostmourne; - uint64 uiFrostmourneAltar; - uint64 uiArthasDoor; - uint64 uiFrontDoor; - - uint32 uiEncounter[MAX_ENCOUNTER]; - uint32 uiTeamInInstance; - uint32 uiWaveCount; - bool bIntroDone; - - EventMap events; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - events.Reset(); - - uiFalric = 0; - uiMarwyn = 0; - uiLichKingEvent = 0; - uiJainaPart1 = 0; - uiSylvanasPart1 = 0; - - uiFrostmourne = 0; - uiFrostmourneAltar = 0; - uiArthasDoor = 0; - uiFrontDoor = 0; - uiTeamInInstance = 0; - uiWaveCount = 0; - bIntroDone = false; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - uiEncounter[i] = NOT_STARTED; + return new instance_halls_of_reflection_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool add) + struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript { - if (!add) - return; + instance_halls_of_reflection_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; - Map::PlayerList const &players = instance->GetPlayers(); - if (!players.isEmpty()) - if (Player* pPlayer = players.begin()->getSource()) - uiTeamInInstance = pPlayer->GetTeam(); + uint64 uiFalric; + uint64 uiMarwyn; + uint64 uiLichKingEvent; + uint64 uiJainaPart1; + uint64 uiSylvanasPart1; - switch(pCreature->GetEntry()) + uint64 uiFrostmourne; + uint64 uiFrostmourneAltar; + uint64 uiArthasDoor; + uint64 uiFrontDoor; + + uint32 uiEncounter[MAX_ENCOUNTER]; + uint32 uiTeamInInstance; + uint32 uiWaveCount; + bool bIntroDone; + + EventMap events; + + void Initialize() { - case NPC_FALRIC: - uiFalric = pCreature->GetGUID(); - break; - case NPC_MARWYN: - uiMarwyn = pCreature->GetGUID(); - break; - case NPC_LICH_KING_EVENT: - uiLichKingEvent = pCreature->GetGUID(); - break; - case NPC_JAINA_PART1: - uiJainaPart1 = pCreature->GetGUID(); - break; - case NPC_SYLVANAS_PART1: - uiSylvanasPart1 = pCreature->GetGUID(); - break; - } - } + events.Reset(); - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if (!add) - return; + uiFalric = 0; + uiMarwyn = 0; + uiLichKingEvent = 0; + uiJainaPart1 = 0; + uiSylvanasPart1 = 0; - // TODO: init state depending on encounters - switch(pGo->GetEntry()) - { - case GO_FROSTMOURNE: - uiFrostmourne = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, false, pGo); - break; - case GO_FROSTMOURNE_ALTAR: - uiFrostmourneAltar = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, true, pGo); - break; - case GO_FRONT_DOOR: - uiFrontDoor = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - HandleGameObject(0, true, pGo); - break; - case GO_ARTHAS_DOOR: - uiArthasDoor = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - - if (uiEncounter[1] == DONE) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - if (type == DATA_WAVE_COUNT && data == SPECIAL) - { - bIntroDone = true; - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); - return; - } - - - if (uiWaveCount && data == NOT_STARTED) - DoWipe(); - - switch(type) - { - case DATA_FALRIC_EVENT: - uiEncounter[0] = data; - if (data == DONE) - events.ScheduleEvent(EVENT_NEXT_WAVE, 60000); - break; - case DATA_MARWYN_EVENT: - uiEncounter[1] = data; - if (data == DONE) - HandleGameObject(uiArthasDoor, true); - break; - case DATA_LICHKING_EVENT: - uiEncounter[2] = data; - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_FALRIC_EVENT: return uiEncounter[0]; - case DATA_MARWYN_EVENT: return uiEncounter[1]; - case DATA_LICHKING_EVENT: return uiEncounter[2]; - case DATA_WAVE_COUNT: return uiWaveCount; - case DATA_TEAM_IN_INSTANCE: return uiTeamInInstance; - } - - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_FALRIC: return uiFalric; - case DATA_MARWYN: return uiMarwyn; - case DATA_LICHKING: return uiLichKingEvent; - case DATA_FROSTMOURNE: return uiFrostmourne; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H R 1 " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 version; - uint16 data0, data1, data2; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2; - - if (dataHead1 == 'H' && dataHead2 == 'R') - { - uiEncounter[0] = data0; - uiEncounter[1] = data1; - uiEncounter[2] = data2; + uiFrostmourne = 0; + uiFrostmourneAltar = 0; + uiArthasDoor = 0; + uiFrontDoor = 0; + uiTeamInInstance = 0; + uiWaveCount = 0; + bIntroDone = false; for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (uiEncounter[i] == IN_PROGRESS) - uiEncounter[i] = NOT_STARTED; - - } else OUT_LOAD_INST_DATA_FAIL; - - if (uiEncounter[0] == DONE || uiEncounter[1] == DONE) - bIntroDone = true; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - void AddWave() - { - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); - - switch(uiWaveCount) - { - case 1: - case 2: - case 3: - case 4: - if (Creature *pFalric = instance->GetCreature(uiFalric)) - SpawnWave(pFalric); - break; - case 5: - if (GetData(DATA_FALRIC_EVENT) == DONE) - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); - else if (Creature *pFalric = instance->GetCreature(uiFalric)) - if (pFalric->AI()) - pFalric->AI()->DoAction(ACTION_ENTER_COMBAT); - break; - case 6: - case 7: - case 8: - case 9: - if (Creature *pMarwyn = instance->GetCreature(uiMarwyn)) - SpawnWave(pMarwyn); - break; - case 10: - if (GetData(DATA_MARWYN_EVENT) != DONE) // wave should not have been started if DONE. Check anyway to avoid bug exploit! - if (Creature *pMarwyn = instance->GetCreature(uiMarwyn)) - if (pMarwyn->AI()) - pMarwyn->AI()->DoAction(ACTION_ENTER_COMBAT); - break; + uiEncounter[i] = NOT_STARTED; } - } - // Wipe has been detected. Perform cleanup and reset. - void DoWipe() - { - uiWaveCount = 0; - events.Reset(); - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); - HandleGameObject(uiFrontDoor, true); - - // TODO - // in case of wipe, the event is normally restarted by jumping into the center of the room. - // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted. - if (Creature* pJaina = instance->GetCreature(uiJainaPart1)) - pJaina->Respawn(); - if (Creature* pSylvanas = instance->GetCreature(uiSylvanasPart1)) - pSylvanas->Respawn(); - - if (Creature* pFalric = instance->GetCreature(uiFalric)) - pFalric->SetVisibility(VISIBILITY_OFF); - if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) - pMarwyn->SetVisibility(VISIBILITY_OFF); - } - - // spawn a wave on behalf of the summoner. - void SpawnWave(Creature *pSummoner) - { - uint32 index; - - pSummoner->SetVisibility(VISIBILITY_ON); - - // TODO: do composition at random. # of spawn also depends on uiWaveCount - // As of now, it is just one of each. - index = urand(0,ENCOUNTER_WAVE_MERCENARY-1); - pSummoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - - index = urand(0,ENCOUNTER_WAVE_FOOTMAN-1); - pSummoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - - index = urand(0,ENCOUNTER_WAVE_RIFLEMAN-1); - pSummoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - - index = urand(0,ENCOUNTER_WAVE_PRIEST-1); - pSummoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - - index = urand(0,ENCOUNTER_WAVE_MAGE-1); - pSummoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); - } - - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; - - events.Update(diff); - - switch(uint32 eventId = events.ExecuteEvent()) + void OnCreatureCreate(Creature* pCreature, bool add) { - case EVENT_NEXT_WAVE: - uiWaveCount++; - AddWave(); - break; - case EVENT_START_LICH_KING: - // TODO - break; + if (!add) + return; + + Map::PlayerList const &players = instance->GetPlayers(); + if (!players.isEmpty()) + if (Player* pPlayer = players.begin()->getSource()) + uiTeamInInstance = pPlayer->GetTeam(); + + switch(pCreature->GetEntry()) + { + case NPC_FALRIC: + uiFalric = pCreature->GetGUID(); + break; + case NPC_MARWYN: + uiMarwyn = pCreature->GetGUID(); + break; + case NPC_LICH_KING_EVENT: + uiLichKingEvent = pCreature->GetGUID(); + break; + case NPC_JAINA_PART1: + uiJainaPart1 = pCreature->GetGUID(); + break; + case NPC_SYLVANAS_PART1: + uiSylvanasPart1 = pCreature->GetGUID(); + break; + } } - } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + if (!add) + return; + + // TODO: init state depending on encounters + switch(pGo->GetEntry()) + { + case GO_FROSTMOURNE: + uiFrostmourne = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, false, pGo); + break; + case GO_FROSTMOURNE_ALTAR: + uiFrostmourneAltar = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, true, pGo); + break; + case GO_FRONT_DOOR: + uiFrontDoor = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + HandleGameObject(0, true, pGo); + break; + case GO_ARTHAS_DOOR: + uiArthasDoor = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + + if (uiEncounter[1] == DONE) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + if (type == DATA_WAVE_COUNT && data == SPECIAL) + { + bIntroDone = true; + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + return; + } + + + if (uiWaveCount && data == NOT_STARTED) + DoWipe(); + + switch(type) + { + case DATA_FALRIC_EVENT: + uiEncounter[0] = data; + if (data == DONE) + events.ScheduleEvent(EVENT_NEXT_WAVE, 60000); + break; + case DATA_MARWYN_EVENT: + uiEncounter[1] = data; + if (data == DONE) + HandleGameObject(uiArthasDoor, true); + break; + case DATA_LICHKING_EVENT: + uiEncounter[2] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_FALRIC_EVENT: return uiEncounter[0]; + case DATA_MARWYN_EVENT: return uiEncounter[1]; + case DATA_LICHKING_EVENT: return uiEncounter[2]; + case DATA_WAVE_COUNT: return uiWaveCount; + case DATA_TEAM_IN_INSTANCE: return uiTeamInInstance; + } + + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_FALRIC: return uiFalric; + case DATA_MARWYN: return uiMarwyn; + case DATA_LICHKING: return uiLichKingEvent; + case DATA_FROSTMOURNE: return uiFrostmourne; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "H R 1 " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 version; + uint16 data0, data1, data2; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> version >> data0 >> data1 >> data2; + + if (dataHead1 == 'H' && dataHead2 == 'R') + { + uiEncounter[0] = data0; + uiEncounter[1] = data1; + uiEncounter[2] = data2; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + if (uiEncounter[0] == DONE || uiEncounter[1] == DONE) + bIntroDone = true; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + void AddWave() + { + DoUpdateWorldState(WORLD_STATE_HOR, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); + + switch(uiWaveCount) + { + case 1: + case 2: + case 3: + case 4: + if (Creature *pFalric = instance->GetCreature(uiFalric)) + SpawnWave(pFalric); + break; + case 5: + if (GetData(DATA_FALRIC_EVENT) == DONE) + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + else if (Creature *pFalric = instance->GetCreature(uiFalric)) + if (pFalric->AI()) + pFalric->AI()->DoAction(ACTION_ENTER_COMBAT); + break; + case 6: + case 7: + case 8: + case 9: + if (Creature *pMarwyn = instance->GetCreature(uiMarwyn)) + SpawnWave(pMarwyn); + break; + case 10: + if (GetData(DATA_MARWYN_EVENT) != DONE) // wave should not have been started if DONE. Check anyway to avoid bug exploit! + if (Creature *pMarwyn = instance->GetCreature(uiMarwyn)) + if (pMarwyn->AI()) + pMarwyn->AI()->DoAction(ACTION_ENTER_COMBAT); + break; + } + } + + // Wipe has been detected. Perform cleanup and reset. + void DoWipe() + { + uiWaveCount = 0; + events.Reset(); + DoUpdateWorldState(WORLD_STATE_HOR, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, uiWaveCount); + HandleGameObject(uiFrontDoor, true); + + // TODO + // in case of wipe, the event is normally restarted by jumping into the center of the room. + // As I can't find a trigger area there, just respawn Jaina/Sylvanas so the event may be restarted. + if (Creature* pJaina = instance->GetCreature(uiJainaPart1)) + pJaina->Respawn(); + if (Creature* pSylvanas = instance->GetCreature(uiSylvanasPart1)) + pSylvanas->Respawn(); + + if (Creature* pFalric = instance->GetCreature(uiFalric)) + pFalric->SetVisibility(VISIBILITY_OFF); + if (Creature* pMarwyn = instance->GetCreature(uiMarwyn)) + pMarwyn->SetVisibility(VISIBILITY_OFF); + } + + // spawn a wave on behalf of the summoner. + void SpawnWave(Creature *pSummoner) + { + uint32 index; + + pSummoner->SetVisibility(VISIBILITY_ON); + + // TODO: do composition at random. # of spawn also depends on uiWaveCount + // As of now, it is just one of each. + index = urand(0,ENCOUNTER_WAVE_MERCENARY-1); + pSummoner->SummonCreature(NPC_WAVE_MERCENARY, MercenarySpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + index = urand(0,ENCOUNTER_WAVE_FOOTMAN-1); + pSummoner->SummonCreature(NPC_WAVE_FOOTMAN, FootmenSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + index = urand(0,ENCOUNTER_WAVE_RIFLEMAN-1); + pSummoner->SummonCreature(NPC_WAVE_RIFLEMAN, RiflemanSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + index = urand(0,ENCOUNTER_WAVE_PRIEST-1); + pSummoner->SummonCreature(NPC_WAVE_PRIEST, PriestSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + + index = urand(0,ENCOUNTER_WAVE_MAGE-1); + pSummoner->SummonCreature(NPC_WAVE_MAGE, MageSpawnPos[index], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0); + } + + void Update(uint32 diff) + { + if (!instance->HavePlayers()) + return; + + events.Update(diff); + + switch(uint32 eventId = events.ExecuteEvent()) + { + case EVENT_NEXT_WAVE: + uiWaveCount++; + AddWave(); + break; + case EVENT_START_LICH_KING: + // TODO + break; + } + } + }; + }; -InstanceData* GetInstanceData_instance_halls_of_reflection(Map* pMap) -{ - return new instance_halls_of_reflection(pMap); -} void AddSC_instance_halls_of_reflection() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_reflection"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_reflection; - newscript->RegisterSelf(); + new instance_halls_of_reflection(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index e854c767f63..3f9c5158038 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -61,150 +61,153 @@ enum eEnums EQUIP_ID_MACE = 49344, ACHIEV_DOESNT_GO_TO_ELEVEN = 4524, }; - -struct boss_garfrostAI : public ScriptedAI + class boss_garfrost : public CreatureScript { - boss_garfrostAI(Creature *c) : ScriptedAI(c) +public: + boss_garfrost() : CreatureScript("boss_garfrost") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_garfrostAI (pCreature); } - bool phase2; - bool phase3; - bool bAchievement; - - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_garfrostAI : public ScriptedAI { - events.Reset(); - - phase2 = false; - phase3 = false; - bAchievement = true; - - if (pInstance) - pInstance->SetData(DATA_GARFROST_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_PERMAFROST); - - if (pInstance) - pInstance->SetData(DATA_GARFROST_EVENT, IN_PROGRESS); - - events.ScheduleEvent(EVENT_THROW_SARONITE, 45000); - } - - void DamageTaken(Unit* /*pDoneBy*/, uint32& /*uiDamage*/) - { - if (HealthBelowPct(66) && !phase2) + boss_garfrostAI(Creature *c) : ScriptedAI(c) { - phase2 = true; - DoCast(me, SPELL_THUNDERING_STOMP); - // TODO: should go to a forge - DoCast(me, SPELL_FORGE_BLADE); - // TODO: should equip when spell completes - SetEquipmentSlots(false, EQUIP_ID_SWORD, -1, -1); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - events.ScheduleEvent(EVENT_CHILLINGWAVE, 10000); + pInstance = c->GetInstanceScript(); } - if (HealthBelowPct(33) && !phase3) + bool phase2; + bool phase3; + bool bAchievement; + + InstanceScript* pInstance; + EventMap events; + + void Reset() { - phase3 = true; - DoCast(me, SPELL_THUNDERING_STOMP); - // TODO: should go to a forge - DoCast(me, SPELL_FORGE_MACE); - // TODO: should equip when spell completes - SetEquipmentSlots(false, EQUIP_ID_MACE, -1, -1); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - events.CancelEvent(EVENT_CHILLINGWAVE); // cast only in phase 2. - events.ScheduleEvent(EVENT_DEEPFREEZE, 10000); + events.Reset(); + + phase2 = false; + phase3 = false; + bAchievement = true; + + if (pInstance) + pInstance->SetData(DATA_GARFROST_EVENT, NOT_STARTED); } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) + void EnterCombat(Unit* /*who*/) { - if (Creature *pTyrannus = me->GetCreature(*me, pInstance->GetData64(DATA_TYRANNUS))) - DoScriptText(SAY_TYRANNUS_DEATH, pTyrannus); + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_PERMAFROST); - pInstance->SetData(DATA_GARFROST_EVENT, DONE); - if (IsHeroic() && bAchievement) - pInstance->DoCompleteAchievement(ACHIEV_DOESNT_GO_TO_ELEVEN); + if (pInstance) + pInstance->SetData(DATA_GARFROST_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_THROW_SARONITE, 45000); } - } - void SpellHitTarget(Unit* pTarget, const SpellEntry *spell) - { - if (spell->Id == SPELL_PERMAFROST_TRIGGER && bAchievement) + void DamageTaken(Unit* /*pDoneBy*/, uint32& /*uiDamage*/) { - if (Aura *pAura = pTarget->GetAura(SPELL_PERMAFROST_TRIGGER)) - if (pAura->GetStackAmount() > 10) - bAchievement = false; - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + if (HealthBelowPct(66) && !phase2) { - case EVENT_THROW_SARONITE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_THROW_SARONITE); - events.RescheduleEvent(EVENT_THROW_SARONITE, 35000); - return; - case EVENT_DEEPFREEZE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_DEEP_FREEZE); - events.RescheduleEvent(EVENT_DEEPFREEZE, 35000); - return; - case EVENT_CHILLINGWAVE: - DoCastAOE(SPELL_CHILLING_WAVE); - events.RescheduleEvent(EVENT_CHILLINGWAVE, 40000); - return; + phase2 = true; + DoCast(me, SPELL_THUNDERING_STOMP); + // TODO: should go to a forge + DoCast(me, SPELL_FORGE_BLADE); + // TODO: should equip when spell completes + SetEquipmentSlots(false, EQUIP_ID_SWORD, -1, -1); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + events.ScheduleEvent(EVENT_CHILLINGWAVE, 10000); + } + + if (HealthBelowPct(33) && !phase3) + { + phase3 = true; + DoCast(me, SPELL_THUNDERING_STOMP); + // TODO: should go to a forge + DoCast(me, SPELL_FORGE_MACE); + // TODO: should equip when spell completes + SetEquipmentSlots(false, EQUIP_ID_MACE, -1, -1); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + events.CancelEvent(EVENT_CHILLINGWAVE); // cast only in phase 2. + events.ScheduleEvent(EVENT_DEEPFREEZE, 10000); } } - DoMeleeAttackIfReady(); - } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + if (pInstance) + { + if (Creature *pTyrannus = me->GetCreature(*me, pInstance->GetData64(DATA_TYRANNUS))) + DoScriptText(SAY_TYRANNUS_DEATH, pTyrannus); + + pInstance->SetData(DATA_GARFROST_EVENT, DONE); + if (IsHeroic() && bAchievement) + pInstance->DoCompleteAchievement(ACHIEV_DOESNT_GO_TO_ELEVEN); + } + } + + void SpellHitTarget(Unit* pTarget, const SpellEntry *spell) + { + if (spell->Id == SPELL_PERMAFROST_TRIGGER && bAchievement) + { + if (Aura *pAura = pTarget->GetAura(SPELL_PERMAFROST_TRIGGER)) + if (pAura->GetStackAmount() > 10) + bAchievement = false; + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_THROW_SARONITE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_THROW_SARONITE); + events.RescheduleEvent(EVENT_THROW_SARONITE, 35000); + return; + case EVENT_DEEPFREEZE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_DEEP_FREEZE); + events.RescheduleEvent(EVENT_DEEPFREEZE, 35000); + return; + case EVENT_CHILLINGWAVE: + DoCastAOE(SPELL_CHILLING_WAVE); + events.RescheduleEvent(EVENT_CHILLINGWAVE, 40000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_garfrost(Creature* pCreature) -{ - return new boss_garfrostAI (pCreature); -} void AddSC_boss_garfrost() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_garfrost"; - newscript->GetAI = &GetAI_boss_garfrost; - newscript->RegisterSelf(); + new boss_garfrost(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 961451051a7..8a1e6b5de37 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -118,366 +118,372 @@ enum Misc // Krick is the Gnome. // Ick is the Mount // Common Events are handled/triggered by Ick that "drive" Krick through DoAction. - -struct boss_ickAI : public ScriptedAI + class boss_ick : public CreatureScript { - boss_ickAI(Creature *c) : ScriptedAI(c) +public: + boss_ick() : CreatureScript("boss_ick") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ickAI(pCreature); } - ScriptedInstance* pInstance; - - EventMap events; - - void Reset() + struct boss_ickAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, NOT_STARTED); - } - - Creature* GetKrick() - { - return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_KRICK) : 0); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, IN_PROGRESS); - - Creature* pKrick = GetKrick(); - if (!pKrick) - pKrick = me->SummonCreature(CREATURE_KRICK, *me, TEMPSUMMON_MANUAL_DESPAWN); - - if (pKrick) - DoScriptText(SAY_KRICK_AGGRO, pKrick); - - events.ScheduleEvent(EVENT_MIGHTY_KICK, 20000, GCD_1); - events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); - events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); - events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 35000); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); - } - - void EnterEvadeMode() - { - me->GetMotionMaster()->Clear(); - ScriptedAI::EnterEvadeMode(); - } - - void JustDied(Unit* /*pKiller*/) - { - if (Creature* pKrick = GetKrick()) + boss_ickAI(Creature *c) : ScriptedAI(c) { - if (pKrick->AI()) - pKrick->AI()->DoAction(ACTION_OUTRO); + pInstance = c->GetInstanceScript(); } - if (pInstance) - pInstance->SetData(DATA_KRICKANDICK_EVENT, DONE); - } + InstanceScript* pInstance; - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - return; + EventMap events; - if (!me->getVictim() && me->getThreatManager().isThreatListEmpty()) + void Reset() { - EnterEvadeMode(); - return; + events.Reset(); + + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, NOT_STARTED); } - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - switch(events.ExecuteEvent()) + Creature* GetKrick() { - case EVENT_PURSUE: - if (Creature* pKrick = GetKrick()) - DoScriptText(RAND(SAY_KRICK_CHASE_1,SAY_KRICK_CHASE_2,SAY_KRICK_CHASE_3), pKrick); - - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - me->Attack(pTarget,false); - DoScriptText(SAY_ICK_CHASE_1, me, pTarget); - DoCast(pTarget, SPELL_PURSUED); - } - - DoCast(SPELL_CONFUSION); - events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); - return; - - case EVENT_MIGHTY_KICK: - DoCast(me->getVictim(), SPELL_MIGHTY_KICK); - events.ScheduleEvent(EVENT_MIGHTY_KICK, 25000, GCD_1); - return; - - case EVENT_POISON_NOVA: - if (Creature* pKrick = GetKrick()) - DoScriptText(SAY_KRICK_POISON_NOVA, pKrick); - - DoScriptText(SAY_ICK_POISON_NOVA, me); - DoCastAOE(SPELL_POISON_NOVA); - events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); - return; - - case EVENT_TOXIC_WASTE: - DoCast(me->getVictim(), SPELL_TOXIC_WASTE); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); - return; - - case EVENT_SHADOW_BOLT: - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); - return; - - case EVENT_EXPLOSIVE_BARRAGE: - if (Creature *pKrick = GetKrick()) - { - DoScriptText(SAY_KRICK_BARRAGE_1, pKrick); - DoScriptText(SAY_KRICK_BARRAGE_2, pKrick); - } - - DoCastAOE(SPELL_EXPLOSIVE_BARRAGE); - me->GetMotionMaster()->MoveIdle(); - events.DelayEvents(20000, GCD_1); // 2 sec cast + 18 sec - events.ScheduleEvent(EVENT_END_EXPLOSIVE_BARRAGE, 20000); - return; - - case EVENT_END_EXPLOSIVE_BARRAGE: - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 25000); - break; + return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_KRICK) : 0); } - DoMeleeAttackIfReady(); - } -}; - -struct boss_krickAI : public ScriptedAI -{ - boss_krickAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - EventMap events; - - KrickPhase phase; - uint64 uiNpcOutroDialog; - uint64 uiTyrannus; - - void Reset() - { - uiNpcOutroDialog = 0; - uiTyrannus = 0; - phase = PHASE_COMBAT; - - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_OFF); - } - - Creature* GetIck() - { - return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ICK) : 0); - } - - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - - DoScriptText(RAND(SAY_KRICK_SLAY_1,SAY_KRICK_SLAY_2), me); - } - - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) - { - // if killed whatever the reason, it breaks the outro - uiDamage = 0; - } - - void DoAction(const int32 actionId) - { - switch(actionId) + void EnterCombat(Unit * /*who*/) { - case ACTION_OUTRO: + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, IN_PROGRESS); + + Creature* pKrick = GetKrick(); + if (!pKrick) + pKrick = me->SummonCreature(CREATURE_KRICK, *me, TEMPSUMMON_MANUAL_DESPAWN); + + if (pKrick) + DoScriptText(SAY_KRICK_AGGRO, pKrick); + + events.ScheduleEvent(EVENT_MIGHTY_KICK, 20000, GCD_1); + events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); + events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); + events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 35000); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); + } + + void EnterEvadeMode() + { + me->GetMotionMaster()->Clear(); + ScriptedAI::EnterEvadeMode(); + } + + void JustDied(Unit* /*pKiller*/) + { + if (Creature* pKrick = GetKrick()) { - Position pos; - if (Creature* pIck = GetIck()) - { - // TODO: tele on Ick then run some distance. - pIck->GetNearPosition(pos, 5.0f, 3.14); - me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0.0f); - } - me->SetVisibility(VISIBILITY_ON); - - Creature* pJainaOrSylvanas = me->GetCreature(*me, pInstance->GetData64(DATA_JAINA_SYLVANAS_1)); - if (pJainaOrSylvanas) { - Position pos; - me->GetNearPosition(pos, 5.0f, 0); - pJainaOrSylvanas->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), - pos.GetAngle(me->GetPositionX(), me->GetPositionY())); - } - else { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - pJainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); - else - pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); - } - - if (pJainaOrSylvanas) - { - pJainaOrSylvanas->SetOrientation(pJainaOrSylvanas->GetAngle(me->GetPositionX(), me->GetPositionY())); - me->SetOrientation(me->GetAngle(pJainaOrSylvanas->GetPositionX(), pJainaOrSylvanas->GetPositionY())); - uiNpcOutroDialog = pJainaOrSylvanas->GetGUID(); - } - - phase = PHASE_OUTRO; - events.Reset(); - events.ScheduleEvent(EVENT_OUTRO_1, 1000); - break; + if (pKrick->AI()) + pKrick->AI()->DoAction(ACTION_OUTRO); } - } - } - void UpdateAI(const uint32 diff) - { - if (phase == PHASE_OUTRO) + if (pInstance) + pInstance->SetData(DATA_KRICKANDICK_EVENT, DONE); + } + + void UpdateAI(const uint32 diff) { - if (!pInstance) + if (!me->isInCombat()) return; + if (!me->getVictim() && me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return; + } + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + switch(events.ExecuteEvent()) { - case EVENT_OUTRO_1: - { - DoScriptText(SAY_KRICK_OUTRO_1, me); - events.ScheduleEvent(EVENT_OUTRO_2, 14000); - break; - } - case EVENT_OUTRO_2: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) - { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_2, pNpcDialog); - else - DoScriptText(SAY_SYLVANAS_OUTRO_2, pNpcDialog); - } - events.ScheduleEvent(EVENT_OUTRO_3, 8500); - break; - } - case EVENT_OUTRO_3: - DoScriptText(SAY_KRICK_OUTRO_3, me); - events.ScheduleEvent(EVENT_OUTRO_4, 12000); - break; - case EVENT_OUTRO_4: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) - { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_4, pNpcDialog); - else - DoScriptText(SAY_SYLVANAS_OUTRO_4, pNpcDialog); - } - events.ScheduleEvent(EVENT_OUTRO_5, 8000); - break; - } - case EVENT_OUTRO_5: - DoScriptText(SAY_KRICK_OUTRO_5, me); - events.ScheduleEvent(EVENT_OUTRO_6, 4000); - break; - case EVENT_OUTRO_6: - // TODO spawn Tyrannus at some distance and MovePoint near-by (flying on rimefang) - // store uiTyrannus - // Adjust timer so tyrannus has time to come - uiTyrannus = (pInstance ? pInstance->GetData64(DATA_TYRANNUS) : 0); - events.ScheduleEvent(EVENT_OUTRO_7, 1); - break; - case EVENT_OUTRO_7: - if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) - DoScriptText(SAY_TYRANNUS_OUTRO_7, pTyrannus); - events.ScheduleEvent(EVENT_OUTRO_8, 7000); - break; - case EVENT_OUTRO_8: - DoScriptText(SAY_KRICK_OUTRO_8, me); - // TODO: Tyrannus starts killing Krick. - // there shall be some visual spell effect - events.ScheduleEvent(EVENT_OUTRO_9, 6000); - break; - case EVENT_OUTRO_9: - // tyrannus kills krick - me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetHealth(0); + case EVENT_PURSUE: + if (Creature* pKrick = GetKrick()) + DoScriptText(RAND(SAY_KRICK_CHASE_1,SAY_KRICK_CHASE_2,SAY_KRICK_CHASE_3), pKrick); - if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) - DoScriptText(SAY_TYRANNUS_OUTRO_9, pTyrannus); - - events.ScheduleEvent(EVENT_OUTRO_10, 12000); - break; - case EVENT_OUTRO_10: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) - DoScriptText(SAY_JAYNA_OUTRO_10, pNpcDialog); - else - DoScriptText(SAY_SYLVANAS_OUTRO_10, pNpcDialog); + me->Attack(pTarget,false); + DoScriptText(SAY_ICK_CHASE_1, me, pTarget); + DoCast(pTarget, SPELL_PURSUED); } - // End of OUTRO. for now... - events.ScheduleEvent(EVENT_OUTRO_END, 8000); - break; - } - case EVENT_OUTRO_END: - { - Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); - if (pNpcDialog) - pNpcDialog->DisappearAndDie(); + DoCast(SPELL_CONFUSION); + events.ScheduleEvent(EVENT_PURSUE, 30000, GCD_1); + return; - me->DisappearAndDie(); + case EVENT_MIGHTY_KICK: + DoCast(me->getVictim(), SPELL_MIGHTY_KICK); + events.ScheduleEvent(EVENT_MIGHTY_KICK, 25000, GCD_1); + return; + + case EVENT_POISON_NOVA: + if (Creature* pKrick = GetKrick()) + DoScriptText(SAY_KRICK_POISON_NOVA, pKrick); + + DoScriptText(SAY_ICK_POISON_NOVA, me); + DoCastAOE(SPELL_POISON_NOVA); + events.ScheduleEvent(EVENT_POISON_NOVA, 30000, GCD_1); + return; + + case EVENT_TOXIC_WASTE: + DoCast(me->getVictim(), SPELL_TOXIC_WASTE); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 5000); + return; + + case EVENT_SHADOW_BOLT: + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + events.ScheduleEvent(EVENT_SHADOW_BOLT, 15000); + return; + + case EVENT_EXPLOSIVE_BARRAGE: + if (Creature *pKrick = GetKrick()) + { + DoScriptText(SAY_KRICK_BARRAGE_1, pKrick); + DoScriptText(SAY_KRICK_BARRAGE_2, pKrick); + } + + DoCastAOE(SPELL_EXPLOSIVE_BARRAGE); + me->GetMotionMaster()->MoveIdle(); + events.DelayEvents(20000, GCD_1); // 2 sec cast + 18 sec + events.ScheduleEvent(EVENT_END_EXPLOSIVE_BARRAGE, 20000); + return; + + case EVENT_END_EXPLOSIVE_BARRAGE: + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + events.ScheduleEvent(EVENT_EXPLOSIVE_BARRAGE, 25000); + break; + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_krick : public CreatureScript +{ +public: + boss_krick() : CreatureScript("boss_krick") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_krickAI(pCreature); + } + + struct boss_krickAI : public ScriptedAI + { + boss_krickAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + + KrickPhase phase; + uint64 uiNpcOutroDialog; + uint64 uiTyrannus; + + void Reset() + { + uiNpcOutroDialog = 0; + uiTyrannus = 0; + phase = PHASE_COMBAT; + + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_OFF); + } + + Creature* GetIck() + { + return me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ICK) : 0); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_KRICK_SLAY_1,SAY_KRICK_SLAY_2), me); + } + + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + { + // if killed whatever the reason, it breaks the outro + uiDamage = 0; + } + + void DoAction(const int32 actionId) + { + switch(actionId) + { + case ACTION_OUTRO: + { + Position pos; + if (Creature* pIck = GetIck()) + { + // TODO: tele on Ick then run some distance. + pIck->GetNearPosition(pos, 5.0f, 3.14); + me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0.0f); + } + me->SetVisibility(VISIBILITY_ON); + + Creature* pJainaOrSylvanas = me->GetCreature(*me, pInstance->GetData64(DATA_JAINA_SYLVANAS_1)); + if (pJainaOrSylvanas) { + Position pos; + me->GetNearPosition(pos, 5.0f, 0); + pJainaOrSylvanas->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), + pos.GetAngle(me->GetPositionX(), me->GetPositionY())); + } + else { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + pJainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); + else + pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN); + } + + if (pJainaOrSylvanas) + { + pJainaOrSylvanas->SetOrientation(pJainaOrSylvanas->GetAngle(me->GetPositionX(), me->GetPositionY())); + me->SetOrientation(me->GetAngle(pJainaOrSylvanas->GetPositionX(), pJainaOrSylvanas->GetPositionY())); + uiNpcOutroDialog = pJainaOrSylvanas->GetGUID(); + } + + phase = PHASE_OUTRO; + events.Reset(); + events.ScheduleEvent(EVENT_OUTRO_1, 1000); break; } } - return; } - } + + void UpdateAI(const uint32 diff) + { + if (phase == PHASE_OUTRO) + { + if (!pInstance) + return; + + events.Update(diff); + switch(events.ExecuteEvent()) + { + case EVENT_OUTRO_1: + { + DoScriptText(SAY_KRICK_OUTRO_1, me); + events.ScheduleEvent(EVENT_OUTRO_2, 14000); + break; + } + case EVENT_OUTRO_2: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_2, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_2, pNpcDialog); + } + events.ScheduleEvent(EVENT_OUTRO_3, 8500); + break; + } + case EVENT_OUTRO_3: + DoScriptText(SAY_KRICK_OUTRO_3, me); + events.ScheduleEvent(EVENT_OUTRO_4, 12000); + break; + case EVENT_OUTRO_4: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_4, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_4, pNpcDialog); + } + events.ScheduleEvent(EVENT_OUTRO_5, 8000); + break; + } + case EVENT_OUTRO_5: + DoScriptText(SAY_KRICK_OUTRO_5, me); + events.ScheduleEvent(EVENT_OUTRO_6, 4000); + break; + case EVENT_OUTRO_6: + // TODO spawn Tyrannus at some distance and MovePoint near-by (flying on rimefang) + // store uiTyrannus + // Adjust timer so tyrannus has time to come + uiTyrannus = (pInstance ? pInstance->GetData64(DATA_TYRANNUS) : 0); + events.ScheduleEvent(EVENT_OUTRO_7, 1); + break; + case EVENT_OUTRO_7: + if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) + DoScriptText(SAY_TYRANNUS_OUTRO_7, pTyrannus); + events.ScheduleEvent(EVENT_OUTRO_8, 7000); + break; + case EVENT_OUTRO_8: + DoScriptText(SAY_KRICK_OUTRO_8, me); + // TODO: Tyrannus starts killing Krick. + // there shall be some visual spell effect + events.ScheduleEvent(EVENT_OUTRO_9, 6000); + break; + case EVENT_OUTRO_9: + // tyrannus kills krick + me->SetStandState(UNIT_STAND_STATE_DEAD); + me->SetHealth(0); + + if (Creature *pTyrannus = me->GetCreature(*me, uiTyrannus)) + DoScriptText(SAY_TYRANNUS_OUTRO_9, pTyrannus); + + events.ScheduleEvent(EVENT_OUTRO_10, 12000); + break; + case EVENT_OUTRO_10: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + { + if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE) + DoScriptText(SAY_JAYNA_OUTRO_10, pNpcDialog); + else + DoScriptText(SAY_SYLVANAS_OUTRO_10, pNpcDialog); + } + + // End of OUTRO. for now... + events.ScheduleEvent(EVENT_OUTRO_END, 8000); + break; + } + case EVENT_OUTRO_END: + { + Creature* pNpcDialog = me->GetCreature(*me, uiNpcOutroDialog); + if (pNpcDialog) + pNpcDialog->DisappearAndDie(); + + me->DisappearAndDie(); + break; + } + } + return; + } + } + }; + }; -CreatureAI* GetAI_boss_ick(Creature* pCreature) -{ - return new boss_ickAI(pCreature); -} -CreatureAI* GetAI_boss_krick(Creature* pCreature) -{ - return new boss_krickAI(pCreature); -} void AddSC_boss_ick() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ick"; - newscript->GetAI = &GetAI_boss_ick; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_krick"; - newscript->GetAI = &GetAI_boss_krick; - newscript->RegisterSelf(); + new boss_ick(); + new boss_krick(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 6f45c3ef76f..f08535ccc59 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -84,191 +84,197 @@ enum Misc { SEAT_TYRANNUS = 0 }; - -struct boss_tyrannusAI : public ScriptedAI + class boss_tyrannus : public CreatureScript { - boss_tyrannusAI(Creature *c) : ScriptedAI(c) +public: + boss_tyrannus() : CreatureScript("boss_tyrannus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_tyrannusAI(pCreature); } - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_tyrannusAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_TYRANNUS_EVENT, NOT_STARTED); - } - - Creature* GetRimefang() - { - return me->GetCreature(*me, pInstance->GetData64(DATA_RIMEFANG)); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - me->ExitVehicle(); - - // restore health if any damage done during intro - me->SetHealth(me->GetMaxHealth()); - - if (pInstance) - pInstance->SetData(DATA_TYRANNUS_EVENT, IN_PROGRESS); - - events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); - events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 35000); - events.ScheduleEvent(EVENT_DARK_MIGHT, 40000); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) + boss_tyrannusAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_TYRANNUS_EVENT, DONE); - if (Creature* pRimefang = GetRimefang()) - pRimefang->ForcedDespawn(); + pInstance = c->GetInstanceScript(); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; + EventMap events; - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) + events.Reset(); + + if (pInstance) + pInstance->SetData(DATA_TYRANNUS_EVENT, NOT_STARTED); + } + + Creature* GetRimefang() + { + return me->GetCreature(*me, pInstance->GetData64(DATA_RIMEFANG)); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + me->ExitVehicle(); + + // restore health if any damage done during intro + me->SetHealth(me->GetMaxHealth()); + + if (pInstance) + pInstance->SetData(DATA_TYRANNUS_EVENT, IN_PROGRESS); + + events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); + events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 35000); + events.ScheduleEvent(EVENT_DARK_MIGHT, 40000); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - case EVENT_FORCEFUL_SMASH: - DoCast(me->getVictim(), SPELL_FORCEFUL_SMASH); - events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); - return; - case EVENT_OVERLORDS_BRAND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_OVERLORDS_BRAND); - events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 45000); - return; - case EVENT_DARK_MIGHT: - DoScriptText(SAY_DARK_MIGHT_1, me); - DoScriptText(SAY_DARK_MIGHT_2, me); - DoCast(me, SPELL_DARK_MIGHT); - events.ScheduleEvent(EVENT_DARK_MIGHT, 60000); - return; + pInstance->SetData(DATA_TYRANNUS_EVENT, DONE); + if (Creature* pRimefang = GetRimefang()) + pRimefang->ForcedDespawn(); } } - DoMeleeAttackIfReady(); - } -}; - -struct boss_rimefangAI : public ScriptedAI -{ - boss_rimefangAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - EventMap events; - - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - me->InterruptSpell(CURRENT_GENERIC_SPELL); - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 25000); - events.ScheduleEvent(EVENT_ICY_BLAST, 35000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) - { - case EVENT_MARK_OF_RIMEFANG: - DoScriptText(SAY_MARK_RIMEFANG_1, me); - DoScriptText(SAY_MARK_RIMEFANG_2, me); + //Return since we have no target + if (!UpdateVictim()) + return; - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_MARK_OF_RIMEFANG); - events.ScheduleEvent(EVENT_HOARFROST, 5000); - return; - case EVENT_HOARFROST: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_HOARFROST); - events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 20000); - return; - case EVENT_ICY_BLAST: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ICY_BLAST); - events.ScheduleEvent(EVENT_ICY_BLAST_2, 5000); - return; - case EVENT_ICY_BLAST_2: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget->getVictim(), SPELL_ICY_BLAST_2); - events.ScheduleEvent(EVENT_ICY_BLAST, 30000); - return; + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FORCEFUL_SMASH: + DoCast(me->getVictim(), SPELL_FORCEFUL_SMASH); + events.ScheduleEvent(EVENT_FORCEFUL_SMASH, 10000); + return; + case EVENT_OVERLORDS_BRAND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_OVERLORDS_BRAND); + events.ScheduleEvent(EVENT_OVERLORDS_BRAND, 45000); + return; + case EVENT_DARK_MIGHT: + DoScriptText(SAY_DARK_MIGHT_1, me); + DoScriptText(SAY_DARK_MIGHT_2, me); + DoCast(me, SPELL_DARK_MIGHT); + events.ScheduleEvent(EVENT_DARK_MIGHT, 60000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_rimefang : public CreatureScript +{ +public: + boss_rimefang() : CreatureScript("boss_rimefang") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_rimefangAI(pCreature); + } + + struct boss_rimefangAI : public ScriptedAI + { + boss_rimefangAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + me->InterruptSpell(CURRENT_GENERIC_SPELL); + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 25000); + events.ScheduleEvent(EVENT_ICY_BLAST, 35000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_MARK_OF_RIMEFANG: + DoScriptText(SAY_MARK_RIMEFANG_1, me); + DoScriptText(SAY_MARK_RIMEFANG_2, me); + + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_MARK_OF_RIMEFANG); + events.ScheduleEvent(EVENT_HOARFROST, 5000); + return; + case EVENT_HOARFROST: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_HOARFROST); + events.ScheduleEvent(EVENT_MARK_OF_RIMEFANG, 20000); + return; + case EVENT_ICY_BLAST: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ICY_BLAST); + events.ScheduleEvent(EVENT_ICY_BLAST_2, 5000); + return; + case EVENT_ICY_BLAST_2: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget->getVictim(), SPELL_ICY_BLAST_2); + events.ScheduleEvent(EVENT_ICY_BLAST, 30000); + return; + } } } - } + }; + }; -CreatureAI* GetAI_boss_tyrannus(Creature* pCreature) -{ - return new boss_tyrannusAI(pCreature); -} -CreatureAI* GetAI_boss_rimefang(Creature* pCreature) -{ - return new boss_rimefangAI(pCreature); -} void AddSC_boss_tyrannus() { - Script *newscript; - newscript = new Script; - newscript->Name="boss_tyrannus"; - newscript->GetAI = &GetAI_boss_tyrannus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="boss_rimefang"; - newscript->GetAI = &GetAI_boss_rimefang; - newscript->RegisterSelf(); + new boss_tyrannus(); + new boss_rimefang(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 595b5d01228..97c23020056 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -25,213 +25,216 @@ 1- Krick and Ick 2- Scourgelord Tyrannus */ - -struct instance_pit_of_saron : public ScriptedInstance + class instance_pit_of_saron : public InstanceMapScript { - instance_pit_of_saron(Map* pMap) : ScriptedInstance(pMap) {}; +public: + instance_pit_of_saron() : InstanceMapScript("instance_pit_of_saron") { } - uint64 uiKrick; - uint64 uiIck; - uint64 uiGarfrost; - uint64 uiTyrannus; - uint64 uiRimefang; - - uint64 uiJainaOrSylvanas1; - uint64 uiJainaOrSylvanas2; - - uint32 uiTeamInInstance; - uint32 uiEncounter[MAX_ENCOUNTER]; - - void Initialize() - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - uiEncounter[i] = NOT_STARTED; - - uiGarfrost = 0; - uiKrick = 0; - uiIck = 0; - uiTyrannus = 0; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_pit_of_saron_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_pit_of_saron_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (uiEncounter[i] == IN_PROGRESS) - return true; + instance_pit_of_saron_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {}; - return false; - } + uint64 uiKrick; + uint64 uiIck; + uint64 uiGarfrost; + uint64 uiTyrannus; + uint64 uiRimefang; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - Map::PlayerList const &players = instance->GetPlayers(); + uint64 uiJainaOrSylvanas1; + uint64 uiJainaOrSylvanas2; - if (!players.isEmpty()) - { - if (Player* pPlayer = players.begin()->getSource()) - uiTeamInInstance = pPlayer->GetTeam(); + uint32 uiTeamInInstance; + uint32 uiEncounter[MAX_ENCOUNTER]; + + void Initialize() + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + uiEncounter[i] = NOT_STARTED; + + uiGarfrost = 0; + uiKrick = 0; + uiIck = 0; + uiTyrannus = 0; } - switch(pCreature->GetEntry()) + bool IsEncounterInProgress() const { - case CREATURE_KRICK: - uiKrick = pCreature->GetGUID(); - break; - - case CREATURE_ICK: - uiIck = pCreature->GetGUID(); - break; - - case CREATURE_GARFROST: - uiGarfrost = pCreature->GetGUID(); - break; - - case CREATURE_TYRANNUS: - uiTyrannus = pCreature->GetGUID(); - break; - - case CREATURE_RIMEFANG: - uiRimefang = pCreature->GetGUID(); - break; - - case NPC_SYLVANAS_PART1: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_JAINA_PART1, ALLIANCE); - uiJainaOrSylvanas1 = pCreature->GetGUID(); - break; - case NPC_SYLVANAS_PART2: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_JAINA_PART2, ALLIANCE); - uiJainaOrSylvanas2 = pCreature->GetGUID(); - break; - case NPC_KILARA: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_ELANDRA, ALLIANCE); - break; - case NPC_KORALEN: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_KORLAEN, ALLIANCE); - break; - case NPC_CHAMPION_1_HORDE: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_1_ALLIANCE, ALLIANCE); - break; - case NPC_CHAMPION_2_HORDE: - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); - break; - case NPC_CHAMPION_3_HORDE: // No 3rd set for Alliance? - if (uiTeamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); - break; - } - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_GARFROST: return uiGarfrost; - case DATA_KRICK: return uiKrick; - case DATA_ICK: return uiIck; - case DATA_TYRANNUS: return uiTyrannus; - case DATA_RIMEFANG: return uiRimefang; - - case DATA_JAINA_SYLVANAS_1: return uiJainaOrSylvanas1; - case DATA_JAINA_SYLVANAS_2: return uiJainaOrSylvanas2; - } - - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_GARFROST_EVENT: - uiEncounter[0] = data; - break; - case DATA_TYRANNUS_EVENT: - uiEncounter[1] = data; - break; - case DATA_KRICKANDICK_EVENT: - uiEncounter[2] = data; - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_GARFROST_EVENT: return uiEncounter[0]; - case DATA_TYRANNUS_EVENT: return uiEncounter[1]; - case DATA_KRICKANDICK_EVENT: return uiEncounter[2]; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "P S " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; - - if (dataHead1 == 'P' && dataHead2 == 'S') - { - uiEncounter[0] = data0; - uiEncounter[1] = data1; - uiEncounter[2] = data2; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (uiEncounter[i] == IN_PROGRESS) - uiEncounter[i] = NOT_STARTED; + return true; - } else OUT_LOAD_INST_DATA_FAIL; + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + Map::PlayerList const &players = instance->GetPlayers(); + + if (!players.isEmpty()) + { + if (Player* pPlayer = players.begin()->getSource()) + uiTeamInInstance = pPlayer->GetTeam(); + } + + switch(pCreature->GetEntry()) + { + case CREATURE_KRICK: + uiKrick = pCreature->GetGUID(); + break; + + case CREATURE_ICK: + uiIck = pCreature->GetGUID(); + break; + + case CREATURE_GARFROST: + uiGarfrost = pCreature->GetGUID(); + break; + + case CREATURE_TYRANNUS: + uiTyrannus = pCreature->GetGUID(); + break; + + case CREATURE_RIMEFANG: + uiRimefang = pCreature->GetGUID(); + break; + + case NPC_SYLVANAS_PART1: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_JAINA_PART1, ALLIANCE); + uiJainaOrSylvanas1 = pCreature->GetGUID(); + break; + case NPC_SYLVANAS_PART2: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_JAINA_PART2, ALLIANCE); + uiJainaOrSylvanas2 = pCreature->GetGUID(); + break; + case NPC_KILARA: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_ELANDRA, ALLIANCE); + break; + case NPC_KORALEN: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_KORLAEN, ALLIANCE); + break; + case NPC_CHAMPION_1_HORDE: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_1_ALLIANCE, ALLIANCE); + break; + case NPC_CHAMPION_2_HORDE: + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); + break; + case NPC_CHAMPION_3_HORDE: // No 3rd set for Alliance? + if (uiTeamInInstance == ALLIANCE) + pCreature->UpdateEntry(NPC_CHAMPION_2_ALLIANCE, ALLIANCE); + break; + } + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_GARFROST: return uiGarfrost; + case DATA_KRICK: return uiKrick; + case DATA_ICK: return uiIck; + case DATA_TYRANNUS: return uiTyrannus; + case DATA_RIMEFANG: return uiRimefang; + + case DATA_JAINA_SYLVANAS_1: return uiJainaOrSylvanas1; + case DATA_JAINA_SYLVANAS_2: return uiJainaOrSylvanas2; + } + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_GARFROST_EVENT: + uiEncounter[0] = data; + break; + case DATA_TYRANNUS_EVENT: + uiEncounter[1] = data; + break; + case DATA_KRICKANDICK_EVENT: + uiEncounter[2] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_GARFROST_EVENT: return uiEncounter[0]; + case DATA_TYRANNUS_EVENT: return uiEncounter[1]; + case DATA_KRICKANDICK_EVENT: return uiEncounter[2]; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::string str_data; + + std::ostringstream saveStream; + saveStream << "P S " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2; + + if (dataHead1 == 'P' && dataHead2 == 'S') + { + uiEncounter[0] = data0; + uiEncounter[1] = data1; + uiEncounter[2] = data2; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_pit_of_saron(Map* pMap) -{ - return new instance_pit_of_saron(pMap); -} void AddSC_instance_pit_of_saron() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_pit_of_saron"; - newscript->GetInstanceData = &GetInstanceData_instance_pit_of_saron; - newscript->RegisterSelf(); + new instance_pit_of_saron(); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index b9b8504fcf0..28885a34abc 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -149,954 +149,987 @@ enum eEvents }; /****************************************AI****************************************/ -struct mob_ymirjar_wrathbringerAI : public ScriptedAI + class mob_ymirjar_wrathbringer : public CreatureScript { - mob_ymirjar_wrathbringerAI(Creature *c) : ScriptedAI(c) +public: + mob_ymirjar_wrathbringer() : CreatureScript("mob_ymirjar_wrathbringer") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_ymirjar_wrathbringerAI(pCreature); } - EventMap events; - - void Reset() + struct mob_ymirjar_wrathbringerAI : public ScriptedAI { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BLIGHT, 7000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + mob_ymirjar_wrathbringerAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_BLIGHT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLIGHT); - events.RescheduleEvent(EVENT_BLIGHT, 8000); - return; - } } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct mob_ymirjar_skyCallerAI: public ScriptedAI -{ - mob_ymirjar_skyCallerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROSTBLADE, 1); - events.ScheduleEvent(EVENT_GLACIAL_STRIKE, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_GLACIAL_STRIKE: - DoCast(me->getVictim(), SPELL_GLACIAL_STRIKE); - events.RescheduleEvent(EVENT_GLACIAL_STRIKE, 8000); - return; - case EVENT_FROSTBLADE: - DoCast(me, SPELL_FROSTBLADE); - events.CancelEvent(EVENT_FROSTBLADE); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_ymirjar_flamebearerAI: public ScriptedAI -{ - mob_ymirjar_flamebearerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FIREBALL, 4000); - events.ScheduleEvent(EVENT_HELLFIRE, 8000); - events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_FIREBALL: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FIREBALL); - events.RescheduleEvent(EVENT_FIREBALL, 5000); - return; - case EVENT_HELLFIRE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_HELLFIRE); - events.RescheduleEvent(EVENT_HELLFIRE, 10000); - return; - case EVENT_TACTICAL_BLINK: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_TACTICAL_BLINK); - events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12000); - return; - } + events.ScheduleEvent(EVENT_BLIGHT, 7000); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_ymirjar_deathbringerAI: public ScriptedAI -{ - mob_ymirjar_deathbringerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_EMPOWERED_SHADOW_BOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_EMPOWERED_SHADOW_BOLT); - events.RescheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); - return; + switch(eventId) + { + case EVENT_BLIGHT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLIGHT); + events.RescheduleEvent(EVENT_BLIGHT, 8000); + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_ymirjar_skycaller : public CreatureScript +{ +public: + mob_ymirjar_skycaller() : CreatureScript("mob_ymirjar_skycaller") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ymirjar_skyCallerAI(pCreature); + } + + struct mob_ymirjar_skyCallerAI: public ScriptedAI + { + mob_ymirjar_skyCallerAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct mob_wrathbone_laborerAI: public ScriptedAI -{ - mob_wrathbone_laborerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); - events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - events.ScheduleEvent(EVENT_SHOVELLED, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_BLINDING_DIRT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLINDING_DIRT); - events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); - return; - case EVENT_PUNCTURE_WOUND: - DoCast(me->getVictim(), SPELL_PUNCTURE_WOUND); - events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); - return; - case EVENT_SHOVELLED: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHOVELLED); - events.RescheduleEvent(EVENT_SHOVELLED, 7000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_wrathbone_coldwraithAI: public ScriptedAI -{ - mob_wrathbone_coldwraithAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FREEZING_CIRCLE, 9000); - events.ScheduleEvent(EVENT_FROSTBOLT, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_FREEZING_CIRCLE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FREEZING_CIRCLE); - events.RescheduleEvent(EVENT_FREEZING_CIRCLE, 9000); - return; - case EVENT_FROSTBOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FROSTBOLT); - events.RescheduleEvent(EVENT_FROSTBOLT, 5000); - return; - } + events.ScheduleEvent(EVENT_FROSTBLADE, 1); + events.ScheduleEvent(EVENT_GLACIAL_STRIKE, 8000); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_stonespine_gargoyleAI: public ScriptedAI -{ - mob_stonespine_gargoyleAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_GARGOYLE_STRIKE, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_GARGOYLE_STRIKE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_GARGOYLE_STRIKE); - events.RescheduleEvent(EVENT_GARGOYLE_STRIKE, 6000); - return; - case EVENT_STONEFORM: - if (HealthBelowPct(10)) - DoCast(me, SPELL_STONEFORM); - return; + switch(eventId) + { + case EVENT_GLACIAL_STRIKE: + DoCast(me->getVictim(), SPELL_GLACIAL_STRIKE); + events.RescheduleEvent(EVENT_GLACIAL_STRIKE, 8000); + return; + case EVENT_FROSTBLADE: + DoCast(me, SPELL_FROSTBLADE); + events.CancelEvent(EVENT_FROSTBLADE); + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_ymirjar_flamebearer : public CreatureScript +{ +public: + mob_ymirjar_flamebearer() : CreatureScript("mob_ymirjar_flamebearer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ymirjar_flamebearerAI(pCreature); + } + + struct mob_ymirjar_flamebearerAI: public ScriptedAI + { + mob_ymirjar_flamebearerAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct mob_plagueborn_horrorAI: public ScriptedAI -{ - mob_plagueborn_horrorAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BLIGHT_BOMB, 999999); - events.ScheduleEvent(EVENT_PUSTULANT_FLESH, 5000); - events.ScheduleEvent(EVENT_TOXIC_WASTE, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_BLIGHT_BOMB: - if (HealthBelowPct(15)) - DoCast(me, SPELL_BLIGHT_BOMB); - return; - case EVENT_PUSTULANT_FLESH: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_PUSTULANT_FLESH); - events.RescheduleEvent(EVENT_PUSTULANT_FLESH, 10000); - return; - case EVENT_TOXIC_WASTE: - DoCast(me, SPELL_TOXIC_WASTE); - events.RescheduleEvent(EVENT_TOXIC_WASTE, 8000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_iceborn_protodrakeAI: public ScriptedAI -{ - mob_iceborn_protodrakeAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_FROST_BREATH, 5000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_FROST_BREATH: - DoCast(me->getVictim(), SPELL_FROST_BREATH); - events.RescheduleEvent(EVENT_FROST_BREATH, 10000); - return; - } + events.ScheduleEvent(EVENT_FIREBALL, 4000); + events.ScheduleEvent(EVENT_HELLFIRE, 8000); + events.ScheduleEvent(EVENT_TACTICAL_BLINK, 15000); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_hungering_ghoulAI: public ScriptedAI -{ - mob_hungering_ghoulAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_DEVOUR_FLESH, 4000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_DEVOUR_FLESH: - DoCast(me->getVictim(), SPELL_DEVOUR_FLESH); - events.RescheduleEvent(EVENT_DEVOUR_FLESH, 8000); - return; + switch(eventId) + { + case EVENT_FIREBALL: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FIREBALL); + events.RescheduleEvent(EVENT_FIREBALL, 5000); + return; + case EVENT_HELLFIRE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_HELLFIRE); + events.RescheduleEvent(EVENT_HELLFIRE, 10000); + return; + case EVENT_TACTICAL_BLINK: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_TACTICAL_BLINK); + events.RescheduleEvent(EVENT_TACTICAL_BLINK, 12000); + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_ymirjar_deathbringer : public CreatureScript +{ +public: + mob_ymirjar_deathbringer() : CreatureScript("mob_ymirjar_deathbringer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ymirjar_deathbringerAI(pCreature); + } + + struct mob_ymirjar_deathbringerAI: public ScriptedAI + { + mob_ymirjar_deathbringerAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct mob_fallen_warriorAI: public ScriptedAI -{ - mob_fallen_warriorAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_ARCING_SLICE, 8000); - events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); - events.ScheduleEvent(EVENT_SHIELD_BLOCK, 8000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_ARCING_SLICE: - DoCast(me->getVictim(), SPELL_ARCING_SLICE); - events.RescheduleEvent(EVENT_ARCING_SLICE, 10000); - return; - case EVENT_DEMORALIZING_SHOUT: - DoCast(me, SPELL_DEMORALIZING_SHOUT); - events.RescheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); - return; - case EVENT_SHIELD_BLOCK: - DoCast(me->getVictim(), SPELL_SHIELD_BLOCK); - events.RescheduleEvent(EVENT_SHIELD_BLOCK, 8000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_deathwhisper_torturerAI: public ScriptedAI -{ - mob_deathwhisper_torturerAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_BLACK_BRAND, 10000); - events.ScheduleEvent(EVENT_CURSE_OF_AGONY, 6000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_BLACK_BRAND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_BLACK_BRAND); - events.RescheduleEvent(EVENT_BLACK_BRAND, 10000); - return; - case EVENT_CURSE_OF_AGONY: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CURSE_OF_AGONY); - events.RescheduleEvent(EVENT_CURSE_OF_AGONY, 13000); - return; - } + events.ScheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_deathwhisper_shadowcasterAI: public ScriptedAI -{ - mob_deathwhisper_shadowcasterAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHADOW_BOLT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT); - events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); - return; + switch(eventId) + { + case EVENT_EMPOWERED_SHADOW_BOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_EMPOWERED_SHADOW_BOLT); + events.RescheduleEvent(EVENT_EMPOWERED_SHADOW_BOLT, 8000); + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_wrathbone_laborer : public CreatureScript +{ +public: + mob_wrathbone_laborer() : CreatureScript("mob_wrathbone_laborer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_wrathbone_laborerAI(pCreature); + } + + struct mob_wrathbone_laborerAI: public ScriptedAI + { + mob_wrathbone_laborerAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } -}; + EventMap events; -struct mob_deathwhisper_necrolyteAI: public ScriptedAI -{ - mob_deathwhisper_necrolyteAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_CONVERSION_BEAM, 12000); - events.ScheduleEvent(EVENT_SHADOW_BOLT_2, 4000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_CONVERSION_BEAM: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CONVERSION_BEAM); - events.RescheduleEvent(EVENT_CONVERSION_BEAM, 12000); - return; - case EVENT_SHADOW_BOLT_2: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT_2); - events.RescheduleEvent(EVENT_SHADOW_BOLT_2, 5000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_wrathbone_sorcererAI: public ScriptedAI -{ - mob_wrathbone_sorcererAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - events.ScheduleEvent(EVENT_SHADOW_BOLT_3, 3000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit* /*who*/) { - switch(eventId) - { - case EVENT_SHADOW_BOLT_3: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT_3); - events.RescheduleEvent(EVENT_SHADOW_BOLT_3, 5000); - return; - } + events.ScheduleEvent(EVENT_BLINDING_DIRT, 8000); + events.ScheduleEvent(EVENT_PUNCTURE_WOUND, 9000); + events.ScheduleEvent(EVENT_SHOVELLED, 5000); } - DoMeleeAttackIfReady(); - } -}; - -struct mob_geist_ambusherAI: public ScriptedAI -{ - mob_geist_ambusherAI(Creature *c) : ScriptedAI(c) - { - } - - EventMap events; - - void Reset() - { - events.Reset(); - } - - void EnterCombat(Unit* /*who*/) - { - //Only here so when I figure out how to make it cast on an NPC i can do that. - events.ScheduleEvent(EVENT_LEAPING_FACE_MAUL, 99999); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - //Should only be used on NPCs - case EVENT_LEAPING_FACE_MAUL: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_LEAPING_FACE_MAUL); - events.CancelEvent(EVENT_LEAPING_FACE_MAUL); - return; + switch(eventId) + { + case EVENT_BLINDING_DIRT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLINDING_DIRT); + events.RescheduleEvent(EVENT_BLINDING_DIRT, 10000); + return; + case EVENT_PUNCTURE_WOUND: + DoCast(me->getVictim(), SPELL_PUNCTURE_WOUND); + events.RescheduleEvent(EVENT_PUNCTURE_WOUND, 9000); + return; + case EVENT_SHOVELLED: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHOVELLED); + events.RescheduleEvent(EVENT_SHOVELLED, 7000); + return; + } } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_wrathbone_coldwraith : public CreatureScript +{ +public: + mob_wrathbone_coldwraith() : CreatureScript("mob_wrathbone_coldwraith") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_wrathbone_coldwraithAI(pCreature); + } + + struct mob_wrathbone_coldwraithAI: public ScriptedAI + { + mob_wrathbone_coldwraithAI(Creature *c) : ScriptedAI(c) + { } - DoMeleeAttackIfReady(); - } + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FREEZING_CIRCLE, 9000); + events.ScheduleEvent(EVENT_FROSTBOLT, 5000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FREEZING_CIRCLE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FREEZING_CIRCLE); + events.RescheduleEvent(EVENT_FREEZING_CIRCLE, 9000); + return; + case EVENT_FROSTBOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FROSTBOLT); + events.RescheduleEvent(EVENT_FROSTBOLT, 5000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; - -CreatureAI* GetAI_mob_ymirjar_wrathbringerAI(Creature* pCreature) + class mob_stonespine_gargoyle : public CreatureScript { - return new mob_ymirjar_wrathbringerAI(pCreature); -} +public: + mob_stonespine_gargoyle() : CreatureScript("mob_stonespine_gargoyle") { } -CreatureAI* GetAI_mob_ymirjar_skyCallerAI(Creature* pCreature) -{ - return new mob_ymirjar_skyCallerAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_stonespine_gargoyleAI(pCreature); + } -CreatureAI* GetAI_mob_ymirjar_flamebearerAI(Creature* pCreature) -{ - return new mob_ymirjar_flamebearerAI(pCreature); -} + struct mob_stonespine_gargoyleAI: public ScriptedAI + { + mob_stonespine_gargoyleAI(Creature *c) : ScriptedAI(c) + { + } -CreatureAI* GetAI_mob_ymirjar_deathbringerAI(Creature* pCreature) -{ - return new mob_ymirjar_deathbringerAI(pCreature); -} + EventMap events; -CreatureAI* GetAI_mob_wrathbone_laborerAI(Creature* pCreature) -{ - return new mob_wrathbone_laborerAI(pCreature); -} + void Reset() + { + events.Reset(); + } -CreatureAI* GetAI_mob_wrathbone_coldwraithAI(Creature* pCreature) -{ - return new mob_wrathbone_coldwraithAI(pCreature); -} + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_GARGOYLE_STRIKE, 5000); + } -CreatureAI* GetAI_mob_stonespine_gargoyleAI(Creature* pCreature) -{ - return new mob_stonespine_gargoyleAI(pCreature); -} + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; -CreatureAI* GetAI_mob_plagueborn_horrorAI(Creature* pCreature) -{ - return new mob_plagueborn_horrorAI(pCreature); -} + events.Update(diff); -CreatureAI* GetAI_mob_iceborn_protodrakeAI(Creature* pCreature) -{ - return new mob_iceborn_protodrakeAI(pCreature); -} + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; -CreatureAI* GetAI_mob_hungering_ghoulAI(Creature* pCreature) -{ - return new mob_hungering_ghoulAI(pCreature); -} + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_GARGOYLE_STRIKE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_GARGOYLE_STRIKE); + events.RescheduleEvent(EVENT_GARGOYLE_STRIKE, 6000); + return; + case EVENT_STONEFORM: + if (HealthBelowPct(10)) + DoCast(me, SPELL_STONEFORM); + return; + } + } -CreatureAI* GetAI_mob_fallen_warriorAI(Creature* pCreature) -{ - return new mob_fallen_warriorAI(pCreature); -} + DoMeleeAttackIfReady(); + } + }; -CreatureAI* GetAI_mob_deathwhisper_torturerAI(Creature* pCreature) +}; + class mob_plagueborn_horror : public CreatureScript { - return new mob_deathwhisper_torturerAI(pCreature); -} +public: + mob_plagueborn_horror() : CreatureScript("mob_plagueborn_horror") { } -CreatureAI* GetAI_mob_deathwhisper_shadowcasterAI(Creature* pCreature) -{ - return new mob_deathwhisper_shadowcasterAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_plagueborn_horrorAI(pCreature); + } -CreatureAI* GetAI_mob_deathwhisper_necrolyteAI(Creature* pCreature) -{ - return new mob_deathwhisper_necrolyteAI(pCreature); -} + struct mob_plagueborn_horrorAI: public ScriptedAI + { + mob_plagueborn_horrorAI(Creature *c) : ScriptedAI(c) + { + } -CreatureAI* GetAI_mob_wrathbone_sorcererAI(Creature* pCreature) -{ - return new mob_wrathbone_sorcererAI(pCreature); -} + EventMap events; -CreatureAI* GetAI_mob_geist_ambusherAI(Creature* pCreature) + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLIGHT_BOMB, 999999); + events.ScheduleEvent(EVENT_PUSTULANT_FLESH, 5000); + events.ScheduleEvent(EVENT_TOXIC_WASTE, 8000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_BLIGHT_BOMB: + if (HealthBelowPct(15)) + DoCast(me, SPELL_BLIGHT_BOMB); + return; + case EVENT_PUSTULANT_FLESH: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_PUSTULANT_FLESH); + events.RescheduleEvent(EVENT_PUSTULANT_FLESH, 10000); + return; + case EVENT_TOXIC_WASTE: + DoCast(me, SPELL_TOXIC_WASTE); + events.RescheduleEvent(EVENT_TOXIC_WASTE, 8000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_iceborn_protodrake : public CreatureScript { - return new mob_geist_ambusherAI(pCreature); -} +public: + mob_iceborn_protodrake() : CreatureScript("mob_iceborn_protodrake") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_iceborn_protodrakeAI(pCreature); + } + + struct mob_iceborn_protodrakeAI: public ScriptedAI + { + mob_iceborn_protodrakeAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_FROST_BREATH, 5000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FROST_BREATH: + DoCast(me->getVictim(), SPELL_FROST_BREATH); + events.RescheduleEvent(EVENT_FROST_BREATH, 10000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_hungering_ghoul : public CreatureScript +{ +public: + mob_hungering_ghoul() : CreatureScript("mob_hungering_ghoul") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_hungering_ghoulAI(pCreature); + } + + struct mob_hungering_ghoulAI: public ScriptedAI + { + mob_hungering_ghoulAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_DEVOUR_FLESH, 4000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_DEVOUR_FLESH: + DoCast(me->getVictim(), SPELL_DEVOUR_FLESH); + events.RescheduleEvent(EVENT_DEVOUR_FLESH, 8000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_fallen_warrior : public CreatureScript +{ +public: + mob_fallen_warrior() : CreatureScript("mob_fallen_warrior") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_fallen_warriorAI(pCreature); + } + + struct mob_fallen_warriorAI: public ScriptedAI + { + mob_fallen_warriorAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_ARCING_SLICE, 8000); + events.ScheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); + events.ScheduleEvent(EVENT_SHIELD_BLOCK, 8000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ARCING_SLICE: + DoCast(me->getVictim(), SPELL_ARCING_SLICE); + events.RescheduleEvent(EVENT_ARCING_SLICE, 10000); + return; + case EVENT_DEMORALIZING_SHOUT: + DoCast(me, SPELL_DEMORALIZING_SHOUT); + events.RescheduleEvent(EVENT_DEMORALIZING_SHOUT, 20000); + return; + case EVENT_SHIELD_BLOCK: + DoCast(me->getVictim(), SPELL_SHIELD_BLOCK); + events.RescheduleEvent(EVENT_SHIELD_BLOCK, 8000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_deathwhisper_torturer : public CreatureScript +{ +public: + mob_deathwhisper_torturer() : CreatureScript("mob_deathwhisper_torturer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_deathwhisper_torturerAI(pCreature); + } + + struct mob_deathwhisper_torturerAI: public ScriptedAI + { + mob_deathwhisper_torturerAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_BLACK_BRAND, 10000); + events.ScheduleEvent(EVENT_CURSE_OF_AGONY, 6000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_BLACK_BRAND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_BLACK_BRAND); + events.RescheduleEvent(EVENT_BLACK_BRAND, 10000); + return; + case EVENT_CURSE_OF_AGONY: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CURSE_OF_AGONY); + events.RescheduleEvent(EVENT_CURSE_OF_AGONY, 13000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_deathwhisper_shadowcaster : public CreatureScript +{ +public: + mob_deathwhisper_shadowcaster() : CreatureScript("mob_deathwhisper_shadowcaster") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_deathwhisper_shadowcasterAI(pCreature); + } + + struct mob_deathwhisper_shadowcasterAI: public ScriptedAI + { + mob_deathwhisper_shadowcasterAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_BOLT, 3000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHADOW_BOLT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT); + events.RescheduleEvent(EVENT_SHADOW_BOLT, 5000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_deathwhisper_necrolyte : public CreatureScript +{ +public: + mob_deathwhisper_necrolyte() : CreatureScript("mob_deathwhisper_necrolyte") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_deathwhisper_necrolyteAI(pCreature); + } + + struct mob_deathwhisper_necrolyteAI: public ScriptedAI + { + mob_deathwhisper_necrolyteAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_CONVERSION_BEAM, 12000); + events.ScheduleEvent(EVENT_SHADOW_BOLT_2, 4000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_CONVERSION_BEAM: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CONVERSION_BEAM); + events.RescheduleEvent(EVENT_CONVERSION_BEAM, 12000); + return; + case EVENT_SHADOW_BOLT_2: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT_2); + events.RescheduleEvent(EVENT_SHADOW_BOLT_2, 5000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_wrathbone_sorcerer : public CreatureScript +{ +public: + mob_wrathbone_sorcerer() : CreatureScript("mob_wrathbone_sorcerer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_wrathbone_sorcererAI(pCreature); + } + + struct mob_wrathbone_sorcererAI: public ScriptedAI + { + mob_wrathbone_sorcererAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + events.ScheduleEvent(EVENT_SHADOW_BOLT_3, 3000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHADOW_BOLT_3: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT_3); + events.RescheduleEvent(EVENT_SHADOW_BOLT_3, 5000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_geist_ambusher : public CreatureScript +{ +public: + mob_geist_ambusher() : CreatureScript("mob_geist_ambusher") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_geist_ambusherAI(pCreature); + } + + struct mob_geist_ambusherAI: public ScriptedAI + { + mob_geist_ambusherAI(Creature *c) : ScriptedAI(c) + { + } + + EventMap events; + + void Reset() + { + events.Reset(); + } + + void EnterCombat(Unit* /*who*/) + { + //Only here so when I figure out how to make it cast on an NPC i can do that. + events.ScheduleEvent(EVENT_LEAPING_FACE_MAUL, 99999); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + //Should only be used on NPCs + case EVENT_LEAPING_FACE_MAUL: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_LEAPING_FACE_MAUL); + events.CancelEvent(EVENT_LEAPING_FACE_MAUL); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_pit_of_saron() { - Script *newscript; - newscript = new Script; - newscript->Name="mob_ymirjar_wrathbringer"; - newscript->GetAI = &GetAI_mob_ymirjar_wrathbringerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_skycaller"; - newscript->GetAI = &GetAI_mob_ymirjar_skyCallerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_flamebearer"; - newscript->GetAI = &GetAI_mob_ymirjar_flamebearerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ymirjar_deathbringer"; - newscript->GetAI = &GetAI_mob_ymirjar_deathbringerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_laborer"; - newscript->GetAI = &GetAI_mob_wrathbone_laborerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_coldwraith"; - newscript->GetAI = &GetAI_mob_wrathbone_coldwraithAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_stonespine_gargoyle"; - newscript->GetAI = &GetAI_mob_stonespine_gargoyleAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_plagueborn_horror"; - newscript->GetAI = &GetAI_mob_plagueborn_horrorAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_iceborn_protodrake"; - newscript->GetAI = &GetAI_mob_iceborn_protodrakeAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_hungering_ghoul"; - newscript->GetAI = &GetAI_mob_hungering_ghoulAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_fallen_warrior"; - newscript->GetAI = &GetAI_mob_fallen_warriorAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_torturer"; - newscript->GetAI = &GetAI_mob_deathwhisper_torturerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_shadowcaster"; - newscript->GetAI = &GetAI_mob_deathwhisper_shadowcasterAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_deathwhisper_necrolyte"; - newscript->GetAI = &GetAI_mob_deathwhisper_necrolyteAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_wrathbone_sorcerer"; - newscript->GetAI = &GetAI_mob_wrathbone_sorcererAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_geist_ambusher"; - newscript->GetAI = &GetAI_mob_geist_ambusherAI; - newscript->RegisterSelf(); + new mob_ymirjar_wrathbringer(); + new mob_ymirjar_skycaller(); + new mob_ymirjar_flamebearer(); + new mob_ymirjar_deathbringer(); + new mob_wrathbone_laborer(); + new mob_wrathbone_coldwraith(); + new mob_stonespine_gargoyle(); + new mob_plagueborn_horror(); + new mob_iceborn_protodrake(); + new mob_hungering_ghoul(); + new mob_fallen_warrior(); + new mob_deathwhisper_torturer(); + new mob_deathwhisper_shadowcaster(); + new mob_deathwhisper_necrolyte(); + new mob_wrathbone_sorcerer(); + new mob_geist_ambusher(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 3bb998c7096..307479f2542 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -34,283 +34,291 @@ enum Spells SPELL_MOJO_WAVE = 55626, H_SPELL_MOJO_WAVE = 58993 }; - -struct boss_drakkari_colossusAI : public ScriptedAI + class boss_drakkari_colossus : public CreatureScript { - boss_drakkari_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_drakkari_colossus() : CreatureScript("boss_drakkari_colossus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_drakkari_colossusAI (pCreature); } - ScriptedInstance* pInstance; - - bool bHealth; - bool bHealth1; - - uint32 MightyBlowTimer; - - void Reset() + struct boss_drakkari_colossusAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); - MightyBlowTimer = 10*IN_MILLISECONDS; - bHealth = false; - bHealth1 = false; - } - - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); - } - - void CreatureState(Creature* pWho, bool bRestore = false) - { - if (!pWho) - return; - - if (bRestore) + boss_drakkari_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) { - pWho->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - pWho->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pWho == me) - me->RemoveAura(SPELL_FREEZE_ANIM); - }else - { - pWho->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pWho->addUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); - if (pWho == me) - DoCast(me,SPELL_FREEZE_ANIM); - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5)) - { - CreatureState(me, false); - DoCast(me,SPELL_FREEZE_ANIM); - DoCast(me,SPELL_EMERGE); - bHealth = true; + pInstance = pCreature->GetInstanceScript(); } - if (!bHealth1 && HealthBelowPct(5)) - { - DoCast(me,SPELL_EMERGE); - CreatureState(me, false); - bHealth1 = true; - me->RemoveAllAuras(); - } + InstanceScript* pInstance; - if (MightyBlowTimer <= diff) + bool bHealth; + bool bHealth1; + + uint32 MightyBlowTimer; + + void Reset() { - DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, true); + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED); + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); MightyBlowTimer = 10*IN_MILLISECONDS; - } else MightyBlowTimer -= diff; - - if (!me->hasUnitState(UNIT_STAT_STUNNED)) - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); - } - - void JustSummoned(Creature* pSummon) - { - if (HealthBelowPct(5)) - pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - pSummon->AI()->AttackStart(me->getVictim()); - } -}; - -struct boss_drakkari_elementalAI : public ScriptedAI -{ - boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiSurgeTimer; - - bool bGoToColossus; - - void Reset() - { - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(me, true); - uiSurgeTimer = 7*IN_MILLISECONDS; - bGoToColossus = false; - } - - void EnterEvadeMode() - { - me->RemoveFromWorld(); - } - - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - { - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(pColossus, true); - CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->bHealth1 = false; + bHealth = false; + bHealth1 = false; } - me->RemoveFromWorld(); - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!bGoToColossus && HealthBelowPct(50)) + void EnterCombat(Unit* /*who*/) { - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS); + } + + void CreatureState(Creature* pWho, bool bRestore = false) + { + if (!pWho) + return; + + if (bRestore) { - if (!CAST_AI(boss_drakkari_colossusAI,pColossus->AI())->HealthBelowPct(6)) - { - me->InterruptNonMeleeSpells(true); - DoCast(pColossus, SPELL_MERGE); - bGoToColossus = true; - } + pWho->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + pWho->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pWho == me) + me->RemoveAura(SPELL_FREEZE_ANIM); + }else + { + pWho->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pWho->addUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + if (pWho == me) + DoCast(me,SPELL_FREEZE_ANIM); } } - if (uiSurgeTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SURGE); + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bHealth && HealthBelowPct(50) && !HealthBelowPct(5)) + { + CreatureState(me, false); + DoCast(me,SPELL_FREEZE_ANIM); + DoCast(me,SPELL_EMERGE); + bHealth = true; + } + + if (!bHealth1 && HealthBelowPct(5)) + { + DoCast(me,SPELL_EMERGE); + CreatureState(me, false); + bHealth1 = true; + me->RemoveAllAuras(); + } + + if (MightyBlowTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTY_BLOW, true); + MightyBlowTimer = 10*IN_MILLISECONDS; + } else MightyBlowTimer -= diff; + + if (!me->hasUnitState(UNIT_STAT_STUNNED)) + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE); + } + + void JustSummoned(Creature* pSummon) + { + if (HealthBelowPct(5)) + pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pSummon->AI()->AttackStart(me->getVictim()); + } + }; + +}; + class boss_drakkari_elemental : public CreatureScript +{ +public: + boss_drakkari_elemental() : CreatureScript("boss_drakkari_elemental") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_drakkari_elementalAI (pCreature); + } + + struct boss_drakkari_elementalAI : public ScriptedAI + { + boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiSurgeTimer; + + bool bGoToColossus; + + void Reset() + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->CreatureState(me, true); uiSurgeTimer = 7*IN_MILLISECONDS; - } else uiSurgeTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - pColossus->Kill(pColossus); - } -}; - -struct npc_living_mojoAI : public ScriptedAI -{ - npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiMojoWaveTimer; - uint32 uiMojoPuddleTimer; - - void Reset() - { - uiMojoWaveTimer = 2*IN_MILLISECONDS; - uiMojoPuddleTimer = 7*IN_MILLISECONDS; - } - - void EnterCombat(Unit* /*who*/) - { - - //Check if the npc is near of Drakkari Colossus. - if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) - { - if (pColossus->isAlive() && me->IsInRange3d(pColossus->GetHomePosition().GetPositionX(),pColossus->GetHomePosition().GetPositionY(),pColossus->GetHomePosition().GetPositionZ(),0.0f,17.0f)) - me->SetReactState(REACT_PASSIVE); - else - me->SetReactState(REACT_AGGRESSIVE); + bGoToColossus = false; } - } - void DamageTaken(Unit* pDone_by, uint32& /*uiDamage*/) - { - if (me->HasReactState(REACT_PASSIVE)) + void EnterEvadeMode() { + me->RemoveFromWorld(); + } + + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) { - if (pColossus->isAlive() && !pColossus->isInCombat()) + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->CreatureState(pColossus, true); + CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI, pColossus->AI())->bHealth1 = false; + } + me->RemoveFromWorld(); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bGoToColossus && HealthBelowPct(50)) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) { - pColossus->RemoveAura(SPELL_FREEZE_ANIM); - pColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - pColossus->SetReactState(REACT_AGGRESSIVE); - if (pDone_by && pDone_by->isAlive()) - pColossus->AI()->AttackStart(pDone_by); - EnterEvadeMode(); + if (!CAST_AI(boss_drakkari_colossus::boss_drakkari_colossusAI,pColossus->AI())->HealthBelowPct(6)) + { + me->InterruptNonMeleeSpells(true); + DoCast(pColossus, SPELL_MERGE); + bGoToColossus = true; + } + } + } + + if (uiSurgeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SURGE); + uiSurgeTimer = 7*IN_MILLISECONDS; + } else uiSurgeTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + pColossus->Kill(pColossus); + } + }; + +}; + class npc_living_mojo : public CreatureScript +{ +public: + npc_living_mojo() : CreatureScript("npc_living_mojo") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_living_mojoAI (pCreature); + } + + struct npc_living_mojoAI : public ScriptedAI + { + npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiMojoWaveTimer; + uint32 uiMojoPuddleTimer; + + void Reset() + { + uiMojoWaveTimer = 2*IN_MILLISECONDS; + uiMojoPuddleTimer = 7*IN_MILLISECONDS; + } + + void EnterCombat(Unit* /*who*/) + { + + //Check if the npc is near of Drakkari Colossus. + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + { + if (pColossus->isAlive() && me->IsInRange3d(pColossus->GetHomePosition().GetPositionX(),pColossus->GetHomePosition().GetPositionY(),pColossus->GetHomePosition().GetPositionZ(),0.0f,17.0f)) + me->SetReactState(REACT_PASSIVE); + else + me->SetReactState(REACT_AGGRESSIVE); + } + } + + void DamageTaken(Unit* pDone_by, uint32& /*uiDamage*/) + { + if (me->HasReactState(REACT_PASSIVE)) + { + if (Creature *pColossus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0)) + { + if (pColossus->isAlive() && !pColossus->isInCombat()) + { + pColossus->RemoveAura(SPELL_FREEZE_ANIM); + pColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + pColossus->SetReactState(REACT_AGGRESSIVE); + if (pDone_by && pDone_by->isAlive()) + pColossus->AI()->AttackStart(pDone_by); + EnterEvadeMode(); + } } } } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiMojoWaveTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_MOJO_WAVE); - uiMojoWaveTimer = 15*IN_MILLISECONDS; - } else uiMojoWaveTimer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - if (uiMojoPuddleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_MOJO_PUDDLE); - uiMojoPuddleTimer = 18*IN_MILLISECONDS; - } else uiMojoPuddleTimer -= diff; + if (uiMojoWaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MOJO_WAVE); + uiMojoWaveTimer = 15*IN_MILLISECONDS; + } else uiMojoWaveTimer -= diff; + + if (uiMojoPuddleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MOJO_PUDDLE); + uiMojoPuddleTimer = 18*IN_MILLISECONDS; + } else uiMojoPuddleTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_drakkari_colossus(Creature* pCreature) -{ - return new boss_drakkari_colossusAI (pCreature); -} -CreatureAI* GetAI_boss_drakkari_elemental(Creature* pCreature) -{ - return new boss_drakkari_elementalAI (pCreature); -} -CreatureAI* GetAI_npc_living_mojo(Creature* pCreature) -{ - return new npc_living_mojoAI (pCreature); -} void AddSC_boss_drakkari_colossus() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_drakkari_colossus"; - newscript->GetAI = &GetAI_boss_drakkari_colossus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_drakkari_elemental"; - newscript->GetAI = &GetAI_boss_drakkari_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_living_mojo"; - newscript->GetAI = &GetAI_npc_living_mojo; - newscript->RegisterSelf(); + new boss_drakkari_colossus(); + new boss_drakkari_elemental(); + new npc_living_mojo(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp index 8ddcc12ae49..b25cf7d27be 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_eck.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_eck.cpp @@ -28,140 +28,145 @@ enum Spells }; static Position EckSpawnPoint = { 1643.877930, 936.278015, 107.204948, 0.668432 }; - -struct boss_eckAI : public ScriptedAI + class boss_eck : public CreatureScript { - boss_eckAI(Creature *c) : ScriptedAI(c) +public: + boss_eck() : CreatureScript("boss_eck") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_eckAI (pCreature); } - uint32 uiBerserkTimer; - uint32 uiBiteTimer; - uint32 uiSpitTimer; - uint32 uiSpringTimer; - - bool bBerserk; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_eckAI : public ScriptedAI { - uiBerserkTimer = urand(60*IN_MILLISECONDS,90*IN_MILLISECONDS); //60-90 secs according to wowwiki - uiBiteTimer = 5*IN_MILLISECONDS; - uiSpitTimer = 10*IN_MILLISECONDS; - uiSpringTimer = 8*IN_MILLISECONDS; - - bBerserk = false; - - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiBiteTimer <= diff) + boss_eckAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_ECK_BITE); - uiBiteTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); - } else uiBiteTimer -= diff; + pInstance = c->GetInstanceScript(); + } - if (uiSpitTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ECK_SPIT); - uiSpitTimer = urand(6*IN_MILLISECONDS,14*IN_MILLISECONDS); - } else uiSpitTimer -= diff; + uint32 uiBerserkTimer; + uint32 uiBiteTimer; + uint32 uiSpitTimer; + uint32 uiSpringTimer; - if (uiSpringTimer <= diff) + bool bBerserk; + + InstanceScript* pInstance; + + void Reset() { - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + uiBerserkTimer = urand(60*IN_MILLISECONDS,90*IN_MILLISECONDS); //60-90 secs according to wowwiki + uiBiteTimer = 5*IN_MILLISECONDS; + uiSpitTimer = 10*IN_MILLISECONDS; + uiSpringTimer = 8*IN_MILLISECONDS; + + bBerserk = false; + + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiBiteTimer <= diff) { - DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); - uiSpringTimer = urand(5*IN_MILLISECONDS,10*IN_MILLISECONDS); - } - } else uiSpringTimer -= diff; + DoCast(me->getVictim(), SPELL_ECK_BITE); + uiBiteTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); + } else uiBiteTimer -= diff; - //Berserk on timer or 20% of health - if (!bBerserk) - { - if (uiBerserkTimer <= diff) + if (uiSpitTimer <= diff) { - DoCast(me, SPELL_ECK_BERSERK); - bBerserk = true; - } - else + DoCast(me->getVictim(), SPELL_ECK_SPIT); + uiSpitTimer = urand(6*IN_MILLISECONDS,14*IN_MILLISECONDS); + } else uiSpitTimer -= diff; + + if (uiSpringTimer <= diff) { - uiBerserkTimer -= diff; - if (HealthBelowPct(20)) + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2)); + uiSpringTimer = urand(5*IN_MILLISECONDS,10*IN_MILLISECONDS); + } + } else uiSpringTimer -= diff; + + //Berserk on timer or 20% of health + if (!bBerserk) + { + if (uiBerserkTimer <= diff) { DoCast(me, SPELL_ECK_BERSERK); bBerserk = true; } + else + { + uiBerserkTimer -= diff; + if (HealthBelowPct(20)) + { + DoCast(me, SPELL_ECK_BERSERK); + bBerserk = true; + } + } + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); + } + }; + +}; + + class npc_ruins_dweller : public CreatureScript +{ +public: + npc_ruins_dweller() : CreatureScript("npc_ruins_dweller") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ruins_dwellerAI (pCreature); + } + + struct npc_ruins_dwellerAI : public ScriptedAI + { + npc_ruins_dwellerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + void JustDied(Unit * /*who*/) + { + if (pInstance) + { + pInstance->SetData64(DATA_RUIN_DWELLER_DIED,me->GetGUID()); + if (pInstance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0) + me->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300*IN_MILLISECONDS); } } + }; - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_eck(Creature* pCreature) -{ - return new boss_eckAI (pCreature); -} - -struct npc_ruins_dwellerAI : public ScriptedAI -{ - npc_ruins_dwellerAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - void JustDied(Unit * /*who*/) - { - if (pInstance) - { - pInstance->SetData64(DATA_RUIN_DWELLER_DIED,me->GetGUID()); - if (pInstance->GetData(DATA_ALIVE_RUIN_DWELLERS) == 0) - me->SummonCreature(CREATURE_ECK, EckSpawnPoint, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300*IN_MILLISECONDS); - } - } -}; - -CreatureAI* GetAI_npc_ruins_dweller(Creature* pCreature) -{ - return new npc_ruins_dwellerAI (pCreature); -} void AddSC_boss_eck() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_eck"; - newscript->GetAI = &GetAI_boss_eck; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ruins_dweller"; - newscript->GetAI = &GetAI_npc_ruins_dweller; - newscript->RegisterSelf(); + new boss_eck(); + new npc_ruins_dweller(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index e90b244b118..be92b9dc52c 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -67,221 +67,223 @@ enum CombatPhase TROLL, RHINO }; - -struct boss_gal_darahAI : public ScriptedAI + class boss_gal_darah : public CreatureScript { - boss_gal_darahAI(Creature *c) : ScriptedAI(c) +public: + boss_gal_darah() : CreatureScript("boss_gal_darah") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gal_darahAI (pCreature); } - uint32 uiStampedeTimer; - uint32 uiWhirlingSlashTimer; - uint32 uiPunctureTimer; - uint32 uiEnrageTimer; - uint32 uiImpalingChargeTimer; - uint32 uiStompTimer; - uint32 uiTransformationTimer; - std::set lImpaledPlayers; - - CombatPhase Phase; - - uint8 uiPhaseCounter; - - bool bStartOfTransformation; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_gal_darahAI : public ScriptedAI { - uiStampedeTimer = 10*IN_MILLISECONDS; - uiWhirlingSlashTimer = 21*IN_MILLISECONDS; - uiPunctureTimer = 10*IN_MILLISECONDS; - uiEnrageTimer = 15*IN_MILLISECONDS; - uiImpalingChargeTimer = 21*IN_MILLISECONDS; - uiStompTimer = 25*IN_MILLISECONDS; - uiTransformationTimer = 9*IN_MILLISECONDS; - uiPhaseCounter = 0; - - lImpaledPlayers.clear(); - - bStartOfTransformation = true; - - Phase = TROLL; - - me->SetDisplayId(DISPLAY_TROLL); - - if (pInstance) - pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - switch (Phase) + boss_gal_darahAI(Creature *c) : ScriptedAI(c) { - case TROLL: - if (uiPhaseCounter == 2) - { - if (uiTransformationTimer <= diff) - { - me->SetDisplayId(DISPLAY_RHINO); - Phase = RHINO; - uiPhaseCounter = 0; - DoScriptText(SAY_TRANSFORM_1, me); - uiTransformationTimer = 5*IN_MILLISECONDS; - bStartOfTransformation = true; - me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_AGGRESSIVE); - } - else - { - uiTransformationTimer -= diff; - - if (bStartOfTransformation) - { - bStartOfTransformation = false; - me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); - } - } - } - else - { - if (uiStampedeTimer <= diff) - { - DoCast(me, SPELL_STAMPEDE); - DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),me); - uiStampedeTimer = 15*IN_MILLISECONDS; - } else uiStampedeTimer -= diff; - - if (uiWhirlingSlashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WHIRLING_SLASH); - uiWhirlingSlashTimer = 21*IN_MILLISECONDS; - ++uiPhaseCounter; - } else uiWhirlingSlashTimer -= diff; - } - break; - case RHINO: - if (uiPhaseCounter == 2) - { - if (uiTransformationTimer <= diff) - { - me->SetDisplayId(DISPLAY_TROLL); - Phase = TROLL; - uiPhaseCounter = 0; - DoScriptText(SAY_TRANSFORM_2, me); - uiTransformationTimer = 9*IN_MILLISECONDS; - bStartOfTransformation = true; - me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_AGGRESSIVE); - } - else - { - uiTransformationTimer -= diff; - - if (bStartOfTransformation) - { - bStartOfTransformation = false; - me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); - me->SetReactState(REACT_PASSIVE); - } - } - } - else - { - if (uiPunctureTimer <= diff) - { - DoCast(me->getVictim(), SPELL_PUNCTURE); - uiPunctureTimer = 8*IN_MILLISECONDS; - } else uiPunctureTimer -= diff; - - if (uiEnrageTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ENRAGE); - uiEnrageTimer = 20*IN_MILLISECONDS; - } else uiEnrageTimer -= diff; - - if (uiStompTimer <= diff) - { - DoCast(me->getVictim(), SPELL_STOMP); - uiStompTimer = 20*IN_MILLISECONDS; - } else uiStompTimer -= diff; - - if (uiImpalingChargeTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - DoCast(pTarget, SPELL_IMPALING_CHARGE); - lImpaledPlayers.insert(pTarget->GetGUID()); - } - uiImpalingChargeTimer = 31*IN_MILLISECONDS; - ++uiPhaseCounter; - } else uiImpalingChargeTimer -= diff; - } - break; + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + uint32 uiStampedeTimer; + uint32 uiWhirlingSlashTimer; + uint32 uiPunctureTimer; + uint32 uiEnrageTimer; + uint32 uiImpalingChargeTimer; + uint32 uiStompTimer; + uint32 uiTransformationTimer; + std::set lImpaledPlayers; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + CombatPhase Phase; - if (pInstance) + uint8 uiPhaseCounter; + + bool bStartOfTransformation; + + InstanceScript* pInstance; + + void Reset() { - if (IsHeroic()) - { - if (lImpaledPlayers.size() == 5) - pInstance->DoCompleteAchievement(ACHIEV_SHARE_THE_LOVE); + uiStampedeTimer = 10*IN_MILLISECONDS; + uiWhirlingSlashTimer = 21*IN_MILLISECONDS; + uiPunctureTimer = 10*IN_MILLISECONDS; + uiEnrageTimer = 15*IN_MILLISECONDS; + uiImpalingChargeTimer = 21*IN_MILLISECONDS; + uiStompTimer = 25*IN_MILLISECONDS; + uiTransformationTimer = 9*IN_MILLISECONDS; + uiPhaseCounter = 0; - AchievementEntry const *achievWhatTheEck = GetAchievementStore()->LookupEntry(ACHIEV_WHAT_THE_ECK); - if (achievWhatTheEck) - { - Map::PlayerList const &players = pInstance->instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - if (itr->getSource()->HasAura(SPELL_ECK_RESIDUE)) - itr->getSource()->CompletedAchievement(achievWhatTheEck); - } + lImpaledPlayers.clear(); + + bStartOfTransformation = true; + + Phase = TROLL; + + me->SetDisplayId(DISPLAY_TROLL); + + if (pInstance) + pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + switch (Phase) + { + case TROLL: + if (uiPhaseCounter == 2) + { + if (uiTransformationTimer <= diff) + { + me->SetDisplayId(DISPLAY_RHINO); + Phase = RHINO; + uiPhaseCounter = 0; + DoScriptText(SAY_TRANSFORM_1, me); + uiTransformationTimer = 5*IN_MILLISECONDS; + bStartOfTransformation = true; + me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_AGGRESSIVE); + } + else + { + uiTransformationTimer -= diff; + + if (bStartOfTransformation) + { + bStartOfTransformation = false; + me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); + } + } + } + else + { + if (uiStampedeTimer <= diff) + { + DoCast(me, SPELL_STAMPEDE); + DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),me); + uiStampedeTimer = 15*IN_MILLISECONDS; + } else uiStampedeTimer -= diff; + + if (uiWhirlingSlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLING_SLASH); + uiWhirlingSlashTimer = 21*IN_MILLISECONDS; + ++uiPhaseCounter; + } else uiWhirlingSlashTimer -= diff; + } + break; + case RHINO: + if (uiPhaseCounter == 2) + { + if (uiTransformationTimer <= diff) + { + me->SetDisplayId(DISPLAY_TROLL); + Phase = TROLL; + uiPhaseCounter = 0; + DoScriptText(SAY_TRANSFORM_2, me); + uiTransformationTimer = 9*IN_MILLISECONDS; + bStartOfTransformation = true; + me->clearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_AGGRESSIVE); + } + else + { + uiTransformationTimer -= diff; + + if (bStartOfTransformation) + { + bStartOfTransformation = false; + me->addUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->SetReactState(REACT_PASSIVE); + } + } + } + else + { + if (uiPunctureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_PUNCTURE); + uiPunctureTimer = 8*IN_MILLISECONDS; + } else uiPunctureTimer -= diff; + + if (uiEnrageTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ENRAGE); + uiEnrageTimer = 20*IN_MILLISECONDS; + } else uiEnrageTimer -= diff; + + if (uiStompTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STOMP); + uiStompTimer = 20*IN_MILLISECONDS; + } else uiStompTimer -= diff; + + if (uiImpalingChargeTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoCast(pTarget, SPELL_IMPALING_CHARGE); + lImpaledPlayers.insert(pTarget->GetGUID()); + } + uiImpalingChargeTimer = 31*IN_MILLISECONDS; + ++uiPhaseCounter; + } else uiImpalingChargeTimer -= diff; + } + break; } - pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE); + DoMeleeAttackIfReady(); } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (IsHeroic()) + { + if (lImpaledPlayers.size() == 5) + pInstance->DoCompleteAchievement(ACHIEV_SHARE_THE_LOVE); + + AchievementEntry const *achievWhatTheEck = GetAchievementStore()->LookupEntry(ACHIEV_WHAT_THE_ECK); + if (achievWhatTheEck) + { + Map::PlayerList const &players = pInstance->instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (itr->getSource()->HasAura(SPELL_ECK_RESIDUE)) + itr->getSource()->CompletedAchievement(achievWhatTheEck); + } + } + + pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE); + } + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_gal_darah(Creature* pCreature) -{ - return new boss_gal_darahAI (pCreature); -} void AddSC_boss_gal_darah() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gal_darah"; - newscript->GetAI = &GetAI_boss_gal_darah; - newscript->RegisterSelf(); + new boss_gal_darah(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp index 7a9278b2fde..4aa8bac0cb5 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_moorabi.cpp @@ -47,128 +47,130 @@ enum eSays SAY_QUAKE = -1604016, EMOTE_TRANSFORM = -1604017 }; - -struct boss_moorabiAI : public ScriptedAI + class boss_moorabi : public CreatureScript { - boss_moorabiAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_moorabi() : CreatureScript("boss_moorabi") { } + + CreatureAI* GetAI(Creature *pCreature) { - pInstance = pCreature->GetInstanceData(); + return new boss_moorabiAI(pCreature); } - ScriptedInstance* pInstance; - - bool bPhase; - - uint32 uiNumblingShoutTimer; - uint32 uiGroundTremorTimer; - uint32 uiDeterminedStabTimer; - uint32 uiTransformationTImer; - - void Reset() + struct boss_moorabiAI : public ScriptedAI { - uiGroundTremorTimer = 18*IN_MILLISECONDS; - uiNumblingShoutTimer = 10*IN_MILLISECONDS; - uiDeterminedStabTimer = 20*IN_MILLISECONDS; - uiTransformationTImer = 12*IN_MILLISECONDS; - bPhase = false; - - if (pInstance) - pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_MOJO_FRENZY, true); - - if (pInstance) - pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!bPhase && me->HasAura(SPELL_TRANSFORMATION)) + boss_moorabiAI(Creature* pCreature) : ScriptedAI(pCreature) { - bPhase = true; - me->RemoveAura(SPELL_MOJO_FRENZY); + pInstance = pCreature->GetInstanceScript(); } - if (uiGroundTremorTimer <= uiDiff) + InstanceScript* pInstance; + + bool bPhase; + + uint32 uiNumblingShoutTimer; + uint32 uiGroundTremorTimer; + uint32 uiDeterminedStabTimer; + uint32 uiTransformationTImer; + + void Reset() { - DoScriptText(SAY_QUAKE, me); - if (bPhase) - DoCast(me->getVictim(), SPELL_QUAKE, true); - else - DoCast(me->getVictim(), SPELL_GROUND_TREMOR, true); - uiGroundTremorTimer = 10*IN_MILLISECONDS; - } else uiGroundTremorTimer -= uiDiff; + uiGroundTremorTimer = 18*IN_MILLISECONDS; + uiNumblingShoutTimer = 10*IN_MILLISECONDS; + uiDeterminedStabTimer = 20*IN_MILLISECONDS; + uiTransformationTImer = 12*IN_MILLISECONDS; + bPhase = false; - if (uiNumblingShoutTimer <= uiDiff) - { - if (bPhase) - DoCast(me->getVictim(), SPELL_NUMBING_ROAR, true); - else - DoCast(me->getVictim(), SPELL_NUMBING_SHOUT, true); - uiNumblingShoutTimer = 10*IN_MILLISECONDS; - } else uiNumblingShoutTimer -=uiDiff; - - if (uiDeterminedStabTimer <= uiDiff) - { - if (bPhase) - DoCast(me->getVictim(), SPELL_DETERMINED_GORE); - else - DoCast(me->getVictim(), SPELL_DETERMINED_STAB, true); - uiDeterminedStabTimer = 8*IN_MILLISECONDS; - } else uiDeterminedStabTimer -=uiDiff; - - if (!bPhase && uiTransformationTImer <= uiDiff) - { - DoScriptText(EMOTE_TRANSFORM, me); - DoScriptText(SAY_TRANSFORM, me); - DoCast(me, SPELL_TRANSFORMATION, false); - uiTransformationTImer = 10*IN_MILLISECONDS; - } else uiTransformationTImer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - { - pInstance->SetData(DATA_MOORABI_EVENT, DONE); - - if (IsHeroic() && !bPhase) - pInstance->DoCompleteAchievement(ACHIEV_LESS_RABI); + if (pInstance) + pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED); } - } - void KilledUnit(Unit* pVictim) - { - if (pVictim == me) - return; + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + DoCast(me, SPELL_MOJO_FRENZY, true); + + if (pInstance) + pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bPhase && me->HasAura(SPELL_TRANSFORMATION)) + { + bPhase = true; + me->RemoveAura(SPELL_MOJO_FRENZY); + } + + if (uiGroundTremorTimer <= uiDiff) + { + DoScriptText(SAY_QUAKE, me); + if (bPhase) + DoCast(me->getVictim(), SPELL_QUAKE, true); + else + DoCast(me->getVictim(), SPELL_GROUND_TREMOR, true); + uiGroundTremorTimer = 10*IN_MILLISECONDS; + } else uiGroundTremorTimer -= uiDiff; + + if (uiNumblingShoutTimer <= uiDiff) + { + if (bPhase) + DoCast(me->getVictim(), SPELL_NUMBING_ROAR, true); + else + DoCast(me->getVictim(), SPELL_NUMBING_SHOUT, true); + uiNumblingShoutTimer = 10*IN_MILLISECONDS; + } else uiNumblingShoutTimer -=uiDiff; + + if (uiDeterminedStabTimer <= uiDiff) + { + if (bPhase) + DoCast(me->getVictim(), SPELL_DETERMINED_GORE); + else + DoCast(me->getVictim(), SPELL_DETERMINED_STAB, true); + uiDeterminedStabTimer = 8*IN_MILLISECONDS; + } else uiDeterminedStabTimer -=uiDiff; + + if (!bPhase && uiTransformationTImer <= uiDiff) + { + DoScriptText(EMOTE_TRANSFORM, me); + DoScriptText(SAY_TRANSFORM, me); + DoCast(me, SPELL_TRANSFORMATION, false); + uiTransformationTImer = 10*IN_MILLISECONDS; + } else uiTransformationTImer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + pInstance->SetData(DATA_MOORABI_EVENT, DONE); + + if (IsHeroic() && !bPhase) + pInstance->DoCompleteAchievement(ACHIEV_LESS_RABI); + } + } + + void KilledUnit(Unit* pVictim) + { + if (pVictim == me) + return; + + DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_moorabi(Creature *pCreature) -{ - return new boss_moorabiAI(pCreature); -} void AddSC_boss_moorabi() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_moorabi"; - newscript->GetAI = &GetAI_boss_moorabi; - newscript->RegisterSelf(); + new boss_moorabi(); } diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 47a55440b92..13f0a722bf2 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -64,202 +64,210 @@ static Position SpawnLoc[]= {1765.66, 646.542, 134.02, 5.11381}, {1716.76, 635.159, 129.282, 0.191986} }; - -struct boss_slad_ranAI : public ScriptedAI + class boss_slad_ran : public CreatureScript { - boss_slad_ranAI(Creature *c) : ScriptedAI(c), lSummons(me) +public: + boss_slad_ran() : CreatureScript("boss_slad_ran") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_slad_ranAI (pCreature); } - uint32 uiPoisonNovaTimer; - uint32 uiPowerfullBiteTimer; - uint32 uiVenomBoltTimer; - uint32 uiSpawnTimer; - - uint8 uiPhase; - - SummonList lSummons; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_slad_ranAI : public ScriptedAI { - uiPoisonNovaTimer = 10*IN_MILLISECONDS; - uiPowerfullBiteTimer = 3*IN_MILLISECONDS; - uiVenomBoltTimer = 15*IN_MILLISECONDS; - uiSpawnTimer = 5*IN_MILLISECONDS; - uiPhase = 0; - - lSummons.DespawnAll(); - - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiPoisonNovaTimer <= diff) + boss_slad_ranAI(Creature *c) : ScriptedAI(c), lSummons(me) { - DoCast(me->getVictim(), SPELL_POISON_NOVA); - uiPoisonNovaTimer = 15*IN_MILLISECONDS; - } else uiPoisonNovaTimer -= diff; + pInstance = c->GetInstanceScript(); + } - if (uiPowerfullBiteTimer <= diff) - { - DoCast(me->getVictim(), SPELL_POWERFULL_BITE); - uiPowerfullBiteTimer = 10*IN_MILLISECONDS; - } else uiPowerfullBiteTimer -= diff; + uint32 uiPoisonNovaTimer; + uint32 uiPowerfullBiteTimer; + uint32 uiVenomBoltTimer; + uint32 uiSpawnTimer; - if (uiVenomBoltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_VENOM_BOLT); - uiVenomBoltTimer = 10*IN_MILLISECONDS; - } else uiVenomBoltTimer -= diff; + uint8 uiPhase; - if (uiPhase) + SummonList lSummons; + + InstanceScript* pInstance; + + void Reset() { - if (uiSpawnTimer <= diff) + uiPoisonNovaTimer = 10*IN_MILLISECONDS; + uiPowerfullBiteTimer = 3*IN_MILLISECONDS; + uiVenomBoltTimer = 15*IN_MILLISECONDS; + uiSpawnTimer = 5*IN_MILLISECONDS; + uiPhase = 0; + + lSummons.DespawnAll(); + + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiPoisonNovaTimer <= diff) { - if (uiPhase == 1) - for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) - me->SummonCreature(CREATURE_SNAKE, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); - if (uiPhase == 2) - for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) - me->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); - uiSpawnTimer = 5*IN_MILLISECONDS; - } else uiSpawnTimer -= diff; + DoCast(me->getVictim(), SPELL_POISON_NOVA); + uiPoisonNovaTimer = 15*IN_MILLISECONDS; + } else uiPoisonNovaTimer -= diff; + + if (uiPowerfullBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_POWERFULL_BITE); + uiPowerfullBiteTimer = 10*IN_MILLISECONDS; + } else uiPowerfullBiteTimer -= diff; + + if (uiVenomBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VENOM_BOLT); + uiVenomBoltTimer = 10*IN_MILLISECONDS; + } else uiVenomBoltTimer -= diff; + + if (uiPhase) + { + if (uiSpawnTimer <= diff) + { + if (uiPhase == 1) + for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) + me->SummonCreature(CREATURE_SNAKE, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); + if (uiPhase == 2) + for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i) + me->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN,20*IN_MILLISECONDS); + uiSpawnTimer = 5*IN_MILLISECONDS; + } else uiSpawnTimer -= diff; + } + + if (uiPhase == 0 && HealthBelowPct(30)) + { + DoScriptText(SAY_SUMMON_SNAKES,me); + uiPhase = 1; + } + + if (uiPhase == 1 && HealthBelowPct(25)) + { + DoScriptText(SAY_SUMMON_CONSTRICTORS,me); + uiPhase = 2; + } + + DoMeleeAttackIfReady(); } - if (uiPhase == 0 && HealthBelowPct(30)) + void JustDied(Unit* /*killer*/) { - DoScriptText(SAY_SUMMON_SNAKES,me); - uiPhase = 1; + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE); } - if (uiPhase == 1 && HealthBelowPct(25)) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(SAY_SUMMON_CONSTRICTORS,me); - uiPhase = 2; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - void JustSummoned(Creature* summoned) - { - summoned->GetMotionMaster()->MovePoint(0,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ()); - lSummons.Summon(summoned); - } -}; - -struct mob_slad_ran_constrictorAI : public ScriptedAI -{ - mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {} - - uint32 uiGripOfSladRanTimer; - - void Reset() - { - uiGripOfSladRanTimer = 1*IN_MILLISECONDS; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - if (uiGripOfSladRanTimer <= diff) + void JustSummoned(Creature* summoned) { - DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); - uiGripOfSladRanTimer = 5*IN_MILLISECONDS; - } else uiGripOfSladRanTimer -= diff; - } + summoned->GetMotionMaster()->MovePoint(0,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ()); + lSummons.Summon(summoned); + } + }; - ScriptedInstance* pInstance; }; - -struct mob_slad_ran_viperAI : public ScriptedAI + class mob_slad_ran_constrictor : public CreatureScript { - mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {} +public: + mob_slad_ran_constrictor() : CreatureScript("mob_slad_ran_constrictor") { } - uint32 uiVenomousBiteTimer; - - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiVenomousBiteTimer = 2*IN_MILLISECONDS; + return new mob_slad_ran_constrictorAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_slad_ran_constrictorAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {} - if (uiVenomousBiteTimer <= diff) + uint32 uiGripOfSladRanTimer; + + void Reset() { - DoCast(me->getVictim(), SPELL_VENOMOUS_BITE); - uiVenomousBiteTimer = 10*IN_MILLISECONDS; - } else uiVenomousBiteTimer -= diff; + uiGripOfSladRanTimer = 1*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + if (uiGripOfSladRanTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GRIP_OF_SLAD_RAN); + uiGripOfSladRanTimer = 5*IN_MILLISECONDS; + } else uiGripOfSladRanTimer -= diff; + } + + InstanceScript* pInstance; + }; + +}; + class mob_slad_ran_viper : public CreatureScript +{ +public: + mob_slad_ran_viper() : CreatureScript("mob_slad_ran_viper") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_slad_ran_viperAI (pCreature); } + + struct mob_slad_ran_viperAI : public ScriptedAI + { + mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiVenomousBiteTimer; + + InstanceScript* pInstance; + + void Reset() + { + uiVenomousBiteTimer = 2*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiVenomousBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_VENOMOUS_BITE); + uiVenomousBiteTimer = 10*IN_MILLISECONDS; + } else uiVenomousBiteTimer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_slad_ran(Creature* pCreature) -{ - return new boss_slad_ranAI (pCreature); -} -CreatureAI* GetAI_mob_slad_ran_constrictor(Creature* pCreature) -{ - return new mob_slad_ran_constrictorAI (pCreature); -} -CreatureAI* GetAI_mob_slad_ran_viper(Creature* pCreature) -{ - return new mob_slad_ran_viperAI (pCreature); -} void AddSC_boss_slad_ran() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_slad_ran"; - newscript->GetAI = &GetAI_boss_slad_ran; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_slad_ran_constrictor"; - newscript->GetAI = &GetAI_mob_slad_ran_constrictor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_slad_ran_viper"; - newscript->GetAI = &GetAI_mob_slad_ran_viper; - newscript->RegisterSelf(); + new boss_slad_ran(); + new mob_slad_ran_constrictor(); + new mob_slad_ran_viper(); } diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 63bbb3f2f8b..ef9c45246ec 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -27,509 +27,514 @@ 3 - Gal'Darah 4 - Eck the Ferocious */ - -struct instance_gundrak : public ScriptedInstance + class instance_gundrak : public InstanceMapScript { - instance_gundrak(Map* pMap) : ScriptedInstance(pMap) +public: + instance_gundrak() : InstanceMapScript("instance_gundrak") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - bHeroicMode = pMap->IsHeroic(); - Initialize(); - }; - - bool bHeroicMode; - bool spawnSupport; - - uint32 timer; - uint32 phase; - uint64 toActivate; - - uint64 uiSladRan; - uint64 uiMoorabi; - uint64 uiDrakkariColossus; - uint64 uiGalDarah; - uint64 uiEckTheFerocious; - - uint64 uiSladRanAltar; - uint64 uiMoorabiAltar; - uint64 uiDrakkariColossusAltar; - uint64 uiSladRanStatue; - uint64 uiMoorabiStatue; - uint64 uiDrakkariColossusStatue; - uint64 uiGalDarahStatue; - uint64 uiEckTheFerociousDoor; - uint64 uiEckTheFerociousDoorBehind; - uint64 uiGalDarahDoor1; - uint64 uiGalDarahDoor2; - uint64 uiBridge; - uint64 uiCollision; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - GOState uiSladRanStatueState; - GOState uiMoorabiStatueState; - GOState uiDrakkariColossusStatueState; - GOState uiGalDarahStatueState; - GOState uiBridgeState; - GOState uiCollisionState; - - std::set DwellerGUIDs; - - std::string str_data; - - void Initialize() - { - spawnSupport = false; - - timer = 0; - phase = 0; - toActivate = 0; - - uiSladRan = 0; - uiMoorabi = 0; - uiDrakkariColossus = 0; - uiGalDarah = 0; - uiEckTheFerocious = 0; - - uiSladRanAltar = 0; - uiMoorabiAltar = 0; - uiDrakkariColossusAltar = 0; - - uiSladRanStatue = 0; - uiMoorabiStatue = 0; - uiDrakkariColossusStatue = 0; - uiGalDarahStatue = 0; - - uiEckTheFerociousDoor = 0; - uiEckTheFerociousDoorBehind = 0; - uiGalDarahDoor1 = 0; - uiGalDarahDoor2 = 0; - - uiBridge = 0; - uiCollision = 0; - - uiSladRanStatueState = GO_STATE_ACTIVE; - uiMoorabiStatueState = GO_STATE_ACTIVE; - uiDrakkariColossusStatueState = GO_STATE_ACTIVE; - uiGalDarahStatueState = GO_STATE_READY; - uiBridgeState = GO_STATE_ACTIVE; - uiCollisionState = GO_STATE_READY; - - DwellerGUIDs.clear(); - - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + return new instance_gundrak_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_gundrak_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_gundrak_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + bHeroicMode = pMap->IsHeroic(); + Initialize(); + }; + bool bHeroicMode; + bool spawnSupport; + + uint32 timer; + uint32 phase; + uint64 toActivate; + + uint64 uiSladRan; + uint64 uiMoorabi; + uint64 uiDrakkariColossus; + uint64 uiGalDarah; + uint64 uiEckTheFerocious; + + uint64 uiSladRanAltar; + uint64 uiMoorabiAltar; + uint64 uiDrakkariColossusAltar; + uint64 uiSladRanStatue; + uint64 uiMoorabiStatue; + uint64 uiDrakkariColossusStatue; + uint64 uiGalDarahStatue; + uint64 uiEckTheFerociousDoor; + uint64 uiEckTheFerociousDoorBehind; + uint64 uiGalDarahDoor1; + uint64 uiGalDarahDoor2; + uint64 uiBridge; + uint64 uiCollision; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + GOState uiSladRanStatueState; + GOState uiMoorabiStatueState; + GOState uiDrakkariColossusStatueState; + GOState uiGalDarahStatueState; + GOState uiBridgeState; + GOState uiCollisionState; + + std::set DwellerGUIDs; + + std::string str_data; + + void Initialize() + { + spawnSupport = false; + + timer = 0; + phase = 0; + toActivate = 0; + + uiSladRan = 0; + uiMoorabi = 0; + uiDrakkariColossus = 0; + uiGalDarah = 0; + uiEckTheFerocious = 0; + + uiSladRanAltar = 0; + uiMoorabiAltar = 0; + uiDrakkariColossusAltar = 0; + + uiSladRanStatue = 0; + uiMoorabiStatue = 0; + uiDrakkariColossusStatue = 0; + uiGalDarahStatue = 0; + + uiEckTheFerociousDoor = 0; + uiEckTheFerociousDoorBehind = 0; + uiGalDarahDoor1 = 0; + uiGalDarahDoor2 = 0; + + uiBridge = 0; + uiCollision = 0; + + uiSladRanStatueState = GO_STATE_ACTIVE; + uiMoorabiStatueState = GO_STATE_ACTIVE; + uiDrakkariColossusStatueState = GO_STATE_ACTIVE; + uiGalDarahStatueState = GO_STATE_READY; + uiBridgeState = GO_STATE_ACTIVE; + uiCollisionState = GO_STATE_READY; + + DwellerGUIDs.clear(); + + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } + + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case CREATURE_SLAD_RAN: uiSladRan = pCreature->GetGUID(); break; + case CREATURE_MOORABI: uiMoorabi = pCreature->GetGUID(); break; + case CREATURE_GALDARAH: uiGalDarah = pCreature->GetGUID(); break; + case CREATURE_DRAKKARICOLOSSUS: uiDrakkariColossus = pCreature->GetGUID(); break; + case CREATURE_ECK: uiEckTheFerocious = pCreature->GetGUID(); break; + case CREATURE_RUIN_DWELLER: + if (pCreature->isAlive()) + DwellerGUIDs.insert(pCreature->GetGUID()); + break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 192518: + uiSladRanAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) + { + if (uiSladRanStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } + } + break; + case 192519: + uiMoorabiAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) + { + if (uiMoorabiStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } + } + break; + case 192520: + uiDrakkariColossusAltar = pGo->GetGUID(); + // Make sure that they start out as unusuable + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (m_auiEncounter[0] == DONE) + { + if (uiDrakkariColossusStatueState == GO_STATE_ACTIVE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + else + { + ++phase; + pGo->SetGoState(GO_STATE_ACTIVE); + } + } + break; + case 192564: + uiSladRanStatue = pGo->GetGUID(); + pGo->SetGoState(uiSladRanStatueState); + break; + case 192565: + uiMoorabiStatue = pGo->GetGUID(); + pGo->SetGoState(uiMoorabiStatueState); + break; + case 192566: + uiGalDarahStatue = pGo->GetGUID(); + pGo->SetGoState(uiGalDarahStatueState); + break; + case 192567: + uiDrakkariColossusStatue = pGo->GetGUID(); + pGo->SetGoState(uiDrakkariColossusStatueState); + break; + case 192632: + uiEckTheFerociousDoor = pGo->GetGUID(); + if (bHeroicMode && m_auiEncounter[1] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 192569: + uiEckTheFerociousDoorBehind = pGo->GetGUID(); + if (bHeroicMode && m_auiEncounter[4] == DONE) + HandleGameObject(NULL,true,pGo); + case 193208: + uiGalDarahDoor1 = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 193209: + uiGalDarahDoor2 = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(NULL,true,pGo); + break; + case 193188: + uiBridge = pGo->GetGUID(); + pGo->SetGoState(uiBridgeState); + break; + case 192633: + uiCollision = pGo->GetGUID(); + pGo->SetGoState(uiCollisionState); + + // Can't spawn here with SpawnGameObject because pGo isn't added to world yet... + if (uiCollisionState == GO_STATE_ACTIVE_ALTERNATIVE) + spawnSupport = true; + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_SLAD_RAN_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiSladRanAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + } + break; + case DATA_MOORABI_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiMoorabiAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + if (bHeroicMode) + HandleGameObject(uiEckTheFerociousDoor,true); + } + break; + case DATA_DRAKKARI_COLOSSUS_EVENT: + m_auiEncounter[2] = data; + if (data == DONE) + { + GameObject* pGo = instance->GetGameObject(uiDrakkariColossusAltar); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + } + break; + case DATA_GAL_DARAH_EVENT: + m_auiEncounter[3] = data; + if (data == DONE) + { + HandleGameObject(uiGalDarahDoor1,true); + HandleGameObject(uiGalDarahDoor2,true); + } + break; + case DATA_ECK_THE_FEROCIOUS_EVENT: + m_auiEncounter[4] = data; + if (bHeroicMode && data == DONE) + HandleGameObject(uiEckTheFerociousDoorBehind,true); + break; + } + + if (data == DONE) + SaveToDB(); + } + + void SetData64(uint32 type, uint64 data) + { + if (type == DATA_RUIN_DWELLER_DIED) + DwellerGUIDs.erase(data); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_SLAD_RAN_EVENT: return m_auiEncounter[0]; + case DATA_MOORABI_EVENT: return m_auiEncounter[1]; + case DATA_GAL_DARAH_EVENT: return m_auiEncounter[2]; + case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3]; + case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; + case DATA_ALIVE_RUIN_DWELLERS: return DwellerGUIDs.size(); + } + + return 0; + } + + uint64 GetData64(uint32 type) + { + switch(type) + { + case DATA_SLAD_RAN_ALTAR: return uiSladRanAltar; + case DATA_MOORABI_ALTAR: return uiMoorabiAltar; + case DATA_DRAKKARI_COLOSSUS_ALTAR: return uiDrakkariColossusAltar; + case DATA_SLAD_RAN_STATUE: return uiSladRanStatue; + case DATA_MOORABI_STATUE: return uiMoorabiStatue; + case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue; + case DATA_DRAKKARI_COLOSSUS: return uiDrakkariColossus; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " + << (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " " + << (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " " + << (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY); + + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 + >> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10; + + if (dataHead1 == 'G' && dataHead2 == 'D') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + uiSladRanStatueState = GOState(data5); + uiMoorabiStatueState = GOState(data6); + uiDrakkariColossusStatueState = GOState(data7); + uiGalDarahStatueState = GOState(data8); + uiBridgeState = GOState(data9); + uiCollisionState = GOState(data10); + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + bool QueueActivation(uint64 guid, uint32 time) + { + if (timer) + return false; + + toActivate = guid; + timer = time; + phase++; + return true; + } + + void Update(uint32 diff) + { + // Spawn the support for the bridge if necessary + if (spawnSupport) + { + if (GameObject* pCollision = instance->GetGameObject(uiCollision)) + pCollision->SummonGameObject(192743, pCollision->GetPositionX(), pCollision->GetPositionY(), pCollision->GetPositionZ(), pCollision->GetOrientation(), 0, 0, 0, 0, 0); + spawnSupport = false; + } + + // If there is nothing to activate, then return + if (!toActivate) + return; + + if (timer < diff) + { + timer = 0; + if (toActivate == uiBridge) + { + toActivate = 0; + GameObject* pBridge = instance->GetGameObject(uiBridge); + GameObject* pCollision = instance->GetGameObject(uiCollision); + GameObject* pSladRanStatue = instance->GetGameObject(uiSladRanStatue); + GameObject* pMoorabiStatue = instance->GetGameObject(uiMoorabiStatue); + GameObject* pDrakkariColossusStatue = instance->GetGameObject(uiDrakkariColossusStatue); + GameObject* pGalDarahStatue = instance->GetGameObject(uiGalDarahStatue); + + if (pBridge && pCollision && pSladRanStatue && pMoorabiStatue && pDrakkariColossusStatue && pGalDarahStatue) + { + pBridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pCollision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pSladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pMoorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pDrakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + pGalDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + + // Add the GO that solidifies the bridge so you can walk on it + spawnSupport = true; + SaveToDB(); + } + } + else + { + uint32 spell = 0; + GameObject* pAltar = NULL; + if (toActivate == uiSladRanStatue) + { + spell = 57071; + pAltar = instance->GetGameObject(uiSladRanAltar); + } else if (toActivate == uiMoorabiStatue) + { + spell = 57068; + pAltar = instance->GetGameObject(uiMoorabiAltar); + } else if (toActivate == uiDrakkariColossusStatue) + { + spell = 57072; + pAltar = instance->GetGameObject(uiDrakkariColossusAltar); + } + + // This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells + // all are with scripted target for that same ID, it will hit itself. + if (pAltar) + if (Creature* trigger = pAltar->SummonCreature(18721, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ() + 3, pAltar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000)) + { + // Set the trigger model to invisible + trigger->SetDisplayId(11686); + trigger->CastSpell(trigger, spell, false); + } + + if (GameObject* statueGO = instance->GetGameObject(toActivate)) + statueGO->SetGoState(GO_STATE_READY); + + toActivate = 0; + + if (phase == 3) + QueueActivation(uiBridge, 3000); + else + SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance + } + } else timer -= diff; + } + + GOState GetObjState(uint64 guid) + { + if (GameObject* go = instance->GetGameObject(guid)) + return go->GetGoState(); + return GO_STATE_ACTIVE; + } + }; + +}; + class go_gundrak_altar : public GameObjectScript +{ +public: + go_gundrak_altar() : GameObjectScript("go_gundrak_altar") { } + + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) + { + InstanceScript *pInstance = pGO->GetInstanceScript(); + uint64 uiStatue = 0; + + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + + if (pInstance) + { + switch(pGO->GetEntry()) + { + case 192518: uiStatue = pInstance->GetData64(DATA_SLAD_RAN_STATUE); break; + case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break; + case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break; + } + if (CAST_INST(instance_gundrak::instance_gundrak_InstanceMapScript, pInstance)->QueueActivation(uiStatue, 3500)) + { + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + } + return true; + } return false; } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case CREATURE_SLAD_RAN: uiSladRan = pCreature->GetGUID(); break; - case CREATURE_MOORABI: uiMoorabi = pCreature->GetGUID(); break; - case CREATURE_GALDARAH: uiGalDarah = pCreature->GetGUID(); break; - case CREATURE_DRAKKARICOLOSSUS: uiDrakkariColossus = pCreature->GetGUID(); break; - case CREATURE_ECK: uiEckTheFerocious = pCreature->GetGUID(); break; - case CREATURE_RUIN_DWELLER: - if (pCreature->isAlive()) - DwellerGUIDs.insert(pCreature->GetGUID()); - break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case 192518: - uiSladRanAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiSladRanStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else - { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); - } - } - break; - case 192519: - uiMoorabiAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiMoorabiStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else - { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); - } - } - break; - case 192520: - uiDrakkariColossusAltar = pGo->GetGUID(); - // Make sure that they start out as unusuable - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (m_auiEncounter[0] == DONE) - { - if (uiDrakkariColossusStatueState == GO_STATE_ACTIVE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - else - { - ++phase; - pGo->SetGoState(GO_STATE_ACTIVE); - } - } - break; - case 192564: - uiSladRanStatue = pGo->GetGUID(); - pGo->SetGoState(uiSladRanStatueState); - break; - case 192565: - uiMoorabiStatue = pGo->GetGUID(); - pGo->SetGoState(uiMoorabiStatueState); - break; - case 192566: - uiGalDarahStatue = pGo->GetGUID(); - pGo->SetGoState(uiGalDarahStatueState); - break; - case 192567: - uiDrakkariColossusStatue = pGo->GetGUID(); - pGo->SetGoState(uiDrakkariColossusStatueState); - break; - case 192632: - uiEckTheFerociousDoor = pGo->GetGUID(); - if (bHeroicMode && m_auiEncounter[1] == DONE) - HandleGameObject(NULL,true,pGo); - break; - case 192569: - uiEckTheFerociousDoorBehind = pGo->GetGUID(); - if (bHeroicMode && m_auiEncounter[4] == DONE) - HandleGameObject(NULL,true,pGo); - case 193208: - uiGalDarahDoor1 = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL,true,pGo); - break; - case 193209: - uiGalDarahDoor2 = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(NULL,true,pGo); - break; - case 193188: - uiBridge = pGo->GetGUID(); - pGo->SetGoState(uiBridgeState); - break; - case 192633: - uiCollision = pGo->GetGUID(); - pGo->SetGoState(uiCollisionState); - - // Can't spawn here with SpawnGameObject because pGo isn't added to world yet... - if (uiCollisionState == GO_STATE_ACTIVE_ALTERNATIVE) - spawnSupport = true; - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_SLAD_RAN_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiSladRanAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - } - break; - case DATA_MOORABI_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiMoorabiAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - if (bHeroicMode) - HandleGameObject(uiEckTheFerociousDoor,true); - } - break; - case DATA_DRAKKARI_COLOSSUS_EVENT: - m_auiEncounter[2] = data; - if (data == DONE) - { - GameObject* pGo = instance->GetGameObject(uiDrakkariColossusAltar); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - } - break; - case DATA_GAL_DARAH_EVENT: - m_auiEncounter[3] = data; - if (data == DONE) - { - HandleGameObject(uiGalDarahDoor1,true); - HandleGameObject(uiGalDarahDoor2,true); - } - break; - case DATA_ECK_THE_FEROCIOUS_EVENT: - m_auiEncounter[4] = data; - if (bHeroicMode && data == DONE) - HandleGameObject(uiEckTheFerociousDoorBehind,true); - break; - } - - if (data == DONE) - SaveToDB(); - } - - void SetData64(uint32 type, uint64 data) - { - if (type == DATA_RUIN_DWELLER_DIED) - DwellerGUIDs.erase(data); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_SLAD_RAN_EVENT: return m_auiEncounter[0]; - case DATA_MOORABI_EVENT: return m_auiEncounter[1]; - case DATA_GAL_DARAH_EVENT: return m_auiEncounter[2]; - case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3]; - case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4]; - case DATA_ALIVE_RUIN_DWELLERS: return DwellerGUIDs.size(); - } - - return 0; - } - - uint64 GetData64(uint32 type) - { - switch(type) - { - case DATA_SLAD_RAN_ALTAR: return uiSladRanAltar; - case DATA_MOORABI_ALTAR: return uiMoorabiAltar; - case DATA_DRAKKARI_COLOSSUS_ALTAR: return uiDrakkariColossusAltar; - case DATA_SLAD_RAN_STATUE: return uiSladRanStatue; - case DATA_MOORABI_STATUE: return uiMoorabiStatue; - case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue; - case DATA_DRAKKARI_COLOSSUS: return uiDrakkariColossus; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " - << (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " " - << (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " " - << (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY); - - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 - >> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10; - - if (dataHead1 == 'G' && dataHead2 == 'D') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; - uiSladRanStatueState = GOState(data5); - uiMoorabiStatueState = GOState(data6); - uiDrakkariColossusStatueState = GOState(data7); - uiGalDarahStatueState = GOState(data8); - uiBridgeState = GOState(data9); - uiCollisionState = GOState(data10); - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - bool QueueActivation(uint64 guid, uint32 time) - { - if (timer) - return false; - - toActivate = guid; - timer = time; - phase++; - return true; - } - - void Update(uint32 diff) - { - // Spawn the support for the bridge if necessary - if (spawnSupport) - { - if (GameObject* pCollision = instance->GetGameObject(uiCollision)) - pCollision->SummonGameObject(192743, pCollision->GetPositionX(), pCollision->GetPositionY(), pCollision->GetPositionZ(), pCollision->GetOrientation(), 0, 0, 0, 0, 0); - spawnSupport = false; - } - - // If there is nothing to activate, then return - if (!toActivate) - return; - - if (timer < diff) - { - timer = 0; - if (toActivate == uiBridge) - { - toActivate = 0; - GameObject* pBridge = instance->GetGameObject(uiBridge); - GameObject* pCollision = instance->GetGameObject(uiCollision); - GameObject* pSladRanStatue = instance->GetGameObject(uiSladRanStatue); - GameObject* pMoorabiStatue = instance->GetGameObject(uiMoorabiStatue); - GameObject* pDrakkariColossusStatue = instance->GetGameObject(uiDrakkariColossusStatue); - GameObject* pGalDarahStatue = instance->GetGameObject(uiGalDarahStatue); - - if (pBridge && pCollision && pSladRanStatue && pMoorabiStatue && pDrakkariColossusStatue && pGalDarahStatue) - { - pBridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pCollision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pSladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pMoorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pDrakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - pGalDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - - // Add the GO that solidifies the bridge so you can walk on it - spawnSupport = true; - SaveToDB(); - } - } - else - { - uint32 spell = 0; - GameObject* pAltar = NULL; - if (toActivate == uiSladRanStatue) - { - spell = 57071; - pAltar = instance->GetGameObject(uiSladRanAltar); - } else if (toActivate == uiMoorabiStatue) - { - spell = 57068; - pAltar = instance->GetGameObject(uiMoorabiAltar); - } else if (toActivate == uiDrakkariColossusStatue) - { - spell = 57072; - pAltar = instance->GetGameObject(uiDrakkariColossusAltar); - } - - // This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells - // all are with scripted target for that same ID, it will hit itself. - if (pAltar) - if (Creature* trigger = pAltar->SummonCreature(18721, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ() + 3, pAltar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000)) - { - // Set the trigger model to invisible - trigger->SetDisplayId(11686); - trigger->CastSpell(trigger, spell, false); - } - - if (GameObject* statueGO = instance->GetGameObject(toActivate)) - statueGO->SetGoState(GO_STATE_READY); - - toActivate = 0; - - if (phase == 3) - QueueActivation(uiBridge, 3000); - else - SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance - } - } else timer -= diff; - } - - GOState GetObjState(uint64 guid) - { - if (GameObject* go = instance->GetGameObject(guid)) - return go->GetGoState(); - return GO_STATE_ACTIVE; - } }; -bool GOHello_altar(Player * /*pPlayer*/, GameObject *pGO) -{ - ScriptedInstance *pInstance = pGO->GetInstanceData(); - uint64 uiStatue = 0; - - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); - - if (pInstance) - { - switch(pGO->GetEntry()) - { - case 192518: uiStatue = pInstance->GetData64(DATA_SLAD_RAN_STATUE); break; - case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break; - case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break; - } - if (CAST_INST(instance_gundrak, pInstance)->QueueActivation(uiStatue, 3500)) - { - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); - } - return true; - } - return false; -} - -InstanceData* GetInstanceData_instance_gundrak(Map* pMap) -{ - return new instance_gundrak(pMap); -} void AddSC_instance_gundrak() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_gundrak"; - newscript->GetInstanceData = &GetInstanceData_instance_gundrak; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_gundrak_altar"; - newscript->pGOHello = &GOHello_altar; - newscript->RegisterSelf(); + new instance_gundrak(); + new go_gundrak_altar(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp index 567f1f01c4d..4af58272127 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_anubrekhan.cpp @@ -50,137 +50,140 @@ enum { ACHIEV_TIMED_START_EVENT = 9891, }; - -struct boss_anubrekhanAI : public BossAI + class boss_anubrekhan : public CreatureScript { - boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {} +public: + boss_anubrekhan() : CreatureScript("boss_anubrekhan") { } - bool hasTaunted; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); + return new boss_anubrekhanAI (pCreature); + } - hasTaunted = false; + struct boss_anubrekhanAI : public BossAI + { + boss_anubrekhanAI(Creature *c) : BossAI(c, BOSS_ANUBREKHAN) {} - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + bool hasTaunted; + + void Reset() { - Position pos; + _Reset(); - // respawn guard using home position, - // otherwise, after a wipe, they respawn where boss was at wipe moment. - pos = me->GetHomePosition(); - pos.m_positionY -= 10.0f; - me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + hasTaunted = false; - pos = me->GetHomePosition(); - pos.m_positionY += 10.0f; - me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); - } - } - - void KilledUnit(Unit* victim) - { - //Force the player to spawn corpse scarabs via spell, TODO: Check percent chance for scarabs, 20% at the moment - if (!(rand()%5)) - if (victim->GetTypeId() == TYPEID_PLAYER) - victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID()); - - DoScriptText(SAY_SLAY, me); - } - - void JustDied(Unit *) - { - _JustDied(); - - // start achievement timer (kill Maexna within 20 min) - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - events.ScheduleEvent(EVENT_IMPALE, 10000 + rand()%10000); - events.ScheduleEvent(EVENT_LOCUST, 90000); - events.ScheduleEvent(EVENT_BERSERK, 600000); - - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) - events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000)); - } - - void MoveInLineOfSight(Unit *who) - { - if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER) - { - DoScriptText(SAY_GREET, me); - hasTaunted = true; - } - ScriptedAI::MoveInLineOfSight(who); - } - - void SummonedCreatureDespawn(Creature *summon) - { - BossAI::SummonedCreatureDespawn(summon); - - // check if it is an actual killed guard - if (!me->isAlive() || summon->isAlive() || summon->GetEntry() != MOB_CRYPT_GUARD) - return; - - summon->CastSpell(summon, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, NULL, NULL, me->GetGUID()); - } - - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { - case EVENT_IMPALE: - //Cast Impale on a random target - //Do NOT cast it when we are afflicted by locust swarm - if (!me->HasAura(RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25))) - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_IMPALE_10,SPELL_IMPALE_25)); - events.ScheduleEvent(EVENT_IMPALE, urand(10000,20000)); - break; - case EVENT_LOCUST: - // TODO : Add Text - DoCast(me, RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25)); - DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); - events.ScheduleEvent(EVENT_LOCUST, 90000); - break; - case EVENT_SPAWN_GUARDIAN_NORMAL: - // TODO : Add Text - DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - events.ScheduleEvent(EVENT_BERSERK, 600000); - break; + Position pos; + + // respawn guard using home position, + // otherwise, after a wipe, they respawn where boss was at wipe moment. + pos = me->GetHomePosition(); + pos.m_positionY -= 10.0f; + me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); + + pos = me->GetHomePosition(); + pos.m_positionY += 10.0f; + me->SummonCreature(MOB_CRYPT_GUARD, pos, TEMPSUMMON_CORPSE_DESPAWN); } } - DoMeleeAttackIfReady(); - } + void KilledUnit(Unit* victim) + { + //Force the player to spawn corpse scarabs via spell, TODO: Check percent chance for scarabs, 20% at the moment + if (!(rand()%5)) + if (victim->GetTypeId() == TYPEID_PLAYER) + victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCARABS_PLR, true, NULL, NULL, me->GetGUID()); + + DoScriptText(SAY_SLAY, me); + } + + void JustDied(Unit *) + { + _JustDied(); + + // start achievement timer (kill Maexna within 20 min) + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + events.ScheduleEvent(EVENT_IMPALE, 10000 + rand()%10000); + events.ScheduleEvent(EVENT_LOCUST, 90000); + events.ScheduleEvent(EVENT_BERSERK, 600000); + + if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + events.ScheduleEvent(EVENT_SPAWN_GUARDIAN_NORMAL, urand(15000,20000)); + } + + void MoveInLineOfSight(Unit *who) + { + if (!hasTaunted && me->IsWithinDistInMap(who, 60.0f) && who->GetTypeId() == TYPEID_PLAYER) + { + DoScriptText(SAY_GREET, me); + hasTaunted = true; + } + ScriptedAI::MoveInLineOfSight(who); + } + + void SummonedCreatureDespawn(Creature *summon) + { + BossAI::SummonedCreatureDespawn(summon); + + // check if it is an actual killed guard + if (!me->isAlive() || summon->isAlive() || summon->GetEntry() != MOB_CRYPT_GUARD) + return; + + summon->CastSpell(summon, SPELL_SUMMON_CORPSE_SCARABS_MOB, true, NULL, NULL, me->GetGUID()); + } + + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_IMPALE: + //Cast Impale on a random target + //Do NOT cast it when we are afflicted by locust swarm + if (!me->HasAura(RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25))) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_IMPALE_10,SPELL_IMPALE_25)); + events.ScheduleEvent(EVENT_IMPALE, urand(10000,20000)); + break; + case EVENT_LOCUST: + // TODO : Add Text + DoCast(me, RAID_MODE(SPELL_LOCUST_SWARM_10,SPELL_LOCUST_SWARM_25)); + DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_LOCUST, 90000); + break; + case EVENT_SPAWN_GUARDIAN_NORMAL: + // TODO : Add Text + DoSummon(MOB_CRYPT_GUARD, GuardSummonPos, 0, TEMPSUMMON_CORPSE_DESPAWN); + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + events.ScheduleEvent(EVENT_BERSERK, 600000); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_anubrekhan(Creature* pCreature) -{ - return new boss_anubrekhanAI (pCreature); -} void AddSC_boss_anubrekhan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anubrekhan"; - newscript->GetAI = &GetAI_boss_anubrekhan; - newscript->RegisterSelf(); + new boss_anubrekhan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index b6a3760e6b6..a2513e5173a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -56,162 +56,166 @@ enum Achievements ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10 = 1997, ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25 = 2140 }; - -struct boss_faerlinaAI : public BossAI + class boss_faerlina : public CreatureScript { - boss_faerlinaAI(Creature *c) : BossAI(c, BOSS_FAERLINA), greet(false) {} +public: + boss_faerlina() : CreatureScript("boss_faerlina") { } - bool greet; - bool doDelayFrenzy; - bool bAchievement; - - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4), me); - events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); - events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); - events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); + return new boss_faerlinaAI (pCreature); } - void Reset() + struct boss_faerlinaAI : public BossAI { - doDelayFrenzy = false; - bAchievement = true; - _Reset(); - } + boss_faerlinaAI(Creature *c) : BossAI(c, BOSS_FAERLINA), greet(false) {} - void MoveInLineOfSight(Unit *who) - { - if (!greet && who->GetTypeId() == TYPEID_PLAYER) + bool greet; + bool doDelayFrenzy; + bool bAchievement; + + void EnterCombat(Unit * /*who*/) { - DoScriptText(SAY_GREET, me); - greet = true; + _EnterCombat(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4), me); + events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); + events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); + events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); } - BossAI::MoveInLineOfSight(who); - } - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%3)) - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - - if (instance && bAchievement) - instance->DoCompleteAchievement(RAID_MODE(ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10,ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25)); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (doDelayFrenzy && !me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE, H_SPELL_WIDOWS_EMBRACE))) + void Reset() { doDelayFrenzy = false; - DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY), true); + bAchievement = true; + _Reset(); } - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void MoveInLineOfSight(Unit *who) { - switch(eventId) + if (!greet && who->GetTypeId() == TYPEID_PLAYER) { - case EVENT_POISON: - if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) - DoCastAOE(RAID_MODE(SPELL_POISON_BOLT_VOLLEY,H_SPELL_POISON_BOLT_VOLLEY)); - events.ScheduleEvent(EVENT_POISON, urand(8000,15000)); - break; - case EVENT_FIRE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_RAIN_OF_FIRE, H_SPELL_RAIN_OF_FIRE)); - events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); - break; - case EVENT_FRENZY: - // TODO : Add Text - if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) - DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY)); - else - doDelayFrenzy = true; + DoScriptText(SAY_GREET, me); + greet = true; + } + BossAI::MoveInLineOfSight(who); + } - events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); - break; + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%3)) + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + + if (instance && bAchievement) + instance->DoCompleteAchievement(RAID_MODE(ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_10,ACHIEVEMENT_MOMMA_SAID_KNOCK_YOU_OUT_25)); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (doDelayFrenzy && !me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE, H_SPELL_WIDOWS_EMBRACE))) + { + doDelayFrenzy = false; + DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY), true); + } + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_POISON: + if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) + DoCastAOE(RAID_MODE(SPELL_POISON_BOLT_VOLLEY,H_SPELL_POISON_BOLT_VOLLEY)); + events.ScheduleEvent(EVENT_POISON, urand(8000,15000)); + break; + case EVENT_FIRE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_RAIN_OF_FIRE, H_SPELL_RAIN_OF_FIRE)); + events.ScheduleEvent(EVENT_FIRE, urand(6000,18000)); + break; + case EVENT_FRENZY: + // TODO : Add Text + if (!me->HasAura(RAID_MODE(SPELL_WIDOWS_EMBRACE,H_SPELL_WIDOWS_EMBRACE))) + DoCast(me, RAID_MODE(SPELL_FRENZY, H_SPELL_FRENZY)); + else + doDelayFrenzy = true; + + events.ScheduleEvent(EVENT_FRENZY, urand(60000,80000)); + break; + } + } + + DoMeleeAttackIfReady(); + } + + void SpellHit(Unit* caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_WIDOWS_EMBRACE || spell->Id == H_SPELL_WIDOWS_EMBRACE) + { + // TODO : Add Text + bAchievement = false; + doDelayFrenzy = true; + me->Kill(caster); + } + } + }; + +}; + + class mob_faerlina_add : public CreatureScript +{ +public: + mob_faerlina_add() : CreatureScript("mob_faerlina_add") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_faerlina_addAI (pCreature); + } + + struct mob_faerlina_addAI : public ScriptedAI + { + mob_faerlina_addAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void Reset() + { + if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); } } - DoMeleeAttackIfReady(); - } - - void SpellHit(Unit* caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_WIDOWS_EMBRACE || spell->Id == H_SPELL_WIDOWS_EMBRACE) + void JustDied(Unit * /*killer*/) { - // TODO : Add Text - bAchievement = false; - doDelayFrenzy = true; - me->Kill(caster); + if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + { + if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) + DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); + } } - } + }; + }; -CreatureAI* GetAI_boss_faerlina(Creature* pCreature) -{ - return new boss_faerlinaAI (pCreature); -} - -struct mob_faerlina_addAI : public ScriptedAI -{ - mob_faerlina_addAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - void Reset() - { - if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) { - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, SPELL_EFFECT_BIND, true); - me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_CHARM, true); - } - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance && getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) - { - if (Creature *pFaerlina = pInstance->instance->GetCreature(pInstance->GetData64(DATA_FAERLINA))) - DoCast(pFaerlina, SPELL_WIDOWS_EMBRACE); - } - } -}; - -CreatureAI* GetAI_mob_faerlina_add(Creature* pCreature) -{ - return new mob_faerlina_addAI (pCreature); -} void AddSC_boss_faerlina() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_faerlina"; - newscript->GetAI = &GetAI_boss_faerlina; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_faerlina_add"; - newscript->GetAI = &GetAI_mob_faerlina_add; - newscript->RegisterSelf(); + new boss_faerlina(); + new mob_faerlina_add(); } - - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 0313f9eb893..73647bc4f21 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -76,323 +76,325 @@ const int32 SAY_DEATH[] = {-1533057, -1533050, -1533074, -1533064}; #define SAY_BARON_AGGRO RAND(-1533065,-1533066,-1533067) #define SAY_BARON_SLAY RAND(-1533068,-1533069) - -struct boss_four_horsemenAI : public BossAI + class boss_four_horsemen : public CreatureScript { - boss_four_horsemenAI(Creature *c) : BossAI(c, BOSS_HORSEMEN) +public: + boss_four_horsemen() : CreatureScript("boss_four_horsemen") { } + + CreatureAI* GetAI(Creature* pCreature) const { - id = Horsemen(0); - for (uint8 i = 0; i < 4; ++i) - if (me->GetEntry() == MOB_HORSEMEN[i]) - id = Horsemen(i); - caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); + return new boss_four_horsemenAI (pCreature); } - Horsemen id; - uint64 uiEventStarterGUID; - uint8 nextWP; - uint32 punishTimer; - bool caster; - bool nextMovementStarted; - bool movementCompleted; - bool movementStarted; - bool encounterActionAttack; - bool encounterActionReset; - bool doDelayPunish; - - void Reset() + struct boss_four_horsemenAI : public BossAI { - if (!encounterActionReset) - DoEncounterAction(NULL, false, true, false); - - if (instance) - instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED); - - me->SetReactState(REACT_AGGRESSIVE); - uiEventStarterGUID = 0; - nextWP = 0; - punishTimer = 2000; - nextMovementStarted = false; - movementCompleted = false; - movementStarted = false; - encounterActionAttack = false; - encounterActionReset = false; - doDelayPunish = false; - _Reset(); - } - - bool DoEncounterAction(Unit *who, bool attack, bool reset, bool checkAllDead) - { - if (!instance) - return false; - - Creature *Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); - Creature *Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); - Creature *Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); - Creature *Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); - - if (Thane && Lady && Baron && Sir) + boss_four_horsemenAI(Creature *c) : BossAI(c, BOSS_HORSEMEN) { - if (attack && who) - { - CAST_AI(boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; - CAST_AI(boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; - - CAST_AI(boss_four_horsemenAI, Thane->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Lady->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Baron->AI())->AttackStart(who); - CAST_AI(boss_four_horsemenAI, Sir->AI())->AttackStart(who); - } - - if (reset) - { - if (instance->GetBossState(BOSS_HORSEMEN) != NOT_STARTED) - { - if (!Thane->isAlive()) - Thane->Respawn(); - - if (!Lady->isAlive()) - Lady->Respawn(); - - if (!Baron->isAlive()) - Baron->Respawn(); - - if (!Sir->isAlive()) - Sir->Respawn(); - - CAST_AI(boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; - CAST_AI(boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; - - CAST_AI(boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); - CAST_AI(boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); - } - } - - if (checkAllDead) - return !Thane->isAlive() && !Lady->isAlive() && !Baron->isAlive() && !Sir->isAlive(); + id = Horsemen(0); + for (uint8 i = 0; i < 4; ++i) + if (me->GetEntry() == MOB_HORSEMEN[i]) + id = Horsemen(i); + caster = (id == HORSEMEN_LADY || id == HORSEMEN_SIR); } - return false; - } - void BeginFourHorsemenMovement() - { - movementStarted = true; - me->SetReactState(REACT_PASSIVE); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); + Horsemen id; + uint64 uiEventStarterGUID; + uint8 nextWP; + uint32 punishTimer; + bool caster; + bool nextMovementStarted; + bool movementCompleted; + bool movementStarted; + bool encounterActionAttack; + bool encounterActionReset; + bool doDelayPunish; - switch(id) + void Reset() { - case HORSEMEN_THANE: - me->GetMotionMaster()->MovePoint(0, WaypointPositions[0]); - break; - case HORSEMEN_LADY: - me->GetMotionMaster()->MovePoint(3, WaypointPositions[3]); - break; - case HORSEMEN_BARON: - me->GetMotionMaster()->MovePoint(6, WaypointPositions[6]); - break; - case HORSEMEN_SIR: - me->GetMotionMaster()->MovePoint(9, WaypointPositions[9]); - break; - } - } + if (!encounterActionReset) + DoEncounterAction(NULL, false, true, false); - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + if (instance) + instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED); - if (id == 2 || id == 5 || id == 8 || id == 11) - { - movementCompleted = true; me->SetReactState(REACT_AGGRESSIVE); + uiEventStarterGUID = 0; + nextWP = 0; + punishTimer = 2000; + nextMovementStarted = false; + movementCompleted = false; + movementStarted = false; + encounterActionAttack = false; + encounterActionReset = false; + doDelayPunish = false; + _Reset(); + } - Unit *eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); + bool DoEncounterAction(Unit *who, bool attack, bool reset, bool checkAllDead) + { + if (!instance) + return false; - if (eventStarter && me->canAttack(eventStarter)) - AttackStart(eventStarter); - else if (!UpdateVictim()) + Creature *Thane = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_THANE))); + Creature *Lady = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_LADY))); + Creature *Baron = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_BARON))); + Creature *Sir = CAST_CRE(Unit::GetUnit(*me, instance->GetData64(DATA_SIR))); + + if (Thane && Lady && Baron && Sir) { - EnterEvadeMode(); + if (attack && who) + { + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionAttack = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionAttack = true; + + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->AttackStart(who); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->AttackStart(who); + } + + if (reset) + { + if (instance->GetBossState(BOSS_HORSEMEN) != NOT_STARTED) + { + if (!Thane->isAlive()) + Thane->Respawn(); + + if (!Lady->isAlive()) + Lady->Respawn(); + + if (!Baron->isAlive()) + Baron->Respawn(); + + if (!Sir->isAlive()) + Sir->Respawn(); + + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->encounterActionReset = true; + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->encounterActionReset = true; + + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Thane->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Lady->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Baron->AI())->EnterEvadeMode(); + CAST_AI(boss_four_horsemen::boss_four_horsemenAI, Sir->AI())->EnterEvadeMode(); + } + } + + if (checkAllDead) + return !Thane->isAlive() && !Lady->isAlive() && !Baron->isAlive() && !Sir->isAlive(); + } + return false; + } + + void BeginFourHorsemenMovement() + { + movementStarted = true; + me->SetReactState(REACT_PASSIVE); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetSpeed(MOVE_RUN, me->GetSpeedRate(MOVE_RUN), true); + + switch(id) + { + case HORSEMEN_THANE: + me->GetMotionMaster()->MovePoint(0, WaypointPositions[0]); + break; + case HORSEMEN_LADY: + me->GetMotionMaster()->MovePoint(3, WaypointPositions[3]); + break; + case HORSEMEN_BARON: + me->GetMotionMaster()->MovePoint(6, WaypointPositions[6]); + break; + case HORSEMEN_SIR: + me->GetMotionMaster()->MovePoint(9, WaypointPositions[9]); + break; + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 2 || id == 5 || id == 8 || id == 11) + { + movementCompleted = true; + me->SetReactState(REACT_AGGRESSIVE); + + Unit *eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); + + if (eventStarter && me->canAttack(eventStarter)) + AttackStart(eventStarter); + else if (!UpdateVictim()) + { + EnterEvadeMode(); + return; + } + + if (caster) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + } + return; } - if (caster) + nextMovementStarted = false; + nextWP = id + 1; + } + + // switch to "who" if nearer than current target. + void SelectNearestTarget(Unit *who) + { + if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + me->AddThreat(who, 1000000.0f); + } + } + + void MoveInLineOfSight(Unit *who) + { + BossAI::MoveInLineOfSight(who); + if (caster) + SelectNearestTarget(who); + } + + void AttackStart(Unit *who) + { + if (!movementCompleted && !movementStarted) + { + uiEventStarterGUID = who->GetGUID(); + BeginFourHorsemenMovement(); + + if (!encounterActionAttack) + DoEncounterAction(who, true, false, false); + } + else if (movementCompleted && movementStarted) + { + if (caster) + me->Attack(who, false); + else + BossAI::AttackStart(who); + } + } + + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%5)) + { + if (id == HORSEMEN_BARON) + DoScriptText(SAY_BARON_SLAY, me); + else + DoScriptText(SAY_SLAY[id], me); + } + } + + void JustDied(Unit* /*killer*/) + { + events.Reset(); + summons.DespawnAll(); + + if (instance) + instance->SetData(DATA_HORSEMEN0 + id, DONE); + + if (instance && DoEncounterAction(NULL, false, false, true)) + { + instance->SetBossState(BOSS_HORSEMEN, DONE); + instance->SaveToDB(); + + // Achievements related to the 4-horsemen are given through spell 59450 which does not exist. + // There is thus no way it can be given by casting the spell on the players. + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450); } - return; + DoScriptText(SAY_DEATH[id], me); } - nextMovementStarted = false; - nextWP = id + 1; - } - - // switch to "who" if nearer than current target. - void SelectNearestTarget(Unit *who) - { - if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) + void EnterCombat(Unit * /*who*/) { - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); - me->AddThreat(who, 1000000.0f); - } - } + _EnterCombat(); - void MoveInLineOfSight(Unit *who) - { - BossAI::MoveInLineOfSight(who); - if (caster) - SelectNearestTarget(who); - } - - void AttackStart(Unit *who) - { - if (!movementCompleted && !movementStarted) - { - uiEventStarterGUID = who->GetGUID(); - BeginFourHorsemenMovement(); - - if (!encounterActionAttack) - DoEncounterAction(who, true, false, false); - } - else if (movementCompleted && movementStarted) - { - if (caster) - me->Attack(who, false); - else - BossAI::AttackStart(who); - } - } - - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - { if (id == HORSEMEN_BARON) - DoScriptText(SAY_BARON_SLAY, me); + DoScriptText(SAY_BARON_AGGRO, me); else - DoScriptText(SAY_SLAY[id], me); - } - } + DoScriptText(SAY_AGGRO[id], me); - void JustDied(Unit* /*killer*/) - { - events.Reset(); - summons.DespawnAll(); - - if (instance) - instance->SetData(DATA_HORSEMEN0 + id, DONE); - - if (instance && DoEncounterAction(NULL, false, false, true)) - { - instance->SetBossState(BOSS_HORSEMEN, DONE); - instance->SaveToDB(); - - // Achievements related to the 4-horsemen are given through spell 59450 which does not exist. - // There is thus no way it can be given by casting the spell on the players. - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450); + events.ScheduleEvent(EVENT_MARK, 15000); + events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000); + events.ScheduleEvent(EVENT_BERSERK, 15*100*1000); } - DoScriptText(SAY_DEATH[id], me); - } - - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - - if (id == HORSEMEN_BARON) - DoScriptText(SAY_BARON_AGGRO, me); - else - DoScriptText(SAY_AGGRO[id], me); - - events.ScheduleEvent(EVENT_MARK, 15000); - events.ScheduleEvent(EVENT_CAST, 20000+rand()%5000); - events.ScheduleEvent(EVENT_BERSERK, 15*100*1000); - } - - void UpdateAI(const uint32 diff) - { - if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted) + void UpdateAI(const uint32 diff) { - nextMovementStarted = true; - me->GetMotionMaster()->MovePoint(nextWP, WaypointPositions[nextWP]); - } - - if (!UpdateVictim() || !CheckInRoom() || !movementCompleted) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + if (nextWP && movementStarted && !movementCompleted && !nextMovementStarted) { - case EVENT_MARK: - if (!(rand()%5)) + nextMovementStarted = true; + me->GetMotionMaster()->MovePoint(nextWP, WaypointPositions[nextWP]); + } + + if (!UpdateVictim() || !CheckInRoom() || !movementCompleted) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_MARK: + if (!(rand()%5)) + DoScriptText(SAY_SPECIAL[id], me); + DoCastAOE(SPELL_MARK[id]); + events.ScheduleEvent(EVENT_MARK, 15000); + break; + case EVENT_CAST: + if (!(rand()%5)) + DoScriptText(SAY_TAUNT[rand()%3][id], me); + + if (caster) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + DoCast(pTarget, SPELL_PRIMARY(id)); + } + else + DoCast(me->getVictim(), SPELL_PRIMARY(id)); + + events.ScheduleEvent(EVENT_CAST, 15000); + break; + case EVENT_BERSERK: DoScriptText(SAY_SPECIAL[id], me); - DoCastAOE(SPELL_MARK[id]); - events.ScheduleEvent(EVENT_MARK, 15000); - break; - case EVENT_CAST: - if (!(rand()%5)) - DoScriptText(SAY_TAUNT[rand()%3][id], me); - - if (caster) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) - DoCast(pTarget, SPELL_PRIMARY(id)); - } - else - DoCast(me->getVictim(), SPELL_PRIMARY(id)); - - events.ScheduleEvent(EVENT_CAST, 15000); - break; - case EVENT_BERSERK: - DoScriptText(SAY_SPECIAL[id], me); - DoCast(me, EVENT_BERSERK); - break; + DoCast(me, EVENT_BERSERK); + break; + } } - } - if (punishTimer <= diff) - { - if (doDelayPunish) + if (punishTimer <= diff) { - DoCastAOE(SPELL_PUNISH[id], true); - doDelayPunish = false; - } - punishTimer = 2000; - } else punishTimer -= diff; + if (doDelayPunish) + { + DoCastAOE(SPELL_PUNISH[id], true); + doDelayPunish = false; + } + punishTimer = 2000; + } else punishTimer -= diff; + + if (!caster) + DoMeleeAttackIfReady(); + else if ((!DoSpellAttackIfReady(SPELL_SECONDARY(id)) || !me->IsWithinLOSInMap(me->getVictim())) && movementCompleted && !doDelayPunish) + doDelayPunish = true; + } + }; - if (!caster) - DoMeleeAttackIfReady(); - else if ((!DoSpellAttackIfReady(SPELL_SECONDARY(id)) || !me->IsWithinLOSInMap(me->getVictim())) && movementCompleted && !doDelayPunish) - doDelayPunish = true; - } }; -CreatureAI* GetAI_four_horsemen(Creature* pCreature) -{ - return new boss_four_horsemenAI (pCreature); -} - void AddSC_boss_four_horsemen() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_four_horsemen"; - newscript->GetAI = &GetAI_four_horsemen; - newscript->RegisterSelf(); + new boss_four_horsemen(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index a91fa207df7..c1fbc4d2d93 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -44,105 +44,107 @@ enum Events }; #define EMOTE_NEARBY " spots a nearby zombie to devour!" - -struct boss_gluthAI : public BossAI + class boss_gluth : public CreatureScript { - boss_gluthAI(Creature *c) : BossAI(c, BOSS_GLUTH) +public: + boss_gluth() : CreatureScript("boss_gluth") { } + + CreatureAI* GetAI(Creature* pCreature) const { - // Do not let Gluth be affected by zombies' debuff - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); + return new boss_gluthAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct boss_gluthAI : public BossAI { - if (who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 7)) + boss_gluthAI(Creature *c) : BossAI(c, BOSS_GLUTH) { - SetGazeOn(who); - // TODO: use a script text - me->MonsterTextEmote(EMOTE_NEARBY, 0, true); + // Do not let Gluth be affected by zombies' debuff + me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true); } - else - BossAI::MoveInLineOfSight(who); - } - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - events.ScheduleEvent(EVENT_WOUND, 10000); - events.ScheduleEvent(EVENT_ENRAGE, 15000); - events.ScheduleEvent(EVENT_DECIMATE, 105000); - events.ScheduleEvent(EVENT_BERSERK, 8*60000); - events.ScheduleEvent(EVENT_SUMMON, 15000); - } - - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == MOB_ZOMBIE) - summon->AI()->AttackStart(me); - summons.Summon(summon); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictimWithGaze() || !CheckInRoom()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void MoveInLineOfSight(Unit *who) { - switch(eventId) + if (who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 7)) { - case EVENT_WOUND: - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - events.ScheduleEvent(EVENT_WOUND, 10000); - break; - case EVENT_ENRAGE: - // TODO : Add missing text - DoCast(me, SPELL_ENRAGE); - events.ScheduleEvent(EVENT_ENRAGE, 15000); - break; - case EVENT_DECIMATE: - // TODO : Add missing text - DoCastAOE(SPELL_DECIMATE); - events.ScheduleEvent(EVENT_DECIMATE, 105000); - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - events.ScheduleEvent(EVENT_BERSERK, 5*60000); - break; - case EVENT_SUMMON: - for (uint32 i = 0; i < RAID_MODE(1,2); ++i) - DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]); - events.ScheduleEvent(EVENT_SUMMON, 10000); - break; + SetGazeOn(who); + // TODO: use a script text + me->MonsterTextEmote(EMOTE_NEARBY, 0, true); } + else + BossAI::MoveInLineOfSight(who); } - if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) + void EnterCombat(Unit * /*who*/) { - if (me->IsWithinMeleeRange(me->getVictim())) - { - me->Kill(me->getVictim()); - me->ModifyHealth(me->GetMaxHealth() * 0.05f); - } + _EnterCombat(); + events.ScheduleEvent(EVENT_WOUND, 10000); + events.ScheduleEvent(EVENT_ENRAGE, 15000); + events.ScheduleEvent(EVENT_DECIMATE, 105000); + events.ScheduleEvent(EVENT_BERSERK, 8*60000); + events.ScheduleEvent(EVENT_SUMMON, 15000); } - else - DoMeleeAttackIfReady(); - } + + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == MOB_ZOMBIE) + summon->AI()->AttackStart(me); + summons.Summon(summon); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictimWithGaze() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_WOUND: + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + events.ScheduleEvent(EVENT_WOUND, 10000); + break; + case EVENT_ENRAGE: + // TODO : Add missing text + DoCast(me, SPELL_ENRAGE); + events.ScheduleEvent(EVENT_ENRAGE, 15000); + break; + case EVENT_DECIMATE: + // TODO : Add missing text + DoCastAOE(SPELL_DECIMATE); + events.ScheduleEvent(EVENT_DECIMATE, 105000); + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + events.ScheduleEvent(EVENT_BERSERK, 5*60000); + break; + case EVENT_SUMMON: + for (uint32 i = 0; i < RAID_MODE(1,2); ++i) + DoSummon(MOB_ZOMBIE, PosSummon[rand()%3]); + events.ScheduleEvent(EVENT_SUMMON, 10000); + break; + } + } + + if (me->getVictim() && me->getVictim()->GetEntry() == MOB_ZOMBIE) + { + if (me->IsWithinMeleeRange(me->getVictim())) + { + me->Kill(me->getVictim()); + me->ModifyHealth(me->GetMaxHealth() * 0.05f); + } + } + else + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_gluth(Creature* pCreature) -{ - return new boss_gluthAI (pCreature); -} void AddSC_boss_gluth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gluth"; - newscript->GetAI = &GetAI_boss_gluth; - newscript->RegisterSelf(); + new boss_gluth(); } - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 4fcf902714c..56f1a216fcd 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -142,442 +142,448 @@ struct NotOnSameSide : public std::unary_function { return (m_inLiveSide != IN_LIVE_SIDE(pTarget)); } }; - -struct boss_gothikAI : public BossAI + class boss_gothik : public CreatureScript { - boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} +public: + boss_gothik() : CreatureScript("boss_gothik") { } - uint32 waveCount; - typedef std::vector TriggerVct; - TriggerVct liveTrigger, deadTrigger; - bool mergedSides; - bool phaseTwo; - bool thirtyPercentReached; - - std::vector LiveTriggerGUID; - std::vector DeadTriggerGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - LiveTriggerGUID.clear(); - DeadTriggerGUID.clear(); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - me->SetReactState(REACT_PASSIVE); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - _Reset(); - mergedSides = false; - phaseTwo = false; - thirtyPercentReached = false; + return new boss_gothikAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_gothikAI : public BossAI { - for (uint32 i = 0; i < POS_LIVE; ++i) - if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) - LiveTriggerGUID.push_back(trigger->GetGUID()); - for (uint32 i = 0; i < POS_DEAD; ++i) - if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) - DeadTriggerGUID.push_back(trigger->GetGUID()); + boss_gothikAI(Creature *c) : BossAI(c, BOSS_GOTHIK) {} - if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) + uint32 waveCount; + typedef std::vector TriggerVct; + TriggerVct liveTrigger, deadTrigger; + bool mergedSides; + bool phaseTwo; + bool thirtyPercentReached; + + std::vector LiveTriggerGUID; + std::vector DeadTriggerGUID; + + void Reset() { - sLog.outError("Script Gothik: cannot summon triggers!"); - EnterEvadeMode(); - return; + LiveTriggerGUID.clear(); + DeadTriggerGUID.clear(); + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + me->SetReactState(REACT_PASSIVE); + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + _Reset(); + mergedSides = false; + phaseTwo = false; + thirtyPercentReached = false; } - _EnterCombat(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - waveCount = 0; - events.ScheduleEvent(EVENT_SUMMON, 30000); - DoTeleportTo(PosPlatform); - DoScriptText(SAY_SPEECH, me); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY); - } - - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == WORLD_TRIGGER) - summon->setActive(true); - else if (!mergedSides) + void EnterCombat(Unit * /*who*/) { - summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); - summon->AI()->EnterEvadeMode(); - } - else - { - summon->AI()->DoAction(0); - summon->AI()->DoZoneInCombat(); - } - summons.Summon(summon); - } + for (uint32 i = 0; i < POS_LIVE; ++i) + if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i])) + LiveTriggerGUID.push_back(trigger->GetGUID()); + for (uint32 i = 0; i < POS_DEAD; ++i) + if (Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i])) + DeadTriggerGUID.push_back(trigger->GetGUID()); - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } - - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_KILL, me); - } - - void JustDied(Unit* /*Killer*/) - { - LiveTriggerGUID.clear(); - DeadTriggerGUID.clear(); - _JustDied(); - DoScriptText(SAY_DEATH, me); - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - } - - void DoGothikSummon(uint32 entry) - { - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - { - switch(entry) + if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD) { - case MOB_LIVE_TRAINEE: - { - if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); - if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); - if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1); - break; - } - case MOB_LIVE_KNIGHT: - { - if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1); - if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); - break; - } - case MOB_LIVE_RIDER: - { - if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); - break; - } + sLog.outError("Script Gothik: cannot summon triggers!"); + EnterEvadeMode(); + return; } + + _EnterCombat(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + waveCount = 0; + events.ScheduleEvent(EVENT_SUMMON, 30000); + DoTeleportTo(PosPlatform); + DoScriptText(SAY_SPEECH, me); + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY); } - else + + void JustSummoned(Creature *summon) { - switch(entry) + if (summon->GetEntry() == WORLD_TRIGGER) + summon->setActive(true); + else if (!mergedSides) { - case MOB_LIVE_TRAINEE: - { - if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); - if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); - break; - } - case MOB_LIVE_KNIGHT: - { - if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); - break; - } - case MOB_LIVE_RIDER: - { - if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) - DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); - break; - } + summon->AI()->DoAction(me->HasReactState(REACT_PASSIVE) ? 1 : 0); + summon->AI()->EnterEvadeMode(); } - } - } - - bool CheckGroupSplitted() - { - bool checklife = false; - bool checkdead = false; - - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) + else { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource() && i->getSource()->isAlive() && - i->getSource()->GetPositionX() <= POS_X_NORTH && - i->getSource()->GetPositionX() >= POS_X_SOUTH && - i->getSource()->GetPositionY() <= POS_Y_GATE && - i->getSource()->GetPositionY() >= POS_Y_EAST) - { - checklife = true; - } - else if (i->getSource() && i->getSource()->isAlive() && - i->getSource()->GetPositionX() <= POS_X_NORTH && - i->getSource()->GetPositionX() >= POS_X_SOUTH && - i->getSource()->GetPositionY() >= POS_Y_GATE && - i->getSource()->GetPositionY() <= POS_Y_WEST) - { - checkdead = true; - } - - if (checklife && checkdead) - return true; - } + summon->AI()->DoAction(0); + summon->AI()->DoZoneInCombat(); } + summons.Summon(summon); } - return false; - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - uint32 spellId = 0; - switch(spell->Id) + void SummonedCreatureDespawn(Creature *summon) { - case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; - case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; - case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + summons.Despawn(summon); } - if (spellId && me->isInCombat()) + + void KilledUnit(Unit* /*victim*/) { - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); - if (Creature *pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) - me->CastSpell(pRandomDeadTrigger, spellId, true); + if (!(rand()%5)) + DoScriptText(SAY_KILL, me); } - } - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (!me->isInCombat()) - return; - - switch(spell->Id) + void JustDied(Unit* /*Killer*/) { - case SPELL_INFORM_DEAD_TRAINEE: - DoSummon(MOB_DEAD_TRAINEE, pTarget, 0); - break; - case SPELL_INFORM_DEAD_KNIGHT: - DoSummon(MOB_DEAD_KNIGHT, pTarget, 0); - break; - case SPELL_INFORM_DEAD_RIDER: - DoSummon(MOB_DEAD_RIDER, pTarget, 1.0f); - DoSummon(MOB_DEAD_HORSE, pTarget, 1.0f); - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState() || !CheckInRoom()) - return; - - events.Update(diff); - - if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) - { - thirtyPercentReached = true; + LiveTriggerGUID.clear(); + DeadTriggerGUID.clear(); + _JustDied(); + DoScriptText(SAY_DEATH, me); if (instance) instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); } - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void DoGothikSummon(uint32 entry) { - switch(eventId) + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) { - case EVENT_SUMMON: - if (waves[waveCount].entry) - { - if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) - DoGothikSummon(waves[waveCount].entry); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) - DoGothikSummon(waves[waveCount].entry); - else if (waves[waveCount].mode == 1) - DoGothikSummon(waves[waveCount].entry); - - // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) - if (waveCount == 11) - { - if (!CheckGroupSplitted()) - { - if (instance) - instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); - summons.DoAction(0, 0); - summons.DoZoneInCombat(); - mergedSides = true; - } - } - - if (waves[waveCount].mode == 1) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) - events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); - else - events.ScheduleEvent(EVENT_SUMMON, 0); - - ++waveCount; - } - else - { - phaseTwo = true; - DoScriptText(SAY_TELEPORT, me); - DoTeleportTo(PosGroundLiveSide); - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - summons.DoAction(0, 0); - summons.DoZoneInCombat(); - events.ScheduleEvent(EVENT_BOLT, 1000); - events.ScheduleEvent(EVENT_HARVEST, urand(3000,15000)); - events.ScheduleEvent(EVENT_TELEPORT, 20000); - } - break; - case EVENT_BOLT: - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); - events.ScheduleEvent(EVENT_BOLT, 1000); - break; - case EVENT_HARVEST: - DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); - events.ScheduleEvent(EVENT_HARVEST, urand(20000,25000)); - break; - case EVENT_TELEPORT: - if (!thirtyPercentReached) - { - me->AttackStop(); - if (IN_LIVE_SIDE(me)) - { - DoTeleportTo(PosGroundDeadSide); - } - else - { - DoTeleportTo(PosGroundLiveSide); - } - - me->getThreatManager().resetAggro(NotOnSameSide(me)); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) - { - me->getThreatManager().addThreat(pTarget, 100.0f); - AttackStart(pTarget); - } - - events.ScheduleEvent(EVENT_TELEPORT, 20000); - } - break; - } - } - - DoMeleeAttackIfReady(); - } -}; - -struct mob_gothik_minionAI : public CombatAI -{ - mob_gothik_minionAI(Creature *c) : CombatAI(c) - { - liveSide = IN_LIVE_SIDE(me); - } - - bool liveSide; - bool gateClose; - - bool isOnSameSide(const Unit *pWho) - { - return (liveSide == IN_LIVE_SIDE(pWho)); - } - - void DoAction(const int32 param) - { - gateClose = param; - } - - void DamageTaken(Unit *attacker, uint32 &damage) - { - if (gateClose && !isOnSameSide(attacker)) - damage = 0; - } - - void JustDied(Unit * /*killer*/) - { - if (me->isSummon()) - { - if (Unit *owner = CAST_SUM(me)->GetSummoner()) - CombatAI::JustDied(owner); - } - } - - void EnterEvadeMode() - { - if (!gateClose) - { - CombatAI::EnterEvadeMode(); - return; - } - - if (!_EnterEvadeMode()) - return; - - Map* pMap = me->GetMap(); - if (pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + switch(entry) { - if (i->getSource() && i->getSource()->isAlive() && isOnSameSide(i->getSource())) + case MOB_LIVE_TRAINEE: { - AttackStart(i->getSource()); - return; + if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[0])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); + if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[1])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); + if (Creature *LiveTrigger2 = Unit::GetCreature(*me, LiveTriggerGUID[2])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger2, 1); + break; + } + case MOB_LIVE_KNIGHT: + { + if (Creature *LiveTrigger3 = Unit::GetCreature(*me, LiveTriggerGUID[3])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger3, 1); + if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[5])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); + break; + } + case MOB_LIVE_RIDER: + { + if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); + break; + } + } + } + else + { + switch(entry) + { + case MOB_LIVE_TRAINEE: + { + if (Creature *LiveTrigger0 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger0, 1); + if (Creature *LiveTrigger1 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_TRAINEE, LiveTrigger1, 1); + break; + } + case MOB_LIVE_KNIGHT: + { + if (Creature *LiveTrigger5 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_KNIGHT, LiveTrigger5, 1); + break; + } + case MOB_LIVE_RIDER: + { + if (Creature *LiveTrigger4 = Unit::GetCreature(*me, LiveTriggerGUID[4])) + DoSummon(MOB_LIVE_RIDER, LiveTrigger4, 1); + break; } } } } - me->GetMotionMaster()->MoveIdle(); - Reset(); - } - - void UpdateAI(const uint32 diff) - { - if (gateClose && (!isOnSameSide(me) || me->getVictim() && !isOnSameSide(me->getVictim()))) + bool CheckGroupSplitted() { - EnterEvadeMode(); - return; + bool checklife = false; + bool checkdead = false; + + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource() && i->getSource()->isAlive() && + i->getSource()->GetPositionX() <= POS_X_NORTH && + i->getSource()->GetPositionX() >= POS_X_SOUTH && + i->getSource()->GetPositionY() <= POS_Y_GATE && + i->getSource()->GetPositionY() >= POS_Y_EAST) + { + checklife = true; + } + else if (i->getSource() && i->getSource()->isAlive() && + i->getSource()->GetPositionX() <= POS_X_NORTH && + i->getSource()->GetPositionX() >= POS_X_SOUTH && + i->getSource()->GetPositionY() >= POS_Y_GATE && + i->getSource()->GetPositionY() <= POS_Y_WEST) + { + checkdead = true; + } + + if (checklife && checkdead) + return true; + } + } + } + + return false; } - CombatAI::UpdateAI(diff); + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + uint32 spellId = 0; + switch(spell->Id) + { + case SPELL_INFORM_LIVE_TRAINEE: spellId = SPELL_INFORM_DEAD_TRAINEE; break; + case SPELL_INFORM_LIVE_KNIGHT: spellId = SPELL_INFORM_DEAD_KNIGHT; break; + case SPELL_INFORM_LIVE_RIDER: spellId = SPELL_INFORM_DEAD_RIDER; break; + } + if (spellId && me->isInCombat()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); + if (Creature *pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) + me->CastSpell(pRandomDeadTrigger, spellId, true); + } + } + + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) + { + if (!me->isInCombat()) + return; + + switch(spell->Id) + { + case SPELL_INFORM_DEAD_TRAINEE: + DoSummon(MOB_DEAD_TRAINEE, pTarget, 0); + break; + case SPELL_INFORM_DEAD_KNIGHT: + DoSummon(MOB_DEAD_KNIGHT, pTarget, 0); + break; + case SPELL_INFORM_DEAD_RIDER: + DoSummon(MOB_DEAD_RIDER, pTarget, 1.0f); + DoSummon(MOB_DEAD_HORSE, pTarget, 1.0f); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateCombatState() || !CheckInRoom()) + return; + + events.Update(diff); + + if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo) + { + thirtyPercentReached = true; + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + } + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SUMMON: + if (waves[waveCount].entry) + { + if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + DoGothikSummon(waves[waveCount].entry); + else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + DoGothikSummon(waves[waveCount].entry); + else if (waves[waveCount].mode == 1) + DoGothikSummon(waves[waveCount].entry); + + // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11) + if (waveCount == 11) + { + if (!CheckGroupSplitted()) + { + if (instance) + instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + mergedSides = true; + } + } + + if (waves[waveCount].mode == 1) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)) + events.ScheduleEvent(EVENT_SUMMON,waves[waveCount].time); + else + events.ScheduleEvent(EVENT_SUMMON, 0); + + ++waveCount; + } + else + { + phaseTwo = true; + DoScriptText(SAY_TELEPORT, me); + DoTeleportTo(PosGroundLiveSide); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + summons.DoAction(0, 0); + summons.DoZoneInCombat(); + events.ScheduleEvent(EVENT_BOLT, 1000); + events.ScheduleEvent(EVENT_HARVEST, urand(3000,15000)); + events.ScheduleEvent(EVENT_TELEPORT, 20000); + } + break; + case EVENT_BOLT: + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT)); + events.ScheduleEvent(EVENT_BOLT, 1000); + break; + case EVENT_HARVEST: + DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true); + events.ScheduleEvent(EVENT_HARVEST, urand(20000,25000)); + break; + case EVENT_TELEPORT: + if (!thirtyPercentReached) + { + me->AttackStop(); + if (IN_LIVE_SIDE(me)) + { + DoTeleportTo(PosGroundDeadSide); + } + else + { + DoTeleportTo(PosGroundLiveSide); + } + + me->getThreatManager().resetAggro(NotOnSameSide(me)); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) + { + me->getThreatManager().addThreat(pTarget, 100.0f); + AttackStart(pTarget); + } + + events.ScheduleEvent(EVENT_TELEPORT, 20000); + } + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_gothik_minion : public CreatureScript +{ +public: + mob_gothik_minion() : CreatureScript("mob_gothik_minion") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_gothik_minionAI (pCreature); } + + struct mob_gothik_minionAI : public CombatAI + { + mob_gothik_minionAI(Creature *c) : CombatAI(c) + { + liveSide = IN_LIVE_SIDE(me); + } + + bool liveSide; + bool gateClose; + + bool isOnSameSide(const Unit *pWho) + { + return (liveSide == IN_LIVE_SIDE(pWho)); + } + + void DoAction(const int32 param) + { + gateClose = param; + } + + void DamageTaken(Unit *attacker, uint32 &damage) + { + if (gateClose && !isOnSameSide(attacker)) + damage = 0; + } + + void JustDied(Unit * /*killer*/) + { + if (me->isSummon()) + { + if (Unit *owner = CAST_SUM(me)->GetSummoner()) + CombatAI::JustDied(owner); + } + } + + void EnterEvadeMode() + { + if (!gateClose) + { + CombatAI::EnterEvadeMode(); + return; + } + + if (!_EnterEvadeMode()) + return; + + Map* pMap = me->GetMap(); + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource() && i->getSource()->isAlive() && isOnSameSide(i->getSource())) + { + AttackStart(i->getSource()); + return; + } + } + } + } + + me->GetMotionMaster()->MoveIdle(); + Reset(); + } + + void UpdateAI(const uint32 diff) + { + if (gateClose && (!isOnSameSide(me) || me->getVictim() && !isOnSameSide(me->getVictim()))) + { + EnterEvadeMode(); + return; + } + + CombatAI::UpdateAI(diff); + } + }; + }; -CreatureAI* GetAI_boss_gothik(Creature* pCreature) -{ - return new boss_gothikAI (pCreature); -} -CreatureAI* GetAI_mob_gothik_minion(Creature* pCreature) -{ - return new mob_gothik_minionAI (pCreature); -} void AddSC_boss_gothik() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gothik"; - newscript->GetAI = &GetAI_boss_gothik; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_gothik_minion"; - newscript->GetAI = &GetAI_mob_gothik_minion; - newscript->RegisterSelf(); + new boss_gothik(); + new mob_gothik_minion(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index 1d96a2d70ab..cc2789d582d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -32,112 +32,118 @@ #define EVENT_SPRAY 4 #define MOB_FALLOUT_SLIME 16290 - -struct boss_grobbulusAI : public BossAI + class boss_grobbulus : public CreatureScript { - boss_grobbulusAI(Creature *c) : BossAI(c, BOSS_GROBBULUS) +public: + boss_grobbulus() : CreatureScript("boss_grobbulus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); + return new boss_grobbulusAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_grobbulusAI : public BossAI { - _EnterCombat(); - events.ScheduleEvent(EVENT_CLOUD, 15000); - events.ScheduleEvent(EVENT_INJECT, 20000); - events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); //not sure - events.ScheduleEvent(EVENT_BERSERK, 12*60000); - } - - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (spell->Id == uint32(SPELL_SLIME_SPRAY)) + boss_grobbulusAI(Creature *c) : BossAI(c, BOSS_GROBBULUS) { - if (TempSummon *slime = me->SummonCreature(MOB_FALLOUT_SLIME, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) - DoZoneInCombat(slime); + me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_POISON_CLOUD_ADD, true); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit * /*who*/) { - switch(eventId) + _EnterCombat(); + events.ScheduleEvent(EVENT_CLOUD, 15000); + events.ScheduleEvent(EVENT_INJECT, 20000); + events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); //not sure + events.ScheduleEvent(EVENT_BERSERK, 12*60000); + } + + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) + { + if (spell->Id == uint32(SPELL_SLIME_SPRAY)) { - case EVENT_CLOUD: - DoCastAOE(SPELL_POISON_CLOUD); - events.ScheduleEvent(EVENT_CLOUD, 15000); - return; - case EVENT_BERSERK: - DoCastAOE(SPELL_BERSERK); - return; - case EVENT_SPRAY: - DoCastAOE(SPELL_SLIME_SPRAY); - events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); - return; - case EVENT_INJECT: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) - if (!pTarget->HasAura(SPELL_MUTATING_INJECTION)) - DoCast(pTarget, SPELL_MUTATING_INJECTION); - events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth())); - return; + if (TempSummon *slime = me->SummonCreature(MOB_FALLOUT_SLIME, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + DoZoneInCombat(slime); } } - DoMeleeAttackIfReady(); - } -}; - -struct npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI -{ - npc_grobbulus_poison_cloudAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - Reset(); - } - - uint32 Cloud_Timer; - - void Reset() - { - Cloud_Timer = 1000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void UpdateAI(const uint32 diff) - { - if (Cloud_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_POISON_CLOUD_ADD); - Cloud_Timer = 10000; - } else Cloud_Timer -= diff; + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_CLOUD: + DoCastAOE(SPELL_POISON_CLOUD); + events.ScheduleEvent(EVENT_CLOUD, 15000); + return; + case EVENT_BERSERK: + DoCastAOE(SPELL_BERSERK); + return; + case EVENT_SPRAY: + DoCastAOE(SPELL_SLIME_SPRAY); + events.ScheduleEvent(EVENT_SPRAY, 15000+rand()%15000); + return; + case EVENT_INJECT: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1)) + if (!pTarget->HasAura(SPELL_MUTATING_INJECTION)) + DoCast(pTarget, SPELL_MUTATING_INJECTION); + events.ScheduleEvent(EVENT_INJECT, 8000 + 12000 * ((float)me->GetHealth() / me->GetMaxHealth())); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class npc_grobbulus_poison_cloud : public CreatureScript +{ +public: + npc_grobbulus_poison_cloud() : CreatureScript("npc_grobbulus_poison_cloud") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_grobbulus_poison_cloudAI(pCreature); } + + struct npc_grobbulus_poison_cloudAI : public Scripted_NoMovementAI + { + npc_grobbulus_poison_cloudAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) + { + Reset(); + } + + uint32 Cloud_Timer; + + void Reset() + { + Cloud_Timer = 1000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void UpdateAI(const uint32 diff) + { + if (Cloud_Timer <= diff) + { + DoCast(me, SPELL_POISON_CLOUD_ADD); + Cloud_Timer = 10000; + } else Cloud_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_grobbulus(Creature* pCreature) -{ - return new boss_grobbulusAI (pCreature); -} -CreatureAI* GetAI_npc_grobbulus_poison_cloud(Creature* pCreature) -{ - return new npc_grobbulus_poison_cloudAI(pCreature); -} void AddSC_boss_grobbulus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grobbulus"; - newscript->GetAI = &GetAI_boss_grobbulus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_grobbulus_poison_cloud"; - newscript->GetAI = &GetAI_npc_grobbulus_poison_cloud; - newscript->RegisterSelf(); + new boss_grobbulus(); + new npc_grobbulus_poison_cloud(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp index 00b6f498ce0..85e084f9081 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_heigan.cpp @@ -41,110 +41,113 @@ enum Phases PHASE_FIGHT = 1, PHASE_DANCE, }; - -struct boss_heiganAI : public BossAI + class boss_heigan : public CreatureScript { - boss_heiganAI(Creature *c) : BossAI(c, BOSS_HEIGAN) {} +public: + boss_heigan() : CreatureScript("boss_heigan") { } - uint32 eruptSection; - bool eruptDirection; - Phases phase; - - void KilledUnit(Unit* /*Victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); + return new boss_heiganAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_heiganAI : public BossAI { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + boss_heiganAI(Creature *c) : BossAI(c, BOSS_HEIGAN) {} - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - EnterPhase(PHASE_FIGHT); - } + uint32 eruptSection; + bool eruptDirection; + Phases phase; - void EnterPhase(Phases newPhase) - { - phase = newPhase; - events.Reset(); - eruptSection = 3; - if (phase == PHASE_FIGHT) + void KilledUnit(Unit* /*Victim*/) { - events.ScheduleEvent(EVENT_DISRUPT, urand(10000, 25000)); - events.ScheduleEvent(EVENT_FEVER, urand(15000, 20000)); - events.ScheduleEvent(EVENT_PHASE, 90000); - events.ScheduleEvent(EVENT_ERUPT, 15000); + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); } - else + + void JustDied(Unit* /*Killer*/) { - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); - DoCastAOE(SPELL_PLAGUE_CLOUD); - events.ScheduleEvent(EVENT_PHASE, 45000); - events.ScheduleEvent(EVENT_ERUPT, 8000); + _JustDied(); + DoScriptText(SAY_DEATH, me); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim() || !CheckInRoom()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit * /*who*/) { - switch(eventId) + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + EnterPhase(PHASE_FIGHT); + } + + void EnterPhase(Phases newPhase) + { + phase = newPhase; + events.Reset(); + eruptSection = 3; + if (phase == PHASE_FIGHT) { - case EVENT_DISRUPT: - DoCastAOE(SPELL_SPELL_DISRUPTION); - events.ScheduleEvent(EVENT_DISRUPT, urand(5000, 10000)); - break; - case EVENT_FEVER: - DoCastAOE(SPELL_DECREPIT_FEVER); - events.ScheduleEvent(EVENT_FEVER, urand(20000, 25000)); - break; - case EVENT_PHASE: - // TODO : Add missing texts for both phase switches - EnterPhase(phase == PHASE_FIGHT ? PHASE_DANCE : PHASE_FIGHT); - break; - case EVENT_ERUPT: - instance->SetData(DATA_HEIGAN_ERUPT, eruptSection); - TeleportCheaters(); - - if (eruptSection == 0) - eruptDirection = true; - else if (eruptSection == 3) - eruptDirection = false; - - eruptDirection ? ++eruptSection : --eruptSection; - - events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000); - break; + events.ScheduleEvent(EVENT_DISRUPT, urand(10000, 25000)); + events.ScheduleEvent(EVENT_FEVER, urand(15000, 20000)); + events.ScheduleEvent(EVENT_PHASE, 90000); + events.ScheduleEvent(EVENT_ERUPT, 15000); + } + else + { + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->NearTeleportTo(x, y, z, o); + DoCastAOE(SPELL_PLAGUE_CLOUD); + events.ScheduleEvent(EVENT_PHASE, 45000); + events.ScheduleEvent(EVENT_ERUPT, 8000); } } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_DISRUPT: + DoCastAOE(SPELL_SPELL_DISRUPTION); + events.ScheduleEvent(EVENT_DISRUPT, urand(5000, 10000)); + break; + case EVENT_FEVER: + DoCastAOE(SPELL_DECREPIT_FEVER); + events.ScheduleEvent(EVENT_FEVER, urand(20000, 25000)); + break; + case EVENT_PHASE: + // TODO : Add missing texts for both phase switches + EnterPhase(phase == PHASE_FIGHT ? PHASE_DANCE : PHASE_FIGHT); + break; + case EVENT_ERUPT: + instance->SetData(DATA_HEIGAN_ERUPT, eruptSection); + TeleportCheaters(); + + if (eruptSection == 0) + eruptDirection = true; + else if (eruptSection == 3) + eruptDirection = false; + + eruptDirection ? ++eruptSection : --eruptSection; + + events.ScheduleEvent(EVENT_ERUPT, phase == PHASE_FIGHT ? 10000 : 3000); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_heigan(Creature* pCreature) -{ - return new boss_heiganAI (pCreature); -} void AddSC_boss_heigan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_heigan"; - newscript->GetAI = &GetAI_boss_heigan; - newscript->RegisterSelf(); + new boss_heigan(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 196d0771b97..8395fe13e1c 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -251,458 +251,462 @@ struct NotCharmedTargetSelector : public std::unary_function { return (!pTarget->isCharmed()); } }; - -struct boss_kelthuzadAI : public BossAI + class boss_kelthuzad : public CreatureScript { - boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), spawns(c) +public: + boss_kelthuzad() : CreatureScript("boss_kelthuzad") { } + + struct boss_kelthuzadAI : public BossAI { - uiFaction = me->getFaction(); - } - - uint32 Phase; - uint32 uiGuardiansOfIcecrownTimer; - uint32 uiFaction; - - uint8 nGuardiansOfIcecrownCount; - uint8 nAbomination; - uint8 nWeaver; - - std::map chained; - - uint64 PortalsGUID[4]; - uint64 KTTriggerGUID; - - SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) - - void Reset() - { - _Reset(); - - PortalsGUID[0] = PortalsGUID[1] = PortalsGUID[2] = PortalsGUID[3] = 0; - KTTriggerGUID = 0; - - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - std::map::const_iterator itr; - for (itr = chained.begin(); itr != chained.end(); ++itr) + boss_kelthuzadAI(Creature* c) : BossAI(c, BOSS_KELTHUZAD), spawns(c) { - if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) - charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + uiFaction = me->getFaction(); } - chained.clear(); - spawns.DespawnAll(); + uint32 Phase; + uint32 uiGuardiansOfIcecrownTimer; + uint32 uiFaction; - FindGameObjects(); + uint8 nGuardiansOfIcecrownCount; + uint8 nAbomination; + uint8 nWeaver; - if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) + std::map chained; + + uint64 PortalsGUID[4]; + uint64 KTTriggerGUID; + + SummonList spawns; // adds spawn by the trigger. kept in separated list (i.e. not in summons) + + void Reset() { - pKTTrigger->ResetDoorOrButton(); - pKTTrigger->SetPhaseMask(1, true); - } + _Reset(); - for (uint8 i = 0; i <= 3; ++i) - { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + PortalsGUID[0] = PortalsGUID[1] = PortalsGUID[2] = PortalsGUID[3] = 0; + KTTriggerGUID = 0; + + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + std::map::const_iterator itr; + for (itr = chained.begin(); itr != chained.end(); ++itr) { - if (!((pPortal->getLootState() == GO_READY) || (pPortal->getLootState() == GO_NOT_READY))) + if (Player* charmed = Unit::GetPlayer(*me, (*itr).first)) + charmed->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + } + + chained.clear(); + spawns.DespawnAll(); + + FindGameObjects(); + + if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) + { + pKTTrigger->ResetDoorOrButton(); + pKTTrigger->SetPhaseMask(1, true); + } + + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + { + if (!((pPortal->getLootState() == GO_READY) || (pPortal->getLootState() == GO_NOT_READY))) + pPortal->ResetDoorOrButton(); + } + } + + nGuardiansOfIcecrownCount = 0; + uiGuardiansOfIcecrownTimer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 + + Phase = 0; + nAbomination = 0; + nWeaver = 0; + } + + void KilledUnit() + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + + std::map::const_iterator itr; + for (itr = chained.begin(); itr != chained.end(); ++itr) + { + if (Player* pPlayer = Unit::GetPlayer(*me, (*itr).first)) + pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + } + chained.clear(); + } + + void EnterCombat(Unit* /*who*/) + { + me->setFaction(uiFaction); + + _EnterCombat(); + FindGameObjects(); + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) pPortal->ResetDoorOrButton(); } + DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); + DoScriptText(SAY_SUMMON_MINIONS, me); + Phase = 1; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4); + me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 4); + events.ScheduleEvent(EVENT_TRIGGER, 5000); + events.ScheduleEvent(EVENT_WASTE, 15000); + events.ScheduleEvent(EVENT_ABOMIN, 30000); + events.ScheduleEvent(EVENT_WEAVER, 50000); + events.ScheduleEvent(EVENT_PHASE, 228000); } - nGuardiansOfIcecrownCount = 0; - uiGuardiansOfIcecrownTimer = 5000; //5 seconds for summoning each Guardian of Icecrown in phase 3 - - Phase = 0; - nAbomination = 0; - nWeaver = 0; - } - - void KilledUnit() - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - - std::map::const_iterator itr; - for (itr = chained.begin(); itr != chained.end(); ++itr) + void FindGameObjects() { - if (Player* pPlayer = Unit::GetPlayer(*me, (*itr).first)) - pPlayer->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + PortalsGUID[0] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL01) : 0; + PortalsGUID[1] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL02) : 0; + PortalsGUID[2] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL03) : 0; + PortalsGUID[3] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL04) : 0; + KTTriggerGUID = instance ? instance->GetData64(DATA_KELTHUZAD_TRIGGER) : 0; } - chained.clear(); - } - void EnterCombat(Unit* /*who*/) - { - me->setFaction(uiFaction); - - _EnterCombat(); - FindGameObjects(); - for (uint8 i = 0; i <= 3; ++i) + void UpdateAI(const uint32 diff) { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - pPortal->ResetDoorOrButton(); - } - DoCast(me, SPELL_KELTHUZAD_CHANNEL, false); - DoScriptText(SAY_SUMMON_MINIONS, me); - Phase = 1; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - me->SetFloatValue(UNIT_FIELD_COMBATREACH, 4); - me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 4); - events.ScheduleEvent(EVENT_TRIGGER, 5000); - events.ScheduleEvent(EVENT_WASTE, 15000); - events.ScheduleEvent(EVENT_ABOMIN, 30000); - events.ScheduleEvent(EVENT_WEAVER, 50000); - events.ScheduleEvent(EVENT_PHASE, 228000); - } - - void FindGameObjects() - { - PortalsGUID[0] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL01) : 0; - PortalsGUID[1] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL02) : 0; - PortalsGUID[2] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL03) : 0; - PortalsGUID[3] = instance ? instance->GetData64(DATA_KELTHUZAD_PORTAL04) : 0; - KTTriggerGUID = instance ? instance->GetData64(DATA_KELTHUZAD_TRIGGER) : 0; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState()) - return; - - events.Update(diff); - - if (Phase == 1) - { - while (uint32 eventId = events.GetEvent()) - { - switch(eventId) - { - case EVENT_WASTE: - DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); - events.RepeatEvent(urand(2000,5000)); - break; - case EVENT_ABOMIN: - if (nAbomination < 8) - { - DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); - nAbomination++; - events.RepeatEvent(20000); - } - else - events.PopEvent(); - break; - case EVENT_WEAVER: - if (nWeaver < 8) - { - DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); - nWeaver++; - events.RepeatEvent(25000); - } - else - events.PopEvent(); - break; - case EVENT_TRIGGER: - if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) - pKTTrigger->SetPhaseMask(2, true); - events.PopEvent(); - break; - case EVENT_PHASE: - events.Reset(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - spawns.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - me->CastStop(); - - DoStartMovement(me->getVictim()); - events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); - events.ScheduleEvent(EVENT_NOVA, 15000); - events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); - events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); - events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); - Phase = 2; - break; - default: - events.PopEvent(); - break; - } - } - } - else - { - //start phase 3 when we are 45% health - if (Phase != 3) - { - if (HealthBelowPct(45)) - { - Phase = 3 ; - DoScriptText(SAY_REQUEST_AID, me); - //here Lich King should respond to KelThuzad but I don't know which Creature to make talk - //so for now just make Kelthuzad says it. - DoScriptText(SAY_ANSWER_REQUEST, me); - - for (uint8 i = 0; i <= 3; ++i) - { - if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) - { - if (pPortal->getLootState() == GO_READY) - pPortal->UseDoorOrButton(); - } - } - } - } - else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) - { - if (uiGuardiansOfIcecrownTimer <= diff) - { - // TODO : Add missing text - if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) - pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); - ++nGuardiansOfIcecrownCount; - uiGuardiansOfIcecrownTimer = 5000; - } - else uiGuardiansOfIcecrownTimer -= diff; - } - - if (me->hasUnitState(UNIT_STAT_CASTING)) + if (!UpdateCombatState()) return; - if (uint32 eventId = events.GetEvent()) + events.Update(diff); + + if (Phase == 1) { - switch(eventId) + while (uint32 eventId = events.GetEvent()) { - case EVENT_BOLT: - DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); - events.RepeatEvent(urand(5000,10000)); - break; - case EVENT_NOVA: - DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); - events.RepeatEvent(urand(15000,30000)); - break; - case EVENT_CHAIN: + switch(eventId) { - uint32 count = urand(1,3); - for (uint8 i = 1; i <= count; i++) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); - if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) + case EVENT_WASTE: + DoSummon(NPC_WASTE, Pos[RAND(0,3,6,9)]); + events.RepeatEvent(urand(2000,5000)); + break; + case EVENT_ABOMIN: + if (nAbomination < 8) { - DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); - float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); - chained.insert(std::make_pair(pTarget->GetGUID(), scale)); - pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); - events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm + DoSummon(NPC_ABOMINATION, Pos[RAND(1,4,7,10)]); + nAbomination++; + events.RepeatEvent(20000); } - } - if (!chained.empty()) - DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); - events.RepeatEvent(urand(100000,180000)); - break; - } - case EVENT_CHAINED_SPELL: - { - std::map::iterator itr; - for (itr = chained.begin(); itr != chained.end();) - { - if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) + else + events.PopEvent(); + break; + case EVENT_WEAVER: + if (nWeaver < 8) { - if (!player->isCharmed()) - { - player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); - std::map::iterator next = itr; - ++next; - chained.erase(itr); - itr = next; - continue; - } - - if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) - { - switch(player->getClass()) - { - case CLASS_DRUID: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_MOONFIRE, false); - else - player->CastSpell(me, SPELL_LIFEBLOOM, false); - break; - case CLASS_HUNTER: - player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); - break; - case CLASS_MAGE: - player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); - break; - case CLASS_WARLOCK: - player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); - break; - case CLASS_WARRIOR: - player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); - break; - case CLASS_PALADIN: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); - else - player->CastSpell(me, SPELL_HOLY_SHOCK, false); - break; - case CLASS_PRIEST: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); - else - player->CastSpell(me, SPELL_RENEW, false); - break; - case CLASS_SHAMAN: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); - else - player->CastSpell(me, SPELL_HEALING_WAVE, false); - break; - case CLASS_ROGUE: - player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); - break; - case CLASS_DEATH_KNIGHT: - if (urand(0,1)) - player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); - else - player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); - break; - } - } + DoSummon(NPC_WEAVER, Pos[RAND(0,3,6,9)]); + nWeaver++; + events.RepeatEvent(25000); } - ++itr; - } - - if (chained.empty()) + else + events.PopEvent(); + break; + case EVENT_TRIGGER: + if (GameObject *pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID)) + pKTTrigger->SetPhaseMask(2, true); events.PopEvent(); - else - events.RepeatEvent(5000); + break; + case EVENT_PHASE: + events.Reset(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + spawns.DespawnAll(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); + me->CastStop(); - break; + DoStartMovement(me->getVictim()); + events.ScheduleEvent(EVENT_BOLT, urand(5000,10000)); + events.ScheduleEvent(EVENT_NOVA, 15000); + events.ScheduleEvent(EVENT_DETONATE, urand(30000,40000)); + events.ScheduleEvent(EVENT_FISSURE, urand(10000,30000)); + events.ScheduleEvent(EVENT_BLAST, urand(60000,120000)); + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + events.ScheduleEvent(EVENT_CHAIN, urand(30000,60000)); + Phase = 2; + break; + default: + events.PopEvent(); + break; } - case EVENT_DETONATE: - { - std::vector unitList; - std::list *threatList = &me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) - { - if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER - && (*itr)->getTarget()->getPowerType() == POWER_MANA - && (*itr)->getTarget()->GetPower(POWER_MANA)) - unitList.push_back((*itr)->getTarget()); - } - - if (!unitList.empty()) - { - std::vector::const_iterator itr = unitList.begin(); - advance(itr, rand()%unitList.size()); - DoCast(*itr, SPELL_MANA_DETONATION); - DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); - } - - events.RepeatEvent(urand(20000,50000)); - break; - } - case EVENT_FISSURE: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SHADOW_FISURE); - events.RepeatEvent(urand(10000,45000)); - break; - case EVENT_BLAST: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) - DoCast(pTarget, SPELL_FROST_BLAST); - if (rand()%2) - DoScriptText(SAY_FROST_BLAST, me); - events.RepeatEvent(urand(30000,90000)); - break; - default: - events.PopEvent(); - break; } } + else + { + //start phase 3 when we are 45% health + if (Phase != 3) + { + if (HealthBelowPct(45)) + { + Phase = 3 ; + DoScriptText(SAY_REQUEST_AID, me); + //here Lich King should respond to KelThuzad but I don't know which Creature to make talk + //so for now just make Kelthuzad says it. + DoScriptText(SAY_ANSWER_REQUEST, me); - DoMeleeAttackIfReady(); + for (uint8 i = 0; i <= 3; ++i) + { + if (GameObject *pPortal = me->GetMap()->GetGameObject(PortalsGUID[i])) + { + if (pPortal->getLootState() == GO_READY) + pPortal->UseDoorOrButton(); + } + } + } + } + else if (nGuardiansOfIcecrownCount < RAID_MODE(2,4)) + { + if (uiGuardiansOfIcecrownTimer <= diff) + { + // TODO : Add missing text + if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2,5,8,11)])) + pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2); + ++nGuardiansOfIcecrownCount; + uiGuardiansOfIcecrownTimer = 5000; + } + else uiGuardiansOfIcecrownTimer -= diff; + } + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (uint32 eventId = events.GetEvent()) + { + switch(eventId) + { + case EVENT_BOLT: + DoCastVictim(RAID_MODE(SPELL_FROST_BOLT,H_SPELL_FROST_BOLT)); + events.RepeatEvent(urand(5000,10000)); + break; + case EVENT_NOVA: + DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE,H_SPELL_FROST_BOLT_AOE)); + events.RepeatEvent(urand(15000,30000)); + break; + case EVENT_CHAIN: + { + uint32 count = urand(1,3); + for (uint8 i = 1; i <= count; i++) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); + if (pTarget && !pTarget->isCharmed() && (chained.find(pTarget->GetGUID()) == chained.end())) + { + DoCast(pTarget, SPELL_CHAINS_OF_KELTHUZAD); + float scale = pTarget->GetFloatValue(OBJECT_FIELD_SCALE_X); + chained.insert(std::make_pair(pTarget->GetGUID(), scale)); + pTarget->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); + events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm + } + } + if (!chained.empty()) + DoScriptText(RAND(SAY_CHAIN_1,SAY_CHAIN_2), me); + events.RepeatEvent(urand(100000,180000)); + break; + } + case EVENT_CHAINED_SPELL: + { + std::map::iterator itr; + for (itr = chained.begin(); itr != chained.end();) + { + if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) + { + if (!player->isCharmed()) + { + player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); + std::map::iterator next = itr; + ++next; + chained.erase(itr); + itr = next; + continue; + } + + if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) + { + switch(player->getClass()) + { + case CLASS_DRUID: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_MOONFIRE, false); + else + player->CastSpell(me, SPELL_LIFEBLOOM, false); + break; + case CLASS_HUNTER: + player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); + break; + case CLASS_MAGE: + player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); + break; + case CLASS_WARLOCK: + player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); + break; + case CLASS_WARRIOR: + player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); + break; + case CLASS_PALADIN: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false); + else + player->CastSpell(me, SPELL_HOLY_SHOCK, false); + break; + case CLASS_PRIEST: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false); + else + player->CastSpell(me, SPELL_RENEW, false); + break; + case CLASS_SHAMAN: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false); + else + player->CastSpell(me, SPELL_HEALING_WAVE, false); + break; + case CLASS_ROGUE: + player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); + break; + case CLASS_DEATH_KNIGHT: + if (urand(0,1)) + player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true); + else + player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true); + break; + } + } + } + ++itr; + } + + if (chained.empty()) + events.PopEvent(); + else + events.RepeatEvent(5000); + + break; + } + case EVENT_DETONATE: + { + std::vector unitList; + std::list *threatList = &me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) + { + if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER + && (*itr)->getTarget()->getPowerType() == POWER_MANA + && (*itr)->getTarget()->GetPower(POWER_MANA)) + unitList.push_back((*itr)->getTarget()); + } + + if (!unitList.empty()) + { + std::vector::const_iterator itr = unitList.begin(); + advance(itr, rand()%unitList.size()); + DoCast(*itr, SPELL_MANA_DETONATION); + DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me); + } + + events.RepeatEvent(urand(20000,50000)); + break; + } + case EVENT_FISSURE: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SHADOW_FISURE); + events.RepeatEvent(urand(10000,45000)); + break; + case EVENT_BLAST: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true)) + DoCast(pTarget, SPELL_FROST_BLAST); + if (rand()%2) + DoScriptText(SAY_FROST_BLAST, me); + events.RepeatEvent(urand(30000,90000)); + break; + default: + events.PopEvent(); + break; + } + } + + DoMeleeAttackIfReady(); + } } - } -}; + }; -CreatureAI* GetAI_boss_kelthuzadAI(Creature* pCreature) -{ - return new boss_kelthuzadAI (pCreature); -} - -bool AreaTrigger_at_kelthuzad_center(Player* pPlayer, const AreaTriggerEntry * /*at*/) -{ - if (pPlayer->isGameMaster()) - return false; - - ScriptedInstance* pInstance = pPlayer->GetInstanceData(); - if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE) - return false; - - Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD))); - if (!pKelthuzad) - return false; - - boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzadAI, pKelthuzad->AI()); - if (!pKelthuzadAI) - return false; - - pKelthuzadAI->AttackStart(pPlayer); - if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER))) + CreatureAI* GetAI(Creature* pCreature) const { - if (trigger->getLootState() == GO_READY) - trigger->UseDoorOrButton(); - - // Note: summon must be done by trigger and not by KT. - // Otherwise, they attack immediately as KT is in combat. - for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i) - { - if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i])) - { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(9.0f); - sum->SetReactState(REACT_DEFENSIVE); - } - } - for (uint8 i = 0; i <= MAX_WASTES; ++i) - { - if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i])) - { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(5.0f); - sum->SetReactState(REACT_DEFENSIVE); - } - } - for (uint8 i = 0; i <= MAX_WEAVERS; ++i) - { - if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i])) - { - pKelthuzadAI->spawns.Summon(sum); - sum->GetMotionMaster()->MoveRandom(9.0f); - sum->SetReactState(REACT_DEFENSIVE); - } - } + return new boss_kelthuzadAI (pCreature); } - return true; -} +}; + class at_kelthuzad_center : public AreaTriggerScript +{ +public: + at_kelthuzad_center() : AreaTriggerScript("at_kelthuzad_center") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) + { + if (pPlayer->isGameMaster()) + return false; + + InstanceScript* pInstance = pPlayer->GetInstanceScript(); + if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE) + return false; + + Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD))); + if (!pKelthuzad) + return false; + + boss_kelthuzad::boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzad::boss_kelthuzadAI, pKelthuzad->AI()); + if (!pKelthuzadAI) + return false; + + pKelthuzadAI->AttackStart(pPlayer); + if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER))) + { + if (trigger->getLootState() == GO_READY) + trigger->UseDoorOrButton(); + + // Note: summon must be done by trigger and not by KT. + // Otherwise, they attack immediately as KT is in combat. + for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i) + { + if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(9.0f); + sum->SetReactState(REACT_DEFENSIVE); + } + } + for (uint8 i = 0; i <= MAX_WASTES; ++i) + { + if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(5.0f); + sum->SetReactState(REACT_DEFENSIVE); + } + } + for (uint8 i = 0; i <= MAX_WEAVERS; ++i) + { + if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i])) + { + pKelthuzadAI->spawns.Summon(sum); + sum->GetMotionMaster()->MoveRandom(9.0f); + sum->SetReactState(REACT_DEFENSIVE); + } + } + } + + return true; + } + +}; void AddSC_boss_kelthuzad() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kelthuzad"; - newscript->GetAI = &GetAI_boss_kelthuzadAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_kelthuzad_center"; - newscript->pAreaTrigger = &AreaTrigger_at_kelthuzad_center; - newscript->RegisterSelf(); + new boss_kelthuzad(); + new at_kelthuzad_center(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp index c22bf236ec3..b44559f80f0 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_loatheb.cpp @@ -35,90 +35,92 @@ enum Events EVENT_BLOOM, EVENT_DOOM, }; - -struct boss_loathebAI : public BossAI + class boss_loatheb : public CreatureScript { - boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} +public: + boss_loatheb() : CreatureScript("boss_loatheb") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - events.ScheduleEvent(EVENT_AURA, 10000); - events.ScheduleEvent(EVENT_BLOOM, 5000); - events.ScheduleEvent(EVENT_DOOM, 120000); + return new boss_loathebAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_loathebAI : public BossAI { - if (!UpdateVictim()) - return; + boss_loathebAI(Creature *c) : BossAI(c, BOSS_LOATHEB) {} - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit * /*who*/) { - switch(eventId) - { - case EVENT_AURA: - DoCastAOE(SPELL_NECROTIC_AURA); - events.ScheduleEvent(EVENT_AURA, 20000); - break; - case EVENT_BLOOM: - // TODO : Add missing text - DoCastAOE(SPELL_SUMMON_SPORE, true); - DoCastAOE(RAID_MODE(SPELL_DEATHBLOOM,H_SPELL_DEATHBLOOM)); - events.ScheduleEvent(EVENT_BLOOM, 30000); - break; - case EVENT_DOOM: - DoCastAOE(RAID_MODE(SPELL_INEVITABLE_DOOM,H_SPELL_INEVITABLE_DOOM)); - events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000); - break; - } + _EnterCombat(); + events.ScheduleEvent(EVENT_AURA, 10000); + events.ScheduleEvent(EVENT_BLOOM, 5000); + events.ScheduleEvent(EVENT_DOOM, 120000); } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_AURA: + DoCastAOE(SPELL_NECROTIC_AURA); + events.ScheduleEvent(EVENT_AURA, 20000); + break; + case EVENT_BLOOM: + // TODO : Add missing text + DoCastAOE(SPELL_SUMMON_SPORE, true); + DoCastAOE(RAID_MODE(SPELL_DEATHBLOOM,H_SPELL_DEATHBLOOM)); + events.ScheduleEvent(EVENT_BLOOM, 30000); + break; + case EVENT_DOOM: + DoCastAOE(RAID_MODE(SPELL_INEVITABLE_DOOM,H_SPELL_INEVITABLE_DOOM)); + events.ScheduleEvent(EVENT_DOOM, events.GetTimer() < 5*60000 ? 30000 : 15000); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_loatheb(Creature* pCreature) -{ - return new boss_loathebAI (pCreature); -} enum SporeSpells { SPELL_FUNGAL_CREEP = 29232 }; - -struct mob_loatheb_sporeAI : public ScriptedAI + class mob_loatheb_spore : public CreatureScript { - mob_loatheb_sporeAI(Creature *c) : ScriptedAI(c) {} +public: + mob_loatheb_spore() : CreatureScript("mob_loatheb_spore") { } - void JustDied(Unit* killer) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(killer, SPELL_FUNGAL_CREEP); + return new mob_loatheb_sporeAI (pCreature); } + + struct mob_loatheb_sporeAI : public ScriptedAI + { + mob_loatheb_sporeAI(Creature *c) : ScriptedAI(c) {} + + void JustDied(Unit* killer) + { + DoCast(killer, SPELL_FUNGAL_CREEP); + } + }; + }; -CreatureAI* GetAI_mob_loatheb_spore(Creature* pCreature) -{ - return new mob_loatheb_sporeAI (pCreature); -} void AddSC_boss_loatheb() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_loatheb"; - newscript->GetAI = &GetAI_boss_loatheb; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_loatheb_spore"; - newscript->GetAI = &GetAI_mob_loatheb_spore; - newscript->RegisterSelf(); - - // Fungal Creep - //GetAISpellInfo(29232)->condition = AICOND_DIE; + new boss_loatheb(); + new mob_loatheb_spore(); } - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index b7a61ad0aca..b1aee9c90bc 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -55,131 +55,134 @@ enum Events EVENT_SUMMON, EVENT_FRENZY, }; - -struct boss_maexxnaAI : public BossAI + class boss_maexxna : public CreatureScript { - boss_maexxnaAI(Creature *c) : BossAI(c, BOSS_MAEXXNA) {} +public: + boss_maexxna() : CreatureScript("boss_maexxna") { } - bool enraged; - - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - _EnterCombat(); - enraged = false; - events.ScheduleEvent(EVENT_WRAP, 20000); - events.ScheduleEvent(EVENT_SPRAY, 40000); - events.ScheduleEvent(EVENT_SHOCK, urand(5000,10000)); - events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); - events.ScheduleEvent(EVENT_SUMMON, 30000); + return new boss_maexxnaAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_maexxnaAI : public BossAI { - if (!UpdateVictim() || !CheckInRoom()) - return; + boss_maexxnaAI(Creature *c) : BossAI(c, BOSS_MAEXXNA) {} - if (!enraged && HealthBelowPct(30)) + bool enraged; + + void EnterCombat(Unit * /*who*/) { - enraged = true; - events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately + _EnterCombat(); + enraged = false; + events.ScheduleEvent(EVENT_WRAP, 20000); + events.ScheduleEvent(EVENT_SPRAY, 40000); + events.ScheduleEvent(EVENT_SHOCK, urand(5000,10000)); + events.ScheduleEvent(EVENT_POISON, urand(10000,15000)); + events.ScheduleEvent(EVENT_SUMMON, 30000); } - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim() || !CheckInRoom()) + return; + + if (!enraged && HealthBelowPct(30)) { - case EVENT_WRAP: - // TODO : Add missing text - for (uint8 i = 0; i < RAID_MODE(1,2); ++i) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) - { - pTarget->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); - uint8 pos = rand()%MAX_POS_WRAP; - pTarget->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); - if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN)) - wrap->AI()->SetGUID(pTarget->GetGUID()); - } - } - events.ScheduleEvent(EVENT_WRAP, 40000); - break; - case EVENT_SPRAY: - DoCastAOE(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); - events.ScheduleEvent(EVENT_SPRAY, 40000); - break; - case EVENT_SHOCK: - DoCastAOE(RAID_MODE(SPELL_POISON_SHOCK_10,SPELL_POISON_SHOCK_25)); - events.ScheduleEvent(EVENT_SHOCK, urand(10000,20000)); - break; - case EVENT_POISON: - DoCast(me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10,SPELL_NECROTIC_POISON_25)); - events.ScheduleEvent(EVENT_POISON, urand(10000, 20000)); - break; - case EVENT_FRENZY: - DoCast(me, RAID_MODE(SPELL_FRENZY_10,SPELL_FRENZY_25), true); - events.ScheduleEvent(EVENT_FRENZY, 600000); - break; - case EVENT_SUMMON: - // TODO : Add missing text - uint8 amount = urand(8,10); - for (uint8 i = 0; i < amount; ++i) - DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN); - events.ScheduleEvent(EVENT_SUMMON, 40000); - break; + enraged = true; + events.ScheduleEvent(EVENT_FRENZY, 0); // will be cast immediately } + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_WRAP: + // TODO : Add missing text + for (uint8 i = 0; i < RAID_MODE(1,2); ++i) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, -SPELL_WEB_WRAP)) + { + pTarget->RemoveAura(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); + uint8 pos = rand()%MAX_POS_WRAP; + pTarget->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20); + if (Creature *wrap = DoSummon(MOB_WEB_WRAP, PosWrap[pos], 0, TEMPSUMMON_CORPSE_DESPAWN)) + wrap->AI()->SetGUID(pTarget->GetGUID()); + } + } + events.ScheduleEvent(EVENT_WRAP, 40000); + break; + case EVENT_SPRAY: + DoCastAOE(RAID_MODE(SPELL_WEB_SPRAY_10,SPELL_WEB_SPRAY_25)); + events.ScheduleEvent(EVENT_SPRAY, 40000); + break; + case EVENT_SHOCK: + DoCastAOE(RAID_MODE(SPELL_POISON_SHOCK_10,SPELL_POISON_SHOCK_25)); + events.ScheduleEvent(EVENT_SHOCK, urand(10000,20000)); + break; + case EVENT_POISON: + DoCast(me->getVictim(), RAID_MODE(SPELL_NECROTIC_POISON_10,SPELL_NECROTIC_POISON_25)); + events.ScheduleEvent(EVENT_POISON, urand(10000, 20000)); + break; + case EVENT_FRENZY: + DoCast(me, RAID_MODE(SPELL_FRENZY_10,SPELL_FRENZY_25), true); + events.ScheduleEvent(EVENT_FRENZY, 600000); + break; + case EVENT_SUMMON: + // TODO : Add missing text + uint8 amount = urand(8,10); + for (uint8 i = 0; i < amount; ++i) + DoSummon(MOB_SPIDERLING, me, 0, TEMPSUMMON_CORPSE_DESPAWN); + events.ScheduleEvent(EVENT_SUMMON, 40000); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_webwrap : public CreatureScript +{ +public: + mob_webwrap() : CreatureScript("mob_webwrap") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_webwrapAI (pCreature); + } + + struct mob_webwrapAI : public NullCreatureAI + { + mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} + + uint64 victimGUID; + + void SetGUID(const uint64 &guid, int32 /*param*/) + { + victimGUID = guid; + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit * /*killer*/) + { + if (me->m_spells[0] && victimGUID) + if (Unit *victim = Unit::GetUnit(*me, victimGUID)) + victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); + } + }; + }; -struct mob_webwrapAI : public NullCreatureAI -{ - mob_webwrapAI(Creature *c) : NullCreatureAI(c), victimGUID(0) {} - uint64 victimGUID; - - void SetGUID(const uint64 &guid, int32 /*param*/) - { - victimGUID = guid; - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->CastSpell(victim, me->m_spells[0], true, NULL, NULL, me->GetGUID()); - } - - void JustDied(Unit * /*killer*/) - { - if (me->m_spells[0] && victimGUID) - if (Unit *victim = Unit::GetUnit(*me, victimGUID)) - victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID()); - } -}; - -CreatureAI* GetAI_boss_maexxna(Creature* pCreature) -{ - return new boss_maexxnaAI (pCreature); -} - -CreatureAI* GetAI_mob_webwrap(Creature* pCreature) -{ - return new mob_webwrapAI (pCreature); -} void AddSC_boss_maexxna() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_maexxna"; - newscript->GetAI = &GetAI_boss_maexxna; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_webwrap"; - newscript->GetAI = &GetAI_mob_webwrap; - newscript->RegisterSelf(); - + new boss_maexxna(); + new mob_webwrap(); } - diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index 6b93e5ea19d..569ef2b1670 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -62,152 +62,155 @@ enum Events EVENT_WAVE, EVENT_GROUND, }; - -struct boss_nothAI : public BossAI + class boss_noth : public CreatureScript { - boss_nothAI(Creature *c) : BossAI(c, BOSS_NOTH) {} +public: + boss_noth() : CreatureScript("boss_noth") { } - uint32 waveCount, balconyCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - _Reset(); + return new boss_nothAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_nothAI : public BossAI { - _EnterCombat(); - DoScriptText(SAY_AGGRO, me); - balconyCount = 0; - EnterPhaseGround(); - } + boss_nothAI(Creature *c) : BossAI(c, BOSS_NOTH) {} - void EnterPhaseGround() - { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoZoneInCombat(); - if (me->getThreatManager().isThreatListEmpty()) - EnterEvadeMode(); - else + uint32 waveCount, balconyCount; + + void Reset() { - events.ScheduleEvent(EVENT_BALCONY, 110000); - events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); - events.ScheduleEvent(EVENT_WARRIOR, 30000); - if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) - events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + _Reset(); } - } - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } - - void JustSummoned(Creature *summon) - { - summons.Summon(summon); - summon->setActive(true); - summon->AI()->DoZoneInCombat(); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } - - void SummonUndead(uint32 entry, uint32 num) - { - for (uint32 i = 0; i < num; ++i) + void EnterCombat(Unit * /*who*/) { - uint32 pos = rand()%MAX_SUMMON_POS; - me->SummonCreature(entry, SummonPos[pos][0], SummonPos[pos][1], SummonPos[pos][2], - SummonPos[pos][3], TEMPSUMMON_CORPSE_DESPAWN, 60000); + _EnterCombat(); + DoScriptText(SAY_AGGRO, me); + balconyCount = 0; + EnterPhaseGround(); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateCombatState() || !CheckInRoom()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void EnterPhaseGround() { - switch(eventId) + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoZoneInCombat(); + if (me->getThreatManager().isThreatListEmpty()) + EnterEvadeMode(); + else { - case EVENT_CURSE: - DoCastAOE(SPELL_CURSE_PLAGUEBRINGER); - events.ScheduleEvent(EVENT_CURSE, 50000 + rand()%10000); - return; - case EVENT_WARRIOR: - DoScriptText(SAY_SUMMON, me); - SummonUndead(MOB_WARRIOR, RAID_MODE(2,3)); - events.ScheduleEvent(EVENT_WARRIOR, 30000); - return; - case EVENT_BLINK: - DoCastAOE(SPELL_CRIPPLE, true); - DoCastAOE(SPELL_BLINK); - DoResetThreat(); - events.ScheduleEvent(EVENT_BLINK, 40000); - return; - case EVENT_BALCONY: - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AttackStop(); - me->RemoveAllAuras(); - me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O); - events.Reset(); - events.ScheduleEvent(EVENT_WAVE, 2000 + rand()%3000); - waveCount = 0; - return; - case EVENT_WAVE: - DoScriptText(SAY_SUMMON, me); - switch(balconyCount) - { - case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2,4)); break; - case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1,2)); - SummonUndead(MOB_GUARDIAN, RAID_MODE(1,2)); break; - case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2,4)); break; - default:SummonUndead(MOB_CHAMPION, RAID_MODE(5,10)); - SummonUndead(MOB_GUARDIAN, RAID_MODE(5,10));break; - } - ++waveCount; - events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, 30000 + rand()%15000); - return; - case EVENT_GROUND: - { - ++balconyCount; - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->NearTeleportTo(x, y, z, o); - events.ScheduleEvent(EVENT_BALCONY, 110000); - EnterPhaseGround(); - return; - } + events.ScheduleEvent(EVENT_BALCONY, 110000); + events.ScheduleEvent(EVENT_CURSE, 10000+rand()%15000); + events.ScheduleEvent(EVENT_WARRIOR, 30000); + if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL) + events.ScheduleEvent(EVENT_BLINK, 20000 + rand()%20000); } } - if (me->HasReactState(REACT_AGGRESSIVE)) - DoMeleeAttackIfReady(); - } + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); + } + + void JustSummoned(Creature *summon) + { + summons.Summon(summon); + summon->setActive(true); + summon->AI()->DoZoneInCombat(); + } + + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } + + void SummonUndead(uint32 entry, uint32 num) + { + for (uint32 i = 0; i < num; ++i) + { + uint32 pos = rand()%MAX_SUMMON_POS; + me->SummonCreature(entry, SummonPos[pos][0], SummonPos[pos][1], SummonPos[pos][2], + SummonPos[pos][3], TEMPSUMMON_CORPSE_DESPAWN, 60000); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateCombatState() || !CheckInRoom()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_CURSE: + DoCastAOE(SPELL_CURSE_PLAGUEBRINGER); + events.ScheduleEvent(EVENT_CURSE, 50000 + rand()%10000); + return; + case EVENT_WARRIOR: + DoScriptText(SAY_SUMMON, me); + SummonUndead(MOB_WARRIOR, RAID_MODE(2,3)); + events.ScheduleEvent(EVENT_WARRIOR, 30000); + return; + case EVENT_BLINK: + DoCastAOE(SPELL_CRIPPLE, true); + DoCastAOE(SPELL_BLINK); + DoResetThreat(); + events.ScheduleEvent(EVENT_BLINK, 40000); + return; + case EVENT_BALCONY: + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AttackStop(); + me->RemoveAllAuras(); + me->NearTeleportTo(TELE_X, TELE_Y, TELE_Z, TELE_O); + events.Reset(); + events.ScheduleEvent(EVENT_WAVE, 2000 + rand()%3000); + waveCount = 0; + return; + case EVENT_WAVE: + DoScriptText(SAY_SUMMON, me); + switch(balconyCount) + { + case 0: SummonUndead(MOB_CHAMPION, RAID_MODE(2,4)); break; + case 1: SummonUndead(MOB_CHAMPION, RAID_MODE(1,2)); + SummonUndead(MOB_GUARDIAN, RAID_MODE(1,2)); break; + case 2: SummonUndead(MOB_GUARDIAN, RAID_MODE(2,4)); break; + default:SummonUndead(MOB_CHAMPION, RAID_MODE(5,10)); + SummonUndead(MOB_GUARDIAN, RAID_MODE(5,10));break; + } + ++waveCount; + events.ScheduleEvent(waveCount < 2 ? EVENT_WAVE : EVENT_GROUND, 30000 + rand()%15000); + return; + case EVENT_GROUND: + { + ++balconyCount; + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->NearTeleportTo(x, y, z, o); + events.ScheduleEvent(EVENT_BALCONY, 110000); + EnterPhaseGround(); + return; + } + } + } + + if (me->HasReactState(REACT_AGGRESSIVE)) + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_noth(Creature* pCreature) -{ - return new boss_nothAI (pCreature); -} void AddSC_boss_noth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_noth"; - newscript->GetAI = &GetAI_boss_noth; - newscript->RegisterSelf(); + new boss_noth(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index bd30cb20471..22551ac379e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -49,112 +49,115 @@ enum { ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286, }; - -struct boss_patchwerkAI : public BossAI + class boss_patchwerk : public CreatureScript { - boss_patchwerkAI(Creature *c) : BossAI(c, BOSS_PATCHWERK) {} +public: + boss_patchwerk() : CreatureScript("boss_patchwerk") { } - bool Enraged; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + return new boss_patchwerkAI (pCreature); } - void KilledUnit(Unit* /*Victim*/) + struct boss_patchwerkAI : public BossAI { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } + boss_patchwerkAI(Creature *c) : BossAI(c, BOSS_PATCHWERK) {} - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } + bool Enraged; - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - Enraged = false; - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); - events.ScheduleEvent(EVENT_HATEFUL, 1200); - events.ScheduleEvent(EVENT_BERSERK, 360000); - - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) + _Reset(); + + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + } + + void KilledUnit(Unit* /*Victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); + } + + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } + + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + Enraged = false; + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); + events.ScheduleEvent(EVENT_HATEFUL, 1200); + events.ScheduleEvent(EVENT_BERSERK, 360000); + + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_HATEFUL: + switch(eventId) { - //Cast Hateful strike on the player with the highest - //amount of HP within melee distance - uint32 MostHP = 0; - Unit* pMostHPTarget = NULL; - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + case EVENT_HATEFUL: { - Unit *pTarget = (*i)->getTarget(); - if (pTarget->isAlive() && pTarget->GetHealth() > MostHP && me->IsWithinMeleeRange(pTarget)) + //Cast Hateful strike on the player with the highest + //amount of HP within melee distance + uint32 MostHP = 0; + Unit* pMostHPTarget = NULL; + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - MostHP = pTarget->GetHealth(); - pMostHPTarget = pTarget; + Unit *pTarget = (*i)->getTarget(); + if (pTarget->isAlive() && pTarget->GetHealth() > MostHP && me->IsWithinMeleeRange(pTarget)) + { + MostHP = pTarget->GetHealth(); + pMostHPTarget = pTarget; + } } + + if (pMostHPTarget) + DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE,H_SPELL_HATEFUL_STRIKE), true); + + events.ScheduleEvent(EVENT_HATEFUL, 1200); + break; } - - if (pMostHPTarget) - DoCast(pMostHPTarget, RAID_MODE(SPELL_HATEFUL_STRIKE,H_SPELL_HATEFUL_STRIKE), true); - - events.ScheduleEvent(EVENT_HATEFUL, 1200); - break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + DoScriptText(EMOTE_BERSERK, me); + events.ScheduleEvent(EVENT_SLIME, 2000); + break; + case EVENT_SLIME: + DoCast(me->getVictim(), SPELL_SLIME_BOLT); + events.ScheduleEvent(EVENT_SLIME, 2000); + break; } - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - DoScriptText(EMOTE_BERSERK, me); - events.ScheduleEvent(EVENT_SLIME, 2000); - break; - case EVENT_SLIME: - DoCast(me->getVictim(), SPELL_SLIME_BOLT); - events.ScheduleEvent(EVENT_SLIME, 2000); - break; } - } - if (!Enraged && HealthBelowPct(5)) - { - DoCast(me, SPELL_FRENZY, true); - DoScriptText(EMOTE_ENRAGE, me); - Enraged = true; - } + if (!Enraged && HealthBelowPct(5)) + { + DoCast(me, SPELL_FRENZY, true); + DoScriptText(EMOTE_ENRAGE, me); + Enraged = true; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_patchwerk(Creature* pCreature) -{ - return new boss_patchwerkAI (pCreature); -} void AddSC_boss_patchwerk() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_patchwerk"; - newscript->GetAI = &GetAI_boss_patchwerk; - newscript->RegisterSelf(); + new boss_patchwerk(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index 12d5b3057f5..bef81ded30f 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -51,88 +51,91 @@ enum Events EVENT_KNIFE, EVENT_COMMAND, }; - -struct boss_razuviousAI : public BossAI + class boss_razuvious : public CreatureScript { - boss_razuviousAI(Creature *c) : BossAI(c, BOSS_RAZUVIOUS) {} +public: + boss_razuvious() : CreatureScript("boss_razuvious") { } - void KilledUnit(Unit* /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (!(rand()%3)) - DoPlaySoundToSet(me, SOUND_SLAY); + return new boss_razuviousAI (pCreature); } - void DamageTaken(Unit* pDone_by, uint32& uiDamage) + struct boss_razuviousAI : public BossAI { - // Damage done by the controlled Death Knight understudies should also count toward damage done by players - if (pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941)) + boss_razuviousAI(Creature *c) : BossAI(c, BOSS_RAZUVIOUS) {} + + void KilledUnit(Unit* /*victim*/) { - me->LowerPlayerDamageReq(uiDamage); + if (!(rand()%3)) + DoPlaySoundToSet(me, SOUND_SLAY); } - } - void JustDied(Unit* /*killer*/) - { - _JustDied(); - DoPlaySoundToSet(me, SOUND_DEATH); - me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures - } - - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoPlaySoundToSet(me, SOUND_AGGRO); - events.ScheduleEvent(EVENT_STRIKE, 30000); - events.ScheduleEvent(EVENT_SHOUT, 25000); - events.ScheduleEvent(EVENT_COMMAND, 40000); - events.ScheduleEvent(EVENT_KNIFE, 10000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void DamageTaken(Unit* pDone_by, uint32& uiDamage) { - switch(eventId) + // Damage done by the controlled Death Knight understudies should also count toward damage done by players + if (pDone_by->GetTypeId() == TYPEID_UNIT && (pDone_by->GetEntry() == 16803 || pDone_by->GetEntry() == 29941)) { - case EVENT_STRIKE: - DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); - events.ScheduleEvent(EVENT_STRIKE, 30000); - return; - case EVENT_SHOUT: - DoCastAOE(SPELL_DISRUPTING_SHOUT); - events.ScheduleEvent(EVENT_SHOUT, 25000); - return; - case EVENT_KNIFE: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) - DoCast(pTarget, SPELL_JAGGED_KNIFE); - events.ScheduleEvent(EVENT_KNIFE, 10000); - return; - case EVENT_COMMAND: - DoPlaySoundToSet(me, SOUND_COMMND); - events.ScheduleEvent(EVENT_COMMAND, 40000); - return; + me->LowerPlayerDamageReq(uiDamage); } } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) + { + _JustDied(); + DoPlaySoundToSet(me, SOUND_DEATH); + me->CastSpell(me, SPELL_HOPELESS, true); // TODO: this may affect other creatures + } + + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoPlaySoundToSet(me, SOUND_AGGRO); + events.ScheduleEvent(EVENT_STRIKE, 30000); + events.ScheduleEvent(EVENT_SHOUT, 25000); + events.ScheduleEvent(EVENT_COMMAND, 40000); + events.ScheduleEvent(EVENT_KNIFE, 10000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_STRIKE: + DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); + events.ScheduleEvent(EVENT_STRIKE, 30000); + return; + case EVENT_SHOUT: + DoCastAOE(SPELL_DISRUPTING_SHOUT); + events.ScheduleEvent(EVENT_SHOUT, 25000); + return; + case EVENT_KNIFE: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) + DoCast(pTarget, SPELL_JAGGED_KNIFE); + events.ScheduleEvent(EVENT_KNIFE, 10000); + return; + case EVENT_COMMAND: + DoPlaySoundToSet(me, SOUND_COMMND); + events.ScheduleEvent(EVENT_COMMAND, 40000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_razuvious(Creature* pCreature) -{ - return new boss_razuviousAI (pCreature); -} void AddSC_boss_razuvious() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razuvious"; - newscript->GetAI = &GetAI_boss_razuvious; - newscript->RegisterSelf(); + new boss_razuvious(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 0b2ac4173e2..d2c341d6db1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -68,335 +68,334 @@ enum Events }; typedef std::map IceBlockMap; - -struct boss_sapphironAI : public BossAI + class boss_sapphiron : public CreatureScript { - boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) - , phase(PHASE_NULL) +public: + boss_sapphiron() : CreatureScript("boss_sapphiron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pMap = me->GetMap(); + return new boss_sapphironAI (pCreature); } - Phases phase; - uint32 iceboltCount; - IceBlockMap iceblocks; - - bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147) - uint32 CheckFrostResistTimer; - Map* pMap; - - void InitializeAI() + struct boss_sapphironAI : public BossAI { - float x, y, z; - me->GetPosition(x, y, z); - me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - - ScriptedAI::InitializeAI(); - } - - void Reset() - { - _Reset(); - - if (phase == PHASE_FLIGHT) - ClearIceBlock(); - - phase = PHASE_NULL; - - CanTheHundredClub = true; - CheckFrostResistTimer = 5000; - } - - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - - me->CastSpell(me, SPELL_FROST_AURA, true); - - events.ScheduleEvent(EVENT_BERSERK, 15*60000); - EnterPhaseGround(); - - CheckPlayersFrostResist(); - } - - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (spell->Id == SPELL_ICEBOLT) + boss_sapphironAI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) + , phase(PHASE_NULL) { - IceBlockMap::iterator itr = iceblocks.find(pTarget->GetGUID()); - if (itr != iceblocks.end() && !itr->second) - { - if (GameObject *iceblock = me->SummonGameObject(GO_ICEBLOCK, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, 0, 0, 0, 0, 25000)) - itr->second = iceblock->GetGUID(); - } + pMap = me->GetMap(); } - } - void JustDied(Unit* /*who*/) - { - _JustDied(); - me->CastSpell(me, SPELL_DIES, true); + Phases phase; + uint32 iceboltCount; + IceBlockMap iceblocks; - CheckPlayersFrostResist(); - if (CanTheHundredClub) + bool CanTheHundredClub; // needed for achievement: The Hundred Club(2146, 2147) + uint32 CheckFrostResistTimer; + Map* pMap; + + void InitializeAI() { - AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); - if (AchievTheHundredClub) + float x, y, z; + me->GetPosition(x, y, z); + me->SummonGameObject(GO_BIRTH, x, y, z, 0, 0, 0, 0, 0, 0); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + + ScriptedAI::InitializeAI(); + } + + void Reset() + { + _Reset(); + + if (phase == PHASE_FLIGHT) + ClearIceBlock(); + + phase = PHASE_NULL; + + CanTheHundredClub = true; + CheckFrostResistTimer = 5000; + } + + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + + me->CastSpell(me, SPELL_FROST_AURA, true); + + events.ScheduleEvent(EVENT_BERSERK, 15*60000); + EnterPhaseGround(); + + CheckPlayersFrostResist(); + } + + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) + { + if (spell->Id == SPELL_ICEBOLT) { - if (pMap && pMap->IsDungeon()) + IceBlockMap::iterator itr = iceblocks.find(pTarget->GetGUID()); + if (itr != iceblocks.end() && !itr->second) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievTheHundredClub); + if (GameObject *iceblock = me->SummonGameObject(GO_ICEBLOCK, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, 0, 0, 0, 0, 25000)) + itr->second = iceblock->GetGUID(); } } } - } - void MovementInform(uint32, uint32 id) - { - if (id == 1) - events.ScheduleEvent(EVENT_LIFTOFF, 0); - } - - void DoAction(const int32 param) - { - if (param == DATA_SAPPHIRON_BIRTH) + void JustDied(Unit* /*who*/) { - phase = PHASE_BIRTH; - events.ScheduleEvent(EVENT_BIRTH, 23000); - } - } + _JustDied(); + me->CastSpell(me, SPELL_DIES, true); - void CheckPlayersFrostResist() - { - if (CanTheHundredClub && pMap && pMap->IsDungeon()) - { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + CheckPlayersFrostResist(); + if (CanTheHundredClub) { - if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) + AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); + if (AchievTheHundredClub) { - CanTheHundredClub = false; - break; - } - } - } - } - - void EnterPhaseGround() - { - phase = PHASE_GROUND; - me->SetReactState(REACT_AGGRESSIVE); - events.SetPhase(PHASE_GROUND); - events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND); - events.ScheduleEvent(EVENT_FLIGHT, 45000); - } - - void ClearIceBlock() - { - for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) - { - if (Player* pPlayer = Unit::GetPlayer(*me, itr->first)) - pPlayer->RemoveAura(SPELL_ICEBOLT); - if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) - pGo->Delete(); - } - iceblocks.clear(); - } - - void UpdateAI(const uint32 diff) - { - if (!phase) - return; - - events.Update(diff); - - if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom()) - return; - - if (CanTheHundredClub) - { - if (CheckFrostResistTimer <= diff) - { - CheckPlayersFrostResist(); - CheckFrostResistTimer = (rand() % 5 + 5) * 1000; - } else CheckFrostResistTimer -= diff; - } - - if (phase == PHASE_GROUND) - { - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_BERSERK: - DoScriptText(EMOTE_ENRAGE, me); - DoCast(me, SPELL_BERSERK); - return; - case EVENT_CLEAVE: - DoCast(me->getVictim(), SPELL_CLEAVE); - events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); - return; - case EVENT_TAIL: - DoCastAOE(SPELL_TAIL_SWEEP); - events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); - return; - case EVENT_DRAIN: - DoCastAOE(SPELL_LIFE_DRAIN); - events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); - return; - case EVENT_BLIZZARD: + if (pMap && pMap->IsDungeon()) { - //DoCastAOE(SPELL_SUMMON_BLIZZARD); - if (Creature *pSummon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000,30000), TEMPSUMMON_TIMED_DESPAWN)) - pSummon->GetMotionMaster()->MoveRandom(40); - events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000,7000), 0, PHASE_GROUND); + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievTheHundredClub); + } + } + } + } + + void MovementInform(uint32, uint32 id) + { + if (id == 1) + events.ScheduleEvent(EVENT_LIFTOFF, 0); + } + + void DoAction(const int32 param) + { + if (param == DATA_SAPPHIRON_BIRTH) + { + phase = PHASE_BIRTH; + events.ScheduleEvent(EVENT_BIRTH, 23000); + } + } + + void CheckPlayersFrostResist() + { + if (CanTheHundredClub && pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (itr->getSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) + { + CanTheHundredClub = false; break; } - case EVENT_FLIGHT: - phase = PHASE_FLIGHT; - events.SetPhase(PHASE_FLIGHT); - me->SetReactState(REACT_PASSIVE); - me->AttackStop(); - float x, y, z, o; - me->GetHomePosition(x, y, z, o); - me->GetMotionMaster()->MovePoint(1, x, y, z); - return; } } - - DoMeleeAttackIfReady(); } - else + + void EnterPhaseGround() { - if (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_LIFTOFF: - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_ICEBOLT, 1500); - iceboltCount = RAID_MODE(2,3); - return; - case EVENT_ICEBOLT: - { - std::vector targets; - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) - targets.push_back((*i)->getTarget()); + phase = PHASE_GROUND; + me->SetReactState(REACT_AGGRESSIVE); + events.SetPhase(PHASE_GROUND); + events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_BLIZZARD, 5000+rand()%5000, 0, PHASE_GROUND); + events.ScheduleEvent(EVENT_FLIGHT, 45000); + } - if (targets.empty()) - iceboltCount = 0; - else - { - std::vector::const_iterator itr = targets.begin(); - advance(itr, rand()%targets.size()); - iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); - DoCast(*itr, SPELL_ICEBOLT); - --iceboltCount; - } - - if (iceboltCount) - events.ScheduleEvent(EVENT_ICEBOLT, 1000); - else - events.ScheduleEvent(EVENT_BREATH, 1000); - return; - } - case EVENT_BREATH: - { - DoScriptText(EMOTE_BREATH, me); - DoCastAOE(SPELL_FROST_MISSILE); - events.ScheduleEvent(EVENT_EXPLOSION, 8000); - return; - } - case EVENT_EXPLOSION: - CastExplosion(); - ClearIceBlock(); - events.ScheduleEvent(EVENT_LAND, 3000); - return; - case EVENT_LAND: - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SendMovementFlagUpdate(); - events.ScheduleEvent(EVENT_GROUND, 1500); - return; - case EVENT_GROUND: - EnterPhaseGround(); - return; - case EVENT_BIRTH: - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - return; - } - }//if (uint32 eventId = events.ExecuteEvent()) - }//if (phase == PHASE_GROUND) - } - - void CastExplosion() - { - DoZoneInCombat(); // make sure everyone is in threatlist - std::vector targets; - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + void ClearIceBlock() { - Unit *pTarget = (*i)->getTarget(); - if (pTarget->GetTypeId() != TYPEID_PLAYER) - continue; - - if (pTarget->HasAura(SPELL_ICEBOLT)) - { - pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); - targets.push_back(pTarget); - continue; - } - for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) { + if (Player* pPlayer = Unit::GetPlayer(*me, itr->first)) + pPlayer->RemoveAura(SPELL_ICEBOLT); if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) + pGo->Delete(); + } + iceblocks.clear(); + } + + void UpdateAI(const uint32 diff) + { + if (!phase) + return; + + events.Update(diff); + + if (phase != PHASE_BIRTH && !UpdateCombatState() || !CheckInRoom()) + return; + + if (CanTheHundredClub) + { + if (CheckFrostResistTimer <= diff) { - if (pGo->IsInBetween(me, pTarget, 2.0f) - && me->GetExactDist2d(pTarget->GetPositionX(), pTarget->GetPositionY()) - me->GetExactDist2d(pGo->GetPositionX(), pGo->GetPositionY()) < 5.0f) + CheckPlayersFrostResist(); + CheckFrostResistTimer = (rand() % 5 + 5) * 1000; + } else CheckFrostResistTimer -= diff; + } + + if (phase == PHASE_GROUND) + { + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) { - pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); - targets.push_back(pTarget); - break; + case EVENT_BERSERK: + DoScriptText(EMOTE_ENRAGE, me); + DoCast(me, SPELL_BERSERK); + return; + case EVENT_CLEAVE: + DoCast(me->getVictim(), SPELL_CLEAVE); + events.ScheduleEvent(EVENT_CLEAVE, 5000+rand()%10000, 0, PHASE_GROUND); + return; + case EVENT_TAIL: + DoCastAOE(SPELL_TAIL_SWEEP); + events.ScheduleEvent(EVENT_TAIL, 5000+rand()%10000, 0, PHASE_GROUND); + return; + case EVENT_DRAIN: + DoCastAOE(SPELL_LIFE_DRAIN); + events.ScheduleEvent(EVENT_DRAIN, 24000, 0, PHASE_GROUND); + return; + case EVENT_BLIZZARD: + { + //DoCastAOE(SPELL_SUMMON_BLIZZARD); + if (Creature *pSummon = DoSummon(MOB_BLIZZARD, me, 0.0f, urand(25000,30000), TEMPSUMMON_TIMED_DESPAWN)) + pSummon->GetMotionMaster()->MoveRandom(40); + events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20000,7000), 0, PHASE_GROUND); + break; + } + case EVENT_FLIGHT: + phase = PHASE_FLIGHT; + events.SetPhase(PHASE_FLIGHT); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + float x, y, z, o; + me->GetHomePosition(x, y, z, o); + me->GetMotionMaster()->MovePoint(1, x, y, z); + return; + } + } + + DoMeleeAttackIfReady(); + } + else + { + if (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_LIFTOFF: + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMovementFlagUpdate(); + events.ScheduleEvent(EVENT_ICEBOLT, 1500); + iceboltCount = RAID_MODE(2,3); + return; + case EVENT_ICEBOLT: + { + std::vector targets; + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) + targets.push_back((*i)->getTarget()); + + if (targets.empty()) + iceboltCount = 0; + else + { + std::vector::const_iterator itr = targets.begin(); + advance(itr, rand()%targets.size()); + iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); + DoCast(*itr, SPELL_ICEBOLT); + --iceboltCount; + } + + if (iceboltCount) + events.ScheduleEvent(EVENT_ICEBOLT, 1000); + else + events.ScheduleEvent(EVENT_BREATH, 1000); + return; + } + case EVENT_BREATH: + { + DoScriptText(EMOTE_BREATH, me); + DoCastAOE(SPELL_FROST_MISSILE); + events.ScheduleEvent(EVENT_EXPLOSION, 8000); + return; + } + case EVENT_EXPLOSION: + CastExplosion(); + ClearIceBlock(); + events.ScheduleEvent(EVENT_LAND, 3000); + return; + case EVENT_LAND: + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SendMovementFlagUpdate(); + events.ScheduleEvent(EVENT_GROUND, 1500); + return; + case EVENT_GROUND: + EnterPhaseGround(); + return; + case EVENT_BIRTH: + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + return; + } + }//if (uint32 eventId = events.ExecuteEvent()) + }//if (phase == PHASE_GROUND) + } + + void CastExplosion() + { + DoZoneInCombat(); // make sure everyone is in threatlist + std::vector targets; + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit *pTarget = (*i)->getTarget(); + if (pTarget->GetTypeId() != TYPEID_PLAYER) + continue; + + if (pTarget->HasAura(SPELL_ICEBOLT)) + { + pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); + targets.push_back(pTarget); + continue; + } + + for (IceBlockMap::const_iterator itr = iceblocks.begin(); itr != iceblocks.end(); ++itr) + { + if (GameObject* pGo = GameObject::GetGameObject(*me, itr->second)) + { + if (pGo->IsInBetween(me, pTarget, 2.0f) + && me->GetExactDist2d(pTarget->GetPositionX(), pTarget->GetPositionY()) - me->GetExactDist2d(pGo->GetPositionX(), pGo->GetPositionY()) < 5.0f) + { + pTarget->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, true); + targets.push_back(pTarget); + break; + } } } } + + me->CastSpell(me, SPELL_FROST_EXPLOSION, true); + + for (std::vector::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); } + }; - me->CastSpell(me, SPELL_FROST_EXPLOSION, true); - - for (std::vector::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - (*itr)->ApplySpellImmune(0, IMMUNITY_ID, SPELL_FROST_EXPLOSION, false); - } }; -CreatureAI* GetAI_boss_sapphiron(Creature* pCreature) -{ - return new boss_sapphironAI (pCreature); -} void AddSC_boss_sapphiron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_sapphiron"; - newscript->GetAI = &GetAI_boss_sapphiron; - newscript->RegisterSelf(); - - // Chill - GetAISpellInfo(28547)->cooldown = 1000; - GetAISpellInfo(55699)->cooldown = 1000; + new boss_sapphiron(); } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 9d224f01022..a027aeda3bc 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -93,307 +93,316 @@ enum Events EVENT_CHAIN, EVENT_BERSERK, }; - -struct boss_thaddiusAI : public BossAI + class boss_thaddius : public CreatureScript { - boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS) +public: + boss_thaddius() : CreatureScript("boss_thaddius") { } + + CreatureAI* GetAI(Creature* pCreature) const { - // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe - // and, in particular, if there was a crash after both adds were killed (should not respawn) + return new boss_thaddiusAI (pCreature); + } - // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn - // and each mob will send its status at reset (meaning that it is alive) - checkFeugenAlive = false; - if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) - checkFeugenAlive = pFeugen->isAlive(); - - checkStalaggAlive = false; - if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) - checkStalaggAlive = pStalagg->isAlive(); - - if (!checkFeugenAlive && !checkStalaggAlive) + struct boss_thaddiusAI : public BossAI + { + boss_thaddiusAI(Creature *c) : BossAI(c, BOSS_THADDIUS) + { + // init is a bit tricky because thaddius shall track the life of both adds, but not if there was a wipe + // and, in particular, if there was a crash after both adds were killed (should not respawn) + + // Moreover, the adds may not yet be spawn. So just track down the status if mob is spawn + // and each mob will send its status at reset (meaning that it is alive) + checkFeugenAlive = false; + if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + checkFeugenAlive = pFeugen->isAlive(); + + checkStalaggAlive = false; + if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + checkStalaggAlive = pStalagg->isAlive(); + + if (!checkFeugenAlive && !checkStalaggAlive) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_AGGRESSIVE); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } + } + + bool checkStalaggAlive; + bool checkFeugenAlive; + uint32 uiAddsTimer; + + void KilledUnit(Unit* /*victim*/) + { + if (!(rand()%5)) + DoScriptText(SAY_SLAY, me); + } + + void JustDied(Unit* /*Killer*/) + { + _JustDied(); + DoScriptText(SAY_DEATH, me); + } + + void DoAction(const int32 action) + { + switch(action) + { + case ACTION_FEUGEN_RESET: + checkFeugenAlive = true; + break; + case ACTION_FEUGEN_DIED: + checkFeugenAlive = false; + break; + case ACTION_STALAGG_RESET: + checkStalaggAlive = true; + break; + case ACTION_STALAGG_DIED: + checkStalaggAlive = false; + break; + } + + if (!checkFeugenAlive && !checkStalaggAlive) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + // REACT_AGGRESSIVE only reset when he takes damage. + DoZoneInCombat(); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); + } + } + + void EnterCombat(Unit * /*who*/) + { + _EnterCombat(); + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + events.ScheduleEvent(EVENT_SHIFT, 30000); + events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); + events.ScheduleEvent(EVENT_BERSERK, 360000); + } + + void DamageTaken(Unit * /*pDoneBy*/, uint32 & /*uiDamage*/) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); me->SetReactState(REACT_AGGRESSIVE); } - else + + void UpdateAI(const uint32 diff) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } - } + if (checkFeugenAlive && checkStalaggAlive) + uiAddsTimer = 0; - bool checkStalaggAlive; - bool checkFeugenAlive; - uint32 uiAddsTimer; - - void KilledUnit(Unit* /*victim*/) - { - if (!(rand()%5)) - DoScriptText(SAY_SLAY, me); - } - - void JustDied(Unit* /*Killer*/) - { - _JustDied(); - DoScriptText(SAY_DEATH, me); - } - - void DoAction(const int32 action) - { - switch(action) - { - case ACTION_FEUGEN_RESET: - checkFeugenAlive = true; - break; - case ACTION_FEUGEN_DIED: - checkFeugenAlive = false; - break; - case ACTION_STALAGG_RESET: - checkStalaggAlive = true; - break; - case ACTION_STALAGG_DIED: - checkStalaggAlive = false; - break; - } - - if (!checkFeugenAlive && !checkStalaggAlive) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - // REACT_AGGRESSIVE only reset when he takes damage. - DoZoneInCombat(); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); - } - } - - void EnterCombat(Unit * /*who*/) - { - _EnterCombat(); - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - events.ScheduleEvent(EVENT_SHIFT, 30000); - events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); - events.ScheduleEvent(EVENT_BERSERK, 360000); - } - - void DamageTaken(Unit * /*pDoneBy*/, uint32 & /*uiDamage*/) - { - me->SetReactState(REACT_AGGRESSIVE); - } - - void UpdateAI(const uint32 diff) - { - if (checkFeugenAlive && checkStalaggAlive) - uiAddsTimer = 0; - - if (checkStalaggAlive != checkFeugenAlive) - { - uiAddsTimer += diff; - if (uiAddsTimer > 5000) + if (checkStalaggAlive != checkFeugenAlive) { - if (!checkStalaggAlive) + uiAddsTimer += diff; + if (uiAddsTimer > 5000) { - if (instance) - if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) - pStalagg->Respawn(); - } - else - { - if (instance) - if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) - pFeugen->Respawn(); + if (!checkStalaggAlive) + { + if (instance) + if (Creature *pStalagg = me->GetCreature(*me, instance->GetData64(DATA_STALAGG))) + pStalagg->Respawn(); + } + else + { + if (instance) + if (Creature *pFeugen = me->GetCreature(*me, instance->GetData64(DATA_FEUGEN))) + pFeugen->Respawn(); + } } } - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - events.Update(diff); + events.Update(diff); - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_SHIFT: - DoCastAOE(SPELL_POLARITY_SHIFT); - events.ScheduleEvent(EVENT_SHIFT, 30000); - return; - case EVENT_CHAIN: - DoCast(me->getVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING, H_SPELL_CHAIN_LIGHTNING)); - events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); - return; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - return; + switch(eventId) + { + case EVENT_SHIFT: + DoCastAOE(SPELL_POLARITY_SHIFT); + events.ScheduleEvent(EVENT_SHIFT, 30000); + return; + case EVENT_CHAIN: + DoCast(me->getVictim(), RAID_MODE(SPELL_CHAIN_LIGHTNING, H_SPELL_CHAIN_LIGHTNING)); + events.ScheduleEvent(EVENT_CHAIN, urand(10000,20000)); + return; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + return; + } } - } - if (events.GetTimer() > 15000 && !me->IsWithinMeleeRange(me->getVictim())) - DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); - else - DoMeleeAttackIfReady(); - } + if (events.GetTimer() > 15000 && !me->IsWithinMeleeRange(me->getVictim())) + DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); + else + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_thaddius(Creature* pCreature) + class mob_stalagg : public CreatureScript { - return new boss_thaddiusAI (pCreature); -} +public: + mob_stalagg() : CreatureScript("mob_stalagg") { } -struct mob_stalaggAI : public ScriptedAI -{ - mob_stalaggAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_stalaggAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 powerSurgeTimer; - uint32 magneticPullTimer; - - void Reset() + struct mob_stalaggAI : public ScriptedAI { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); - powerSurgeTimer = urand(20000,25000); - magneticPullTimer = 20000; - } - - void EnterCombat(Unit * /*pWho*/) - { - DoCast(SPELL_STALAGG_TESLA); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (magneticPullTimer <= uiDiff) + mob_stalaggAI(Creature *c) : ScriptedAI(c) { - if (Creature *pFeugen = me->GetCreature(*me, pInstance->GetData64(DATA_FEUGEN))) - { - Unit* pStalaggVictim = me->getVictim(); - Unit* pFeugenVictim = pFeugen->getVictim(); + pInstance = c->GetInstanceScript(); + } - if (pFeugenVictim && pStalaggVictim) - { - // magnetic pull is not working. So just jump. + InstanceScript* pInstance; - // reset aggro to be sure that feugen will not follow the jump - pFeugen->getThreatManager().modifyThreatPercent(pFeugenVictim, -100); - pFeugenVictim->JumpTo(me, 0.3f); - - me->getThreatManager().modifyThreatPercent(pStalaggVictim, -100); - pStalaggVictim->JumpTo(pFeugen, 0.3f); - } - } + uint32 powerSurgeTimer; + uint32 magneticPullTimer; + void Reset() + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_STALAGG_RESET); + powerSurgeTimer = urand(20000,25000); magneticPullTimer = 20000; } - else magneticPullTimer -= uiDiff; - if (powerSurgeTimer <= uiDiff) + void EnterCombat(Unit * /*pWho*/) { - DoCast(me, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE)); - powerSurgeTimer = urand(15000,20000); - } else powerSurgeTimer -= uiDiff; + DoCast(SPELL_STALAGG_TESLA); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_STALAGG_DIED); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (magneticPullTimer <= uiDiff) + { + if (Creature *pFeugen = me->GetCreature(*me, pInstance->GetData64(DATA_FEUGEN))) + { + Unit* pStalaggVictim = me->getVictim(); + Unit* pFeugenVictim = pFeugen->getVictim(); + + if (pFeugenVictim && pStalaggVictim) + { + // magnetic pull is not working. So just jump. + + // reset aggro to be sure that feugen will not follow the jump + pFeugen->getThreatManager().modifyThreatPercent(pFeugenVictim, -100); + pFeugenVictim->JumpTo(me, 0.3f); + + me->getThreatManager().modifyThreatPercent(pStalaggVictim, -100); + pStalaggVictim->JumpTo(pFeugen, 0.3f); + } + } + + magneticPullTimer = 20000; + } + else magneticPullTimer -= uiDiff; + + if (powerSurgeTimer <= uiDiff) + { + DoCast(me, RAID_MODE(SPELL_POWERSURGE, H_SPELL_POWERSURGE)); + powerSurgeTimer = urand(15000,20000); + } else powerSurgeTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_stalagg(Creature* pCreature) + class mob_feugen : public CreatureScript { - return new mob_stalaggAI(pCreature); -} +public: + mob_feugen() : CreatureScript("mob_feugen") { } -struct mob_feugenAI : public ScriptedAI -{ - mob_feugenAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_feugenAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 staticFieldTimer; - - void Reset() + struct mob_feugenAI : public ScriptedAI { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); - staticFieldTimer = 5000; - } - - void EnterCombat(Unit * /*pWho*/) - { - DoCast(SPELL_FEUGEN_TESLA); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) - if (pThaddius->AI()) - pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - - if (staticFieldTimer <= uiDiff) + mob_feugenAI(Creature *c) : ScriptedAI(c) { - DoCast(me, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD)); + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 staticFieldTimer; + + void Reset() + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_FEUGEN_RESET); staticFieldTimer = 5000; - } else staticFieldTimer -= uiDiff; + } + + void EnterCombat(Unit * /*pWho*/) + { + DoCast(SPELL_FEUGEN_TESLA); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + if (Creature *pThaddius = me->GetCreature(*me, pInstance->GetData64(DATA_THADDIUS))) + if (pThaddius->AI()) + pThaddius->AI()->DoAction(ACTION_FEUGEN_DIED); + } + + void UpdateAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; + + if (staticFieldTimer <= uiDiff) + { + DoCast(me, RAID_MODE(SPELL_STATICFIELD, H_SPELL_STATICFIELD)); + staticFieldTimer = 5000; + } else staticFieldTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_feugen(Creature* pCreature) -{ - return new mob_feugenAI(pCreature); -} void AddSC_boss_thaddius() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_thaddius"; - newscript->GetAI = &GetAI_boss_thaddius; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_stalagg"; - newscript->GetAI = &GetAI_mob_stalagg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_feugen"; - newscript->GetAI = &GetAI_mob_feugen; - newscript->RegisterSelf(); + new boss_thaddius(); + new mob_stalagg(); + new mob_feugen(); } diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 6ece32054ae..0f408914e39 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -101,246 +101,249 @@ inline uint32 GetEruptionSection(float x, float y) return i; return 3; } - -struct instance_naxxramas : public InstanceData + class instance_naxxramas : public InstanceMapScript { - instance_naxxramas(Map* pMap) : InstanceData(pMap) +public: + instance_naxxramas() : InstanceMapScript("instance_naxxramas") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - SetBossNumber(MAX_BOSS_NUMBER); - LoadDoorData(doorData); - LoadMinionData(minionData); + return new instance_naxxramas_InstanceMapScript(pMap); } - std::set HeiganEruptionGUID[4]; - uint64 GothikGateGUID; - uint64 HorsemenChestGUID; - uint64 SapphironGUID; - uint64 uiFaerlina; - uint64 uiThane; - uint64 uiLady; - uint64 uiBaron; - uint64 uiSir; - - uint64 uiThaddius; - uint64 uiFeugen; - uint64 uiStalagg; - - uint64 uiKelthuzad; - uint64 uiKelthuzadTrigger; - uint64 uiPortals[4]; - - GOState gothikDoorState; - - time_t minHorsemenDiedTime; - time_t maxHorsemenDiedTime; - - void OnCreatureCreate(Creature* pCreature, bool add) + struct instance_naxxramas_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_naxxramas_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { - case 15989: SapphironGUID = add ? pCreature->GetGUID() : 0; return; - case 15953: uiFaerlina = pCreature->GetGUID(); return; - case 16064: uiThane = pCreature->GetGUID(); return; - case 16065: uiLady = pCreature->GetGUID(); return; - case 30549: uiBaron = pCreature->GetGUID(); return; - case 16063: uiSir = pCreature->GetGUID(); return; - case 15928: uiThaddius = pCreature->GetGUID(); return; - case 15930: uiFeugen = pCreature->GetGUID(); return; - case 15929: uiStalagg = pCreature->GetGUID(); return; - case 15990: uiKelthuzad = pCreature->GetGUID(); return; + SetBossNumber(MAX_BOSS_NUMBER); + LoadDoorData(doorData); + LoadMinionData(minionData); } - AddMinion(pCreature, add); - } + std::set HeiganEruptionGUID[4]; + uint64 GothikGateGUID; + uint64 HorsemenChestGUID; + uint64 SapphironGUID; + uint64 uiFaerlina; + uint64 uiThane; + uint64 uiLady; + uint64 uiBaron; + uint64 uiSir; - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) - { - uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); - if (add) - HeiganEruptionGUID[section].insert(pGo->GetGUID()); - else - HeiganEruptionGUID[section].erase(pGo->GetGUID()); - return; - } + uint64 uiThaddius; + uint64 uiFeugen; + uint64 uiStalagg; - switch(pGo->GetEntry()) + uint64 uiKelthuzad; + uint64 uiKelthuzadTrigger; + uint64 uiPortals[4]; + + GOState gothikDoorState; + + time_t minHorsemenDiedTime; + time_t maxHorsemenDiedTime; + + void OnCreatureCreate(Creature* pCreature, bool add) { - case GO_BIRTH: - if (!add && SapphironGUID) + switch(pCreature->GetEntry()) { - if (Creature *pSapphiron = instance->GetCreature(SapphironGUID)) - pSapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); + case 15989: SapphironGUID = add ? pCreature->GetGUID() : 0; return; + case 15953: uiFaerlina = pCreature->GetGUID(); return; + case 16064: uiThane = pCreature->GetGUID(); return; + case 16065: uiLady = pCreature->GetGUID(); return; + case 30549: uiBaron = pCreature->GetGUID(); return; + case 16063: uiSir = pCreature->GetGUID(); return; + case 15928: uiThaddius = pCreature->GetGUID(); return; + case 15930: uiFeugen = pCreature->GetGUID(); return; + case 15929: uiStalagg = pCreature->GetGUID(); return; + case 15990: uiKelthuzad = pCreature->GetGUID(); return; + } + + AddMinion(pCreature, add); + } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + if (pGo->GetGOInfo()->displayId == 6785 || pGo->GetGOInfo()->displayId == 1287) + { + uint32 section = GetEruptionSection(pGo->GetPositionX(), pGo->GetPositionY()); + if (add) + HeiganEruptionGUID[section].insert(pGo->GetGUID()); + else + HeiganEruptionGUID[section].erase(pGo->GetGUID()); return; } - case GO_GOTHIK_GATE: - GothikGateGUID = add ? pGo->GetGUID() : 0; - pGo->SetGoState(gothikDoorState); - break; - case GO_HORSEMEN_CHEST: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; - case GO_HORSEMEN_CHEST_HERO: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; - case GO_KELTHUZAD_PORTAL01: uiPortals[0] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL02: uiPortals[1] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL03: uiPortals[2] = pGo->GetGUID(); break; - case GO_KELTHUZAD_PORTAL04: uiPortals[3] = pGo->GetGUID(); break; - case GO_KELTHUZAD_TRIGGER: uiKelthuzadTrigger = pGo->GetGUID(); break; - } - AddDoor(pGo, add); - } - - void SetData(uint32 id, uint32 value) - { - switch(id) - { - case DATA_HEIGAN_ERUPT: - HeiganErupt(value); - break; - case DATA_GOTHIK_GATE: - if (GameObject *pGothikGate = instance->GetGameObject(GothikGateGUID)) - pGothikGate->SetGoState(GOState(value)); - gothikDoorState = GOState(value); - break; - - case DATA_HORSEMEN0: - case DATA_HORSEMEN1: - case DATA_HORSEMEN2: - case DATA_HORSEMEN3: - if (value == NOT_STARTED) - { - minHorsemenDiedTime = 0; - maxHorsemenDiedTime = 0; - } - else if (value == DONE) - { - time_t now = time(NULL); - - if (minHorsemenDiedTime == 0) - minHorsemenDiedTime = now; - - maxHorsemenDiedTime = now; - } - break; - } - } - - uint64 GetData64(uint32 id) - { - switch(id) - { - case DATA_FAERLINA: - return uiFaerlina; - case DATA_THANE: - return uiThane; - case DATA_LADY: - return uiLady; - case DATA_BARON: - return uiBaron; - case DATA_SIR: - return uiSir; - case DATA_THADDIUS: - return uiThaddius; - case DATA_FEUGEN: - return uiFeugen; - case DATA_STALAGG: - return uiStalagg; - case DATA_KELTHUZAD: - return uiKelthuzad; - case DATA_KELTHUZAD_PORTAL01: - return uiPortals[0]; - case DATA_KELTHUZAD_PORTAL02: - return uiPortals[1]; - case DATA_KELTHUZAD_PORTAL03: - return uiPortals[2]; - case DATA_KELTHUZAD_PORTAL04: - return uiPortals[3]; - case DATA_KELTHUZAD_TRIGGER: - return uiKelthuzadTrigger; - } - return 0; - } - - bool SetBossState(uint32 id, EncounterState state) - { - if (!InstanceData::SetBossState(id, state)) - return false; - - if (id == BOSS_HORSEMEN && state == DONE) - { - if (GameObject *pHorsemenChest = instance->GetGameObject(HorsemenChestGUID)) - pHorsemenChest->SetRespawnTime(pHorsemenChest->GetRespawnDelay()); - } - - return true; - } - - void HeiganErupt(uint32 section) - { - for (uint32 i = 0; i < 4; ++i) - { - if (i == section) - continue; - - for (std::set::const_iterator itr = HeiganEruptionGUID[i].begin(); itr != HeiganEruptionGUID[i].end(); ++itr) + switch(pGo->GetEntry()) { - if (GameObject *pHeiganEruption = instance->GetGameObject(*itr)) + case GO_BIRTH: + if (!add && SapphironGUID) { - pHeiganEruption->SendCustomAnim(); - pHeiganEruption->CastSpell(NULL, SPELL_ERUPTION); + if (Creature *pSapphiron = instance->GetCreature(SapphironGUID)) + pSapphiron->AI()->DoAction(DATA_SAPPHIRON_BIRTH); + return; + } + case GO_GOTHIK_GATE: + GothikGateGUID = add ? pGo->GetGUID() : 0; + pGo->SetGoState(gothikDoorState); + break; + case GO_HORSEMEN_CHEST: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; + case GO_HORSEMEN_CHEST_HERO: HorsemenChestGUID = add ? pGo->GetGUID() : 0; break; + case GO_KELTHUZAD_PORTAL01: uiPortals[0] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL02: uiPortals[1] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL03: uiPortals[2] = pGo->GetGUID(); break; + case GO_KELTHUZAD_PORTAL04: uiPortals[3] = pGo->GetGUID(); break; + case GO_KELTHUZAD_TRIGGER: uiKelthuzadTrigger = pGo->GetGUID(); break; + } + + AddDoor(pGo, add); + } + + void SetData(uint32 id, uint32 value) + { + switch(id) + { + case DATA_HEIGAN_ERUPT: + HeiganErupt(value); + break; + case DATA_GOTHIK_GATE: + if (GameObject *pGothikGate = instance->GetGameObject(GothikGateGUID)) + pGothikGate->SetGoState(GOState(value)); + gothikDoorState = GOState(value); + break; + + case DATA_HORSEMEN0: + case DATA_HORSEMEN1: + case DATA_HORSEMEN2: + case DATA_HORSEMEN3: + if (value == NOT_STARTED) + { + minHorsemenDiedTime = 0; + maxHorsemenDiedTime = 0; + } + else if (value == DONE) + { + time_t now = time(NULL); + + if (minHorsemenDiedTime == 0) + minHorsemenDiedTime = now; + + maxHorsemenDiedTime = now; + } + break; + } + } + + uint64 GetData64(uint32 id) + { + switch(id) + { + case DATA_FAERLINA: + return uiFaerlina; + case DATA_THANE: + return uiThane; + case DATA_LADY: + return uiLady; + case DATA_BARON: + return uiBaron; + case DATA_SIR: + return uiSir; + case DATA_THADDIUS: + return uiThaddius; + case DATA_FEUGEN: + return uiFeugen; + case DATA_STALAGG: + return uiStalagg; + case DATA_KELTHUZAD: + return uiKelthuzad; + case DATA_KELTHUZAD_PORTAL01: + return uiPortals[0]; + case DATA_KELTHUZAD_PORTAL02: + return uiPortals[1]; + case DATA_KELTHUZAD_PORTAL03: + return uiPortals[2]; + case DATA_KELTHUZAD_PORTAL04: + return uiPortals[3]; + case DATA_KELTHUZAD_TRIGGER: + return uiKelthuzadTrigger; + } + return 0; + } + + bool SetBossState(uint32 id, EncounterState state) + { + if (!InstanceScript::SetBossState(id, state)) + return false; + + if (id == BOSS_HORSEMEN && state == DONE) + { + if (GameObject *pHorsemenChest = instance->GetGameObject(HorsemenChestGUID)) + pHorsemenChest->SetRespawnTime(pHorsemenChest->GetRespawnDelay()); + } + + return true; + } + + void HeiganErupt(uint32 section) + { + for (uint32 i = 0; i < 4; ++i) + { + if (i == section) + continue; + + for (std::set::const_iterator itr = HeiganEruptionGUID[i].begin(); itr != HeiganEruptionGUID[i].end(); ++itr) + { + if (GameObject *pHeiganEruption = instance->GetGameObject(*itr)) + { + pHeiganEruption->SendCustomAnim(); + pHeiganEruption->CastSpell(NULL, SPELL_ERUPTION); + } } } } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) - { - switch(criteria_id) + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/) { - case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) - return true; - return false; - case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man - if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) - return true; - return false; - case 13233: // Criteria for achievement 2186: The Immortal (25-man) - // TODO. - break; - case 13237: // Criteria for achievement 2187: The Undying (10-man) - // TODO. - break; + switch(criteria_id) + { + case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man + if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + return true; + return false; + case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man + if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15) + return true; + return false; + case 13233: // Criteria for achievement 2186: The Immortal (25-man) + // TODO. + break; + case 13237: // Criteria for achievement 2187: The Undying (10-man) + // TODO. + break; + } + return false; } - return false; - } - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " " << gothikDoorState; - return saveStream.str(); - } + std::string GetSaveData() + { + std::ostringstream saveStream; + saveStream << GetBossSaveData() << " " << gothikDoorState; + return saveStream.str(); + } + + void Load(const char * data) + { + std::istringstream loadStream(LoadBossState(data)); + uint32 buff; + loadStream >> buff; + gothikDoorState = GOState(buff); + } + }; - void Load(const char * data) - { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - loadStream >> buff; - gothikDoorState = GOState(buff); - } }; -InstanceData* GetInstanceData_instance_naxxramas(Map* pMap) -{ - return new instance_naxxramas(pMap); -} void AddSC_instance_naxxramas() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_naxxramas"; - newscript->GetInstanceData = &GetInstanceData_instance_naxxramas; - newscript->RegisterSelf(); + new instance_naxxramas(); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 71e8ad69ff4..3523672b1c8 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -104,89 +104,91 @@ enum { ACHIEV_TIMED_START_EVENT = 20387, }; - -struct boss_malygosAI : public ScriptedAI + class boss_malygos : public CreatureScript { - boss_malygosAI(Creature *c) : ScriptedAI(c) +public: + boss_malygos() : CreatureScript("boss_malygos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - instance = me->GetInstanceData(); + return new boss_malygosAI (pCreature); } - InstanceData *instance; - - uint32 phase; - uint32 enrage; - - void Reset() + struct boss_malygosAI : public ScriptedAI { - phase = 1; - enrage = 615000; //Source Deadly Boss Mod - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - - void EnterCombat(Unit* /*who*/) - { - if (phase == 1) + boss_malygosAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_PHASE1_AGGRO, me); + instance = me->GetInstanceScript(); + } + + InstanceScript *instance; + + uint32 phase; + uint32 enrage; + + void Reset() + { + phase = 1; + enrage = 615000; //Source Deadly Boss Mod + if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - if (phase == 2) - DoScriptText(SAY_PHASE1_AGGRO, me); - if (phase == 3) - DoScriptText(SAY_PHASE1_AGGRO, me); - } + void EnterCombat(Unit* /*who*/) + { + if (phase == 1) + { + DoScriptText(SAY_PHASE1_AGGRO, me); + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (phase == 1 && HealthBelowPct(50)) { - phase = 2; - //spawn adds - //set malygos unatackable untill all adds spawned dead - //start phase3 + if (phase == 2) + DoScriptText(SAY_PHASE1_AGGRO, me); + if (phase == 3) + DoScriptText(SAY_PHASE1_AGGRO, me); } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - } + if (phase == 1 && HealthBelowPct(50)) { + phase = 2; + //spawn adds + //set malygos unatackable untill all adds spawned dead + //start phase3 + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + if (phase == 1) + DoScriptText(RAND(SAY_PHASE1_SLAY_1,SAY_PHASE1_SLAY_2,SAY_PHASE1_SLAY_3), me); + if (phase == 2) + DoScriptText(RAND(SAY_PHASE2_SLAY_1,SAY_PHASE2_SLAY_2,SAY_PHASE2_SLAY_3), me); + if (phase == 3) + DoScriptText(RAND(SAY_PHASE3_SLAY_1,SAY_PHASE3_SLAY_2,SAY_PHASE3_SLAY_3), me); + } + }; - if (phase == 1) - DoScriptText(RAND(SAY_PHASE1_SLAY_1,SAY_PHASE1_SLAY_2,SAY_PHASE1_SLAY_3), me); - if (phase == 2) - DoScriptText(RAND(SAY_PHASE2_SLAY_1,SAY_PHASE2_SLAY_2,SAY_PHASE2_SLAY_3), me); - if (phase == 3) - DoScriptText(RAND(SAY_PHASE3_SLAY_1,SAY_PHASE3_SLAY_2,SAY_PHASE3_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_malygos(Creature* pCreature) -{ - return new boss_malygosAI (pCreature); -} void AddSC_boss_malygos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_malygos"; - newscript->GetAI = &GetAI_boss_malygos; - newscript->RegisterSelf(); + new boss_malygos(); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index e8ba3c89a67..c5714db534d 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -17,22 +17,25 @@ #include "ScriptPCH.h" #include "eye_of_eternity.h" - -struct instance_eye_of_eternity : public ScriptedInstance + class instance_eye_of_eternity : public InstanceMapScript { - instance_eye_of_eternity(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_eye_of_eternity() : InstanceMapScript("instance_eye_of_eternity") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_eye_of_eternity_InstanceMapScript(pMap); + } + + struct instance_eye_of_eternity_InstanceMapScript : public InstanceScript + { + instance_eye_of_eternity_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + }; + }; -InstanceData* GetInstanceData_instance_eye_of_eternity(Map* pMap) -{ - return new instance_eye_of_eternity(pMap); -} void AddSC_instance_eye_of_eternity() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_eye_of_eternity"; - newscript->GetInstanceData = &GetInstanceData_instance_eye_of_eternity; - newscript->RegisterSelf(); + new instance_eye_of_eternity(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp index 767aeabcc42..fbb00e9b9bf 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_anomalus.cpp @@ -58,114 +58,121 @@ const Position RiftLocation[6] = {639.87, -314.11, -9.49}, {651.72, -297.44, -9.37} }; - -struct boss_anomalusAI : public ScriptedAI + class boss_anomalus : public CreatureScript { - boss_anomalusAI(Creature *c) : ScriptedAI(c) +public: + boss_anomalus() : CreatureScript("boss_anomalus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_anomalusAI (pCreature); } - ScriptedInstance* pInstance; - - uint8 Phase; - uint32 uiSparkTimer; - uint32 uiCreateRiftTimer; - uint64 uiChaoticRiftGUID; - - bool bDeadChaoticRift; // needed for achievement: Chaos Theory(2037) - - void Reset() + struct boss_anomalusAI : public ScriptedAI { - Phase = 0; - uiSparkTimer = 5*IN_MILLISECONDS; - uiChaoticRiftGUID = 0; - - bDeadChaoticRift = false; - - if (pInstance) - pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) + boss_anomalusAI(Creature *c) : ScriptedAI(c) { - if (IsHeroic() && !bDeadChaoticRift) - pInstance->DoCompleteAchievement(ACHIEV_CHAOS_THEORY); - pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (me->GetDistance(me->GetHomePosition()) > 60.0f) - { - //Not blizzlike, hack to avoid an exploit - EnterEvadeMode(); - return; + pInstance = c->GetInstanceScript(); } - if (me->HasAura(SPELL_RIFT_SHIELD)) + InstanceScript* pInstance; + + uint8 Phase; + uint32 uiSparkTimer; + uint32 uiCreateRiftTimer; + uint64 uiChaoticRiftGUID; + + bool bDeadChaoticRift; // needed for achievement: Chaos Theory(2037) + + void Reset() { - if (uiChaoticRiftGUID) - { - Unit* Rift = Unit::GetUnit((*me), uiChaoticRiftGUID); - if (Rift && Rift->isDead()) - { - me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); - uiChaoticRiftGUID = 0; - } - return; - } - } else + Phase = 0; + uiSparkTimer = 5*IN_MILLISECONDS; uiChaoticRiftGUID = 0; - if ((Phase == 0) && HealthBelowPct(50)) + bDeadChaoticRift = false; + + if (pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - Phase = 1; - DoScriptText(SAY_SHIELD, me); - DoCast(me, SPELL_RIFT_SHIELD); - Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0,5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); - if (Rift) + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - //DoCast(Rift, SPELL_CHARGE_RIFT); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Rift->AI()->AttackStart(pTarget); - uiChaoticRiftGUID = Rift->GetGUID(); - DoScriptText(SAY_RIFT , me); + if (IsHeroic() && !bDeadChaoticRift) + pInstance->DoCompleteAchievement(ACHIEV_CHAOS_THEORY); + pInstance->SetData(DATA_ANOMALUS_EVENT, DONE); } } - - if (uiSparkTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SPARK); - uiSparkTimer = 5*IN_MILLISECONDS; - } else uiSparkTimer -= diff; + if (!UpdateVictim()) + return; + + if (me->GetDistance(me->GetHomePosition()) > 60.0f) + { + //Not blizzlike, hack to avoid an exploit + EnterEvadeMode(); + return; + } + + if (me->HasAura(SPELL_RIFT_SHIELD)) + { + if (uiChaoticRiftGUID) + { + Unit* Rift = Unit::GetUnit((*me), uiChaoticRiftGUID); + if (Rift && Rift->isDead()) + { + me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD); + uiChaoticRiftGUID = 0; + } + return; + } + } else + uiChaoticRiftGUID = 0; + + if ((Phase == 0) && HealthBelowPct(50)) + { + Phase = 1; + DoScriptText(SAY_SHIELD, me); + DoCast(me, SPELL_RIFT_SHIELD); + Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0,5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); + if (Rift) + { + //DoCast(Rift, SPELL_CHARGE_RIFT); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Rift->AI()->AttackStart(pTarget); + uiChaoticRiftGUID = Rift->GetGUID(); + DoScriptText(SAY_RIFT , me); + } + } + + + if (uiSparkTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SPARK); + uiSparkTimer = 5*IN_MILLISECONDS; + } else uiSparkTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_anomalus(Creature* pCreature) -{ - return new boss_anomalusAI (pCreature); -} enum RiftSpells { @@ -173,82 +180,80 @@ enum RiftSpells SPELL_CHARGED_CHAOTIC_ENERGY_BURST = 47737, SPELL_ARCANEFORM = 48019 //Chaotic Rift visual }; - -struct mob_chaotic_riftAI : public Scripted_NoMovementAI + class mob_chaotic_rift : public CreatureScript { - mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) +public: + mob_chaotic_rift() : CreatureScript("mob_chaotic_rift") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_chaotic_riftAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiChaoticEnergyBurstTimer; - uint32 uiSummonCrazedManaWraithTimer; - - void Reset() + struct mob_chaotic_riftAI : public Scripted_NoMovementAI { - uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; - uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; - //me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different. - //Model for ally (1126) does not show auras. Horde model works perfect. - //Set model to horde number - DoCast(me, SPELL_ARCANEFORM, false); - } - - void JustDied(Unit * /*killer*/) - { - if (Creature* pAnomalus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0)) - CAST_AI(boss_anomalusAI,pAnomalus->AI())->bDeadChaoticRift = true; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiChaoticEnergyBurstTimer <= diff) + mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiChaoticEnergyBurstTimer; + uint32 uiSummonCrazedManaWraithTimer; + + void Reset() { - Unit* pAnomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - if (pAnomalus && pAnomalus->HasAura(SPELL_RIFT_SHIELD)) - DoCast(pTarget, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); - else - DoCast(pTarget, SPELL_CHAOTIC_ENERGY_BURST); uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; - } else uiChaoticEnergyBurstTimer -= diff; + uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; + //me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different. + //Model for ally (1126) does not show auras. Horde model works perfect. + //Set model to horde number + DoCast(me, SPELL_ARCANEFORM, false); + } - if (uiSummonCrazedManaWraithTimer <= diff) + void JustDied(Unit * /*killer*/) { - Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX()+1, me->GetPositionY()+1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); - if (Wraith) + if (Creature* pAnomalus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0)) + CAST_AI(boss_anomalus::boss_anomalusAI,pAnomalus->AI())->bDeadChaoticRift = true; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiChaoticEnergyBurstTimer <= diff) + { + Unit* pAnomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Wraith->AI()->AttackStart(pTarget); - Unit* Anomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); - if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) - uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; - else - uiSummonCrazedManaWraithTimer = 10*IN_MILLISECONDS; - } else uiSummonCrazedManaWraithTimer -= diff; - } + if (pAnomalus && pAnomalus->HasAura(SPELL_RIFT_SHIELD)) + DoCast(pTarget, SPELL_CHARGED_CHAOTIC_ENERGY_BURST); + else + DoCast(pTarget, SPELL_CHAOTIC_ENERGY_BURST); + uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS; + } else uiChaoticEnergyBurstTimer -= diff; + + if (uiSummonCrazedManaWraithTimer <= diff) + { + Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX()+1, me->GetPositionY()+1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS); + if (Wraith) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Wraith->AI()->AttackStart(pTarget); + Unit* Anomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0); + if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD)) + uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS; + else + uiSummonCrazedManaWraithTimer = 10*IN_MILLISECONDS; + } else uiSummonCrazedManaWraithTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_chaotic_rift(Creature* pCreature) -{ - return new mob_chaotic_riftAI (pCreature); -} void AddSC_boss_anomalus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_anomalus"; - newscript->GetAI = &GetAI_boss_anomalus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_chaotic_rift"; - newscript->GetAI = &GetAI_mob_chaotic_rift; - newscript->RegisterSelf(); + new boss_anomalus(); + new mob_chaotic_rift(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index befa9fb068d..d2421bae1ef 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -49,200 +49,204 @@ enum Misc { DATA_CONTAINMENT_SPHERES = 3 }; - -struct boss_keristraszaAI : public ScriptedAI + class boss_keristrasza : public CreatureScript { - boss_keristraszaAI(Creature *c) : ScriptedAI(c) +public: + boss_keristrasza() : CreatureScript("boss_keristrasza") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_keristraszaAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiCrystalfireBreathTimer; - uint32 uiCrystalChainsCrystalizeTimer; - uint32 uiTailSweepTimer; - bool bEnrage; - - uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; - - uint32 uiCheckIntenseColdTimer; - bool bMoreThanTwoIntenseCold; // needed for achievement: Intense Cold(2036) - - void Reset() + struct boss_keristraszaAI : public ScriptedAI { - uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; - uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); - uiTailSweepTimer = 5*IN_MILLISECONDS; - bEnrage = false; - - uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; - bMoreThanTwoIntenseCold = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - - RemovePrison(CheckContainmentSpheres()); - - if (pInstance) - pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoCastAOE(SPELL_INTENSE_COLD); - - if (pInstance) - pInstance->SetData(DATA_KERISTRASZA_EVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) + boss_keristraszaAI(Creature *c) : ScriptedAI(c) { - if (IsHeroic() && !bMoreThanTwoIntenseCold) - pInstance->DoCompleteAchievement(ACHIEV_INTENSE_COLD); - pInstance->SetData(DATA_KERISTRASZA_EVENT, DONE); + pInstance = c->GetInstanceScript(); } - } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + InstanceScript* pInstance; - bool CheckContainmentSpheres(bool remove_prison = false) - { - if (!pInstance) - return false; + uint32 uiCrystalfireBreathTimer; + uint32 uiCrystalChainsCrystalizeTimer; + uint32 uiTailSweepTimer; + bool bEnrage; - auiContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[1] = pInstance->GetData64(ORMOROKS_CONTAINMET_SPHERE); - auiContainmentSphereGUIDs[2] = pInstance->GetData64(TELESTRAS_CONTAINMET_SPHERE); + uint64 auiContainmentSphereGUIDs[DATA_CONTAINMENT_SPHERES]; - GameObject *ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; + uint32 uiCheckIntenseColdTimer; + bool bMoreThanTwoIntenseCold; // needed for achievement: Intense Cold(2036) - for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i) + void Reset() { - ContainmentSpheres[i] = pInstance->instance->GetGameObject(auiContainmentSphereGUIDs[i]); - if (!ContainmentSpheres[i]) - return false; - if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE) - return false; + uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; + uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); + uiTailSweepTimer = 5*IN_MILLISECONDS; + bEnrage = false; + + uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; + bMoreThanTwoIntenseCold = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + + RemovePrison(CheckContainmentSpheres()); + + if (pInstance) + pInstance->SetData(DATA_KERISTRASZA_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoCastAOE(SPELL_INTENSE_COLD); + + if (pInstance) + pInstance->SetData(DATA_KERISTRASZA_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (IsHeroic() && !bMoreThanTwoIntenseCold) + pInstance->DoCompleteAchievement(ACHIEV_INTENSE_COLD); + pInstance->SetData(DATA_KERISTRASZA_EVENT, DONE); + } + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_SLAY, me); + } + + bool CheckContainmentSpheres(bool remove_prison = false) + { + if (!pInstance) + return false; + + auiContainmentSphereGUIDs[0] = pInstance->GetData64(ANOMALUS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[1] = pInstance->GetData64(ORMOROKS_CONTAINMET_SPHERE); + auiContainmentSphereGUIDs[2] = pInstance->GetData64(TELESTRAS_CONTAINMET_SPHERE); + + GameObject *ContainmentSpheres[DATA_CONTAINMENT_SPHERES]; + + for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i) + { + ContainmentSpheres[i] = pInstance->instance->GetGameObject(auiContainmentSphereGUIDs[i]); + if (!ContainmentSpheres[i]) + return false; + if (ContainmentSpheres[i]->GetGoState() != GO_STATE_ACTIVE) + return false; + } + if (remove_prison) + RemovePrison(true); + return true; + } + + void RemovePrison(bool remove) + { + if (remove) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (me->HasAura(SPELL_FROZEN_PRISON)) + me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + DoCast(me, SPELL_FROZEN_PRISON, false); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) + { + std::list ThreatList = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) + continue; + + Aura *AuraIntenseCold = pTarget->GetAura(SPELL_INTENSE_COLD_TRIGGERED); + if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2) + { + bMoreThanTwoIntenseCold = true; + break; + } + } + uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; + } else uiCheckIntenseColdTimer -= diff; + + if (!bEnrage && HealthBelowPct(25)) + { + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_ENRAGE); + bEnrage = true; + } + + if (uiCrystalfireBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CRYSTALFIRE_BREATH); + uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; + } else uiCrystalfireBreathTimer -= diff; + + if (uiTailSweepTimer <= diff) + { + DoCast(me, SPELL_TAIL_SWEEP); + uiTailSweepTimer = 5*IN_MILLISECONDS; + } else uiTailSweepTimer -= diff; + + if (uiCrystalChainsCrystalizeTimer <= diff) + { + DoScriptText(SAY_CRYSTAL_NOVA, me); + if (IsHeroic()) + DoCast(me, SPELL_CRYSTALIZE); + else if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CRYSTAL_CHAINS); + uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); + } else uiCrystalChainsCrystalizeTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + + class containment_sphere : public GameObjectScript +{ +public: + containment_sphere() : GameObjectScript("containment_sphere") { } + + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) + { + InstanceScript *pInstance = pGO->GetInstanceScript(); + + Creature *pKeristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); + if (pKeristrasza && pKeristrasza->isAlive()) + { + // maybe these are hacks :( + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + + CAST_AI(boss_keristrasza::boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); } - if (remove_prison) - RemovePrison(true); return true; } - void RemovePrison(bool remove) - { - if (remove) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (me->HasAura(SPELL_FROZEN_PRISON)) - me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoCast(me, SPELL_FROZEN_PRISON, false); - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) - { - std::list ThreatList = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) - { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) - continue; - - Aura *AuraIntenseCold = pTarget->GetAura(SPELL_INTENSE_COLD_TRIGGERED); - if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2) - { - bMoreThanTwoIntenseCold = true; - break; - } - } - uiCheckIntenseColdTimer = 2*IN_MILLISECONDS; - } else uiCheckIntenseColdTimer -= diff; - - if (!bEnrage && HealthBelowPct(25)) - { - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_ENRAGE); - bEnrage = true; - } - - if (uiCrystalfireBreathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CRYSTALFIRE_BREATH); - uiCrystalfireBreathTimer = 14*IN_MILLISECONDS; - } else uiCrystalfireBreathTimer -= diff; - - if (uiTailSweepTimer <= diff) - { - DoCast(me, SPELL_TAIL_SWEEP); - uiTailSweepTimer = 5*IN_MILLISECONDS; - } else uiTailSweepTimer -= diff; - - if (uiCrystalChainsCrystalizeTimer <= diff) - { - DoScriptText(SAY_CRYSTAL_NOVA, me); - if (IsHeroic()) - DoCast(me, SPELL_CRYSTALIZE); - else if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CRYSTAL_CHAINS); - uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(30*IN_MILLISECONDS,11*IN_MILLISECONDS); - } else uiCrystalChainsCrystalizeTimer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_keristrasza(Creature* pCreature) -{ - return new boss_keristraszaAI (pCreature); -} - -bool GOHello_containment_sphere(Player * /*pPlayer*/, GameObject *pGO) -{ - ScriptedInstance *pInstance = pGO->GetInstanceData(); - - Creature *pKeristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); - if (pKeristrasza && pKeristrasza->isAlive()) - { - // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); - - CAST_AI(boss_keristraszaAI, pKeristrasza->AI())->CheckContainmentSpheres(true); - } - return true; -} - void AddSC_boss_keristrasza() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_keristrasza"; - newscript->GetAI = &GetAI_boss_keristrasza; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "containment_sphere"; - newscript->pGOHello = &GOHello_containment_sphere; - newscript->RegisterSelf(); + new boss_keristrasza(); + new containment_sphere(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index 77dd3025451..3c5d50cfc12 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -54,275 +54,277 @@ enum Achievements }; const Position CenterOfRoom = {504.80, 89.07, -16.12, 6.27}; - -struct boss_magus_telestraAI : public ScriptedAI + class boss_magus_telestra : public CreatureScript { - boss_magus_telestraAI(Creature* c) : ScriptedAI(c) +public: + boss_magus_telestra() : CreatureScript("boss_magus_telestra") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_magus_telestraAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 uiFireMagusGUID; - uint64 uiFrostMagusGUID; - uint64 uiArcaneMagusGUID; - - bool bFireMagusDead; - bool bFrostMagusDead; - bool bArcaneMagusDead; - bool bIsWaitingToAppear; - bool bIsAchievementTimerRunning; - - uint32 uiIsWaitingToAppearTimer; - uint32 uiIceNovaTimer; - uint32 uiFireBombTimer; - uint32 uiGravityWellTimer; - uint32 uiCooldown; - uint32 uiAchievementTimer; - - uint8 Phase; - uint8 uiAchievementProgress; - - void Reset() + struct boss_magus_telestraAI : public ScriptedAI { - Phase = 0; - //These times are probably wrong - uiIceNovaTimer = 7*IN_MILLISECONDS; - uiFireBombTimer = 0; - uiGravityWellTimer = 15*IN_MILLISECONDS; - uiCooldown = 0; - - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; - - uiAchievementProgress = 0; - uiAchievementTimer = 0; - - bIsAchievementTimerRunning = false; - bIsWaitingToAppear = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); - - if (pInstance) - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) + boss_magus_telestraAI(Creature* c) : ScriptedAI(c) { - if (IsHeroic() && uiAchievementProgress == 2) - pInstance->DoCompleteAchievement(ACHIEV_SPLIT_PERSONALITY); - pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); - } - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } - - uint64 SplitPersonality(uint32 entry) - { - if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS)) - { - switch (entry) - { - case MOB_FIRE_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false); - break; - } - case MOB_FROST_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false); - break; - } - case MOB_ARCANE_MAGUS: - { - Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false); - break; - } - } - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - Summoned->AI()->AttackStart(pTarget); - return Summoned->GetGUID(); - } - return 0; - } - - void SummonedCreatureDespawn(Creature *summon) - { - if (summon->isAlive()) - return; - - if (summon->GetGUID() == uiFireMagusGUID) - { - bFireMagusDead = true; - bIsAchievementTimerRunning = true; - } - else if (summon->GetGUID() == uiFrostMagusGUID) - { - bFrostMagusDead = true; - bIsAchievementTimerRunning = true; - } - else if (summon->GetGUID() == uiArcaneMagusGUID) - { - bArcaneMagusDead = true; - bIsAchievementTimerRunning = true; - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (bIsWaitingToAppear) - { - me->StopMoving(); - me->AttackStop(); - if (uiIsWaitingToAppearTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - bIsWaitingToAppear = false; - } else uiIsWaitingToAppearTimer -= diff; - return; + pInstance = c->GetInstanceScript(); } - if ((Phase == 1) ||(Phase == 3)) - { - if (bIsAchievementTimerRunning) - uiAchievementTimer += diff; - if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) - { - if (uiAchievementTimer <= ACHIEV_TIMER) - uiAchievementProgress +=1; - me->GetMotionMaster()->Clear(); - me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); - DoCast(me, SPELL_TELESTRA_BACK); - me->SetVisibility(VISIBILITY_ON); - if (Phase == 1) - Phase = 2; - if (Phase == 3) - Phase = 4; - uiFireMagusGUID = 0; - uiFrostMagusGUID = 0; - uiArcaneMagusGUID = 0; - bIsWaitingToAppear = true; - uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; - DoScriptText(SAY_MERGE, me); - bIsAchievementTimerRunning = false; - uiAchievementTimer = 0; - } - else - return; - } + InstanceScript* pInstance; - if ((Phase == 0) && HealthBelowPct(50)) - { - Phase = 1; - me->CastStop(); - me->RemoveAllAuras(); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); - uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); - uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - return; - } + uint64 uiFireMagusGUID; + uint64 uiFrostMagusGUID; + uint64 uiArcaneMagusGUID; - if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) - { - Phase = 3; - me->CastStop(); - me->RemoveAllAuras(); - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); - uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); - uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); - bFireMagusDead = false; - bFrostMagusDead = false; - bArcaneMagusDead = false; - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - return; - } + bool bFireMagusDead; + bool bFrostMagusDead; + bool bArcaneMagusDead; + bool bIsWaitingToAppear; + bool bIsAchievementTimerRunning; - if (uiCooldown) - { - if (uiCooldown <= diff) - uiCooldown = 0; - else - { - uiCooldown -= diff; - return; - } - } + uint32 uiIsWaitingToAppearTimer; + uint32 uiIceNovaTimer; + uint32 uiFireBombTimer; + uint32 uiGravityWellTimer; + uint32 uiCooldown; + uint32 uiAchievementTimer; - if (uiIceNovaTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_ICE_NOVA, false); - uiCooldown = 1.5*IN_MILLISECONDS; - } - uiIceNovaTimer = 15*IN_MILLISECONDS; - } else uiIceNovaTimer -= diff; + uint8 Phase; + uint8 uiAchievementProgress; - if (uiGravityWellTimer <= diff) + void Reset() { - if (Unit *pTarget = me->getVictim()) - { - DoCast(pTarget, SPELL_GRAVITY_WELL); - uiCooldown = 6*IN_MILLISECONDS; - } + Phase = 0; + //These times are probably wrong + uiIceNovaTimer = 7*IN_MILLISECONDS; + uiFireBombTimer = 0; uiGravityWellTimer = 15*IN_MILLISECONDS; - } else uiGravityWellTimer -= diff; + uiCooldown = 0; - if (uiFireBombTimer <= diff) + uiFireMagusGUID = 0; + uiFrostMagusGUID = 0; + uiArcaneMagusGUID = 0; + + uiAchievementProgress = 0; + uiAchievementTimer = 0; + + bIsAchievementTimerRunning = false; + bIsWaitingToAppear = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); + + if (pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_FIREBOMB, false); - uiCooldown = 2*IN_MILLISECONDS; - } - uiFireBombTimer = 2*IN_MILLISECONDS; - } else uiFireBombTimer -=diff; + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (IsHeroic() && uiAchievementProgress == 2) + pInstance->DoCompleteAchievement(ACHIEV_SPLIT_PERSONALITY); + pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE); + } + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } + + uint64 SplitPersonality(uint32 entry) + { + if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS)) + { + switch (entry) + { + case MOB_FIRE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FIRE_MAGUS_VISUAL, false); + break; + } + case MOB_FROST_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_FROST_MAGUS_VISUAL, false); + break; + } + case MOB_ARCANE_MAGUS: + { + Summoned->CastSpell(Summoned, SPELL_ARCANE_MAGUS_VISUAL, false); + break; + } + } + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + Summoned->AI()->AttackStart(pTarget); + return Summoned->GetGUID(); + } + return 0; + } + + void SummonedCreatureDespawn(Creature *summon) + { + if (summon->isAlive()) + return; + + if (summon->GetGUID() == uiFireMagusGUID) + { + bFireMagusDead = true; + bIsAchievementTimerRunning = true; + } + else if (summon->GetGUID() == uiFrostMagusGUID) + { + bFrostMagusDead = true; + bIsAchievementTimerRunning = true; + } + else if (summon->GetGUID() == uiArcaneMagusGUID) + { + bArcaneMagusDead = true; + bIsAchievementTimerRunning = true; + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (bIsWaitingToAppear) + { + me->StopMoving(); + me->AttackStop(); + if (uiIsWaitingToAppearTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + bIsWaitingToAppear = false; + } else uiIsWaitingToAppearTimer -= diff; + return; + } + + if ((Phase == 1) ||(Phase == 3)) + { + if (bIsAchievementTimerRunning) + uiAchievementTimer += diff; + if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead) + { + if (uiAchievementTimer <= ACHIEV_TIMER) + uiAchievementProgress +=1; + me->GetMotionMaster()->Clear(); + me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation()); + DoCast(me, SPELL_TELESTRA_BACK); + me->SetVisibility(VISIBILITY_ON); + if (Phase == 1) + Phase = 2; + if (Phase == 3) + Phase = 4; + uiFireMagusGUID = 0; + uiFrostMagusGUID = 0; + uiArcaneMagusGUID = 0; + bIsWaitingToAppear = true; + uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS; + DoScriptText(SAY_MERGE, me); + bIsAchievementTimerRunning = false; + uiAchievementTimer = 0; + } + else + return; + } + + if ((Phase == 0) && HealthBelowPct(50)) + { + Phase = 1; + me->CastStop(); + me->RemoveAllAuras(); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + bFireMagusDead = false; + bFrostMagusDead = false; + bArcaneMagusDead = false; + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + return; + } + + if (IsHeroic() && (Phase == 2) && HealthBelowPct(10)) + { + Phase = 3; + me->CastStop(); + me->RemoveAllAuras(); + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS); + uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS); + uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS); + bFireMagusDead = false; + bFrostMagusDead = false; + bArcaneMagusDead = false; + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + return; + } + + if (uiCooldown) + { + if (uiCooldown <= diff) + uiCooldown = 0; + else + { + uiCooldown -= diff; + return; + } + } + + if (uiIceNovaTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_ICE_NOVA, false); + uiCooldown = 1.5*IN_MILLISECONDS; + } + uiIceNovaTimer = 15*IN_MILLISECONDS; + } else uiIceNovaTimer -= diff; + + if (uiGravityWellTimer <= diff) + { + if (Unit *pTarget = me->getVictim()) + { + DoCast(pTarget, SPELL_GRAVITY_WELL); + uiCooldown = 6*IN_MILLISECONDS; + } + uiGravityWellTimer = 15*IN_MILLISECONDS; + } else uiGravityWellTimer -= diff; + + if (uiFireBombTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_FIREBOMB, false); + uiCooldown = 2*IN_MILLISECONDS; + } + uiFireBombTimer = 2*IN_MILLISECONDS; + } else uiFireBombTimer -=diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_magus_telestra(Creature* pCreature) -{ - return new boss_magus_telestraAI (pCreature); -} void AddSC_boss_magus_telestra() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_magus_telestra"; - newscript->GetAI = &GetAI_boss_magus_telestra; - newscript->RegisterSelf(); + new boss_magus_telestra(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp index c28aff66ed1..e77534d9ea1 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_ormorok.cpp @@ -48,252 +48,260 @@ enum Creatures }; #define SPIKE_DISTANCE 5.0f - -struct boss_ormorokAI : public ScriptedAI + class boss_ormorok : public CreatureScript { - boss_ormorokAI(Creature *c) : ScriptedAI(c) +public: + boss_ormorok() : CreatureScript("boss_ormorok") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ormorokAI (pCreature); } - ScriptedInstance* pInstance; - - bool bFrenzy; - bool bCrystalSpikes; - uint8 uiCrystalSpikesCount; - float fBaseX; - float fBaseY; - float fBaseZ; - float fBaseO; - float fSpikeXY[4][2]; - - uint32 uiCrystalSpikesTimer; - uint32 uiCrystalSpikesTimer2; - uint32 uiTrampleTimer; - uint32 uiFrenzyTimer; - uint32 uiSpellReflectionTimer; - uint32 uiSummonCrystallineTanglerTimer; - - void Reset() + struct boss_ormorokAI : public ScriptedAI { - uiCrystalSpikesTimer = 12*IN_MILLISECONDS; - uiTrampleTimer = 10*IN_MILLISECONDS; - uiSpellReflectionTimer = 30*IN_MILLISECONDS; - uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - bFrenzy = false; - bCrystalSpikes = false; - - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_ORMOROK_EVENT, DONE); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) + boss_ormorokAI(Creature *c) : ScriptedAI(c) { - return; - } - if (bCrystalSpikes) - if (uiCrystalSpikesTimer2 <= diff) - { - fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); - fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); - fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); - fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); - for (uint8 i = 0; i < 4; ++i) - me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); - if (++uiCrystalSpikesCount >= 13) - bCrystalSpikes = false; - uiCrystalSpikesTimer2 = 200; - } else uiCrystalSpikesTimer2 -= diff; - - if (!bFrenzy && (me->GetHealth() < me->GetMaxHealth() * 0.25)) - { - DoCast(me, SPELL_FRENZY); - bFrenzy = true; + pInstance = c->GetInstanceScript(); } - if (uiTrampleTimer <= diff) + InstanceScript* pInstance; + + bool bFrenzy; + bool bCrystalSpikes; + uint8 uiCrystalSpikesCount; + float fBaseX; + float fBaseY; + float fBaseZ; + float fBaseO; + float fSpikeXY[4][2]; + + uint32 uiCrystalSpikesTimer; + uint32 uiCrystalSpikesTimer2; + uint32 uiTrampleTimer; + uint32 uiFrenzyTimer; + uint32 uiSpellReflectionTimer; + uint32 uiSummonCrystallineTanglerTimer; + + void Reset() { - DoCast(me, SPELL_TRAMPLE); + uiCrystalSpikesTimer = 12*IN_MILLISECONDS; uiTrampleTimer = 10*IN_MILLISECONDS; - } else uiTrampleTimer -= diff; - - if (uiSpellReflectionTimer <= diff) - { - DoScriptText(SAY_REFLECT, me); - DoCast(me, SPELL_SPELL_REFLECTION); uiSpellReflectionTimer = 30*IN_MILLISECONDS; - } else uiSpellReflectionTimer -= diff; - - if (uiCrystalSpikesTimer <= diff) - { - DoScriptText(SAY_CRYSTAL_SPIKES, me); - bCrystalSpikes = true; - uiCrystalSpikesCount = 1; - uiCrystalSpikesTimer2 = 0; - fBaseX = me->GetPositionX(); - fBaseY = me->GetPositionY(); - fBaseZ = me->GetPositionZ(); - fBaseO = me->GetOrientation(); - uiCrystalSpikesTimer = 20*IN_MILLISECONDS; - } else uiCrystalSpikesTimer -= diff; - - if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff)) - { - Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - if (Crystalline_Tangler) - { - Unit *pTarget = NULL; - uint8 Healer = 0; - for (uint8 j = 1; j <= 4; j++) - { - switch (j) - { - case 1: Healer = CLASS_PRIEST; break; - case 2: Healer = CLASS_PALADIN; break; - case 3: Healer = CLASS_DRUID; break; - case 4: Healer = CLASS_SHAMAN; break; - } - std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) - { - Unit* pTemp = Unit::GetUnit((*me),(*i)->getUnitGuid()); - if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER && pTemp->getClass() == Healer) - { - pTarget = pTemp; - break; - } - } - if (pTarget) - break; - } - if (!pTarget) - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - { - Crystalline_Tangler->AI()->AttackStart(pTarget); - Crystalline_Tangler->getThreatManager().addThreat(pTarget, 1000000000.0f); - } - } uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; - } else uiSummonCrystallineTanglerTimer -= diff; + bFrenzy = false; + bCrystalSpikes = false; - DoMeleeAttackIfReady(); - } -}; + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, NOT_STARTED); + } -struct mob_crystal_spikeAI : public Scripted_NoMovementAI -{ - mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) - { - } - - uint32 SpellCrystalSpikeDamageTimer; - uint32 SpellCrystalSpikePrevisualTimer; - - void Reset() - { - SpellCrystalSpikeDamageTimer = 3.7*IN_MILLISECONDS; - SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS; - } - - void UpdateAI(const uint32 diff) - { - if (SpellCrystalSpikePrevisualTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL); - SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikePrevisualTimer -= diff; + DoScriptText(SAY_AGGRO, me); - if (SpellCrystalSpikeDamageTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) { - DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE); - SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS; - } else SpellCrystalSpikeDamageTimer -= diff; - } -}; + DoScriptText(SAY_DEATH, me); -struct mob_crystalline_tanglerAI : public ScriptedAI -{ - mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) {} + if (pInstance) + pInstance->SetData(DATA_ORMOROK_EVENT, DONE); + } - uint32 uiRootsTimer; - - void Reset() - { - uiRootsTimer = 1*IN_MILLISECONDS; - } - - void UpdateAI(const uint32 diff) - { - if (uiRootsTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - if (me->IsWithinDist(me->getVictim(), 5.0f, false)) + DoScriptText(SAY_KILL, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) { - DoCast(me->getVictim(), SPELL_ROOTS); - uiRootsTimer = 15*IN_MILLISECONDS; + return; } - } else uiRootsTimer -= diff; + if (bCrystalSpikes) + if (uiCrystalSpikesTimer2 <= diff) + { + fSpikeXY[0][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); + fSpikeXY[0][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); + fSpikeXY[1][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO)); + fSpikeXY[1][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO)); + fSpikeXY[2][0] = fBaseX+(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); + fSpikeXY[2][1] = fBaseY+(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + fSpikeXY[3][0] = fBaseX-(SPIKE_DISTANCE*uiCrystalSpikesCount*cos(fBaseO-(M_PI/2))); + fSpikeXY[3][1] = fBaseY-(SPIKE_DISTANCE*uiCrystalSpikesCount*sin(fBaseO-(M_PI/2))); + for (uint8 i = 0; i < 4; ++i) + me->SummonCreature(MOB_CRYSTAL_SPIKE, fSpikeXY[i][0], fSpikeXY[i][1], fBaseZ, 0, TEMPSUMMON_TIMED_DESPAWN, 7*IN_MILLISECONDS); + if (++uiCrystalSpikesCount >= 13) + bCrystalSpikes = false; + uiCrystalSpikesTimer2 = 200; + } else uiCrystalSpikesTimer2 -= diff; + + if (!bFrenzy && (me->GetHealth() < me->GetMaxHealth() * 0.25)) + { + DoCast(me, SPELL_FRENZY); + bFrenzy = true; + } + + if (uiTrampleTimer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + uiTrampleTimer = 10*IN_MILLISECONDS; + } else uiTrampleTimer -= diff; + + if (uiSpellReflectionTimer <= diff) + { + DoScriptText(SAY_REFLECT, me); + DoCast(me, SPELL_SPELL_REFLECTION); + uiSpellReflectionTimer = 30*IN_MILLISECONDS; + } else uiSpellReflectionTimer -= diff; + + if (uiCrystalSpikesTimer <= diff) + { + DoScriptText(SAY_CRYSTAL_SPIKES, me); + bCrystalSpikes = true; + uiCrystalSpikesCount = 1; + uiCrystalSpikesTimer2 = 0; + fBaseX = me->GetPositionX(); + fBaseY = me->GetPositionY(); + fBaseZ = me->GetPositionZ(); + fBaseO = me->GetOrientation(); + uiCrystalSpikesTimer = 20*IN_MILLISECONDS; + } else uiCrystalSpikesTimer -= diff; + + if (IsHeroic() && (uiSummonCrystallineTanglerTimer <= diff)) + { + Creature* Crystalline_Tangler = me->SummonCreature(MOB_CRYSTALLINE_TANGLER, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); + if (Crystalline_Tangler) + { + Unit *pTarget = NULL; + uint8 Healer = 0; + for (uint8 j = 1; j <= 4; j++) + { + switch (j) + { + case 1: Healer = CLASS_PRIEST; break; + case 2: Healer = CLASS_PALADIN; break; + case 3: Healer = CLASS_DRUID; break; + case 4: Healer = CLASS_SHAMAN; break; + } + std::list::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pTemp = Unit::GetUnit((*me),(*i)->getUnitGuid()); + if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER && pTemp->getClass() == Healer) + { + pTarget = pTemp; + break; + } + } + if (pTarget) + break; + } + if (!pTarget) + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + Crystalline_Tangler->AI()->AttackStart(pTarget); + Crystalline_Tangler->getThreatManager().addThreat(pTarget, 1000000000.0f); + } + } + uiSummonCrystallineTanglerTimer = 17*IN_MILLISECONDS; + } else uiSummonCrystallineTanglerTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_crystal_spike : public CreatureScript +{ +public: + mob_crystal_spike() : CreatureScript("mob_crystal_spike") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_crystal_spikeAI (pCreature); } + + struct mob_crystal_spikeAI : public Scripted_NoMovementAI + { + mob_crystal_spikeAI(Creature *c) : Scripted_NoMovementAI(c) + { + } + + uint32 SpellCrystalSpikeDamageTimer; + uint32 SpellCrystalSpikePrevisualTimer; + + void Reset() + { + SpellCrystalSpikeDamageTimer = 3.7*IN_MILLISECONDS; + SpellCrystalSpikePrevisualTimer = 1*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (SpellCrystalSpikePrevisualTimer <= diff) + { + DoCast(me, SPELL_CRYSTAL_SPIKE_PREVISUAL); + SpellCrystalSpikePrevisualTimer = 10*IN_MILLISECONDS; + } else SpellCrystalSpikePrevisualTimer -= diff; + + if (SpellCrystalSpikeDamageTimer <= diff) + { + DoCast(me, SPELL_CRYSTALL_SPIKE_DAMAGE); + SpellCrystalSpikeDamageTimer = 10*IN_MILLISECONDS; + } else SpellCrystalSpikeDamageTimer -= diff; + } + }; + +}; + class mob_crystalline_tangler : public CreatureScript +{ +public: + mob_crystalline_tangler() : CreatureScript("mob_crystalline_tangler") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_crystalline_tanglerAI (pCreature); + } + + struct mob_crystalline_tanglerAI : public ScriptedAI + { + mob_crystalline_tanglerAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiRootsTimer; + + void Reset() + { + uiRootsTimer = 1*IN_MILLISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (uiRootsTimer <= diff) + { + if (me->IsWithinDist(me->getVictim(), 5.0f, false)) + { + DoCast(me->getVictim(), SPELL_ROOTS); + uiRootsTimer = 15*IN_MILLISECONDS; + } + } else uiRootsTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_crystal_spike(Creature* pCreature) -{ - return new mob_crystal_spikeAI (pCreature); -} -CreatureAI* GetAI_mob_crystalline_tangler(Creature* pCreature) -{ - return new mob_crystalline_tanglerAI (pCreature); -} -CreatureAI* GetAI_boss_ormorok(Creature* pCreature) -{ - return new boss_ormorokAI (pCreature); -} void AddSC_boss_ormorok() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ormorok"; - newscript->GetAI = &GetAI_boss_ormorok; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crystal_spike"; - newscript->GetAI = &GetAI_mob_crystal_spike; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crystalline_tangler"; - newscript->GetAI = &GetAI_mob_crystalline_tangler; - newscript->RegisterSelf(); + new boss_ormorok(); + new mob_crystal_spike(); + new mob_crystalline_tangler(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp index 2a95007a477..52b1943b7d6 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_kolurg.cpp @@ -39,37 +39,39 @@ update creature_template set scriptname = 'boss_commander_kolurg' where entry = #define SAY_AGGRO -1576024 #define SAY_KILL -1576025 #define SAY_DEATH -1576026 - -struct boss_commander_kolurgAI : public ScriptedAI + class boss_commander_kolurg : public CreatureScript { - boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {} +public: + boss_commander_kolurg() : CreatureScript("boss_commander_kolurg") { } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) + CreatureAI* GetAI(Creature* pCreature) const { - //Return since we have no target - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + return new boss_commander_kolurgAI (pCreature); } - void JustDied(Unit* /*killer*/) {} + + struct boss_commander_kolurgAI : public ScriptedAI + { + boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) {} + }; + }; -CreatureAI* GetAI_boss_commander_kolurg(Creature* pCreature) -{ - return new boss_commander_kolurgAI (pCreature); -} void AddSC_boss_commander_kolurg() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_commander_kolurg"; - newscript->GetAI = &GetAI_boss_commander_kolurg; - newscript->RegisterSelf(); + new boss_commander_kolurg(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp index a4e8f9559ce..baa851e3f2b 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/commander_stoutbeard.cpp @@ -39,43 +39,45 @@ update creature_template set scriptname = 'boss_commander_stoutbeard' where entr #define SAY_AGGRO -1576021 #define SAY_KILL -1576022 #define SAY_DEATH -1576023 - -struct boss_commander_stoutbeardAI : public ScriptedAI + class boss_commander_stoutbeard : public CreatureScript { - boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {} +public: + boss_commander_stoutbeard() : CreatureScript("boss_commander_stoutbeard") { } - void Reset() {} - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me); + return new boss_commander_stoutbeardAI (pCreature); } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) + struct boss_commander_stoutbeardAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - } + boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {} + + void Reset() {} + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + } + }; + }; -CreatureAI* GetAI_boss_commander_stoutbeard(Creature* pCreature) -{ - return new boss_commander_stoutbeardAI (pCreature); -} void AddSC_boss_commander_stoutbeard() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_commander_stoutbeard"; - newscript->GetAI = &GetAI_boss_commander_stoutbeard; - newscript->RegisterSelf(); + new boss_commander_stoutbeard(); } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index 356a7eab12f..74b04dd672e 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -25,236 +25,239 @@ enum Factions { FACTION_HOSTILE_FOR_ALL = 16 }; - -struct instance_nexus : public ScriptedInstance + class instance_nexus : public InstanceMapScript { - instance_nexus(Map *pMap) : ScriptedInstance(pMap) { Initialize(); } +public: + instance_nexus() : InstanceMapScript("instance_nexus") { } - uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; - - uint64 Anomalus; - uint64 Keristrasza; - - uint64 AnomalusContainmentSphere; - uint64 OrmoroksContainmentSphere; - uint64 TelestrasContainmentSphere; - - std::string strInstData; - - void Initialize() + InstanceScript *GetInstanceData_InstanceMapScript(Map *pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Anomalus = 0; - Keristrasza = 0; + return new instance_nexus_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature *pCreature, bool /*bAdd*/) + struct instance_nexus_InstanceMapScript : public InstanceScript { - Map::PlayerList const &players = instance->GetPlayers(); - uint32 TeamInInstance = 0; + instance_nexus_InstanceMapScript(Map *pMap) : InstanceScript(pMap) { Initialize(); } - if (!players.isEmpty()) - { - if (Player* pPlayer = players.begin()->getSource()) - TeamInInstance = pPlayer->GetTeam(); - } - switch (pCreature->GetEntry()) - { - case 26763: - Anomalus = pCreature->GetGUID(); - break; - case 26723: - Keristrasza = pCreature->GetGUID(); - break; - // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs. - case 26800: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26799, HORDE); - break; - } - case 26802: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26801, HORDE); - break; - } - case 26805: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26803, HORDE); - break; - } - case 27949: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(27947, HORDE); - break; - } - case 26796: - { - if (ServerAllowsTwoSideGroups()) - pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); - if (TeamInInstance == ALLIANCE) - pCreature->UpdateEntry(26798, HORDE); - break; - } - } - } + uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; - void OnGameObjectCreate(GameObject *pGo, bool /*bAdd*/) - { - switch (pGo->GetEntry()) - { - case 188527: - { - AnomalusContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - } - case 188528: - { - OrmoroksContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - } - case 188526: - { - TelestrasContainmentSphere = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - } - } - } + uint64 Anomalus; + uint64 Keristrasza; - uint32 GetData(uint32 identifier) - { - switch(identifier) - { - case DATA_MAGUS_TELESTRA_EVENT: return m_auiEncounter[0]; - case DATA_ANOMALUS_EVENT: return m_auiEncounter[1]; - case DATA_ORMOROK_EVENT: return m_auiEncounter[2]; - case DATA_KERISTRASZA_EVENT: return m_auiEncounter[3]; - } - return 0; - } + uint64 AnomalusContainmentSphere; + uint64 OrmoroksContainmentSphere; + uint64 TelestrasContainmentSphere; - void SetData(uint32 identifier, uint32 data) - { - switch (identifier) + std::string strInstData; + + void Initialize() { - case DATA_MAGUS_TELESTRA_EVENT: + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Anomalus = 0; + Keristrasza = 0; + } + + void OnCreatureCreate(Creature *pCreature, bool /*bAdd*/) + { + Map::PlayerList const &players = instance->GetPlayers(); + uint32 TeamInInstance = 0; + + if (!players.isEmpty()) { - if (data == DONE) + if (Player* pPlayer = players.begin()->getSource()) + TeamInInstance = pPlayer->GetTeam(); + } + switch (pCreature->GetEntry()) + { + case 26763: + Anomalus = pCreature->GetGUID(); + break; + case 26723: + Keristrasza = pCreature->GetGUID(); + break; + // Alliance npcs are spawned by default, if you are alliance, you will fight against horde npcs. + case 26800: { - GameObject *Sphere = instance->GetGameObject(TelestrasContainmentSphere); - if (Sphere) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26799, HORDE); + break; } - m_auiEncounter[0] = data; - break; - } - case DATA_ANOMALUS_EVENT: - { - if (data == DONE) + case 26802: { - if (GameObject *Sphere = instance->GetGameObject(AnomalusContainmentSphere)) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26801, HORDE); + break; } - m_auiEncounter[1] = data; - break; - } - case DATA_ORMOROK_EVENT: - { - if (data == DONE) + case 26805: { - if (GameObject *Sphere = instance->GetGameObject(OrmoroksContainmentSphere)) - Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26803, HORDE); + break; + } + case 27949: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(27947, HORDE); + break; + } + case 26796: + { + if (ServerAllowsTwoSideGroups()) + pCreature->setFaction(FACTION_HOSTILE_FOR_ALL); + if (TeamInInstance == ALLIANCE) + pCreature->UpdateEntry(26798, HORDE); + break; } - m_auiEncounter[2] = data; - break; } - case DATA_KERISTRASZA_EVENT: - m_auiEncounter[3] = data; - break; } - if (data == DONE) + void OnGameObjectCreate(GameObject *pGo, bool /*bAdd*/) { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3]; - - strInstData = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + switch (pGo->GetEntry()) + { + case 188527: + { + AnomalusContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } + case 188528: + { + OrmoroksContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } + case 188526: + { + TelestrasContainmentSphere = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + } + } } - } - uint64 GetData64(uint32 uiIdentifier) - { - switch(uiIdentifier) + uint32 GetData(uint32 identifier) { - case DATA_ANOMALUS: return Anomalus; - case DATA_KERISTRASZA: return Keristrasza; - case ANOMALUS_CONTAINMET_SPHERE: return AnomalusContainmentSphere; - case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere; - case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere; + switch(identifier) + { + case DATA_MAGUS_TELESTRA_EVENT: return m_auiEncounter[0]; + case DATA_ANOMALUS_EVENT: return m_auiEncounter[1]; + case DATA_ORMOROK_EVENT: return m_auiEncounter[2]; + case DATA_KERISTRASZA_EVENT: return m_auiEncounter[3]; + } + return 0; } - return 0; - } - std::string GetSaveData() - { - return strInstData; - } - - void Load(const char *chrIn) - { - if (!chrIn) + void SetData(uint32 identifier, uint32 data) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch (identifier) + { + case DATA_MAGUS_TELESTRA_EVENT: + { + if (data == DONE) + { + GameObject *Sphere = instance->GetGameObject(TelestrasContainmentSphere); + if (Sphere) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[0] = data; + break; + } + case DATA_ANOMALUS_EVENT: + { + if (data == DONE) + { + if (GameObject *Sphere = instance->GetGameObject(AnomalusContainmentSphere)) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[1] = data; + break; + } + case DATA_ORMOROK_EVENT: + { + if (data == DONE) + { + if (GameObject *Sphere = instance->GetGameObject(OrmoroksContainmentSphere)) + Sphere->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } + m_auiEncounter[2] = data; + break; + } + case DATA_KERISTRASZA_EVENT: + m_auiEncounter[3] = data; + break; + } + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3]; + + strInstData = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } } - OUT_LOAD_INST_DATA(chrIn); + uint64 GetData64(uint32 uiIdentifier) + { + switch(uiIdentifier) + { + case DATA_ANOMALUS: return Anomalus; + case DATA_KERISTRASZA: return Keristrasza; + case ANOMALUS_CONTAINMET_SPHERE: return AnomalusContainmentSphere; + case ORMOROKS_CONTAINMET_SPHERE: return OrmoroksContainmentSphere; + case TELESTRAS_CONTAINMET_SPHERE: return TelestrasContainmentSphere; + } + return 0; + } - std::istringstream loadStream(chrIn); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + std::string GetSaveData() + { + return strInstData; + } - for (uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + void Load(const char *chrIn) + { + if (!chrIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(chrIn); + + std::istringstream loadStream(chrIn); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + + for (uint8 i = 0; i < NUMBER_OF_ENCOUNTERS; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData *GetInstanceData_instance_nexus(Map *pMap) -{ - return new instance_nexus(pMap); -} void AddSC_instance_nexus() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_nexus"; - newscript->GetInstanceData = &GetInstanceData_instance_nexus; - newscript->RegisterSelf(); + new instance_nexus(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index a1201b838c5..1d6f581b170 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -51,169 +51,174 @@ enum { ACHIEV_TIMED_START_EVENT = 18153, }; - -struct boss_drakosAI : public ScriptedAI + class boss_drakos : public CreatureScript { - boss_drakosAI(Creature* pCreature) : ScriptedAI(pCreature), lSummons(me) +public: + boss_drakos() : CreatureScript("boss_drakos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_drakosAI (pCreature); } - uint32 uiMagicPullTimer; - uint32 uiStompTimer; - uint32 uiBombSummonTimer; - - bool bPostPull; - - ScriptedInstance* pInstance; - SummonList lSummons; - - void Reset() + struct boss_drakosAI : public ScriptedAI { - lSummons.DespawnAll(); - uiMagicPullTimer = 15000; - uiStompTimer = 17000; - uiBombSummonTimer = 2000; - - bPostPull = false; - - if (pInstance) - pInstance->SetData(DATA_DRAKOS_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS); - } - - void JustSummoned(Creature* pSummon) - { - lSummons.Summon(pSummon); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiBombSummonTimer <= uiDiff) + boss_drakosAI(Creature* pCreature) : ScriptedAI(pCreature), lSummons(me) { - Position pPosition; - me->GetPosition(&pPosition); + pInstance = pCreature->GetInstanceScript(); + } - if (bPostPull) + uint32 uiMagicPullTimer; + uint32 uiStompTimer; + uint32 uiBombSummonTimer; + + bool bPostPull; + + InstanceScript* pInstance; + SummonList lSummons; + + void Reset() + { + lSummons.DespawnAll(); + uiMagicPullTimer = 15000; + uiStompTimer = 17000; + uiBombSummonTimer = 2000; + + bPostPull = false; + + if (pInstance) + pInstance->SetData(DATA_DRAKOS_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_DRAKOS_EVENT, IN_PROGRESS); + } + + void JustSummoned(Creature* pSummon) + { + lSummons.Summon(pSummon); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiBombSummonTimer <= uiDiff) { - for (uint8 uiI = 0; uiI >= 3; uiI++) + Position pPosition; + me->GetPosition(&pPosition); + + if (bPostPull) + { + for (uint8 uiI = 0; uiI >= 3; uiI++) + { + me->GetRandomNearPosition(pPosition, float(urand(0,10))); + me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); + } + } + else { me->GetRandomNearPosition(pPosition, float(urand(0,10))); me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); } - } - else + + uiBombSummonTimer = 2000; + } else uiBombSummonTimer -= uiDiff; + + if (uiMagicPullTimer <= uiDiff) { - me->GetRandomNearPosition(pPosition, float(urand(0,10))); - me->SummonCreature(NPC_UNSTABLE_SPHERE, pPosition); - } + DoCast(SPELL_MAGIC_PULL); - uiBombSummonTimer = 2000; - } else uiBombSummonTimer -= uiDiff; + bPostPull = true; - if (uiMagicPullTimer <= uiDiff) - { - DoCast(SPELL_MAGIC_PULL); + uiMagicPullTimer = 15000; + } else uiMagicPullTimer -= uiDiff; - bPostPull = true; + if (uiStompTimer <= uiDiff) + { + DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me); + DoCast(SPELL_THUNDERING_STOMP); + uiStompTimer = 17000; + } else uiStompTimer -= uiDiff; - uiMagicPullTimer = 15000; - } else uiMagicPullTimer -= uiDiff; - - if (uiStompTimer <= uiDiff) - { - DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2,SAY_STOMP_3), me); - DoCast(SPELL_THUNDERING_STOMP); - uiStompTimer = 17000; - } else uiStompTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - { - pInstance->SetData(DATA_DRAKOS_EVENT, DONE); - // start achievement timer (kill Eregos within 20 min) - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + DoMeleeAttackIfReady(); } - lSummons.DespawnAll(); - } - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); - } -}; - -CreatureAI* GetAI_boss_drakos(Creature* pCreature) -{ - return new boss_drakosAI (pCreature); -} - -struct npc_unstable_sphereAI : public ScriptedAI -{ - npc_unstable_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) {} - - uint32 uiPulseTimer; - uint32 uiDeathTimer; - - void Reset() - { - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRandom(40.0f); - - me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); - me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); - - uiPulseTimer = 3000; - uiDeathTimer = 19000; - } - - void UpdateAI(const uint32 uiDiff) - { - if (uiPulseTimer <= uiDiff) + void JustDied(Unit* /*killer*/) { - DoCast(SPELL_UNSTABLE_SPHERE_PULSE); - uiPulseTimer = 3*IN_MILLISECONDS; - } else uiPulseTimer -= uiDiff; + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + pInstance->SetData(DATA_DRAKOS_EVENT, DONE); + // start achievement timer (kill Eregos within 20 min) + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } + + lSummons.DespawnAll(); + } + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me); + } + }; - if (uiDeathTimer <= uiDiff) - me->DisappearAndDie(); - else uiDeathTimer -= uiDiff; - } }; -CreatureAI* GetAI_npc_unstable_sphere(Creature* pCreature) + class npc_unstable_sphere : public CreatureScript { - return new npc_unstable_sphereAI (pCreature); -} +public: + npc_unstable_sphere() : CreatureScript("npc_unstable_sphere") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_unstable_sphereAI (pCreature); + } + + struct npc_unstable_sphereAI : public ScriptedAI + { + npc_unstable_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + uint32 uiPulseTimer; + uint32 uiDeathTimer; + + void Reset() + { + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRandom(40.0f); + + me->AddAura(SPELL_UNSTABLE_SPHERE_PASSIVE, me); + me->AddAura(SPELL_UNSTABLE_SPHERE_TIMER, me); + + uiPulseTimer = 3000; + uiDeathTimer = 19000; + } + + void UpdateAI(const uint32 uiDiff) + { + if (uiPulseTimer <= uiDiff) + { + DoCast(SPELL_UNSTABLE_SPHERE_PULSE); + uiPulseTimer = 3*IN_MILLISECONDS; + } else uiPulseTimer -= uiDiff; + + if (uiDeathTimer <= uiDiff) + me->DisappearAndDie(); + else uiDeathTimer -= uiDiff; + } + }; + +}; + void AddSC_boss_drakos() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_drakos"; - newscript->GetAI = &GetAI_boss_drakos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_unstable_sphere"; - newscript->GetAI = &GetAI_npc_unstable_sphere; - newscript->RegisterSelf(); + new boss_drakos(); + new npc_unstable_sphere(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index cde22d0268c..5604f82f9d7 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -74,57 +74,59 @@ enum EmeraldDrake // you do not have access to until you kill the Mage-Lord Urom SPELL_EMERALD_DREAM_FUNNEL = 50344 //(60 yds) - Channeled - Transfers 5% of the caster's max health to a friendly drake every second for 10 seconds as long as the caster channels. }; - -struct boss_eregosAI : public ScriptedAI + class boss_eregos : public CreatureScript { - boss_eregosAI(Creature *c) : ScriptedAI(c) +public: + boss_eregos() : CreatureScript("boss_eregos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_eregosAI (pCreature); } - ScriptedInstance* pInstance; - - void Reset() + struct boss_eregosAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, NOT_STARTED); - } + boss_eregosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, IN_PROGRESS); - } + InstanceScript* pInstance; - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, NOT_STARTED); + } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_EREGOS_EVENT, DONE); + } + }; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_EREGOS_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_eregos(Creature* pCreature) -{ - return new boss_eregosAI (pCreature); -} void AddSC_boss_eregos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_eregos"; - newscript->GetAI = &GetAI_boss_eregos; - newscript->RegisterSelf(); + new boss_eregos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 86735b9ff81..5d1626ec3d1 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -85,273 +85,275 @@ static int32 SayAggro[]= { SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3,SAY_AGGRO_4 }; - -struct boss_uromAI : public ScriptedAI + class boss_urom : public CreatureScript { - boss_uromAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_urom() : CreatureScript("boss_urom") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_uromAI (pCreature); } - ScriptedInstance* pInstance; - - float x,y; - - bool bCanCast; - bool bCanGoBack; - - uint8 uiGroup[3]; - - uint32 uiTeleportTimer; - uint32 uiArcaneExplosionTimer; - uint32 uiCastArcaneExplosionTimer; - uint32 uiFrostBombTimer; - uint32 uiTimeBombTimer; - - void Reset() + struct boss_uromAI : public ScriptedAI { - if (pInstance && pInstance->GetData(DATA_VAROS_EVENT) != DONE) - DoCast(SPELL_ARCANE_SHIELD); - - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, NOT_STARTED); - - if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) == 0) + boss_uromAI(Creature* pCreature) : ScriptedAI(pCreature) { - uiGroup[0] = 0; - uiGroup[1] = 0; - uiGroup[2] = 0; + pInstance = pCreature->GetInstanceScript(); } - x,y = 0.0f; - bCanCast = false; - bCanGoBack = false; + InstanceScript* pInstance; - me->GetMotionMaster()->MoveIdle(); + float x,y; - uiTeleportTimer = urand(30000,35000); - uiArcaneExplosionTimer = 9000; - uiCastArcaneExplosionTimer = 2000; - uiFrostBombTimer = urand(5000,8000); - uiTimeBombTimer = urand(20000,25000); - } + bool bCanCast; + bool bCanGoBack; - void EnterCombat(Unit* pWho) - { - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, IN_PROGRESS); + uint8 uiGroup[3]; - SetGroups(); - SummonGroups(); - CastTeleport(); + uint32 uiTeleportTimer; + uint32 uiArcaneExplosionTimer; + uint32 uiCastArcaneExplosionTimer; + uint32 uiFrostBombTimer; + uint32 uiTimeBombTimer; - if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) != 3) - pInstance->SetData(DATA_UROM_PLATAFORM,pInstance->GetData(DATA_UROM_PLATAFORM)+1); - } - - void AttackStart(Unit* pWho) - { - if (!pWho) - return; - - if (me->GetPositionZ() > 518.63) - DoStartNoMovement(pWho); - - if (me->GetPositionZ() < 518.63) + void Reset() { - if (me->Attack(pWho, true)) + if (pInstance && pInstance->GetData(DATA_VAROS_EVENT) != DONE) + DoCast(SPELL_ARCANE_SHIELD); + + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, NOT_STARTED); + + if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) == 0) { - DoScriptText(SayAggro[3],me); + uiGroup[0] = 0; + uiGroup[1] = 0; + uiGroup[2] = 0; + } - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + x,y = 0.0f; + bCanCast = false; + bCanGoBack = false; - me->GetMotionMaster()->MoveChase(pWho, 0,0); - } - } - } - - void SetGroups() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) != 0) - return; - - while (uiGroup[0] == uiGroup[1] || uiGroup[0] == uiGroup[2] || uiGroup[1] == uiGroup[2]) - { - uiGroup[0] = urand(0,2); - uiGroup[1] = urand(0,2); - uiGroup[2] = urand(0,2); - } - } - - void SetPosition(uint8 uiI) - { - switch(uiI) - { - case 0: - x = me->GetPositionX() + 4; - y = me->GetPositionY() - 4; - break; - case 1: - x = me->GetPositionX() + 4; - y = me->GetPositionY() + 4; - break; - case 2: - x = me->GetPositionX() - 4; - y = me->GetPositionY() + 4; - break; - case 3: - x = me->GetPositionX() - 4; - y = me->GetPositionY() - 4; - break; - default: - break; - } - } - - void SummonGroups() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - for (uint8 uiI = 0; uiI < 4 ; uiI++) - { - SetPosition(uiI); - me->SummonCreature(Group[uiGroup[pInstance->GetData(DATA_UROM_PLATAFORM)]].uiEntry[uiI],x,y,me->GetPositionZ(),me->GetOrientation()); - } - } - - void CastTeleport() - { - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) - return; - - DoScriptText(SayAggro[pInstance->GetData(DATA_UROM_PLATAFORM)],me); - DoCast(TeleportSpells[pInstance->GetData(DATA_UROM_PLATAFORM)]); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2) - return; - - if (uiTeleportTimer <= uiDiff) - { - me->InterruptNonMeleeSpells(false); - DoScriptText(SAY_TELEPORT,me); me->GetMotionMaster()->MoveIdle(); - DoCast(SPELL_TELEPORT); + uiTeleportTimer = urand(30000,35000); - - } else uiTeleportTimer -= uiDiff; - - if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) - { - if (uiCastArcaneExplosionTimer <= uiDiff) - { - bCanCast = false; - bCanGoBack = true; - DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); - uiCastArcaneExplosionTimer = 2000; - }else uiCastArcaneExplosionTimer -= uiDiff; + uiArcaneExplosionTimer = 9000; + uiCastArcaneExplosionTimer = 2000; + uiFrostBombTimer = urand(5000,8000); + uiTimeBombTimer = urand(20000,25000); } - if (bCanGoBack) + void EnterCombat(Unit* pWho) { - if (uiArcaneExplosionTimer <= uiDiff) - { - Position pPos; - me->getVictim()->GetPosition(&pPos); + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, IN_PROGRESS); - me->NearTeleportTo(pPos.GetPositionX(),pPos.GetPositionY(),pPos.GetPositionZ(),pPos.GetOrientation()); - me->GetMotionMaster()->MoveChase(me->getVictim(),0,0); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + SetGroups(); + SummonGroups(); + CastTeleport(); - bCanCast = false; - bCanGoBack = false; - uiArcaneExplosionTimer = 9000; - } else uiArcaneExplosionTimer -= uiDiff; + if (pInstance && pInstance->GetData(DATA_UROM_PLATAFORM) != 3) + pInstance->SetData(DATA_UROM_PLATAFORM,pInstance->GetData(DATA_UROM_PLATAFORM)+1); } - if (!me->IsNonMeleeSpellCasted(false, true, true)) + void AttackStart(Unit* pWho) { - if (uiFrostBombTimer <= uiDiff) - { - DoCastVictim(SPELL_FROSTBOMB); - uiFrostBombTimer = urand(5000,8000); - } else uiFrostBombTimer -= uiDiff; + if (!pWho) + return; - if (uiTimeBombTimer <= uiDiff) - { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pUnit,SPELL_TIME_BOMB); + if (me->GetPositionZ() > 518.63) + DoStartNoMovement(pWho); - uiTimeBombTimer = urand(20000,25000); - } else uiTimeBombTimer -= uiDiff; + if (me->GetPositionZ() < 518.63) + { + if (me->Attack(pWho, true)) + { + DoScriptText(SayAggro[3],me); + + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + me->GetMotionMaster()->MoveChase(pWho, 0,0); + } + } } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_UROM_EVENT, DONE); - } - - void JustSummoned(Creature* pSummon) - { - pSummon->SetInCombatWithZone(); - } - - void LeaveCombat() - { - me->RemoveAllAuras(); - me->CombatStop(false); - me->DeleteThreatList(); - } - - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - switch(pSpell->Id) + void SetGroups() { - case SPELL_SUMMON_MENAGERIE: - me->SetHomePosition(968.66,1042.53,527.32,0.077); - LeaveCombat(); - break; - case SPELL_SUMMON_MENAGERIE_2: - me->SetHomePosition(1164.02,1170.85,527.321,3.66); - LeaveCombat(); - break; - case SPELL_SUMMON_MENAGERIE_3: - me->SetHomePosition(1118.31,1080.377,508.361,4.25); - LeaveCombat(); - break; - case SPELL_TELEPORT: - me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting - bCanCast = true; - break; - default: - break; + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) != 0) + return; + + while (uiGroup[0] == uiGroup[1] || uiGroup[0] == uiGroup[2] || uiGroup[1] == uiGroup[2]) + { + uiGroup[0] = urand(0,2); + uiGroup[1] = urand(0,2); + uiGroup[2] = urand(0,2); + } } - } + + void SetPosition(uint8 uiI) + { + switch(uiI) + { + case 0: + x = me->GetPositionX() + 4; + y = me->GetPositionY() - 4; + break; + case 1: + x = me->GetPositionX() + 4; + y = me->GetPositionY() + 4; + break; + case 2: + x = me->GetPositionX() - 4; + y = me->GetPositionY() + 4; + break; + case 3: + x = me->GetPositionX() - 4; + y = me->GetPositionY() - 4; + break; + default: + break; + } + } + + void SummonGroups() + { + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) + return; + + for (uint8 uiI = 0; uiI < 4 ; uiI++) + { + SetPosition(uiI); + me->SummonCreature(Group[uiGroup[pInstance->GetData(DATA_UROM_PLATAFORM)]].uiEntry[uiI],x,y,me->GetPositionZ(),me->GetOrientation()); + } + } + + void CastTeleport() + { + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) > 2) + return; + + DoScriptText(SayAggro[pInstance->GetData(DATA_UROM_PLATAFORM)],me); + DoCast(TeleportSpells[pInstance->GetData(DATA_UROM_PLATAFORM)]); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!pInstance || pInstance->GetData(DATA_UROM_PLATAFORM) < 2) + return; + + if (uiTeleportTimer <= uiDiff) + { + me->InterruptNonMeleeSpells(false); + DoScriptText(SAY_TELEPORT,me); + me->GetMotionMaster()->MoveIdle(); + DoCast(SPELL_TELEPORT); + uiTeleportTimer = urand(30000,35000); + + } else uiTeleportTimer -= uiDiff; + + if (bCanCast && !me->FindCurrentSpellBySpellId(SPELL_EMPOWERED_ARCANE_EXPLOSION)) + { + if (uiCastArcaneExplosionTimer <= uiDiff) + { + bCanCast = false; + bCanGoBack = true; + DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); + uiCastArcaneExplosionTimer = 2000; + }else uiCastArcaneExplosionTimer -= uiDiff; + } + + if (bCanGoBack) + { + if (uiArcaneExplosionTimer <= uiDiff) + { + Position pPos; + me->getVictim()->GetPosition(&pPos); + + me->NearTeleportTo(pPos.GetPositionX(),pPos.GetPositionY(),pPos.GetPositionZ(),pPos.GetOrientation()); + me->GetMotionMaster()->MoveChase(me->getVictim(),0,0); + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + + bCanCast = false; + bCanGoBack = false; + uiArcaneExplosionTimer = 9000; + } else uiArcaneExplosionTimer -= uiDiff; + } + + if (!me->IsNonMeleeSpellCasted(false, true, true)) + { + if (uiFrostBombTimer <= uiDiff) + { + DoCastVictim(SPELL_FROSTBOMB); + uiFrostBombTimer = urand(5000,8000); + } else uiFrostBombTimer -= uiDiff; + + if (uiTimeBombTimer <= uiDiff) + { + if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pUnit,SPELL_TIME_BOMB); + + uiTimeBombTimer = urand(20000,25000); + } else uiTimeBombTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_UROM_EVENT, DONE); + } + + void JustSummoned(Creature* pSummon) + { + pSummon->SetInCombatWithZone(); + } + + void LeaveCombat() + { + me->RemoveAllAuras(); + me->CombatStop(false); + me->DeleteThreatList(); + } + + void SpellHit(Unit* pCaster, const SpellEntry* pSpell) + { + switch(pSpell->Id) + { + case SPELL_SUMMON_MENAGERIE: + me->SetHomePosition(968.66,1042.53,527.32,0.077); + LeaveCombat(); + break; + case SPELL_SUMMON_MENAGERIE_2: + me->SetHomePosition(1164.02,1170.85,527.321,3.66); + LeaveCombat(); + break; + case SPELL_SUMMON_MENAGERIE_3: + me->SetHomePosition(1118.31,1080.377,508.361,4.25); + LeaveCombat(); + break; + case SPELL_TELEPORT: + me->AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY); // with out it the npc will fall down while is casting + bCanCast = true; + break; + default: + break; + } + } + }; + }; -CreatureAI* GetAI_boss_urom(Creature* pCreature) -{ - return new boss_uromAI (pCreature); -} void AddSC_boss_urom() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_urom"; - newscript->GetAI = &GetAI_boss_urom; - newscript->RegisterSelf(); + new boss_urom(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 1a67d07dcb0..f9f22a37990 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -43,64 +43,66 @@ enum Yells SAY_STRIKE_3 = -1578028, SAY_SPAWN = -1578029 }; - -struct boss_varosAI : public ScriptedAI + class boss_varos : public CreatureScript { - boss_varosAI(Creature *c) : ScriptedAI(c) +public: + boss_varos() : CreatureScript("boss_varos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_varosAI (pCreature); } - ScriptedInstance* pInstance; + struct boss_varosAI : public ScriptedAI + { + boss_varosAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, NOT_STARTED); - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + InstanceScript* pInstance; - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, IN_PROGRESS); - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, NOT_STARTED); + } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, IN_PROGRESS); + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_VAROS_EVENT, DONE); + } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } + }; - if (pInstance) - pInstance->SetData(DATA_VAROS_EVENT, DONE); - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } }; -CreatureAI* GetAI_boss_varos(Creature* pCreature) -{ - return new boss_varosAI (pCreature); -} void AddSC_boss_varos() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_varos"; - newscript->GetAI = &GetAI_boss_varos; - newscript->RegisterSelf(); + new boss_varos(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index bc1ce7f58dd..8f023a98968 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -25,182 +25,185 @@ 1 - Varos Cloudstrider 2 - Mage-Lord Urom 3 - Ley-Guardian Eregos */ - -struct instance_oculus : public ScriptedInstance + class instance_oculus : public InstanceMapScript { - instance_oculus(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_oculus() : InstanceMapScript("instance_oculus") { } - uint64 uiDrakos; - uint64 uiVaros; - uint64 uiUrom; - uint64 uiEregos; - - uint8 uiPlataformUrom; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - std::list GameObjectList; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - uiPlataformUrom = 0; + return new instance_oculus_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_oculus_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_oculus_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 uiDrakos; + uint64 uiVaros; + uint64 uiUrom; + uint64 uiEregos; + + uint8 uiPlataformUrom; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + std::list GameObjectList; + + void Initialize() { - case CREATURE_DRAKOS: - uiDrakos = pCreature->GetGUID(); - break; - case CREATURE_VAROS: - uiVaros = pCreature->GetGUID(); - break; - case CREATURE_UROM: - uiUrom = pCreature->GetGUID(); - break; - case CREATURE_EREGOS: - uiEregos = pCreature->GetGUID(); - break; + uiPlataformUrom = 0; } - } - void OnGameObjectCreate(GameObject* pGO, bool bAdd) - { - if (pGO->GetEntry() == GO_DRAGON_CAGE_DOOR) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - if (DATA_DRAKOS_EVENT == DONE) - pGO->SetGoState(GO_STATE_ACTIVE); - else - pGO->SetGoState(GO_STATE_READY); + switch(pCreature->GetEntry()) + { + case CREATURE_DRAKOS: + uiDrakos = pCreature->GetGUID(); + break; + case CREATURE_VAROS: + uiVaros = pCreature->GetGUID(); + break; + case CREATURE_UROM: + uiUrom = pCreature->GetGUID(); + break; + case CREATURE_EREGOS: + uiEregos = pCreature->GetGUID(); + break; + } + } + + void OnGameObjectCreate(GameObject* pGO, bool bAdd) + { + if (pGO->GetEntry() == GO_DRAGON_CAGE_DOOR) + { + if (DATA_DRAKOS_EVENT == DONE) + pGO->SetGoState(GO_STATE_ACTIVE); + else + pGO->SetGoState(GO_STATE_READY); - GameObjectList.push_back(pGO->GetGUID()); + GameObjectList.push_back(pGO->GetGUID()); + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_DRAKOS_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - OpenCageDoors(); - break; - case DATA_VAROS_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_UROM_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_EREGOS_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_UROM_PLATAFORM: - uiPlataformUrom = data; - break; + switch(type) + { + case DATA_DRAKOS_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + OpenCageDoors(); + break; + case DATA_VAROS_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_UROM_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_EREGOS_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_UROM_PLATAFORM: + uiPlataformUrom = data; + break; + } + + if (data == DONE) + SaveToDB(); } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_DRAKOS_EVENT: return m_auiEncounter[0]; - case DATA_VAROS_EVENT: return m_auiEncounter[1]; - case DATA_UROM_EVENT: return m_auiEncounter[2]; - case DATA_EREGOS_EVENT: return m_auiEncounter[3]; - case DATA_UROM_PLATAFORM: return uiPlataformUrom; + switch(type) + { + case DATA_DRAKOS_EVENT: return m_auiEncounter[0]; + case DATA_VAROS_EVENT: return m_auiEncounter[1]; + case DATA_UROM_EVENT: return m_auiEncounter[2]; + case DATA_EREGOS_EVENT: return m_auiEncounter[3]; + case DATA_UROM_PLATAFORM: return uiPlataformUrom; + } + + return 0; } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint64 GetData64(uint32 identifier) { - case DATA_DRAKOS: return uiDrakos; - case DATA_VAROS: return uiVaros; - case DATA_UROM: return uiUrom; - case DATA_EREGOS: return uiEregos; - } + switch(identifier) + { + case DATA_DRAKOS: return uiDrakos; + case DATA_VAROS: return uiVaros; + case DATA_UROM: return uiUrom; + case DATA_EREGOS: return uiEregos; + } - return 0; - } + return 0; + } - void OpenCageDoors() - { - if (GameObjectList.empty()) - return; - - for (std::list::const_iterator itr = GameObjectList.begin(); itr != GameObjectList.end(); ++itr) + void OpenCageDoors() { - if (GameObject* pGO = instance->GetGameObject(*itr)) - pGO->SetGoState(GO_STATE_ACTIVE); - } - } + if (GameObjectList.empty()) + return; - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "T O " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + for (std::list::const_iterator itr = GameObjectList.begin(); itr != GameObjectList.end(); ++itr) + { + if (GameObject* pGO = instance->GetGameObject(*itr)) + pGO->SetGoState(GO_STATE_ACTIVE); + } } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - - if (dataHead1 == 'T' && dataHead2 == 'O') + std::string GetSaveData() { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + OUT_SAVE_INST_DATA; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + std::ostringstream saveStream; + saveStream << "T O " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - } else OUT_LOAD_INST_DATA_FAIL; + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + + if (dataHead1 == 'T' && dataHead2 == 'O') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_oculus(Map* pMap) -{ - return new instance_oculus(pMap); -} void AddSC_instance_oculus() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_oculus"; - newscript->GetInstanceData = &GetInstanceData_instance_oculus; - newscript->RegisterSelf(); + new instance_oculus(); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index b3572bd92ff..484edc3aa0c 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -49,127 +49,128 @@ enum Drakes NPC_BELGARISTRASZ = 27658, NPC_ETERNOS = 27659 }; - -bool GossipHello_npc_oculus_drake(Player* pPlayer, Creature* pCreature) + class npc_oculus_drake : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_oculus_drake() : CreatureScript("npc_oculus_drake") { } - if (pCreature->GetInstanceData()->GetData(DATA_DRAKOS_EVENT) == DONE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); + switch(pCreature->GetEntry()) + { + case NPC_VERDISA: //Verdisa + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); + break; + } + break; + case NPC_BELGARISTRASZ: //Belgaristrasz + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); + break; + } + break; + case NPC_ETERNOS: //Eternos + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + if (!HAS_ESSENCE(pPlayer)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); + } + else + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF + 2: + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); + break; + } + break; + } + + return true; } - return true; -} - -bool GossipSelect_npc_oculus_drake(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(pCreature->GetEntry()) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case NPC_VERDISA: //Verdisa - switch(uiAction) + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->GetInstanceScript()->GetData(DATA_DRAKOS_EVENT) == DONE) { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_VERDISA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_EMERALD_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_EMERALD_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_DRAKES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DRAKES, pCreature->GetGUID()); } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_VERDISA3, pCreature->GetGUID()); - break; - } - break; - case NPC_BELGARISTRASZ: //Belgaristrasz - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BELGARISTRASZ2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_RUBY_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_RUBY_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_BELGARISTRASZ3, pCreature->GetGUID()); - break; - } - break; - case NPC_ETERNOS: //Eternos - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - if (!HAS_ESSENCE(pPlayer)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS1, pCreature->GetGUID()); - } - else - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ETERNOS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS2, pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF + 2: - { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_AMBER_ESSENCE, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, ITEM_AMBER_ESSENCE, true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_ETERNOS3, pCreature->GetGUID()); - break; - } - break; + + return true; } - return true; -} +}; + void AddSC_oculus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_oculus_drake"; - newscript->pGossipHello = &GossipHello_npc_oculus_drake; - newscript->pGossipSelect = &GossipSelect_npc_oculus_drake; - newscript->RegisterSelf(); + new npc_oculus_drake(); } diff --git a/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp index 971f60fe435..6dc24313584 100644 --- a/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ObsidianSanctum/boss_sartharion.cpp @@ -217,490 +217,497 @@ Locations TwilightEggsSarth[] = /*###### ## Boss Sartharion ######*/ - -struct boss_sartharionAI : public ScriptedAI + class boss_sartharion : public CreatureScript { - boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_sartharion() : CreatureScript("boss_sartharion") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_sartharionAI(pCreature); } - ScriptedInstance* pInstance; - - bool m_bIsBerserk; - bool m_bIsSoftEnraged; - - uint32 m_uiEnrageTimer; - bool m_bIsHardEnraged; - - uint32 m_uiTenebronTimer; - uint32 m_uiShadronTimer; - uint32 m_uiVesperonTimer; - - uint32 m_uiFlameTsunamiTimer; - uint32 m_uiFlameBreathTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiLavaStrikeTimer; - - bool m_bHasCalledTenebron; - bool m_bHasCalledShadron; - bool m_bHasCalledVesperon; - - uint32 achievProgress; - - void Reset() + struct boss_sartharionAI : public ScriptedAI { - m_bIsBerserk = false; - m_bIsSoftEnraged = false; - - m_uiEnrageTimer = 15*MINUTE*IN_MILLISECONDS; - m_bIsHardEnraged = false; - - m_uiTenebronTimer = 30000; - m_uiShadronTimer = 75000; - m_uiVesperonTimer = 120000; - - m_uiFlameTsunamiTimer = 30000; - m_uiFlameBreathTimer = 20000; - m_uiTailSweepTimer = 20000; - m_uiCleaveTimer = 7000; - m_uiLavaStrikeTimer = 5000; - - m_bHasCalledTenebron = false; - m_bHasCalledShadron = false; - m_bHasCalledVesperon = false; - - if (me->HasAura(SPELL_TWILIGHT_REVENGE)) - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); - - me->ResetLootMode(); - me->SetHomePosition(3246.57, 551.263, 58.6164, 4.66003); - - achievProgress = 0; - - // Drakes respawning system - if (pInstance) + boss_sartharionAI(Creature* pCreature) : ScriptedAI(pCreature) { - Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - if (pTenebron) - { - pTenebron->SetHomePosition(3239.07, 657.235, 86.8775, 4.74729); - if(pTenebron->isAlive()) - { - if (pTenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pTenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTenebron->GetMotionMaster()->MoveTargetedHome(); - }else - { - if(pInstance->GetData(TYPE_TENEBRON_PREKILLED) == false) - { - pTenebron->Respawn(); - pTenebron->GetMotionMaster()->MoveTargetedHome(); - pTenebron->AI()->SetData(DATA_CAN_LOOT,0); - } - } - } - if (pShadron) - { - pShadron->SetHomePosition(3363.06, 525.28, 98.362, 4.76475); - if(pShadron->isAlive()) - { - if (pShadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pShadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pShadron->GetMotionMaster()->MoveTargetedHome(); - }else - { - if(pInstance->GetData(TYPE_SHADRON_PREKILLED) == false) - { - pShadron->Respawn(); - pShadron->GetMotionMaster()->MoveTargetedHome(); - pShadron->AI()->SetData(DATA_CAN_LOOT,0); - } - } - } - if (pVesperon) - { - pVesperon->SetHomePosition(3145.68, 520.71, 89.7, 4.64258); - if(pVesperon->isAlive()) - { - if (pVesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pVesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pVesperon->GetMotionMaster()->MoveTargetedHome(); - }else - { - if(pInstance->GetData(TYPE_VESPERON_PREKILLED) == false) - { - pVesperon->Respawn(); - pVesperon->GetMotionMaster()->MoveTargetedHome(); - pVesperon->AI()->SetData(DATA_CAN_LOOT,0); - } - } - } - } - } - - void JustReachedHome() - { - if (pInstance) - pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_SARTHARION_AGGRO,me); - DoZoneInCombat(); - - if (pInstance) - { - pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); - FetchDragons(); - } - } - - void JustDied(Unit* pKiller) - { - DoScriptText(SAY_SARTHARION_DEATH,me); - - if (pInstance) - { - Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - if (pTenebron && pTenebron->isAlive()) - pTenebron->DisappearAndDie(); - if (pShadron && pShadron->isAlive()) - pShadron->DisappearAndDie(); - if (pVesperon && pVesperon->isAlive()) - pVesperon->DisappearAndDie(); - - if (achievProgress == 1) - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - else if (achievProgress == 2) - { - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); - } - else if (achievProgress == 3) - { - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ZONE,H_ACHIEV_TWILIGHT_ZONE)); - } - - pInstance->SetData(TYPE_SARTHARION_EVENT, DONE); - } - } - - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_SARTHARION_SLAY_1,SAY_SARTHARION_SLAY_2,SAY_SARTHARION_SLAY_3), me); - } - - // me->ResetLootMode() is called from Reset() - // AddDrakeLootMode() should only ever be called from FetchDragons(), which is called from Aggro() - void AddDrakeLootMode() - { - if (me->HasLootMode(LOOT_MODE_HARD_MODE_2)) // Has two Drake loot modes - me->AddLootMode(LOOT_MODE_HARD_MODE_3); // Add 3rd Drake loot mode - else if (me->HasLootMode(LOOT_MODE_HARD_MODE_1)) // Has one Drake loot mode - me->AddLootMode(LOOT_MODE_HARD_MODE_2); // Add 2nd Drake loot mode - else // Has no Drake loot modes - me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode - } - - void FetchDragons() - { - if(!pInstance) - return; - - me->ResetLootMode(); - achievProgress = 0; - - Creature* pFetchTene = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); - Creature* pFetchShad = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); - Creature* pFetchVesp = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); - - //if at least one of the dragons are alive and are being called - bool bCanUseWill = false; - - if (pFetchTene && pFetchTene->isAlive() && !pFetchTene->getVictim()) - { - bCanUseWill = true; - if(!pFetchTene->isInCombat()) - { - AddDrakeLootMode(); - achievProgress++; - } - pFetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); - - if (!pFetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pInstance = pCreature->GetInstanceScript(); } - if (pFetchShad && pFetchShad->isAlive() && !pFetchShad->getVictim()) + InstanceScript* pInstance; + + bool m_bIsBerserk; + bool m_bIsSoftEnraged; + + uint32 m_uiEnrageTimer; + bool m_bIsHardEnraged; + + uint32 m_uiTenebronTimer; + uint32 m_uiShadronTimer; + uint32 m_uiVesperonTimer; + + uint32 m_uiFlameTsunamiTimer; + uint32 m_uiFlameBreathTimer; + uint32 m_uiTailSweepTimer; + uint32 m_uiCleaveTimer; + uint32 m_uiLavaStrikeTimer; + + bool m_bHasCalledTenebron; + bool m_bHasCalledShadron; + bool m_bHasCalledVesperon; + + uint32 achievProgress; + + void Reset() { - bCanUseWill = true; - if(!pFetchShad->isInCombat()) - { - AddDrakeLootMode(); - achievProgress++; - } - pFetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); + m_bIsBerserk = false; + m_bIsSoftEnraged = false; - if (!pFetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + m_uiEnrageTimer = 15*MINUTE*IN_MILLISECONDS; + m_bIsHardEnraged = false; - if (pFetchVesp && pFetchVesp->isAlive() && !pFetchVesp->getVictim()) - { - bCanUseWill = true; - if(!pFetchVesp->isInCombat()) - { - AddDrakeLootMode(); - achievProgress++; - } - pFetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); - - if (!pFetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pFetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - if (bCanUseWill) - DoCast(me, SPELL_WILL_OF_SARTHARION); - } - - void CallDragon(uint32 uiDataId) - { - if (pInstance) - { - if (Creature *pTemp = Unit::GetCreature(*me,pInstance->GetData64(uiDataId))) - { - if (pTemp->isAlive() && !pTemp->getVictim()) - { - if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) - pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - - if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - int32 iTextId = 0; - - switch(pTemp->GetEntry()) - { - case NPC_TENEBRON: - iTextId = SAY_SARTHARION_CALL_TENEBRON; - pTemp->AddAura(SPELL_POWER_OF_TENEBRON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ); - break; - case NPC_SHADRON: - iTextId = SAY_SARTHARION_CALL_SHADRON; - pTemp->AddAura(SPELL_POWER_OF_SHADRON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ); - break; - case NPC_VESPERON: - iTextId = SAY_SARTHARION_CALL_VESPERON; - pTemp->AddAura(SPELL_POWER_OF_VESPERON, pTemp); - pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); - break; - } - - DoScriptText(iTextId, me); - } - } - } - } - - void SendFlameTsunami() - { - if (Map* pMap = me->GetMap()) - if (pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive()) - DoScriptText(WHISPER_LAVA_CHURN, me, i->getSource()); - } - } - - // Selects a random Fire Cyclone and makes it cast Lava Strike. - // FIXME: Frequency of the casts reduced to compensate 100% chance of spawning a Lava Blaze add - void CastLavaStrikeOnTarget(Unit* target) - { - std::list pFireCyclonesList; - Trinity::AllCreaturesOfEntryInRange checker(me, NPC_FIRE_CYCLONE, 200.0f); - Trinity::CreatureListSearcher searcher(me, pFireCyclonesList, checker); - me->VisitNearbyObject(200.0f, searcher); - - if(pFireCyclonesList.empty()) - return; - - std::list::iterator itr = pFireCyclonesList.begin(); - uint32 rnd = rand()%pFireCyclonesList.size(); - - for(uint32 i = 0; i < rnd; ++i) - ++itr; - - (*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - Unit* pTene = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_TENEBRON) : 0); - Unit* pShad = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SHADRON) : 0); - Unit* pVesp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_VESPERON) : 0); - - //spell will target dragons, if they are still alive at 35% - if (!m_bIsBerserk && (me->GetHealth()*100 / me->GetMaxHealth()) <= 35 - && ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive()))) - { - DoScriptText(SAY_SARTHARION_BERSERK, me); - DoCast(me, SPELL_BERSERK); - m_bIsBerserk = true; - } - - //soft enrage - if (!m_bIsSoftEnraged && HealthBelowPct(10)) - { - // m_bIsSoftEnraged is used while determining Lava Strike cooldown. - m_bIsSoftEnraged = true; - } - - // hard enrage - if (!m_bIsHardEnraged) - { - if (m_uiEnrageTimer <= uiDiff) - { - DoCast(me, SPELL_PYROBUFFET, true); - m_bIsHardEnraged = true; - } - else - m_uiEnrageTimer -= uiDiff; - } - - // flame tsunami - if (m_uiFlameTsunamiTimer <= uiDiff) - { - SendFlameTsunami(); - switch(urand(0,1)) - { - case 0: - { - Creature *Right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y , FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y , FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y , FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); - Right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); - Right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); - break; - } - case 1: - { - Creature *Left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y , FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Creature *Left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y , FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); - Left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); - Left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); - break; - } - } + m_uiTenebronTimer = 30000; + m_uiShadronTimer = 75000; + m_uiVesperonTimer = 120000; m_uiFlameTsunamiTimer = 30000; - } - else - m_uiFlameTsunamiTimer -= uiDiff; + m_uiFlameBreathTimer = 20000; + m_uiTailSweepTimer = 20000; + m_uiCleaveTimer = 7000; + m_uiLavaStrikeTimer = 5000; - // flame breath - if (m_uiFlameBreathTimer <= uiDiff) - { - DoScriptText(SAY_SARTHARION_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); - m_uiFlameBreathTimer = urand(25000,35000); - } - else - m_uiFlameBreathTimer -= uiDiff; + m_bHasCalledTenebron = false; + m_bHasCalledShadron = false; + m_bHasCalledVesperon = false; - // Tail Sweep - if (m_uiTailSweepTimer <= uiDiff) - { - DoCast(me->getVictim(), RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); - m_uiTailSweepTimer = urand(15000,20000); - } - else - m_uiTailSweepTimer -= uiDiff; + if (me->HasAura(SPELL_TWILIGHT_REVENGE)) + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_REVENGE); - // Cleave - if (m_uiCleaveTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - m_uiCleaveTimer = urand(7000,10000); - } - else - m_uiCleaveTimer -= uiDiff; + me->ResetLootMode(); + me->SetHomePosition(3246.57, 551.263, 58.6164, 4.66003); - // Lavas Strike - if (m_uiLavaStrikeTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + achievProgress = 0; + + // Drakes respawning system + if (pInstance) { - CastLavaStrikeOnTarget(pTarget); - - if(urand(0,5) == 0) - DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), me); + Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + if (pTenebron) + { + pTenebron->SetHomePosition(3239.07, 657.235, 86.8775, 4.74729); + if(pTenebron->isAlive()) + { + if (pTenebron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pTenebron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTenebron->GetMotionMaster()->MoveTargetedHome(); + }else + { + if(pInstance->GetData(TYPE_TENEBRON_PREKILLED) == false) + { + pTenebron->Respawn(); + pTenebron->GetMotionMaster()->MoveTargetedHome(); + pTenebron->AI()->SetData(DATA_CAN_LOOT,0); + } + } + } + if (pShadron) + { + pShadron->SetHomePosition(3363.06, 525.28, 98.362, 4.76475); + if(pShadron->isAlive()) + { + if (pShadron->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pShadron->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pShadron->GetMotionMaster()->MoveTargetedHome(); + }else + { + if(pInstance->GetData(TYPE_SHADRON_PREKILLED) == false) + { + pShadron->Respawn(); + pShadron->GetMotionMaster()->MoveTargetedHome(); + pShadron->AI()->SetData(DATA_CAN_LOOT,0); + } + } + } + if (pVesperon) + { + pVesperon->SetHomePosition(3145.68, 520.71, 89.7, 4.64258); + if(pVesperon->isAlive()) + { + if (pVesperon->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pVesperon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pVesperon->GetMotionMaster()->MoveTargetedHome(); + }else + { + if(pInstance->GetData(TYPE_VESPERON_PREKILLED) == false) + { + pVesperon->Respawn(); + pVesperon->GetMotionMaster()->MoveTargetedHome(); + pVesperon->AI()->SetData(DATA_CAN_LOOT,0); + } + } + } } - m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000,20000)); } - else - m_uiLavaStrikeTimer -= uiDiff; - // call tenebron - if (!m_bHasCalledTenebron && m_uiTenebronTimer <= uiDiff) + void JustReachedHome() { - CallDragon(DATA_TENEBRON); - m_bHasCalledTenebron = true; + if (pInstance) + pInstance->SetData(TYPE_SARTHARION_EVENT, NOT_STARTED); } - else - m_uiTenebronTimer -= uiDiff; - // call shadron - if (!m_bHasCalledShadron && m_uiShadronTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - CallDragon(DATA_SHADRON); - m_bHasCalledShadron = true; - } - else - m_uiShadronTimer -= uiDiff; + DoScriptText(SAY_SARTHARION_AGGRO,me); + DoZoneInCombat(); - // call vesperon - if (!m_bHasCalledVesperon && m_uiVesperonTimer <= uiDiff) + if (pInstance) + { + pInstance->SetData(TYPE_SARTHARION_EVENT, IN_PROGRESS); + FetchDragons(); + } + } + + void JustDied(Unit* pKiller) { - CallDragon(DATA_VESPERON); - m_bHasCalledVesperon = true; + DoScriptText(SAY_SARTHARION_DEATH,me); + + if (pInstance) + { + Creature* pTenebron = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pShadron = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pVesperon = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + if (pTenebron && pTenebron->isAlive()) + pTenebron->DisappearAndDie(); + if (pShadron && pShadron->isAlive()) + pShadron->DisappearAndDie(); + if (pVesperon && pVesperon->isAlive()) + pVesperon->DisappearAndDie(); + + if (achievProgress == 1) + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + else if (achievProgress == 2) + { + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); + } + else if (achievProgress == 3) + { + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ASSIST,H_ACHIEV_TWILIGHT_ASSIST)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_DUO,H_ACHIEV_TWILIGHT_DUO)); + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_TWILIGHT_ZONE,H_ACHIEV_TWILIGHT_ZONE)); + } + + pInstance->SetData(TYPE_SARTHARION_EVENT, DONE); + } } - else - m_uiVesperonTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + void KilledUnit(Unit* pVictim) + { + DoScriptText(RAND(SAY_SARTHARION_SLAY_1,SAY_SARTHARION_SLAY_2,SAY_SARTHARION_SLAY_3), me); + } - DoMeleeAttackIfReady(); + // me->ResetLootMode() is called from Reset() + // AddDrakeLootMode() should only ever be called from FetchDragons(), which is called from Aggro() + void AddDrakeLootMode() + { + if (me->HasLootMode(LOOT_MODE_HARD_MODE_2)) // Has two Drake loot modes + me->AddLootMode(LOOT_MODE_HARD_MODE_3); // Add 3rd Drake loot mode + else if (me->HasLootMode(LOOT_MODE_HARD_MODE_1)) // Has one Drake loot mode + me->AddLootMode(LOOT_MODE_HARD_MODE_2); // Add 2nd Drake loot mode + else // Has no Drake loot modes + me->AddLootMode(LOOT_MODE_HARD_MODE_1); // Add 1st Drake loot mode + } + + void FetchDragons() + { + if(!pInstance) + return; + + me->ResetLootMode(); + achievProgress = 0; + + Creature* pFetchTene = Unit::GetCreature(*me, pInstance->GetData64(DATA_TENEBRON)); + Creature* pFetchShad = Unit::GetCreature(*me, pInstance->GetData64(DATA_SHADRON)); + Creature* pFetchVesp = Unit::GetCreature(*me, pInstance->GetData64(DATA_VESPERON)); + + //if at least one of the dragons are alive and are being called + bool bCanUseWill = false; + + if (pFetchTene && pFetchTene->isAlive() && !pFetchTene->getVictim()) + { + bCanUseWill = true; + if(!pFetchTene->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchTene->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aTene[0].m_fX, m_aTene[0].m_fY, m_aTene[0].m_fZ); + + if (!pFetchTene->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchTene->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + if (pFetchShad && pFetchShad->isAlive() && !pFetchShad->getVictim()) + { + bCanUseWill = true; + if(!pFetchShad->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchShad->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aShad[0].m_fX, m_aShad[0].m_fY, m_aShad[0].m_fZ); + + if (!pFetchShad->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchShad->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + if (pFetchVesp && pFetchVesp->isAlive() && !pFetchVesp->getVictim()) + { + bCanUseWill = true; + if(!pFetchVesp->isInCombat()) + { + AddDrakeLootMode(); + achievProgress++; + } + pFetchVesp->GetMotionMaster()->MovePoint(POINT_ID_INIT, m_aVesp[0].m_fX, m_aVesp[0].m_fY, m_aVesp[0].m_fZ); + + if (!pFetchVesp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pFetchVesp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + if (bCanUseWill) + DoCast(me, SPELL_WILL_OF_SARTHARION); + } + + void CallDragon(uint32 uiDataId) + { + if (pInstance) + { + if (Creature *pTemp = Unit::GetCreature(*me,pInstance->GetData64(uiDataId))) + { + if (pTemp->isAlive() && !pTemp->getVictim()) + { + if (pTemp->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) + pTemp->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + + if (pTemp->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + int32 iTextId = 0; + + switch(pTemp->GetEntry()) + { + case NPC_TENEBRON: + iTextId = SAY_SARTHARION_CALL_TENEBRON; + pTemp->AddAura(SPELL_POWER_OF_TENEBRON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ); + break; + case NPC_SHADRON: + iTextId = SAY_SARTHARION_CALL_SHADRON; + pTemp->AddAura(SPELL_POWER_OF_SHADRON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ); + break; + case NPC_VESPERON: + iTextId = SAY_SARTHARION_CALL_VESPERON; + pTemp->AddAura(SPELL_POWER_OF_VESPERON, pTemp); + pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ); + break; + } + + DoScriptText(iTextId, me); + } + } + } + } + + void SendFlameTsunami() + { + if (Map* pMap = me->GetMap()) + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource() && i->getSource()->isAlive()) + DoScriptText(WHISPER_LAVA_CHURN, me, i->getSource()); + } + } + + // Selects a random Fire Cyclone and makes it cast Lava Strike. + // FIXME: Frequency of the casts reduced to compensate 100% chance of spawning a Lava Blaze add + void CastLavaStrikeOnTarget(Unit* target) + { + std::list pFireCyclonesList; + Trinity::AllCreaturesOfEntryInRange checker(me, NPC_FIRE_CYCLONE, 200.0f); + Trinity::CreatureListSearcher searcher(me, pFireCyclonesList, checker); + me->VisitNearbyObject(200.0f, searcher); + + if(pFireCyclonesList.empty()) + return; + + std::list::iterator itr = pFireCyclonesList.begin(); + uint32 rnd = rand()%pFireCyclonesList.size(); + + for(uint32 i = 0; i < rnd; ++i) + ++itr; + + (*itr)->CastSpell(target, SPELL_LAVA_STRIKE, true); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + Unit* pTene = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_TENEBRON) : 0); + Unit* pShad = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SHADRON) : 0); + Unit* pVesp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_VESPERON) : 0); + + //spell will target dragons, if they are still alive at 35% + if (!m_bIsBerserk && (me->GetHealth()*100 / me->GetMaxHealth()) <= 35 + && ((pTene && pTene->isAlive()) || (pShad && pShad->isAlive()) || (pVesp && pVesp->isAlive()))) + { + DoScriptText(SAY_SARTHARION_BERSERK, me); + DoCast(me, SPELL_BERSERK); + m_bIsBerserk = true; + } + + //soft enrage + if (!m_bIsSoftEnraged && HealthBelowPct(10)) + { + // m_bIsSoftEnraged is used while determining Lava Strike cooldown. + m_bIsSoftEnraged = true; + } + + // hard enrage + if (!m_bIsHardEnraged) + { + if (m_uiEnrageTimer <= uiDiff) + { + DoCast(me, SPELL_PYROBUFFET, true); + m_bIsHardEnraged = true; + } + else + m_uiEnrageTimer -= uiDiff; + } + + // flame tsunami + if (m_uiFlameTsunamiTimer <= uiDiff) + { + SendFlameTsunami(); + switch(urand(0,1)) + { + case 0: + { + Creature *Right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn.x, FlameRight1Spawn.y , FlameRight1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn.x, FlameRight2Spawn.y , FlameRight2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn.x, FlameRight3Spawn.y , FlameRight3Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction.x, FlameRight1Direction.y, FlameRight1Direction.z); + Right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction.x, FlameRight2Direction.y, FlameRight2Direction.z); + Right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction.x, FlameRight3Direction.y, FlameRight3Direction.z); + break; + } + case 1: + { + Creature *Left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn.x, FlameLeft1Spawn.y , FlameLeft1Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Creature *Left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn.x, FlameLeft2Spawn.y , FlameLeft2Spawn.z, 0, TEMPSUMMON_TIMED_DESPAWN,12000); + Left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction.x, FlameLeft1Direction.y, FlameLeft1Direction.z); + Left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction.x, FlameLeft2Direction.y, FlameLeft2Direction.z); + break; + } + } + + m_uiFlameTsunamiTimer = 30000; + } + else + m_uiFlameTsunamiTimer -= uiDiff; + + // flame breath + if (m_uiFlameBreathTimer <= uiDiff) + { + DoScriptText(SAY_SARTHARION_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H)); + m_uiFlameBreathTimer = urand(25000,35000); + } + else + m_uiFlameBreathTimer -= uiDiff; + + // Tail Sweep + if (m_uiTailSweepTimer <= uiDiff) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H)); + m_uiTailSweepTimer = urand(15000,20000); + } + else + m_uiTailSweepTimer -= uiDiff; + + // Cleave + if (m_uiCleaveTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + m_uiCleaveTimer = urand(7000,10000); + } + else + m_uiCleaveTimer -= uiDiff; + + // Lavas Strike + if (m_uiLavaStrikeTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + CastLavaStrikeOnTarget(pTarget); + + if(urand(0,5) == 0) + DoScriptText(RAND(SAY_SARTHARION_SPECIAL_1,SAY_SARTHARION_SPECIAL_2,SAY_SARTHARION_SPECIAL_3), me); + } + m_uiLavaStrikeTimer = (m_bIsSoftEnraged ? urand(1400, 2000) : urand(5000,20000)); + } + else + m_uiLavaStrikeTimer -= uiDiff; + + // call tenebron + if (!m_bHasCalledTenebron && m_uiTenebronTimer <= uiDiff) + { + CallDragon(DATA_TENEBRON); + m_bHasCalledTenebron = true; + } + else + m_uiTenebronTimer -= uiDiff; + + // call shadron + if (!m_bHasCalledShadron && m_uiShadronTimer <= uiDiff) + { + CallDragon(DATA_SHADRON); + m_bHasCalledShadron = true; + } + else + m_uiShadronTimer -= uiDiff; + + // call vesperon + if (!m_bHasCalledVesperon && m_uiVesperonTimer <= uiDiff) + { + CallDragon(DATA_VESPERON); + m_bHasCalledVesperon = true; + } + else + m_uiVesperonTimer -= uiDiff; + + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(uiDiff); + } + }; - EnterEvadeIfOutOfCombatArea(uiDiff); - } }; -CreatureAI* GetAI_boss_sartharion(Creature* pCreature) -{ - return new boss_sartharionAI(pCreature); -} enum TeneText { @@ -743,10 +750,10 @@ struct dummy_dragonAI : public ScriptedAI { dummy_dragonAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 m_uiWaypointId; uint32 m_uiMoveNextTimer; @@ -994,720 +1001,742 @@ struct dummy_dragonAI : public ScriptedAI /*###### ## Mob Tenebron ######*/ - -struct mob_tenebronAI : public dummy_dragonAI + class mob_tenebron : public CreatureScript { - mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} +public: + mob_tenebron() : CreatureScript("mob_tenebron") { } - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiHatchEggTimer; - - bool m_bHasPortalOpen; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiHatchEggTimer = 30000; - - m_bHasPortalOpen = false; + return new mob_tenebronAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_tenebronAI : public dummy_dragonAI { - DoScriptText(SAY_TENEBRON_AGGRO, me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_TENEBRON); - } + mob_tenebronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_TENEBRON_SLAY_1,SAY_TENEBRON_SLAY_2), me); - } + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiHatchEggTimer; - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) + bool m_bHasPortalOpen; + + void Reset() { - dummy_dragonAI::UpdateAI(uiDiff); - return; - } - - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); - - m_uiShadowFissureTimer = urand(15000,20000); - } - else - m_uiShadowFissureTimer -= uiDiff; - - // Hatch Egg - if (m_uiHatchEggTimer <= uiDiff) - { - OpenPortal(); + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; m_uiHatchEggTimer = 30000; - } - else - m_uiHatchEggTimer -= uiDiff; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) + m_bHasPortalOpen = false; + } + + void EnterCombat(Unit* pWho) { - DoScriptText(SAY_TENEBRON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); + DoScriptText(SAY_TENEBRON_AGGRO, me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_TENEBRON); } - else - m_uiShadowBreathTimer -= uiDiff; - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + void KilledUnit(Unit* pVictim) + { + DoScriptText(RAND(SAY_TENEBRON_SLAY_1,SAY_TENEBRON_SLAY_2), me); + } + + void UpdateAI(const uint32 uiDiff) + { + //if no target, update dummy and return + if (!UpdateVictim()) + { + dummy_dragonAI::UpdateAI(uiDiff); + return; + } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE)); + + m_uiShadowFissureTimer = urand(15000,20000); + } + else + m_uiShadowFissureTimer -= uiDiff; + + // Hatch Egg + if (m_uiHatchEggTimer <= uiDiff) + { + OpenPortal(); + m_uiHatchEggTimer = 30000; + } + else + m_uiHatchEggTimer -= uiDiff; + + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_TENEBRON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; + + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_tenebron(Creature* pCreature) -{ - return new mob_tenebronAI(pCreature); -} /*###### ## Mob Shadron ######*/ - -struct mob_shadronAI : public dummy_dragonAI + class mob_shadron : public CreatureScript { - mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} +public: + mob_shadron() : CreatureScript("mob_shadron") { } - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteShadronTimer; - - bool m_bHasPortalOpen; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteShadronTimer = 60000; - - if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); - - m_bHasPortalOpen = false; + return new mob_shadronAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_shadronAI : public dummy_dragonAI { - DoScriptText(SAY_SHADRON_AGGRO,me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_SHADRON); - } + mob_shadronAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_SHADRON_SLAY_1,SAY_SHADRON_SLAY_2), me); - } + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiAcolyteShadronTimer; - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) + bool m_bHasPortalOpen; + + void Reset() { - dummy_dragonAI::UpdateAI(uiDiff); - return; + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; + m_uiAcolyteShadronTimer = 60000; + + if (me->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + me->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + + m_bHasPortalOpen = false; } - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); - - m_uiShadowFissureTimer = urand(15000,20000); + DoScriptText(SAY_SHADRON_AGGRO,me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_SHADRON); } - else - m_uiShadowFissureTimer -= uiDiff; - // Portal Event - if (m_uiAcolyteShadronTimer <= uiDiff) + void KilledUnit(Unit* pVictim) { - if(m_bHasPortalOpen) - m_uiAcolyteShadronTimer = 10000; - else + DoScriptText(RAND(SAY_SHADRON_SLAY_1,SAY_SHADRON_SLAY_2), me); + } + + void UpdateAI(const uint32 uiDiff) + { + //if no target, update dummy and return + if (!UpdateVictim()) { - if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - return; - - OpenPortal(); - m_bHasPortalOpen = true; - m_uiAcolyteShadronTimer = urand(60000,65000); + dummy_dragonAI::UpdateAI(uiDiff); + return; } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + + m_uiShadowFissureTimer = urand(15000,20000); + } + else + m_uiShadowFissureTimer -= uiDiff; + + // Portal Event + if (m_uiAcolyteShadronTimer <= uiDiff) + { + if(m_bHasPortalOpen) + m_uiAcolyteShadronTimer = 10000; + else + { + if (me->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + return; + + OpenPortal(); + m_bHasPortalOpen = true; + m_uiAcolyteShadronTimer = urand(60000,65000); + } + } + else + m_uiAcolyteShadronTimer -= uiDiff; + + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_SHADRON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; + + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); } - else - m_uiAcolyteShadronTimer -= uiDiff; + }; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - DoScriptText(SAY_SHADRON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); - } - else - m_uiShadowBreathTimer -= uiDiff; - - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_shadron(Creature* pCreature) -{ - return new mob_shadronAI(pCreature); -} /*###### ## Mob Vesperon ######*/ - -struct mob_vesperonAI : public dummy_dragonAI + class mob_vesperon : public CreatureScript { - mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} +public: + mob_vesperon() : CreatureScript("mob_vesperon") { } - uint32 m_uiShadowBreathTimer; - uint32 m_uiShadowFissureTimer; - uint32 m_uiAcolyteVesperonTimer; - - bool m_bHasPortalOpen; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiShadowBreathTimer = 20000; - m_uiShadowFissureTimer = 5000; - m_uiAcolyteVesperonTimer = 60000; - - m_bHasPortalOpen = false; + return new mob_vesperonAI(pCreature); } - void EnterCombat(Unit* pWho) + struct mob_vesperonAI : public dummy_dragonAI { - DoScriptText(SAY_VESPERON_AGGRO,me); - DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_VESPERON); - } + mob_vesperonAI(Creature* pCreature) : dummy_dragonAI(pCreature) {} - void KilledUnit(Unit* pVictim) - { - DoScriptText(RAND(SAY_VESPERON_SLAY_1,SAY_VESPERON_SLAY_2), me); - } + uint32 m_uiShadowBreathTimer; + uint32 m_uiShadowFissureTimer; + uint32 m_uiAcolyteVesperonTimer; - void UpdateAI(const uint32 uiDiff) - { - //if no target, update dummy and return - if (!UpdateVictim()) + bool m_bHasPortalOpen; + + void Reset() { - dummy_dragonAI::UpdateAI(uiDiff); - return; + m_uiShadowBreathTimer = 20000; + m_uiShadowFissureTimer = 5000; + m_uiAcolyteVesperonTimer = 60000; + + m_bHasPortalOpen = false; } - // shadow fissure - if (m_uiShadowFissureTimer <= uiDiff) + void EnterCombat(Unit* pWho) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); - - m_uiShadowFissureTimer = urand(15000,20000); + DoScriptText(SAY_VESPERON_AGGRO,me); + DoZoneInCombat(); + DoCast(me, SPELL_POWER_OF_VESPERON); } - else - m_uiShadowFissureTimer -= uiDiff; - // Portal Event - if (m_uiAcolyteVesperonTimer <= uiDiff) + void KilledUnit(Unit* pVictim) { - if(m_bHasPortalOpen) - m_uiAcolyteVesperonTimer = 10000; - else + DoScriptText(RAND(SAY_VESPERON_SLAY_1,SAY_VESPERON_SLAY_2), me); + } + + void UpdateAI(const uint32 uiDiff) + { + //if no target, update dummy and return + if (!UpdateVictim()) { - OpenPortal(); - DoCast(me->getVictim(), SPELL_TWILIGHT_TORMENT_VESP); - m_uiAcolyteVesperonTimer = urand(60000,70000); + dummy_dragonAI::UpdateAI(uiDiff); + return; } + + // shadow fissure + if (m_uiShadowFissureTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, RAID_MODE(SPELL_SHADOW_FISSURE, SPELL_SHADOW_FISSURE_H)); + + m_uiShadowFissureTimer = urand(15000,20000); + } + else + m_uiShadowFissureTimer -= uiDiff; + + // Portal Event + if (m_uiAcolyteVesperonTimer <= uiDiff) + { + if(m_bHasPortalOpen) + m_uiAcolyteVesperonTimer = 10000; + else + { + OpenPortal(); + DoCast(me->getVictim(), SPELL_TWILIGHT_TORMENT_VESP); + m_uiAcolyteVesperonTimer = urand(60000,70000); + } + } + else + m_uiAcolyteVesperonTimer -= uiDiff; + + // shadow breath + if (m_uiShadowBreathTimer <= uiDiff) + { + DoScriptText(SAY_VESPERON_BREATH, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); + m_uiShadowBreathTimer = urand(20000,25000); + } + else + m_uiShadowBreathTimer -= uiDiff; + + // Don't attack current target if he's not visible for us. + if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) + me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); + + DoMeleeAttackIfReady(); } - else - m_uiAcolyteVesperonTimer -= uiDiff; + }; - // shadow breath - if (m_uiShadowBreathTimer <= uiDiff) - { - DoScriptText(SAY_VESPERON_BREATH, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BREATH, SPELL_SHADOW_BREATH_H)); - m_uiShadowBreathTimer = urand(20000,25000); - } - else - m_uiShadowBreathTimer -= uiDiff; - - // Don't attack current target if he's not visible for us. - if(me->getVictim() && me->getVictim()->HasAura(57874, 0)) - me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_vesperon(Creature* pCreature) -{ - return new mob_vesperonAI(pCreature); -} /*###### ## Mob Acolyte of Shadron ######*/ - -struct mob_acolyte_of_shadronAI : public ScriptedAI + class mob_acolyte_of_shadron : public CreatureScript { - mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_acolyte_of_shadron() : CreatureScript("mob_acolyte_of_shadron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); - Reset(); + return new mob_acolyte_of_shadronAI(pCreature); } - ScriptedInstance* pInstance; - uint32 uiDespawnTimer; - - void Reset() + struct mob_acolyte_of_shadronAI : public ScriptedAI { - uiDespawnTimer = 28000; - if (pInstance) + mob_acolyte_of_shadronAI(Creature* pCreature) : ScriptedAI(pCreature) { - Creature* pTarget = NULL; - //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT - if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - { - if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SARTHARION)))) - pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, pTarget); - } - else - { - if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SHADRON)))) - pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, pTarget); - } - } - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); - } - - void JustDied(Unit* killer) - { - if (pInstance) - { - Creature* Shadron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); - if(Shadron) - { - (CAST_AI(mob_shadronAI,Shadron->AI()))->m_bHasPortalOpen = false; - } - - Creature* pDebuffTarget = NULL; - Map *map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) - { - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } - } - } - - //not solo fight, so main boss has deduff - pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SARTHARION)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); - - //event not in progress, then solo fight and must remove debuff mini-boss - pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); - if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) - pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + pInstance = pCreature->GetInstanceScript(); + Reset(); } - } - void UpdateAI(const uint32 uiDiff) - { - if(uiDespawnTimer < uiDiff) + InstanceScript* pInstance; + uint32 uiDespawnTimer; + + void Reset() { - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; + if (pInstance) + { + Creature* pTarget = NULL; + //if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT + if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) + { + if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SARTHARION)))) + pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SAR, pTarget); + } + else + { + if(pTarget = (Unit::GetCreature((*me), pInstance->GetData64(DATA_SHADRON)))) + pTarget->AddAura(SPELL_GIFT_OF_TWILIGTH_SHA, pTarget); + } + } + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } - if (!UpdateVictim()) - return; + void JustDied(Unit* killer) + { + if (pInstance) + { + Creature* Shadron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); + if(Shadron) + { + (CAST_AI(mob_shadron::mob_shadronAI,Shadron->AI()))->m_bHasPortalOpen = false; + } + + Creature* pDebuffTarget = NULL; + Map *map = me->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + { + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + } + } + + //not solo fight, so main boss has deduff + pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SARTHARION)); + if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR)) + pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR); + + //event not in progress, then solo fight and must remove debuff mini-boss + pDebuffTarget = pInstance->instance->GetCreature(pInstance->GetData64(DATA_SHADRON)); + if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA)) + pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if(uiDespawnTimer < uiDiff) + { + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + uiDespawnTimer = 28000; + return; + }else uiDespawnTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_acolyte_of_shadron(Creature* pCreature) -{ - return new mob_acolyte_of_shadronAI(pCreature); -} /*###### ## Mob Acolyte of Vesperon ######*/ - -struct mob_acolyte_of_vesperonAI : public ScriptedAI + class mob_acolyte_of_vesperon : public CreatureScript { - mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_acolyte_of_vesperon() : CreatureScript("mob_acolyte_of_vesperon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_acolyte_of_vesperonAI(pCreature); } - ScriptedInstance* pInstance; - uint32 uiDespawnTimer; - - void Reset() + struct mob_acolyte_of_vesperonAI : public ScriptedAI { - uiDespawnTimer = 28000; - if (pInstance) + mob_acolyte_of_vesperonAI(Creature* pCreature) : ScriptedAI(pCreature) { - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + pInstance = pCreature->GetInstanceScript(); } - DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); - } - void JustDied(Unit* pKiller) - { - me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); + InstanceScript* pInstance; + uint32 uiDespawnTimer; - // remove twilight torment on Vesperon - if (pInstance) + void Reset() { - Creature* pVesperon = pInstance->instance->GetCreature(pInstance->GetData64(DATA_VESPERON)); - if (pVesperon) - (CAST_AI(mob_vesperonAI,pVesperon->AI()))->m_bHasPortalOpen = false; - - if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) - pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - - Map *map = me->GetMap(); - if (map->IsDungeon()) - { - Map::PlayerList const &PlayerList = map->GetPlayers(); - - if (PlayerList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) - { - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); - i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); - } - if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP,0) && !i->getSource()->getVictim()) - i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - } - } - - pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); - pInstance->DoRemoveAurasDueToSpellOnPlayers(57935); - pInstance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment - } - } - - void UpdateAI(const uint32 uiDiff) - { - if(uiDespawnTimer < uiDiff) - { - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); uiDespawnTimer = 28000; - return; - }else uiDespawnTimer -= uiDiff; + if (pInstance) + { + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } + DoCast(me, SPELL_TWILIGHT_TORMENT_VESP_ACO); + } - if (!UpdateVictim()) - return; + void JustDied(Unit* pKiller) + { + me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO); + + // remove twilight torment on Vesperon + if (pInstance) + { + Creature* pVesperon = pInstance->instance->GetCreature(pInstance->GetData64(DATA_VESPERON)); + if (pVesperon) + (CAST_AI(mob_vesperon::mob_vesperonAI,pVesperon->AI()))->m_bHasPortalOpen = false; + + if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) + pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + + Map *map = me->GetMap(); + if (map->IsDungeon()) + { + Map::PlayerList const &PlayerList = map->GetPlayers(); + + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_SHIFT,0) && !i->getSource()->getVictim()) + { + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_SHIFT_REMOVAL_ALL,true); + i->getSource()->CastSpell(i->getSource(),SPELL_TWILIGHT_RESIDUE,true); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT); + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER); + } + if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP,0) && !i->getSource()->getVictim()) + i->getSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); + } + } + + pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO); + pInstance->DoRemoveAurasDueToSpellOnPlayers(57935); + pInstance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment + } + } + + void UpdateAI(const uint32 uiDiff) + { + if(uiDespawnTimer < uiDiff) + { + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + uiDespawnTimer = 28000; + return; + }else uiDespawnTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_acolyte_of_vesperon(Creature* pCreature) -{ - return new mob_acolyte_of_vesperonAI(pCreature); -} /*###### ## Mob Twilight Eggs ######*/ - -struct mob_twilight_eggsAI : public Scripted_NoMovementAI + class mob_twilight_eggs : public CreatureScript { - mob_twilight_eggsAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); +public: + mob_twilight_eggs() : CreatureScript("mob_twilight_eggs") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_twilight_eggsAI(pCreature); } - uint32 m_uiFadeArmorTimer; - uint32 m_uiHatchEggTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct mob_twilight_eggsAI : public Scripted_NoMovementAI { - if(pInstance) - { - me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + mob_twilight_eggsAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); } - m_uiFadeArmorTimer = 1000; - m_uiHatchEggTimer = 20000; - } - - void SpawnWhelps() - { - me->RemoveAllAuras(); - if (!pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) - me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - else - me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); - me->DealDamage(me, me->GetHealth()); - } - - void JustSummoned(Creature* pWho) - { - pWho->SetInCombatWithZone(); - } - - void UpdateAI(const uint32 uiDiff) - { - if (m_uiHatchEggTimer <= uiDiff) + uint32 m_uiFadeArmorTimer; + uint32 m_uiHatchEggTimer; + + InstanceScript* pInstance; + + void Reset() { - Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON)); - if(Tenebron) - (CAST_AI(mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false; - SpawnWhelps(); + if(pInstance) + { + me->AddAura(SPELL_TWILIGHT_SHIFT_ENTER,me); + } + m_uiFadeArmorTimer = 1000; + m_uiHatchEggTimer = 20000; + } + + void SpawnWhelps() + { + me->RemoveAllAuras(); + + if (!pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) + me->SummonCreature(NPC_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + else + me->SummonCreature(NPC_SHARTHARION_TWILIGHT_WHELP, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + me->DealDamage(me, me->GetHealth()); + } + + void JustSummoned(Creature* pWho) + { + pWho->SetInCombatWithZone(); + } + + void UpdateAI(const uint32 uiDiff) + { + if (m_uiHatchEggTimer <= uiDiff) + { + Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON)); + if(Tenebron) + (CAST_AI(mob_tenebron::mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false; + SpawnWhelps(); + } + else + m_uiHatchEggTimer -= uiDiff; } - else - m_uiHatchEggTimer -= uiDiff; - } - void AttackStart(Unit* pWho) {} - void MoveInLineOfSight(Unit* pWho) {} + void AttackStart(Unit* pWho) {} + void MoveInLineOfSight(Unit* pWho) {} + }; + }; -CreatureAI* GetAI_mob_twilight_eggs(Creature* pCreature) -{ - return new mob_twilight_eggsAI(pCreature); -} /*###### ## Mob Flame Tsunami -######*/ -struct npc_flame_tsunamiAI : public ScriptedAI +######*/ class npc_flame_tsunami : public CreatureScript { - npc_flame_tsunamiAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_flame_tsunami() : CreatureScript("npc_flame_tsunami") { } + + CreatureAI* GetAI(Creature* pCreature) const { - me->SetDisplayId(11686); - me->AddAura(SPELL_FLAME_TSUNAMI, me); + return new npc_flame_tsunamiAI(pCreature); } - uint32 Tsunami_Timer; - uint32 TsunamiBuff_timer; - uint32 entry; + struct npc_flame_tsunamiAI : public ScriptedAI + { + npc_flame_tsunamiAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->SetDisplayId(11686); + me->AddAura(SPELL_FLAME_TSUNAMI, me); + } - void Reset() - { - Tsunami_Timer = 100; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - TsunamiBuff_timer = 1000; - entry = 0; - } - - void UpdateAI(const uint32 diff) - { - if (Tsunami_Timer <= diff) + uint32 Tsunami_Timer; + uint32 TsunamiBuff_timer; + uint32 entry; + + void Reset() { - DoCast(me,SPELL_FLAME_TSUNAMI_DMG_AURA); - Tsunami_Timer = 500; - }else Tsunami_Timer -= diff; - - if(TsunamiBuff_timer <= diff) - { - if (Unit* LavaBlaze = GetClosestCreatureWithEntry(me,NPC_LAVA_BLAZE, 10.0f, true)) - LavaBlaze->CastSpell(LavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); + Tsunami_Timer = 100; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); TsunamiBuff_timer = 1000; - }else TsunamiBuff_timer -= diff; - } -}; - -// Twilight Fissure -struct npc_twilight_fissureAI : public Scripted_NoMovementAI -{ - npc_twilight_fissureAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) - { - Reset(); - } - - uint32 VoidBlast_Timer; - - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura( 46265 , me ); // Wrong, can't find proper visual - me->AddAura( 69422 , me ); - VoidBlast_Timer = 5000; - } - - void UpdateAI(const uint32 diff) - { - if (VoidBlast_Timer <= diff) + entry = 0; + } + + void UpdateAI(const uint32 diff) { - DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); - ////twilight realm - //DoCast(me->getVictim(), 57620, true); - //DoCast(me->getVictim(), 57874, true); - VoidBlast_Timer = 9000; - me->RemoveAllAuras(); - me->Kill(me); - } else VoidBlast_Timer -= diff; + if (Tsunami_Timer <= diff) + { + DoCast(me,SPELL_FLAME_TSUNAMI_DMG_AURA); + Tsunami_Timer = 500; + }else Tsunami_Timer -= diff; + + if(TsunamiBuff_timer <= diff) + { + if (Unit* LavaBlaze = GetClosestCreatureWithEntry(me,NPC_LAVA_BLAZE, 10.0f, true)) + LavaBlaze->CastSpell(LavaBlaze, SPELL_FLAME_TSUNAMI_BUFF, true); + TsunamiBuff_timer = 1000; + }else TsunamiBuff_timer -= diff; + } + }; + +}; + +// Twilight Fissure class npc_twilight_fissure : public CreatureScript +{ +public: + npc_twilight_fissure() : CreatureScript("npc_twilight_fissure") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_twilight_fissureAI(pCreature); } + + struct npc_twilight_fissureAI : public Scripted_NoMovementAI + { + npc_twilight_fissureAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) + { + Reset(); + } + + uint32 VoidBlast_Timer; + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura( 46265 , me ); // Wrong, can't find proper visual + me->AddAura( 69422 , me ); + VoidBlast_Timer = 5000; + } + + void UpdateAI(const uint32 diff) + { + if (VoidBlast_Timer <= diff) + { + DoCastAOE(RAID_MODE(SPELL_VOID_BLAST, SPELL_VOID_BLAST_H)); + ////twilight realm + //DoCast(me->getVictim(), 57620, true); + //DoCast(me->getVictim(), 57874, true); + VoidBlast_Timer = 9000; + me->RemoveAllAuras(); + me->Kill(me); + } else VoidBlast_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_npc_flame_tsunami(Creature* pCreature) -{ - return new npc_flame_tsunamiAI(pCreature); -} -CreatureAI* GetAI_npc_twilight_fissure(Creature* pCreature) -{ - return new npc_twilight_fissureAI(pCreature); -} /*###### ## Mob Twilight Whelps ######*/ - -struct mob_twilight_whelpAI : public ScriptedAI + class mob_twilight_whelp : public CreatureScript { - mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_twilight_whelp() : CreatureScript("mob_twilight_whelp") { } + + CreatureAI* GetAI(Creature* pCreature) const { - Reset(); + return new mob_twilight_whelpAI(pCreature); } - uint32 m_uiFadeArmorTimer; - - void Reset() + struct mob_twilight_whelpAI : public ScriptedAI { - me->RemoveAllAuras(); - me->SetInCombatWithZone(); - m_uiFadeArmorTimer = 1000; - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - // twilight torment - if (m_uiFadeArmorTimer <= uiDiff) + mob_twilight_whelpAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(me->getVictim(), SPELL_FADE_ARMOR); - m_uiFadeArmorTimer = urand(5000,10000); + Reset(); } - else - m_uiFadeArmorTimer -= uiDiff; - DoMeleeAttackIfReady(); - } + uint32 m_uiFadeArmorTimer; + + void Reset() + { + me->RemoveAllAuras(); + me->SetInCombatWithZone(); + m_uiFadeArmorTimer = 1000; + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + // twilight torment + if (m_uiFadeArmorTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_FADE_ARMOR); + m_uiFadeArmorTimer = urand(5000,10000); + } + else + m_uiFadeArmorTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_twilight_whelp(Creature* pCreature) -{ - return new mob_twilight_whelpAI(pCreature); -} void AddSC_boss_sartharion() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sartharion"; - newscript->GetAI = &GetAI_boss_sartharion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_vesperon"; - newscript->GetAI = &GetAI_mob_vesperon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadron"; - newscript->GetAI = &GetAI_mob_shadron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tenebron"; - newscript->GetAI = &GetAI_mob_tenebron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_acolyte_of_shadron"; - newscript->GetAI = &GetAI_mob_acolyte_of_shadron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_acolyte_of_vesperon"; - newscript->GetAI = &GetAI_mob_acolyte_of_vesperon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_twilight_eggs"; - newscript->GetAI = &GetAI_mob_twilight_eggs; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_flame_tsunami"; - newscript->GetAI = &GetAI_npc_flame_tsunami; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_twilight_fissure"; - newscript->GetAI = &GetAI_npc_twilight_fissure; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_twilight_whelp"; - newscript->GetAI = &GetAI_mob_twilight_whelp; - newscript->RegisterSelf(); + new boss_sartharion(); + new mob_vesperon(); + new mob_shadron(); + new mob_tenebron(); + new mob_acolyte_of_shadron(); + new mob_acolyte_of_vesperon(); + new mob_twilight_eggs(); + new npc_flame_tsunami(); + new npc_twilight_fissure(); + new mob_twilight_whelp(); } diff --git a/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp index 4cb38db3a28..520d7c89a8a 100644 --- a/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -23,112 +23,115 @@ /* Obsidian Sanctum encounters: 0 - Sartharion */ - -struct instance_obsidian_sanctum : public ScriptedInstance + class instance_obsidian_sanctum : public InstanceMapScript { - instance_obsidian_sanctum(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_obsidian_sanctum() : InstanceMapScript("instance_obsidian_sanctum") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint64 m_uiSartharionGUID; - uint64 m_uiTenebronGUID; - uint64 m_uiShadronGUID; - uint64 m_uiVesperonGUID; - - bool m_bTenebronKilled; - bool m_bShadronKilled; - bool m_bVesperonKilled; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiSartharionGUID = 0; - m_uiTenebronGUID = 0; - m_uiShadronGUID = 0; - m_uiVesperonGUID = 0; - - m_bTenebronKilled = false; - m_bShadronKilled = false; - m_bVesperonKilled = false; + return new instance_obsidian_sanctum_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_obsidian_sanctum_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 m_uiSartharionGUID; + uint64 m_uiTenebronGUID; + uint64 m_uiShadronGUID; + uint64 m_uiVesperonGUID; + + bool m_bTenebronKilled; + bool m_bShadronKilled; + bool m_bVesperonKilled; + + void Initialize() { - case NPC_SARTHARION: - m_uiSartharionGUID = pCreature->GetGUID(); - break; - //three dragons below set to active state once created. - //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences - case NPC_TENEBRON: - m_uiTenebronGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; - case NPC_SHADRON: - m_uiShadronGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; - case NPC_VESPERON: - m_uiVesperonGUID = pCreature->GetGUID(); - pCreature->setActive(true); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiSartharionGUID = 0; + m_uiTenebronGUID = 0; + m_uiShadronGUID = 0; + m_uiVesperonGUID = 0; + + m_bTenebronKilled = false; + m_bShadronKilled = false; + m_bVesperonKilled = false; } - } - void SetData(uint32 uiType, uint32 uiData) - { - if (uiType == TYPE_SARTHARION_EVENT) - m_auiEncounter[0] = uiData; - else if(uiType == TYPE_TENEBRON_PREKILLED) - m_bTenebronKilled = true; - else if(uiType == TYPE_SHADRON_PREKILLED) - m_bShadronKilled = true; - else if(uiType == TYPE_VESPERON_PREKILLED) - m_bVesperonKilled = true; - } - - uint32 GetData(uint32 uiType) - { - if (uiType == TYPE_SARTHARION_EVENT) - return m_auiEncounter[0]; - else if(uiType == TYPE_TENEBRON_PREKILLED) - return m_bTenebronKilled; - else if(uiType == TYPE_SHADRON_PREKILLED) - return m_bShadronKilled; - else if(uiType == TYPE_VESPERON_PREKILLED) - return m_bVesperonKilled; - - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_SARTHARION: - return m_uiSartharionGUID; - case DATA_TENEBRON: - return m_uiTenebronGUID; - case DATA_SHADRON: - return m_uiShadronGUID; - case DATA_VESPERON: - return m_uiVesperonGUID; + switch(pCreature->GetEntry()) + { + case NPC_SARTHARION: + m_uiSartharionGUID = pCreature->GetGUID(); + break; + //three dragons below set to active state once created. + //we must expect bigger raid to encounter main boss, and then three dragons must be active due to grid differences + case NPC_TENEBRON: + m_uiTenebronGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + case NPC_SHADRON: + m_uiShadronGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + case NPC_VESPERON: + m_uiVesperonGUID = pCreature->GetGUID(); + pCreature->setActive(true); + break; + } } - return 0; - } + + void SetData(uint32 uiType, uint32 uiData) + { + if (uiType == TYPE_SARTHARION_EVENT) + m_auiEncounter[0] = uiData; + else if(uiType == TYPE_TENEBRON_PREKILLED) + m_bTenebronKilled = true; + else if(uiType == TYPE_SHADRON_PREKILLED) + m_bShadronKilled = true; + else if(uiType == TYPE_VESPERON_PREKILLED) + m_bVesperonKilled = true; + } + + uint32 GetData(uint32 uiType) + { + if (uiType == TYPE_SARTHARION_EVENT) + return m_auiEncounter[0]; + else if(uiType == TYPE_TENEBRON_PREKILLED) + return m_bTenebronKilled; + else if(uiType == TYPE_SHADRON_PREKILLED) + return m_bShadronKilled; + else if(uiType == TYPE_VESPERON_PREKILLED) + return m_bVesperonKilled; + + return 0; + } + + uint64 GetData64(uint32 uiData) + { + switch(uiData) + { + case DATA_SARTHARION: + return m_uiSartharionGUID; + case DATA_TENEBRON: + return m_uiTenebronGUID; + case DATA_SHADRON: + return m_uiShadronGUID; + case DATA_VESPERON: + return m_uiVesperonGUID; + } + return 0; + } + }; + }; -InstanceData* GetInstanceData_instance_obsidian_sanctum(Map* pMap) -{ - return new instance_obsidian_sanctum(pMap); -} void AddSC_instance_obsidian_sanctum() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_obsidian_sanctum"; - newscript->GetInstanceData = &GetInstanceData_instance_obsidian_sanctum; - newscript->RegisterSelf(); + new instance_obsidian_sanctum(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index aa0be07d7bd..c376104ccf7 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -80,355 +80,360 @@ enum eEnums /*###### ## boss_bjarngrim ######*/ - -struct boss_bjarngrimAI : public ScriptedAI + class boss_bjarngrim : public CreatureScript { - boss_bjarngrimAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + boss_bjarngrim() : CreatureScript("boss_bjarngrim") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - m_uiStance = STANCE_DEFENSIVE; - memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); + return new boss_bjarngrimAI(pCreature); } - ScriptedInstance* m_pInstance; - - bool m_bIsChangingStance; - - uint8 m_uiChargingStatus; - uint8 m_uiStance; - - uint32 m_uiCharge_Timer; - uint32 m_uiChangeStance_Timer; - - uint32 m_uiReflection_Timer; - uint32 m_uiKnockAway_Timer; - uint32 m_uiPummel_Timer; - uint32 m_uiIronform_Timer; - - uint32 m_uiIntercept_Timer; - uint32 m_uiWhirlwind_Timer; - uint32 m_uiCleave_Timer; - - uint32 m_uiMortalStrike_Timer; - uint32 m_uiSlam_Timer; - - uint64 m_auiStormforgedLieutenantGUID[2]; - - void Reset() + struct boss_bjarngrimAI : public ScriptedAI { - m_bIsChangingStance = false; - - m_uiChargingStatus = 0; - m_uiCharge_Timer = 1000; - - m_uiChangeStance_Timer = 20000 + rand()%5000; - - m_uiReflection_Timer = 8000; - m_uiKnockAway_Timer = 20000; - m_uiPummel_Timer = 10000; - m_uiIronform_Timer = 25000; - - m_uiIntercept_Timer = 5000; - m_uiWhirlwind_Timer = 10000; - m_uiCleave_Timer = 8000; - - m_uiMortalStrike_Timer = 8000; - m_uiSlam_Timer = 10000; - - for (uint8 i = 0; i < 2; ++i) + boss_bjarngrimAI(Creature *pCreature) : ScriptedAI(pCreature) { - if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) + m_pInstance = pCreature->GetInstanceScript(); + m_uiStance = STANCE_DEFENSIVE; + memset(&m_auiStormforgedLieutenantGUID, 0, sizeof(m_auiStormforgedLieutenantGUID)); + } + + InstanceScript* m_pInstance; + + bool m_bIsChangingStance; + + uint8 m_uiChargingStatus; + uint8 m_uiStance; + + uint32 m_uiCharge_Timer; + uint32 m_uiChangeStance_Timer; + + uint32 m_uiReflection_Timer; + uint32 m_uiKnockAway_Timer; + uint32 m_uiPummel_Timer; + uint32 m_uiIronform_Timer; + + uint32 m_uiIntercept_Timer; + uint32 m_uiWhirlwind_Timer; + uint32 m_uiCleave_Timer; + + uint32 m_uiMortalStrike_Timer; + uint32 m_uiSlam_Timer; + + uint64 m_auiStormforgedLieutenantGUID[2]; + + void Reset() + { + m_bIsChangingStance = false; + + m_uiChargingStatus = 0; + m_uiCharge_Timer = 1000; + + m_uiChangeStance_Timer = 20000 + rand()%5000; + + m_uiReflection_Timer = 8000; + m_uiKnockAway_Timer = 20000; + m_uiPummel_Timer = 10000; + m_uiIronform_Timer = 25000; + + m_uiIntercept_Timer = 5000; + m_uiWhirlwind_Timer = 10000; + m_uiCleave_Timer = 8000; + + m_uiMortalStrike_Timer = 8000; + m_uiSlam_Timer = 10000; + + for (uint8 i = 0; i < 2; ++i) { - if (!pStormforgedLieutenant->isAlive()) - pStormforgedLieutenant->Respawn(); + if (Creature* pStormforgedLieutenant = (Unit::GetCreature((*me), m_auiStormforgedLieutenantGUID[i]))) + { + if (!pStormforgedLieutenant->isAlive()) + pStormforgedLieutenant->Respawn(); + } + } + + if (m_uiStance != STANCE_DEFENSIVE) + { + DoRemoveStanceAura(m_uiStance); + DoCast(me, SPELL_DEFENSIVE_STANCE); + m_uiStance = STANCE_DEFENSIVE; + } + + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + + //must get both lieutenants here and make sure they are with him + me->CallForHelp(30.0f); + + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); + } + + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + if (m_pInstance) + m_pInstance->SetData(TYPE_BJARNGRIM, DONE); + } + + //TODO: remove when removal is done by the core + void DoRemoveStanceAura(uint8 uiStance) + { + switch(uiStance) + { + case STANCE_DEFENSIVE: + me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); + break; + case STANCE_BERSERKER: + me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); + break; + case STANCE_BATTLE: + me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); + break; } } - if (m_uiStance != STANCE_DEFENSIVE) + void UpdateAI(const uint32 uiDiff) { - DoRemoveStanceAura(m_uiStance); - DoCast(me, SPELL_DEFENSIVE_STANCE); - m_uiStance = STANCE_DEFENSIVE; - } - - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, NOT_STARTED); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - - //must get both lieutenants here and make sure they are with him - me->CallForHelp(30.0f); - - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, IN_PROGRESS); - } - - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - - if (m_pInstance) - m_pInstance->SetData(TYPE_BJARNGRIM, DONE); - } - - //TODO: remove when removal is done by the core - void DoRemoveStanceAura(uint8 uiStance) - { - switch(uiStance) - { - case STANCE_DEFENSIVE: - me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); - break; - case STANCE_BERSERKER: - me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); - break; - case STANCE_BATTLE: - me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); - break; - } - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - // Change stance - if (m_uiChangeStance_Timer <= uiDiff) - { - //wait for current spell to finish before change stance - if (me->IsNonMeleeSpellCasted(false)) + //Return since we have no target + if (!UpdateVictim()) return; - DoRemoveStanceAura(m_uiStance); + // Change stance + if (m_uiChangeStance_Timer <= uiDiff) + { + //wait for current spell to finish before change stance + if (me->IsNonMeleeSpellCasted(false)) + return; - int uiTempStance = rand()%(3-1); + DoRemoveStanceAura(m_uiStance); - if (uiTempStance >= m_uiStance) - ++uiTempStance; + int uiTempStance = rand()%(3-1); - m_uiStance = uiTempStance; + if (uiTempStance >= m_uiStance) + ++uiTempStance; + + m_uiStance = uiTempStance; + + switch(m_uiStance) + { + case STANCE_DEFENSIVE: + DoScriptText(SAY_DEFENSIVE_STANCE, me); + DoScriptText(EMOTE_DEFENSIVE_STANCE, me); + DoCast(me, SPELL_DEFENSIVE_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + break; + case STANCE_BERSERKER: + DoScriptText(SAY_BERSEKER_STANCE, me); + DoScriptText(EMOTE_BERSEKER_STANCE, me); + DoCast(me, SPELL_BERSEKER_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + break; + case STANCE_BATTLE: + DoScriptText(SAY_BATTLE_STANCE, me); + DoScriptText(EMOTE_BATTLE_STANCE, me); + DoCast(me, SPELL_BATTLE_STANCE); + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + break; + } + + m_uiChangeStance_Timer = 20000 + rand()%5000; + return; + } + else + m_uiChangeStance_Timer -= uiDiff; switch(m_uiStance) { case STANCE_DEFENSIVE: - DoScriptText(SAY_DEFENSIVE_STANCE, me); - DoScriptText(EMOTE_DEFENSIVE_STANCE, me); - DoCast(me, SPELL_DEFENSIVE_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + { + if (m_uiReflection_Timer <= uiDiff) + { + DoCast(me, SPELL_SPELL_REFLECTION); + m_uiReflection_Timer = 8000 + rand()%1000; + } + else + m_uiReflection_Timer -= uiDiff; + + if (m_uiKnockAway_Timer <= uiDiff) + { + DoCast(me, SPELL_KNOCK_AWAY); + m_uiKnockAway_Timer = 20000 + rand()%1000; + } + else + m_uiKnockAway_Timer -= uiDiff; + + if (m_uiPummel_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_PUMMEL); + m_uiPummel_Timer = 10000 + rand()%1000; + } + else + m_uiPummel_Timer -= uiDiff; + + if (m_uiIronform_Timer <= uiDiff) + { + DoCast(me, SPELL_IRONFORM); + m_uiIronform_Timer = 25000 + rand()%1000; + } + else + m_uiIronform_Timer -= uiDiff; + break; + } case STANCE_BERSERKER: - DoScriptText(SAY_BERSEKER_STANCE, me); - DoScriptText(EMOTE_BERSEKER_STANCE, me); - DoCast(me, SPELL_BERSEKER_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); + { + if (m_uiIntercept_Timer <= uiDiff) + { + //not much point is this, better random target and more often? + DoCast(me->getVictim(), SPELL_INTERCEPT); + m_uiIntercept_Timer = 45000 + rand()%1000; + } + else + m_uiIntercept_Timer -= uiDiff; + + if (m_uiWhirlwind_Timer <= uiDiff) + { + DoCast(me, SPELL_WHIRLWIND); + m_uiWhirlwind_Timer = 10000 + rand()%1000; + } + else + m_uiWhirlwind_Timer -= uiDiff; + + if (m_uiCleave_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + m_uiCleave_Timer = 8000 + rand()%1000; + } + else + m_uiCleave_Timer -= uiDiff; + break; + } case STANCE_BATTLE: - DoScriptText(SAY_BATTLE_STANCE, me); - DoScriptText(EMOTE_BATTLE_STANCE, me); - DoCast(me, SPELL_BATTLE_STANCE); - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + { + if (m_uiMortalStrike_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + m_uiMortalStrike_Timer = 20000 + rand()%1000; + } + else + m_uiMortalStrike_Timer -= uiDiff; + + if (m_uiSlam_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_SLAM); + m_uiSlam_Timer = 15000 + rand()%1000; + } + else + m_uiSlam_Timer -= uiDiff; + break; + } } - m_uiChangeStance_Timer = 20000 + rand()%5000; - return; + DoMeleeAttackIfReady(); } - else - m_uiChangeStance_Timer -= uiDiff; + }; - switch(m_uiStance) - { - case STANCE_DEFENSIVE: - { - if (m_uiReflection_Timer <= uiDiff) - { - DoCast(me, SPELL_SPELL_REFLECTION); - m_uiReflection_Timer = 8000 + rand()%1000; - } - else - m_uiReflection_Timer -= uiDiff; - - if (m_uiKnockAway_Timer <= uiDiff) - { - DoCast(me, SPELL_KNOCK_AWAY); - m_uiKnockAway_Timer = 20000 + rand()%1000; - } - else - m_uiKnockAway_Timer -= uiDiff; - - if (m_uiPummel_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_PUMMEL); - m_uiPummel_Timer = 10000 + rand()%1000; - } - else - m_uiPummel_Timer -= uiDiff; - - if (m_uiIronform_Timer <= uiDiff) - { - DoCast(me, SPELL_IRONFORM); - m_uiIronform_Timer = 25000 + rand()%1000; - } - else - m_uiIronform_Timer -= uiDiff; - - break; - } - case STANCE_BERSERKER: - { - if (m_uiIntercept_Timer <= uiDiff) - { - //not much point is this, better random target and more often? - DoCast(me->getVictim(), SPELL_INTERCEPT); - m_uiIntercept_Timer = 45000 + rand()%1000; - } - else - m_uiIntercept_Timer -= uiDiff; - - if (m_uiWhirlwind_Timer <= uiDiff) - { - DoCast(me, SPELL_WHIRLWIND); - m_uiWhirlwind_Timer = 10000 + rand()%1000; - } - else - m_uiWhirlwind_Timer -= uiDiff; - - if (m_uiCleave_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - m_uiCleave_Timer = 8000 + rand()%1000; - } - else - m_uiCleave_Timer -= uiDiff; - - break; - } - case STANCE_BATTLE: - { - if (m_uiMortalStrike_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - m_uiMortalStrike_Timer = 20000 + rand()%1000; - } - else - m_uiMortalStrike_Timer -= uiDiff; - - if (m_uiSlam_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_SLAM); - m_uiSlam_Timer = 15000 + rand()%1000; - } - else - m_uiSlam_Timer -= uiDiff; - - break; - } - } - - DoMeleeAttackIfReady(); - } }; /*###### ## mob_stormforged_lieutenant ######*/ - -struct mob_stormforged_lieutenantAI : public ScriptedAI + class mob_stormforged_lieutenant : public CreatureScript { - mob_stormforged_lieutenantAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + mob_stormforged_lieutenant() : CreatureScript("mob_stormforged_lieutenant") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new mob_stormforged_lieutenantAI(pCreature); } - ScriptedInstance* m_pInstance; - - uint32 m_uiArcWeld_Timer; - uint32 m_uiRenewSteel_Timer; - - void Reset() + struct mob_stormforged_lieutenantAI : public ScriptedAI { - m_uiArcWeld_Timer = 20000 + rand()%1000; - m_uiRenewSteel_Timer = 10000 + rand()%1000; - } - - void EnterCombat(Unit* pWho) - { - if (m_pInstance) + mob_stormforged_lieutenantAI(Creature *pCreature) : ScriptedAI(pCreature) { - if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) - { - if (pBjarngrim->isAlive() && !pBjarngrim->getVictim()) - pBjarngrim->AI()->AttackStart(pWho); - } + m_pInstance = pCreature->GetInstanceScript(); } - } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* m_pInstance; - if (m_uiArcWeld_Timer <= uiDiff) + uint32 m_uiArcWeld_Timer; + uint32 m_uiRenewSteel_Timer; + + void Reset() { - DoCast(me->getVictim(), SPELL_ARC_WELD); m_uiArcWeld_Timer = 20000 + rand()%1000; + m_uiRenewSteel_Timer = 10000 + rand()%1000; } - else - m_uiArcWeld_Timer -= uiDiff; - if (m_uiRenewSteel_Timer <= uiDiff) + void EnterCombat(Unit* pWho) { if (m_pInstance) { if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) { - if (pBjarngrim->isAlive()) - DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); + if (pBjarngrim->isAlive() && !pBjarngrim->getVictim()) + pBjarngrim->AI()->AttackStart(pWho); } } - m_uiRenewSteel_Timer = 10000 + rand()%4000; } - else - m_uiRenewSteel_Timer -= uiDiff; - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_uiArcWeld_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_ARC_WELD); + m_uiArcWeld_Timer = 20000 + rand()%1000; + } + else + m_uiArcWeld_Timer -= uiDiff; + + if (m_uiRenewSteel_Timer <= uiDiff) + { + if (m_pInstance) + { + if (Creature* pBjarngrim = m_pInstance->instance->GetCreature(m_pInstance->GetData64(DATA_BJARNGRIM))) + { + if (pBjarngrim->isAlive()) + DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); + } + } + m_uiRenewSteel_Timer = 10000 + rand()%4000; + } + else + m_uiRenewSteel_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_bjarngrim(Creature* pCreature) -{ - return new boss_bjarngrimAI(pCreature); -} -CreatureAI* GetAI_mob_stormforged_lieutenant(Creature* pCreature) -{ - return new mob_stormforged_lieutenantAI(pCreature); -} void AddSC_boss_bjarngrim() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_bjarngrim"; - newscript->GetAI = &GetAI_boss_bjarngrim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_stormforged_lieutenant"; - newscript->GetAI = &GetAI_mob_stormforged_lieutenant; - newscript->RegisterSelf(); + new boss_bjarngrim(); + new mob_stormforged_lieutenant(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index 88c240b49bd..e8eb2b20a31 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -65,325 +65,330 @@ enum Misc /*###### ## Boss Ionar ######*/ - -struct boss_ionarAI : public ScriptedAI + class boss_ionar : public CreatureScript { - boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), lSparkList(pCreature) +public: + boss_ionar() : CreatureScript("boss_ionar") { } + + bool EffectDummyCreature(Unit* /*pCaster*/, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - SummonList lSparkList; - - bool bIsSplitPhase; - bool bHasDispersed; - - uint32 uiSplitTimer; - - uint32 uiStaticOverloadTimer; - uint32 uiBallLightningTimer; - - uint32 uiDisperseHealth; - - void Reset() - { - lSparkList.DespawnAll(); - - bIsSplitPhase = true; - bHasDispersed = false; - - uiSplitTimer = 25*IN_MILLISECONDS; - - uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); - uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); - - uiDisperseHealth = 45 + urand(0,10); - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - - if (me->GetVisibility() == VISIBILITY_OFF) - me->SetVisibility(VISIBILITY_ON); - - if (pInstance) - pInstance->SetData(TYPE_IONAR, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(TYPE_IONAR, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - lSparkList.DespawnAll(); - - if (pInstance) - pInstance->SetData(TYPE_IONAR, DONE); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - //make sparks come back - void CallBackSparks() - { - //should never be empty here, but check - if (lSparkList.empty()) - return; - - Position pos; - me->GetPosition(&pos); - - for (std::list::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr) + //always check spellid and effectindex + if (uiSpellId == SPELL_DISPERSE && uiEffIndex == 0) { - if (Creature* pSpark = Unit::GetCreature(*me, *itr)) - { - if (pSpark->isAlive()) - { - pSpark->SetSpeed(MOVE_RUN, 2.0f); - pSpark->GetMotionMaster()->Clear(); - pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); - } - else - pSpark->ForcedDespawn(); - } + if (pCreatureTarget->GetEntry() != NPC_IONAR) + return true; + + for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i) + pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true); + + pCreatureTarget->AttackStop(); + pCreatureTarget->SetVisibility(VISIBILITY_OFF); + pCreatureTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + + pCreatureTarget->GetMotionMaster()->Clear(); + pCreatureTarget->GetMotionMaster()->MoveIdle(); + + //always return true when we are handling this spell and effect + return true; } + return false; } - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + CreatureAI* GetAI(Creature* pCreature) const { - if (me->GetVisibility() == VISIBILITY_OFF) - uiDamage = 0; + return new boss_ionarAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct boss_ionarAI : public ScriptedAI { - if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + boss_ionarAI(Creature *pCreature) : ScriptedAI(pCreature), lSparkList(pCreature) { - lSparkList.Summon(pSummoned); - - pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER,H_SPELL_SPARK_VISUAL_TRIGGER), true); - - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - { - pSummoned->SetInCombatWith(pTarget); - pSummoned->GetMotionMaster()->Clear(); - pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0.0f, 0.0f); - } - } - } - - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) - lSparkList.Despawn(pSummoned); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - // Splitted - if (me->GetVisibility() == VISIBILITY_OFF) - { - if (uiSplitTimer <= uiDiff) - { - uiSplitTimer = 2.5*IN_MILLISECONDS; - - // Return sparks to where Ionar splitted - if (bIsSplitPhase) - { - CallBackSparks(); - bIsSplitPhase = false; - } - // Lightning effect and restore Ionar - else if (lSparkList.empty()) - { - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - - DoCast(me, SPELL_SPARK_DESPAWN, false); - - uiSplitTimer = 25*IN_MILLISECONDS; - bIsSplitPhase = true; - - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); - } - } - else - uiSplitTimer -= uiDiff; - - return; + pInstance = pCreature->GetInstanceScript(); } - if (uiStaticOverloadTimer <= uiDiff) + InstanceScript* pInstance; + + SummonList lSparkList; + + bool bIsSplitPhase; + bool bHasDispersed; + + uint32 uiSplitTimer; + + uint32 uiStaticOverloadTimer; + uint32 uiBallLightningTimer; + + uint32 uiDisperseHealth; + + void Reset() { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_STATIC_OVERLOAD); + lSparkList.DespawnAll(); + + bIsSplitPhase = true; + bHasDispersed = false; + + uiSplitTimer = 25*IN_MILLISECONDS; uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); - } - else - uiStaticOverloadTimer -= uiDiff; - - if (uiBallLightningTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); - } - else - uiBallLightningTimer -= uiDiff; - // Health check - if (!bHasDispersed && HealthBelowPct(uiDisperseHealth)) + uiDisperseHealth = 45 + urand(0,10); + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + + if (me->GetVisibility() == VISIBILITY_OFF) + me->SetVisibility(VISIBILITY_ON); + + if (pInstance) + pInstance->SetData(TYPE_IONAR, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - bHasDispersed = true; + DoScriptText(SAY_AGGRO, me); - DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); - - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - DoCast(me, SPELL_DISPERSE, true); + if (pInstance) + pInstance->SetData(TYPE_IONAR, IN_PROGRESS); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + lSparkList.DespawnAll(); + + if (pInstance) + pInstance->SetData(TYPE_IONAR, DONE); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + //make sparks come back + void CallBackSparks() + { + //should never be empty here, but check + if (lSparkList.empty()) + return; + + Position pos; + me->GetPosition(&pos); + + for (std::list::const_iterator itr = lSparkList.begin(); itr != lSparkList.end(); ++itr) + { + if (Creature* pSpark = Unit::GetCreature(*me, *itr)) + { + if (pSpark->isAlive()) + { + pSpark->SetSpeed(MOVE_RUN, 2.0f); + pSpark->GetMotionMaster()->Clear(); + pSpark->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + } + else + pSpark->ForcedDespawn(); + } + } + } + + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + { + if (me->GetVisibility() == VISIBILITY_OFF) + uiDamage = 0; + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + { + lSparkList.Summon(pSummoned); + + pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_SPARK_VISUAL_TRIGGER,H_SPELL_SPARK_VISUAL_TRIGGER), true); + + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + pSummoned->SetInCombatWith(pTarget); + pSummoned->GetMotionMaster()->Clear(); + pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0.0f, 0.0f); + } + } + } + + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned->GetEntry() == NPC_SPARK_OF_IONAR) + lSparkList.Despawn(pSummoned); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + // Splitted + if (me->GetVisibility() == VISIBILITY_OFF) + { + if (uiSplitTimer <= uiDiff) + { + uiSplitTimer = 2.5*IN_MILLISECONDS; + + // Return sparks to where Ionar splitted + if (bIsSplitPhase) + { + CallBackSparks(); + bIsSplitPhase = false; + } + // Lightning effect and restore Ionar + else if (lSparkList.empty()) + { + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); + + DoCast(me, SPELL_SPARK_DESPAWN, false); + + uiSplitTimer = 25*IN_MILLISECONDS; + bIsSplitPhase = true; + + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + } + else + uiSplitTimer -= uiDiff; + + return; + } + + if (uiStaticOverloadTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_STATIC_OVERLOAD); + + uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS); + } + else + uiStaticOverloadTimer -= uiDiff; + + if (uiBallLightningTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_BALL_LIGHTNING); + uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS); + } + else + uiBallLightningTimer -= uiDiff; + + // Health check + if (!bHasDispersed && HealthBelowPct(uiDisperseHealth)) + { + bHasDispersed = true; + + DoScriptText(RAND(SAY_SPLIT_1,SAY_SPLIT_2), me); + + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoCast(me, SPELL_DISPERSE, true); + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_ionar(Creature* pCreature) -{ - return new boss_ionarAI(pCreature); -} -bool EffectDummyCreature_boss_ionar(Unit* /*pCaster*/, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) -{ - //always check spellid and effectindex - if (uiSpellId == SPELL_DISPERSE && uiEffIndex == 0) - { - if (pCreatureTarget->GetEntry() != NPC_IONAR) - return true; - - for (uint8 i = 0; i < DATA_MAX_SPARKS; ++i) - pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_SPARK, true); - - pCreatureTarget->AttackStop(); - pCreatureTarget->SetVisibility(VISIBILITY_OFF); - pCreatureTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE); - - pCreatureTarget->GetMotionMaster()->Clear(); - pCreatureTarget->GetMotionMaster()->MoveIdle(); - - //always return true when we are handling this spell and effect - return true; - } - return false; -} /*###### ## mob_spark_of_ionar ######*/ - -struct mob_spark_of_ionarAI : public ScriptedAI + class mob_spark_of_ionar : public CreatureScript { - mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + mob_spark_of_ionar() : CreatureScript("mob_spark_of_ionar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new mob_spark_of_ionarAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 uiCheckTimer; - - void Reset() + struct mob_spark_of_ionarAI : public ScriptedAI { - uiCheckTimer = 2*IN_MILLISECONDS; - me->SetReactState(REACT_PASSIVE); - } - - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE || !pInstance) - return; - - if (uiPointId == DATA_POINT_CALLBACK) - me->ForcedDespawn(); - } - - void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) - { - uiDamage = 0; - } - - void UpdateAI(const uint32 uiDiff) - { - // Despawn if the encounter is not running - if (pInstance && pInstance->GetData(TYPE_IONAR) != IN_PROGRESS) + mob_spark_of_ionarAI(Creature *pCreature) : ScriptedAI(pCreature) { - me->ForcedDespawn(); - return; + pInstance = pCreature->GetInstanceScript(); } - // Prevent them to follow players through the whole instance - if (uiCheckTimer <= uiDiff) - { - if (pInstance) - { - Creature* pIonar = pInstance->instance->GetCreature(pInstance->GetData64(DATA_IONAR)); - if (pIonar && pIonar->isAlive()) - { - if (me->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE) - { - Position pos; - pIonar->GetPosition(&pos); + InstanceScript* pInstance; - me->SetSpeed(MOVE_RUN, 2.0f); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); - } - } - else - me->ForcedDespawn(); - } + uint32 uiCheckTimer; + + void Reset() + { uiCheckTimer = 2*IN_MILLISECONDS; + me->SetReactState(REACT_PASSIVE); } - else - uiCheckTimer -= uiDiff; - // No melee attack at all! - } + void MovementInform(uint32 uiType, uint32 uiPointId) + { + if (uiType != POINT_MOTION_TYPE || !pInstance) + return; + + if (uiPointId == DATA_POINT_CALLBACK) + me->ForcedDespawn(); + } + + void DamageTaken(Unit * /*pDoneBy*/, uint32 &uiDamage) + { + uiDamage = 0; + } + + void UpdateAI(const uint32 uiDiff) + { + // Despawn if the encounter is not running + if (pInstance && pInstance->GetData(TYPE_IONAR) != IN_PROGRESS) + { + me->ForcedDespawn(); + return; + } + + // Prevent them to follow players through the whole instance + if (uiCheckTimer <= uiDiff) + { + if (pInstance) + { + Creature* pIonar = pInstance->instance->GetCreature(pInstance->GetData64(DATA_IONAR)); + if (pIonar && pIonar->isAlive()) + { + if (me->GetDistance(pIonar) > DATA_MAX_SPARK_DISTANCE) + { + Position pos; + pIonar->GetPosition(&pos); + + me->SetSpeed(MOVE_RUN, 2.0f); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(DATA_POINT_CALLBACK, pos); + } + } + else + me->ForcedDespawn(); + } + uiCheckTimer = 2*IN_MILLISECONDS; + } + else + uiCheckTimer -= uiDiff; + + // No melee attack at all! + } + }; + }; -CreatureAI* GetAI_mob_spark_of_ionar(Creature* pCreature) -{ - return new mob_spark_of_ionarAI(pCreature); -} void AddSC_boss_ionar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ionar"; - newscript->GetAI = &GetAI_boss_ionar; - newscript->pEffectDummyCreature = &EffectDummyCreature_boss_ionar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_spark_of_ionar"; - newscript->GetAI = &GetAI_mob_spark_of_ionar; - newscript->RegisterSelf(); + new boss_ionar(); + new mob_spark_of_ionar(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp index e0a55a79ccd..ba6d5bba5f9 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_loken.cpp @@ -57,168 +57,170 @@ enum eEnums /*###### ## Boss Loken ######*/ - -struct boss_lokenAI : public ScriptedAI + class boss_loken : public CreatureScript { - boss_lokenAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_loken() : CreatureScript("boss_loken") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_lokenAI(pCreature); } - ScriptedInstance* m_pInstance; - - bool m_bIsAura; - - uint32 m_uiArcLightning_Timer; - uint32 m_uiLightningNova_Timer; - uint32 m_uiPulsingShockwave_Timer; - uint32 m_uiResumePulsingShockwave_Timer; - - uint32 m_uiHealthAmountModifier; - - void Reset() + struct boss_lokenAI : public ScriptedAI { - m_bIsAura = false; - - m_uiArcLightning_Timer = 15000; - m_uiLightningNova_Timer = 20000; - m_uiPulsingShockwave_Timer = 2000; - m_uiResumePulsingShockwave_Timer = 15000; - - m_uiHealthAmountModifier = 1; - - if (m_pInstance) + boss_lokenAI(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + m_pInstance = pCreature->GetInstanceScript(); } - } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); + InstanceScript* m_pInstance; - if (m_pInstance) + bool m_bIsAura; + + uint32 m_uiArcLightning_Timer; + uint32 m_uiLightningNova_Timer; + uint32 m_uiPulsingShockwave_Timer; + uint32 m_uiResumePulsingShockwave_Timer; + + uint32 m_uiHealthAmountModifier; + + void Reset() { - m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); - } - } + m_bIsAura = false; - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); + m_uiArcLightning_Timer = 15000; + m_uiLightningNova_Timer = 20000; + m_uiPulsingShockwave_Timer = 2000; + m_uiResumePulsingShockwave_Timer = 15000; - if (m_pInstance) - m_pInstance->SetData(TYPE_LOKEN, DONE); - } + m_uiHealthAmountModifier = 1; - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_bIsAura) - { - // workaround for PULSING_SHOCKWAVE - if (m_uiPulsingShockwave_Timer <= uiDiff) + if (m_pInstance) { - Map* pMap = me->GetMap(); - if (pMap->IsDungeon()) + m_pInstance->SetData(TYPE_LOKEN, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + } + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + + if (m_pInstance) + { + m_pInstance->SetData(TYPE_LOKEN, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMELY_DEATH_START_EVENT); + } + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + if (m_pInstance) + m_pInstance->SetData(TYPE_LOKEN, DONE); + } + + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_bIsAura) + { + // workaround for PULSING_SHOCKWAVE + if (m_uiPulsingShockwave_Timer <= uiDiff) { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); + Map* pMap = me->GetMap(); + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) - return; + if (PlayerList.isEmpty()) + return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) - { - int32 dmg; - float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) + { + int32 dmg; + float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ()); - dmg = DUNGEON_MODE(100, 150); // need to correct damage - if (m_fDist > 1.0f) // Further from 1 yard - dmg *= m_fDist; + dmg = DUNGEON_MODE(100, 150); // need to correct damage + if (m_fDist > 1.0f) // Further from 1 yard + dmg *= m_fDist; - me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); - } - } - m_uiPulsingShockwave_Timer = 2000; - } else m_uiPulsingShockwave_Timer -= uiDiff; - } - else - { - if (m_uiResumePulsingShockwave_Timer <= uiDiff) - { - //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? - DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); - - DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support - m_bIsAura = true; - m_uiResumePulsingShockwave_Timer = 0; + me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false); + } + } + m_uiPulsingShockwave_Timer = 2000; + } else m_uiPulsingShockwave_Timer -= uiDiff; } else - m_uiResumePulsingShockwave_Timer -= uiDiff; - } - - if (m_uiArcLightning_Timer <= uiDiff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ARC_LIGHTNING); - - m_uiArcLightning_Timer = 15000 + rand()%1000; - } - else - m_uiArcLightning_Timer -= uiDiff; - - if (m_uiLightningNova_Timer <= uiDiff) - { - DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), me); - DoScriptText(EMOTE_NOVA, me); - DoCast(me, SPELL_LIGHTNING_NOVA_N); - - m_bIsAura = false; - m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura - m_uiLightningNova_Timer = 20000 + rand()%1000; - } - else - m_uiLightningNova_Timer -= uiDiff; - - // Health check - if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier))) - { - switch(m_uiHealthAmountModifier) { - case 1: DoScriptText(SAY_75HEALTH, me); break; - case 2: DoScriptText(SAY_50HEALTH, me); break; - case 3: DoScriptText(SAY_25HEALTH, me); break; + if (m_uiResumePulsingShockwave_Timer <= uiDiff) + { + //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement? + DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true); + + DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support + m_bIsAura = true; + m_uiResumePulsingShockwave_Timer = 0; + } + else + m_uiResumePulsingShockwave_Timer -= uiDiff; } - ++m_uiHealthAmountModifier; - } + if (m_uiArcLightning_Timer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ARC_LIGHTNING); + + m_uiArcLightning_Timer = 15000 + rand()%1000; + } + else + m_uiArcLightning_Timer -= uiDiff; + + if (m_uiLightningNova_Timer <= uiDiff) + { + DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), me); + DoScriptText(EMOTE_NOVA, me); + DoCast(me, SPELL_LIGHTNING_NOVA_N); + + m_bIsAura = false; + m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura + m_uiLightningNova_Timer = 20000 + rand()%1000; + } + else + m_uiLightningNova_Timer -= uiDiff; + + // Health check + if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier))) + { + switch(m_uiHealthAmountModifier) + { + case 1: DoScriptText(SAY_75HEALTH, me); break; + case 2: DoScriptText(SAY_50HEALTH, me); break; + case 3: DoScriptText(SAY_25HEALTH, me); break; + } + + ++m_uiHealthAmountModifier; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_loken(Creature* pCreature) -{ - return new boss_lokenAI(pCreature); -} void AddSC_boss_loken() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_loken"; - newscript->GetAI = &GetAI_boss_loken; - newscript->RegisterSelf(); + new boss_loken(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index cb5878defb3..7cdf9c4e287 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -73,408 +73,415 @@ enum eEnums /*###### ## Boss Volkhan ######*/ - -struct boss_volkhanAI : public ScriptedAI + class boss_volkhan : public CreatureScript { - boss_volkhanAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + boss_volkhan() : CreatureScript("boss_volkhan") { } + + bool EffectDummyCreature(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - m_pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* m_pInstance; - - std::list m_lGolemGUIDList; - - bool m_bHasTemper; - bool m_bIsStriking; - bool m_bCanShatterGolem; - - uint8 GolemsShattered; - uint32 m_uiPause_Timer; - uint32 m_uiShatteringStomp_Timer; - uint32 m_uiShatter_Timer; - - uint32 m_uiHealthAmountModifier; - - void Reset() - { - m_bIsStriking = false; - m_bHasTemper = false; - m_bCanShatterGolem = false; - - m_uiPause_Timer = 3500; - m_uiShatteringStomp_Timer = 0; - m_uiShatter_Timer = 5000; - GolemsShattered = 0; - - m_uiHealthAmountModifier = 1; - - DespawnGolem(); - m_lGolemGUIDList.clear(); - - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); - } - - void AttackStart(Unit* pWho) - { - if (me->Attack(pWho, true)) + //always check spellid and effectindex + if (uiSpellId == SPELL_TEMPER_DUMMY && uiEffIndex == 0) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + if (pCaster->GetEntry() != NPC_VOLKHAN_ANVIL || pCreatureTarget->GetEntry() != NPC_VOLKHAN) + return true; - if (!m_bHasTemper) - me->GetMotionMaster()->MoveChase(pWho); - } - } - - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - DespawnGolem(); - - if (m_pInstance) - m_pInstance->SetData(TYPE_VOLKHAN, DONE); - - if (IsHeroic() && GolemsShattered < 5) - { - AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); - if (AchievShatterResistant) + for (uint8 i = 0; i < MAX_GOLEM; ++i) { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) + pCreatureTarget->CastSpell(pCaster, SPELL_SUMMON_MOLTEN_GOLEM, true); + } + + //always return true when we are handling this spell and effect + return true; + } + + return false; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_volkhanAI(pCreature); + } + + struct boss_volkhanAI : public ScriptedAI + { + boss_volkhanAI(Creature *pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* m_pInstance; + + std::list m_lGolemGUIDList; + + bool m_bHasTemper; + bool m_bIsStriking; + bool m_bCanShatterGolem; + + uint8 GolemsShattered; + uint32 m_uiPause_Timer; + uint32 m_uiShatteringStomp_Timer; + uint32 m_uiShatter_Timer; + + uint32 m_uiHealthAmountModifier; + + void Reset() + { + m_bIsStriking = false; + m_bHasTemper = false; + m_bCanShatterGolem = false; + + m_uiPause_Timer = 3500; + m_uiShatteringStomp_Timer = 0; + m_uiShatter_Timer = 5000; + GolemsShattered = 0; + + m_uiHealthAmountModifier = 1; + + DespawnGolem(); + m_lGolemGUIDList.clear(); + + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, NOT_STARTED); + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, IN_PROGRESS); + } + + void AttackStart(Unit* pWho) + { + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + if (!m_bHasTemper) + me->GetMotionMaster()->MoveChase(pWho); + } + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + DespawnGolem(); + + if (m_pInstance) + m_pInstance->SetData(TYPE_VOLKHAN, DONE); + + if (IsHeroic() && GolemsShattered < 5) + { + AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); + if (AchievShatterResistant) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievShatterResistant); + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievShatterResistant); + } } } } - } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - void DespawnGolem() - { - if (m_lGolemGUIDList.empty()) - return; - - for (std::list::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + void KilledUnit(Unit* /*pVictim*/) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - { - if (pTemp->isAlive()) - pTemp->ForcedDespawn(); - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - m_lGolemGUIDList.clear(); - } - - void ShatterGolem() - { - if (m_lGolemGUIDList.empty()) - return; - - for (std::list::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + void DespawnGolem() { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (m_lGolemGUIDList.empty()) + return; + + for (std::list::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) { - // only shatter brittle golems - if (pTemp->isAlive() && pTemp->GetEntry() == NPC_BRITTLE_GOLEM) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) { - pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SHATTER_N, SPELL_SHATTER_H), false); - GolemsShattered += 1; + if (pTemp->isAlive()) + pTemp->ForcedDespawn(); + } + } + + m_lGolemGUIDList.clear(); + } + + void ShatterGolem() + { + if (m_lGolemGUIDList.empty()) + return; + + for (std::list::const_iterator itr = m_lGolemGUIDList.begin(); itr != m_lGolemGUIDList.end(); ++itr) + { + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + { + // only shatter brittle golems + if (pTemp->isAlive() && pTemp->GetEntry() == NPC_BRITTLE_GOLEM) + { + pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SHATTER_N, SPELL_SHATTER_H), false); + GolemsShattered += 1; + } } } } - } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_TEMPER_DUMMY) - m_bIsStriking = true; - } - - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) { - m_lGolemGUIDList.push_back(pSummoned->GetGUID()); - - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - - //why healing when just summoned? - pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_HEAT_N, SPELL_HEAT_H), false, NULL, NULL, me->GetGUID()); + if (pSpell->Id == SPELL_TEMPER_DUMMY) + m_bIsStriking = true; } - } - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_bIsStriking) + void JustSummoned(Creature* pSummoned) { - if (m_uiPause_Timer <= uiDiff) + if (pSummoned->GetEntry() == NPC_MOLTEN_GOLEM) { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + m_lGolemGUIDList.push_back(pSummoned->GetGUID()); + + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); + + //why healing when just summoned? + pSummoned->CastSpell(pSummoned, DUNGEON_MODE(SPELL_HEAT_N, SPELL_HEAT_H), false, NULL, NULL, me->GetGUID()); + } + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_bIsStriking) + { + if (m_uiPause_Timer <= uiDiff) { - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + + m_bHasTemper = false; + m_bIsStriking = false; + m_uiPause_Timer = 3500; } + else + m_uiPause_Timer -= uiDiff; - m_bHasTemper = false; - m_bIsStriking = false; - m_uiPause_Timer = 3500; + return; } - else - m_uiPause_Timer -= uiDiff; - return; - } - - // When to start shatter? After 60, 40 or 20% hp? - if (!m_bHasTemper && m_uiHealthAmountModifier >= 3) - { - if (m_uiShatteringStomp_Timer <= uiDiff) + // When to start shatter? After 60, 40 or 20% hp? + if (!m_bHasTemper && m_uiHealthAmountModifier >= 3) { - //should he stomp even if he has no brittle golem to shatter? + if (m_uiShatteringStomp_Timer <= uiDiff) + { + //should he stomp even if he has no brittle golem to shatter? - DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2), me); + DoScriptText(RAND(SAY_STOMP_1,SAY_STOMP_2), me); - DoCast(me, SPELL_SHATTERING_STOMP_N); + DoCast(me, SPELL_SHATTERING_STOMP_N); - DoScriptText(EMOTE_SHATTER, me); + DoScriptText(EMOTE_SHATTER, me); - m_uiShatteringStomp_Timer = 30000; - m_bCanShatterGolem = true; + m_uiShatteringStomp_Timer = 30000; + m_bCanShatterGolem = true; + } + else + m_uiShatteringStomp_Timer -= uiDiff; } - else - m_uiShatteringStomp_Timer -= uiDiff; - } - // Shatter Golems 3 seconds after Shattering Stomp - if (m_bCanShatterGolem) - { - if (m_uiShatter_Timer <= uiDiff) + // Shatter Golems 3 seconds after Shattering Stomp + if (m_bCanShatterGolem) { - ShatterGolem(); - m_uiShatter_Timer = 3000; - m_bCanShatterGolem = false; + if (m_uiShatter_Timer <= uiDiff) + { + ShatterGolem(); + m_uiShatter_Timer = 3000; + m_bCanShatterGolem = false; + } + else + m_uiShatter_Timer -= uiDiff; } - else - m_uiShatter_Timer -= uiDiff; + + // Health check + if (!m_bCanShatterGolem && (me->GetHealth()*100 / me->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) + { + ++m_uiHealthAmountModifier; + + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoScriptText(RAND(SAY_FORGE_1,SAY_FORGE_2), me); + + m_bHasTemper = true; + + DoCast(me, SPELL_TEMPER, false); + } + + DoMeleeAttackIfReady(); } + }; - // Health check - if (!m_bCanShatterGolem && (me->GetHealth()*100 / me->GetMaxHealth()) < (100-(20*m_uiHealthAmountModifier))) - { - ++m_uiHealthAmountModifier; - - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - DoScriptText(RAND(SAY_FORGE_1,SAY_FORGE_2), me); - - m_bHasTemper = true; - - DoCast(me, SPELL_TEMPER, false); - } - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_volkhan(Creature* pCreature) -{ - return new boss_volkhanAI(pCreature); -} -bool EffectDummyCreature_boss_volkhan(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) -{ - //always check spellid and effectindex - if (uiSpellId == SPELL_TEMPER_DUMMY && uiEffIndex == 0) - { - if (pCaster->GetEntry() != NPC_VOLKHAN_ANVIL || pCreatureTarget->GetEntry() != NPC_VOLKHAN) - return true; - - for (uint8 i = 0; i < MAX_GOLEM; ++i) - { - pCreatureTarget->CastSpell(pCaster, SPELL_SUMMON_MOLTEN_GOLEM, true); - } - - //always return true when we are handling this spell and effect - return true; - } - - return false; -} /*###### ## npc_volkhan_anvil ######*/ - -bool EffectDummyCreature_npc_volkhan_anvil(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) + class npc_volkhan_anvil : public CreatureScript { - //always check spellid and effectindex - if (uiSpellId == SPELL_TEMPER && uiEffIndex == 0) +public: + npc_volkhan_anvil() : CreatureScript("npc_volkhan_anvil") { } + + bool EffectDummyCreature(Unit* pCaster, uint32 uiSpellId, uint32 uiEffIndex, Creature* pCreatureTarget) { - if (pCaster->GetEntry() != NPC_VOLKHAN || pCreatureTarget->GetEntry() != NPC_VOLKHAN_ANVIL) + //always check spellid and effectindex + if (uiSpellId == SPELL_TEMPER && uiEffIndex == 0) + { + if (pCaster->GetEntry() != NPC_VOLKHAN || pCreatureTarget->GetEntry() != NPC_VOLKHAN_ANVIL) + return true; + + Creature *cre = CAST_CRE(pCaster); + + DoScriptText(EMOTE_TO_ANVIL, pCaster); + + float fX, fY, fZ; + pCreatureTarget->GetContactPoint(pCaster, fX, fY, fZ, INTERACTION_DISTANCE); + + pCaster->AttackStop(); + + if (pCaster->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + pCaster->GetMotionMaster()->MovementExpired(); + + cre->GetMap()->CreatureRelocation(cre, fX, fY, fZ, pCreatureTarget->GetOrientation()); + cre->SendMonsterMove(fX, fY, fZ, 0, cre->GetUnitMovementFlags(), 1); + + pCreatureTarget->CastSpell(pCaster, SPELL_TEMPER_DUMMY, false); + + //always return true when we are handling this spell and effect return true; + } - Creature *cre = CAST_CRE(pCaster); - - DoScriptText(EMOTE_TO_ANVIL, pCaster); - - float fX, fY, fZ; - pCreatureTarget->GetContactPoint(pCaster, fX, fY, fZ, INTERACTION_DISTANCE); - - pCaster->AttackStop(); - - if (pCaster->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - pCaster->GetMotionMaster()->MovementExpired(); - - cre->GetMap()->CreatureRelocation(cre, fX, fY, fZ, pCreatureTarget->GetOrientation()); - cre->SendMonsterMove(fX, fY, fZ, 0, cre->GetUnitMovementFlags(), 1); - - pCreatureTarget->CastSpell(pCaster, SPELL_TEMPER_DUMMY, false); - - //always return true when we are handling this spell and effect - return true; + return false; } - return false; -} +}; /*###### ## mob_molten_golem ######*/ - -struct mob_molten_golemAI : public ScriptedAI + class mob_molten_golem : public CreatureScript { - mob_molten_golemAI(Creature *pCreature) : ScriptedAI(pCreature) +public: + mob_molten_golem() : CreatureScript("mob_molten_golem") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_molten_golemAI(pCreature); } - bool m_bIsFrozen; - - uint32 m_uiBlast_Timer; - uint32 m_uiDeathDelay_Timer; - uint32 m_uiImmolation_Timer; - - void Reset() + struct mob_molten_golemAI : public ScriptedAI { - m_bIsFrozen = false; - - m_uiBlast_Timer = 20000; - m_uiDeathDelay_Timer = 0; - m_uiImmolation_Timer = 5000; - } - - void AttackStart(Unit* pWho) - { - if (me->Attack(pWho, true)) + mob_molten_golemAI(Creature *pCreature) : ScriptedAI(pCreature) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - - if (!m_bIsFrozen) - me->GetMotionMaster()->MoveChase(pWho); } - } - void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth()) + bool m_bIsFrozen; + + uint32 m_uiBlast_Timer; + uint32 m_uiDeathDelay_Timer; + uint32 m_uiImmolation_Timer; + + void Reset() { - me->UpdateEntry(NPC_BRITTLE_GOLEM); - me->SetHealth(1); - uiDamage = 0; - me->RemoveAllAuras(); - me->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - m_bIsFrozen = true; - } - } + m_bIsFrozen = false; - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - //this is the dummy effect of the spells - if (pSpell->Id == SPELL_SHATTER_N || pSpell->Id == SPELL_SHATTER_H) - { - if (me->GetEntry() == NPC_BRITTLE_GOLEM) - me->ForcedDespawn(); - } - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target or if we are frozen - if (!UpdateVictim() || m_bIsFrozen) - return; - - if (m_uiBlast_Timer <= uiDiff) - { - DoCast(me, SPELL_BLAST_WAVE); m_uiBlast_Timer = 20000; - } - else - m_uiBlast_Timer -= uiDiff; - - if (m_uiImmolation_Timer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_IMMOLATION_STRIKE_N); + m_uiDeathDelay_Timer = 0; m_uiImmolation_Timer = 5000; } - else - m_uiImmolation_Timer -= uiDiff; - DoMeleeAttackIfReady(); - } + void AttackStart(Unit* pWho) + { + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + if (!m_bIsFrozen) + me->GetMotionMaster()->MoveChase(pWho); + } + } + + void DamageTaken(Unit* /*pDoneBy*/, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth()) + { + me->UpdateEntry(NPC_BRITTLE_GOLEM); + me->SetHealth(1); + uiDamage = 0; + me->RemoveAllAuras(); + me->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + m_bIsFrozen = true; + } + } + + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + //this is the dummy effect of the spells + if (pSpell->Id == SPELL_SHATTER_N || pSpell->Id == SPELL_SHATTER_H) + { + if (me->GetEntry() == NPC_BRITTLE_GOLEM) + me->ForcedDespawn(); + } + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target or if we are frozen + if (!UpdateVictim() || m_bIsFrozen) + return; + + if (m_uiBlast_Timer <= uiDiff) + { + DoCast(me, SPELL_BLAST_WAVE); + m_uiBlast_Timer = 20000; + } + else + m_uiBlast_Timer -= uiDiff; + + if (m_uiImmolation_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_IMMOLATION_STRIKE_N); + m_uiImmolation_Timer = 5000; + } + else + m_uiImmolation_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_molten_golem(Creature* pCreature) -{ - return new mob_molten_golemAI(pCreature); -} void AddSC_boss_volkhan() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_volkhan"; - newscript->GetAI = &GetAI_boss_volkhan; - newscript->pEffectDummyCreature = &EffectDummyCreature_boss_volkhan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_volkhan_anvil"; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_volkhan_anvil; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_molten_golem"; - newscript->GetAI = &GetAI_mob_molten_golem; - newscript->RegisterSelf(); + new boss_volkhan(); + new npc_volkhan_anvil(); + new mob_molten_golem(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index 8dbcf8da23f..3dda1e0c77a 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -32,219 +32,222 @@ EndScriptData */ 2 - Ionar 3 - Loken */ - -struct instance_halls_of_lightning : public ScriptedInstance + class instance_halls_of_lightning : public InstanceMapScript { - instance_halls_of_lightning(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_halls_of_lightning() : InstanceMapScript("instance_halls_of_lightning") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 m_uiGeneralBjarngrimGUID; - uint64 m_uiIonarGUID; - uint64 m_uiLokenGUID; - uint64 m_uiVolkhanGUID; - - uint64 m_uiBjarngrimDoorGUID; - uint64 m_uiVolkhanDoorGUID; - uint64 m_uiIonarDoorGUID; - uint64 m_uiLokenDoorGUID; - uint64 m_uiLokenGlobeGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiGeneralBjarngrimGUID = 0; - m_uiVolkhanGUID = 0; - m_uiIonarGUID = 0; - m_uiLokenGUID = 0; - - m_uiBjarngrimDoorGUID = 0; - m_uiVolkhanDoorGUID = 0; - m_uiIonarDoorGUID = 0; - m_uiLokenDoorGUID = 0; - m_uiLokenGlobeGUID = 0; + return new instance_halls_of_lightning_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_halls_of_lightning_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) - { - case NPC_BJARNGRIM: - m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); - break; - case NPC_VOLKHAN: - m_uiVolkhanGUID = pCreature->GetGUID(); - break; - case NPC_IONAR: - m_uiIonarGUID = pCreature->GetGUID(); - break; - case NPC_LOKEN: - m_uiLokenGUID = pCreature->GetGUID(); - break; - } - } + instance_halls_of_lightning_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_BJARNGRIM_DOOR: - m_uiBjarngrimDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_VOLKHAN_DOOR: - m_uiVolkhanDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_IONAR_DOOR: - m_uiIonarDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_LOKEN_DOOR: - m_uiLokenDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_LOKEN_THRONE: - m_uiLokenGlobeGUID = pGo->GetGUID(); - break; - } - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) - { - case TYPE_BJARNGRIM: - if (uiData == DONE) - DoUseDoorOrButton(m_uiBjarngrimDoorGUID); - m_auiEncounter[0] = uiData; - break; - case TYPE_VOLKHAN: - if (uiData == DONE) - DoUseDoorOrButton(m_uiVolkhanDoorGUID); - m_auiEncounter[1] = uiData; - break; - case TYPE_IONAR: - if (uiData == DONE) - DoUseDoorOrButton(m_uiIonarDoorGUID); - m_auiEncounter[2] = uiData; - break; - case TYPE_LOKEN: - if (uiData == DONE) - { - DoUseDoorOrButton(m_uiLokenDoorGUID); + uint64 m_uiGeneralBjarngrimGUID; + uint64 m_uiIonarGUID; + uint64 m_uiLokenGUID; + uint64 m_uiVolkhanGUID; - //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder - if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) - pGlobe->SetGoState(GO_STATE_ACTIVE); - } - m_auiEncounter[3] = uiData; - break; + uint64 m_uiBjarngrimDoorGUID; + uint64 m_uiVolkhanDoorGUID; + uint64 m_uiIonarDoorGUID; + uint64 m_uiLokenDoorGUID; + uint64 m_uiLokenGlobeGUID; + + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiGeneralBjarngrimGUID = 0; + m_uiVolkhanGUID = 0; + m_uiIonarGUID = 0; + m_uiLokenGUID = 0; + + m_uiBjarngrimDoorGUID = 0; + m_uiVolkhanDoorGUID = 0; + m_uiIonarDoorGUID = 0; + m_uiLokenDoorGUID = 0; + m_uiLokenGlobeGUID = 0; } - if (uiData == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 uiType) - { - switch(uiType) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case TYPE_BJARNGRIM: - return m_auiEncounter[0]; - case TYPE_VOLKHAN: - return m_auiEncounter[1]; - case TYPE_IONAR: - return m_auiEncounter[2]; - case TYPE_LOKEN: - return m_auiEncounter[3]; - } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) - { - case DATA_BJARNGRIM: - return m_uiGeneralBjarngrimGUID; - case DATA_VOLKHAN: - return m_uiVolkhanGUID; - case DATA_IONAR: - return m_uiIonarGUID; - case DATA_LOKEN: - return m_uiLokenGUID; - } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H L " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + switch(pCreature->GetEntry()) + { + case NPC_BJARNGRIM: + m_uiGeneralBjarngrimGUID = pCreature->GetGUID(); + break; + case NPC_VOLKHAN: + m_uiVolkhanGUID = pCreature->GetGUID(); + break; + case NPC_IONAR: + m_uiIonarGUID = pCreature->GetGUID(); + break; + case NPC_LOKEN: + m_uiLokenGUID = pCreature->GetGUID(); + break; + } } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - - if (dataHead1 == 'H' && dataHead2 == 'L') + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + switch(pGo->GetEntry()) + { + case GO_BJARNGRIM_DOOR: + m_uiBjarngrimDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_VOLKHAN_DOOR: + m_uiVolkhanDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_IONAR_DOOR: + m_uiIonarDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_LOKEN_DOOR: + m_uiLokenDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_LOKEN_THRONE: + m_uiLokenGlobeGUID = pGo->GetGUID(); + break; + } + } - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_BJARNGRIM: + if (uiData == DONE) + DoUseDoorOrButton(m_uiBjarngrimDoorGUID); + m_auiEncounter[0] = uiData; + break; + case TYPE_VOLKHAN: + if (uiData == DONE) + DoUseDoorOrButton(m_uiVolkhanDoorGUID); + m_auiEncounter[1] = uiData; + break; + case TYPE_IONAR: + if (uiData == DONE) + DoUseDoorOrButton(m_uiIonarDoorGUID); + m_auiEncounter[2] = uiData; + break; + case TYPE_LOKEN: + if (uiData == DONE) + { + DoUseDoorOrButton(m_uiLokenDoorGUID); + + //Appears to be type 5 GO with animation. Need to figure out how this work, code below only placeholder + if (GameObject* pGlobe = instance->GetGameObject(m_uiLokenGlobeGUID)) + pGlobe->SetGoState(GO_STATE_ACTIVE); + } + m_auiEncounter[3] = uiData; + break; + } + + if (uiData == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 uiType) + { + switch(uiType) + { + case TYPE_BJARNGRIM: + return m_auiEncounter[0]; + case TYPE_VOLKHAN: + return m_auiEncounter[1]; + case TYPE_IONAR: + return m_auiEncounter[2]; + case TYPE_LOKEN: + return m_auiEncounter[3]; + } + return 0; + } + + uint64 GetData64(uint32 uiData) + { + switch(uiData) + { + case DATA_BJARNGRIM: + return m_uiGeneralBjarngrimGUID; + case DATA_VOLKHAN: + return m_uiVolkhanGUID; + case DATA_IONAR: + return m_uiIonarGUID; + case DATA_LOKEN: + return m_uiLokenGUID; + } + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "H L " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3]; + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + + if (dataHead1 == 'H' && dataHead2 == 'L') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_halls_of_lightning(Map* pMap) -{ - return new instance_halls_of_lightning(pMap); -} void AddSC_instance_halls_of_lightning() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_lightning"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_lightning; - newscript->RegisterSelf(); + new instance_halls_of_lightning(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index 63b1de56c38..3c61b2f4abc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -51,143 +51,145 @@ enum Yells SAY_DEATH = -1599009, SAY_SHATTER = -1599010 }; - -struct boss_krystallusAI : public ScriptedAI + class boss_krystallus : public CreatureScript { - boss_krystallusAI(Creature *c) : ScriptedAI(c) +public: + boss_krystallus() : CreatureScript("boss_krystallus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_krystallusAI (pCreature); } - uint32 uiBoulderTossTimer; - uint32 uiGroundSpikeTimer; - uint32 uiGroundSlamTimer; - uint32 uiShatterTimer; - uint32 uiStompTimer; - - bool bIsSlam; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_krystallusAI : public ScriptedAI { - bIsSlam = false; - - uiBoulderTossTimer = 3000 + rand()%6000; - uiGroundSpikeTimer = 9000 + rand()%5000; - uiGroundSlamTimer = 15000 + rand()%3000; - uiStompTimer = 20000 + rand()%9000; - uiShatterTimer = 0; - - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, NOT_STARTED); - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiBoulderTossTimer <= diff) + boss_krystallusAI(Creature *c) : ScriptedAI(c) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BOULDER_TOSS); - uiBoulderTossTimer = 9000 + rand()%6000; - } else uiBoulderTossTimer -= diff; - - if (uiGroundSpikeTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_GROUND_SPIKE); - uiGroundSpikeTimer = 12000 + rand()%5000; - } else uiGroundSpikeTimer -= diff; - - if (uiStompTimer <= diff) - { - DoCast(me, SPELL_STOMP); - uiStompTimer = 20000 + rand()%9000; - } else uiStompTimer -= diff; - - if (uiGroundSlamTimer <= diff) - { - DoCast(me, SPELL_GROUND_SLAM); - bIsSlam = true; - uiShatterTimer = 10000; - uiGroundSlamTimer = 15000 + rand()%3000; - } else uiGroundSlamTimer -= diff; - - if (bIsSlam) - { - if (uiShatterTimer <= diff) - { - DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER)); - } else uiShatterTimer -= diff; + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + uint32 uiBoulderTossTimer; + uint32 uiGroundSpikeTimer; + uint32 uiGroundSlamTimer; + uint32 uiShatterTimer; + uint32 uiStompTimer; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + bool bIsSlam; - if (pInstance) - pInstance->SetData(DATA_KRYSTALLUS_EVENT, DONE); - } + InstanceScript* pInstance; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(SAY_KILL, me); - } - - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - //this part should be in the core - if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) + void Reset() { - //this spell must have custom handling in the core, dealing damage based on distance - pTarget->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); + bIsSlam = false; - if (pTarget->HasAura(SPELL_STONED)) - pTarget->RemoveAurasDueToSpell(SPELL_STONED); + uiBoulderTossTimer = 3000 + rand()%6000; + uiGroundSpikeTimer = 9000 + rand()%5000; + uiGroundSlamTimer = 15000 + rand()%3000; + uiStompTimer = 20000 + rand()%9000; + uiShatterTimer = 0; + + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, NOT_STARTED); + } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiBoulderTossTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BOULDER_TOSS); + uiBoulderTossTimer = 9000 + rand()%6000; + } else uiBoulderTossTimer -= diff; + + if (uiGroundSpikeTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_GROUND_SPIKE); + uiGroundSpikeTimer = 12000 + rand()%5000; + } else uiGroundSpikeTimer -= diff; + + if (uiStompTimer <= diff) + { + DoCast(me, SPELL_STOMP); + uiStompTimer = 20000 + rand()%9000; + } else uiStompTimer -= diff; + + if (uiGroundSlamTimer <= diff) + { + DoCast(me, SPELL_GROUND_SLAM); + bIsSlam = true; + uiShatterTimer = 10000; + uiGroundSlamTimer = 15000 + rand()%3000; + } else uiGroundSlamTimer -= diff; - //clear this, if we are still performing if (bIsSlam) { - bIsSlam = false; - - //and correct movement, if not already - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + if (uiShatterTimer <= diff) { - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + DoCast(me, DUNGEON_MODE(SPELL_SHATTER, H_SPELL_SHATTER)); + } else uiShatterTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_KRYSTALLUS_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(SAY_KILL, me); + } + + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) + { + //this part should be in the core + if (pSpell->Id == SPELL_SHATTER || pSpell->Id == H_SPELL_SHATTER) + { + //this spell must have custom handling in the core, dealing damage based on distance + pTarget->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHATTER_EFFECT, H_SPELL_SHATTER_EFFECT), true); + + if (pTarget->HasAura(SPELL_STONED)) + pTarget->RemoveAurasDueToSpell(SPELL_STONED); + + //clear this, if we are still performing + if (bIsSlam) + { + bIsSlam = false; + + //and correct movement, if not already + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } } } } - } + }; + }; -CreatureAI* GetAI_boss_krystallus(Creature* pCreature) -{ - return new boss_krystallusAI (pCreature); -} void AddSC_boss_krystallus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_krystallus"; - newscript->GetAI = &GetAI_boss_krystallus; - newscript->RegisterSelf(); + new boss_krystallus(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp index e7fde3dcea7..6b14beb9881 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_maiden_of_grief.cpp @@ -55,129 +55,131 @@ enum Achievements { ACHIEV_GOOD_GRIEF_START_EVENT = 20383, }; - -struct boss_maiden_of_griefAI : public ScriptedAI + class boss_maiden_of_grief : public CreatureScript { - boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) +public: + boss_maiden_of_grief() : CreatureScript("boss_maiden_of_grief") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = me->GetInstanceData(); + return new boss_maiden_of_griefAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 PartingSorrowTimer; - uint32 StormOfGriefTimer; - uint32 ShockOfSorrowTimer; - uint32 PillarOfWoeTimer; - - void Reset() + struct boss_maiden_of_griefAI : public ScriptedAI { - PartingSorrowTimer = 25000 + rand()%5000; - StormOfGriefTimer = 10000; - ShockOfSorrowTimer = 20000+rand()%5000; - PillarOfWoeTimer = 5000 + rand()%10000; - - if (pInstance) + boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); - pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + pInstance = me->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + InstanceScript* pInstance; - if (pInstance) + uint32 PartingSorrowTimer; + uint32 StormOfGriefTimer; + uint32 ShockOfSorrowTimer; + uint32 PillarOfWoeTimer; + + void Reset() { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAIDEN_DOOR))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } + PartingSorrowTimer = 25000 + rand()%5000; + StormOfGriefTimer = 10000; + ShockOfSorrowTimer = 20000+rand()%5000; + PillarOfWoeTimer = 5000 + rand()%10000; - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); - pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (IsHeroic()) - { - if (PartingSorrowTimer <= diff) + if (pInstance) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, NOT_STARTED); + pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + } + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAIDEN_DOOR))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, IN_PROGRESS); + pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_GOOD_GRIEF_START_EVENT); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (IsHeroic()) + { + if (PartingSorrowTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + + if (pTarget) + DoCast(pTarget, SPELL_PARTING_SORROW); + + PartingSorrowTimer = 30000 + rand()%10000; + } else PartingSorrowTimer -= diff; + } + + if (StormOfGriefTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STORM_OF_GRIEF_N, true); + StormOfGriefTimer = 15000 + rand()%5000; + } else StormOfGriefTimer -= diff; + + if (ShockOfSorrowTimer <= diff) + { + DoResetThreat(); + DoScriptText(SAY_STUN, me); + DoCast(me, SPELL_SHOCK_OF_SORROW_N); + ShockOfSorrowTimer = 20000 + rand()%10000; + } else ShockOfSorrowTimer -= diff; + + if (PillarOfWoeTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); if (pTarget) - DoCast(pTarget, SPELL_PARTING_SORROW); + DoCast(pTarget, SPELL_PILLAR_OF_WOE_N); + else + DoCast(me->getVictim(), SPELL_PILLAR_OF_WOE_N); - PartingSorrowTimer = 30000 + rand()%10000; - } else PartingSorrowTimer -= diff; + PillarOfWoeTimer = 5000 + rand()%20000; + } else PillarOfWoeTimer -= diff; + + DoMeleeAttackIfReady(); } - if (StormOfGriefTimer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_STORM_OF_GRIEF_N, true); - StormOfGriefTimer = 15000 + rand()%5000; - } else StormOfGriefTimer -= diff; + DoScriptText(SAY_DEATH, me); - if (ShockOfSorrowTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); + } + + void KilledUnit(Unit * victim) { - DoResetThreat(); - DoScriptText(SAY_STUN, me); - DoCast(me, SPELL_SHOCK_OF_SORROW_N); - ShockOfSorrowTimer = 20000 + rand()%10000; - } else ShockOfSorrowTimer -= diff; + if (victim == me) + return; - if (PillarOfWoeTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } + }; - if (pTarget) - DoCast(pTarget, SPELL_PILLAR_OF_WOE_N); - else - DoCast(me->getVictim(), SPELL_PILLAR_OF_WOE_N); - - PillarOfWoeTimer = 5000 + rand()%20000; - } else PillarOfWoeTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_MAIDEN_OF_GRIEF_EVENT, DONE); - } - - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } }; -CreatureAI* GetAI_boss_maiden_of_grief(Creature* pCreature) -{ - return new boss_maiden_of_griefAI (pCreature); -} void AddSC_boss_maiden_of_grief() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_maiden_of_grief"; - newscript->GetAI = &GetAI_boss_maiden_of_grief; - newscript->RegisterSelf(); + new boss_maiden_of_grief(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 1cab83db949..0bdc8ace4de 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -81,237 +81,245 @@ static Locations PipeLocations[] = }; static Locations CenterPoint = {1295.21, 667.157, 189.691}; - -struct boss_sjonnirAI : public ScriptedAI + class boss_sjonnir : public CreatureScript { - boss_sjonnirAI(Creature *c) : ScriptedAI(c), lSummons(me) +public: + boss_sjonnir() : CreatureScript("boss_sjonnir") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_sjonnirAI (pCreature); } - bool bIsFrenzy; - - uint32 uiChainLightningTimer; - uint32 uiLightningShieldTimer; - uint32 uiStaticChargeTimer; - uint32 uiLightningRingTimer; - uint32 uiSummonTimer; - uint32 uiFrenzyTimer; - uint32 uiEncounterTimer; - uint32 uiKilledIronSludges; - - SummonList lSummons; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_sjonnirAI : public ScriptedAI { - bIsFrenzy = false; - - uiEncounterTimer = 0; - uiChainLightningTimer = 3000 + rand()%5000; - uiLightningShieldTimer = 20000 + rand()%5000; - uiStaticChargeTimer = 20000 + rand()%5000; - uiLightningRingTimer = 30000 + rand()%5000; - uiSummonTimer = 5000; - uiFrenzyTimer = 300000; //5 minutes - uiKilledIronSludges = 0; - - lSummons.DespawnAll(); - - if (pInstance) - pInstance->SetData(DATA_SJONNIR_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - uiEncounterTimer = 0; - - if (pInstance) + boss_sjonnirAI(Creature *c) : ScriptedAI(c), lSummons(me) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SJONNIR_DOOR))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - - pInstance->SetData(DATA_SJONNIR_EVENT, IN_PROGRESS); - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiChainLightningTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CHAIN_LIGHTING); - uiChainLightningTimer = 10000 + rand()%5000; - } else uiChainLightningTimer -= diff; - - if (uiLightningShieldTimer <= diff) - { - DoCast(me, SPELL_LIGHTING_SHIELD); - uiLightningShieldTimer -= diff; + pInstance = c->GetInstanceScript(); } - if (uiStaticChargeTimer <= diff) + bool bIsFrenzy; + + uint32 uiChainLightningTimer; + uint32 uiLightningShieldTimer; + uint32 uiStaticChargeTimer; + uint32 uiLightningRingTimer; + uint32 uiSummonTimer; + uint32 uiFrenzyTimer; + uint32 uiEncounterTimer; + uint32 uiKilledIronSludges; + + SummonList lSummons; + + InstanceScript* pInstance; + + void Reset() { - DoCast(me->getVictim(), SPELL_STATIC_CHARGE); + bIsFrenzy = false; + + uiEncounterTimer = 0; + uiChainLightningTimer = 3000 + rand()%5000; + uiLightningShieldTimer = 20000 + rand()%5000; uiStaticChargeTimer = 20000 + rand()%5000; - } uiStaticChargeTimer -= diff; - - if (uiLightningRingTimer <= diff) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_LIGHTING_RING); uiLightningRingTimer = 30000 + rand()%5000; - } else uiLightningRingTimer -= diff; + uiSummonTimer = 5000; + uiFrenzyTimer = 300000; //5 minutes + uiKilledIronSludges = 0; - if (uiSummonTimer <= diff) - { - uint32 uiSummonPipe = rand()%2; - me->SummonCreature(uiEncounterTimer > DATA_TIME_BEFORE_OOZE ? CREATURE_MALFORMED_OOZE : - RAND(CREATURE_FORGED_IRON_DWARF,CREATURE_FORGED_IRON_TROGG), - PipeLocations[uiSummonPipe].x, PipeLocations[uiSummonPipe].y, PipeLocations[uiSummonPipe].z, 0.0f, - TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - uiSummonTimer = 20000; - } else uiSummonTimer -= diff; + lSummons.DespawnAll(); - if (!bIsFrenzy) - { - if (uiFrenzyTimer <= diff) - { - DoCast(me, SPELL_FRENZY); - bIsFrenzy = true; - } - else uiFrenzyTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_SJONNIR_EVENT, NOT_STARTED); } - uiEncounterTimer +=diff; - - DoMeleeAttackIfReady(); - } - - void JustSummoned(Creature* summon) - { - summon->GetMotionMaster()->MovePoint(0, CenterPoint.x, CenterPoint.y, CenterPoint.z); - /*if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - summon->AI()->AttackStart(pTarget);*/ - lSummons.Summon(summon); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - lSummons.DespawnAll(); - - if (pInstance) + void EnterCombat(Unit* /*who*/) { - pInstance->SetData(DATA_SJONNIR_EVENT, DONE); - if (IsHeroic() && uiKilledIronSludges > 4) - pInstance->DoCompleteAchievement(ACHIEV_ABUSE_THE_OOZE); - } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + DoScriptText(SAY_AGGRO, me); - void KilledIronSludge() - { - ++uiKilledIronSludges; - } -}; + uiEncounterTimer = 0; -CreatureAI* GetAI_boss_sjonnir(Creature* pCreature) -{ - return new boss_sjonnirAI (pCreature); -} - -struct mob_malformed_oozeAI : public ScriptedAI -{ - mob_malformed_oozeAI(Creature *c) : ScriptedAI(c) {} - - uint32 uiMergeTimer; - - void Reset() - { - uiMergeTimer = 10000; - } - - void UpdateAI(const uint32 diff) - { - if (uiMergeTimer <= diff) - { - if (Creature* pTemp = me->FindNearestCreature(CREATURE_MALFORMED_OOZE, 3.0f, true)) + if (pInstance) { - DoSpawnCreature(CREATURE_IRON_SLUDGE, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); - pTemp->DisappearAndDie(); - me->DisappearAndDie(); + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SJONNIR_DOOR))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + + pInstance->SetData(DATA_SJONNIR_EVENT, IN_PROGRESS); } - uiMergeTimer = 3000; - } else uiMergeTimer -= diff; + } - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiChainLightningTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CHAIN_LIGHTING); + uiChainLightningTimer = 10000 + rand()%5000; + } else uiChainLightningTimer -= diff; + + if (uiLightningShieldTimer <= diff) + { + DoCast(me, SPELL_LIGHTING_SHIELD); + uiLightningShieldTimer -= diff; + } + + if (uiStaticChargeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STATIC_CHARGE); + uiStaticChargeTimer = 20000 + rand()%5000; + } uiStaticChargeTimer -= diff; + + if (uiLightningRingTimer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_LIGHTING_RING); + uiLightningRingTimer = 30000 + rand()%5000; + } else uiLightningRingTimer -= diff; + + if (uiSummonTimer <= diff) + { + uint32 uiSummonPipe = rand()%2; + me->SummonCreature(uiEncounterTimer > DATA_TIME_BEFORE_OOZE ? CREATURE_MALFORMED_OOZE : + RAND(CREATURE_FORGED_IRON_DWARF,CREATURE_FORGED_IRON_TROGG), + PipeLocations[uiSummonPipe].x, PipeLocations[uiSummonPipe].y, PipeLocations[uiSummonPipe].z, 0.0f, + TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + uiSummonTimer = 20000; + } else uiSummonTimer -= diff; + + if (!bIsFrenzy) + { + if (uiFrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + bIsFrenzy = true; + } + else uiFrenzyTimer -= diff; + } + + uiEncounterTimer +=diff; + + DoMeleeAttackIfReady(); + } + + void JustSummoned(Creature* summon) + { + summon->GetMotionMaster()->MovePoint(0, CenterPoint.x, CenterPoint.y, CenterPoint.z); + /*if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + summon->AI()->AttackStart(pTarget);*/ + lSummons.Summon(summon); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + lSummons.DespawnAll(); + + if (pInstance) + { + pInstance->SetData(DATA_SJONNIR_EVENT, DONE); + if (IsHeroic() && uiKilledIronSludges > 4) + pInstance->DoCompleteAchievement(ACHIEV_ABUSE_THE_OOZE); + } + } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void KilledIronSludge() + { + ++uiKilledIronSludges; + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_malformed_ooze(Creature* pCreature) + class mob_malformed_ooze : public CreatureScript { - return new mob_malformed_oozeAI(pCreature); -} +public: + mob_malformed_ooze() : CreatureScript("mob_malformed_ooze") { } -struct mob_iron_sludgeAI : public ScriptedAI -{ - mob_iron_sludgeAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_malformed_oozeAI(pCreature); } - ScriptedInstance* pInstance; - - void JustDied(Unit* /*pKiller*/) + struct mob_malformed_oozeAI : public ScriptedAI { - if (pInstance) - if (Creature* pSjonnir = Unit::GetCreature(*me, pInstance->GetData64(DATA_SJONNIR))) - CAST_AI(boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); - } + mob_malformed_oozeAI(Creature *c) : ScriptedAI(c) {} + + uint32 uiMergeTimer; + + void Reset() + { + uiMergeTimer = 10000; + } + + void UpdateAI(const uint32 diff) + { + if (uiMergeTimer <= diff) + { + if (Creature* pTemp = me->FindNearestCreature(CREATURE_MALFORMED_OOZE, 3.0f, true)) + { + DoSpawnCreature(CREATURE_IRON_SLUDGE, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); + pTemp->DisappearAndDie(); + me->DisappearAndDie(); + } + uiMergeTimer = 3000; + } else uiMergeTimer -= diff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_iron_sludge(Creature* pCreature) + class mob_iron_sludge : public CreatureScript { - return new mob_iron_sludgeAI(pCreature); -} +public: + mob_iron_sludge() : CreatureScript("mob_iron_sludge") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_iron_sludgeAI(pCreature); + } + + struct mob_iron_sludgeAI : public ScriptedAI + { + mob_iron_sludgeAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + if (Creature* pSjonnir = Unit::GetCreature(*me, pInstance->GetData64(DATA_SJONNIR))) + CAST_AI(boss_sjonnir::boss_sjonnirAI, pSjonnir->AI())->KilledIronSludge(); + } + }; + +}; + void AddSC_boss_sjonnir() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_sjonnir"; - newscript->GetAI = &GetAI_boss_sjonnir; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_malformed_ooze"; - newscript->GetAI = &GetAI_mob_malformed_ooze; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_iron_sludge"; - newscript->GetAI = &GetAI_mob_iron_sludge; - newscript->RegisterSelf(); + new boss_sjonnir(); + new mob_malformed_ooze(); + new mob_iron_sludge(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp index d7e7f495cfb..a358b99d269 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.cpp @@ -131,611 +131,616 @@ static Position SpawnLocations[]= {946.992, 397.016, 208.374}, {960.748, 382.944, 208.374}, }; - -struct mob_tribuna_controllerAI : public ScriptedAI + class mob_tribuna_controller : public CreatureScript { - mob_tribuna_controllerAI(Creature *c) : ScriptedAI(c) +public: + mob_tribuna_controller() : CreatureScript("mob_tribuna_controller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - SetCombatMovement(false); + return new mob_tribuna_controllerAI(pCreature); } - ScriptedInstance* pInstance; - - uint32 uiKaddrakEncounterTimer; - uint32 uiMarnakEncounterTimer; - uint32 uiAbedneumEncounterTimer; - - bool bKaddrakActivated; - bool bMarnakActivated; - bool bAbedneumActivated; - - std::list KaddrakGUIDList; - - void Reset() + struct mob_tribuna_controllerAI : public ScriptedAI { - uiKaddrakEncounterTimer = 1500; - uiMarnakEncounterTimer = 10000; - uiAbedneumEncounterTimer = 10000; - - bKaddrakActivated = false; - bMarnakActivated = false; - bAbedneumActivated = false; - - if (pInstance) + mob_tribuna_controllerAI(Creature *c) : ScriptedAI(c) { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + pInstance = c->GetInstanceScript(); + SetCombatMovement(false); } - KaddrakGUIDList.clear(); - } + InstanceScript* pInstance; - void UpdateFacesList() - { - /*GetCreatureListWithEntryInGrid(lKaddrakGUIDList, me, CREATURE_KADDRAK, 50.0f); - if (!lKaddrakGUIDList.empty()) + uint32 uiKaddrakEncounterTimer; + uint32 uiMarnakEncounterTimer; + uint32 uiAbedneumEncounterTimer; + + bool bKaddrakActivated; + bool bMarnakActivated; + bool bAbedneumActivated; + + std::list KaddrakGUIDList; + + void Reset() { - uint32 uiPositionCounter = 0; - for (std::list::const_iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) - { - if ((*itr)->isAlive()) - { - if (uiPositionCounter == 0) - { - (*itr)->GetMap()->CreatureRelocation((*itr), 927.265, 333.200, 218.780, (*itr)->GetOrientation()); - (*itr)->SendMonsterMove(927.265, 333.200, 218.780, 0, (*itr)->GetMovementFlags(), 1); - } - else - { - (*itr)->GetMap()->CreatureRelocation((*itr), 921.745, 328.076, 218.780, (*itr)->GetOrientation()); - (*itr)->SendMonsterMove(921.745, 328.076, 218.780, 0, (*itr)->GetMovementFlags(), 1); - } - } - ++uiPositionCounter; - } - }*/ - } + uiKaddrakEncounterTimer = 1500; + uiMarnakEncounterTimer = 10000; + uiAbedneumEncounterTimer = 10000; - void UpdateAI(const uint32 diff) - { - if (bKaddrakActivated) - { - if (uiKaddrakEncounterTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (!KaddrakGUIDList.empty()) - for (std::list::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) - { - if (Creature *pKaddrak = Unit::GetCreature(*me, *itr)) - { - if (pKaddrak->isAlive()) - pKaddrak->CastSpell(pTarget, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true); - } - } - uiKaddrakEncounterTimer = 1500; - } else uiKaddrakEncounterTimer -= diff; - } - if (bMarnakActivated) - { - if (uiMarnakEncounterTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - if (Creature* pSummon = me->SummonCreature(CREATURE_DARK_MATTER_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) - { - pSummon->SetDisplayId(11686); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_DARK_MATTER, H_SPELL_DARK_MATTER), true); - } - } - uiMarnakEncounterTimer = 30000 + rand()%1000; - } else uiMarnakEncounterTimer -= diff; - } - if (bAbedneumActivated) - { - if (uiAbedneumEncounterTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - if (Creature* pSummon = me->SummonCreature(CREATURE_SEARING_GAZE_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) - { - pSummon->SetDisplayId(11686); - pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_SEARING_GAZE, H_SPELL_SEARING_GAZE), true); - } - } - uiAbedneumEncounterTimer = 30000 + rand()%1000; - } else uiAbedneumEncounterTimer -= diff; - } - } -}; - -struct npc_brann_hosAI : public npc_escortAI -{ - npc_brann_hosAI(Creature *c) : npc_escortAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiStep; - uint32 uiPhaseTimer; - - uint64 uiControllerGUID; - std::list lDwarfGUIDList; - - ScriptedInstance* pInstance; - - bool bIsBattle; - bool bIsLowHP; - bool bHasBeenDamaged; - - void Reset() - { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - bIsLowHP = false; - bIsBattle = false; - bHasBeenDamaged = false; - uiStep = 0; - uiPhaseTimer = 0; - uiControllerGUID = 0; - - DespawnDwarf(); + bKaddrakActivated = false; + bMarnakActivated = false; + bAbedneumActivated = false; if (pInstance) - pInstance->SetData(DATA_BRANN_EVENT, NOT_STARTED); - } - } - - void DespawnDwarf() - { - if (lDwarfGUIDList.empty()) - return; - for (std::list::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) - { - Creature* pTemp = Unit::GetCreature(*me, pInstance ? (*itr) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->ForcedDespawn(); - } - lDwarfGUIDList.clear(); - } - - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) - { - case 7: - if (Creature* pCreature = GetClosestCreatureWithEntry(me, CREATURE_TRIBUNAL_OF_THE_AGES, 100.0f)) - { - if (!pCreature->isAlive()) - pCreature->Respawn(); - CAST_AI(mob_tribuna_controllerAI, pCreature->AI())->UpdateFacesList(); - uiControllerGUID = pCreature->GetGUID(); - } - break; - case 13: - DoScriptText(SAY_EVENT_INTRO_1, me); - SetEscortPaused(true); - JumpToNextStep(20000); - break; - case 17: - DoScriptText(SAY_EVENT_INTRO_2, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_TRIBUNAL_CONSOLE),true); - me->SetStandState(UNIT_STAND_STATE_KNEEL); - SetEscortPaused(true); - JumpToNextStep(8500); - break; - case 18: - SetEscortPaused(true); - break; - } - } - - void SpawnDwarf(uint32 uiType) - { - switch(uiType) - { - case 1: - { - uint32 uiSpawnNumber = DUNGEON_MODE(2,3); - for (uint8 i = 0; i < uiSpawnNumber; ++i) - me->SummonCreature(CREATURE_DARK_RUNE_PROTECTOR, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - } - case 2: - for (uint8 i = 0; i < 2; ++i) - me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - case 3: - me->SummonCreature(CREATURE_IRON_GOLEM_CUSTODIAN, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - break; - } - } - - void JustSummoned(Creature* pSummoned) - { - lDwarfGUIDList.push_back(pSummoned->GetGUID()); - pSummoned->AddThreat(me, 0.0f); - pSummoned->AI()->AttackStart(me); - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhaseTimer = uiTimer; - ++uiStep; - } - - void StartWP() - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetEscortPaused(false); - uiStep = 1; - Start(); - } - - void DamageTaken(Unit* /*done_by*/, uint32 & /*damage*/) - { - if (!bHasBeenDamaged) - bHasBeenDamaged = true; - } - - void UpdateEscortAI(const uint32 uiDiff) - { - if (uiPhaseTimer <= uiDiff) - { - switch(uiStep) { - case 1: - if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + } + + KaddrakGUIDList.clear(); + } + + void UpdateFacesList() + { + /*GetCreatureListWithEntryInGrid(lKaddrakGUIDList, me, CREATURE_KADDRAK, 50.0f); + if (!lKaddrakGUIDList.empty()) + { + uint32 uiPositionCounter = 0; + for (std::list::const_iterator itr = lKaddrakGUIDList.begin(); itr != lKaddrakGUIDList.end(); ++itr) + { + if ((*itr)->isAlive()) { - if (pInstance->GetData(DATA_BRANN_EVENT) != NOT_STARTED) - return; - pInstance->SetData(DATA_BRANN_EVENT, IN_PROGRESS); + if (uiPositionCounter == 0) + { + (*itr)->GetMap()->CreatureRelocation((*itr), 927.265, 333.200, 218.780, (*itr)->GetOrientation()); + (*itr)->SendMonsterMove(927.265, 333.200, 218.780, 0, (*itr)->GetMovementFlags(), 1); + } + else + { + (*itr)->GetMap()->CreatureRelocation((*itr), 921.745, 328.076, 218.780, (*itr)->GetOrientation()); + (*itr)->SendMonsterMove(921.745, 328.076, 218.780, 0, (*itr)->GetMovementFlags(), 1); + } } - bIsBattle = false; - DoScriptText(SAY_ESCORT_START, me); - SetRun(true); - JumpToNextStep(0); - break; - case 3: - SetEscortPaused(false); - JumpToNextStep(0); - break; - case 5: - if (pInstance) - if (Creature* pTemp = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))) - DoScriptText(SAY_EVENT_INTRO_3_ABED, pTemp); - JumpToNextStep(8500); - break; - case 6: - DoScriptText(SAY_EVENT_A_1, me); - JumpToNextStep(6500); - break; + ++uiPositionCounter; + } + }*/ + } + + void UpdateAI(const uint32 diff) + { + if (bKaddrakActivated) + { + if (uiKaddrakEncounterTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (!KaddrakGUIDList.empty()) + for (std::list::const_iterator itr = KaddrakGUIDList.begin(); itr != KaddrakGUIDList.end(); ++itr) + { + if (Creature *pKaddrak = Unit::GetCreature(*me, *itr)) + { + if (pKaddrak->isAlive()) + pKaddrak->CastSpell(pTarget, DUNGEON_MODE(SPELL_GLARE_OF_THE_TRIBUNAL, H_SPELL_GLARE_OF_THE_TRIBUNAL), true); + } + } + uiKaddrakEncounterTimer = 1500; + } else uiKaddrakEncounterTimer -= diff; + } + if (bMarnakActivated) + { + if (uiMarnakEncounterTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (Creature* pSummon = me->SummonCreature(CREATURE_DARK_MATTER_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + { + pSummon->SetDisplayId(11686); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_DARK_MATTER, H_SPELL_DARK_MATTER), true); + } + } + uiMarnakEncounterTimer = 30000 + rand()%1000; + } else uiMarnakEncounterTimer -= diff; + } + if (bAbedneumActivated) + { + if (uiAbedneumEncounterTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + if (Creature* pSummon = me->SummonCreature(CREATURE_SEARING_GAZE_TARGET, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 1000)) + { + pSummon->SetDisplayId(11686); + pSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pSummon->CastSpell(pTarget, DUNGEON_MODE(SPELL_SEARING_GAZE, H_SPELL_SEARING_GAZE), true); + } + } + uiAbedneumEncounterTimer = 30000 + rand()%1000; + } else uiAbedneumEncounterTimer -= diff; + } + } + }; + +}; + class npc_brann_hos : public CreatureScript +{ +public: + npc_brann_hos() : CreatureScript("npc_brann_hos") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_brann_hos::npc_brann_hosAI, pCreature->AI())->StartWP(); + } + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_brann_hosAI(pCreature); + } + + struct npc_brann_hosAI : public npc_escortAI + { + npc_brann_hosAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + } + + uint32 uiStep; + uint32 uiPhaseTimer; + + uint64 uiControllerGUID; + std::list lDwarfGUIDList; + + InstanceScript* pInstance; + + bool bIsBattle; + bool bIsLowHP; + bool bHasBeenDamaged; + + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + bIsLowHP = false; + bIsBattle = false; + bHasBeenDamaged = false; + uiStep = 0; + uiPhaseTimer = 0; + uiControllerGUID = 0; + + DespawnDwarf(); + + if (pInstance) + pInstance->SetData(DATA_BRANN_EVENT, NOT_STARTED); + } + } + + void DespawnDwarf() + { + if (lDwarfGUIDList.empty()) + return; + for (std::list::const_iterator itr = lDwarfGUIDList.begin(); itr != lDwarfGUIDList.end(); ++itr) + { + Creature* pTemp = Unit::GetCreature(*me, pInstance ? (*itr) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->ForcedDespawn(); + } + lDwarfGUIDList.clear(); + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { case 7: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_A_2_KADD, pTemp); - JumpToNextStep(12500); - break; - case 8: - DoScriptText(SAY_EVENT_A_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bKaddrakActivated = true; - JumpToNextStep(5000); - break; - case 9: - me->SetReactState(REACT_PASSIVE); - SpawnDwarf(1); - JumpToNextStep(20000); - break; - case 10: - DoScriptText(SAY_EVENT_B_1, me); - JumpToNextStep(6000); - break; - case 11: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_B_2_MARN, pTemp); - SpawnDwarf(1); - JumpToNextStep(20000); - break; - case 12: - DoScriptText(SAY_EVENT_B_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bMarnakActivated = true; - JumpToNextStep(10000); + if (Creature* pCreature = GetClosestCreatureWithEntry(me, CREATURE_TRIBUNAL_OF_THE_AGES, 100.0f)) + { + if (!pCreature->isAlive()) + pCreature->Respawn(); + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pCreature->AI())->UpdateFacesList(); + uiControllerGUID = pCreature->GetGUID(); + } break; case 13: - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 14: - SpawnDwarf(2); - JumpToNextStep(20000); - break; - case 15: - DoScriptText(SAY_EVENT_C_1, me); - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 16: - SpawnDwarf(2); + DoScriptText(SAY_EVENT_INTRO_1, me); + SetEscortPaused(true); JumpToNextStep(20000); break; case 17: + DoScriptText(SAY_EVENT_INTRO_2, me); if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_C_2_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(20000); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_TRIBUNAL_CONSOLE),true); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + SetEscortPaused(true); + JumpToNextStep(8500); break; case 18: - DoScriptText(SAY_EVENT_C_3, me); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - CAST_AI(mob_tribuna_controllerAI, pTemp->AI())->bAbedneumActivated = true; - JumpToNextStep(5000); - break; - case 19: - SpawnDwarf(2); - JumpToNextStep(10000); - break; - case 20: - SpawnDwarf(1); - JumpToNextStep(15000); - break; - case 21: - DoScriptText(SAY_EVENT_D_1, me); - SpawnDwarf(3); - JumpToNextStep(20000); - break; - case 22: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_D_2_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(5000); - break; - case 23: - SpawnDwarf(2); - JumpToNextStep(15000); - break; - case 24: - DoScriptText(SAY_EVENT_D_3, me); - SpawnDwarf(3); - JumpToNextStep(5000); - break; - case 25: - SpawnDwarf(1); - JumpToNextStep(5000); - break; - case 26: - SpawnDwarf(2); - JumpToNextStep(10000); - break; - case 27: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_D_4_ABED, pTemp); - SpawnDwarf(1); - JumpToNextStep(10000); - break; - case 28: - me->SetReactState(REACT_DEFENSIVE); - DoScriptText(SAY_EVENT_END_01, me); - me->SetStandState(UNIT_STAND_STATE_STAND); - if (pInstance) - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),true); - if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) - pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - bIsBattle = true; - SetEscortPaused(false); - JumpToNextStep(6500); - break; - case 29: - DoScriptText(SAY_EVENT_END_02, me); - if (pInstance) - { - pInstance->SetData(DATA_BRANN_EVENT, DONE); - - // Achievement criteria is with spell 59046 which does not exist. - // There is thus no way it can be given by casting the spell on the players. - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59046); - - if (!bHasBeenDamaged) - pInstance->DoCompleteAchievement(ACHIEV_BRANN_SPANKIN_NEW); - } - - JumpToNextStep(5500); - break; - case 30: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_03_ABED, pTemp); - JumpToNextStep(8500); - break; - case 31: - DoScriptText(SAY_EVENT_END_04, me); - JumpToNextStep(11500); - break; - case 32: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_05_ABED, pTemp); - JumpToNextStep(11500); - break; - case 33: - DoScriptText(SAY_EVENT_END_06, me); - JumpToNextStep(4500); - break; - case 34: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_07_ABED, pTemp); - JumpToNextStep(22500); - break; - case 35: - DoScriptText(SAY_EVENT_END_08, me); - JumpToNextStep(7500); - break; - case 36: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_09_KADD, pTemp); - JumpToNextStep(18500); - break; - case 37: - DoScriptText(SAY_EVENT_END_10, me); - JumpToNextStep(5500); - break; - case 38: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_11_KADD, pTemp); - JumpToNextStep(20500); - break; - case 39: - DoScriptText(SAY_EVENT_END_12, me); - JumpToNextStep(2500); - break; - case 40: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) - DoScriptText(SAY_EVENT_END_13_KADD, pTemp); - JumpToNextStep(19500); - break; - case 41: - DoScriptText(SAY_EVENT_END_14, me); - JumpToNextStep(10500); - break; - case 42: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_15_MARN, pTemp); - JumpToNextStep(6500); - break; - case 43: - DoScriptText(SAY_EVENT_END_16, me); - JumpToNextStep(6500); - break; - case 44: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_17_MARN, pTemp); - JumpToNextStep(25500); - break; - case 45: - DoScriptText(SAY_EVENT_END_18, me); - JumpToNextStep(23500); - break; - case 46: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) - DoScriptText(SAY_EVENT_END_19_MARN, pTemp); - JumpToNextStep(3500); - break; - case 47: - DoScriptText(SAY_EVENT_END_20, me); - JumpToNextStep(8500); - break; - case 48: - if (pInstance) - if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) - DoScriptText(SAY_EVENT_END_21_ABED, pTemp); - JumpToNextStep(5500); - break; - case 49: - { - if (pInstance) - { - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); - } - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_HALLS_OF_STONE, me); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - JumpToNextStep(180000); - break; - } - case 50: - SetEscortPaused(false); + SetEscortPaused(true); break; } - } else uiPhaseTimer -= uiDiff; + } - if (!bIsLowHP && HealthBelowPct(30)) + void SpawnDwarf(uint32 uiType) + { + switch(uiType) + { + case 1: + { + uint32 uiSpawnNumber = DUNGEON_MODE(2,3); + for (uint8 i = 0; i < uiSpawnNumber; ++i) + me->SummonCreature(CREATURE_DARK_RUNE_PROTECTOR, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + } + case 2: + for (uint8 i = 0; i < 2; ++i) + me->SummonCreature(CREATURE_DARK_RUNE_STORMCALLER, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + case 3: + me->SummonCreature(CREATURE_IRON_GOLEM_CUSTODIAN, SpawnLocations[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + break; + } + } + + void JustSummoned(Creature* pSummoned) { - DoScriptText(SAY_LOW_HEALTH, me); - bIsLowHP = true; + lDwarfGUIDList.push_back(pSummoned->GetGUID()); + pSummoned->AddThreat(me, 0.0f); + pSummoned->AI()->AttackStart(me); } - else if (bIsLowHP && !HealthBelowPct(30)) - bIsLowHP = false; - if (!UpdateVictim()) - return; + void JumpToNextStep(uint32 uiTimer) + { + uiPhaseTimer = uiTimer; + ++uiStep; + } + + void StartWP() + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetEscortPaused(false); + uiStep = 1; + Start(); + } + + void DamageTaken(Unit* /*done_by*/, uint32 & /*damage*/) + { + if (!bHasBeenDamaged) + bHasBeenDamaged = true; + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (uiPhaseTimer <= uiDiff) + { + switch(uiStep) + { + case 1: + if (pInstance) + { + if (pInstance->GetData(DATA_BRANN_EVENT) != NOT_STARTED) + return; + pInstance->SetData(DATA_BRANN_EVENT, IN_PROGRESS); + } + bIsBattle = false; + DoScriptText(SAY_ESCORT_START, me); + SetRun(true); + JumpToNextStep(0); + break; + case 3: + SetEscortPaused(false); + JumpToNextStep(0); + break; + case 5: + if (pInstance) + if (Creature* pTemp = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM)))) + DoScriptText(SAY_EVENT_INTRO_3_ABED, pTemp); + JumpToNextStep(8500); + break; + case 6: + DoScriptText(SAY_EVENT_A_1, me); + JumpToNextStep(6500); + break; + case 7: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_A_2_KADD, pTemp); + JumpToNextStep(12500); + break; + case 8: + DoScriptText(SAY_EVENT_A_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bKaddrakActivated = true; + JumpToNextStep(5000); + break; + case 9: + me->SetReactState(REACT_PASSIVE); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 10: + DoScriptText(SAY_EVENT_B_1, me); + JumpToNextStep(6000); + break; + case 11: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_B_2_MARN, pTemp); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 12: + DoScriptText(SAY_EVENT_B_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bMarnakActivated = true; + JumpToNextStep(10000); + break; + case 13: + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 14: + SpawnDwarf(2); + JumpToNextStep(20000); + break; + case 15: + DoScriptText(SAY_EVENT_C_1, me); + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 16: + SpawnDwarf(2); + JumpToNextStep(20000); + break; + case 17: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_C_2_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(20000); + break; + case 18: + DoScriptText(SAY_EVENT_C_3, me); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + CAST_AI(mob_tribuna_controller::mob_tribuna_controllerAI, pTemp->AI())->bAbedneumActivated = true; + JumpToNextStep(5000); + break; + case 19: + SpawnDwarf(2); + JumpToNextStep(10000); + break; + case 20: + SpawnDwarf(1); + JumpToNextStep(15000); + break; + case 21: + DoScriptText(SAY_EVENT_D_1, me); + SpawnDwarf(3); + JumpToNextStep(20000); + break; + case 22: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_D_2_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(5000); + break; + case 23: + SpawnDwarf(2); + JumpToNextStep(15000); + break; + case 24: + DoScriptText(SAY_EVENT_D_3, me); + SpawnDwarf(3); + JumpToNextStep(5000); + break; + case 25: + SpawnDwarf(1); + JumpToNextStep(5000); + break; + case 26: + SpawnDwarf(2); + JumpToNextStep(10000); + break; + case 27: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_D_4_ABED, pTemp); + SpawnDwarf(1); + JumpToNextStep(10000); + break; + case 28: + me->SetReactState(REACT_DEFENSIVE); + DoScriptText(SAY_EVENT_END_01, me); + me->SetStandState(UNIT_STAND_STATE_STAND); + if (pInstance) + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),true); + if (Creature* pTemp = Unit::GetCreature(*me, uiControllerGUID)) + pTemp->DealDamage(pTemp, pTemp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + bIsBattle = true; + SetEscortPaused(false); + JumpToNextStep(6500); + break; + case 29: + DoScriptText(SAY_EVENT_END_02, me); + if (pInstance) + { + pInstance->SetData(DATA_BRANN_EVENT, DONE); + + // Achievement criteria is with spell 59046 which does not exist. + // There is thus no way it can be given by casting the spell on the players. + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59046); + + if (!bHasBeenDamaged) + pInstance->DoCompleteAchievement(ACHIEV_BRANN_SPANKIN_NEW); + } + + JumpToNextStep(5500); + break; + case 30: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_03_ABED, pTemp); + JumpToNextStep(8500); + break; + case 31: + DoScriptText(SAY_EVENT_END_04, me); + JumpToNextStep(11500); + break; + case 32: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_05_ABED, pTemp); + JumpToNextStep(11500); + break; + case 33: + DoScriptText(SAY_EVENT_END_06, me); + JumpToNextStep(4500); + break; + case 34: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_07_ABED, pTemp); + JumpToNextStep(22500); + break; + case 35: + DoScriptText(SAY_EVENT_END_08, me); + JumpToNextStep(7500); + break; + case 36: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_09_KADD, pTemp); + JumpToNextStep(18500); + break; + case 37: + DoScriptText(SAY_EVENT_END_10, me); + JumpToNextStep(5500); + break; + case 38: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_11_KADD, pTemp); + JumpToNextStep(20500); + break; + case 39: + DoScriptText(SAY_EVENT_END_12, me); + JumpToNextStep(2500); + break; + case 40: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_KADDRAK))) + DoScriptText(SAY_EVENT_END_13_KADD, pTemp); + JumpToNextStep(19500); + break; + case 41: + DoScriptText(SAY_EVENT_END_14, me); + JumpToNextStep(10500); + break; + case 42: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_15_MARN, pTemp); + JumpToNextStep(6500); + break; + case 43: + DoScriptText(SAY_EVENT_END_16, me); + JumpToNextStep(6500); + break; + case 44: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_17_MARN, pTemp); + JumpToNextStep(25500); + break; + case 45: + DoScriptText(SAY_EVENT_END_18, me); + JumpToNextStep(23500); + break; + case 46: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_MARNAK))) + DoScriptText(SAY_EVENT_END_19_MARN, pTemp); + JumpToNextStep(3500); + break; + case 47: + DoScriptText(SAY_EVENT_END_20, me); + JumpToNextStep(8500); + break; + case 48: + if (pInstance) + if (Creature* pTemp = Unit::GetCreature(*me, pInstance->GetData64(DATA_ABEDNEUM))) + DoScriptText(SAY_EVENT_END_21_ABED, pTemp); + JumpToNextStep(5500); + break; + case 49: + { + if (pInstance) + { + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_KADDRAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_MARNAK),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_ABEDNEUM),false); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_SKY_FLOOR),false); + } + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_HALLS_OF_STONE, me); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + JumpToNextStep(180000); + break; + } + case 50: + SetEscortPaused(false); + break; + } + } else uiPhaseTimer -= uiDiff; + + if (!bIsLowHP && HealthBelowPct(30)) + { + DoScriptText(SAY_LOW_HEALTH, me); + bIsLowHP = true; + } + else if (bIsLowHP && !HealthBelowPct(30)) + bIsLowHP = false; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool GossipHello_npc_brann_hos(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(TEXT_ID_START, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_brann_hos(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1 || uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_brann_hosAI, pCreature->AI())->StartWP(); - } - - return true; -} - -CreatureAI* GetAI_mob_tribuna_controller(Creature* pCreature) -{ - return new mob_tribuna_controllerAI(pCreature); -} - -CreatureAI* GetAI_npc_brann_hos(Creature* pCreature) -{ - return new npc_brann_hosAI(pCreature); -} void AddSC_halls_of_stone() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_brann_hos"; - newscript->GetAI = &GetAI_npc_brann_hos; - newscript->pGossipHello = &GossipHello_npc_brann_hos; - newscript->pGossipSelect = &GossipSelect_npc_brann_hos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tribuna_controller"; - newscript->GetAI = &GetAI_mob_tribuna_controller; - newscript->RegisterSelf(); + new npc_brann_hos(); + new mob_tribuna_controller(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index e4bbcdd9690..621655876dc 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -26,246 +26,249 @@ 2- Escort Event 3- Sjonnir The Ironshaper */ - -struct instance_halls_of_stone : public ScriptedInstance + class instance_halls_of_stone : public InstanceMapScript { - instance_halls_of_stone(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_halls_of_stone() : InstanceMapScript("instance_halls_of_stone") { } - uint64 uiMaidenOfGrief; - uint64 uiKrystallus; - uint64 uiSjonnir; - - uint64 uiKaddrak; - uint64 uiAbedneum; - uint64 uiMarnak; - uint64 uiBrann; - - uint64 uiMaidenOfGriefDoor; - uint64 uiSjonnirDoor; - uint64 uiBrannDoor; - uint64 uiTribunalConsole; - uint64 uiTribunalChest; - uint64 uiTribunalSkyFloor; - uint64 uiKaddrakGo; - uint64 uiAbedneumGo; - uint64 uiMarnakGo; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - std::string str_data; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - uiMaidenOfGrief = 0; - uiKrystallus = 0; - uiSjonnir = 0; - - uiKaddrak = 0; - uiMarnak = 0; - uiAbedneum = 0; - uiBrann = 0; - - uiMaidenOfGriefDoor = 0; - uiSjonnirDoor = 0; - uiBrannDoor = 0; - uiKaddrakGo = 0; - uiMarnakGo = 0; - uiAbedneumGo = 0; - uiTribunalConsole = 0; - uiTribunalChest = 0; - uiTribunalSkyFloor = 0; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - m_auiEncounter[i] = NOT_STARTED; + return new instance_halls_of_stone_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_halls_of_stone_InstanceMapScript : public InstanceScript { - switch(pCreature->GetEntry()) + instance_halls_of_stone_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 uiMaidenOfGrief; + uint64 uiKrystallus; + uint64 uiSjonnir; + + uint64 uiKaddrak; + uint64 uiAbedneum; + uint64 uiMarnak; + uint64 uiBrann; + + uint64 uiMaidenOfGriefDoor; + uint64 uiSjonnirDoor; + uint64 uiBrannDoor; + uint64 uiTribunalConsole; + uint64 uiTribunalChest; + uint64 uiTribunalSkyFloor; + uint64 uiKaddrakGo; + uint64 uiAbedneumGo; + uint64 uiMarnakGo; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + std::string str_data; + + void Initialize() { - case CREATURE_MAIDEN: uiMaidenOfGrief = pCreature->GetGUID(); break; - case CREATURE_KRYSTALLUS: uiKrystallus = pCreature->GetGUID(); break; - case CREATURE_SJONNIR: uiSjonnir = pCreature->GetGUID(); break; - case CREATURE_MARNAK: uiMarnak = pCreature->GetGUID(); break; - case CREATURE_KADDRAK: uiKaddrak = pCreature->GetGUID(); break; - case CREATURE_ABEDNEUM: uiAbedneum = pCreature->GetGUID(); break; - case CREATURE_BRANN: uiBrann = pCreature->GetGUID(); break; - } - } + uiMaidenOfGrief = 0; + uiKrystallus = 0; + uiSjonnir = 0; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_ABEDNEUM: - uiAbedneumGo = pGo->GetGUID(); - break; - case GO_MARNAK: - uiMarnakGo = pGo->GetGUID(); - break; - case GO_KADDRAK: - uiKaddrakGo = pGo->GetGUID(); - break; - case GO_MAIDEN_DOOR: - uiMaidenOfGriefDoor = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_BRANN_DOOR: - uiBrannDoor = pGo->GetGUID(); - if (m_auiEncounter[1] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_SJONNIR_DOOR: - uiSjonnirDoor = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - else - pGo->SetGoState(GO_STATE_READY); - break; - case GO_TRIBUNAL_CONSOLE: - uiTribunalConsole = pGo->GetGUID(); - break; - case GO_TRIBUNAL_CHEST: - case GO_TRIBUNAL_CHEST_HERO: - uiTribunalChest = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; - case 191527: - uiTribunalSkyFloor = pGo->GetGUID(); - break; - } - } + uiKaddrak = 0; + uiMarnak = 0; + uiAbedneum = 0; + uiBrann = 0; - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_MAIDEN_OF_GRIEF_EVENT: - m_auiEncounter[1] = data; - if (m_auiEncounter[1] == DONE) - HandleGameObject(uiBrannDoor,true); - break; - case DATA_KRYSTALLUS_EVENT: - m_auiEncounter[0] = data; - if (m_auiEncounter[0] == DONE) - HandleGameObject(uiMaidenOfGriefDoor,true); - break; - case DATA_SJONNIR_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_BRANN_EVENT: - m_auiEncounter[2] = data; - if (m_auiEncounter[2] == DONE) - { - HandleGameObject(uiSjonnirDoor,true); - GameObject *pGo = instance->GetGameObject(uiTribunalChest); - if (pGo) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - } - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_KRYSTALLUS_EVENT: return m_auiEncounter[0]; - case DATA_MAIDEN_OF_GRIEF_EVENT: return m_auiEncounter[1]; - case DATA_SJONNIR_EVENT: return m_auiEncounter[2]; - case DATA_BRANN_EVENT: return m_auiEncounter[3]; - } - - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_MAIDEN_OF_GRIEF: return uiMaidenOfGrief; - case DATA_KRYSTALLUS: return uiKrystallus; - case DATA_SJONNIR: return uiSjonnir; - case DATA_KADDRAK: return uiKaddrak; - case DATA_MARNAK: return uiMarnak; - case DATA_ABEDNEUM: return uiAbedneum; - case DATA_GO_TRIBUNAL_CONSOLE: return uiTribunalConsole; - case DATA_GO_KADDRAK: return uiKaddrakGo; - case DATA_GO_ABEDNEUM: return uiAbedneumGo; - case DATA_GO_MARNAK: return uiMarnakGo; - case DATA_GO_SKY_FLOOR: return uiTribunalSkyFloor; - case DATA_SJONNIR_DOOR: return uiSjonnirDoor; - case DATA_MAIDEN_DOOR: return uiMaidenOfGriefDoor; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; - - if (dataHead1 == 'H' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; + uiMaidenOfGriefDoor = 0; + uiSjonnirDoor = 0; + uiBrannDoor = 0; + uiKaddrakGo = 0; + uiMarnakGo = 0; + uiAbedneumGo = 0; + uiTribunalConsole = 0; + uiTribunalChest = 0; + uiTribunalSkyFloor = 0; for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + m_auiEncounter[i] = NOT_STARTED; + } - } else OUT_LOAD_INST_DATA_FAIL; + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case CREATURE_MAIDEN: uiMaidenOfGrief = pCreature->GetGUID(); break; + case CREATURE_KRYSTALLUS: uiKrystallus = pCreature->GetGUID(); break; + case CREATURE_SJONNIR: uiSjonnir = pCreature->GetGUID(); break; + case CREATURE_MARNAK: uiMarnak = pCreature->GetGUID(); break; + case CREATURE_KADDRAK: uiKaddrak = pCreature->GetGUID(); break; + case CREATURE_ABEDNEUM: uiAbedneum = pCreature->GetGUID(); break; + case CREATURE_BRANN: uiBrann = pCreature->GetGUID(); break; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_ABEDNEUM: + uiAbedneumGo = pGo->GetGUID(); + break; + case GO_MARNAK: + uiMarnakGo = pGo->GetGUID(); + break; + case GO_KADDRAK: + uiKaddrakGo = pGo->GetGUID(); + break; + case GO_MAIDEN_DOOR: + uiMaidenOfGriefDoor = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_BRANN_DOOR: + uiBrannDoor = pGo->GetGUID(); + if (m_auiEncounter[1] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_SJONNIR_DOOR: + uiSjonnirDoor = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + else + pGo->SetGoState(GO_STATE_READY); + break; + case GO_TRIBUNAL_CONSOLE: + uiTribunalConsole = pGo->GetGUID(); + break; + case GO_TRIBUNAL_CHEST: + case GO_TRIBUNAL_CHEST_HERO: + uiTribunalChest = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + case 191527: + uiTribunalSkyFloor = pGo->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_MAIDEN_OF_GRIEF_EVENT: + m_auiEncounter[1] = data; + if (m_auiEncounter[1] == DONE) + HandleGameObject(uiBrannDoor,true); + break; + case DATA_KRYSTALLUS_EVENT: + m_auiEncounter[0] = data; + if (m_auiEncounter[0] == DONE) + HandleGameObject(uiMaidenOfGriefDoor,true); + break; + case DATA_SJONNIR_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_BRANN_EVENT: + m_auiEncounter[2] = data; + if (m_auiEncounter[2] == DONE) + { + HandleGameObject(uiSjonnirDoor,true); + GameObject *pGo = instance->GetGameObject(uiTribunalChest); + if (pGo) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + } + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_KRYSTALLUS_EVENT: return m_auiEncounter[0]; + case DATA_MAIDEN_OF_GRIEF_EVENT: return m_auiEncounter[1]; + case DATA_SJONNIR_EVENT: return m_auiEncounter[2]; + case DATA_BRANN_EVENT: return m_auiEncounter[3]; + } + + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MAIDEN_OF_GRIEF: return uiMaidenOfGrief; + case DATA_KRYSTALLUS: return uiKrystallus; + case DATA_SJONNIR: return uiSjonnir; + case DATA_KADDRAK: return uiKaddrak; + case DATA_MARNAK: return uiMarnak; + case DATA_ABEDNEUM: return uiAbedneum; + case DATA_GO_TRIBUNAL_CONSOLE: return uiTribunalConsole; + case DATA_GO_KADDRAK: return uiKaddrakGo; + case DATA_GO_ABEDNEUM: return uiAbedneumGo; + case DATA_GO_MARNAK: return uiMarnakGo; + case DATA_GO_SKY_FLOOR: return uiTribunalSkyFloor; + case DATA_SJONNIR_DOOR: return uiSjonnirDoor; + case DATA_MAIDEN_DOOR: return uiMaidenOfGriefDoor; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "H S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3; + + if (dataHead1 == 'H' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_halls_of_stone(Map* pMap) -{ - return new instance_halls_of_stone(pMap); -} void AddSC_instance_halls_of_stone() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_halls_of_stone"; - newscript->GetInstanceData = &GetInstanceData_instance_halls_of_stone; - newscript->RegisterSelf(); + new instance_halls_of_stone(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp index 5019bb29d21..167fbec1077 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_algalon.cpp @@ -80,304 +80,309 @@ enum Yells SAY_SUMMON_2 = -1603018, SAY_SUMMON_3 = -1603019, }; - -struct boss_algalonAI : public ScriptedAI + class boss_algalon : public CreatureScript { - boss_algalonAI(Creature *c) : ScriptedAI(c) +public: + boss_algalon() : CreatureScript("boss_algalon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Summon = false; // not in reset. intro speech done only once. + return new boss_algalonAI(pCreature); } - ScriptedInstance* pInstance; - - std::list m_lCollapsingStarGUIDList; - - uint32 Phase; - uint32 Ascend_Timer; - uint32 Berserk_Timer; - uint32 BigBang_Timer; - uint32 CosmicSmash_Timer; - uint32 PhasePunch_Timer; - uint32 QuantumStrike_Timer; - uint32 CollapsingStar_Timer; - uint32 uiPhase_timer; - uint32 uiStep; - - uint64 BlackHoleGUID; - - bool Enrage; - bool Summon; - - void EnterCombat(Unit* who) + struct boss_algalonAI : public ScriptedAI { - if (Summon) + boss_algalonAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_AGGRO, me); - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoZoneInCombat(who->ToCreature()); - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); - uiStep = 1; + pInstance = c->GetInstanceScript(); + Summon = false; // not in reset. intro speech done only once. } - if (pInstance) - pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); - } + InstanceScript* pInstance; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + std::list m_lCollapsingStarGUIDList; - void Reset() - { - Phase = 1; + uint32 Phase; + uint32 Ascend_Timer; + uint32 Berserk_Timer; + uint32 BigBang_Timer; + uint32 CosmicSmash_Timer; + uint32 PhasePunch_Timer; + uint32 QuantumStrike_Timer; + uint32 CollapsingStar_Timer; + uint32 uiPhase_timer; + uint32 uiStep; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pInstance) - pInstance->SetData(TYPE_ALGALON, NOT_STARTED); + uint64 BlackHoleGUID; - BlackHoleGUID = 0; + bool Enrage; + bool Summon; - uiPhase_timer = 0; - Ascend_Timer = 480000; //8 minutes - QuantumStrike_Timer = 4000 + rand()%10000; - Berserk_Timer = 360000; //6 minutes - CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds - BigBang_Timer = 90000; - PhasePunch_Timer = 8000; - CosmicSmash_Timer = urand(30000, 60000); - Enrage = false; - } - - void JumpToNextStep(uint32 uiTimer) - { - uiPhase_timer = uiTimer; - ++uiStep; - } - - void DespawnCollapsingStar() - { - if (m_lCollapsingStarGUIDList.empty()) - return; - - for (std::list::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) + void EnterCombat(Unit* who) { - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (Summon) { - if (pTemp->isAlive()) - pTemp->ForcedDespawn(); + DoScriptText(SAY_AGGRO, me); + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + DoZoneInCombat(who->ToCreature()); + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + uiStep = 1; } - } - m_lCollapsingStarGUIDList.clear(); - } - - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_COLLAPSING_STAR) - { - Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (me->getVictim()) - pSummoned->AI()->AttackStart(pTarget ? pTarget : me->getVictim()); - m_lCollapsingStarGUIDList.push_back(pSummoned->GetGUID()); - } - } - - void SummonCollapsingStar(Unit* target) - { - DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); - me->SummonCreature(CREATURE_COLLAPSING_STAR,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 100000); - me->SummonCreature(CREATURE_BLACK_HOLE,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (Phase == 1 && HealthBelowPct(20)) - { - Phase = 2; - DoScriptText(SAY_PHASE_2, me); - } - - if (HealthBelowPct(2)) - { - me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667, -295.101166,417.321381,0,0,0,0,0,0); - - // All of them. or random? - DoScriptText(SAY_DEATH_1, me); - DoScriptText(SAY_DEATH_2, me); - DoScriptText(SAY_DEATH_3, me); - DoScriptText(SAY_DEATH_4, me); - DoScriptText(SAY_DEATH_5, me); - - me->DisappearAndDie(); if (pInstance) - pInstance->SetData(TYPE_ALGALON, DONE); - - return; + pInstance->SetData(TYPE_ALGALON, IN_PROGRESS); } - if (Phase == 1) + void KilledUnit(Unit * /*victim*/) { - if (!Summon) + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void Reset() + { + Phase = 1; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance) + pInstance->SetData(TYPE_ALGALON, NOT_STARTED); + + BlackHoleGUID = 0; + + uiPhase_timer = 0; + Ascend_Timer = 480000; //8 minutes + QuantumStrike_Timer = 4000 + rand()%10000; + Berserk_Timer = 360000; //6 minutes + CollapsingStar_Timer = urand(15000, 20000); //Spawns between 15 to 20 seconds + BigBang_Timer = 90000; + PhasePunch_Timer = 8000; + CosmicSmash_Timer = urand(30000, 60000); + Enrage = false; + } + + void JumpToNextStep(uint32 uiTimer) + { + uiPhase_timer = uiTimer; + ++uiStep; + } + + void DespawnCollapsingStar() + { + if (m_lCollapsingStarGUIDList.empty()) + return; + + for (std::list::const_iterator itr = m_lCollapsingStarGUIDList.begin(); itr != m_lCollapsingStarGUIDList.end(); ++itr) { - if (uiPhase_timer <= diff) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) { - switch(uiStep) - { - case 1: - DoScriptText(SAY_SUMMON_1, me); - JumpToNextStep(3000); - break; - case 2: - DoScriptText(SAY_SUMMON_2, me); - JumpToNextStep(3000); - break; - case 3: - DoScriptText(SAY_SUMMON_3, me); - JumpToNextStep(3000); - break; - case 4: - DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); - JumpToNextStep(3000); - break; - case 5: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_AGGRESSIVE); - Summon = true; - break; - } - } else uiPhase_timer -= diff; + if (pTemp->isAlive()) + pTemp->ForcedDespawn(); + } + } + m_lCollapsingStarGUIDList.clear(); + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_COLLAPSING_STAR) + { + Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (me->getVictim()) + pSummoned->AI()->AttackStart(pTarget ? pTarget : me->getVictim()); + m_lCollapsingStarGUIDList.push_back(pSummoned->GetGUID()); + } + } + + void SummonCollapsingStar(Unit* target) + { + DoScriptText(SAY_SUMMON_COLLAPSING_STAR, me); + me->SummonCreature(CREATURE_COLLAPSING_STAR,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 100000); + me->SummonCreature(CREATURE_BLACK_HOLE,target->GetPositionX()+15.0,target->GetPositionY()+15.0,target->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 27000); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (Phase == 1 && HealthBelowPct(20)) + { + Phase = 2; + DoScriptText(SAY_PHASE_2, me); + } + + if (HealthBelowPct(2)) + { + me->SummonGameObject(GAMEOBJECT_GIVE_OF_THE_OBSERVER, 1634.258667, -295.101166,417.321381,0,0,0,0,0,0); + + // All of them. or random? + DoScriptText(SAY_DEATH_1, me); + DoScriptText(SAY_DEATH_2, me); + DoScriptText(SAY_DEATH_3, me); + DoScriptText(SAY_DEATH_4, me); + DoScriptText(SAY_DEATH_5, me); + + me->DisappearAndDie(); + + if (pInstance) + pInstance->SetData(TYPE_ALGALON, DONE); return; } - if (QuantumStrike_Timer <= diff) + if (Phase == 1) { - DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE,H_SPELL_QUANTUM_STRIKE), true); + if (!Summon) + { + if (uiPhase_timer <= diff) + { + switch(uiStep) + { + case 1: + DoScriptText(SAY_SUMMON_1, me); + JumpToNextStep(3000); + break; + case 2: + DoScriptText(SAY_SUMMON_2, me); + JumpToNextStep(3000); + break; + case 3: + DoScriptText(SAY_SUMMON_3, me); + JumpToNextStep(3000); + break; + case 4: + DoScriptText(SAY_ENGADED_FOR_FIRTS_TIME, me); + JumpToNextStep(3000); + break; + case 5: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + Summon = true; + break; + } + } else uiPhase_timer -= diff; - QuantumStrike_Timer = urand(4000, 14000); - } else QuantumStrike_Timer -= diff; + return; + } - if (BigBang_Timer <= diff) - { - DoScriptText(RAND(SAY_BIG_BANG_1,SAY_BIG_BANG_2), me); - DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG,H_SPELL_BIG_BANG), true); + if (QuantumStrike_Timer <= diff) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_QUANTUM_STRIKE,H_SPELL_QUANTUM_STRIKE), true); - BigBang_Timer = 90000; - } else BigBang_Timer -= diff; + QuantumStrike_Timer = urand(4000, 14000); + } else QuantumStrike_Timer -= diff; - if (Ascend_Timer <= diff) - { - DoCast(me->getVictim(),SPELL_ASCEND, true); + if (BigBang_Timer <= diff) + { + DoScriptText(RAND(SAY_BIG_BANG_1,SAY_BIG_BANG_2), me); + DoCast(me->getVictim(), RAID_MODE(SPELL_BIG_BANG,H_SPELL_BIG_BANG), true); - Ascend_Timer = 480000; - } else Ascend_Timer -= diff; + BigBang_Timer = 90000; + } else BigBang_Timer -= diff; - if (PhasePunch_Timer <= diff) - { - DoCast(me->getVictim(),SPELL_PHASE_PUNCH, true); - - PhasePunch_Timer = 8000; - } else PhasePunch_Timer -= diff; - - if (CosmicSmash_Timer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH,H_SPELL_COSMIC_SMASH), true); - - CosmicSmash_Timer = urand(30000, 60000); - } else CosmicSmash_Timer -= diff; - - if (Berserk_Timer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me->getVictim(),SPELL_BERSERK, true); - - Berserk_Timer = 360000; - } else Berserk_Timer -= diff; - - DoMeleeAttackIfReady(); - - EnterEvadeIfOutOfCombatArea(diff); - } - - if (Phase == 2) - { - if (Enrage) - { if (Ascend_Timer <= diff) { - DoCast(me, SPELL_ASCEND); - DoScriptText(SAY_BERSERK, me); - Ascend_Timer = urand(360000,365000); - Enrage = false; + DoCast(me->getVictim(),SPELL_ASCEND, true); + + Ascend_Timer = 480000; } else Ascend_Timer -= diff; + + if (PhasePunch_Timer <= diff) + { + DoCast(me->getVictim(),SPELL_PHASE_PUNCH, true); + + PhasePunch_Timer = 8000; + } else PhasePunch_Timer -= diff; + + if (CosmicSmash_Timer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), RAID_MODE(SPELL_COSMIC_SMASH,H_SPELL_COSMIC_SMASH), true); + + CosmicSmash_Timer = urand(30000, 60000); + } else CosmicSmash_Timer -= diff; + + if (Berserk_Timer <= diff) + { + DoScriptText(SAY_BERSERK, me); + DoCast(me->getVictim(),SPELL_BERSERK, true); + + Berserk_Timer = 360000; + } else Berserk_Timer -= diff; + + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); } + + if (Phase == 2) + { + if (Enrage) + { + if (Ascend_Timer <= diff) + { + DoCast(me, SPELL_ASCEND); + DoScriptText(SAY_BERSERK, me); + Ascend_Timer = urand(360000,365000); + Enrage = false; + } else Ascend_Timer -= diff; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + +//Collapsing Star class mob_collapsing_star : public CreatureScript +{ +public: + mob_collapsing_star() : CreatureScript("mob_collapsing_star") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_collapsing_starAI(pCreature); + } + + struct mob_collapsing_starAI : public ScriptedAI + { + mob_collapsing_starAI(Creature *pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } -}; + InstanceScript* pInstance; -//Collapsing Star -struct mob_collapsing_starAI : public ScriptedAI -{ - mob_collapsing_starAI(Creature *pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } + uint32 BlackHoleExplosion_Timer; - ScriptedInstance* pInstance; - - uint32 BlackHoleExplosion_Timer; - - void Reset() - { - BlackHoleExplosion_Timer = 0; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (BlackHoleExplosion_Timer <= diff) + void Reset() { - me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); BlackHoleExplosion_Timer = 0; - } else BlackHoleExplosion_Timer -= diff; - } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (BlackHoleExplosion_Timer <= diff) + { + me->CastSpell(me, SPELL_BLACK_HOLE_EXPLOSION, false); + BlackHoleExplosion_Timer = 0; + } else BlackHoleExplosion_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_boss_algalon(Creature* pCreature) -{ - return new boss_algalonAI(pCreature); -} -CreatureAI* GetAI_mob_collapsing_star(Creature* pCreature) -{ - return new mob_collapsing_starAI(pCreature); -} void AddSC_boss_Algalon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_algalon"; - newscript->GetAI = &GetAI_boss_algalon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_collapsing_star"; - newscript->GetAI = &GetAI_mob_collapsing_star; - newscript->RegisterSelf(); + new boss_algalon(); + new mob_collapsing_star(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp index 98fac4f80d2..d55653a2498 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_assembly_of_iron.cpp @@ -112,7 +112,7 @@ enum Yells SAY_BRUNDIR_BERSERK = -1603047, }; -bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* me) +bool IsEncounterComplete(InstanceScript* pInstance, Creature* me) { if (!pInstance || !me) return false; @@ -133,456 +133,469 @@ bool IsEncounterComplete(ScriptedInstance* pInstance, Creature* me) } return true; } - -struct boss_steelbreakerAI : public ScriptedAI + class boss_steelbreaker : public CreatureScript { - boss_steelbreakerAI(Creature *c) : ScriptedAI(c) +public: + boss_steelbreaker() : CreatureScript("boss_steelbreaker") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_steelbreakerAI (pCreature); } - void Reset() + struct boss_steelbreakerAI : public ScriptedAI { - events.Reset(); - phase = 0; - me->RemoveAllAuras(); - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - } - - EventMap events; - ScriptedInstance* pInstance; - uint32 phase; - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_STEELBREAKER_AGGRO, me); - DoZoneInCombat(); - DoCast(me, RAID_MODE(SPELL_HIGH_VOLTAGE, SPELL_HIGH_VOLTAGE_H)); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); - } - - void UpdatePhase() - { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); - if (phase >= 2) - events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 30000); - if (phase >= 3) - events.RescheduleEvent(EVENT_OVERWHELMING_POWER, rand()%5000); - } - - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + boss_steelbreakerAI(Creature *c) : ScriptedAI(c) { - if (Creature* Brundir = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) - if (Brundir->isAlive()) - Brundir->SetHealth(Brundir->GetMaxHealth()); - - if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) - if (Molgeim->isAlive()) - Molgeim->SetHealth(Molgeim->GetMaxHealth()); - - DoCast(SPELL_SUPERCHARGE); + pInstance = c->GetInstanceScript(); } - } - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1,SAY_STEELBREAKER_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } - - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_STEELBREAKER_SLAY_1,SAY_STEELBREAKER_SLAY_2), me); - - if (phase == 3) - DoCast(me, SPELL_ELECTRICAL_CHARGE); - } - - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) + events.Reset(); + phase = 0; + me->RemoveAllAuras(); + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + } + + EventMap events; + InstanceScript* pInstance; + uint32 phase; + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_STEELBREAKER_AGGRO, me); + DoZoneInCombat(); + DoCast(me, RAID_MODE(SPELL_HIGH_VOLTAGE, SPELL_HIGH_VOLTAGE_H)); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); + } + + void UpdatePhase() + { + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_FUSION_PUNCH, 15000); + if (phase >= 2) + events.RescheduleEvent(EVENT_STATIC_DISRUPTION, 30000); + if (phase >= 3) + events.RescheduleEvent(EVENT_OVERWHELMING_POWER, rand()%5000); + } + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage >= me->GetHealth()) { - case EVENT_ENRAGE: - DoScriptText(SAY_STEELBREAKER_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_FUSION_PUNCH: - DoCast(me->getVictim(), RAID_MODE(SPELL_FUSION_PUNCH, SPELL_FUSION_PUNCH_H)); - events.ScheduleEvent(EVENT_FUSION_PUNCH, urand(13000, 22000)); - break; - case EVENT_STATIC_DISRUPTION: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, RAID_MODE(SPELL_STATIC_DISRUPTION, SPELL_STATIC_DISRUPTION_H)); - events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(20000, 40000)); - break; - case EVENT_OVERWHELMING_POWER: - DoScriptText(SAY_STEELBREAKER_POWER, me); - DoCast(me->getVictim(), RAID_MODE(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H)); - events.ScheduleEvent(EVENT_OVERWHELMING_POWER, RAID_MODE(60000, 35000)); - break; + if (Creature* Brundir = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) + if (Brundir->isAlive()) + Brundir->SetHealth(Brundir->GetMaxHealth()); + + if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) + if (Molgeim->isAlive()) + Molgeim->SetHealth(Molgeim->GetMaxHealth()); + + DoCast(SPELL_SUPERCHARGE); } } - DoMeleeAttackIfReady(); - } -}; - -struct boss_runemaster_molgeimAI : public ScriptedAI -{ - boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - void Reset() - { - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - events.Reset(); - me->RemoveAllAuras(); - phase = 0; - } - - ScriptedInstance* pInstance; - EventMap events; - uint32 phase; - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_MOLGEIM_AGGRO, me); - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); - } - - void UpdatePhase() - { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); - events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); - if (phase >= 2) - events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); - if (phase >= 3) - events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); - } - - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + void JustDied(Unit* /*Killer*/) { - if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) - if (Steelbreaker->isAlive()) - Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); - - if (Creature* Brundir = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) - if (Brundir->isAlive()) - Brundir->SetHealth(Brundir->GetMaxHealth()); - - DoCast(me, SPELL_SUPERCHARGE); + DoScriptText(RAND(SAY_STEELBREAKER_DEATH_1,SAY_STEELBREAKER_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); } - } - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_MOLGEIM_DEATH_1,SAY_MOLGEIM_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } - - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_MOLGEIM_SLAY_1,SAY_MOLGEIM_SLAY_2), me); - } - - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) - UpdatePhase(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void KilledUnit(Unit * /*who*/) { - switch(eventId) + DoScriptText(RAND(SAY_STEELBREAKER_SLAY_1,SAY_STEELBREAKER_SLAY_2), me); + + if (phase == 3) + DoCast(me, SPELL_ELECTRICAL_CHARGE); + } + + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_ENRAGE: - DoScriptText(SAY_MOLGEIM_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_RUNE_OF_POWER: // Improve target selection; random alive friendly + switch(eventId) { - Unit *pTarget = DoSelectLowestHpFriendly(60); - if (!pTarget || (pTarget && !pTarget->isAlive())) - pTarget = me; - DoCast(pTarget, SPELL_RUNE_OF_POWER); - events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000); - break; + case EVENT_ENRAGE: + DoScriptText(SAY_STEELBREAKER_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_FUSION_PUNCH: + DoCast(me->getVictim(), RAID_MODE(SPELL_FUSION_PUNCH, SPELL_FUSION_PUNCH_H)); + events.ScheduleEvent(EVENT_FUSION_PUNCH, urand(13000, 22000)); + break; + case EVENT_STATIC_DISRUPTION: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, RAID_MODE(SPELL_STATIC_DISRUPTION, SPELL_STATIC_DISRUPTION_H)); + events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(20000, 40000)); + break; + case EVENT_OVERWHELMING_POWER: + DoScriptText(SAY_STEELBREAKER_POWER, me); + DoCast(me->getVictim(), RAID_MODE(SPELL_OVERWHELMING_POWER, SPELL_OVERWHELMING_POWER_H)); + events.ScheduleEvent(EVENT_OVERWHELMING_POWER, RAID_MODE(60000, 35000)); + break; } - case EVENT_SHIELD_OF_RUNES: - DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H)); - events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000,34000)); - break; - case EVENT_RUNE_OF_DEATH: - DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_RUNE_OF_DEATH); - events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000,40000)); - break; - case EVENT_RUNE_OF_SUMMONING: - DoScriptText(SAY_MOLGEIM_SUMMON, me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_RUNE_OF_SUMMONING); - events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); - break; } - } - DoMeleeAttackIfReady(); - } + DoMeleeAttackIfReady(); + } + }; + }; - -struct mob_lightning_elementalAI : public ScriptedAI + class boss_runemaster_molgeim : public CreatureScript { - mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) +public: + boss_runemaster_molgeim() : CreatureScript("boss_runemaster_molgeim") { } + + CreatureAI* GetAI(Creature* pCreature) const { - Charge(); + return new boss_runemaster_molgeimAI (pCreature); } - void Charge() + struct boss_runemaster_molgeimAI : public ScriptedAI { - Unit* pTarget = me->SelectNearestTarget(); - me->AddThreat(pTarget, 5000000.0f); - AttackStart(pTarget); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (!me->isInCombat()) - return; - - if (!UpdateVictim()) - return; - - if (me->IsWithinMeleeRange(me->getVictim())) + boss_runemaster_molgeimAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), RAID_MODE(SPELL_LIGHTNING_BLAST, SPELL_LIGHTNING_BLAST_H)); - me->Kill(me); // hack until spell works + pInstance = c->GetInstanceScript(); } - me->GetMotionMaster()->MoveChase(me->getVictim()); // needed at every update? - } -}; - -struct mob_rune_of_summoningAI : public ScriptedAI -{ - mob_rune_of_summoningAI(Creature *c) : ScriptedAI(c) - { - SummonLightningElemental(); - } - - void SummonLightningElemental() - { - me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); - me->DealDamage(me, me->GetHealth()); - } -}; - -struct boss_stormcaller_brundirAI : public ScriptedAI -{ - boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - void Reset() - { - if (pInstance) - pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); - me->RemoveAllAuras(); - events.Reset(); - phase = 0; - } - - EventMap events; - ScriptedInstance* pInstance; - uint32 phase; - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_BRUNDIR_AGGRO, me); - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ENRAGE, 900000); - UpdatePhase(); - } - - void UpdatePhase() - { - ++phase; - events.SetPhase(phase); - events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); - events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); - if (phase >= 2) - events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); - if (phase >= 3) + void Reset() { - DoCast(me, SPELL_STORMSHIELD); - events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000)); + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + events.Reset(); + me->RemoveAllAuras(); + phase = 0; } - } - void DamageTaken(Unit* /*pKiller*/, uint32 &damage) - { - if (damage >= me->GetHealth()) + InstanceScript* pInstance; + EventMap events; + uint32 phase; + + void EnterCombat(Unit* /*who*/) { - if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) - if (Steelbreaker->isAlive()) - Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); - - if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) - if (Molgeim->isAlive()) - Molgeim->SetHealth(Molgeim->GetMaxHealth()); - - DoCast(SPELL_SUPERCHARGE); - } - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(RAND(SAY_BRUNDIR_DEATH_1,SAY_BRUNDIR_DEATH_2), me); - if (IsEncounterComplete(pInstance, me) && pInstance) - pInstance->SetData(TYPE_ASSEMBLY, DONE); - } - - void KilledUnit(Unit * /*who*/) - { - DoScriptText(RAND(SAY_BRUNDIR_SLAY_1,SAY_BRUNDIR_SLAY_2), me); - } - - void SpellHit(Unit * /*from*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_SUPERCHARGE) + DoScriptText(SAY_MOLGEIM_AGGRO, me); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); UpdatePhase(); - } + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void UpdatePhase() { - switch(eventId) + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_SHIELD_OF_RUNES, 27000); + events.RescheduleEvent(EVENT_RUNE_OF_POWER, 60000); + if (phase >= 2) + events.RescheduleEvent(EVENT_RUNE_OF_DEATH, 30000); + if (phase >= 3) + events.RescheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); + } + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage >= me->GetHealth()) { - case EVENT_ENRAGE: - DoScriptText(SAY_BRUNDIR_BERSERK, me); - DoCast(SPELL_BERSERK); - break; - case EVENT_CHAIN_LIGHTNING: - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H)); - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); - break; - case EVENT_OVERLOAD: - DoCast(RAID_MODE(SPELL_OVERLOAD , SPELL_OVERLOAD_H)); - events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); - break; - case EVENT_LIGHTNING_WHIRL: - DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H)); - events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); - break; - case EVENT_LIGHTNING_TENDRILS: - DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); - events.DelayEvents(15000, 5000); - DoResetThreat(); - break; + if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) + if (Steelbreaker->isAlive()) + Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); + + if (Creature* Brundir = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_STORMCALLER_BRUNDIR) : 0)) + if (Brundir->isAlive()) + Brundir->SetHealth(Brundir->GetMaxHealth()); + + DoCast(me, SPELL_SUPERCHARGE); } } - DoMeleeAttackIfReady(); + void JustDied(Unit* /*Killer*/) + { + DoScriptText(RAND(SAY_MOLGEIM_DEATH_1,SAY_MOLGEIM_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); + } + + void KilledUnit(Unit * /*who*/) + { + DoScriptText(RAND(SAY_MOLGEIM_SLAY_1,SAY_MOLGEIM_SLAY_2), me); + } + + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ENRAGE: + DoScriptText(SAY_MOLGEIM_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_RUNE_OF_POWER: // Improve target selection; random alive friendly + { + Unit *pTarget = DoSelectLowestHpFriendly(60); + if (!pTarget || (pTarget && !pTarget->isAlive())) + pTarget = me; + DoCast(pTarget, SPELL_RUNE_OF_POWER); + events.ScheduleEvent(EVENT_RUNE_OF_POWER, 60000); + break; + } + case EVENT_SHIELD_OF_RUNES: + DoCast(me, RAID_MODE(SPELL_SHIELD_OF_RUNES, SPELL_SHIELD_OF_RUNES_H)); + events.ScheduleEvent(EVENT_SHIELD_OF_RUNES, urand(27000,34000)); + break; + case EVENT_RUNE_OF_DEATH: + DoScriptText(SAY_MOLGEIM_RUNE_DEATH, me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_RUNE_OF_DEATH); + events.ScheduleEvent(EVENT_RUNE_OF_DEATH, urand(30000,40000)); + break; + case EVENT_RUNE_OF_SUMMONING: + DoScriptText(SAY_MOLGEIM_SUMMON, me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_RUNE_OF_SUMMONING); + events.ScheduleEvent(EVENT_RUNE_OF_SUMMONING, urand(20000,30000)); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_lightning_elemental : public CreatureScript +{ +public: + mob_lightning_elemental() : CreatureScript("mob_lightning_elemental") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_lightning_elementalAI (pCreature); } + + struct mob_lightning_elementalAI : public ScriptedAI + { + mob_lightning_elementalAI(Creature *c) : ScriptedAI(c) + { + Charge(); + } + + void Charge() + { + Unit* pTarget = me->SelectNearestTarget(); + me->AddThreat(pTarget, 5000000.0f); + AttackStart(pTarget); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (!me->isInCombat()) + return; + + if (!UpdateVictim()) + return; + + if (me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(), RAID_MODE(SPELL_LIGHTNING_BLAST, SPELL_LIGHTNING_BLAST_H)); + me->Kill(me); // hack until spell works + } + + me->GetMotionMaster()->MoveChase(me->getVictim()); // needed at every update? + } + }; + +}; + class mob_rune_of_summoning : public CreatureScript +{ +public: + mob_rune_of_summoning() : CreatureScript("mob_rune_of_summoning") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_rune_of_summoningAI (pCreature); + } + + struct mob_rune_of_summoningAI : public ScriptedAI + { + mob_rune_of_summoningAI(Creature *c) : ScriptedAI(c) + { + SummonLightningElemental(); + } + + void SummonLightningElemental() + { + me->SummonCreature(CREATURE_RUNE_OF_SUMMONING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN); + me->DealDamage(me, me->GetHealth()); + } + }; + +}; + class boss_stormcaller_brundir : public CreatureScript +{ +public: + boss_stormcaller_brundir() : CreatureScript("boss_stormcaller_brundir") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_stormcaller_brundirAI (pCreature); + } + + struct boss_stormcaller_brundirAI : public ScriptedAI + { + boss_stormcaller_brundirAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + void Reset() + { + if (pInstance) + pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED); + me->RemoveAllAuras(); + events.Reset(); + phase = 0; + } + + EventMap events; + InstanceScript* pInstance; + uint32 phase; + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_BRUNDIR_AGGRO, me); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ENRAGE, 900000); + UpdatePhase(); + } + + void UpdatePhase() + { + ++phase; + events.SetPhase(phase); + events.RescheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); + events.RescheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); + if (phase >= 2) + events.RescheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); + if (phase >= 3) + { + DoCast(me, SPELL_STORMSHIELD); + events.RescheduleEvent(EVENT_LIGHTNING_TENDRILS, urand(40000,80000)); + } + } + + void DamageTaken(Unit* /*pKiller*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + { + if (Creature* Steelbreaker = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_STEELBREAKER) : 0)) + if (Steelbreaker->isAlive()) + Steelbreaker->SetHealth(Steelbreaker->GetMaxHealth()); + + if (Creature* Molgeim = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_RUNEMASTER_MOLGEIM) : 0)) + if (Molgeim->isAlive()) + Molgeim->SetHealth(Molgeim->GetMaxHealth()); + + DoCast(SPELL_SUPERCHARGE); + } + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(RAND(SAY_BRUNDIR_DEATH_1,SAY_BRUNDIR_DEATH_2), me); + if (IsEncounterComplete(pInstance, me) && pInstance) + pInstance->SetData(TYPE_ASSEMBLY, DONE); + } + + void KilledUnit(Unit * /*who*/) + { + DoScriptText(RAND(SAY_BRUNDIR_SLAY_1,SAY_BRUNDIR_SLAY_2), me); + } + + void SpellHit(Unit * /*from*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_SUPERCHARGE) + UpdatePhase(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ENRAGE: + DoScriptText(SAY_BRUNDIR_BERSERK, me); + DoCast(SPELL_BERSERK); + break; + case EVENT_CHAIN_LIGHTNING: + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, RAID_MODE(SPELL_CHAIN_LIGHTNING_N , SPELL_CHAIN_LIGHTNING_H)); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(9000,17000)); + break; + case EVENT_OVERLOAD: + DoCast(RAID_MODE(SPELL_OVERLOAD , SPELL_OVERLOAD_H)); + events.ScheduleEvent(EVENT_OVERLOAD, urand(60000,125000)); + break; + case EVENT_LIGHTNING_WHIRL: + DoCast(RAID_MODE(SPELL_LIGHTNING_WHIRL , SPELL_LIGHTNING_WHIRL_H)); + events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(20000,40000)); + break; + case EVENT_LIGHTNING_TENDRILS: + DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS, SPELL_LIGHTNING_TENDRILS_H)); + events.DelayEvents(15000, 5000); + DoResetThreat(); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_steelbreaker(Creature* pCreature) -{ - return new boss_steelbreakerAI (pCreature); -} -CreatureAI* GetAI_boss_runemaster_molgeim(Creature* pCreature) -{ - return new boss_runemaster_molgeimAI (pCreature); -} -CreatureAI* GetAI_boss_stormcaller_brundir(Creature* pCreature) -{ - return new boss_stormcaller_brundirAI (pCreature); -} -CreatureAI* GetAI_mob_lightning_elemental(Creature* pCreature) -{ - return new mob_lightning_elementalAI (pCreature); -} -CreatureAI* GetAI_mob_rune_of_summoning(Creature* pCreature) -{ - return new mob_rune_of_summoningAI (pCreature); -} void AddSC_boss_assembly_of_iron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_steelbreaker"; - newscript->GetAI = &GetAI_boss_steelbreaker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_runemaster_molgeim"; - newscript->GetAI = &GetAI_boss_runemaster_molgeim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_stormcaller_brundir"; - newscript->GetAI = &GetAI_boss_stormcaller_brundir; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_lightning_elemental"; - newscript->GetAI = &GetAI_mob_lightning_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_rune_of_summoning"; - newscript->GetAI = &GetAI_mob_rune_of_summoning; - newscript->RegisterSelf(); - + new boss_steelbreaker(); + new boss_runemaster_molgeim(); + new boss_stormcaller_brundir(); + new mob_lightning_elemental(); + new mob_rune_of_summoning(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp index da3d671eb6d..c259adb1d94 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_auriaya.cpp @@ -32,74 +32,75 @@ enum Yells SAY_DEATH = -1603053, SAY_BERSERK = -1603054, }; - -struct boss_auriaya_AI : public BossAI + class boss_auriaya : public CreatureScript { - boss_auriaya_AI(Creature *pCreature) : BossAI(pCreature, TYPE_AURIAYA) +public: + boss_auriaya() : CreatureScript("boss_auriaya") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_auriaya_AI (pCreature); } - uint32 TERRIFYING_SCREECH_Timer; - uint32 SONIC_SCREECH_Timer; - - void Reset() + struct boss_auriaya_AI : public BossAI { - _Reset(); - TERRIFYING_SCREECH_Timer = 180000; - SONIC_SCREECH_Timer = 30000; - } - - void EnterCombat(Unit* /*who*/) - { - _EnterCombat(); - DoScriptText(SAY_AGGRO,me); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (TERRIFYING_SCREECH_Timer <= diff) + boss_auriaya_AI(Creature *pCreature) : BossAI(pCreature, TYPE_AURIAYA) { - DoCast(SPELL_TERRIFYING_SCREECH); + } + + uint32 TERRIFYING_SCREECH_Timer; + uint32 SONIC_SCREECH_Timer; + + void Reset() + { + _Reset(); TERRIFYING_SCREECH_Timer = 180000; - } else TERRIFYING_SCREECH_Timer -= diff; - - if (SONIC_SCREECH_Timer <= diff) - { - DoCastVictim(SPELL_SONIC_SCREECH); SONIC_SCREECH_Timer = 30000; - } else SONIC_SCREECH_Timer -= diff; + } + + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + DoScriptText(SAY_AGGRO,me); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (TERRIFYING_SCREECH_Timer <= diff) + { + DoCast(SPELL_TERRIFYING_SCREECH); + TERRIFYING_SCREECH_Timer = 180000; + } else TERRIFYING_SCREECH_Timer -= diff; + + if (SONIC_SCREECH_Timer <= diff) + { + DoCastVictim(SPELL_SONIC_SCREECH); + SONIC_SCREECH_Timer = 30000; + } else SONIC_SCREECH_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_auriaya(Creature* pCreature) -{ - return new boss_auriaya_AI (pCreature); -} - void AddSC_boss_auriaya() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_auriaya"; - newscript->GetAI = &GetAI_boss_auriaya; - newscript->RegisterSelf(); + new boss_auriaya(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 0d462097213..c503f909d52 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -196,1037 +196,1069 @@ const Position PosDemolisher[5] = {-756.01,-219.23,430.50,2.369}, {-798.01,-227.24,429.84,1.446}, }; - -struct boss_flame_leviathanAI : public BossAI + class boss_flame_leviathan : public CreatureScript { - boss_flame_leviathanAI(Creature* pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(pCreature->GetVehicleKit()) - { - assert(vehicle); - pInstance = me->GetInstanceData(); - uiActiveTowers = 4; - ActiveTowers = false; - towerOfStorms = false; - towerOfLife = false; - towerOfFlames = false; - towerOfFrost = false; - me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); - me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip +public: + boss_flame_leviathan() : CreatureScript("boss_flame_leviathan") { } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - me->SetReactState(REACT_PASSIVE); + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_flame_leviathanAI (pCreature); } - ScriptedInstance* pInstance; - - Vehicle* vehicle; - uint8 uiActiveTowers; - bool ActiveTowers; - bool towerOfStorms; - bool towerOfLife; - bool towerOfFlames; - bool towerOfFrost; - - void Reset() + struct boss_flame_leviathanAI : public BossAI { - _Reset(); - /*me->SetLootMode(LOOT_MODE_HARD_MODE_4); - me->SetLootMode(LOOT_MODE_HARD_MODE_3); - me->SetLootMode(LOOT_MODE_HARD_MODE_2); - me->SetLootMode(LOOT_MODE_HARD_MODE_1);*/ - if (pInstance) - pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); - assert(vehicle); - me->GetVehicleKit(); - me->SetReactState(REACT_DEFENSIVE); - } - - void EnterCombat(Unit* /*who*/) - { - _EnterCombat(); - pInstance->SetData(TYPE_LEVIATHAN, IN_PROGRESS); //_Reset doesnt do this correctly - me->SetReactState(REACT_AGGRESSIVE); - events.ScheduleEvent(EVENT_PURSUE, 0); - events.ScheduleEvent(EVENT_MISSILE, 1500); - events.ScheduleEvent(EVENT_VENT, 20000); - events.ScheduleEvent(EVENT_SPEED, 15000); - events.ScheduleEvent(EVENT_SUMMON, 0); - if (ActiveTowers) + boss_flame_leviathanAI(Creature* pCreature) : BossAI(pCreature, TYPE_LEVIATHAN), vehicle(pCreature->GetVehicleKit()) { - if (towerOfStorms) - { - me->AddAura(SPELL_BUFF_TOWER_OF_STORMS, me); - events.ScheduleEvent(EVENT_THORIM_S_HAMMER, 35000); - } - - if (towerOfFlames) - { - me->AddAura(SPELL_BUFF_TOWER_OF_FLAMES, me); - events.ScheduleEvent(EVENT_MIMIRON_S_INFERNO,70000); - } - - if (towerOfFrost) - { - me->AddAura(SPELL_BUFF_TOWER_OF_FR0ST, me); - events.ScheduleEvent(EVENT_HODIR_S_FURY, 105000); - } - - if (towerOfLife) - { - me->AddAura(SPELL_BUFF_TOWER_OF_LIFE, me); - events.ScheduleEvent(EVENT_FREYA_S_WARD, 140000); - } - - if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms) - DoScriptText(SAY_TOWER_NONE, me); - else - DoScriptText(SAY_HARDMODE, me); - } - else - DoScriptText(SAY_AGGRO, me); - - if (Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) - turret->AI()->DoZoneInCombat(); - } - - // TODO: effect 0 and effect 1 may be on different target - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_PURSUED) - AttackStart(pTarget); - } - - - void JustDied(Unit* /*victim*/) - { - _JustDied(); - pInstance->SetData(TYPE_LEVIATHAN, DONE); //_Reset doesnt do this correctly - DoScriptText(SAY_DEATH, me); - - if (ActiveTowers) - { - switch (uiActiveTowers) - { - case 4: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); - break; - case 3: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); - break; - case 2: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); - break; - case 1: - pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); - break; - } - } - } - - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_START_THE_ENGINE) - vehicle->InstallAllAccessories(); - else - if (pSpell->Id == SPELL_ELECTROSHOCK) - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - return; - - if (me->getThreatManager().isThreatListEmpty()) - { - EnterEvadeMode(); - return; - } - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) - { - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - return; - } - else - { - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - } - - uint32 eventId = events.GetEvent(); - if (!me->getVictim()) - eventId = EVENT_PURSUE; - - switch(eventId) - { - case 0: break; // this is a must - case EVENT_PURSUE: - DoCastAOE(SPELL_PURSUED, true); - DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); - events.RescheduleEvent(EVENT_PURSUE, 30000); - UpdateVictim(); // begin to kill other things - if (me->getVictim()) - me->MonsterTextEmote(EMOTE_PURSUE, me->getVictim()->GetGUID(), true); - return; - case EVENT_MISSILE: - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_MISSILE_BARRAGE); - events.RepeatEvent(1500); - return; - case EVENT_VENT: - DoCastAOE(SPELL_FLAME_VENTS); - events.RepeatEvent(20000); - return; - case EVENT_SPEED: - DoCastAOE(SPELL_GATHERING_SPEED); - events.RepeatEvent(15000); - return; - case EVENT_SUMMON: - if (summons.size() < 15) // 4seat+1turret+10lift - if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0)) - pLift->GetMotionMaster()->MoveRandom(100); - events.RepeatEvent(2000); - return; - case EVENT_SHUTDOWN: - DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); - me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); - DoCast(SPELL_SYSTEMS_SHUTDOWN); - me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); - me->MonsterTextEmote(EMOTE_REPAIR, 0, true); - events.CancelEvent(EVENT_SHUTDOWN); - return; - case EVENT_THORIM_S_HAMMER: // Tower of Storms - for (uint8 i = 0; i < 7; ++i) - { - if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, urand(20,60), 20000, TEMPSUMMON_TIMED_DESPAWN)) - pThorim->GetMotionMaster()->MoveRandom(100); - } - DoScriptText(SAY_TOWER_STORM, me); - events.CancelEvent(EVENT_THORIM_S_HAMMER); - return; - case EVENT_MIMIRON_S_INFERNO: // Tower of Flames - me->SummonCreature(MOB_MIMIRON_BEACON, 390.93, -13.91, 409.81); - DoScriptText(SAY_TOWER_FLAME, me); - events.CancelEvent(EVENT_MIMIRON_S_INFERNO); - return; - case EVENT_HODIR_S_FURY: // Tower of Frost - for (uint8 i = 0; i < 7; ++i) - { - if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0)) - pHodir->GetMotionMaster()->MoveRandom(100); - } - DoScriptText(SAY_TOWER_FROST, me); - events.CancelEvent(EVENT_HODIR_S_FURY); - return; - case EVENT_FREYA_S_WARD: // Tower of Nature - DoScriptText(SAY_TOWER_NATURE, me); - StartFreyaEvent(); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_FREYA_S_WARD); - events.CancelEvent(EVENT_FREYA_S_WARD); - return; - default: - events.PopEvent(); - break; - } - if (me->IsWithinMeleeRange(me->getVictim())) - DoSpellAttackIfReady(SPELL_BATTERING_RAM); - } - - void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs - { - me->SummonCreature(MOB_FREYA_BEACON, 377.02, -119.10, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 377.02, 54.78, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 185.62, 54.78, 409.81); - me->SummonCreature(MOB_FREYA_BEACON, 185.62, -119.10, 409.81); - } - - void DoAction(const int32 uiAction) - { - // Start encounter - if (uiAction == 10) - { - me->SetHomePosition(354.8771, -12.90240, 409.803, 0); - me->GetMotionMaster()->MoveCharge(354.8771, -12.90240, 409.803); //position center - me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); - DoZoneInCombat(); - return; - } - - if (uiAction && uiAction <= 4) // Tower destruction, debuff leviathan loot and reduce active tower - { - if (me->HasLootMode(31) && uiActiveTowers == 4) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); - --uiActiveTowers; - } - if (me->HasLootMode(15) && uiActiveTowers == 3) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); - --uiActiveTowers; - } - if (me->HasLootMode(7) && uiActiveTowers == 2) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); - --uiActiveTowers; - } - if (me->HasLootMode(3) && uiActiveTowers == 1) - { - me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); - --uiActiveTowers; - } - } - - switch (uiAction) - { - case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian - ActiveTowers = true; - towerOfStorms = true; - towerOfLife = true; - towerOfFlames = true; - towerOfFrost = true; - me->SetLootMode(31); - break; - case 1: // Tower of Storms destroyed + assert(vehicle); + pInstance = me->GetInstanceScript(); + uiActiveTowers = 4; + ActiveTowers = false; towerOfStorms = false; - break; - case 2: // Tower of Flames destroyed - towerOfFlames = false; - break; - case 3: // Tower of Frost destroyed - towerOfFrost = false; - break; - case 4: // Tower of Nature destroyed towerOfLife = false; - break; - case 9: // Schedule event - events.ScheduleEvent(EVENT_SHUTDOWN, 0); - break; + towerOfFlames = false; + towerOfFrost = false; + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); //deathgrip + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetReactState(REACT_PASSIVE); } - } + + InstanceScript* pInstance; + + Vehicle* vehicle; + uint8 uiActiveTowers; + bool ActiveTowers; + bool towerOfStorms; + bool towerOfLife; + bool towerOfFlames; + bool towerOfFrost; + + void Reset() + { + _Reset(); + /*me->SetLootMode(LOOT_MODE_HARD_MODE_4); + me->SetLootMode(LOOT_MODE_HARD_MODE_3); + me->SetLootMode(LOOT_MODE_HARD_MODE_2); + me->SetLootMode(LOOT_MODE_HARD_MODE_1);*/ + if (pInstance) + pInstance->SetData(TYPE_LEVIATHAN, NOT_STARTED); + assert(vehicle); + me->GetVehicleKit(); + me->SetReactState(REACT_DEFENSIVE); + } + + void EnterCombat(Unit* /*who*/) + { + _EnterCombat(); + pInstance->SetData(TYPE_LEVIATHAN, IN_PROGRESS); //_Reset doesnt do this correctly + me->SetReactState(REACT_AGGRESSIVE); + events.ScheduleEvent(EVENT_PURSUE, 0); + events.ScheduleEvent(EVENT_MISSILE, 1500); + events.ScheduleEvent(EVENT_VENT, 20000); + events.ScheduleEvent(EVENT_SPEED, 15000); + events.ScheduleEvent(EVENT_SUMMON, 0); + if (ActiveTowers) + { + if (towerOfStorms) + { + me->AddAura(SPELL_BUFF_TOWER_OF_STORMS, me); + events.ScheduleEvent(EVENT_THORIM_S_HAMMER, 35000); + } + + if (towerOfFlames) + { + me->AddAura(SPELL_BUFF_TOWER_OF_FLAMES, me); + events.ScheduleEvent(EVENT_MIMIRON_S_INFERNO,70000); + } + + if (towerOfFrost) + { + me->AddAura(SPELL_BUFF_TOWER_OF_FR0ST, me); + events.ScheduleEvent(EVENT_HODIR_S_FURY, 105000); + } + + if (towerOfLife) + { + me->AddAura(SPELL_BUFF_TOWER_OF_LIFE, me); + events.ScheduleEvent(EVENT_FREYA_S_WARD, 140000); + } + + if (!towerOfLife && !towerOfFrost && !towerOfFlames && !towerOfStorms) + DoScriptText(SAY_TOWER_NONE, me); + else + DoScriptText(SAY_HARDMODE, me); + } + else + DoScriptText(SAY_AGGRO, me); + + if (Creature *turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) + turret->AI()->DoZoneInCombat(); + } + + // TODO: effect 0 and effect 1 may be on different target + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_PURSUED) + AttackStart(pTarget); + } + + + void JustDied(Unit* /*victim*/) + { + _JustDied(); + pInstance->SetData(TYPE_LEVIATHAN, DONE); //_Reset doesnt do this correctly + DoScriptText(SAY_DEATH, me); + + if (ActiveTowers) + { + switch (uiActiveTowers) + { + case 4: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBIT_UARY, ACHIEV_25_ORBIT_UARY)); + break; + case 3: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_NUKED_FROM_ORBIT, ACHIEV_25_NUKED_FROM_ORBIT)); + break; + case 2: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_DEVASTATION, ACHIEV_25_ORBITAL_DEVASTATION)); + break; + case 1: + pInstance->DoCompleteAchievement(RAID_MODE(ACHIEV_10_ORBITAL_BOMBARDMENT, ACHIEV_25_ORBITAL_BOMBARDMENT)); + break; + } + } + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) + { + if (pSpell->Id == SPELL_START_THE_ENGINE) + vehicle->InstallAllAccessories(); + else + if (pSpell->Id == SPELL_ELECTROSHOCK) + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) + return; + + if (me->getThreatManager().isThreatListEmpty()) + { + EnterEvadeMode(); + return; + } + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (me->HasAura(SPELL_SYSTEMS_SHUTDOWN)) + { + me->SetReactState(REACT_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + return; + } + else + { + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + } + + uint32 eventId = events.GetEvent(); + if (!me->getVictim()) + eventId = EVENT_PURSUE; + + switch(eventId) + { + case 0: break; // this is a must + case EVENT_PURSUE: + DoCastAOE(SPELL_PURSUED, true); + DoScriptText(RAND(SAY_TARGET_1, SAY_TARGET_2, SAY_TARGET_3), me); + events.RescheduleEvent(EVENT_PURSUE, 30000); + UpdateVictim(); // begin to kill other things + if (me->getVictim()) + me->MonsterTextEmote(EMOTE_PURSUE, me->getVictim()->GetGUID(), true); + return; + case EVENT_MISSILE: + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_MISSILE_BARRAGE); + events.RepeatEvent(1500); + return; + case EVENT_VENT: + DoCastAOE(SPELL_FLAME_VENTS); + events.RepeatEvent(20000); + return; + case EVENT_SPEED: + DoCastAOE(SPELL_GATHERING_SPEED); + events.RepeatEvent(15000); + return; + case EVENT_SUMMON: + if (summons.size() < 15) // 4seat+1turret+10lift + if (Creature* pLift = DoSummonFlyer(MOB_MECHANOLIFT, me, urand(20,40), 50, 0)) + pLift->GetMotionMaster()->MoveRandom(100); + events.RepeatEvent(2000); + return; + case EVENT_SHUTDOWN: + DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); + me->MonsterTextEmote(EMOTE_OVERLOAD, 0, true); + DoCast(SPELL_SYSTEMS_SHUTDOWN); + me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); + me->MonsterTextEmote(EMOTE_REPAIR, 0, true); + events.CancelEvent(EVENT_SHUTDOWN); + return; + case EVENT_THORIM_S_HAMMER: // Tower of Storms + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* pThorim = DoSummon(MOB_THORIM_BEACON, me, urand(20,60), 20000, TEMPSUMMON_TIMED_DESPAWN)) + pThorim->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_STORM, me); + events.CancelEvent(EVENT_THORIM_S_HAMMER); + return; + case EVENT_MIMIRON_S_INFERNO: // Tower of Flames + me->SummonCreature(MOB_MIMIRON_BEACON, 390.93, -13.91, 409.81); + DoScriptText(SAY_TOWER_FLAME, me); + events.CancelEvent(EVENT_MIMIRON_S_INFERNO); + return; + case EVENT_HODIR_S_FURY: // Tower of Frost + for (uint8 i = 0; i < 7; ++i) + { + if (Creature* pHodir = DoSummon(MOB_HODIR_BEACON, me, 50, 0)) + pHodir->GetMotionMaster()->MoveRandom(100); + } + DoScriptText(SAY_TOWER_FROST, me); + events.CancelEvent(EVENT_HODIR_S_FURY); + return; + case EVENT_FREYA_S_WARD: // Tower of Nature + DoScriptText(SAY_TOWER_NATURE, me); + StartFreyaEvent(); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_FREYA_S_WARD); + events.CancelEvent(EVENT_FREYA_S_WARD); + return; + default: + events.PopEvent(); + break; + } + if (me->IsWithinMeleeRange(me->getVictim())) + DoSpellAttackIfReady(SPELL_BATTERING_RAM); + } + + void StartFreyaEvent()//summon these 4 on each corner wich wil spawn additional hostile mobs + { + me->SummonCreature(MOB_FREYA_BEACON, 377.02, -119.10, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 377.02, 54.78, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 185.62, 54.78, 409.81); + me->SummonCreature(MOB_FREYA_BEACON, 185.62, -119.10, 409.81); + } + + void DoAction(const int32 uiAction) + { + // Start encounter + if (uiAction == 10) + { + me->SetHomePosition(354.8771, -12.90240, 409.803, 0); + me->GetMotionMaster()->MoveCharge(354.8771, -12.90240, 409.803); //position center + me->SetReactState(REACT_AGGRESSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + DoZoneInCombat(); + return; + } + + if (uiAction && uiAction <= 4) // Tower destruction, debuff leviathan loot and reduce active tower + { + if (me->HasLootMode(31) && uiActiveTowers == 4) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_4); + --uiActiveTowers; + } + if (me->HasLootMode(15) && uiActiveTowers == 3) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_3); + --uiActiveTowers; + } + if (me->HasLootMode(7) && uiActiveTowers == 2) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_2); + --uiActiveTowers; + } + if (me->HasLootMode(3) && uiActiveTowers == 1) + { + me->RemoveLootMode(LOOT_MODE_HARD_MODE_1); + --uiActiveTowers; + } + } + + switch (uiAction) + { + case 0: // Activate hard-mode setting counter to 4 towers, enable all towers apply buffs on levithian + ActiveTowers = true; + towerOfStorms = true; + towerOfLife = true; + towerOfFlames = true; + towerOfFrost = true; + me->SetLootMode(31); + break; + case 1: // Tower of Storms destroyed + towerOfStorms = false; + break; + case 2: // Tower of Flames destroyed + towerOfFlames = false; + break; + case 3: // Tower of Frost destroyed + towerOfFrost = false; + break; + case 4: // Tower of Nature destroyed + towerOfLife = false; + break; + case 9: // Schedule event + events.ScheduleEvent(EVENT_SHUTDOWN, 0); + break; + } + } + }; + }; //#define BOSS_DEBUG - -struct boss_flame_leviathan_seatAI : public PassiveAI + class boss_flame_leviathan_seat : public CreatureScript { - boss_flame_leviathan_seatAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) +public: + boss_flame_leviathan_seat() : CreatureScript("boss_flame_leviathan_seat") { } + + CreatureAI* GetAI(Creature* pCreature) const { - assert(vehicle); -#ifdef BOSS_DEBUG - me->SetReactState(REACT_AGGRESSIVE); -#endif + return new boss_flame_leviathan_seatAI (pCreature); } - Vehicle* vehicle; - -#ifdef BOSS_DEBUG - void MoveInLineOfSight(Unit *who) + struct boss_flame_leviathan_seatAI : public PassiveAI { - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster() - && !who->GetVehicle() && vehicle->GetPassenger(SEAT_TURRET)) - who->EnterVehicle(vehicle, SEAT_PLAYER); - } -#endif - - void PassengerBoarded(Unit* who, int8 seatId, bool apply) - { - if (!me->GetVehicle()) - return; - - if (seatId == SEAT_PLAYER) + boss_flame_leviathan_seatAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) { - if (!apply) + assert(vehicle); + #ifdef BOSS_DEBUG + me->SetReactState(REACT_AGGRESSIVE); + #endif + } + + Vehicle* vehicle; + + #ifdef BOSS_DEBUG + void MoveInLineOfSight(Unit *who) + { + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->isGameMaster() + && !who->GetVehicle() && vehicle->GetPassenger(SEAT_TURRET)) + who->EnterVehicle(vehicle, SEAT_PLAYER); + } + #endif + + void PassengerBoarded(Unit* who, int8 seatId, bool apply) + { + if (!me->GetVehicle()) return; - if (Creature* turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) + if (seatId == SEAT_PLAYER) { - turret->setFaction(me->GetVehicleBase()->getFaction()); - turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable - turret->AI()->AttackStart(who); - } - if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) - { - device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - } - else - if (seatId == SEAT_TURRET) - { - if (apply) + if (!apply) return; + + if (Creature* turret = CAST_CRE(vehicle->GetPassenger(SEAT_TURRET))) + { + turret->setFaction(me->GetVehicleBase()->getFaction()); + turret->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + turret->AI()->AttackStart(who); + } if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) { - device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable - } - } - } -}; - -struct boss_flame_leviathan_defense_turretAI : public TurretAI -{ - boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} - - void DamageTaken(Unit* who, uint32 &damage) - { - if (!CanAIAttack(who)) - damage = 0; - } - - bool CanAIAttack(const Unit *who) const - { - if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) - return false; - return true; - } -}; - -struct boss_flame_leviathan_overload_deviceAI : public PassiveAI -{ - boss_flame_leviathan_overload_deviceAI(Creature* pCreature) : PassiveAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - void DoAction(const int32 param) - { - if (param == EVENT_SPELLCLICK) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pInstance->instance->GetCreature(TYPE_LEVIATHAN)->AI()->DoAction(9); //should be called if all 3 overload devices are active - if (me->GetVehicle()) - { - if (Unit* pPlayer = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) - { - pPlayer->ExitVehicle(); - me->GetVehicleBase()->CastSpell(pPlayer, SPELL_SMOKE_TRAIL, true); - if (Unit* leviathan = me->GetVehicleBase()->GetVehicleBase()) - pPlayer->GetMotionMaster()->MoveKnockbackFrom(leviathan->GetPositionX(), leviathan->GetPositionY(), 30, 30); - } - } - } - } -}; - -struct boss_flame_leviathan_safety_containerAI : public PassiveAI -{ - boss_flame_leviathan_safety_containerAI(Creature* pCreature) : PassiveAI(pCreature) - { - } - - void JustDied() - { - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - } - - void UpdateAI(const uint32 diff) - { - } -}; -struct npc_mechanoliftAI : public PassiveAI -{ - npc_mechanoliftAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) - { - assert(vehicle); - } - - Vehicle* vehicle; - - uint32 MoveTimer; - - void Reset () - { - MoveTimer = 0; - me->GetMotionMaster()->MoveRandom(50); - } - - void JustDied(Unit* pKiller) - { - me->GetMotionMaster()->MoveTargetedHome(); - Creature* pLiquid = DoSummon(MOB_LIQUID, me, 0); - if (pLiquid) - { - pLiquid->CastSpell(pLiquid, SPELL_LIQUID_PYRITE, true); - pLiquid->GetMotionMaster()->MoveFall(pKiller->GetPositionZ()); - } - - } - - void MovementInform(uint32 type, uint32 id) - { - if (id == 1) - { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true); - if (pContainer) - pContainer->EnterVehicle(me); - } - } - - void UpdateAI(const uint32 diff) - { - if (MoveTimer <= diff) - { - if (me->GetVehicleKit()->HasEmptySeat(-1)) - { - Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 50, true); - if (pContainer && !pContainer->GetVehicle()) - me->GetMotionMaster()->MovePoint(1,pContainer->GetPositionX(),pContainer->GetPositionY(),pContainer->GetPositionZ()); - } - MoveTimer = 30000; //check next 30 seconds - } - else - MoveTimer-=diff; - } -}; - - -struct spell_pool_of_tarAI : public PassiveAI -{ - spell_pool_of_tarAI(Creature* pCreature) : PassiveAI(pCreature) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void DamageTaken(Unit * /*who*/, uint32 &damage) - { - damage = 0; - } - - void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) - { - if (pSpell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) - me->CastSpell(me, SPELL_BLAZE, true); - } -}; - -struct npc_colossusAI : public ScriptedAI -{ - npc_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - void JustDied(Unit* /*Who*/) - { - if (me->GetHomePosition().IsInDist(Center,50.f)) - { - if (pInstance) - pInstance->SetData(TYPE_COLOSSUS,pInstance->GetData(TYPE_COLOSSUS)+1); - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady() ; - } -}; - -struct npc_thorims_hammerAI : public ScriptedAI -{ - npc_thorims_hammerAI(Creature* pCreature) : ScriptedAI (pCreature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_BLUE, me); - } - - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false)) - { - if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); - } - } - - void Reset () - { - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_DUMMY_BLUE)) - me->AddAura(AURA_DUMMY_BLUE, me); - - if (!UpdateVictim()) - return; - } -}; - -struct npc_mimirons_infernoAI : public npc_escortAI -{ - npc_mimirons_infernoAI(Creature* pCreature) : npc_escortAI(pCreature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_YELLOW, me); - me->SetReactState(REACT_PASSIVE); - } - - void WaypointReached(uint32 i) - { - } - - void Reset() - { - infernoTimer = 2000; - } - - uint32 infernoTimer; - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - { - Start(false,true,0,NULL,false,true); - } - else - { - if(infernoTimer <= diff) - { - if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - { - pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); - infernoTimer = 2000; + device->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } else - infernoTimer -= diff; - - if (!me->HasAura(AURA_DUMMY_YELLOW)) - me->AddAura(AURA_DUMMY_YELLOW, me); - } - } -}; - - -struct npc_hodirs_furyAI : public ScriptedAI -{ - npc_hodirs_furyAI(Creature* pCreature) : ScriptedAI (pCreature) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->AddAura(AURA_DUMMY_GREEN, me); - } - - void MoveInLineOfSight(Unit* who) - { - if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) - { - if (Creature* pTrigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) - pTrigger->CastSpell(who, SPELL_HODIR_S_FURY, true); - } - } - - void Reset() - { - } - - void UpdateAI(const uint32 diff) - { - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); - - if (!UpdateVictim()) - return; - } -}; - -struct npc_freyas_wardAI : public ScriptedAI -{ - npc_freyas_wardAI(Creature* pCreature) : ScriptedAI(pCreature) - { - me->AddAura(AURA_DUMMY_GREEN, me); - } - - uint32 summonTimer ; - - void Reset() - { - summonTimer = 5000 ; - } - - void UpdateAI(const uint32 diff) - { - if(summonTimer <= diff) - { - DoCast(SPELL_FREYA_S_WARD_EFFECT_1) ; - DoCast(SPELL_FREYA_S_WARD_EFFECT_2) ; - summonTimer = 20000 ; - } - else - summonTimer -= diff ; - - if (!me->HasAura(AURA_DUMMY_GREEN)) - me->AddAura(AURA_DUMMY_GREEN, me); - - if (!UpdateVictim()) - return; - } -}; - -struct npc_freya_ward_summonAI : public ScriptedAI -{ - npc_freya_ward_summonAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pCreature->GetMotionMaster()->MoveRandom(100); - } - - uint32 lashTimer ; - - void Reset() - { - lashTimer = 5000 ; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if(lashTimer <= diff) - { - DoCast(SPELL_LASH); - lashTimer = 20000; - } - else - lashTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; -//npc lore keeper -#define GOSSIP_ITEM_1 "Activate secondary defensive systems" -#define GOSSIP_ITEM_2 "Confirmed" -struct npc_lorekeeperAI : public ScriptedAI -{ - npc_lorekeeperAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - void DoAction(const int32 uiAction) - { - // Start encounter - if (uiAction == 0) - { - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) - DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); - return; - } - } -}; - -bool GossipHello_npc_lorekeeper(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE && pPlayer) - { - pPlayer->PrepareGossipMenu(pCreature); - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - return true; -} -//enable hardmode -bool GossipSelect_npc_lorekeeper(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - if (pPlayer) - { - pPlayer->PrepareGossipMenu(pCreature); - pInstance->instance->LoadGrid(364,-16); //make sure leviathan is loaded - - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - break; - case GOSSIP_ACTION_INFO_DEF+2: - if (pPlayer) - pPlayer->CLOSE_GOSSIP_MENU(); - - if (Creature* pLeviathan = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_LEVIATHAN))) - { - CAST_AI(boss_flame_leviathanAI, (pLeviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles - pCreature->SetVisibility(VISIBILITY_OFF); - pCreature->AI()->DoAction(0); // spawn the vehicles - pCreature->SetVisibility(VISIBILITY_OFF); - if (Creature* Delorah = pCreature->FindNearestCreature(NPC_DELORAH, 1000, true)) - { - if (Creature* Branz = pCreature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + if (seatId == SEAT_TURRET) { - Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); - //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz + if (apply) + return; + if (Unit* device = vehicle->GetPassenger(SEAT_DEVICE)) + { + device->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + device->SetUInt32Value(UNIT_FIELD_FLAGS, 0); // unselectable + } + } + } + }; + +}; + class boss_flame_leviathan_defense_turret : public CreatureScript +{ +public: + boss_flame_leviathan_defense_turret() : CreatureScript("boss_flame_leviathan_defense_turret") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_flame_leviathan_defense_turretAI (pCreature); + } + + struct boss_flame_leviathan_defense_turretAI : public TurretAI + { + boss_flame_leviathan_defense_turretAI(Creature *c) : TurretAI(c) {} + + void DamageTaken(Unit* who, uint32 &damage) + { + if (!CanAIAttack(who)) + damage = 0; + } + + bool CanAIAttack(const Unit *who) const + { + if (who->GetTypeId() != TYPEID_PLAYER || !who->GetVehicle() || who->GetVehicleBase()->GetEntry() != 33114) + return false; + return true; + } + }; + +}; + class boss_flame_leviathan_overload_device : public CreatureScript +{ +public: + boss_flame_leviathan_overload_device() : CreatureScript("boss_flame_leviathan_overload_device") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_flame_leviathan_overload_deviceAI (pCreature); + } + + struct boss_flame_leviathan_overload_deviceAI : public PassiveAI + { + boss_flame_leviathan_overload_deviceAI(Creature* pCreature) : PassiveAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void DoAction(const int32 param) + { + if (param == EVENT_SPELLCLICK) + { + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pInstance->instance->GetCreature(TYPE_LEVIATHAN)->AI()->DoAction(9); //should be called if all 3 overload devices are active + if (me->GetVehicle()) + { + if (Unit* pPlayer = me->GetVehicle()->GetPassenger(SEAT_PLAYER)) + { + pPlayer->ExitVehicle(); + me->GetVehicleBase()->CastSpell(pPlayer, SPELL_SMOKE_TRAIL, true); + if (Unit* leviathan = me->GetVehicleBase()->GetVehicleBase()) + pPlayer->GetMotionMaster()->MoveKnockbackFrom(leviathan->GetPositionX(), leviathan->GetPositionY(), 30, 30); + } } } } - break; + }; + +}; + class boss_flame_leviathan_safety_container : public CreatureScript +{ +public: + boss_flame_leviathan_safety_container() : CreatureScript("boss_flame_leviathan_safety_container") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_flame_leviathan_safety_containerAI(pCreature); } - return true; -} + + struct boss_flame_leviathan_safety_containerAI : public PassiveAI + { + boss_flame_leviathan_safety_containerAI(Creature* pCreature) : PassiveAI(pCreature) + { + } + + void JustDied() + { + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); + } + + void UpdateAI(const uint32 diff) + { + } + }; }; + +class npc_mechanolift : public CreatureScript +{ +public: + npc_mechanolift() : CreatureScript("npc_mechanolift") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_mechanoliftAI(pCreature); + } + + struct npc_mechanoliftAI : public PassiveAI + { + npc_mechanoliftAI(Creature* pCreature) : PassiveAI(pCreature), vehicle(pCreature->GetVehicleKit()) + { + assert(vehicle); + } + + Vehicle* vehicle; + + uint32 MoveTimer; + + void Reset () + { + MoveTimer = 0; + me->GetMotionMaster()->MoveRandom(50); + } + + void JustDied(Unit* pKiller) + { + me->GetMotionMaster()->MoveTargetedHome(); + Creature* pLiquid = DoSummon(MOB_LIQUID, me, 0); + if (pLiquid) + { + pLiquid->CastSpell(pLiquid, SPELL_LIQUID_PYRITE, true); + pLiquid->GetMotionMaster()->MoveFall(pKiller->GetPositionZ()); + } + + } + + void MovementInform(uint32 type, uint32 id) + { + if (id == 1) + { + Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 5, true); + if (pContainer) + pContainer->EnterVehicle(me); + } + } + + void UpdateAI(const uint32 diff) + { + if (MoveTimer <= diff) + { + if (me->GetVehicleKit()->HasEmptySeat(-1)) + { + Creature* pContainer = me->FindNearestCreature(MOB_CONTAINER, 50, true); + if (pContainer && !pContainer->GetVehicle()) + me->GetMotionMaster()->MovePoint(1,pContainer->GetPositionX(),pContainer->GetPositionY(),pContainer->GetPositionZ()); + } + MoveTimer = 30000; //check next 30 seconds + } + else + MoveTimer-=diff; + } + }; + +}; + + class spell_pool_of_tar : public CreatureScript +{ +public: + spell_pool_of_tar() : CreatureScript("spell_pool_of_tar") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new spell_pool_of_tarAI (pCreature); + } + + struct spell_pool_of_tarAI : public PassiveAI + { + spell_pool_of_tarAI(Creature* pCreature) : PassiveAI(pCreature) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void DamageTaken(Unit * /*who*/, uint32 &damage) + { + damage = 0; + } + + void SpellHit(Unit* /*caster*/, const SpellEntry* pSpell) + { + if (pSpell->SchoolMask & SPELL_SCHOOL_MASK_FIRE && !me->HasAura(SPELL_BLAZE)) + me->CastSpell(me, SPELL_BLAZE, true); + } + }; + +}; + class npc_colossus : public CreatureScript +{ +public: + npc_colossus() : CreatureScript("npc_colossus") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_colossusAI(pCreature); + } + + struct npc_colossusAI : public ScriptedAI + { + npc_colossusAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void JustDied(Unit* /*Who*/) + { + if (me->GetHomePosition().IsInDist(Center,50.f)) + { + if (pInstance) + pInstance->SetData(TYPE_COLOSSUS,pInstance->GetData(TYPE_COLOSSUS)+1); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady() ; + } + }; + +}; + class npc_thorims_hammer : public CreatureScript +{ +public: + npc_thorims_hammer() : CreatureScript("npc_thorims_hammer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_thorims_hammerAI(pCreature); + } + + struct npc_thorims_hammerAI : public ScriptedAI + { + npc_thorims_hammerAI(Creature* pCreature) : ScriptedAI (pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_BLUE, me); + } + + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,10,false)) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_THORIM_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + pTrigger->CastSpell(who, SPELL_THORIM_S_HAMMER, true); + } + } + + void Reset () + { + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_DUMMY_BLUE)) + me->AddAura(AURA_DUMMY_BLUE, me); + + if (!UpdateVictim()) + return; + } + }; + +}; + class npc_mimirons_inferno : public CreatureScript +{ +public: + npc_mimirons_inferno() : CreatureScript("npc_mimirons_inferno") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_mimirons_infernoAI(pCreature); + } + + struct npc_mimirons_infernoAI : public npc_escortAI + { + npc_mimirons_infernoAI(Creature* pCreature) : npc_escortAI(pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_YELLOW, me); + me->SetReactState(REACT_PASSIVE); + } + + void WaypointReached(uint32 i) + { + } + + void Reset() + { + infernoTimer = 2000; + } + + uint32 infernoTimer; + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + Start(false,true,0,NULL,false,true); + } + else + { + if(infernoTimer <= diff) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + { + pTrigger->CastSpell(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(), SPELL_MIMIRON_S_INFERNO, true); + infernoTimer = 2000; + } + } + else + infernoTimer -= diff; + + if (!me->HasAura(AURA_DUMMY_YELLOW)) + me->AddAura(AURA_DUMMY_YELLOW, me); + } + } + }; + +}; + + class npc_hodirs_fury : public CreatureScript +{ +public: + npc_hodirs_fury() : CreatureScript("npc_hodirs_fury") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_hodirs_furyAI(pCreature); + } + + struct npc_hodirs_furyAI : public ScriptedAI + { + npc_hodirs_furyAI(Creature* pCreature) : ScriptedAI (pCreature) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->AddAura(AURA_DUMMY_GREEN, me); + } + + void MoveInLineOfSight(Unit* who) + { + if (who->GetTypeId() == TYPEID_PLAYER && who->IsVehicle() && me->IsInRange(who,0,5,false)) + { + if (Creature* pTrigger = DoSummonFlyer(NPC_HODIR_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN)) + pTrigger->CastSpell(who, SPELL_HODIR_S_FURY, true); + } + } + + void Reset() + { + } + + void UpdateAI(const uint32 diff) + { + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); + + if (!UpdateVictim()) + return; + } + }; + +}; + class npc_freyas_ward : public CreatureScript +{ +public: + npc_freyas_ward() : CreatureScript("npc_freyas_ward") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_freyas_wardAI(pCreature); + } + + struct npc_freyas_wardAI : public ScriptedAI + { + npc_freyas_wardAI(Creature* pCreature) : ScriptedAI(pCreature) + { + me->AddAura(AURA_DUMMY_GREEN, me); + } + + uint32 summonTimer ; + + void Reset() + { + summonTimer = 5000 ; + } + + void UpdateAI(const uint32 diff) + { + if(summonTimer <= diff) + { + DoCast(SPELL_FREYA_S_WARD_EFFECT_1) ; + DoCast(SPELL_FREYA_S_WARD_EFFECT_2) ; + summonTimer = 20000 ; + } + else + summonTimer -= diff ; + + if (!me->HasAura(AURA_DUMMY_GREEN)) + me->AddAura(AURA_DUMMY_GREEN, me); + + if (!UpdateVictim()) + return; + } + }; + +}; + class npc_freya_ward_summon : public CreatureScript +{ +public: + npc_freya_ward_summon() : CreatureScript("npc_freya_ward_summon") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_freya_ward_summonAI (pCreature); + } + + struct npc_freya_ward_summonAI : public ScriptedAI + { + npc_freya_ward_summonAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pCreature->GetMotionMaster()->MoveRandom(100); + } + + uint32 lashTimer ; + + void Reset() + { + lashTimer = 5000 ; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if(lashTimer <= diff) + { + DoCast(SPELL_LASH); + lashTimer = 20000; + } + else + lashTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + +//npc lore keeper +#define GOSSIP_ITEM_1 "Activate secondary defensive systems" +#define GOSSIP_ITEM_2 "Confirmed" class npc_lorekeeper : public CreatureScript +{ +public: + npc_lorekeeper() : CreatureScript("npc_lorekeeper") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + InstanceScript* pInstance = pCreature->GetInstanceScript(); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + if (pPlayer) + { + pPlayer->PrepareGossipMenu(pCreature); + pInstance->instance->LoadGrid(364,-16); //make sure leviathan is loaded + + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + break; + case GOSSIP_ACTION_INFO_DEF+2: + if (pPlayer) + pPlayer->CLOSE_GOSSIP_MENU(); + + if (Creature* pLeviathan = pInstance->instance->GetCreature(pInstance->GetData64(TYPE_LEVIATHAN))) + { + CAST_AI(boss_flame_leviathan::boss_flame_leviathanAI, (pLeviathan->AI()))->DoAction(0); //enable hard mode activating the 4 additional events spawning additional vehicles + pCreature->SetVisibility(VISIBILITY_OFF); + pCreature->AI()->DoAction(0); // spawn the vehicles + pCreature->SetVisibility(VISIBILITY_OFF); + if (Creature* Delorah = pCreature->FindNearestCreature(NPC_DELORAH, 1000, true)) + { + if (Creature* Branz = pCreature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + { + Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); + //TODO DoScriptText(xxxx, Delorah, Branz); when reached at branz + } + } + } + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE && pPlayer) + { + pPlayer->PrepareGossipMenu(pCreature); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_lorekeeperAI (pCreature); + } + + struct npc_lorekeeperAI : public ScriptedAI + { + npc_lorekeeperAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + void DoAction(const int32 uiAction) + { + // Start encounter + if (uiAction == 0) + { + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_SIEGE, PosSiege[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_CHOPPER, PosChopper[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + for(uint32 i = 0; i < (RAID_MODE(2,5)); ++i) + DoSummon(VEHICLE_DEMOLISHER,PosDemolisher[i],3000,TEMPSUMMON_CORPSE_TIMED_DESPAWN); + return; + } + } + }; + +}; + +//enable hardmode ////npc_brann_bronzebeard this requires more work involving area triggers. if reached this guy speaks through his radio.. //#define GOSSIP_ITEM_1 "xxxxx" //#define GOSSIP_ITEM_2 "xxxxx" -// -//bool GossipHello_npc_brann_bronzebeard(Player* pPlayer, Creature* pCreature) -//{ -// ScriptedInstance* pInstance = pCreature->GetInstanceData(); -// if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE) -// { -// pPlayer->PrepareGossipMenu(pCreature); -// -// pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); -// pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -// } -// return true; -//} -// -//bool GossipSelect_npc_brann_bronzebeard(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -//{ -// switch(uiAction) -// { -// case GOSSIP_ACTION_INFO_DEF+1: -// if (pPlayer) -// { -// pPlayer->PrepareGossipMenu(pCreature); -// -// pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); -// pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -// } -// break; -// case GOSSIP_ACTION_INFO_DEF+2: -// if (pPlayer) -// pPlayer->CLOSE_GOSSIP_MENU(); -// if (Creature* Lorekeeper = pCreature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon -// Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); -// break; -// } -// return true; -//} - -void GODestroyed_go_ulduar_tower(Player* pPlayer, GameObject* pGO, uint32 value) +// /* class npc_brann_bronzebeard : public CreatureScript { - ScriptedInstance* pInstance = pGO->GetInstanceData(); - if (pGO->GetGOValue()->building.health == 0) +public: + npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { } + + //bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) + //{ + // switch(uiAction) + // { + // case GOSSIP_ACTION_INFO_DEF+1: + // if (pPlayer) + // { + // pPlayer->PrepareGossipMenu(pCreature); + // + // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_2,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // } + // break; + // case GOSSIP_ACTION_INFO_DEF+2: + // if (pPlayer) + // pPlayer->CLOSE_GOSSIP_MENU(); + // if (Creature* Lorekeeper = pCreature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon + // Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + // break; + // } + // return true; + //} + //bool OnGossipHello(Player* pPlayer, Creature* pCreature) + //{ + // InstanceScript* pInstance = pCreature->GetInstanceScript(); + // if (pInstance && pInstance->GetData(TYPE_LEVIATHAN) !=DONE) + // { + // pPlayer->PrepareGossipMenu(pCreature); + // + // pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + // pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + // } + // return true; + //} + // } */ class go_ulduar_tower : public GameObjectScript +{ +public: + go_ulduar_tower() : GameObjectScript("go_ulduar_tower") { } + + void OnDestroyed(Player* pPlayer, GameObject* pGO, uint32 value) { - switch(pGO->GetEntry()) + InstanceScript* pInstance = pGO->GetInstanceScript(); + if (pGO->GetGOValue()->building.health == 0) { - case GO_TOWER_OF_STORMS: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_STORM_DESTROYED); - break; - case GO_TOWER_OF_FLAMES: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FLAMES_DESTROYED); - break; - case GO_TOWER_OF_FROST: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FROST_DESTROYED); - break; - case GO_TOWER_OF_LIFE: - pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_LIFE_DESTROYED); - break; + switch(pGO->GetEntry()) + { + case GO_TOWER_OF_STORMS: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_STORM_DESTROYED); + break; + case GO_TOWER_OF_FLAMES: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FLAMES_DESTROYED); + break; + case GO_TOWER_OF_FROST: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_FROST_DESTROYED); + break; + case GO_TOWER_OF_LIFE: + pInstance->ProcessEvent(pGO, EVENT_TOWER_OF_LIFE_DESTROYED); + break; + } } } -} -bool AreaTrigger_at_RX_214_repair_o_matic_station(Player* pPlayer, const AreaTriggerEntry* pAt) +}; + class at_RX_214_repair_o_matic_station : public AreaTriggerScript { - if(Creature* vehicle = pPlayer->GetVehicleCreatureBase()) +public: + at_RX_214_repair_o_matic_station() : AreaTriggerScript("at_RX_214_repair_o_matic_station") { } + + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry* pAt) { - if(!vehicle->HasAura(SPELL_AUTO_REPAIR)) + if(Creature* vehicle = pPlayer->GetVehicleCreatureBase()) { - pPlayer->MonsterTextEmote(EMOTE_REPAIR, pPlayer->GetGUID(), true); - pPlayer->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + if(!vehicle->HasAura(SPELL_AUTO_REPAIR)) + { + pPlayer->MonsterTextEmote(EMOTE_REPAIR, pPlayer->GetGUID(), true); + pPlayer->CastSpell(vehicle, SPELL_AUTO_REPAIR, true); + } } + return true; } - return true; -} -CreatureAI* GetAI_boss_flame_leviathan(Creature* pCreature) -{ - return new boss_flame_leviathanAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_seat(Creature* pCreature) -{ - return new boss_flame_leviathan_seatAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_defense_turret(Creature* pCreature) -{ - return new boss_flame_leviathan_defense_turretAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_overload_device(Creature* pCreature) -{ - return new boss_flame_leviathan_overload_deviceAI (pCreature); -} - -CreatureAI* GetAI_boss_flame_leviathan_safety_container(Creature* pCreature) -{ - return new boss_flame_leviathan_safety_containerAI(pCreature); -} - -CreatureAI* GetAI_npc_mechanolift(Creature* pCreature) -{ - return new npc_mechanoliftAI(pCreature); -} - -CreatureAI* GetAI_spell_pool_of_tar(Creature* pCreature) -{ - return new spell_pool_of_tarAI (pCreature); -} - -CreatureAI* GetAI_npc_colossus(Creature* pCreature) -{ - return new npc_colossusAI(pCreature); -} - -CreatureAI* GetAI_npc_thorims_hammer(Creature* pCreature) -{ - return new npc_thorims_hammerAI(pCreature); -} - -CreatureAI* GetAI_npc_mimirons_inferno(Creature* pCreature) -{ - return new npc_mimirons_infernoAI(pCreature); -} - -CreatureAI* GetAI_npc_hodirs_fury(Creature* pCreature) -{ - return new npc_hodirs_furyAI(pCreature); -} - -CreatureAI* GetAI_npc_freyas_ward(Creature* pCreature) -{ - return new npc_freyas_wardAI(pCreature); -} - -CreatureAI* GetAI_npc_freya_ward_summon(Creature* pCreature) -{ - return new npc_freya_ward_summonAI (pCreature); -} -CreatureAI* GetAI_npc_lorekeeper(Creature* pCreature) -{ - return new npc_lorekeeperAI (pCreature); -} +}; void AddSC_boss_flame_leviathan() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_flame_leviathan"; - newscript->GetAI = &GetAI_boss_flame_leviathan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_seat"; - newscript->GetAI = &GetAI_boss_flame_leviathan_seat; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_defense_turret"; - newscript->GetAI = &GetAI_boss_flame_leviathan_defense_turret; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_overload_device"; - newscript->GetAI = &GetAI_boss_flame_leviathan_overload_device; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_flame_leviathan_safety_container"; - newscript->GetAI = &GetAI_boss_flame_leviathan_safety_container; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mechanolift"; - newscript->GetAI = &GetAI_npc_mechanolift; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "spell_pool_of_tar"; - newscript->GetAI = &GetAI_spell_pool_of_tar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_colossus"; - newscript->GetAI = &GetAI_npc_colossus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thorims_hammer"; - newscript->GetAI = &GetAI_npc_thorims_hammer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_mimirons_inferno"; - newscript->GetAI = &GetAI_npc_mimirons_inferno; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_hodirs_fury"; - newscript->GetAI = &GetAI_npc_hodirs_fury; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_freyas_ward"; - newscript->GetAI = &GetAI_npc_freyas_ward; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_freya_ward_summon"; - newscript->GetAI = &GetAI_npc_freya_ward_summon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lorekeeper"; - newscript->GetAI = &GetAI_npc_lorekeeper; - newscript->pGossipHello = &GossipHello_npc_lorekeeper; - newscript->pGossipSelect = &GossipSelect_npc_lorekeeper; - newscript->RegisterSelf(); - - /*newscript = new Script; - newscript->Name = "npc_brann_bronzebeard"; - newscript->pGossipHello = &GossipHello_npc_brann_bronzebeard; - newscript->pGossipSelect = &GossipSelect_npc_brann_bronzebeard; - newscript->RegisterSelf();*/ - - newscript = new Script; - newscript->Name = "go_ulduar_tower"; - newscript->pGODestroyed = &GODestroyed_go_ulduar_tower; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_RX_214_repair_o_matic_station"; - newscript->pAreaTrigger = &AreaTrigger_at_RX_214_repair_o_matic_station; - newscript->RegisterSelf(); + new boss_flame_leviathan(); + new boss_flame_leviathan_seat(); + new boss_flame_leviathan_defense_turret(); + new boss_flame_leviathan_overload_device(); + new boss_flame_leviathan_safety_container(); + new npc_mechanolift(); + new spell_pool_of_tar(); + new npc_colossus(); + new npc_thorims_hammer(); + new npc_mimirons_inferno(); + new npc_hodirs_fury(); + new npc_freyas_ward(); + new npc_freya_ward_summon(); + new npc_lorekeeper(); + // new npc_brann_bronzebeard(); + new go_ulduar_tower(); + new at_RX_214_repair_o_matic_station(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp index df1298eb3b7..31fee5e09e2 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_freya.cpp @@ -63,62 +63,65 @@ enum ACHIEV_LUMBERJACKED = 21686, SPELL_LUMBERJACKED_ACHIEVEMENT_CHECK = 65296, }; - -struct boss_freyaAI : public BossAI + class boss_freya : public CreatureScript { - boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) +public: + boss_freya() : CreatureScript("boss_freya") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_freyaAI(pCreature); } - void Reset() + struct boss_freyaAI : public BossAI { - _Reset(); - } + boss_freyaAI(Creature* pCreature) : BossAI(pCreature, TYPE_FREYA) + { + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void Reset() + { + _Reset(); + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - // cast is not rewarding the achievement. - // DoCast(SPELL_ACHIEVEMENT_CHECK); - instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_ACHIEVEMENT_CHECK); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - } + // cast is not rewarding the achievement. + // DoCast(SPELL_ACHIEVEMENT_CHECK); + instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_ACHIEVEMENT_CHECK); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + } -// - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_freya(Creature* pCreature) -{ - return new boss_freyaAI(pCreature); -} void AddSC_boss_freya() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_freya"; - newscript->GetAI = &GetAI_boss_freya; - newscript->RegisterSelf(); + new boss_freya(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp index b43dbe82b60..1f3327381a6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_hodir.cpp @@ -30,59 +30,61 @@ enum Yells SAY_YS_HELP = -1603217, SAY_HARD_MODE_MISSED = -1603218, }; - -struct boss_hodirAI : public BossAI + class boss_hodir : public CreatureScript { - boss_hodirAI(Creature *pCreature) : BossAI(pCreature, TYPE_HODIR) +public: + boss_hodir() : CreatureScript("boss_hodir") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_hodirAI(pCreature); } - void Reset() + struct boss_hodirAI : public BossAI { - _Reset(); - } + boss_hodirAI(Creature *pCreature) : BossAI(pCreature, TYPE_HODIR) + { + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void Reset() + { + _Reset(); + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + } -// - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_hodir(Creature* pCreature) -{ - return new boss_hodirAI(pCreature); -} void AddSC_boss_hodir() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hodir"; - newscript->GetAI = &GetAI_boss_hodir; - newscript->RegisterSelf(); - + new boss_hodir(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp index ac5414eaedf..01220de94d6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp @@ -39,98 +39,99 @@ enum { ACHIEV_TIMED_START_EVENT = 20951, }; - -struct boss_ignis_AI : public BossAI + class boss_ignis : public CreatureScript { - boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} +public: + boss_ignis() : CreatureScript("boss_ignis") { } - uint32 uiFlameJetsTimer; - uint32 uiScorchTimer; - uint32 uiSlagPotTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - _Reset(); - uiFlameJetsTimer = 32000; - uiScorchTimer = 100; - uiSlagPotTimer = 100; - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + return new boss_ignis_AI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_ignis_AI : public BossAI { - DoScriptText(SAY_AGGRO,me); - _EnterCombat(); + boss_ignis_AI(Creature *pCreature) : BossAI(pCreature, TYPE_IGNIS) {} - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } + uint32 uiFlameJetsTimer; + uint32 uiScorchTimer; + uint32 uiSlagPotTimer; - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (me->GetPositionY() < 150 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. + void Reset() { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(false); - me->GetMotionMaster()->MoveTargetedHome(); + _Reset(); + uiFlameJetsTimer = 32000; + uiScorchTimer = 100; + uiSlagPotTimer = 100; + + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - if (uiFlameJetsTimer <= diff) + void EnterCombat(Unit* /*who*/) { - DoCast(SPELL_FLAME_JETS); - uiFlameJetsTimer = 25000; - } else uiFlameJetsTimer -= diff; + DoScriptText(SAY_AGGRO,me); + _EnterCombat(); - if (uiScorchTimer <= diff) - { - DoScriptText(RAND(SAY_SCORCH_1,SAY_SCORCH_2), me); - DoCast(SPELL_SCORCH); - uiScorchTimer = 20000; - } else uiScorchTimer -= diff; + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } - if (uiSlagPotTimer <= diff) + void KilledUnit(Unit* /*victim*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->GetPositionY() < 150 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { - DoScriptText(SAY_SLAG_POT, me); - DoCast(pTarget, SPELL_SLAG_POT); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(false); + me->GetMotionMaster()->MoveTargetedHome(); } - uiSlagPotTimer = 30000; - } else uiSlagPotTimer -= diff; - DoMeleeAttackIfReady(); - } + if (uiFlameJetsTimer <= diff) + { + DoCast(SPELL_FLAME_JETS); + uiFlameJetsTimer = 25000; + } else uiFlameJetsTimer -= diff; + + if (uiScorchTimer <= diff) + { + DoScriptText(RAND(SAY_SCORCH_1,SAY_SCORCH_2), me); + DoCast(SPELL_SCORCH); + uiScorchTimer = 20000; + } else uiScorchTimer -= diff; + + if (uiSlagPotTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_SLAG_POT, me); + DoCast(pTarget, SPELL_SLAG_POT); + } + uiSlagPotTimer = 30000; + } else uiSlagPotTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; - -CreatureAI* GetAI_boss_ignis(Creature* pCreature) -{ - return new boss_ignis_AI (pCreature); -} void AddSC_boss_ignis() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ignis"; - newscript->GetAI = &GetAI_boss_ignis; - newscript->RegisterSelf(); + new boss_ignis(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp index 710484de42c..d8f7a3eb6e7 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp @@ -53,113 +53,116 @@ enum { ACHIEV_DISARMED_START_EVENT = 21687, }; - -struct boss_kologarnAI : public BossAI + class boss_kologarn : public CreatureScript { - boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()), - left(false), right(false) +public: + boss_kologarn() : CreatureScript("boss_kologarn") { } + + CreatureAI* GetAI(Creature* pCreature) const { - assert(vehicle); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation + return new boss_kologarnAI (pCreature); } - Vehicle *vehicle; - bool left, right; - - void AttackStart(Unit *who) + struct boss_kologarnAI : public BossAI { - me->Attack(who, true); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } - - void KilledUnit(Unit* /*who*/) - { - DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_2), me); - } - - void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply) - { - if (who->GetTypeId() == TYPEID_UNIT) + boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, TYPE_KOLOGARN), vehicle(pCreature->GetVehicleKit()), + left(false), right(false) { - if (who->GetEntry() == 32933) - left = apply; - else if (who->GetEntry() == 32934) - right = apply; - - if (!apply && instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); - - who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - CAST_CRE(who)->SetReactState(REACT_PASSIVE); - } - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - events.ScheduleEvent(EVENT_SMASH, 5000); - events.ScheduleEvent(EVENT_SWEEP, 10000); - events.ScheduleEvent(EVENT_GRIP, 15000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell - switch(events.GetEvent()) - { - case EVENT_NONE: - break; - case EVENT_SMASH: - if (left && right) - DoCastVictim(SPELL_TWO_ARM_SMASH, true); - else if (left || right) - DoCastVictim(SPELL_ONE_ARM_SMASH, true); - events.RepeatEvent(15000); - break; - case EVENT_SWEEP: - if (left) - DoCastAOE(SPELL_ARM_SWEEP, true); - events.RepeatEvent(15000); - break; - case EVENT_GRIP: - if (right) - DoCastAOE(SPELL_STONE_GRIP, true); - events.RepeatEvent(15000); - break; - default: - events.PopEvent(); - break; + assert(vehicle); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); // i think this is a hack, but there is no other way to disable his rotation } - DoMeleeAttackIfReady(); - } + Vehicle *vehicle; + bool left, right; + + void AttackStart(Unit *who) + { + me->Attack(who, true); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } + + void KilledUnit(Unit* /*who*/) + { + DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_2), me); + } + + void PassengerBoarded(Unit *who, int8 /*seatId*/, bool apply) + { + if (who->GetTypeId() == TYPEID_UNIT) + { + if (who->GetEntry() == 32933) + left = apply; + else if (who->GetEntry() == 32934) + right = apply; + + if (!apply && instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); + + who->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); + CAST_CRE(who)->SetReactState(REACT_PASSIVE); + } + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); + events.ScheduleEvent(EVENT_SMASH, 5000); + events.ScheduleEvent(EVENT_SWEEP, 10000); + events.ScheduleEvent(EVENT_GRIP, 15000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + // TODO: because we are using hack, he is stunned and cannot cast, so we use triggered for every spell + switch(events.GetEvent()) + { + case EVENT_NONE: + break; + case EVENT_SMASH: + if (left && right) + DoCastVictim(SPELL_TWO_ARM_SMASH, true); + else if (left || right) + DoCastVictim(SPELL_ONE_ARM_SMASH, true); + events.RepeatEvent(15000); + break; + case EVENT_SWEEP: + if (left) + DoCastAOE(SPELL_ARM_SWEEP, true); + events.RepeatEvent(15000); + break; + case EVENT_GRIP: + if (right) + DoCastAOE(SPELL_STONE_GRIP, true); + events.RepeatEvent(15000); + break; + default: + events.PopEvent(); + break; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_kologarn(Creature* pCreature) -{ - return new boss_kologarnAI (pCreature); -} void AddSC_boss_kologarn() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kologarn"; - newscript->GetAI = &GetAI_boss_kologarn; - newscript->RegisterSelf(); + new boss_kologarn(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp index bf4ddae9e99..0af01cecd5d 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_razorscale.cpp @@ -46,285 +46,288 @@ enum Mobs { NPC_DARK_RUNE_SENTINEL = 33846 }; - -struct boss_razorscaleAI : public BossAI + class boss_razorscale : public CreatureScript { - boss_razorscaleAI(Creature *pCreature) : BossAI(pCreature, TYPE_RAZORSCALE) {} +public: + boss_razorscale() : CreatureScript("boss_razorscale") { } - uint8 Phase; - - uint32 FlameBreathTimer; - uint32 FuseArmorTimer; - uint32 DevouringFlameTimer; - uint32 FlameBuffetTimer; - uint32 SummonAddsTimer; - uint32 WingBuffetTimer; - uint32 FireballTimer; - //uint32 StunTimer; - //uint32 CastSpellsTimer; - - bool InitialSpawn; - bool IsFlying; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Phase = 1; - - FlyPhase(Phase, 0); - - FlameBreathTimer = 20000; - DevouringFlameTimer = 2000; - FuseArmorTimer = 15000; - FlameBuffetTimer = 3000; - SummonAddsTimer = 45000; - WingBuffetTimer = 17000; - FireballTimer = 18000; - //StunTimer = 30000; - //CastSpellsTimer = 0; - - InitialSpawn = true; - IsFlying = true; - - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + return new boss_razorscaleAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_razorscaleAI : public BossAI { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - } + boss_razorscaleAI(Creature *pCreature) : BossAI(pCreature, TYPE_RAZORSCALE) {} - void JustDied(Unit* /*Killer*/) - { - } + uint8 Phase; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_KILL, me); - } + uint32 FlameBreathTimer; + uint32 FuseArmorTimer; + uint32 DevouringFlameTimer; + uint32 FlameBuffetTimer; + uint32 SummonAddsTimer; + uint32 WingBuffetTimer; + uint32 FireballTimer; + //uint32 StunTimer; + //uint32 CastSpellsTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + bool InitialSpawn; + bool IsFlying; - if (me->GetPositionY() > -60 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. + void Reset() { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(false); - me->GetMotionMaster()->MoveTargetedHome(); - } + Phase = 1; - // Victim is not controlled by a player (should never happen) - if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) - me->Kill(me->getVictim()); + FlyPhase(Phase, 0); - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 99 && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important! - { - Phase = 2; - DoScriptText(SAY_PHASE_2_TRANS, me); // Audio: "Move quickly! She won't remain grounded for long!" - } + FlameBreathTimer = 20000; + DevouringFlameTimer = 2000; + FuseArmorTimer = 15000; + FlameBuffetTimer = 3000; + SummonAddsTimer = 45000; + WingBuffetTimer = 17000; + FireballTimer = 18000; + //StunTimer = 30000; + //CastSpellsTimer = 0; - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 33 && Phase == 2) // Health under 33%, Razorscale can't fly anymore. - { - Phase = 3; - DoScriptText(SAY_PHASE_3_TRANS, me); // "Razorscale lands permanently!" - // TODO: Cast Devouring Flame on all harpoon guns simultaneously, briefly after Phase 3 starts (lasts until the harpoon guns are destroyed) - } - - /* - if (Phase == 2 && CastSpellsTimer > 0) // 5 seconds of spell casting, after stun breaks, during Phase 2 - { - if (CastSpellsTimer <= diff) // 5 seconds are up - Phase = 1; // Return to phase 1 - else - CastSpellsTimer -= diff; - }*/ - - FlyPhase(Phase, diff); - - if (Phase >= 2) // Ground Phase (Phase 3 = permanent ground phase) - { - if (FuseArmorTimer <= diff) - { - DoCastVictim(SPELL_FUSEARMOR); - FuseArmorTimer = 10000; - } else FuseArmorTimer -= diff; - - if (WingBuffetTimer <= diff) - { - DoCast(SPELL_WINGBUFFET); - WingBuffetTimer = urand(7000,14000); - } else WingBuffetTimer -= diff; - - if (FireballTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) - { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_FIREBALL); - } - - FireballTimer = 18000; - } else FireballTimer -= diff; - - if (FlameBreathTimer <= diff) - { - DoScriptText(EMOTE_BREATH, me); // TODO: "Razorscale takes a deep breath..." - DoCastVictim(SPELL_FLAMEBREATH); - FlameBreathTimer = 15000; - WingBuffetTimer = 0; - } else FlameBreathTimer -= diff; - - if (Phase == 3) - { - if (FlameBuffetTimer <= diff) - { - DoScriptText(EMOTE_BREATH, me); - std::list pTargets; - SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true); - uint8 i = 0; - for (std::list::const_iterator itr = pTargets.begin(); itr != pTargets.end();) - { - if (me->HasInArc(M_PI, *itr)) - { - DoCast(*itr, SPELL_FLAMEBUFFET, true); - ++i; - } - if (++itr == pTargets.end() || i == RAID_MODE(3,9)) - { - AttackStart(*--itr); // seems to attack targets randomly during perma-ground phase.. - break; - } - } - FlameBuffetTimer = 25000; - } else FlameBuffetTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - else if (Phase == 1) //Flying Phase - { - if (InitialSpawn) - SummonAdds(); - - InitialSpawn = false; - - if (FireballTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) - { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_FIREBALL); - } - - FireballTimer = 18000; - } else FireballTimer -= diff; - - if (DevouringFlameTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) - { - me->SetInFront(pTarget); - DoCast(pTarget, SPELL_DEVOURINGFLAME); - } - - DevouringFlameTimer = 10000; - } else DevouringFlameTimer -= diff; - - if (SummonAddsTimer <= diff) - SummonAdds(); - else SummonAddsTimer -= diff; - } - } - - void SummonAdds() - { - // TODO: Adds will come in waves from mole machines. One mole can spawn a Dark Rune Watcher - // with 1-2 Guardians, or a lone Sentinel. Up to 4 mole machines can spawn adds at any given time. - uint8 random = urand(1,4); - for (uint8 i = 0; i < random; ++i) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) - { - float x = std::max(500.0f, std::min(650.0f, pTarget->GetPositionX() + irand(-20,20))); // Safe range is between 500 and 650 - float y = std::max(-235.0f, std::min(-145.0f, pTarget->GetPositionY() + irand(-20,20))); // Safe range is between -235 and -145 - float z = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); // Ground level - // TODO: Spawn drillers, then spawn adds 5 seconds later - if (Creature *pAdd = me->SummonCreature(NPC_DARK_RUNE_SENTINEL, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) - pAdd->AI()->AttackStart(pTarget); - } - } - SummonAddsTimer = 45000; - } - - void FlyPhase(uint8 Phase, const uint32 /*diff*/) - { - const float x = 587.54; - const float y = -174.92; - const float GroundLevel = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); - const float FlightHeight = GroundLevel + 4.0f; // TODO: Fly out of range of attacks (442 is sufficient height for this), minus ~(10*number of harpoon gun chains attached to Razorscale) - - if (Phase == 1) // Always flying during Phase 1 + InitialSpawn = true; IsFlying = true; - me->SetFlying(IsFlying); - me->SendMovementFlagUpdate(); - me->SetSpeed(MOVE_WALK, IsFlying ? 7.0f : 2.5f, IsFlying); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(1, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + } - if (Phase == 1) // Flying Phase + void EnterCombat(Unit* /*who*/) { - if (me->GetPositionZ() > FlightHeight) // Correct height, stop moving - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - else // Incorrect height + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + } + + void JustDied(Unit* /*Killer*/) + { + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_KILL, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->GetPositionY() > -60 || me->GetPositionX() < 450) // Not Blizzlike, anti-exploit to prevent players from pulling bosses to vehicles. { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - me->GetMotionMaster()->MovePoint(0, x, y, FlightHeight + 0.5f); // Fly to slightly above (x, y, FlightHeight) + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(false); + me->GetMotionMaster()->MoveTargetedHome(); + } + + // Victim is not controlled by a player (should never happen) + if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->Kill(me->getVictim()); + + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 99 && Phase == 1) // TODO: Only land (exit Phase 1) if brought down with harpoon guns! This is important! + { + Phase = 2; + DoScriptText(SAY_PHASE_2_TRANS, me); // Audio: "Move quickly! She won't remain grounded for long!" + } + + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 33 && Phase == 2) // Health under 33%, Razorscale can't fly anymore. + { + Phase = 3; + DoScriptText(SAY_PHASE_3_TRANS, me); // "Razorscale lands permanently!" + // TODO: Cast Devouring Flame on all harpoon guns simultaneously, briefly after Phase 3 starts (lasts until the harpoon guns are destroyed) + } + + /* + if (Phase == 2 && CastSpellsTimer > 0) // 5 seconds of spell casting, after stun breaks, during Phase 2 + { + if (CastSpellsTimer <= diff) // 5 seconds are up + Phase = 1; // Return to phase 1 + else + CastSpellsTimer -= diff; + }*/ + + FlyPhase(Phase, diff); + + if (Phase >= 2) // Ground Phase (Phase 3 = permanent ground phase) + { + if (FuseArmorTimer <= diff) + { + DoCastVictim(SPELL_FUSEARMOR); + FuseArmorTimer = 10000; + } else FuseArmorTimer -= diff; + + if (WingBuffetTimer <= diff) + { + DoCast(SPELL_WINGBUFFET); + WingBuffetTimer = urand(7000,14000); + } else WingBuffetTimer -= diff; + + if (FireballTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_FIREBALL); + } + + FireballTimer = 18000; + } else FireballTimer -= diff; + + if (FlameBreathTimer <= diff) + { + DoScriptText(EMOTE_BREATH, me); // TODO: "Razorscale takes a deep breath..." + DoCastVictim(SPELL_FLAMEBREATH); + FlameBreathTimer = 15000; + WingBuffetTimer = 0; + } else FlameBreathTimer -= diff; + + if (Phase == 3) + { + if (FlameBuffetTimer <= diff) + { + DoScriptText(EMOTE_BREATH, me); + std::list pTargets; + SelectTargetList(pTargets, RAID_MODE(3,9), SELECT_TARGET_RANDOM, 100, true); + uint8 i = 0; + for (std::list::const_iterator itr = pTargets.begin(); itr != pTargets.end();) + { + if (me->HasInArc(M_PI, *itr)) + { + DoCast(*itr, SPELL_FLAMEBUFFET, true); + ++i; + } + if (++itr == pTargets.end() || i == RAID_MODE(3,9)) + { + AttackStart(*--itr); // seems to attack targets randomly during perma-ground phase.. + break; + } + } + FlameBuffetTimer = 25000; + } else FlameBuffetTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + else if (Phase == 1) //Flying Phase + { + if (InitialSpawn) + SummonAdds(); + + InitialSpawn = false; + + if (FireballTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_FIREBALL); + } + + FireballTimer = 18000; + } else FireballTimer -= diff; + + if (DevouringFlameTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + me->SetInFront(pTarget); + DoCast(pTarget, SPELL_DEVOURINGFLAME); + } + + DevouringFlameTimer = 10000; + } else DevouringFlameTimer -= diff; + + if (SummonAddsTimer <= diff) + SummonAdds(); + else SummonAddsTimer -= diff; } } - else // Ground Phases - { - const float CurrentGroundLevel = me->GetBaseMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT); - //if (StunTimer == 30000) // Only fly around if not stunned. - //{ - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - if (IsFlying && me->GetPositionZ() > CurrentGroundLevel) // Fly towards the ground - me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), CurrentGroundLevel); - // TODO: Swoop up just before landing - else - IsFlying = false; // Landed, no longer flying - //} - //if (!IsFlying &&Phase == 2 && CastSpellsTimer == 0 && StunTimer >= diff) // No longer flying, non-permanent ground phase, and not casting spells - //{ - // TODO: Add stun here. 30 second stun after Razorscale is grounded by harpoon guns - //StunTimer -= diff; - //} - //else if (StunTimer != 30000 && (StunTimer < 0 || Phase == 3)) // Stun is active, and needs to end. Note: Stun breaks instantly if Phase 3 starts - //{ - // TODO: Remove stun here. - //DoCast(SPELL_WINGBUFFET); // "Used in the beginning of the phase." - //WingBuffetTimer = urand(7000,14000); - //StunTimer = 30000; // Reinitialize the stun timer - //if (Phase == 2) // Non-permanent ground phase - // CastSpellsTimer = 5000; // Five seconds of casting before returning to Phase 1 - //} + void SummonAdds() + { + // TODO: Adds will come in waves from mole machines. One mole can spawn a Dark Rune Watcher + // with 1-2 Guardians, or a lone Sentinel. Up to 4 mole machines can spawn adds at any given time. + uint8 random = urand(1,4); + for (uint8 i = 0; i < random; ++i) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true)) + { + float x = std::max(500.0f, std::min(650.0f, pTarget->GetPositionX() + irand(-20,20))); // Safe range is between 500 and 650 + float y = std::max(-235.0f, std::min(-145.0f, pTarget->GetPositionY() + irand(-20,20))); // Safe range is between -235 and -145 + float z = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); // Ground level + // TODO: Spawn drillers, then spawn adds 5 seconds later + if (Creature *pAdd = me->SummonCreature(NPC_DARK_RUNE_SENTINEL, x, y, z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000)) + pAdd->AI()->AttackStart(pTarget); + } + } + SummonAddsTimer = 45000; } - } + + void FlyPhase(uint8 Phase, const uint32 /*diff*/) + { + const float x = 587.54; + const float y = -174.92; + const float GroundLevel = me->GetBaseMap()->GetHeight(x, y, MAX_HEIGHT); + const float FlightHeight = GroundLevel + 4.0f; // TODO: Fly out of range of attacks (442 is sufficient height for this), minus ~(10*number of harpoon gun chains attached to Razorscale) + + if (Phase == 1) // Always flying during Phase 1 + IsFlying = true; + + me->SetFlying(IsFlying); + me->SendMovementFlagUpdate(); + me->SetSpeed(MOVE_WALK, IsFlying ? 7.0f : 2.5f, IsFlying); + + if (Phase == 1) // Flying Phase + { + if (me->GetPositionZ() > FlightHeight) // Correct height, stop moving + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + else // Incorrect height + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + me->GetMotionMaster()->MovePoint(0, x, y, FlightHeight + 0.5f); // Fly to slightly above (x, y, FlightHeight) + } + } + else // Ground Phases + { + const float CurrentGroundLevel = me->GetBaseMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), MAX_HEIGHT); + //if (StunTimer == 30000) // Only fly around if not stunned. + //{ + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + if (IsFlying && me->GetPositionZ() > CurrentGroundLevel) // Fly towards the ground + me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), CurrentGroundLevel); + // TODO: Swoop up just before landing + else + IsFlying = false; // Landed, no longer flying + //} + + //if (!IsFlying &&Phase == 2 && CastSpellsTimer == 0 && StunTimer >= diff) // No longer flying, non-permanent ground phase, and not casting spells + //{ + // TODO: Add stun here. 30 second stun after Razorscale is grounded by harpoon guns + //StunTimer -= diff; + //} + //else if (StunTimer != 30000 && (StunTimer < 0 || Phase == 3)) // Stun is active, and needs to end. Note: Stun breaks instantly if Phase 3 starts + //{ + // TODO: Remove stun here. + //DoCast(SPELL_WINGBUFFET); // "Used in the beginning of the phase." + //WingBuffetTimer = urand(7000,14000); + //StunTimer = 30000; // Reinitialize the stun timer + //if (Phase == 2) // Non-permanent ground phase + // CastSpellsTimer = 5000; // Five seconds of casting before returning to Phase 1 + //} + } + } + }; + }; -CreatureAI* GetAI_boss_razorscale(Creature* pCreature) -{ - return new boss_razorscaleAI (pCreature); -} void AddSC_boss_razorscale() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_razorscale"; - newscript->GetAI = &GetAI_boss_razorscale; - newscript->RegisterSelf(); + new boss_razorscale(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp index a508457e62a..fc6093b081d 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_thorim.cpp @@ -39,64 +39,67 @@ enum Yells SAY_END_HARD_3 = -1603286, SAY_YS_HELP = -1603287, }; - -struct boss_thorimAI : public BossAI + class boss_thorim : public CreatureScript { - boss_thorimAI(Creature* pCreature) : BossAI(pCreature, TYPE_THORIM) +public: + boss_thorim() : CreatureScript("boss_thorim") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_thorimAI(pCreature); } - void Reset() + struct boss_thorimAI : public BossAI { - _Reset(); - } + boss_thorimAI(Creature* pCreature) : BossAI(pCreature, TYPE_THORIM) + { + } - void EnterEvadeMode() - { - DoScriptText(SAY_WIPE, me); - _EnterEvadeMode(); - } + void Reset() + { + _Reset(); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + void EnterEvadeMode() + { + DoScriptText(SAY_WIPE, me); + _EnterEvadeMode(); + } - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); - _EnterCombat(); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; -//SPELLS TODO: + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me); + _EnterCombat(); + } -// - DoMeleeAttackIfReady(); + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + //SPELLS TODO: + + // + DoMeleeAttackIfReady(); + + EnterEvadeIfOutOfCombatArea(diff); + } + }; - EnterEvadeIfOutOfCombatArea(diff); - } }; -CreatureAI* GetAI_boss_thorim(Creature* pCreature) -{ - return new boss_thorimAI(pCreature); -} void AddSC_boss_thorim() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_thorim"; - newscript->GetAI = &GetAI_boss_thorim; - newscript->RegisterSelf(); + new boss_thorim(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp index 600bb41a469..c1698214f47 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp @@ -164,686 +164,704 @@ enum * XT-002 DECONSTRUCTOR * *///---------------------------------------------------- -struct boss_xt002_AI : public BossAI +class boss_xt002 : public CreatureScript { - boss_xt002_AI(Creature *pCreature) : BossAI(pCreature, TYPE_XT002) +public: + boss_xt002() : CreatureScript("boss_xt002") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_xt002_AI(pCreature); } - uint32 uiSearingLightTimer; - uint32 uiSpawnLifeSparkTimer; - uint32 uiGravityBombTimer; - uint32 uiGravityBombAuraTimer; - uint32 uiTympanicTantrumTimer; - uint32 uiHeartPhaseTimer; - uint32 uiSpawnAddTimer; - uint32 uiEnrageTimer; - - bool searing_light_active; - uint64 uiSearingLightTarget; - - bool gravity_bomb_active; - uint64 uiGravityBombTarget; - - uint8 phase; - uint8 heart_exposed; - bool enraged; - - uint32 transferHealth; - bool enterHardMode; - bool hardMode; - - void Reset() + struct boss_xt002_AI : public BossAI { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - - //Makes XT-002 to cast a light bomb 10 seconds after aggro. - uiSearingLightTimer = TIMER_SEARING_LIGHT/2; - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; - uiHeartPhaseTimer = TIMER_HEART_PHASE; - uiSpawnAddTimer = TIMER_SPAWN_ADD; - uiEnrageTimer = TIMER_ENRAGE; - - //Tantrum is casted a bit slower the first time. - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX) * 2; - - searing_light_active = false; - gravity_bomb_active = false; - enraged = false; - hardMode = false; - enterHardMode = false; - - phase = 1; - heart_exposed = 0; - - if (instance) - instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - _EnterCombat(); - - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - } - - void DoAction(const int32 action) - { - switch (action) + boss_xt002_AI(Creature *pCreature) : BossAI(pCreature, TYPE_XT002) { - case ACTION_ENTER_HARD_MODE: - if (!hardMode) - { - hardMode = true; - - // Enter hard mode - enterHardMode = true; - - // set max health - me->SetHealth(me->GetMaxHealth()); - - // Get his heartbreak buff - me->CastSpell(me, RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25), true); - } - break; } - } - void SetData(uint32 id, uint32 value) - { - switch(id) + uint32 uiSearingLightTimer; + uint32 uiSpawnLifeSparkTimer; + uint32 uiGravityBombTimer; + uint32 uiGravityBombAuraTimer; + uint32 uiTympanicTantrumTimer; + uint32 uiHeartPhaseTimer; + uint32 uiSpawnAddTimer; + uint32 uiEnrageTimer; + + bool searing_light_active; + uint64 uiSearingLightTarget; + + bool gravity_bomb_active; + uint64 uiGravityBombTarget; + + uint8 phase; + uint8 heart_exposed; + bool enraged; + + uint32 transferHealth; + bool enterHardMode; + bool hardMode; + + void Reset() { - case DATA_TRANSFERED_HEALTH: - transferHealth = value; - break; - } - } + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE); - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + //Makes XT-002 to cast a light bomb 10 seconds after aggro. + uiSearingLightTimer = TIMER_SEARING_LIGHT/2; + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; + uiHeartPhaseTimer = TIMER_HEART_PHASE; + uiSpawnAddTimer = TIMER_SPAWN_ADD; + uiEnrageTimer = TIMER_ENRAGE; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - _JustDied(); - } + //Tantrum is casted a bit slower the first time. + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX) * 2; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (enterHardMode) - { - SetPhaseOne(); + searing_light_active = false; + gravity_bomb_active = false; + enraged = false; + hardMode = false; enterHardMode = false; + + phase = 1; + heart_exposed = 0; + + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - // Handles spell casting. These spells only occur during phase 1 and hard mode - if (phase == 1 || hardMode) + void EnterCombat(Unit* /*who*/) { - if (uiSearingLightTimer <= diff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25)); - uiSearingLightTarget = pTarget->GetGUID(); - } - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - if (hardMode) - searing_light_active = true; - uiSearingLightTimer = TIMER_SEARING_LIGHT; - } else uiSearingLightTimer -= diff; + DoScriptText(SAY_AGGRO, me); + _EnterCombat(); - if (uiGravityBombTimer <= diff) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); - uiGravityBombTarget = pTarget->GetGUID(); - } - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - gravity_bomb_active = true; - } else uiGravityBombTimer -= diff; - - if (uiTympanicTantrumTimer <= 0) - { - DoScriptText(SAY_TYMPANIC_TANTRUM, me); - DoCast(SPELL_TYMPANIC_TANTRUM); - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); - } else uiTympanicTantrumTimer -= diff; + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } - if (!hardMode) + void DoAction(const int32 action) { - if (phase == 1) + switch (action) { - if (HealthBelowPct(75) && heart_exposed == 0) + case ACTION_ENTER_HARD_MODE: + if (!hardMode) + { + hardMode = true; + + // Enter hard mode + enterHardMode = true; + + // set max health + me->SetHealth(me->GetMaxHealth()); + + // Get his heartbreak buff + me->CastSpell(me, RAID_MODE(SPELL_HEARTBREAK_10, SPELL_HEARTBREAK_25), true); + } + break; + } + } + + void SetData(uint32 id, uint32 value) + { + switch(id) + { + case DATA_TRANSFERED_HEALTH: + transferHealth = value; + break; + } + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + _JustDied(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (enterHardMode) + { + SetPhaseOne(); + enterHardMode = false; + } + + // Handles spell casting. These spells only occur during phase 1 and hard mode + if (phase == 1 || hardMode) + { + if (uiSearingLightTimer <= diff) { - exposeHeart(); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, RAID_MODE(SPELL_SEARING_LIGHT_10, SPELL_SEARING_LIGHT_25)); + uiSearingLightTarget = pTarget->GetGUID(); + } + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + if (hardMode) + searing_light_active = true; + uiSearingLightTimer = TIMER_SEARING_LIGHT; + } else uiSearingLightTimer -= diff; + + if (uiGravityBombTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); + uiGravityBombTarget = pTarget->GetGUID(); + } + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + gravity_bomb_active = true; + } else uiGravityBombTimer -= diff; + + if (uiTympanicTantrumTimer <= 0) + { + DoScriptText(SAY_TYMPANIC_TANTRUM, me); + DoCast(SPELL_TYMPANIC_TANTRUM); + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); + } else uiTympanicTantrumTimer -= diff; + } + + if (!hardMode) + { + if (phase == 1) + { + if (HealthBelowPct(75) && heart_exposed == 0) + { + exposeHeart(); + } + else if (HealthBelowPct(50) && heart_exposed == 1) + { + exposeHeart(); + } + else if (HealthBelowPct(25) && heart_exposed == 2) + { + exposeHeart(); + } + + DoMeleeAttackIfReady(); } - else if (HealthBelowPct(50) && heart_exposed == 1) + else { - exposeHeart(); + //Stop moving + me->StopMoving(); + + //Start summoning adds + if (uiSpawnAddTimer <= diff) + { + DoScriptText(SAY_SUMMON, me); + + // Spawn Pummeller + switch (rand() % 4) + { + case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + } + + // Spawn 5 Bombs + for (int8 n = 0; n < 5; n++) + { + //Some randomes are added so they wont spawn in a pile + switch(rand() % 4) + { + case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LR_X - 3, LR_X + 3), irand(LR_Y - 3, LR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LL_X - 3, LL_X + 3), irand(LL_Y - 3, LL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UR_X - 3, UR_X + 3), irand(UR_Y - 3, UR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UL_X - 3, UL_X + 3), irand(UL_Y - 3, UL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + } + } + + //Spawn 5 Scrapbots + switch (rand() % 4) + { + case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + } + + uiSpawnAddTimer = TIMER_SPAWN_ADD; + } else uiSpawnAddTimer -= diff; + + // Is the phase over? + if (uiHeartPhaseTimer <= diff) + { + DoScriptText(SAY_HEART_CLOSED, me); + SetPhaseOne(); + } + else + uiHeartPhaseTimer -= diff; } - else if (HealthBelowPct(25) && heart_exposed == 2) + } + else + { + // Adding life sparks when searing light debuff runs out if hard mode + if (searing_light_active) { - exposeHeart(); + if (uiSpawnLifeSparkTimer <= diff) + { + if (Unit *pSearingLightTarget = me->GetUnit(*me, uiSearingLightTarget)) + pSearingLightTarget->SummonCreature(NPC_LIFE_SPARK, pSearingLightTarget->GetPositionX(), pSearingLightTarget->GetPositionY(), pSearingLightTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; + searing_light_active = false; + } else uiSpawnLifeSparkTimer -= diff; } DoMeleeAttackIfReady(); } - else + + if (gravity_bomb_active) { - //Stop moving - me->StopMoving(); - - //Start summoning adds - if (uiSpawnAddTimer <= diff) + if (uiGravityBombAuraTimer <= diff) { - DoScriptText(SAY_SUMMON, me); - - // Spawn Pummeller - switch (rand() % 4) + if (Unit *pGravityBombTarget = me->GetUnit(*me, uiGravityBombTarget)) { - case 0: me->SummonCreature(NPC_XM024_PUMMELLER, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XM024_PUMMELLER, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XM024_PUMMELLER, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XM024_PUMMELLER, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - } - - // Spawn 5 Bombs - for (int8 n = 0; n < 5; n++) - { - //Some randomes are added so they wont spawn in a pile - switch(rand() % 4) + pGravityBombTarget->RemoveAurasDueToSpell(RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); + if (hardMode) { - case 0: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LR_X - 3, LR_X + 3), irand(LR_Y - 3, LR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(LL_X - 3, LL_X + 3), irand(LL_Y - 3, LL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UR_X - 3, UR_X + 3), irand(UR_Y - 3, UR_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XS013_SCRAPBOT, irand(UL_X - 3, UL_X + 3), irand(UL_Y - 3, UL_Y + 3), SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; + //Remains spawned for 3 minutes + pGravityBombTarget->SummonCreature(NPC_VOID_ZONE, pGravityBombTarget->GetPositionX(), pGravityBombTarget->GetPositionY(), pGravityBombTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); } } - //Spawn 5 Scrapbots - switch (rand() % 4) - { - case 0: me->SummonCreature(NPC_XE321_BOOMBOT, LR_X, LR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 1: me->SummonCreature(NPC_XE321_BOOMBOT, LL_X, LL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 2: me->SummonCreature(NPC_XE321_BOOMBOT, UR_X, UR_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - case 3: me->SummonCreature(NPC_XE321_BOOMBOT, UL_X, UL_Y, SPAWN_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); break; - } - - uiSpawnAddTimer = TIMER_SPAWN_ADD; - } else uiSpawnAddTimer -= diff; - - // Is the phase over? - if (uiHeartPhaseTimer <= diff) - { - DoScriptText(SAY_HEART_CLOSED, me); - SetPhaseOne(); - } - else - uiHeartPhaseTimer -= diff; - } - } - else - { - // Adding life sparks when searing light debuff runs out if hard mode - if (searing_light_active) - { - if (uiSpawnLifeSparkTimer <= diff) - { - if (Unit *pSearingLightTarget = me->GetUnit(*me, uiSearingLightTarget)) - pSearingLightTarget->SummonCreature(NPC_LIFE_SPARK, pSearingLightTarget->GetPositionX(), pSearingLightTarget->GetPositionY(), pSearingLightTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - uiSpawnLifeSparkTimer = TIMER_SPAWN_LIFE_SPARK; - searing_light_active = false; - } else uiSpawnLifeSparkTimer -= diff; + gravity_bomb_active = false; + uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; + //gravityBomb(); + } else uiGravityBombAuraTimer -= diff; } - DoMeleeAttackIfReady(); - } - - if (gravity_bomb_active) - { - if (uiGravityBombAuraTimer <= diff) - { - if (Unit *pGravityBombTarget = me->GetUnit(*me, uiGravityBombTarget)) + //Enrage stuff + if (!enraged) + if (uiEnrageTimer <= diff) { - pGravityBombTarget->RemoveAurasDueToSpell(RAID_MODE(SPELL_GRAVITY_BOMB_10,SPELL_GRAVITY_BOMB_25)); - if (hardMode) - { - //Remains spawned for 3 minutes - pGravityBombTarget->SummonCreature(NPC_VOID_ZONE, pGravityBombTarget->GetPositionX(), pGravityBombTarget->GetPositionY(), pGravityBombTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 180000); - } - } - - gravity_bomb_active = false; - uiGravityBombAuraTimer = TIMER_GRAVITY_BOMB_AURA; - //gravityBomb(); - } else uiGravityBombAuraTimer -= diff; + DoScriptText(SAY_BERSERK, me); + DoCast(me, SPELL_ENRAGE); + enraged = true; + } else uiEnrageTimer -= diff; } - //Enrage stuff - if (!enraged) - if (uiEnrageTimer <= diff) - { - DoScriptText(SAY_BERSERK, me); - DoCast(me, SPELL_ENRAGE); - enraged = true; - } else uiEnrageTimer -= diff; - } + void exposeHeart() + { + //Make untargetable + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - void exposeHeart() - { - //Make untargetable - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + //Summon the heart npc + me->SummonCreature(NPC_XT002_HEART, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 7, 0, TEMPSUMMON_TIMED_DESPAWN, TIMER_HEART_PHASE); - //Summon the heart npc - me->SummonCreature(NPC_XT002_HEART, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 7, 0, TEMPSUMMON_TIMED_DESPAWN, TIMER_HEART_PHASE); + // Start "end of phase 2 timer" + uiHeartPhaseTimer = TIMER_HEART_PHASE; - // Start "end of phase 2 timer" - uiHeartPhaseTimer = TIMER_HEART_PHASE; + //Phase 2 has offically started + phase = 2; + heart_exposed++; - //Phase 2 has offically started - phase = 2; - heart_exposed++; + //Reset the add spawning timer + uiSpawnAddTimer = TIMER_SPAWN_ADD; - //Reset the add spawning timer - uiSpawnAddTimer = TIMER_SPAWN_ADD; + DoScriptText(SAY_HEART_OPENED, me); + } - DoScriptText(SAY_HEART_OPENED, me); - } + void SetPhaseOne() + { + uiSearingLightTimer = TIMER_SEARING_LIGHT / 2; + uiGravityBombTimer = TIMER_GRAVITY_BOMB; + uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); + uiSpawnAddTimer = TIMER_SPAWN_ADD; - void SetPhaseOne() - { - uiSearingLightTimer = TIMER_SEARING_LIGHT / 2; - uiGravityBombTimer = TIMER_GRAVITY_BOMB; - uiTympanicTantrumTimer = urand(TIMER_TYMPANIC_TANTRUM_MIN, TIMER_TYMPANIC_TANTRUM_MAX); - uiSpawnAddTimer = TIMER_SPAWN_ADD; + if (!hardMode) + me->ModifyHealth(-((int32)transferHealth)); - if (!hardMode) - me->ModifyHealth(-((int32)transferHealth)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + phase = 1; + } - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - phase = 1; - } + // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. + ////Have to do this the custom way since the original spell messes up player movement + //void gravityBomb() + //{ + // uint32 maxDamage = RAID_MODE(GRAVITY_BOMB_DMG_MAX_10, GRAVITY_BOMB_DMG_MAX_25); + // uint32 minDamage = RAID_MODE(GRAVITY_BOMB_DMG_MIN_10, GRAVITY_BOMB_DMG_MIN_25); + // uint16 range = GRAVITY_BOMB_RADIUS; + // Map* pMap = me->GetMap(); + // if (pMap && pMap->IsDungeon()) + // { + // Map::PlayerList const &PlayerList = pMap->GetPlayers(); + // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + // { + // //If a player is within the range of the spell + // if (i->getSource() && i->getSource()->GetDistance2d(pGravityBombTarget) <= range) + // { + // //Deal damage to the victim + // int32 damage = urand(minDamage, maxDamage); + // i->getSource()->ModifyHealth(-damage); + // me->SendSpellNonMeleeDamageLog(i->getSource(), SPELL_GRAVITY_BOMB_AURA_10, damage, SPELL_SCHOOL_MASK_SHADOW, 0, 0, false, 0); - // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. - ////Have to do this the custom way since the original spell messes up player movement - //void gravityBomb() - //{ - // uint32 maxDamage = RAID_MODE(GRAVITY_BOMB_DMG_MAX_10, GRAVITY_BOMB_DMG_MAX_25); - // uint32 minDamage = RAID_MODE(GRAVITY_BOMB_DMG_MIN_10, GRAVITY_BOMB_DMG_MIN_25); - // uint16 range = GRAVITY_BOMB_RADIUS; - // Map* pMap = me->GetMap(); - // if (pMap && pMap->IsDungeon()) - // { - // Map::PlayerList const &PlayerList = pMap->GetPlayers(); - // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - // { - // //If a player is within the range of the spell - // if (i->getSource() && i->getSource()->GetDistance2d(pGravityBombTarget) <= range) - // { - // //Deal damage to the victim - // int32 damage = urand(minDamage, maxDamage); - // i->getSource()->ModifyHealth(-damage); - // me->SendSpellNonMeleeDamageLog(i->getSource(), SPELL_GRAVITY_BOMB_AURA_10, damage, SPELL_SCHOOL_MASK_SHADOW, 0, 0, false, 0); - - // //Replacing the tractor beam effect - // i->getSource()->JumpTo(pGravityBombTarget, 5); - // } - // } - // } - //} + // //Replacing the tractor beam effect + // i->getSource()->JumpTo(pGravityBombTarget, 5); + // } + // } + // } + //} + }; }; -CreatureAI* GetAI_boss_xt002(Creature* pCreature) -{ - return new boss_xt002_AI(pCreature); -} - /*------------------------------------------------------- * * XT-002 HEART * *///---------------------------------------------------- -struct mob_xt002_heartAI : public ScriptedAI +class mob_xt002_heart : public CreatureScript { - mob_xt002_heartAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_xt002_heart() : CreatureScript("mob_xt002_heart") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - DoCast(me, SPELL_EXPOSED_HEART); + return new mob_xt002_heartAI(pCreature); } - ScriptedInstance* m_pInstance; - - void JustDied(Unit * /*victim*/) + struct mob_xt002_heartAI : public ScriptedAI { - if (m_pInstance) + mob_xt002_heartAI(Creature* pCreature) : ScriptedAI(pCreature) + { + m_pInstance = pCreature->GetInstanceScript(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + DoCast(me, SPELL_EXPOSED_HEART); + } + + InstanceScript* m_pInstance; + + void JustDied(Unit * /*victim*/) + { + if (m_pInstance) + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + if (pXT002->AI()) + pXT002->AI()->DoAction(ACTION_ENTER_HARD_MODE); + + //removes the aura + me->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); + } + + void DamageTaken(Unit * /*pDone*/, uint32 &damage) + { if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) if (pXT002->AI()) - pXT002->AI()->DoAction(ACTION_ENTER_HARD_MODE); + { + uint32 health = me->GetHealth(); + health -= damage; + if (health < 0) + health = 0; - //removes the aura - me->RemoveAurasDueToSpell(SPELL_EXPOSED_HEART); - } + pXT002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth() - health); + } + } + }; - void DamageTaken(Unit * /*pDone*/, uint32 &damage) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - if (pXT002->AI()) - { - uint32 health = me->GetHealth(); - health -= damage; - if (health < 0) - health = 0; - - pXT002->AI()->SetData(DATA_TRANSFERED_HEALTH, me->GetMaxHealth() - health); - } - } }; -CreatureAI* GetAI_mob_xt002_heart(Creature* pCreature) -{ - return new mob_xt002_heartAI(pCreature); -} - /*------------------------------------------------------- * * XS-013 SCRAPBOT * - *///---------------------------------------------------- -struct mob_scrapbotAI : public ScriptedAI + *///---------------------------------------------------- class mob_scrapbot : public CreatureScript { - mob_scrapbotAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_scrapbot() : CreatureScript("mob_scrapbot") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = me->GetInstanceData(); + return new mob_scrapbotAI(pCreature); } - ScriptedInstance* m_pInstance; - - void Reset() + struct mob_scrapbotAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); - - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - me->GetMotionMaster()->MoveChase(pXT002); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + mob_scrapbotAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (me->GetDistance2d(pXT002) <= 0.5) + m_pInstance = me->GetInstanceScript(); + } + + InstanceScript* m_pInstance; + + void Reset() + { + me->SetReactState(REACT_PASSIVE); + + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + me->GetMotionMaster()->MoveChase(pXT002); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) { - // TODO Send raid message + if (me->GetDistance2d(pXT002) <= 0.5) + { + // TODO Send raid message - // Increase health with 1 percent - pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01); + // Increase health with 1 percent + pXT002->ModifyHealth(pXT002->GetMaxHealth() * 0.01); - // Despawns the scrapbot - me->ForcedDespawn(); + // Despawns the scrapbot + me->ForcedDespawn(); + } } } - } + }; + }; -CreatureAI* GetAI_mob_scrapbot(Creature* pCreature) -{ - return new mob_scrapbotAI(pCreature); -} /*------------------------------------------------------- * * XM-024 PUMMELLER * - *///---------------------------------------------------- -struct mob_pummellerAI : public ScriptedAI + *///---------------------------------------------------- class mob_pummeller : public CreatureScript { - mob_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_pummeller() : CreatureScript("mob_pummeller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new mob_pummellerAI(pCreature); } - ScriptedInstance* m_pInstance; - int32 uiArcingSmashTimer; - int32 uiTrampleTimer; - int32 uiUppercutTimer; - - void Reset() + struct mob_pummellerAI : public ScriptedAI { - uiArcingSmashTimer = TIMER_ARCING_SMASH; - uiTrampleTimer = TIMER_TRAMPLE; - uiUppercutTimer = TIMER_UPPERCUT; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (me->IsWithinMeleeRange(me->getVictim())) + mob_pummellerAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (uiArcingSmashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCING_SMASH); - uiArcingSmashTimer = TIMER_ARCING_SMASH; - } else uiArcingSmashTimer -= diff; - - if (uiTrampleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TRAMPLE); - uiTrampleTimer = TIMER_TRAMPLE; - } else uiTrampleTimer -= diff; - - if (uiUppercutTimer <= diff) - { - DoCast(me->getVictim(), SPELL_UPPERCUT); - uiUppercutTimer = TIMER_UPPERCUT; - } else uiUppercutTimer -= diff; + m_pInstance = pCreature->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + InstanceScript* m_pInstance; + int32 uiArcingSmashTimer; + int32 uiTrampleTimer; + int32 uiUppercutTimer; + + void Reset() + { + uiArcingSmashTimer = TIMER_ARCING_SMASH; + uiTrampleTimer = TIMER_TRAMPLE; + uiUppercutTimer = TIMER_UPPERCUT; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (me->IsWithinMeleeRange(me->getVictim())) + { + if (uiArcingSmashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCING_SMASH); + uiArcingSmashTimer = TIMER_ARCING_SMASH; + } else uiArcingSmashTimer -= diff; + + if (uiTrampleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + uiTrampleTimer = TIMER_TRAMPLE; + } else uiTrampleTimer -= diff; + + if (uiUppercutTimer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + uiUppercutTimer = TIMER_UPPERCUT; + } else uiUppercutTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_pummeller(Creature* pCreature) -{ - return new mob_pummellerAI(pCreature); -} /*------------------------------------------------------- * * XE-321 BOOMBOT * - *///---------------------------------------------------- -struct mob_boombotAI : public ScriptedAI + *///---------------------------------------------------- class mob_boombot : public CreatureScript { - mob_boombotAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_boombot() : CreatureScript("mob_boombot") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new mob_boombotAI(pCreature); } - ScriptedInstance* m_pInstance; - - void Reset() + struct mob_boombotAI : public ScriptedAI { - me->SetReactState(REACT_PASSIVE); - - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) - me->GetMotionMaster()->MoveChase(pXT002); - } - - void JustDied(Unit * /*killer*/) - { - DoCast(SPELL_BOOM); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + mob_boombotAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (me->GetDistance2d(pXT002) <= 0.5) - { - //Explosion - DoCast(me, SPELL_BOOM); + m_pInstance = pCreature->GetInstanceScript(); + } - //Despawns the boombot - me->ForcedDespawn(); + InstanceScript* m_pInstance; + + void Reset() + { + me->SetReactState(REACT_PASSIVE); + + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + me->GetMotionMaster()->MoveChase(pXT002); + } + + void JustDied(Unit * /*killer*/) + { + DoCast(SPELL_BOOM); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (Creature* pXT002 = me->GetCreature(*me, m_pInstance->GetData64(TYPE_XT002))) + { + if (me->GetDistance2d(pXT002) <= 0.5) + { + //Explosion + DoCast(me, SPELL_BOOM); + + //Despawns the boombot + me->ForcedDespawn(); + } } } - } + }; + }; -CreatureAI* GetAI_mob_boombot(Creature* pCreature) -{ - return new mob_boombotAI(pCreature); -} /*------------------------------------------------------- * * VOID ZONE * - *///---------------------------------------------------- -struct mob_void_zoneAI : public ScriptedAI + *///---------------------------------------------------- class mob_void_zone : public CreatureScript { - mob_void_zoneAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_void_zone() : CreatureScript("mob_void_zone") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + return new mob_void_zoneAI(pCreature); } - ScriptedInstance* m_pInstance; - uint32 uiVoidZoneTimer; - - void Reset() + struct mob_void_zoneAI : public ScriptedAI { - uiVoidZoneTimer = TIMER_VOID_ZONE; - } - - void UpdateAI(const uint32 diff) - { - if (uiVoidZoneTimer <= diff) + mob_void_zoneAI(Creature* pCreature) : ScriptedAI(pCreature) { - //voidZone(); - uiVoidZoneTimer = TIMER_VOID_ZONE; - } else uiVoidZoneTimer -= diff; - } + m_pInstance = pCreature->GetInstanceScript(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); + } + + InstanceScript* m_pInstance; + uint32 uiVoidZoneTimer; + + void Reset() + { + uiVoidZoneTimer = TIMER_VOID_ZONE; + } + + void UpdateAI(const uint32 diff) + { + if (uiVoidZoneTimer <= diff) + { + //voidZone(); + uiVoidZoneTimer = TIMER_VOID_ZONE; + } else uiVoidZoneTimer -= diff; + } + + // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. + //void voidZone() + //{ + // Map* pMap = me->GetMap(); + // if (pMap && pMap->IsDungeon()) + // { + // Map::PlayerList const &PlayerList = pMap->GetPlayers(); + // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + // { + // // If a player is within the range of the spell + // if (i->getSource() && i->getSource()->GetDistance2d(me) <= 16) + // { + // // Deal damage to the victim + // int32 damage = RAID_MODE(VOID_ZONE_DMG_10, VOID_ZONE_DMG_25); + // me->DealDamage(i->getSource(), damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_SHADOW); + // } + // } + // } + //} + }; - // TODO: put in comment and kept for reference. The spell should be fixed properly in spell system, if necessary. - //void voidZone() - //{ - // Map* pMap = me->GetMap(); - // if (pMap && pMap->IsDungeon()) - // { - // Map::PlayerList const &PlayerList = pMap->GetPlayers(); - // for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - // { - // // If a player is within the range of the spell - // if (i->getSource() && i->getSource()->GetDistance2d(me) <= 16) - // { - // // Deal damage to the victim - // int32 damage = RAID_MODE(VOID_ZONE_DMG_10, VOID_ZONE_DMG_25); - // me->DealDamage(i->getSource(), damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_SHADOW); - // } - // } - // } - //} }; -CreatureAI* GetAI_mob_void_zone(Creature* pCreature) -{ - return new mob_void_zoneAI(pCreature); -} /*------------------------------------------------------- * * LIFE SPARK * - *///---------------------------------------------------- -struct mob_life_sparkAI : public ScriptedAI + *///---------------------------------------------------- class mob_life_spark : public CreatureScript { - mob_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + mob_life_spark() : CreatureScript("mob_life_spark") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new mob_life_sparkAI(pCreature); } - ScriptedInstance* m_pInstance; - uint32 uiShockTimer; - - void Reset() + struct mob_life_sparkAI : public ScriptedAI { - DoCast(me, RAID_MODE(SPELL_STATIC_CHARGED_10, SPELL_STATIC_CHARGED_25)); - uiShockTimer = 0; // first one is immediate. - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (uiShockTimer <= diff) + mob_life_sparkAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (me->IsWithinMeleeRange(me->getVictim())) - { - DoCast(me->getVictim(), SPELL_SHOCK); - uiShockTimer = TIMER_SHOCK; - } + m_pInstance = pCreature->GetInstanceScript(); } - else uiShockTimer -= diff; - } -}; -CreatureAI* GetAI_mob_life_spark(Creature* pCreature) -{ - return new mob_life_sparkAI(pCreature); -} + InstanceScript* m_pInstance; + uint32 uiShockTimer; + + void Reset() + { + DoCast(me, RAID_MODE(SPELL_STATIC_CHARGED_10, SPELL_STATIC_CHARGED_25)); + uiShockTimer = 0; // first one is immediate. + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiShockTimer <= diff) + { + if (me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(), SPELL_SHOCK); + uiShockTimer = TIMER_SHOCK; + } + } + else uiShockTimer -= diff; + } + }; + +}; void AddSC_boss_xt002() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_xt002"; - newscript->GetAI = &GetAI_boss_xt002; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_xt002_heart"; - newscript->GetAI = &GetAI_mob_xt002_heart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_scrapbot"; - newscript->GetAI = &GetAI_mob_scrapbot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_pummeller"; - newscript->GetAI = &GetAI_mob_pummeller; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_boombot"; - newscript->GetAI = &GetAI_mob_boombot; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_void_zone"; - newscript->GetAI = &GetAI_mob_void_zone; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_life_spark"; - newscript->GetAI = &GetAI_mob_life_spark; - newscript->RegisterSelf(); + new mob_xt002_heart(); + new mob_scrapbot(); + new mob_pummeller(); + new mob_boombot(); + new mob_void_zone(); + new mob_life_spark(); + new boss_xt002(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp index 27f59ebb835..d436d96d15f 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp @@ -31,364 +31,367 @@ enum eGameObjects GO_LEVIATHAN_DOOR = 194905, GO_LEVIATHAN_GATE = 194630 }; - -struct instance_ulduar : public ScriptedInstance + class instance_ulduar : public InstanceMapScript { - instance_ulduar(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; +public: + instance_ulduar() : InstanceMapScript("instance_ulduar") { } - uint32 uiEncounter[MAX_ENCOUNTER]; - std::string m_strInstData; - uint8 flag; - - uint64 uiLeviathanGUID; - uint64 uiIgnisGUID; - uint64 uiRazorscaleGUID; - uint64 uiXT002GUID; - uint64 uiAssemblyGUIDs[3]; - uint64 uiKologarnGUID; - uint64 uiAuriayaGUID; - uint64 uiMimironGUID; - uint64 uiHodirGUID; - uint64 uiThorimGUID; - uint64 uiFreyaGUID; - uint64 uiVezaxGUID; - uint64 uiYoggSaronGUID; - uint64 uiAlgalonGUID; - uint64 uiLeviathanDoor[7]; - uint64 uiLeviathanGateGUID; - - uint64 uiKologarnChestGUID; - uint64 uiThorimChestGUID; - uint64 uiHodirChestGUID; - uint64 uiFreyaChestGUID; - - void Initialize() - { - uiIgnisGUID = 0; - uiRazorscaleGUID = 0; - uiXT002GUID = 0; - uiKologarnGUID = 0; - uiAuriayaGUID = 0; - uiMimironGUID = 0; - uiHodirGUID = 0; - uiThorimGUID = 0; - uiFreyaGUID = 0; - uiVezaxGUID = 0; - uiYoggSaronGUID = 0; - uiAlgalonGUID = 0; - uiKologarnChestGUID = 0; - uiKologarnChestGUID = 0; - uiHodirChestGUID = 0; - uiFreyaChestGUID = 0; - uiLeviathanGateGUID = 0; - flag = 0; - - memset(&uiEncounter, 0, sizeof(uiEncounter)); - memset(&uiAssemblyGUIDs, 0, sizeof(uiAssemblyGUIDs)); - memset(&uiLeviathanDoor, 0, sizeof(uiLeviathanDoor)); + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_ulduar_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_ulduar_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - if (uiEncounter[i] == IN_PROGRESS) - return true; + instance_ulduar_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; + + uint32 uiEncounter[MAX_ENCOUNTER]; + std::string m_strInstData; + uint8 flag; + + uint64 uiLeviathanGUID; + uint64 uiIgnisGUID; + uint64 uiRazorscaleGUID; + uint64 uiXT002GUID; + uint64 uiAssemblyGUIDs[3]; + uint64 uiKologarnGUID; + uint64 uiAuriayaGUID; + uint64 uiMimironGUID; + uint64 uiHodirGUID; + uint64 uiThorimGUID; + uint64 uiFreyaGUID; + uint64 uiVezaxGUID; + uint64 uiYoggSaronGUID; + uint64 uiAlgalonGUID; + uint64 uiLeviathanDoor[7]; + uint64 uiLeviathanGateGUID; + + uint64 uiKologarnChestGUID; + uint64 uiThorimChestGUID; + uint64 uiHodirChestGUID; + uint64 uiFreyaChestGUID; + + void Initialize() + { + uiIgnisGUID = 0; + uiRazorscaleGUID = 0; + uiXT002GUID = 0; + uiKologarnGUID = 0; + uiAuriayaGUID = 0; + uiMimironGUID = 0; + uiHodirGUID = 0; + uiThorimGUID = 0; + uiFreyaGUID = 0; + uiVezaxGUID = 0; + uiYoggSaronGUID = 0; + uiAlgalonGUID = 0; + uiKologarnChestGUID = 0; + uiKologarnChestGUID = 0; + uiHodirChestGUID = 0; + uiFreyaChestGUID = 0; + uiLeviathanGateGUID = 0; + flag = 0; + + memset(&uiEncounter, 0, sizeof(uiEncounter)); + memset(&uiAssemblyGUIDs, 0, sizeof(uiAssemblyGUIDs)); + memset(&uiLeviathanDoor, 0, sizeof(uiLeviathanDoor)); } - return false; - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case NPC_LEVIATHAN: - uiLeviathanGUID = pCreature->GetGUID(); - break; - case NPC_IGNIS: - uiIgnisGUID = pCreature->GetGUID(); - break; - case NPC_RAZORSCALE: - uiRazorscaleGUID = pCreature->GetGUID(); - break; - case NPC_XT002: - uiXT002GUID = pCreature->GetGUID(); - break; - - // Assembly of Iron - case NPC_STEELBREAKER: - uiAssemblyGUIDs[0] = pCreature->GetGUID(); - break; - case NPC_MOLGEIM: - uiAssemblyGUIDs[1] = pCreature->GetGUID(); - break; - case NPC_BRUNDIR: - uiAssemblyGUIDs[2] = pCreature->GetGUID(); - break; - - case NPC_KOLOGARN: - uiKologarnGUID = pCreature->GetGUID(); - break; - case NPC_AURIAYA: - uiAuriayaGUID = pCreature->GetGUID(); - break; - case NPC_MIMIRON: - uiMimironGUID = pCreature->GetGUID(); - break; - case NPC_HODIR: - uiHodirGUID = pCreature->GetGUID(); - break; - case NPC_THORIM: - uiThorimGUID = pCreature->GetGUID(); - break; - case NPC_FREYA: - uiFreyaGUID = pCreature->GetGUID(); - break; - case NPC_VEZAX: - uiVezaxGUID = pCreature->GetGUID(); - break; - case NPC_YOGGSARON: - uiYoggSaronGUID = pCreature->GetGUID(); - break; - case NPC_ALGALON: - uiAlgalonGUID = pCreature->GetGUID(); - break; - } - - } - - void OnGameObjectCreate(GameObject* pGO, bool add) - { - switch(pGO->GetEntry()) - { - case GO_KOLOGARN_CHEST_HERO: - case GO_KOLOGARN_CHEST: - uiKologarnChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_THORIM_CHEST_HERO: - case GO_THORIM_CHEST: - uiThorimChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_HODIR_CHEST_HERO: - case GO_HODIR_CHEST: - uiHodirChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_FREYA_CHEST_HERO: - case GO_FREYA_CHEST: - uiFreyaChestGUID = add ? pGO->GetGUID() : NULL; - break; - case GO_LEVIATHAN_DOOR: - uiLeviathanDoor[flag] = pGO->GetGUID(); - HandleGameObject(NULL, true, pGO); - flag++; - if (flag == 7) - flag =0; - break; - case GO_LEVIATHAN_GATE: - uiLeviathanGateGUID = add ? pGO->GetGUID() : NULL; - HandleGameObject(NULL, false, pGO); - break; - } - } - - void ProcessEvent(GameObject* pGO, uint32 uiEventId) - { - // Flame Leviathan's Tower Event triggers - Creature* pFlameLeviathan = instance->GetCreature(uiLeviathanGUID); - - if (pFlameLeviathan && pFlameLeviathan->isAlive()) //No leviathan, no event triggering ;) - switch(uiEventId) - { - case EVENT_TOWER_OF_STORM_DESTROYED: - //pGO->GetInstanceData()->SetData(DATA_TOWER_STORMS,DESTROYED); - pFlameLeviathan->AI()->DoAction(1); - break; - case EVENT_TOWER_OF_FROST_DESTROYED: - pFlameLeviathan->AI()->DoAction(2); - break; - case EVENT_TOWER_OF_FLAMES_DESTROYED: - pFlameLeviathan->AI()->DoAction(3); - break; - case EVENT_TOWER_OF_LIFE_DESTROYED: - pFlameLeviathan->AI()->DoAction(4); - break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - /*case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_ASSEMBLY: - case TYPE_AURIAYA: - case TYPE_MIMIRON: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - break;*/ - case TYPE_LEVIATHAN: - if (data == IN_PROGRESS) - { - for (uint8 uiI = 0; uiI < 7; ++uiI) - HandleGameObject(uiLeviathanDoor[uiI],false); - } - else - { - for (uint8 uiI = 0; uiI < 7; ++uiI) - HandleGameObject(uiLeviathanDoor[uiI],true); - } - break; - case TYPE_KOLOGARN: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiKologarnChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_HODIR: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiHodirChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_THORIM: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiThorimChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_FREYA: - if (data == DONE) - if (GameObject* pGO = instance->GetGameObject(uiFreyaChestGUID)) - pGO->SetRespawnTime(pGO->GetRespawnDelay()); - break; - case TYPE_COLOSSUS: - uiEncounter[TYPE_COLOSSUS] = data; - if (data == 2) - { - if (Creature* pBoss = instance->GetCreature(uiLeviathanGUID)) - pBoss->AI()->DoAction(10); - if (GameObject* pGate = instance->GetGameObject(uiLeviathanGateGUID)) - pGate->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - } - break; - default: - break; - } - - if (data == DONE) - SaveToDB(); - } - - uint64 GetData64(uint32 data) - { - switch(data) - { - case TYPE_LEVIATHAN: return uiLeviathanGUID; - case TYPE_IGNIS: return uiIgnisGUID; - case TYPE_RAZORSCALE: return uiRazorscaleGUID; - case TYPE_XT002: return uiXT002GUID; - case TYPE_KOLOGARN: return uiKologarnGUID; - case TYPE_AURIAYA: return uiAuriayaGUID; - case TYPE_MIMIRON: return uiMimironGUID; - case TYPE_HODIR: return uiMimironGUID; - case TYPE_THORIM: return uiThorimGUID; - case TYPE_FREYA: return uiFreyaGUID; - case TYPE_VEZAX: return uiVezaxGUID; - case TYPE_YOGGSARON: return uiYoggSaronGUID; - case TYPE_ALGALON: return uiAlgalonGUID; - - // Assembly of Iron - case DATA_STEELBREAKER: return uiAssemblyGUIDs[0]; - case DATA_MOLGEIM: return uiAssemblyGUIDs[1]; - case DATA_BRUNDIR: return uiAssemblyGUIDs[2]; - } - - return 0; - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_LEVIATHAN: - case TYPE_IGNIS: - case TYPE_RAZORSCALE: - case TYPE_XT002: - case TYPE_ASSEMBLY: - case TYPE_KOLOGARN: - case TYPE_AURIAYA: - case TYPE_MIMIRON: - case TYPE_HODIR: - case TYPE_THORIM: - case TYPE_FREYA: - case TYPE_VEZAX: - case TYPE_YOGGSARON: - case TYPE_ALGALON: - case TYPE_COLOSSUS: - return uiEncounter[type]; - } - - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "U U " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2] << " " << uiEncounter[3] - << " " << uiEncounter[4] << " " << uiEncounter[5] << " " << uiEncounter[6] << " " << uiEncounter[7] - << " " << uiEncounter[8] << " " << uiEncounter[9] << " " << uiEncounter[10] << " " << uiEncounter[11] - << " " << uiEncounter[12] << " " << uiEncounter[13] << " " << uiEncounter[14]; - - m_strInstData = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return m_strInstData; - } - - void Load(const char* strIn) - { - if (!strIn) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(strIn); - - char dataHead1, dataHead2; - uint32 data0, data1, data2, data3, data4, data5, data6, - data7, data8, data9, data10, data11, data12, data13, data14; - - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6 - >> data7 >> data8 >> data9 >> data10 >> data11 >> data12 >> data13 >> data14; - - if (dataHead1 == 'U' && dataHead2 == 'U') + bool IsEncounterInProgress() const { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { - loadStream >> uiEncounter[i]; - if (uiEncounter[i] == IN_PROGRESS) - uiEncounter[i] = NOT_STARTED; + return true; + } + + return false; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case NPC_LEVIATHAN: + uiLeviathanGUID = pCreature->GetGUID(); + break; + case NPC_IGNIS: + uiIgnisGUID = pCreature->GetGUID(); + break; + case NPC_RAZORSCALE: + uiRazorscaleGUID = pCreature->GetGUID(); + break; + case NPC_XT002: + uiXT002GUID = pCreature->GetGUID(); + break; + + // Assembly of Iron + case NPC_STEELBREAKER: + uiAssemblyGUIDs[0] = pCreature->GetGUID(); + break; + case NPC_MOLGEIM: + uiAssemblyGUIDs[1] = pCreature->GetGUID(); + break; + case NPC_BRUNDIR: + uiAssemblyGUIDs[2] = pCreature->GetGUID(); + break; + + case NPC_KOLOGARN: + uiKologarnGUID = pCreature->GetGUID(); + break; + case NPC_AURIAYA: + uiAuriayaGUID = pCreature->GetGUID(); + break; + case NPC_MIMIRON: + uiMimironGUID = pCreature->GetGUID(); + break; + case NPC_HODIR: + uiHodirGUID = pCreature->GetGUID(); + break; + case NPC_THORIM: + uiThorimGUID = pCreature->GetGUID(); + break; + case NPC_FREYA: + uiFreyaGUID = pCreature->GetGUID(); + break; + case NPC_VEZAX: + uiVezaxGUID = pCreature->GetGUID(); + break; + case NPC_YOGGSARON: + uiYoggSaronGUID = pCreature->GetGUID(); + break; + case NPC_ALGALON: + uiAlgalonGUID = pCreature->GetGUID(); + break; + } + + } + + void OnGameObjectCreate(GameObject* pGO, bool add) + { + switch(pGO->GetEntry()) + { + case GO_KOLOGARN_CHEST_HERO: + case GO_KOLOGARN_CHEST: + uiKologarnChestGUID = add ? pGO->GetGUID() : NULL; + break; + case GO_THORIM_CHEST_HERO: + case GO_THORIM_CHEST: + uiThorimChestGUID = add ? pGO->GetGUID() : NULL; + break; + case GO_HODIR_CHEST_HERO: + case GO_HODIR_CHEST: + uiHodirChestGUID = add ? pGO->GetGUID() : NULL; + break; + case GO_FREYA_CHEST_HERO: + case GO_FREYA_CHEST: + uiFreyaChestGUID = add ? pGO->GetGUID() : NULL; + break; + case GO_LEVIATHAN_DOOR: + uiLeviathanDoor[flag] = pGO->GetGUID(); + HandleGameObject(NULL, true, pGO); + flag++; + if (flag == 7) + flag =0; + break; + case GO_LEVIATHAN_GATE: + uiLeviathanGateGUID = add ? pGO->GetGUID() : NULL; + HandleGameObject(NULL, false, pGO); + break; } } - OUT_LOAD_INST_DATA_COMPLETE; - } + + void ProcessEvent(GameObject* pGO, uint32 uiEventId) + { + // Flame Leviathan's Tower Event triggers + Creature* pFlameLeviathan = instance->GetCreature(uiLeviathanGUID); + + if (pFlameLeviathan && pFlameLeviathan->isAlive()) //No leviathan, no event triggering ;) + switch(uiEventId) + { + case EVENT_TOWER_OF_STORM_DESTROYED: + //pGO->GetInstanceScript()->SetData(DATA_TOWER_STORMS,DESTROYED); + pFlameLeviathan->AI()->DoAction(1); + break; + case EVENT_TOWER_OF_FROST_DESTROYED: + pFlameLeviathan->AI()->DoAction(2); + break; + case EVENT_TOWER_OF_FLAMES_DESTROYED: + pFlameLeviathan->AI()->DoAction(3); + break; + case EVENT_TOWER_OF_LIFE_DESTROYED: + pFlameLeviathan->AI()->DoAction(4); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + /*case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_ASSEMBLY: + case TYPE_AURIAYA: + case TYPE_MIMIRON: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + break;*/ + case TYPE_LEVIATHAN: + if (data == IN_PROGRESS) + { + for (uint8 uiI = 0; uiI < 7; ++uiI) + HandleGameObject(uiLeviathanDoor[uiI],false); + } + else + { + for (uint8 uiI = 0; uiI < 7; ++uiI) + HandleGameObject(uiLeviathanDoor[uiI],true); + } + break; + case TYPE_KOLOGARN: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiKologarnChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_HODIR: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiHodirChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_THORIM: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiThorimChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_FREYA: + if (data == DONE) + if (GameObject* pGO = instance->GetGameObject(uiFreyaChestGUID)) + pGO->SetRespawnTime(pGO->GetRespawnDelay()); + break; + case TYPE_COLOSSUS: + uiEncounter[TYPE_COLOSSUS] = data; + if (data == 2) + { + if (Creature* pBoss = instance->GetCreature(uiLeviathanGUID)) + pBoss->AI()->DoAction(10); + if (GameObject* pGate = instance->GetGameObject(uiLeviathanGateGUID)) + pGate->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + } + break; + default: + break; + } + + if (data == DONE) + SaveToDB(); + } + + uint64 GetData64(uint32 data) + { + switch(data) + { + case TYPE_LEVIATHAN: return uiLeviathanGUID; + case TYPE_IGNIS: return uiIgnisGUID; + case TYPE_RAZORSCALE: return uiRazorscaleGUID; + case TYPE_XT002: return uiXT002GUID; + case TYPE_KOLOGARN: return uiKologarnGUID; + case TYPE_AURIAYA: return uiAuriayaGUID; + case TYPE_MIMIRON: return uiMimironGUID; + case TYPE_HODIR: return uiMimironGUID; + case TYPE_THORIM: return uiThorimGUID; + case TYPE_FREYA: return uiFreyaGUID; + case TYPE_VEZAX: return uiVezaxGUID; + case TYPE_YOGGSARON: return uiYoggSaronGUID; + case TYPE_ALGALON: return uiAlgalonGUID; + + // Assembly of Iron + case DATA_STEELBREAKER: return uiAssemblyGUIDs[0]; + case DATA_MOLGEIM: return uiAssemblyGUIDs[1]; + case DATA_BRUNDIR: return uiAssemblyGUIDs[2]; + } + + return 0; + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_LEVIATHAN: + case TYPE_IGNIS: + case TYPE_RAZORSCALE: + case TYPE_XT002: + case TYPE_ASSEMBLY: + case TYPE_KOLOGARN: + case TYPE_AURIAYA: + case TYPE_MIMIRON: + case TYPE_HODIR: + case TYPE_THORIM: + case TYPE_FREYA: + case TYPE_VEZAX: + case TYPE_YOGGSARON: + case TYPE_ALGALON: + case TYPE_COLOSSUS: + return uiEncounter[type]; + } + + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "U U " << uiEncounter[0] << " " << uiEncounter[1] << " " << uiEncounter[2] << " " << uiEncounter[3] + << " " << uiEncounter[4] << " " << uiEncounter[5] << " " << uiEncounter[6] << " " << uiEncounter[7] + << " " << uiEncounter[8] << " " << uiEncounter[9] << " " << uiEncounter[10] << " " << uiEncounter[11] + << " " << uiEncounter[12] << " " << uiEncounter[13] << " " << uiEncounter[14]; + + m_strInstData = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return m_strInstData; + } + + void Load(const char* strIn) + { + if (!strIn) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(strIn); + + char dataHead1, dataHead2; + uint32 data0, data1, data2, data3, data4, data5, data6, + data7, data8, data9, data10, data11, data12, data13, data14; + + std::istringstream loadStream(strIn); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6 + >> data7 >> data8 >> data9 >> data10 >> data11 >> data12 >> data13 >> data14; + + if (dataHead1 == 'U' && dataHead2 == 'U') + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + { + loadStream >> uiEncounter[i]; + + if (uiEncounter[i] == IN_PROGRESS) + uiEncounter[i] = NOT_STARTED; + } + } + OUT_LOAD_INST_DATA_COMPLETE; + } + }; + }; -InstanceData* GetInstanceData_instance_ulduar(Map* pMap) -{ - return new instance_ulduar(pMap); -} void AddSC_instance_ulduar() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_ulduar"; - newscript->GetInstanceData = &GetInstanceData_instance_ulduar; - newscript->RegisterSelf(); + new instance_ulduar(); } diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp index 102cb69a3b1..dfa86ad005a 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar_teleporter.cpp @@ -38,73 +38,74 @@ The teleporter appears to be active and stable. #define ANTECHAMBER 204 #define WALKWAY 205 #define CONSERVATORY 206 - -bool GoHello_ulduar_teleporter(Player *pPlayer, GameObject *pGO) + class ulduar_teleporter : public GameObjectScript { - ScriptedInstance *pInstance = pGO->GetInstanceData(); - if (!pInstance) return true; +public: + ulduar_teleporter() : GameObjectScript("ulduar_teleporter") { } - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP); - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS); - if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) + bool OnGossipSelect(Player *pPlayer, GameObject * /*pGO*/, uint32 sender, uint32 action) { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE); - if (pInstance->GetData(TYPE_XT002) == DONE) + if (sender != GOSSIP_SENDER_MAIN) return true; + if (!pPlayer->getAttackers().empty()) return true; + + switch(action) { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD); - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER); - if (pInstance->GetData(TYPE_KOLOGARN) == DONE) + case BASE_CAMP: + pPlayer->TeleportTo(603, -706.122, -92.6024, 429.876, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case GROUNDS: + pPlayer->TeleportTo(603, 131.248, -35.3802, 409.804, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case FORGE: + pPlayer->TeleportTo(603, 553.233, -12.3247, 409.679, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case SCRAPYARD: + pPlayer->TeleportTo(603, 926.292, -11.4635, 418.595, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case ANTECHAMBER: + pPlayer->TeleportTo(603, 1498.09, -24.246, 420.967, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case WALKWAY: + pPlayer->TeleportTo(603, 1859.45, -24.1, 448.9, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + case CONSERVATORY: + pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0); + pPlayer->CLOSE_GOSSIP_MENU(); break; + } + + return true; + } + + bool OnGossipHello(Player *pPlayer, GameObject *pGO) + { + InstanceScript *pInstance = pGO->GetInstanceScript(); + if (!pInstance) return true; + + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP); + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Formation Grounds", GOSSIP_SENDER_MAIN, GROUNDS); + if (pInstance->GetData(TYPE_LEVIATHAN) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Colossal Forge", GOSSIP_SENDER_MAIN, FORGE); + if (pInstance->GetData(TYPE_XT002) == DONE) { - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY); - if (pInstance->GetData(TYPE_AURIAYA) == DONE) - pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY); + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Scrapyard", GOSSIP_SENDER_MAIN, SCRAPYARD); + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Antechamber of Ulduar", GOSSIP_SENDER_MAIN, ANTECHAMBER); + if (pInstance->GetData(TYPE_KOLOGARN) == DONE) + { + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Shattered Walkway", GOSSIP_SENDER_MAIN, WALKWAY); + if (pInstance->GetData(TYPE_AURIAYA) == DONE) + pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Conservatory of Life", GOSSIP_SENDER_MAIN, CONSERVATORY); + } } } - } - pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pGO->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, pGO->GetGUID()); - return true; -} - -bool GOSelect_ulduar_teleporter(Player *pPlayer, GameObject * /*pGO*/, uint32 sender, uint32 action) -{ - if (sender != GOSSIP_SENDER_MAIN) return true; - if (!pPlayer->getAttackers().empty()) return true; - - switch(action) - { - case BASE_CAMP: - pPlayer->TeleportTo(603, -706.122, -92.6024, 429.876, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case GROUNDS: - pPlayer->TeleportTo(603, 131.248, -35.3802, 409.804, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case FORGE: - pPlayer->TeleportTo(603, 553.233, -12.3247, 409.679, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case SCRAPYARD: - pPlayer->TeleportTo(603, 926.292, -11.4635, 418.595, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case ANTECHAMBER: - pPlayer->TeleportTo(603, 1498.09, -24.246, 420.967, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case WALKWAY: - pPlayer->TeleportTo(603, 1859.45, -24.1, 448.9, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; - case CONSERVATORY: - pPlayer->TeleportTo(603, 2086.27, -24.3134, 421.239, 0); - pPlayer->CLOSE_GOSSIP_MENU(); break; + return true; } - return true; -} +}; void AddSC_ulduar_teleporter() { - Script *newscript; - newscript = new Script; - newscript->Name = "ulduar_teleporter"; - newscript->pGOHello = &GoHello_ulduar_teleporter; - newscript->pGOSelect = &GOSelect_ulduar_teleporter; - newscript->RegisterSelf(); + new ulduar_teleporter(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index bc2270cf79f..d4ecbbcedc2 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -70,198 +70,205 @@ enum Spells ENTRY_THROW_TARGET = 23996, SPELL_SHADOW_AXE_SUMMON = 42749 }; - -struct boss_ingvar_the_plundererAI : public ScriptedAI + class boss_ingvar_the_plunderer : public CreatureScript { - boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c) +public: + boss_ingvar_the_plunderer() : CreatureScript("boss_ingvar_the_plunderer") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_ingvar_the_plundererAI(pCreature); } - ScriptedInstance* pInstance; - - bool bIsUndead; - bool bEventInProgress; - - uint32 uiCleaveTimer; - uint32 uiSmashTimer; - uint32 uiEnrageTimer; - uint32 uiRoarTimer; - uint32 uiSpawnResTimer; - - void Reset() + struct boss_ingvar_the_plundererAI : public ScriptedAI { - if (bIsUndead) - me->UpdateEntry(MOB_INGVAR_HUMAN); - - bIsUndead = false; - bEventInProgress = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - - uiCleaveTimer = 2000; - uiSmashTimer = 5000; - uiEnrageTimer = 10000; - uiRoarTimer = 15000; - - uiSpawnResTimer = 3000; - - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth() && !bIsUndead) + boss_ingvar_the_plundererAI(Creature *c) : ScriptedAI(c) { - //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? - // visuel hack - me->SetHealth(0); - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - // visuel hack end + pInstance = c->GetInstanceScript(); + } - bEventInProgress = true; + InstanceScript* pInstance; + + bool bIsUndead; + bool bEventInProgress; + + uint32 uiCleaveTimer; + uint32 uiSmashTimer; + uint32 uiEnrageTimer; + uint32 uiRoarTimer; + uint32 uiSpawnResTimer; + + void Reset() + { + if (bIsUndead) + me->UpdateEntry(MOB_INGVAR_HUMAN); + + bIsUndead = false; + bEventInProgress = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + + uiCleaveTimer = 2000; + uiSmashTimer = 5000; + uiEnrageTimer = 10000; + uiRoarTimer = 15000; + + uiSpawnResTimer = 3000; + + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage >= me->GetHealth() && !bIsUndead) + { + //DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true); // Dont work ??? + // visuel hack + me->SetHealth(0); + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + // visuel hack end + + bEventInProgress = true; + bIsUndead = true; + + DoScriptText(YELL_DEAD_1,me); + } + + if (bEventInProgress) + { + damage = 0; + } + } + + void StartZombiePhase() + { bIsUndead = true; + bEventInProgress = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->UpdateEntry(MOB_INGVAR_UNDEAD); + me->SetInCombatWith(me->getVictim()); + me->GetMotionMaster()->MoveChase(me->getVictim()); - DoScriptText(YELL_DEAD_1,me); + DoScriptText(YELL_AGGRO_2,me); } - if (bEventInProgress) + void EnterCombat(Unit * /*who*/) { - damage = 0; - } - } + DoScriptText(YELL_AGGRO_1,me); - void StartZombiePhase() - { - bIsUndead = true; - bEventInProgress = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->UpdateEntry(MOB_INGVAR_UNDEAD); - me->SetInCombatWith(me->getVictim()); - me->GetMotionMaster()->MoveChase(me->getVictim()); - - DoScriptText(YELL_AGGRO_2,me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(YELL_AGGRO_1,me); - - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(YELL_DEAD_2,me); - - if (pInstance) - pInstance->SetData(DATA_INGVAR_EVENT, DONE); - } - - void KilledUnit(Unit * /*victim*/) - { - if (bIsUndead) - DoScriptText(YELL_KILL_1,me); - else - DoScriptText(YELL_KILL_2,me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (bEventInProgress) - { - if (uiSpawnResTimer) - if (uiSpawnResTimer <= diff) - { - DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position - // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ? - uiSpawnResTimer = 0; - } else uiSpawnResTimer -= diff; - - return; + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS); } - if (uiCleaveTimer <= diff) + void JustDied(Unit* /*killer*/) { - if (!me->hasUnitState(UNIT_STAT_CASTING)) + DoScriptText(YELL_DEAD_2,me); + + if (pInstance) + pInstance->SetData(DATA_INGVAR_EVENT, DONE); + } + + void KilledUnit(Unit * /*victim*/) + { + if (bIsUndead) + DoScriptText(YELL_KILL_1,me); + else + DoScriptText(YELL_KILL_2,me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (bEventInProgress) { - if (bIsUndead) - DoCast(me->getVictim(), SPELL_WOE_STRIKE); - else - DoCast(me->getVictim(), SPELL_CLEAVE); - uiCleaveTimer = rand()%5000 + 2000; + if (uiSpawnResTimer) + if (uiSpawnResTimer <= diff) + { + DoCast(me, SPELL_SUMMON_BANSHEE); // Summons directly on caster position + // DoCast(me, SPELL_SCOURG_RESURRECTION, true); // Not needed ? + uiSpawnResTimer = 0; + } else uiSpawnResTimer -= diff; + + return; } - } else uiCleaveTimer -= diff; - if (uiSmashTimer <= diff) - { - if (!me->hasUnitState(UNIT_STAT_CASTING)) - { - if (bIsUndead) - DoCast(me->getVictim(), SPELL_DARK_SMASH); - else - DoCast(me->getVictim(), SPELL_SMASH); - uiSmashTimer = 10000; - } - } else uiSmashTimer -= diff; - - if (!bIsUndead) - { - if (uiEnrageTimer <= diff) - { - DoCast(me, SPELL_ENRAGE); - uiEnrageTimer = 10000; - } else uiEnrageTimer -= diff; - } else // In Undead form used to summon weapon - { - if (uiEnrageTimer <= diff) + if (uiCleaveTimer <= diff) { if (!me->hasUnitState(UNIT_STAT_CASTING)) { - // Spawn target for Axe - Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); - if (pTarget) - { - me->SummonCreature(ENTRY_THROW_TARGET,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); - - DoCast(me, SPELL_SHADOW_AXE_SUMMON); - } - uiEnrageTimer = 30000; + if (bIsUndead) + DoCast(me->getVictim(), SPELL_WOE_STRIKE); + else + DoCast(me->getVictim(), SPELL_CLEAVE); + uiCleaveTimer = rand()%5000 + 2000; } - } else uiEnrageTimer -= diff; - } + } else uiCleaveTimer -= diff; - if (uiRoarTimer <= diff) - { - if (!me->hasUnitState(UNIT_STAT_CASTING)) + if (uiSmashTimer <= diff) { - if (bIsUndead) - DoCast(me, SPELL_DREADFUL_ROAR); - else - DoCast(me, SPELL_STAGGERING_ROAR); - uiRoarTimer = 10000; - } - } else uiRoarTimer -= diff; + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + if (bIsUndead) + DoCast(me->getVictim(), SPELL_DARK_SMASH); + else + DoCast(me->getVictim(), SPELL_SMASH); + uiSmashTimer = 10000; + } + } else uiSmashTimer -= diff; + + if (!bIsUndead) + { + if (uiEnrageTimer <= diff) + { + DoCast(me, SPELL_ENRAGE); + uiEnrageTimer = 10000; + } else uiEnrageTimer -= diff; + } else // In Undead form used to summon weapon + { + if (uiEnrageTimer <= diff) + { + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + // Spawn target for Axe + Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); + if (pTarget) + { + me->SummonCreature(ENTRY_THROW_TARGET,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000); + + DoCast(me, SPELL_SHADOW_AXE_SUMMON); + } + uiEnrageTimer = 30000; + } + } else uiEnrageTimer -= diff; + } + + if (uiRoarTimer <= diff) + { + if (!me->hasUnitState(UNIT_STAT_CASTING)) + { + if (bIsUndead) + DoCast(me, SPELL_DREADFUL_ROAR); + else + DoCast(me, SPELL_STAGGERING_ROAR); + uiRoarTimer = 10000; + } + } else uiRoarTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ingvar_the_plunderer(Creature* pCreature) -{ - return new boss_ingvar_the_plundererAI(pCreature); -} enum eSpells { @@ -274,168 +281,169 @@ enum eSpells SPELL_SCOURG_RESURRECTION_DUMMY = 42862, //Some Emote Dummy? SPELL_INGVAR_TRANSFORM = 42796 }; - -struct mob_annhylde_the_callerAI : public ScriptedAI + class mob_annhylde_the_caller : public CreatureScript { - mob_annhylde_the_callerAI(Creature *c) : ScriptedAI(c) +public: + mob_annhylde_the_caller() : CreatureScript("mob_annhylde_the_caller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_annhylde_the_callerAI (pCreature); } - float x,y,z; - ScriptedInstance* pInstance; - uint32 uiResurectTimer; - uint32 uiResurectPhase; - - void Reset() + struct mob_annhylde_the_callerAI : public ScriptedAI { - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_HOVER); - me->SetSpeed(MOVE_SWIM , 1.0f); - me->SetSpeed(MOVE_RUN , 1.0f); - me->SetSpeed(MOVE_WALK , 1.0f); - //me->SetSpeed(MOVE_FLIGHT , 1.0f); - - me->GetPosition(x,y,z); - DoTeleportTo(x+1,y,z+30); - - Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + mob_annhylde_the_callerAI(Creature *c) : ScriptedAI(c) { - me->GetMotionMaster()->MovePoint(1,x,y,z+15); - -// DoScriptText(YELL_RESSURECT,me); + pInstance = c->GetInstanceScript(); } - } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - Unit* ingvar = Unit::GetUnit((*me), pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) + float x,y,z; + InstanceScript* pInstance; + uint32 uiResurectTimer; + uint32 uiResurectPhase; + + void Reset() { - switch (id) + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_HOVER); + me->SetSpeed(MOVE_SWIM , 1.0f); + me->SetSpeed(MOVE_RUN , 1.0f); + me->SetSpeed(MOVE_WALK , 1.0f); + //me->SetSpeed(MOVE_FLIGHT , 1.0f); + + me->GetPosition(x,y,z); + DoTeleportTo(x+1,y,z+30); + + Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) { - case 1: - ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); - ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_DUMMY,true); - DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); - uiResurectTimer = 8000; - uiResurectPhase = 1; - break; - case 2: - me->SetVisibility(VISIBILITY_OFF); - me->DealDamage(me,me->GetHealth()); - me->RemoveCorpse(); - break; + me->GetMotionMaster()->MovePoint(1,x,y,z+15); + + // DoScriptText(YELL_RESSURECT,me); } } - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (uiResurectTimer) - if (uiResurectTimer <= diff) + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + Unit* ingvar = Unit::GetUnit((*me), pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) { - if (uiResurectPhase == 1) + switch (id) { - Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); - if (ingvar) - { - ingvar->SetStandState(UNIT_STAND_STATE_STAND); - ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_HEAL,false); - } - uiResurectTimer = 3000; - uiResurectPhase = 2; + case 1: + ingvar->RemoveAura(SPELL_SUMMON_BANSHEE); + ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_DUMMY,true); + DoCast(ingvar, SPELL_SCOURG_RESURRECTION_BEAM); + uiResurectTimer = 8000; + uiResurectPhase = 1; + break; + case 2: + me->SetVisibility(VISIBILITY_OFF); + me->DealDamage(me,me->GetHealth()); + me->RemoveCorpse(); + break; } - else if (uiResurectPhase == 2) + } + } + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) + { + if (uiResurectTimer) + if (uiResurectTimer <= diff) { - if (Creature* ingvar = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0)) + if (uiResurectPhase == 1) { - ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); - - if (boss_ingvar_the_plundererAI* pAI = CAST_AI(boss_ingvar_the_plundererAI, ingvar->AI())) - pAI->StartZombiePhase(); - - me->GetMotionMaster()->MovePoint(2,x+1,y,z+30); - ++uiResurectPhase; - uiResurectTimer = 0; + Unit* ingvar = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0); + if (ingvar) + { + ingvar->SetStandState(UNIT_STAND_STATE_STAND); + ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_HEAL,false); + } + uiResurectTimer = 3000; + uiResurectPhase = 2; } - } + else if (uiResurectPhase == 2) + { + if (Creature* ingvar = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_INGVAR) : 0)) + { + ingvar->RemoveAurasDueToSpell(SPELL_SCOURG_RESURRECTION_DUMMY); + + if (boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI* pAI = CAST_AI(boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI, ingvar->AI())) + pAI->StartZombiePhase(); + + me->GetMotionMaster()->MovePoint(2,x+1,y,z+30); + ++uiResurectPhase; + uiResurectTimer = 0; + } + } + + } else uiResurectTimer -= diff; + } + }; - } else uiResurectTimer -= diff; - } }; -CreatureAI* GetAI_mob_annhylde_the_caller(Creature* pCreature) -{ - return new mob_annhylde_the_callerAI (pCreature); -} enum eShadowAxe { SPELL_SHADOW_AXE_DAMAGE = 42750, H_SPELL_SHADOW_AXE_DAMAGE = 59719 }; - -struct mob_ingvar_throw_dummyAI : public ScriptedAI + class mob_ingvar_throw_dummy : public CreatureScript { - mob_ingvar_throw_dummyAI(Creature *c) : ScriptedAI(c) +public: + mob_ingvar_throw_dummy() : CreatureScript("mob_ingvar_throw_dummy") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_ingvar_throw_dummyAI (pCreature); } - uint32 uiDespawnTimer; - - void Reset() + struct mob_ingvar_throw_dummyAI : public ScriptedAI { - Unit *pTarget = me->FindNearestCreature(ENTRY_THROW_TARGET,50); - if (pTarget) + mob_ingvar_throw_dummyAI(Creature *c) : ScriptedAI(c) { - DoCast(me, SPELL_SHADOW_AXE_DAMAGE); - float x,y,z; - pTarget->GetPosition(x,y,z); - me->GetMotionMaster()->MovePoint(0,x,y,z); } - uiDespawnTimer = 7000; - } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit * /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (uiDespawnTimer <= diff) + + uint32 uiDespawnTimer; + + void Reset() { - me->DealDamage(me,me->GetHealth()); - me->RemoveCorpse(); - uiDespawnTimer = 0; - } else uiDespawnTimer -= diff; - } + Unit *pTarget = me->FindNearestCreature(ENTRY_THROW_TARGET,50); + if (pTarget) + { + DoCast(me, SPELL_SHADOW_AXE_DAMAGE); + float x,y,z; + pTarget->GetPosition(x,y,z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + } + uiDespawnTimer = 7000; + } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit * /*who*/) {} + void UpdateAI(const uint32 diff) + { + if (uiDespawnTimer <= diff) + { + me->DealDamage(me,me->GetHealth()); + me->RemoveCorpse(); + uiDespawnTimer = 0; + } else uiDespawnTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_ingvar_throw_dummy(Creature* pCreature) -{ - return new mob_ingvar_throw_dummyAI (pCreature); -} void AddSC_boss_ingvar_the_plunderer() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ingvar_the_plunderer"; - newscript->GetAI = &GetAI_boss_ingvar_the_plunderer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_annhylde_the_caller"; - newscript->GetAI = &GetAI_mob_annhylde_the_caller; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ingvar_throw_dummy"; - newscript->GetAI = &GetAI_mob_ingvar_throw_dummy; - newscript->RegisterSelf(); + new boss_ingvar_the_plunderer(); + new mob_annhylde_the_caller(); + new mob_ingvar_throw_dummy(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 8e0b69a1d3c..1f7cf12fabb 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -59,302 +59,310 @@ float SkeletonSpawnPoint[5][5]= float AttackLoc[3]={197.636, 194.046, 40.8164}; bool ShatterFrostTomb; // needed for achievement: On The Rocks(1919) - -struct mob_frost_tombAI : public ScriptedAI + class mob_frost_tomb : public CreatureScript { - mob_frost_tombAI(Creature *c) : ScriptedAI(c) +public: + mob_frost_tomb() : CreatureScript("mob_frost_tomb") { } + + CreatureAI* GetAI(Creature* pCreature) const { - FrostTombGUID = 0; + return new mob_frost_tombAI(pCreature); } - uint64 FrostTombGUID; - - void SetPrisoner(Unit* uPrisoner) + struct mob_frost_tombAI : public ScriptedAI { - FrostTombGUID = uPrisoner->GetGUID(); - } - - void Reset(){ FrostTombGUID = 0; } - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void JustDied(Unit *killer) - { - if (killer->GetGUID() != me->GetGUID()) - ShatterFrostTomb = true; - - if (FrostTombGUID) + mob_frost_tombAI(Creature *c) : ScriptedAI(c) { - Unit* FrostTomb = Unit::GetUnit((*me),FrostTombGUID); - if (FrostTomb) - FrostTomb->RemoveAurasDueToSpell(SPELL_FROST_TOMB); + FrostTombGUID = 0; } - } - void UpdateAI(const uint32 /*diff*/) - { - Unit* temp = Unit::GetUnit((*me),FrostTombGUID); - if ((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB)) || !temp) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } -}; + uint64 FrostTombGUID; -struct boss_kelesethAI : public ScriptedAI -{ - boss_kelesethAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 FrostTombTimer; - uint32 SummonSkeletonsTimer; - uint32 RespawnSkeletonsTimer; - uint32 ShadowboltTimer; - uint64 SkeletonGUID[5]; - bool Skeletons; - bool RespawnSkeletons; - - void Reset() - { - ShadowboltTimer = 0; - Skeletons = false; - - ShatterFrostTomb = false; - - ResetTimer(); - - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); - } - - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - - DoScriptText(SAY_KILL, me); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (IsHeroic() && !ShatterFrostTomb) + void SetPrisoner(Unit* uPrisoner) { - AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); - if (AchievOnTheRocks) + FrostTombGUID = uPrisoner->GetGUID(); + } + + void Reset(){ FrostTombGUID = 0; } + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void JustDied(Unit *killer) + { + if (killer->GetGUID() != me->GetGUID()) + ShatterFrostTomb = true; + + if (FrostTombGUID) { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) - { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievOnTheRocks); - } + Unit* FrostTomb = Unit::GetUnit((*me),FrostTombGUID); + if (FrostTomb) + FrostTomb->RemoveAurasDueToSpell(SPELL_FROST_TOMB); } } - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - - if (pInstance) - pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); - } - - void ResetTimer(uint32 inc = 0) - { - SummonSkeletonsTimer = 5000 + inc; - FrostTombTimer = 28000 + inc; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (ShadowboltTimer <= diff) + void UpdateAI(const uint32 /*diff*/) { - Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - me->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHADOWBOLT, SPELL_SHADOWBOLT_HEROIC), true); - ShadowboltTimer = 10000; - } else ShadowboltTimer -= diff; - - if (!Skeletons) - if ((SummonSkeletonsTimer <= diff)) - { - Creature* Skeleton; - DoScriptText(SAY_SKELETONS, me); - for (uint8 i = 0; i < 5; ++i) - { - Skeleton = me->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); - if (Skeleton) - { - Skeleton->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Skeleton->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ()); - Skeleton->AddThreat(me->getVictim(), 0.0f); - DoZoneInCombat(Skeleton); - } - } - Skeletons = true; - } else SummonSkeletonsTimer -= diff; - - if (FrostTombTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - if (pTarget->isAlive()) - { - //DoCast(pTarget, SPELL_FROST_TOMB_SUMMON, true); - if (Creature *pChains = me->SummonCreature(CREATURE_FROSTTOMB, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) - { - CAST_AI(mob_frost_tombAI, pChains->AI())->SetPrisoner(pTarget); - pChains->CastSpell(pTarget, SPELL_FROST_TOMB, true); - - DoScriptText(SAY_FROST_TOMB, me); - } - } - FrostTombTimer = 15000; - } else FrostTombTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_vrykul_skeletonAI : public ScriptedAI -{ - mob_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - uint32 Respawn_Time; - uint64 Target_Guid; - uint32 Decrepify_Timer; - - bool isDead; - - void Reset() - { - Respawn_Time = 12000; - Decrepify_Timer = urand(10000,20000); - isDead = false; - } - - void EnterCombat(Unit * /*who*/){} - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() == me->GetGUID()) - return; - - if (damage >= me->GetHealth()) - { - PretendToDie(); - damage = 0; - } - } - - void PretendToDie() - { - isDead = true; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->GetMotionMaster()->MovementExpired(false); - me->GetMotionMaster()->MoveIdle(); - me->SetStandState(UNIT_STAND_STATE_DEAD); - }; - - void Resurrect() - { - isDead = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_SCOURGE_RESSURRECTION, true); - - if (me->getVictim()) - { - me->GetMotionMaster()->MoveChase(me->getVictim()); - me->AI()->AttackStart(me->getVictim()); - } - else - me->GetMotionMaster()->Initialize(); - }; - - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS) - { - if (isDead) - { - if (Respawn_Time <= diff) - { - Resurrect(); - Respawn_Time = 12000; - } else Respawn_Time -= diff; - } - else - { - if (!UpdateVictim()) - return; - - if (Decrepify_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DECREPIFY); - Decrepify_Timer = 30000; - } else Decrepify_Timer -= diff; - - DoMeleeAttackIfReady(); - } - }else - { - if (me->isAlive()) + Unit* temp = Unit::GetUnit((*me),FrostTombGUID); + if ((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB)) || !temp) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } + }; +}; + class boss_keleseth : public CreatureScript +{ +public: + boss_keleseth() : CreatureScript("boss_keleseth") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_kelesethAI (pCreature); } + + struct boss_kelesethAI : public ScriptedAI + { + boss_kelesethAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 FrostTombTimer; + uint32 SummonSkeletonsTimer; + uint32 RespawnSkeletonsTimer; + uint32 ShadowboltTimer; + uint64 SkeletonGUID[5]; + bool Skeletons; + bool RespawnSkeletons; + + void Reset() + { + ShadowboltTimer = 0; + Skeletons = false; + + ShatterFrostTomb = false; + + ResetTimer(); + + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(SAY_KILL, me); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (IsHeroic() && !ShatterFrostTomb) + { + AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); + if (AchievOnTheRocks) + { + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievOnTheRocks); + } + } + } + + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + + if (pInstance) + pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS); + } + + void ResetTimer(uint32 inc = 0) + { + SummonSkeletonsTimer = 5000 + inc; + FrostTombTimer = 28000 + inc; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (ShadowboltTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + me->CastSpell(pTarget, DUNGEON_MODE(SPELL_SHADOWBOLT, SPELL_SHADOWBOLT_HEROIC), true); + ShadowboltTimer = 10000; + } else ShadowboltTimer -= diff; + + if (!Skeletons) + if ((SummonSkeletonsTimer <= diff)) + { + Creature* Skeleton; + DoScriptText(SAY_SKELETONS, me); + for (uint8 i = 0; i < 5; ++i) + { + Skeleton = me->SummonCreature(CREATURE_SKELETON, SkeletonSpawnPoint[i][0], SkeletonSpawnPoint[i][1] , SKELETONSPAWN_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 20000); + if (Skeleton) + { + Skeleton->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Skeleton->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY() , me->GetPositionZ()); + Skeleton->AddThreat(me->getVictim(), 0.0f); + DoZoneInCombat(Skeleton); + } + } + Skeletons = true; + } else SummonSkeletonsTimer -= diff; + + if (FrostTombTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (pTarget->isAlive()) + { + //DoCast(pTarget, SPELL_FROST_TOMB_SUMMON, true); + if (Creature *pChains = me->SummonCreature(CREATURE_FROSTTOMB, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 20000)) + { + CAST_AI(mob_frost_tomb::mob_frost_tombAI, pChains->AI())->SetPrisoner(pTarget); + pChains->CastSpell(pTarget, SPELL_FROST_TOMB, true); + + DoScriptText(SAY_FROST_TOMB, me); + } + } + FrostTombTimer = 15000; + } else FrostTombTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_vrykul_skeleton : public CreatureScript +{ +public: + mob_vrykul_skeleton() : CreatureScript("mob_vrykul_skeleton") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_vrykul_skeletonAI (pCreature); + } + + struct mob_vrykul_skeletonAI : public ScriptedAI + { + mob_vrykul_skeletonAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + uint32 Respawn_Time; + uint64 Target_Guid; + uint32 Decrepify_Timer; + + bool isDead; + + void Reset() + { + Respawn_Time = 12000; + Decrepify_Timer = urand(10000,20000); + isDead = false; + } + + void EnterCombat(Unit * /*who*/){} + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetGUID() == me->GetGUID()) + return; + + if (damage >= me->GetHealth()) + { + PretendToDie(); + damage = 0; + } + } + + void PretendToDie() + { + isDead = true; + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->GetMotionMaster()->MovementExpired(false); + me->GetMotionMaster()->MoveIdle(); + me->SetStandState(UNIT_STAND_STATE_DEAD); + }; + + void Resurrect() + { + isDead = false; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_SCOURGE_RESSURRECTION, true); + + if (me->getVictim()) + { + me->GetMotionMaster()->MoveChase(me->getVictim()); + me->AI()->AttackStart(me->getVictim()); + } + else + me->GetMotionMaster()->Initialize(); + }; + + void UpdateAI(const uint32 diff) + { + if (pInstance && pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS) + { + if (isDead) + { + if (Respawn_Time <= diff) + { + Resurrect(); + Respawn_Time = 12000; + } else Respawn_Time -= diff; + } + else + { + if (!UpdateVictim()) + return; + + if (Decrepify_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DECREPIFY); + Decrepify_Timer = 30000; + } else Decrepify_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }else + { + if (me->isAlive()) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + } + }; + }; -CreatureAI* GetAI_mob_frost_tomb(Creature* pCreature) -{ - return new mob_frost_tombAI(pCreature); -} -CreatureAI* GetAI_boss_keleseth(Creature* pCreature) -{ - return new boss_kelesethAI (pCreature); -} -CreatureAI* GetAI_mob_vrykul_skeleton(Creature* pCreature) -{ - return new mob_vrykul_skeletonAI (pCreature); -} 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(); - - newscript = new Script; - newscript->Name = "mob_vrykul_skeleton"; - newscript->GetAI = &GetAI_mob_vrykul_skeleton; - newscript->RegisterSelf(); + new boss_keleseth(); + new mob_frost_tomb(); + new mob_vrykul_skeleton(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp index 02fc594b74a..8e3299e4571 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_skarvald_dalronn.cpp @@ -56,333 +56,338 @@ enum eEnums SPELL_SUMMON_DALRONN_GHOST = 48612, MOB_DALRONN_GHOST = 27389 }; - -struct boss_skarvald_the_constructorAI : public ScriptedAI + class boss_skarvald_the_constructor : public CreatureScript { - boss_skarvald_the_constructorAI(Creature *c) : ScriptedAI(c) +public: + boss_skarvald_the_constructor() : CreatureScript("boss_skarvald_the_constructor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_skarvald_the_constructorAI (pCreature); } - ScriptedInstance* pInstance; - - bool ghost; - uint32 Charge_Timer; - uint32 StoneStrike_Timer; - uint32 Response_Timer; - uint32 Check_Timer; - bool Dalronn_isDead; - - void Reset() + struct boss_skarvald_the_constructorAI : public ScriptedAI { - Charge_Timer = 5000; - StoneStrike_Timer = 10000; - Dalronn_isDead = false; - Check_Timer = 5000; - - ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); - if (!ghost && pInstance) + boss_skarvald_the_constructorAI(Creature *c) : ScriptedAI(c) { - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isDead()) - CAST_CRE(dalronn)->Respawn(); - - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit * who) - { - if (!ghost && pInstance) + InstanceScript* pInstance; + + bool ghost; + uint32 Charge_Timer; + uint32 StoneStrike_Timer; + uint32 Response_Timer; + uint32 Check_Timer; + bool Dalronn_isDead; + + void Reset() { - DoScriptText(YELL_SKARVALD_AGGRO,me); + Charge_Timer = 5000; + StoneStrike_Timer = 10000; + Dalronn_isDead = false; + Check_Timer = 5000; - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) - dalronn->getThreatManager().addThreat(who,0.0f); - - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); - } - } - - void JustDied(Unit* Killer) - { - if (!ghost && pInstance) - { - Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); - if (dalronn) + ghost = (me->GetEntry() == MOB_SKARVALD_GHOST); + if (!ghost && pInstance) { - if (dalronn->isDead()) - { - DoScriptText(YELL_SKARVALD_DAL_DIED,me); + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn && dalronn->isDead()) + CAST_CRE(dalronn)->Respawn(); - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST,me); + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); + } + } - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); - Creature* temp = me->SummonCreature(MOB_SKARVALD_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); - if (temp) + void EnterCombat(Unit * who) + { + if (!ghost && pInstance) + { + DoScriptText(YELL_SKARVALD_AGGRO,me); + + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn && dalronn->isAlive() && !dalronn->getVictim()) + dalronn->getThreatManager().addThreat(who,0.0f); + + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + } + } + + void JustDied(Unit* Killer) + { + if (!ghost && pInstance) + { + Unit* dalronn = Unit::GetUnit((*me),pInstance->GetData64(DATA_DALRONN)); + if (dalronn) + { + if (dalronn->isDead()) { - temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); + DoScriptText(YELL_SKARVALD_DAL_DIED,me); + + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); + } + else + { + DoScriptText(YELL_SKARVALD_SKA_DIEDFIRST,me); + + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + //DoCast(me, SPELL_SUMMON_SKARVALD_GHOST, true); + Creature* temp = me->SummonCreature(MOB_SKARVALD_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); + if (temp) + { + temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(Killer); + } } } } } - } - void KilledUnit(Unit * /*victim*/) - { - if (!ghost) + void KilledUnit(Unit * /*victim*/) { - DoScriptText(YELL_SKARVALD_KILL,me); - } - } - - void UpdateAI(const uint32 diff) - { - if (ghost) - { - if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (!ghost) + { + DoScriptText(YELL_SKARVALD_KILL,me); + } } - if (!UpdateVictim()) - return; - - if (!ghost) + void UpdateAI(const uint32 diff) { - if (Check_Timer) - if (Check_Timer <= diff) - { - Check_Timer = 5000; - Unit* dalronn = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_DALRONN) : 0); - if (dalronn && dalronn->isDead()) + if (ghost) + { + if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + if (!UpdateVictim()) + return; + + if (!ghost) + { + if (Check_Timer) + if (Check_Timer <= diff) { - Dalronn_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } else Check_Timer -= diff; + Check_Timer = 5000; + Unit* dalronn = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_DALRONN) : 0); + if (dalronn && dalronn->isDead()) + { + Dalronn_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } + } else Check_Timer -= diff; - if (Response_Timer) - if (Dalronn_isDead) - if (Response_Timer <= diff) - { - DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST,me); + if (Response_Timer) + if (Dalronn_isDead) + if (Response_Timer <= diff) + { + DoScriptText(YELL_SKARVALD_DAL_DIEDFIRST,me); - Response_Timer = 0; - } else Response_Timer -= diff; + Response_Timer = 0; + } else Response_Timer -= diff; + } + + if (Charge_Timer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE); + Charge_Timer = 5000+rand()%5000; + } else Charge_Timer -= diff; + + if (StoneStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STONE_STRIKE); + StoneStrike_Timer = 5000+rand()%5000; + } else StoneStrike_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (Charge_Timer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CHARGE); - Charge_Timer = 5000+rand()%5000; - } else Charge_Timer -= diff; - - if (StoneStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_STONE_STRIKE); - StoneStrike_Timer = 5000+rand()%5000; - } else StoneStrike_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_skarvald_the_constructor(Creature* pCreature) + class boss_dalronn_the_controller : public CreatureScript { - return new boss_skarvald_the_constructorAI (pCreature); -} +public: + boss_dalronn_the_controller() : CreatureScript("boss_dalronn_the_controller") { } -struct boss_dalronn_the_controllerAI : public ScriptedAI -{ - boss_dalronn_the_controllerAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_dalronn_the_controllerAI (pCreature); } - ScriptedInstance* pInstance; - - bool ghost; - uint32 ShadowBolt_Timer; - uint32 Debilitate_Timer; - uint32 Summon_Timer; - - uint32 Response_Timer; - uint32 Check_Timer; - uint32 AggroYell_Timer; - bool Skarvald_isDead; - - void Reset() + struct boss_dalronn_the_controllerAI : public ScriptedAI { - ShadowBolt_Timer = 1000; - Debilitate_Timer = 5000; - Summon_Timer = 10000; - Check_Timer = 5000; - Skarvald_isDead = false; - AggroYell_Timer = 0; - - ghost = me->GetEntry() == MOB_DALRONN_GHOST; - if (!ghost && pInstance) + boss_dalronn_the_controllerAI(Creature *c) : ScriptedAI(c) { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isDead()) - CAST_CRE(skarvald)->Respawn(); - - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); - } - } - - void EnterCombat(Unit * who) - { - if (!ghost && pInstance) - { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) - skarvald->getThreatManager().addThreat(who,0.0f); - - AggroYell_Timer = 5000; - - if (pInstance) - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); - } - } - - void JustDied(Unit* Killer) - { - if (!ghost && pInstance) - { - Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); - if (skarvald) - if (skarvald->isDead()) - { - DoScriptText(YELL_DALRONN_SKA_DIED,me); - - if (pInstance) - pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); - } - else - { - DoScriptText(YELL_DALRONN_DAL_DIEDFIRST,me); - - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); - Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); - if (temp) - { - temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - temp->AI()->AttackStart(Killer); - } - } - } - } - - void KilledUnit(Unit * /*victim*/) - { - if (!ghost) - { - DoScriptText(YELL_DALRONN_KILL,me); - } - } - - void UpdateAI(const uint32 diff) - { - if (ghost) - { - if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pInstance = c->GetInstanceScript(); } - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (AggroYell_Timer) - if (AggroYell_Timer <= diff) + bool ghost; + uint32 ShadowBolt_Timer; + uint32 Debilitate_Timer; + uint32 Summon_Timer; + + uint32 Response_Timer; + uint32 Check_Timer; + uint32 AggroYell_Timer; + bool Skarvald_isDead; + + void Reset() + { + ShadowBolt_Timer = 1000; + Debilitate_Timer = 5000; + Summon_Timer = 10000; + Check_Timer = 5000; + Skarvald_isDead = false; + AggroYell_Timer = 0; + + ghost = me->GetEntry() == MOB_DALRONN_GHOST; + if (!ghost && pInstance) { - DoScriptText(YELL_DALRONN_AGGRO,me); + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald && skarvald->isDead()) + CAST_CRE(skarvald)->Respawn(); - AggroYell_Timer = 0; - } else AggroYell_Timer -= diff; - - if (!ghost) - { - if (Check_Timer) - if (Check_Timer <= diff) - { - Check_Timer = 5000; - Unit* skarvald = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SKARVALD) : 0); - if (skarvald && skarvald->isDead()) - { - Skarvald_isDead = true; - Response_Timer = 2000; - Check_Timer = 0; - } - } else Check_Timer -= diff; - - if (Response_Timer) - if (Skarvald_isDead) - if (Response_Timer <= diff) - { - DoScriptText(YELL_DALRONN_SKA_DIEDFIRST,me); - - Response_Timer = 0; - } else Response_Timer -= diff; - } - - if (ShadowBolt_Timer <= diff) - { - if (!me->IsNonMeleeSpellCasted(false)) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); - ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED); } - } else ShadowBolt_Timer -= diff; + } - if (Debilitate_Timer <= diff) + void EnterCombat(Unit * who) { - if (!me->IsNonMeleeSpellCasted(false)) + if (!ghost && pInstance) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); - Debilitate_Timer = 5000+rand()%5000; - } - } else Debilitate_Timer -= diff; + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald && skarvald->isAlive() && !skarvald->getVictim()) + skarvald->getThreatManager().addThreat(who,0.0f); - if (IsHeroic()) - if (Summon_Timer <= diff) + AggroYell_Timer = 5000; + + if (pInstance) + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS); + } + } + + void JustDied(Unit* Killer) + { + if (!ghost && pInstance) + { + Unit* skarvald = Unit::GetUnit((*me),pInstance->GetData64(DATA_SKARVALD)); + if (skarvald) + if (skarvald->isDead()) + { + DoScriptText(YELL_DALRONN_SKA_DIED,me); + + if (pInstance) + pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE); + } + else + { + DoScriptText(YELL_DALRONN_DAL_DIEDFIRST,me); + + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + //DoCast(me, SPELL_SUMMON_DALRONN_GHOST, true); + Creature* temp = me->SummonCreature(MOB_DALRONN_GHOST,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),0,TEMPSUMMON_CORPSE_DESPAWN,5000); + if (temp) + { + temp->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + temp->AI()->AttackStart(Killer); + } + } + } + } + + void KilledUnit(Unit * /*victim*/) + { + if (!ghost) + { + DoScriptText(YELL_DALRONN_KILL,me); + } + } + + void UpdateAI(const uint32 diff) + { + if (ghost) + { + if (pInstance && pInstance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + if (!UpdateVictim()) + return; + + if (AggroYell_Timer) + if (AggroYell_Timer <= diff) + { + DoScriptText(YELL_DALRONN_AGGRO,me); + + AggroYell_Timer = 0; + } else AggroYell_Timer -= diff; + + if (!ghost) + { + if (Check_Timer) + if (Check_Timer <= diff) + { + Check_Timer = 5000; + Unit* skarvald = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_SKARVALD) : 0); + if (skarvald && skarvald->isDead()) + { + Skarvald_isDead = true; + Response_Timer = 2000; + Check_Timer = 0; + } + } else Check_Timer -= diff; + + if (Response_Timer) + if (Skarvald_isDead) + if (Response_Timer <= diff) + { + DoScriptText(YELL_DALRONN_SKA_DIEDFIRST,me); + + Response_Timer = 0; + } else Response_Timer -= diff; + } + + if (ShadowBolt_Timer <= diff) { if (!me->IsNonMeleeSpellCasted(false)) { - DoCast(me, H_SPELL_SUMMON_SKELETONS); - Summon_Timer = (rand()%10000) + 20000; + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT); + ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells } - } else Summon_Timer -= diff; + } else ShadowBolt_Timer -= diff; + + if (Debilitate_Timer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE); + Debilitate_Timer = 5000+rand()%5000; + } + } else Debilitate_Timer -= diff; + + if (IsHeroic()) + if (Summon_Timer <= diff) + { + if (!me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, H_SPELL_SUMMON_SKELETONS); + Summon_Timer = (rand()%10000) + 20000; + } + } else Summon_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_dalronn_the_controller(Creature* pCreature) -{ - return new boss_dalronn_the_controllerAI (pCreature); -} void AddSC_boss_skarvald_dalronn() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_skarvald_the_constructor"; - newscript->GetAI = &GetAI_boss_skarvald_the_constructor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_dalronn_the_controller"; - newscript->GetAI = &GetAI_boss_dalronn_the_controller; - newscript->RegisterSelf(); + new boss_skarvald_the_constructor(); + new boss_dalronn_the_controller(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 1a45b18326c..4ad3076fb05 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -47,265 +47,268 @@ EndScriptData */ 1 - Skarvald Dalronn 2 - Ingvar the Plunderer */ - -struct instance_utgarde_keep : public ScriptedInstance + class instance_utgarde_keep : public InstanceMapScript { - instance_utgarde_keep(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_utgarde_keep() : InstanceMapScript("instance_utgarde_keep") { } - uint64 Keleseth; - uint64 Skarvald; - uint64 Dalronn; - uint64 Ingvar; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_utgarde_keep_InstanceMapScript(pMap); + } - uint64 forge_bellow[3]; - uint64 forge_fire[3]; - uint64 forge_anvil[3]; - uint64 portcullis[2]; + struct instance_utgarde_keep_InstanceMapScript : public InstanceScript + { + instance_utgarde_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 forge_event[3]; - std::string str_data; + uint64 Keleseth; + uint64 Skarvald; + uint64 Dalronn; + uint64 Ingvar; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + uint64 forge_bellow[3]; + uint64 forge_fire[3]; + uint64 forge_anvil[3]; + uint64 portcullis[2]; - Keleseth = 0; - Skarvald = 0; - Dalronn = 0; - Ingvar = 0; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 forge_event[3]; + std::string str_data; - for (uint8 i = 0; i < 3; ++i) - { - forge_bellow[i] = 0; - forge_fire[i] = 0; - forge_anvil[i] = 0; - forge_event[i] = NOT_STARTED; + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Keleseth = 0; + Skarvald = 0; + Dalronn = 0; + Ingvar = 0; + + for (uint8 i = 0; i < 3; ++i) + { + forge_bellow[i] = 0; + forge_fire[i] = 0; + forge_anvil[i] = 0; + forge_event[i] = NOT_STARTED; + } + + portcullis[0] = 0; + portcullis[1] = 0; } - portcullis[0] = 0; - portcullis[1] = 0; - } - - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; - - return false; - } - - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); - - if (!players.isEmpty()) + bool IsEncounterInProgress() const { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* plr = itr->getSource()) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + sLog.outDebug("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 23953: Keleseth = pCreature->GetGUID(); break; + case 24201: Dalronn = pCreature->GetGUID(); break; + case 24200: Skarvald = pCreature->GetGUID(); break; + case 23954: Ingvar = pCreature->GetGUID(); break; } } - sLog.outDebug("TSCR: Instance Utgarde Keep: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 23953: Keleseth = pCreature->GetGUID(); break; - case 24201: Dalronn = pCreature->GetGUID(); break; - case 24200: Skarvald = pCreature->GetGUID(); break; - case 23954: Ingvar = pCreature->GetGUID(); break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - //door and object id - case ENTRY_BELLOW_1: forge_bellow[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_BELLOW_2: forge_bellow[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_BELLOW_3: forge_bellow[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_1: forge_fire[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_2: forge_fire[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_FORGEFIRE_3: forge_fire[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = pGo->GetGUID(); - if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = pGo->GetGUID(); - if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = pGo->GetGUID(); - if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GIANT_PORTCULLIS_1: portcullis[0] = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; - case ENTRY_GIANT_PORTCULLIS_2: portcullis[1] = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; - } - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_PRINCEKELESETH: return Keleseth; - case DATA_DALRONN: return Dalronn; - case DATA_SKARVALD: return Skarvald; - case DATA_INGVAR: return Ingvar; + switch(pGo->GetEntry()) + { + //door and object id + case ENTRY_BELLOW_1: forge_bellow[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_BELLOW_2: forge_bellow[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_BELLOW_3: forge_bellow[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_1: forge_fire[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_2: forge_fire[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_FORGEFIRE_3: forge_fire[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_1: forge_anvil[0] = pGo->GetGUID(); + if (forge_event[0] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_2: forge_anvil[1] = pGo->GetGUID(); + if (forge_event[1] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GLOWING_ANVIL_3: forge_anvil[2] = pGo->GetGUID(); + if (forge_event[2] != NOT_STARTED)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GIANT_PORTCULLIS_1: portcullis[0] = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; + case ENTRY_GIANT_PORTCULLIS_2: portcullis[1] = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE)HandleGameObject(NULL,true,pGo);break; + } } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + uint64 GetData64(uint32 identifier) { - case DATA_PRINCEKELESETH_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_SKARVALD_DALRONN_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_INGVAR_EVENT: + switch(identifier) + { + case DATA_PRINCEKELESETH: return Keleseth; + case DATA_DALRONN: 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_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_SKARVALD_DALRONN_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_INGVAR_EVENT: + if (data == DONE) + { + HandleGameObject(portcullis[0], true); + HandleGameObject(portcullis[1], true); + } + m_auiEncounter[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); + } + forge_event[0] = data; + 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); + } + forge_event[1] = data; + 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); + } + forge_event[2] = data; + break; + } + if (data == DONE) { - HandleGameObject(portcullis[0], true); - HandleGameObject(portcullis[1], true); + SaveToDB(); } - m_auiEncounter[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); - } - forge_event[0] = data; - 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); - } - forge_event[1] = data; - 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); - } - forge_event[2] = data; - break; } - if (data == DONE) + uint32 GetData(uint32 type) { - SaveToDB(); - } - } + switch(type) + { + case DATA_PRINCEKELESETH_EVENT: return m_auiEncounter[0]; + case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; + case DATA_INGVAR_EVENT: return m_auiEncounter[2]; + } - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_PRINCEKELESETH_EVENT: return m_auiEncounter[0]; - case DATA_SKARVALD_DALRONN_EVENT: return m_auiEncounter[1]; - case DATA_INGVAR_EVENT: return m_auiEncounter[2]; + return 0; } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "U K " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << forge_event[0] << " " << forge_event[1] << " " << forge_event[2]; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; } - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; - - if (dataHead1 == 'U' && dataHead2 == 'K') + void Load(const char* in) { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA(in); - forge_event[0] = data3; - forge_event[1] = data4; - forge_event[2] = data5; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; - } else OUT_LOAD_INST_DATA_FAIL; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + + if (dataHead1 == 'U' && dataHead2 == 'K') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + forge_event[0] = data3; + forge_event[1] = data4; + forge_event[2] = data5; + + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_utgarde_keep(Map* pMap) -{ - return new instance_utgarde_keep(pMap); -} void AddSC_instance_utgarde_keep() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_utgarde_keep"; - newscript->GetInstanceData = &GetInstanceData_instance_utgarde_keep; - newscript->RegisterSelf(); + new instance_utgarde_keep(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index 4ee2059712d..6672d6691b5 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -24,136 +24,138 @@ uint32 entry_search[3] = 186610, 186611 }; - -struct npc_dragonflayer_forge_masterAI : public ScriptedAI + class npc_dragonflayer_forge_master : public CreatureScript { - npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) +public: + npc_dragonflayer_forge_master() : CreatureScript("npc_dragonflayer_forge_master") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - fm_Type = 0; + return new npc_dragonflayer_forge_masterAI(pCreature); } - ScriptedInstance* pInstance; - uint8 fm_Type; - - void Reset() + struct npc_dragonflayer_forge_masterAI : public ScriptedAI { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - CheckForge(); - } - - void CheckForge() - { - if (pInstance) + npc_dragonflayer_forge_masterAI(Creature *c) : ScriptedAI(c) { - switch(fm_Type) - { - case 1: - pInstance->SetData(EVENT_FORGE_1,me->isAlive() ? NOT_STARTED : DONE); - break; - case 2: - pInstance->SetData(EVENT_FORGE_2,me->isAlive() ? NOT_STARTED : DONE); - break; - case 3: - pInstance->SetData(EVENT_FORGE_3,me->isAlive() ? NOT_STARTED : DONE); - break; - } + pInstance = c->GetInstanceScript(); + fm_Type = 0; } - } - void JustDied(Unit * /*killer*/) - { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - if (pInstance) + InstanceScript* pInstance; + uint8 fm_Type; + + void Reset() { - 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; - } + if (fm_Type == 0) fm_Type = GetForgeMasterType(); + CheckForge(); } - } - void EnterCombat(Unit * /*who*/) - { - if (fm_Type == 0) fm_Type = GetForgeMasterType(); - if (pInstance) + void CheckForge() { - switch(fm_Type) + if (pInstance) { - 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; - } - } - me->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); - } - - uint8 GetForgeMasterType() - { - float diff = 30.0f; - int near_f = 0; - - for (uint8 i = 0; i < 3 ; ++i) - { - GameObject* temp; - temp = me->FindNearestGameObject(entry_search[i],30); - if (temp) - { - if (me->IsWithinDist(temp,diff,false)) + switch(fm_Type) { - near_f = i + 1; - diff = me->GetDistance2d(temp); - + case 1: + pInstance->SetData(EVENT_FORGE_1,me->isAlive() ? NOT_STARTED : DONE); + break; + case 2: + pInstance->SetData(EVENT_FORGE_2,me->isAlive() ? NOT_STARTED : DONE); + break; + case 3: + pInstance->SetData(EVENT_FORGE_3,me->isAlive() ? NOT_STARTED : DONE); + break; } } } - switch (near_f) + void JustDied(Unit * /*killer*/) { - case 1: return 1; - case 2: return 2; - case 3: return 3; - default: return 0; + 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 UpdateAI(const uint32 /*diff*/) - { - if (fm_Type == 0) - fm_Type = GetForgeMasterType(); + 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; + } + } + me->SetUInt32Value(UNIT_NPC_EMOTESTATE ,EMOTE_ONESHOT_NONE); + } - if (!UpdateVictim()) - return; + uint8 GetForgeMasterType() + { + float diff = 30.0f; + int near_f = 0; + + for (uint8 i = 0; i < 3 ; ++i) + { + GameObject* temp; + temp = me->FindNearestGameObject(entry_search[i],30); + if (temp) + { + if (me->IsWithinDist(temp,diff,false)) + { + near_f = i + 1; + diff = me->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(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_dragonflayer_forge_master(Creature* pCreature) -{ - return new npc_dragonflayer_forge_masterAI(pCreature); -} void AddSC_utgarde_keep() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_dragonflayer_forge_master"; - newscript->GetAI = &GetAI_npc_dragonflayer_forge_master; - newscript->RegisterSelf(); + new npc_dragonflayer_forge_master(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index af20d156c15..94d6d46acaa 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -84,188 +84,195 @@ enum Phase PHASE_GORTOK_PALEHOOF, PHASE_NONE }; - -struct boss_palehoofAI : public ScriptedAI + class boss_palehoof : public CreatureScript { - boss_palehoofAI(Creature *c) : ScriptedAI(c) +public: + boss_palehoof() : CreatureScript("boss_palehoof") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_palehoofAI (pCreature); } - uint32 uiArcingSmashTimer; - uint32 uiImpaleTimer; - uint32 uiWhiteringRoarTimer; - uint32 uiWaitingTimer; - Phase currentPhase; - uint8 AddCount; - bool DoneAdds[4]; - - ScriptedInstance *pInstance; - - void Reset() + struct boss_palehoofAI : public ScriptedAI { - uiArcingSmashTimer = 15000; - uiImpaleTimer = 12000; - uiWhiteringRoarTimer = 10000; - - me->GetMotionMaster()->MoveTargetedHome(); - - for (uint32 i=0;i<4;i++) - DoneAdds[i]=false; - AddCount=0; - - currentPhase=PHASE_NONE; - - if (pInstance) + boss_palehoofAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); + } - Creature* pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + uint32 uiArcingSmashTimer; + uint32 uiImpaleTimer; + uint32 uiWhiteringRoarTimer; + uint32 uiWaitingTimer; + Phase currentPhase; + uint8 AddCount; + bool DoneAdds[4]; - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + InstanceScript *pInstance; - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + void Reset() + { + uiArcingSmashTimer = 15000; + uiImpaleTimer = 12000; + uiWhiteringRoarTimer = 10000; - pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG)); - if (pTemp && !pTemp->isAlive()) - pTemp->Respawn(); + me->GetMotionMaster()->MoveTargetedHome(); - GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); - if (pGo) + for (uint32 i=0;i<4;i++) + DoneAdds[i]=false; + AddCount=0; + + currentPhase=PHASE_NONE; + + if (pInstance) { - pGo->SetGoState(GO_STATE_READY); - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - } - } - } + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, NOT_STARTED); - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + Creature* pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - void AttackStart(Unit* who) - { - if (!who) - return; + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); - } - } + pTemp = Unit::GetCreature((*me), pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG)); + if (pTemp && !pTemp->isAlive()) + pTemp->Respawn(); - void UpdateAI(const uint32 diff) - { - if (currentPhase != PHASE_GORTOK_PALEHOOF) - return; - //Return since we have no target - if (!UpdateVictim()) - return; - - Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->DisappearAndDie(); - - if (uiArcingSmashTimer <= diff) - { - DoCast(me, SPELL_ARCING_SMASH); - uiArcingSmashTimer = urand(13000,17000); - } else uiArcingSmashTimer -= diff; - - if (uiImpaleTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_IMPALE); - uiImpaleTimer = urand(8000,12000); - } else uiImpaleTimer -= diff; - - if (uiWhiteringRoarTimer <= diff) - { - DoCast(me, SPELL_WITHERING_ROAR); - uiWhiteringRoarTimer = urand(8000,12000); - } else uiWhiteringRoarTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); - Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pTemp && pTemp->isAlive()) - pTemp->DisappearAndDie(); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void NextPhase() - { - if (currentPhase == PHASE_NONE) - { - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); - me->SummonCreature(MOB_STASIS_CONTROLLER,moveLocs[5].x,moveLocs[5].y,moveLocs[5].z,0,TEMPSUMMON_CORPSE_DESPAWN); - } - Phase move = PHASE_NONE; - if (AddCount >= DUNGEON_MODE(2,4)) - move = PHASE_GORTOK_PALEHOOF; - else - { - //select random not yet defeated add - uint8 next = urand(0,3); - for (uint8 i=0; i < 16; i++) - { - if (!DoneAdds[i%4] && next == 0) + GameObject* pGo = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_GORTOK_PALEHOOF_SPHERE)); + if (pGo) { - move = (Phase)(i%4); - break; - } else if (!DoneAdds[i%4] && next > 0) - --next; + pGo->SetGoState(GO_STATE_READY); + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + } } - ++AddCount; - DoneAdds[move] = true; - move = (Phase)(move%4); } - //send orb to summon spot - Creature *pOrb = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); - if (pOrb && pOrb->isAlive()) + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } + + void UpdateAI(const uint32 diff) + { + if (currentPhase != PHASE_GORTOK_PALEHOOF) + return; + //Return since we have no target + if (!UpdateVictim()) + return; + + Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->DisappearAndDie(); + + if (uiArcingSmashTimer <= diff) + { + DoCast(me, SPELL_ARCING_SMASH); + uiArcingSmashTimer = urand(13000,17000); + } else uiArcingSmashTimer -= diff; + + if (uiImpaleTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_IMPALE); + uiImpaleTimer = urand(8000,12000); + } else uiImpaleTimer -= diff; + + if (uiWhiteringRoarTimer <= diff) + { + DoCast(me, SPELL_WITHERING_ROAR); + uiWhiteringRoarTimer = urand(8000,12000); + } else uiWhiteringRoarTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, DONE); + Creature* pTemp = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pTemp && pTemp->isAlive()) + pTemp->DisappearAndDie(); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void NextPhase() { if (currentPhase == PHASE_NONE) - pOrb->CastSpell(me,SPELL_ORB_VISUAL,true); - pOrb->GetMotionMaster()->MovePoint(move,moveLocs[move].x,moveLocs[move].y,moveLocs[move].z); + { + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + me->SummonCreature(MOB_STASIS_CONTROLLER,moveLocs[5].x,moveLocs[5].y,moveLocs[5].z,0,TEMPSUMMON_CORPSE_DESPAWN); + } + Phase move = PHASE_NONE; + if (AddCount >= DUNGEON_MODE(2,4)) + move = PHASE_GORTOK_PALEHOOF; + else + { + //select random not yet defeated add + uint8 next = urand(0,3); + for (uint8 i=0; i < 16; i++) + { + if (!DoneAdds[i%4] && next == 0) + { + move = (Phase)(i%4); + break; + } else if (!DoneAdds[i%4] && next > 0) + --next; + } + ++AddCount; + DoneAdds[move] = true; + move = (Phase)(move%4); + } + //send orb to summon spot + Creature *pOrb = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_ORB) : 0); + if (pOrb && pOrb->isAlive()) + { + if (currentPhase == PHASE_NONE) + pOrb->CastSpell(me,SPELL_ORB_VISUAL,true); + pOrb->GetMotionMaster()->MovePoint(move,moveLocs[move].x,moveLocs[move].y,moveLocs[move].z); + } + currentPhase = move; } - currentPhase = move; - } - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } + void JustReachedHome() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); + } + }; + }; -CreatureAI* GetAI_boss_palehoof(Creature* pCreature) -{ - return new boss_palehoofAI (pCreature); -} //ravenous furbolg's spells enum RavenousSpells @@ -275,103 +282,110 @@ enum RavenousSpells SPELL_CRAZED = 48139, SPELL_TERRIFYING_ROAR = 48144 }; - -struct mob_ravenous_furbolgAI : public ScriptedAI + class mob_ravenous_furbolg : public CreatureScript { - mob_ravenous_furbolgAI(Creature *c) : ScriptedAI(c) +public: + mob_ravenous_furbolg() : CreatureScript("mob_ravenous_furbolg") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_ravenous_furbolgAI (pCreature); } - uint32 uiChainLightingTimer; - uint32 uiCrazedTimer; - uint32 uiTerrifyingRoarTimer; - - ScriptedInstance *pInstance; - - void Reset() + struct mob_ravenous_furbolgAI : public ScriptedAI { - uiChainLightingTimer = 5000; - uiCrazedTimer = 10000; - uiTerrifyingRoarTimer = 15000; + mob_ravenous_furbolgAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - me->GetMotionMaster()->MoveTargetedHome(); + uint32 uiChainLightingTimer; + uint32 uiCrazedTimer; + uint32 uiTerrifyingRoarTimer; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + InstanceScript *pInstance; + + void Reset() + { + uiChainLightingTimer = 5000; + uiCrazedTimer = 10000; + uiTerrifyingRoarTimer = 15000; + + me->GetMotionMaster()->MoveTargetedHome(); + + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiChainLightingTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTING); + uiChainLightingTimer = 5000 + rand()%5000; + } else uiChainLightingTimer -= diff; + + if (uiCrazedTimer <= diff) + { + DoCast(me, SPELL_CRAZED); + uiCrazedTimer = 8000 + rand()%4000; + } else uiCrazedTimer -= diff; + + if (uiTerrifyingRoarTimer <= diff) + { + DoCast(me, SPELL_TERRIFYING_ROAR); + uiTerrifyingRoarTimer = 10000 + rand()%10000; + } else uiTerrifyingRoarTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) { Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiChainLightingTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTING); - uiChainLightingTimer = 5000 + rand()%5000; - } else uiChainLightingTimer -= diff; - - if (uiCrazedTimer <= diff) - { - DoCast(me, SPELL_CRAZED); - uiCrazedTimer = 8000 + rand()%4000; - } else uiCrazedTimer -= diff; - - if (uiTerrifyingRoarTimer <= diff) - { - DoCast(me, SPELL_TERRIFYING_ROAR); - uiTerrifyingRoarTimer = 10000 + rand()%10000; - } else uiTerrifyingRoarTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void AttackStart(Unit* who) - { - if (!who) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_ravenous_furbolg(Creature* pCreature) -{ - return new mob_ravenous_furbolgAI (pCreature); -} //frenzied worgen's spells enum FrenziedSpells @@ -381,105 +395,112 @@ enum FrenziedSpells SPELL_ENRAGE_1 = 48138, SPELL_ENRAGE_2 = 48142 }; - -struct mob_frenzied_worgenAI : public ScriptedAI + class mob_frenzied_worgen : public CreatureScript { - mob_frenzied_worgenAI(Creature *c) : ScriptedAI(c) +public: + mob_frenzied_worgen() : CreatureScript("mob_frenzied_worgen") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_frenzied_worgenAI (pCreature); } - uint32 uiMortalWoundTimer; - uint32 uiEnrage1Timer; - uint32 uiEnrage2Timer; - - ScriptedInstance *pInstance; - - void Reset() + struct mob_frenzied_worgenAI : public ScriptedAI { - uiMortalWoundTimer = 5000; - uiEnrage1Timer = 15000; - uiEnrage2Timer = 10000; - - me->GetMotionMaster()->MoveTargetedHome(); - - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) - { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); - } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiMortalWoundTimer <= diff) + mob_frenzied_worgenAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - uiMortalWoundTimer = 3000 + rand()%4000; - } else uiMortalWoundTimer -= diff; + pInstance = c->GetInstanceScript(); + } - if (uiEnrage1Timer <= diff) + uint32 uiMortalWoundTimer; + uint32 uiEnrage1Timer; + uint32 uiEnrage2Timer; + + InstanceScript *pInstance; + + void Reset() { - DoCast(me, SPELL_ENRAGE_1); + uiMortalWoundTimer = 5000; uiEnrage1Timer = 15000; - } else uiEnrage1Timer -= diff; - - if (uiEnrage2Timer <= diff) - { - DoCast(me, SPELL_ENRAGE_2); uiEnrage2Timer = 10000; - } else uiEnrage2Timer -= diff; - DoMeleeAttackIfReady(); - } + me->GetMotionMaster()->MoveTargetedHome(); - void AttackStart(Unit* who) - { - if (!who) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } } - if (pInstance) - pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void UpdateAI(const uint32 diff) { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance->GetData64(DATA_GORTOK_PALEHOOF)); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); - } - } + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiMortalWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + uiMortalWoundTimer = 3000 + rand()%4000; + } else uiMortalWoundTimer -= diff; + + if (uiEnrage1Timer <= diff) + { + DoCast(me, SPELL_ENRAGE_1); + uiEnrage1Timer = 15000; + } else uiEnrage1Timer -= diff; + + if (uiEnrage2Timer <= diff) + { + DoCast(me, SPELL_ENRAGE_2); + uiEnrage2Timer = 10000; + } else uiEnrage2Timer -= diff; + + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + if (pInstance) + pInstance->SetData(DATA_GORTOK_PALEHOOF_EVENT, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance->GetData64(DATA_GORTOK_PALEHOOF)); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } + } + + void JustReachedHome() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); + } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_frenzied_worgen(Creature* pCreature) -{ - return new mob_frenzied_worgenAI (pCreature); -} //ferocious rhino's spells enum FerociousSpells @@ -490,104 +511,111 @@ enum FerociousSpells H_SPELL_GRIEVOUS_WOUND = 59263, SPELL_STOMP = 48131 }; - -struct mob_ferocious_rhinoAI : public ScriptedAI + class mob_ferocious_rhino : public CreatureScript { - mob_ferocious_rhinoAI(Creature *c) : ScriptedAI(c) +public: + mob_ferocious_rhino() : CreatureScript("mob_ferocious_rhino") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_ferocious_rhinoAI (pCreature); } - uint32 uiStompTimer; - uint32 uiGoreTimer; - uint32 uiGrievousWoundTimer; - - ScriptedInstance *pInstance; - - void Reset() + struct mob_ferocious_rhinoAI : public ScriptedAI { - uiStompTimer = 10000; - uiGoreTimer = 15000; - uiGrievousWoundTimer = 20000; + mob_ferocious_rhinoAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - me->GetMotionMaster()->MoveTargetedHome(); + uint32 uiStompTimer; + uint32 uiGoreTimer; + uint32 uiGrievousWoundTimer; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + InstanceScript *pInstance; + + void Reset() + { + uiStompTimer = 10000; + uiGoreTimer = 15000; + uiGrievousWoundTimer = 20000; + + me->GetMotionMaster()->MoveTargetedHome(); + + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiStompTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STOMP); + uiStompTimer = 8000 + rand()%4000; + } else uiStompTimer -= diff; + + if (uiGoreTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GORE); + uiGoreTimer = 13000 + rand()%4000; + } else uiGoreTimer -= diff; + + if (uiGrievousWoundTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_GRIEVOUS_WOUND); + uiGrievousWoundTimer = 18000 + rand()%4000; + } else uiGrievousWoundTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) { Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiStompTimer <= diff) - { - DoCast(me->getVictim(), SPELL_STOMP); - uiStompTimer = 8000 + rand()%4000; - } else uiStompTimer -= diff; - - if (uiGoreTimer <= diff) - { - DoCast(me->getVictim(), SPELL_GORE); - uiGoreTimer = 13000 + rand()%4000; - } else uiGoreTimer -= diff; - - if (uiGrievousWoundTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_GRIEVOUS_WOUND); - uiGrievousWoundTimer = 18000 + rand()%4000; - } else uiGrievousWoundTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void AttackStart(Unit* who) - { - if (!who) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; -CreatureAI* GetAI_mob_ferocious_rhino(Creature* pCreature) -{ - return new mob_ferocious_rhinoAI (pCreature); -} //massive jormungar's spells enum MassiveSpells @@ -603,245 +631,227 @@ enum MassiveAdds { CREATURE_JORMUNGAR_WORM = 27228 }; - -struct mob_massive_jormungarAI : public ScriptedAI + class mob_massive_jormungar : public CreatureScript { - mob_massive_jormungarAI(Creature *c) : ScriptedAI(c) +public: + mob_massive_jormungar() : CreatureScript("mob_massive_jormungar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_massive_jormungarAI (pCreature); } - uint32 uiAcidSpitTimer; - uint32 uiAcidSplatterTimer; - uint32 uiPoisonBreathTimer; - - ScriptedInstance *pInstance; - - void Reset() + struct mob_massive_jormungarAI : public ScriptedAI { - uiAcidSpitTimer = 3000; - uiAcidSplatterTimer = 12000; - uiPoisonBreathTimer = 10000; + mob_massive_jormungarAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - me->GetMotionMaster()->MoveTargetedHome(); + uint32 uiAcidSpitTimer; + uint32 uiAcidSplatterTimer; + uint32 uiPoisonBreathTimer; - if (pInstance) - if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + InstanceScript *pInstance; + + void Reset() + { + uiAcidSpitTimer = 3000; + uiAcidSplatterTimer = 12000; + uiPoisonBreathTimer = 10000; + + me->GetMotionMaster()->MoveTargetedHome(); + + if (pInstance) + if (pInstance->GetData(DATA_GORTOK_PALEHOOF_EVENT) == IN_PROGRESS) + { + Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->Reset(); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiAcidSpitTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_ACID_SPIT); + uiAcidSpitTimer = 2000 + rand()%2000; + } else uiAcidSpitTimer -= diff; + + if (uiAcidSplatterTimer <= diff) + { + DoCast(me, SPELL_POISON_BREATH); + uiAcidSplatterTimer = 10000 + rand()%4000; + } else uiAcidSplatterTimer -= diff; + + if (uiPoisonBreathTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_POISON_BREATH); + uiPoisonBreathTimer = 8000 + rand()%4000; + } else uiPoisonBreathTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void AttackStart(Unit* who) + { + if (!who) + return; + + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(who, true)) + { + me->AddThreat(who, 0.0f); + me->SetInCombatWith(who); + who->SetInCombatWith(me); + DoStartMovement(who); + } + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) { Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) - CAST_AI(boss_palehoofAI, pPalehoof->AI())->Reset(); + if (pPalehoof) + CAST_AI(boss_palehoof::boss_palehoofAI,pPalehoof->AI())->NextPhase(); } - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiAcidSpitTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_ACID_SPIT); - uiAcidSpitTimer = 2000 + rand()%2000; - } else uiAcidSpitTimer -= diff; - - if (uiAcidSplatterTimer <= diff) - { - DoCast(me, SPELL_POISON_BREATH); - uiAcidSplatterTimer = 10000 + rand()%4000; - } else uiAcidSplatterTimer -= diff; - - if (uiPoisonBreathTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_POISON_BREATH); - uiPoisonBreathTimer = 8000 + rand()%4000; - } else uiPoisonBreathTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void AttackStart(Unit* who) - { - if (!who) - return; - - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(who, true)) - { - me->AddThreat(who, 0.0f); - me->SetInCombatWith(who); - who->SetInCombatWith(me); - DoStartMovement(who); } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustReachedHome() { - Creature *pPalehoof = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof) - CAST_AI(boss_palehoofAI,pPalehoof->AI())->NextPhase(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoCast(me, SPELL_FREEZE); } - } + }; - void JustReachedHome() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_FREEZE); - } }; - -CreatureAI* GetAI_mob_massive_jormungar(Creature* pCreature) + class mob_palehoof_orb : public CreatureScript { - return new mob_massive_jormungarAI (pCreature); -} +public: + mob_palehoof_orb() : CreatureScript("mob_palehoof_orb") { } - -struct mob_palehoof_orbAI : public ScriptedAI -{ - mob_palehoof_orbAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_palehoof_orbAI (pCreature); } - ScriptedInstance *pInstance; - uint32 SummonTimer; - Phase currentPhase; - - void Reset() + struct mob_palehoof_orbAI : public ScriptedAI { - currentPhase=PHASE_NONE; - SummonTimer=5000; - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->RemoveAurasDueToSpell(SPELL_ORB_VISUAL); - me->SetSpeed(MOVE_FLIGHT , 0.5f); - } - - void UpdateAI(const uint32 diff) - { - if (currentPhase == PHASE_NONE) - return; - - if (SummonTimer <= diff) + mob_palehoof_orbAI(Creature *c) : ScriptedAI(c) { - if (currentPhase<5&¤tPhase >= 0) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + uint32 SummonTimer; + Phase currentPhase; + + void Reset() + { + currentPhase=PHASE_NONE; + SummonTimer=5000; + me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); + me->RemoveAurasDueToSpell(SPELL_ORB_VISUAL); + me->SetSpeed(MOVE_FLIGHT , 0.5f); + } + + void UpdateAI(const uint32 diff) + { + if (currentPhase == PHASE_NONE) + return; + + if (SummonTimer <= diff) { - Creature *pNext = NULL; - switch(currentPhase) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; - } + if (currentPhase<5&¤tPhase >= 0) + { + Creature *pNext = NULL; + switch(currentPhase) + { + case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; + case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; + case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; + case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; + case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; + } - if (pNext) - { - pNext->RemoveAurasDueToSpell(SPELL_FREEZE); - pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); - pNext->SetStandState(UNIT_STAND_STATE_STAND); - pNext->SetInCombatWithZone(); - pNext->Attack(pNext->SelectNearestTarget(100),true); + if (pNext) + { + pNext->RemoveAurasDueToSpell(SPELL_FREEZE); + pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + pNext->SetStandState(UNIT_STAND_STATE_STAND); + pNext->SetInCombatWithZone(); + pNext->Attack(pNext->SelectNearestTarget(100),true); - } - currentPhase=PHASE_NONE; - } - } else SummonTimer-=diff; - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - if (id<0 || id>4) - return; - Creature *pNext = NULL; - switch(id) - { - case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; - case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; - case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; - case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; - case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; + } + currentPhase=PHASE_NONE; + } + } else SummonTimer-=diff; } - if (pNext) - DoCast(pNext, SPELL_ORB_CHANNEL, false); - currentPhase=(Phase)id; - SummonTimer=5000; - } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + if (id<0 || id>4) + return; + Creature *pNext = NULL; + switch(id) + { + case PHASE_FRENZIED_WORGEN: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FRENZIED_WORGEN) : 0); break; + case PHASE_RAVENOUS_FURLBORG: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_RAVENOUS_FURBOLG) : 0); break; + case PHASE_MASSIVE_JORMUNGAR: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_MASSIVE_JORMUNGAR) : 0); break; + case PHASE_FEROCIOUS_RHINO: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_MOB_FEROCIOUS_RHINO) : 0); break; + case PHASE_GORTOK_PALEHOOF: pNext = Unit::GetCreature((*me), pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); break; + } + if (pNext) + DoCast(pNext, SPELL_ORB_CHANNEL, false); + currentPhase=(Phase)id; + SummonTimer=5000; + } + }; + }; - -CreatureAI* GetAI_mob_palehoof_orb(Creature* pCreature) + class go_palehoof_sphere : public GameObjectScript { - return new mob_palehoof_orbAI (pCreature); -} +public: + go_palehoof_sphere() : GameObjectScript("go_palehoof_sphere") { } - - -bool GOHello_palehoof_sphere(Player * /*pPlayer*/, GameObject *pGO) -{ - ScriptedInstance *pInstance = pGO->GetInstanceData(); - - Creature *pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); - if (pPalehoof && pPalehoof->isAlive()) + bool OnGossipHello(Player * /*pPlayer*/, GameObject *pGO) { - // maybe these are hacks :( - pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGO->SetGoState(GO_STATE_ACTIVE); + InstanceScript *pInstance = pGO->GetInstanceScript(); - CAST_AI(boss_palehoofAI, pPalehoof->AI())->NextPhase(); + Creature *pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); + if (pPalehoof && pPalehoof->isAlive()) + { + // maybe these are hacks :( + pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGO->SetGoState(GO_STATE_ACTIVE); + + CAST_AI(boss_palehoof::boss_palehoofAI, pPalehoof->AI())->NextPhase(); + } + return true; } - return true; -} - +}; void AddSC_boss_palehoof() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_palehoof"; - newscript->GetAI = &GetAI_boss_palehoof; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ravenous_furbolg"; - newscript->GetAI = &GetAI_mob_ravenous_furbolg; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frenzied_worgen"; - newscript->GetAI = &GetAI_mob_frenzied_worgen; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ferocious_rhino"; - newscript->GetAI = &GetAI_mob_ferocious_rhino; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_massive_jormungar"; - newscript->GetAI = &GetAI_mob_massive_jormungar; - newscript->RegisterSelf(); - - - newscript = new Script; - newscript->Name = "mob_palehoof_orb"; - newscript->GetAI = &GetAI_mob_palehoof_orb; - newscript->RegisterSelf(); - - - newscript = new Script; - newscript->Name = "go_palehoof_sphere"; - newscript->pGOHello=&GOHello_palehoof_sphere; - newscript->RegisterSelf(); + new boss_palehoof(); + new mob_ravenous_furbolg(); + new mob_frenzied_worgen(); + new mob_ferocious_rhino(); + new mob_massive_jormungar(); + new mob_palehoof_orb(); + new go_palehoof_sphere(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index cd85de0dfcd..368b769885f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -155,323 +155,327 @@ enum eAchievments { ACHIEV_TIMED_START_EVENT = 17726, }; - -struct boss_skadiAI : public ScriptedAI + class boss_skadi : public CreatureScript { - boss_skadiAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + boss_skadi() : CreatureScript("boss_skadi") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = c->GetInstanceData(); + return new boss_skadiAI (pCreature); } - ScriptedInstance* m_pInstance; - SummonList Summons; - uint64 m_uiGraufGUID; - std::vector triggersGUID; - - uint32 m_uiCrushTimer; - uint32 m_uiPoisonedSpearTimer; - uint32 m_uiWhirlwindTimer; - uint32 m_uiWaypointId; - uint32 m_uiMovementTimer; - uint32 m_uiMountTimer; - uint32 m_uiSummonTimer; - uint8 m_uiSpellHitCount; - bool m_bSaidEmote; - - eCombatPhase Phase; - - void Reset() + struct boss_skadiAI : public ScriptedAI { - triggersGUID.clear(); - - m_uiCrushTimer = 8000; - m_uiPoisonedSpearTimer = 10000; - m_uiWhirlwindTimer = 20000; - m_uiMountTimer = 3000; - m_uiWaypointId = 0; - m_bSaidEmote = false; - m_uiSpellHitCount = 0; - - Phase = SKADI; - - Summons.DespawnAll(); - me->SetSpeed(MOVE_FLIGHT, 3.0f); - if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) - me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); - if (m_pInstance) + boss_skadiAI(Creature *c) : ScriptedAI(c), Summons(me) { - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + m_pInstance = c->GetInstanceScript(); } - } - void JustReachedHome() - { - me->SetFlying(false); - me->Unmount(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) - me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); - } + InstanceScript* m_pInstance; + SummonList Summons; + uint64 m_uiGraufGUID; + std::vector triggersGUID; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); + uint32 m_uiCrushTimer; + uint32 m_uiPoisonedSpearTimer; + uint32 m_uiWhirlwindTimer; + uint32 m_uiWaypointId; + uint32 m_uiMovementTimer; + uint32 m_uiMountTimer; + uint32 m_uiSummonTimer; + uint8 m_uiSpellHitCount; + bool m_bSaidEmote; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + eCombatPhase Phase; - Phase = FLYING; - - m_uiMovementTimer = 1000; - m_uiSummonTimer = 10000; - me->SetInCombatWithZone(); - if (m_pInstance) + void Reset() { - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - m_uiMountTimer = 1000; - Summons.DespawnEntry(CREATURE_GRAUF); - } - } + triggersGUID.clear(); - void JustSummoned(Creature* pSummoned) - { - switch (pSummoned->GetEntry()) - { - case CREATURE_GRAUF: - m_uiGraufGUID = pSummoned->GetGUID(); - break; - case CREATURE_YMIRJAR_WARRIOR: - case CREATURE_YMIRJAR_WITCH_DOCTOR: - case CREATURE_YMIRJAR_HARPOONER: - pSummoned->setActive(true); - pSummoned->SetInCombatWithZone(); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - pSummoned->AI()->AttackStart(pTarget); - break; - case CREATURE_TRIGGER: - pSummoned->CastSpell((Unit*)NULL, SPELL_FREEZING_CLOUD, true); - pSummoned->ForcedDespawn(10*IN_MILLISECONDS); - break; - } - Summons.Summon(pSummoned); - } + m_uiCrushTimer = 8000; + m_uiPoisonedSpearTimer = 10000; + m_uiWhirlwindTimer = 20000; + m_uiMountTimer = 3000; + m_uiWaypointId = 0; + m_bSaidEmote = false; + m_uiSpellHitCount = 0; - void SummonedCreatureDespawn(Creature* pSummoned) - { - if (pSummoned->GetEntry() == CREATURE_GRAUF) - m_uiGraufGUID = 0; - Summons.Despawn(pSummoned); - } + Phase = SKADI; - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_HARPOON_DAMAGE) - { - m_uiSpellHitCount++; - if (m_uiSpellHitCount >= 5) + Summons.DespawnAll(); + me->SetSpeed(MOVE_FLIGHT, 3.0f); + if ((Unit::GetCreature((*me), m_uiGraufGUID) == NULL) && !me->IsMounted()) + me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); + if (m_pInstance) { - Phase = SKADI; - me->SetFlying(false); - me->Unmount(); - if(Creature* pGrauf = me->SummonCreature(CREATURE_GRAUF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS)) - { - pGrauf->GetMotionMaster()->MoveFall(0); - pGrauf->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - } - sLog.outBasic("[Skadi] Fly off"); - me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_DRAKE_DEATH, me); - m_uiCrushTimer = 8000; - m_uiPoisonedSpearTimer = 10000; - m_uiWhirlwindTimer = 20000; - me->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, NOT_STARTED); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } } - } - - void UpdateAI(const uint32 diff) - { - switch(Phase) + void JustReachedHome() { - case FLYING: - if (!UpdateVictim()) - return; - - if (me->GetPositionX() >= 519) + me->SetFlying(false); + me->Unmount(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + if (Unit::GetCreature((*me), m_uiGraufGUID) == NULL) + me->SummonCreature(CREATURE_GRAUF,Location[0].GetPositionX(),Location[0].GetPositionY(),Location[0].GetPositionZ(),3.0f); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + + Phase = FLYING; + + m_uiMovementTimer = 1000; + m_uiSummonTimer = 10000; + me->SetInCombatWithZone(); + if (m_pInstance) + { + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + m_uiMountTimer = 1000; + Summons.DespawnEntry(CREATURE_GRAUF); + } + } + + void JustSummoned(Creature* pSummoned) + { + switch (pSummoned->GetEntry()) + { + case CREATURE_GRAUF: + m_uiGraufGUID = pSummoned->GetGUID(); + break; + case CREATURE_YMIRJAR_WARRIOR: + case CREATURE_YMIRJAR_WITCH_DOCTOR: + case CREATURE_YMIRJAR_HARPOONER: + pSummoned->setActive(true); + pSummoned->SetInCombatWithZone(); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + pSummoned->AI()->AttackStart(pTarget); + break; + case CREATURE_TRIGGER: + pSummoned->CastSpell((Unit*)NULL, SPELL_FREEZING_CLOUD, true); + pSummoned->ForcedDespawn(10*IN_MILLISECONDS); + break; + } + Summons.Summon(pSummoned); + } + + void SummonedCreatureDespawn(Creature* pSummoned) + { + if (pSummoned->GetEntry() == CREATURE_GRAUF) + m_uiGraufGUID = 0; + Summons.Despawn(pSummoned); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_HARPOON_DAMAGE) + { + m_uiSpellHitCount++; + if (m_uiSpellHitCount >= 5) { + Phase = SKADI; + me->SetFlying(false); + me->Unmount(); + if(Creature* pGrauf = me->SummonCreature(CREATURE_GRAUF, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS)) + { + pGrauf->GetMotionMaster()->MoveFall(0); + pGrauf->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + } + sLog.outBasic("[Skadi] Fly off"); + me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - if (!m_bSaidEmote) - { - DoScriptText(EMOTE_RANGE, me); - m_bSaidEmote = true; - } - } - else - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - m_bSaidEmote = false; - } - - if (m_uiMountTimer && m_uiMountTimer <= diff) - { - me->Mount(DATA_MOUNT); - me->SetFlying(true); - m_uiMountTimer = 0; - } else m_uiMountTimer -= diff; - - if (m_uiSummonTimer <= diff) - { - SpawnMobs(); - m_uiSummonTimer = 25000; - } else m_uiSummonTimer -= diff; - - if (m_uiMovementTimer <= diff) - { - switch(m_uiWaypointId) - { - case 0: - me->GetMotionMaster()->MovePoint(0, Location[1].GetPositionX(), Location[1].GetPositionY(), Location[1].GetPositionZ()); - m_uiMovementTimer = 5000; - break; - case 1: - me->GetMotionMaster()->MovePoint(0, Location[2].GetPositionX(), Location[2].GetPositionY(), Location[2].GetPositionZ()); - m_uiMovementTimer = 2000; - break; - case 2: - me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); - m_uiMovementTimer = 15000; - break; - case 3: - me->GetMotionMaster()->MovePoint(0, Location[69].GetPositionX(), Location[69].GetPositionY(), Location[69].GetPositionZ()); - DoScriptText(RAND(SAY_DRAKE_BREATH_1,SAY_DRAKE_BREATH_2), me); - DoScriptText(EMOTE_BREATH, me); - m_uiMovementTimer = 2500; - break; - case 4: - me->GetMotionMaster()->MovePoint(0, Location[70].GetPositionX(), Location[70].GetPositionY(), Location[70].GetPositionZ()); - m_uiMovementTimer = 2000; - SpawnTrigger(); - break; - case 5: - me->GetMotionMaster()->MovePoint(0, Location[71].GetPositionX(), Location[71].GetPositionY(), Location[71].GetPositionZ()); - m_uiMovementTimer = 3000; - break; - case 6: - me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); - m_uiWaypointId = 2; - m_uiMovementTimer = 15000; - break; - } - m_uiWaypointId++; - } else m_uiMovementTimer -= diff; - break; - case SKADI: - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_uiCrushTimer <= diff) - { - DoCastVictim(SPELL_CRUSH); + DoScriptText(SAY_DRAKE_DEATH, me); m_uiCrushTimer = 8000; - } else m_uiCrushTimer -= diff; - - if (m_uiPoisonedSpearTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pTarget, SPELL_POISONED_SPEAR); m_uiPoisonedSpearTimer = 10000; - } else m_uiPoisonedSpearTimer -= diff; - - if (m_uiWhirlwindTimer <= diff) - { - DoCastAOE(SPELL_WHIRLWIND); m_uiWhirlwindTimer = 20000; - } else m_uiWhirlwindTimer -= diff; - - DoMeleeAttackIfReady(); - break; - } - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - Summons.DespawnAll(); - if (m_pInstance) - m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } - - void SpawnMobs() - { - for (uint8 i = 0; i < DUNGEON_MODE(5,6); ++i) - { - switch (urand(0,2)) - { - case 0: me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 1: me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; - case 2: me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + me->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM)); + } } } + + + void UpdateAI(const uint32 diff) + { + switch(Phase) + { + case FLYING: + if (!UpdateVictim()) + return; + + if (me->GetPositionX() >= 519) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + if (!m_bSaidEmote) + { + DoScriptText(EMOTE_RANGE, me); + m_bSaidEmote = true; + } + } + else + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + m_bSaidEmote = false; + } + + if (m_uiMountTimer && m_uiMountTimer <= diff) + { + me->Mount(DATA_MOUNT); + me->SetFlying(true); + m_uiMountTimer = 0; + } else m_uiMountTimer -= diff; + + if (m_uiSummonTimer <= diff) + { + SpawnMobs(); + m_uiSummonTimer = 25000; + } else m_uiSummonTimer -= diff; + + if (m_uiMovementTimer <= diff) + { + switch(m_uiWaypointId) + { + case 0: + me->GetMotionMaster()->MovePoint(0, Location[1].GetPositionX(), Location[1].GetPositionY(), Location[1].GetPositionZ()); + m_uiMovementTimer = 5000; + break; + case 1: + me->GetMotionMaster()->MovePoint(0, Location[2].GetPositionX(), Location[2].GetPositionY(), Location[2].GetPositionZ()); + m_uiMovementTimer = 2000; + break; + case 2: + me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); + m_uiMovementTimer = 15000; + break; + case 3: + me->GetMotionMaster()->MovePoint(0, Location[69].GetPositionX(), Location[69].GetPositionY(), Location[69].GetPositionZ()); + DoScriptText(RAND(SAY_DRAKE_BREATH_1,SAY_DRAKE_BREATH_2), me); + DoScriptText(EMOTE_BREATH, me); + m_uiMovementTimer = 2500; + break; + case 4: + me->GetMotionMaster()->MovePoint(0, Location[70].GetPositionX(), Location[70].GetPositionY(), Location[70].GetPositionZ()); + m_uiMovementTimer = 2000; + SpawnTrigger(); + break; + case 5: + me->GetMotionMaster()->MovePoint(0, Location[71].GetPositionX(), Location[71].GetPositionY(), Location[71].GetPositionZ()); + m_uiMovementTimer = 3000; + break; + case 6: + me->GetMotionMaster()->MovePoint(0, Location[3].GetPositionX(), Location[3].GetPositionY(), Location[3].GetPositionZ()); + m_uiWaypointId = 2; + m_uiMovementTimer = 15000; + break; + } + m_uiWaypointId++; + } else m_uiMovementTimer -= diff; + break; + case SKADI: + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_uiCrushTimer <= diff) + { + DoCastVictim(SPELL_CRUSH); + m_uiCrushTimer = 8000; + } else m_uiCrushTimer -= diff; + + if (m_uiPoisonedSpearTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(pTarget, SPELL_POISONED_SPEAR); + m_uiPoisonedSpearTimer = 10000; + } else m_uiPoisonedSpearTimer -= diff; + + if (m_uiWhirlwindTimer <= diff) + { + DoCastAOE(SPELL_WHIRLWIND); + m_uiWhirlwindTimer = 20000; + } else m_uiWhirlwindTimer -= diff; + + DoMeleeAttackIfReady(); + break; + } + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + Summons.DespawnAll(); + if (m_pInstance) + m_pInstance->SetData(DATA_SKADI_THE_RUTHLESS_EVENT, DONE); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } + + void SpawnMobs() + { + for (uint8 i = 0; i < DUNGEON_MODE(5,6); ++i) + { + switch (urand(0,2)) + { + case 0: me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + case 1: me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + case 2: me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; + } + } + } + + void SpawnTrigger() + { + uint8 iStart,iEnd; + switch (urand(0,1)) + { + case 0: + iStart = 8; + iEnd = 37; + break; + case 1: + iStart = 38; + iEnd = 68; + break; + } + for(uint32 i = iStart; i < iEnd; ++i) + me->SummonCreature(CREATURE_TRIGGER,Location[i]); + } + }; + +}; + class go_harpoon_launcher : public GameObjectScript +{ +public: + go_harpoon_launcher() : GameObjectScript("go_harpoon_launcher") { } + + bool OnGossipHello(Player *pPlayer, GameObject *pGO) + { + InstanceScript* m_pInstance = pGO->GetInstanceScript(); + if (!m_pInstance) return false; + + if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS))) + { + pPlayer->CastSpell(pSkadi,SPELL_RAPID_FIRE, true); + } + return false; } - void SpawnTrigger() - { - uint8 iStart,iEnd; - switch (urand(0,1)) - { - case 0: - iStart = 8; - iEnd = 37; - break; - case 1: - iStart = 38; - iEnd = 68; - break; - } - for(uint32 i = iStart; i < iEnd; ++i) - me->SummonCreature(CREATURE_TRIGGER,Location[i]); - } }; -bool GOHello_go_harpoon_launcher(Player *pPlayer, GameObject *pGO) -{ - ScriptedInstance* m_pInstance = pGO->GetInstanceData(); - if (!m_pInstance) return false; - - if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS))) - { - pPlayer->CastSpell(pSkadi,SPELL_RAPID_FIRE, true); - } - return false; -} - -CreatureAI* GetAI_boss_skadi(Creature* pCreature) -{ - return new boss_skadiAI (pCreature); -} void AddSC_boss_skadi() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_skadi"; - newscript->GetAI = &GetAI_boss_skadi; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_harpoon_launcher"; - newscript->pGOHello = &GOHello_go_harpoon_launcher; - newscript->RegisterSelf(); + new boss_skadi(); + new go_harpoon_launcher(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 2a785d70f39..b2784007319 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -83,327 +83,335 @@ static Position RitualChannelerPos[]= }; static Position ArthasPos = { 295.81, -366.16, 92.57, 1.58 }; static Position SvalaPos = { 296.632, -346.075, 90.6307, 1.58 }; - -struct boss_svalaAI : public ScriptedAI + class boss_svala : public CreatureScript { - boss_svalaAI(Creature *c) : ScriptedAI(c) +public: + boss_svala() : CreatureScript("boss_svala") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_svalaAI (pCreature); } - uint32 uiIntroTimer; - - uint8 uiIntroPhase; - - IntroPhase Phase; - - TempSummon* pArthas; - uint64 uiArthasGUID; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_svalaAI : public ScriptedAI { - Phase = IDLE; - uiIntroTimer = 1*IN_MILLISECONDS; - uiIntroPhase = 0; - uiArthasGUID = 0; - - if (pInstance) - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); - } - - void MoveInLineOfSight(Unit* pWho) - { - if (!pWho) - return; - - if (Phase == IDLE && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && me->IsWithinDistInMap(pWho, 40)) + boss_svalaAI(Creature *c) : ScriptedAI(c) { - Phase = INTRO; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - if (Creature *pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) - { - pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5); - uiArthasGUID = pArthas->GetGUID(); - } + pInstance = c->GetInstanceScript(); } - } - void AttackStart(Unit* /*who*/) {} + uint32 uiIntroTimer; - void UpdateAI(const uint32 diff) - { - if (Phase != INTRO) - return; + uint8 uiIntroPhase; - if (uiIntroTimer <= diff) + IntroPhase Phase; + + TempSummon* pArthas; + uint64 uiArthasGUID; + + InstanceScript* pInstance; + + void Reset() { - Creature *pArthas = Unit::GetCreature(*me, uiArthasGUID); - if (!pArthas) + Phase = IDLE; + uiIntroTimer = 1*IN_MILLISECONDS; + uiIntroPhase = 0; + uiArthasGUID = 0; + + if (pInstance) + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); + } + + void MoveInLineOfSight(Unit* pWho) + { + if (!pWho) return; - switch (uiIntroPhase) + if (Phase == IDLE && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && me->IsWithinDistInMap(pWho, 40)) { - case 0: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_1, me); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 1: - DoScriptText(SAY_DIALOG_OF_ARTHAS_1, pArthas); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 2: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_2, me); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 3: - DoScriptText(SAY_DIALOG_OF_ARTHAS_2, pArthas); - ++uiIntroPhase; - uiIntroTimer = 3.5*IN_MILLISECONDS; - break; - case 4: - DoScriptText(SAY_DIALOG_WITH_ARTHAS_3, me); - DoCast(me, SPELL_SVALA_TRANSFORMING1); - ++uiIntroPhase; - uiIntroTimer = 2.8*IN_MILLISECONDS; - break; - case 5: - DoCast(me, SPELL_SVALA_TRANSFORMING2); - ++uiIntroPhase; - uiIntroTimer = 200; - break; - case 6: - if (Creature* pSvalaSorrowgrave = me->SummonCreature(CREATURE_SVALA_SORROWGRAVE, SvalaPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60*IN_MILLISECONDS)) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(DATA_SVALA_DISPLAY_ID); - pArthas->ToTempSummon()->UnSummon(); - uiArthasGUID = 0; - Phase = FINISHED; - } - else - Reset(); - break; - } - } else uiIntroTimer -= diff; - } -}; + Phase = INTRO; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); -struct mob_ritual_channelerAI : public Scripted_NoMovementAI -{ - mob_ritual_channelerAI(Creature *c) :Scripted_NoMovementAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - void Reset() - { - DoCast(me, SPELL_SHADOWS_IN_THE_DARK); - } - - // called by svala sorrowgrave to set guid of victim - void DoAction(uint32 /*action*/) - { - if (pInstance) - if (Unit *pVictim = me->GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER))) - DoCast(pVictim, SPELL_PARALYZE); - } - - void EnterCombat(Unit* /*who*/) - { - } -}; - -struct boss_svala_sorrowgraveAI : public ScriptedAI -{ - boss_svala_sorrowgraveAI(Creature *c) : ScriptedAI(c), summons(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiSinsterStrikeTimer; - uint32 uiCallFlamesTimer; - uint32 uiRitualOfSwordTimer; - uint32 uiSacrificeTimer; - - CombatPhase Phase; - - SummonList summons; - - bool bSacrificed; - - ScriptedInstance* pInstance; - - void Reset() - { - uiSinsterStrikeTimer = 7*IN_MILLISECONDS; - uiCallFlamesTimer = 10*IN_MILLISECONDS; - uiRitualOfSwordTimer = 20*IN_MILLISECONDS; - uiSacrificeTimer = 8*IN_MILLISECONDS; - - bSacrificed = false; - - Phase = NORMAL; - - DoTeleportTo(296.632, -346.075, 90.6307); - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - - summons.DespawnAll(); - - if (pInstance) - { - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); - pInstance->SetData64(DATA_SACRIFICED_PLAYER,0); - } - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); - } - - void JustSummoned(Creature *summon) - { - summons.Summon(summon); - } - - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } - - void UpdateAI(const uint32 diff) - { - if (Phase == NORMAL) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiSinsterStrikeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); - uiSinsterStrikeTimer = urand(5*IN_MILLISECONDS,9*IN_MILLISECONDS); - } else uiSinsterStrikeTimer -= diff; - - if (uiCallFlamesTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + if (Creature *pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) { - DoCast(pTarget, SPELL_CALL_FLAMES); - uiCallFlamesTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); + pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5); + uiArthasGUID = pArthas->GetGUID(); } - } else uiCallFlamesTimer -= diff; - - if (!bSacrificed) - if (uiRitualOfSwordTimer <= diff) - { - if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),me); - DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); - //Spell doesn't teleport - DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6); - me->SetUnitMovementFlags(MOVEMENTFLAG_CAN_FLY); - DoTeleportTo(296.632, -346.075, 120.85); - Phase = SACRIFICING; - if (pInstance) - { - pInstance->SetData64(DATA_SACRIFICED_PLAYER,pSacrificeTarget->GetGUID()); - - for (uint8 i = 0; i < 3; ++i) - if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) - pSummon->AI()->DoAction(0); - } - - bSacrificed = true; - } - } else uiRitualOfSwordTimer -= diff; - - DoMeleeAttackIfReady(); - } - else //SACRIFICING - { - if (uiSacrificeTimer <= diff) - { - Unit* pSacrificeTarget = pInstance ? Unit::GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER)) : NULL; - if (pInstance && !summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive()) - me->Kill(pSacrificeTarget, false); // durability damage? - - //go down - Phase = NORMAL; - pSacrificeTarget = NULL; - me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - me->GetMotionMaster()->MoveChase(pTarget); - - uiSacrificeTimer = 8*IN_MILLISECONDS; } - else uiSacrificeTimer -= diff; } - } - void KilledUnit(Unit* /*pVictim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + void AttackStart(Unit* /*who*/) {} - void JustDied(Unit* pKiller) - { - if (pInstance) + void UpdateAI(const uint32 diff) { - Creature* pSvala = Unit::GetCreature((*me), pInstance->GetData64(DATA_SVALA)); - if (pSvala && pSvala->isAlive()) - pKiller->Kill(pSvala); + if (Phase != INTRO) + return; - pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); + if (uiIntroTimer <= diff) + { + Creature *pArthas = Unit::GetCreature(*me, uiArthasGUID); + if (!pArthas) + return; + + switch (uiIntroPhase) + { + case 0: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_1, me); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 1: + DoScriptText(SAY_DIALOG_OF_ARTHAS_1, pArthas); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 2: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_2, me); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 3: + DoScriptText(SAY_DIALOG_OF_ARTHAS_2, pArthas); + ++uiIntroPhase; + uiIntroTimer = 3.5*IN_MILLISECONDS; + break; + case 4: + DoScriptText(SAY_DIALOG_WITH_ARTHAS_3, me); + DoCast(me, SPELL_SVALA_TRANSFORMING1); + ++uiIntroPhase; + uiIntroTimer = 2.8*IN_MILLISECONDS; + break; + case 5: + DoCast(me, SPELL_SVALA_TRANSFORMING2); + ++uiIntroPhase; + uiIntroTimer = 200; + break; + case 6: + if (Creature* pSvalaSorrowgrave = me->SummonCreature(CREATURE_SVALA_SORROWGRAVE, SvalaPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60*IN_MILLISECONDS)) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(DATA_SVALA_DISPLAY_ID); + pArthas->ToTempSummon()->UnSummon(); + uiArthasGUID = 0; + Phase = FINISHED; + } + else + Reset(); + break; + } + } else uiIntroTimer -= diff; } - DoScriptText(SAY_DEATH, me); + }; + +}; + class mob_ritual_channeler : public CreatureScript +{ +public: + mob_ritual_channeler() : CreatureScript("mob_ritual_channeler") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ritual_channelerAI(pCreature); } + + struct mob_ritual_channelerAI : public Scripted_NoMovementAI + { + mob_ritual_channelerAI(Creature *c) :Scripted_NoMovementAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + void Reset() + { + DoCast(me, SPELL_SHADOWS_IN_THE_DARK); + } + + // called by svala sorrowgrave to set guid of victim + void DoAction(uint32 /*action*/) + { + if (pInstance) + if (Unit *pVictim = me->GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER))) + DoCast(pVictim, SPELL_PARALYZE); + } + + void EnterCombat(Unit* /*who*/) + { + } + }; + +}; + class boss_svala_sorrowgrave : public CreatureScript +{ +public: + boss_svala_sorrowgrave() : CreatureScript("boss_svala_sorrowgrave") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_svala_sorrowgraveAI(pCreature); + } + + struct boss_svala_sorrowgraveAI : public ScriptedAI + { + boss_svala_sorrowgraveAI(Creature *c) : ScriptedAI(c), summons(c) + { + pInstance = c->GetInstanceScript(); + } + + uint32 uiSinsterStrikeTimer; + uint32 uiCallFlamesTimer; + uint32 uiRitualOfSwordTimer; + uint32 uiSacrificeTimer; + + CombatPhase Phase; + + SummonList summons; + + bool bSacrificed; + + InstanceScript* pInstance; + + void Reset() + { + uiSinsterStrikeTimer = 7*IN_MILLISECONDS; + uiCallFlamesTimer = 10*IN_MILLISECONDS; + uiRitualOfSwordTimer = 20*IN_MILLISECONDS; + uiSacrificeTimer = 8*IN_MILLISECONDS; + + bSacrificed = false; + + Phase = NORMAL; + + DoTeleportTo(296.632, -346.075, 90.6307); + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + + summons.DespawnAll(); + + if (pInstance) + { + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED); + pInstance->SetData64(DATA_SACRIFICED_PLAYER,0); + } + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); + } + + void JustSummoned(Creature *summon) + { + summons.Summon(summon); + } + + void SummonedCreatureDespawn(Creature *summon) + { + summons.Despawn(summon); + } + + void UpdateAI(const uint32 diff) + { + if (Phase == NORMAL) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiSinsterStrikeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); + uiSinsterStrikeTimer = urand(5*IN_MILLISECONDS,9*IN_MILLISECONDS); + } else uiSinsterStrikeTimer -= diff; + + if (uiCallFlamesTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoCast(pTarget, SPELL_CALL_FLAMES); + uiCallFlamesTimer = urand(8*IN_MILLISECONDS,12*IN_MILLISECONDS); + } + } else uiCallFlamesTimer -= diff; + + if (!bSacrificed) + if (uiRitualOfSwordTimer <= diff) + { + if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),me); + DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD); + //Spell doesn't teleport + DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6); + me->SetUnitMovementFlags(MOVEMENTFLAG_CAN_FLY); + DoTeleportTo(296.632, -346.075, 120.85); + Phase = SACRIFICING; + if (pInstance) + { + pInstance->SetData64(DATA_SACRIFICED_PLAYER,pSacrificeTarget->GetGUID()); + + for (uint8 i = 0; i < 3; ++i) + if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) + pSummon->AI()->DoAction(0); + } + + bSacrificed = true; + } + } else uiRitualOfSwordTimer -= diff; + + DoMeleeAttackIfReady(); + } + else //SACRIFICING + { + if (uiSacrificeTimer <= diff) + { + Unit* pSacrificeTarget = pInstance ? Unit::GetUnit(*me, pInstance->GetData64(DATA_SACRIFICED_PLAYER)) : NULL; + if (pInstance && !summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive()) + me->Kill(pSacrificeTarget, false); // durability damage? + + //go down + Phase = NORMAL; + pSacrificeTarget = NULL; + me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + me->GetMotionMaster()->MoveChase(pTarget); + + uiSacrificeTimer = 8*IN_MILLISECONDS; + } + else uiSacrificeTimer -= diff; + } + } + + void KilledUnit(Unit* /*pVictim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void JustDied(Unit* pKiller) + { + if (pInstance) + { + Creature* pSvala = Unit::GetCreature((*me), pInstance->GetData64(DATA_SVALA)); + if (pSvala && pSvala->isAlive()) + pKiller->Kill(pSvala); + + pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, DONE); + } + DoScriptText(SAY_DEATH, me); + } + }; + }; -CreatureAI* GetAI_boss_svala(Creature* pCreature) -{ - return new boss_svalaAI (pCreature); -} -CreatureAI* GetAI_mob_ritual_channeler(Creature* pCreature) -{ - return new mob_ritual_channelerAI(pCreature); -} -CreatureAI* GetAI_boss_svala_sorrowgrave(Creature* pCreature) -{ - return new boss_svala_sorrowgraveAI(pCreature); -} void AddSC_boss_svala() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_svala"; - newscript->GetAI = &GetAI_boss_svala; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ritual_channeler"; - newscript->GetAI = &GetAI_mob_ritual_channeler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_svala_sorrowgrave"; - newscript->GetAI = &GetAI_boss_svala_sorrowgrave; - newscript->RegisterSelf(); + new boss_svala(); + new mob_ritual_channeler(); + new boss_svala_sorrowgrave(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 62d297396ac..c3619379a74 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -96,289 +96,291 @@ static ActiveBoatStruct ActiveBot[4] = {CREATURE_RANULF_VISUAL, SAY_SUMMON_RANULF, 381.546, -314.362, 104.756, 370.841, -314.426, 107.995, 6.232}, {CREATURE_TORGYN_VISUAL, SAY_SUMMON_TORGYN, 404.310, -314.761, 104.756, 413.992, -314.703, 107.995, 3.157} }; - -struct boss_ymironAI : public ScriptedAI + class boss_ymiron : public CreatureScript { - boss_ymironAI(Creature *c) : ScriptedAI(c) +public: + boss_ymiron() : CreatureScript("boss_ymiron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - srand(time(NULL)); - for (int i = 0; i < 4; ++i) - m_uiActiveOrder[i] = i; - for (int i = 0; i < 3; ++i) + return new boss_ymironAI(pCreature); + } + + struct boss_ymironAI : public ScriptedAI + { + boss_ymironAI(Creature *c) : ScriptedAI(c) { - int r = i + (rand()%(4-i)); - int temp = m_uiActiveOrder[i]; - m_uiActiveOrder[i] = m_uiActiveOrder[r]; - m_uiActiveOrder[r] = temp; - } - } - - bool m_bIsWalking; - bool m_bIsPause; - bool m_bIsActiveWithBJORN; - bool m_bIsActiveWithHALDOR; - bool m_bIsActiveWithRANULF; - bool m_bIsActiveWithTORGYN; - - uint8 m_uiActiveOrder[4]; - uint8 m_uiActivedNumber; - - uint32 m_uiFetidRot_Timer; - uint32 m_uiBane_Timer; - uint32 m_uiDarkSlash_Timer; - uint32 m_uiAncestors_Vengeance_Timer; - - uint32 m_uiAbility_BJORN_Timer; - uint32 m_uiAbility_HALDOR_Timer; - uint32 m_uiAbility_RANULF_Timer; - uint32 m_uiAbility_TORGYN_Timer; - - uint32 m_uiPause_Timer; - uint32 m_uiHealthAmountModifier; - uint32 m_uiHealthAmountMultipler; - - uint64 m_uiActivedCreatureGUID; - uint64 m_uiOrbGUID; - - ScriptedInstance *pInstance; - - void Reset() - { - m_bIsPause = false; - m_bIsActiveWithBJORN = false; - m_bIsActiveWithHALDOR = false; - m_bIsActiveWithRANULF = false; - m_bIsActiveWithTORGYN = false; - - m_uiFetidRot_Timer = urand(8000,13000); - m_uiBane_Timer = urand(18000,23000); - m_uiDarkSlash_Timer = urand(28000,33000); - m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(60000,45000); - m_uiPause_Timer = 0; - - m_uiAbility_BJORN_Timer = 0; - m_uiAbility_HALDOR_Timer = 0; - m_uiAbility_RANULF_Timer = 0; - m_uiAbility_TORGYN_Timer = 0; - - m_uiActivedNumber = 0; - m_uiHealthAmountModifier = 1; - m_uiHealthAmountMultipler = DUNGEON_MODE(20,25); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - if (m_bIsWalking) - { - if (m_uiPause_Timer <= diff) + pInstance = c->GetInstanceScript(); + srand(time(NULL)); + for (int i = 0; i < 4; ++i) + m_uiActiveOrder[i] = i; + for (int i = 0; i < 3; ++i) { - DoScriptText(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].say, me); - DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit - if (Creature* pTemp = me->SummonCreature(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) + int r = i + (rand()%(4-i)); + int temp = m_uiActiveOrder[i]; + m_uiActiveOrder[i] = m_uiActiveOrder[r]; + m_uiActiveOrder[r] = temp; + } + } + + bool m_bIsWalking; + bool m_bIsPause; + bool m_bIsActiveWithBJORN; + bool m_bIsActiveWithHALDOR; + bool m_bIsActiveWithRANULF; + bool m_bIsActiveWithTORGYN; + + uint8 m_uiActiveOrder[4]; + uint8 m_uiActivedNumber; + + uint32 m_uiFetidRot_Timer; + uint32 m_uiBane_Timer; + uint32 m_uiDarkSlash_Timer; + uint32 m_uiAncestors_Vengeance_Timer; + + uint32 m_uiAbility_BJORN_Timer; + uint32 m_uiAbility_HALDOR_Timer; + uint32 m_uiAbility_RANULF_Timer; + uint32 m_uiAbility_TORGYN_Timer; + + uint32 m_uiPause_Timer; + uint32 m_uiHealthAmountModifier; + uint32 m_uiHealthAmountMultipler; + + uint64 m_uiActivedCreatureGUID; + uint64 m_uiOrbGUID; + + InstanceScript *pInstance; + + void Reset() + { + m_bIsPause = false; + m_bIsActiveWithBJORN = false; + m_bIsActiveWithHALDOR = false; + m_bIsActiveWithRANULF = false; + m_bIsActiveWithTORGYN = false; + + m_uiFetidRot_Timer = urand(8000,13000); + m_uiBane_Timer = urand(18000,23000); + m_uiDarkSlash_Timer = urand(28000,33000); + m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(60000,45000); + m_uiPause_Timer = 0; + + m_uiAbility_BJORN_Timer = 0; + m_uiAbility_HALDOR_Timer = 0; + m_uiAbility_RANULF_Timer = 0; + m_uiAbility_TORGYN_Timer = 0; + + m_uiActivedNumber = 0; + m_uiHealthAmountModifier = 1; + m_uiHealthAmountMultipler = DUNGEON_MODE(20,25); + + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); + + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + if (m_bIsWalking) + { + if (m_uiPause_Timer <= diff) { - m_uiActivedCreatureGUID = pTemp->GetGUID(); - pTemp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - switch(m_uiActiveOrder[m_uiActivedNumber]) + DoScriptText(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].say, me); + DoCast(me, SPELL_CHANNEL_YMIRON_TO_SPIRIT); // should be on spirit + if (Creature* pTemp = me->SummonCreature(ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].npc, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnX, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnY, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnZ, ActiveBot[m_uiActiveOrder[m_uiActivedNumber]].SpawnO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { - case 0: m_bIsActiveWithBJORN = true; break; - case 1: m_bIsActiveWithHALDOR = true; break; - case 2: m_bIsActiveWithRANULF = true; break; - case 3: m_bIsActiveWithTORGYN = true; break; - } - } - - m_bIsPause = true; - m_bIsWalking = false; - m_uiPause_Timer = 3000; - } else m_uiPause_Timer -= diff; - return; - } - else if (m_bIsPause) - { - if (m_uiPause_Timer <= diff) - { - m_uiAbility_BJORN_Timer = 5000; - m_uiAbility_HALDOR_Timer = 5000; - m_uiAbility_RANULF_Timer = 5000; - m_uiAbility_TORGYN_Timer = 5000; - - m_bIsPause = false; - m_uiPause_Timer = 0; - } else m_uiPause_Timer -= diff; - return; - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!m_bIsPause) - { - // Normal spells ------------------------------------------------------------------------ - if (m_uiBane_Timer <= diff) - { - DoCast(me, SPELL_BANE); - m_uiBane_Timer = urand(20000,25000); - } else m_uiBane_Timer -= diff; - - if (m_uiFetidRot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FETID_ROT); - m_uiFetidRot_Timer = urand(10000,15000); - } else m_uiFetidRot_Timer -= diff; - - if (m_uiDarkSlash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DARK_SLASH); - m_uiDarkSlash_Timer = urand(30000,35000); - } else m_uiDarkSlash_Timer -= diff; - - if (m_uiAncestors_Vengeance_Timer <= diff) - { - DoCast(me, SPELL_ANCESTORS_VENGEANCE); - m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(urand(60000,65000),urand(45000,50000)); - } else m_uiAncestors_Vengeance_Timer -= diff; - - // Abilities ------------------------------------------------------------------------------ - if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) - { - //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control - if (Creature* pTemp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) - { - pTemp->SetSpeed(MOVE_RUN, 0.4f); - pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pTemp->SetDisplayId(11686); - //pTemp->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiOrbGUID = pTemp->GetGUID(); - } - m_bIsActiveWithBJORN = false; // only one orb - } else m_uiAbility_BJORN_Timer -= diff; - - if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SPIRIT_STRIKE); - m_uiAbility_HALDOR_Timer = 5000; // overtime - } else m_uiAbility_HALDOR_Timer -= diff; - - if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) - { - DoCast(me, SPELL_SPIRIT_BURST); - m_uiAbility_RANULF_Timer = 10000; // overtime - } else m_uiAbility_RANULF_Timer -= diff; - - if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) - { - float x,y,z; - x = me->GetPositionX()-5; - y = me->GetPositionY()-5; - z = me->GetPositionZ(); - for (uint8 i = 0; i < 4; ++i) - { - //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control - if (Creature* pTemp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) - { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + m_uiActivedCreatureGUID = pTemp->GetGUID(); + pTemp->CastSpell(me, SPELL_CHANNEL_SPIRIT_TO_YMIRON, true); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + switch(m_uiActiveOrder[m_uiActivedNumber]) { - pTemp->AddThreat(pTarget, 0.0f); - pTemp->AI()->AttackStart(pTarget); + case 0: m_bIsActiveWithBJORN = true; break; + case 1: m_bIsActiveWithHALDOR = true; break; + case 2: m_bIsActiveWithRANULF = true; break; + case 3: m_bIsActiveWithTORGYN = true; break; } } - } - m_uiAbility_TORGYN_Timer = 15000; // overtime - } else m_uiAbility_TORGYN_Timer -= diff; - // Health check ----------------------------------------------------------------------------- - if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier))) - { - uint8 m_uiOrder = m_uiHealthAmountModifier - 1; - ++m_uiHealthAmountModifier; - - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); - me->GetMotionMaster()->Clear(); - me->StopMoving(); - me->AttackStop(); - me->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); - - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); - - m_bIsActiveWithBJORN = false; - m_bIsActiveWithHALDOR = false; - m_bIsActiveWithRANULF = false; - m_bIsActiveWithTORGYN = false; - - m_uiBane_Timer += 8000; - m_uiFetidRot_Timer += 8000; - m_uiDarkSlash_Timer += 8000; - m_uiAncestors_Vengeance_Timer += 8000; - - m_uiActivedNumber = m_uiOrder; - m_bIsWalking = true; - m_uiPause_Timer = 2000; + m_bIsPause = true; + m_bIsWalking = false; + m_uiPause_Timer = 3000; + } else m_uiPause_Timer -= diff; return; } - DoMeleeAttackIfReady(); + else if (m_bIsPause) + { + if (m_uiPause_Timer <= diff) + { + m_uiAbility_BJORN_Timer = 5000; + m_uiAbility_HALDOR_Timer = 5000; + m_uiAbility_RANULF_Timer = 5000; + m_uiAbility_TORGYN_Timer = 5000; + + m_bIsPause = false; + m_uiPause_Timer = 0; + } else m_uiPause_Timer -= diff; + return; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!m_bIsPause) + { + // Normal spells ------------------------------------------------------------------------ + if (m_uiBane_Timer <= diff) + { + DoCast(me, SPELL_BANE); + m_uiBane_Timer = urand(20000,25000); + } else m_uiBane_Timer -= diff; + + if (m_uiFetidRot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FETID_ROT); + m_uiFetidRot_Timer = urand(10000,15000); + } else m_uiFetidRot_Timer -= diff; + + if (m_uiDarkSlash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DARK_SLASH); + m_uiDarkSlash_Timer = urand(30000,35000); + } else m_uiDarkSlash_Timer -= diff; + + if (m_uiAncestors_Vengeance_Timer <= diff) + { + DoCast(me, SPELL_ANCESTORS_VENGEANCE); + m_uiAncestors_Vengeance_Timer = DUNGEON_MODE(urand(60000,65000),urand(45000,50000)); + } else m_uiAncestors_Vengeance_Timer -= diff; + + // Abilities ------------------------------------------------------------------------------ + if (m_bIsActiveWithBJORN && m_uiAbility_BJORN_Timer <= diff) + { + //DoCast(me, SPELL_SUMMON_SPIRIT_FOUNT); // works fine, but using summon has better control + if (Creature* pTemp = me->SummonCreature(CREATURE_SPIRIT_FOUNT, 385+rand()%10, -330+rand()%10, 104.756, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000)) + { + pTemp->SetSpeed(MOVE_RUN, 0.4f); + pTemp->CastSpell(pTemp, DUNGEON_MODE(SPELL_SPIRIT_FOUNT, H_SPELL_SPIRIT_FOUNT), true); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pTemp->SetDisplayId(11686); + //pTemp->GetMotionMaster()->MoveChase(me->getVictim()); + m_uiOrbGUID = pTemp->GetGUID(); + } + m_bIsActiveWithBJORN = false; // only one orb + } else m_uiAbility_BJORN_Timer -= diff; + + if (m_bIsActiveWithHALDOR && m_uiAbility_HALDOR_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SPIRIT_STRIKE); + m_uiAbility_HALDOR_Timer = 5000; // overtime + } else m_uiAbility_HALDOR_Timer -= diff; + + if (m_bIsActiveWithRANULF && m_uiAbility_RANULF_Timer <= diff) + { + DoCast(me, SPELL_SPIRIT_BURST); + m_uiAbility_RANULF_Timer = 10000; // overtime + } else m_uiAbility_RANULF_Timer -= diff; + + if (m_bIsActiveWithTORGYN && m_uiAbility_TORGYN_Timer <= diff) + { + float x,y,z; + x = me->GetPositionX()-5; + y = me->GetPositionY()-5; + z = me->GetPositionZ(); + for (uint8 i = 0; i < 4; ++i) + { + //DoCast(me, SPELL_SUMMON_AVENGING_SPIRIT); // works fine, but using summon has better control + if (Creature* pTemp = me->SummonCreature(CREATURE_AVENGING_SPIRIT, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + pTemp->AddThreat(pTarget, 0.0f); + pTemp->AI()->AttackStart(pTarget); + } + } + } + m_uiAbility_TORGYN_Timer = 15000; // overtime + } else m_uiAbility_TORGYN_Timer -= diff; + + // Health check ----------------------------------------------------------------------------- + if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(m_uiHealthAmountMultipler * m_uiHealthAmountModifier))) + { + uint8 m_uiOrder = m_uiHealthAmountModifier - 1; + ++m_uiHealthAmountModifier; + + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_SCREAMS_OF_THE_DEAD); + me->GetMotionMaster()->Clear(); + me->StopMoving(); + me->AttackStop(); + me->GetMotionMaster()->MovePoint(0, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveX, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveY, ActiveBot[m_uiActiveOrder[m_uiOrder]].MoveZ); + + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); + + m_bIsActiveWithBJORN = false; + m_bIsActiveWithHALDOR = false; + m_bIsActiveWithRANULF = false; + m_bIsActiveWithTORGYN = false; + + m_uiBane_Timer += 8000; + m_uiFetidRot_Timer += 8000; + m_uiDarkSlash_Timer += 8000; + m_uiAncestors_Vengeance_Timer += 8000; + + m_uiActivedNumber = m_uiOrder; + m_bIsWalking = true; + m_uiPause_Timer = 2000; + return; + } + DoMeleeAttackIfReady(); + } } - } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - DespawnBoatGhosts(m_uiActivedCreatureGUID); - DespawnBoatGhosts(m_uiOrbGUID); + DespawnBoatGhosts(m_uiActivedCreatureGUID); + DespawnBoatGhosts(m_uiOrbGUID); - if (pInstance) - pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_KING_YMIRON_EVENT, DONE); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } - void DespawnBoatGhosts(uint64& m_uiCreatureGUID) - { - if (m_uiCreatureGUID) - if (Creature* pTemp = Unit::GetCreature(*me, m_uiCreatureGUID)) - pTemp->DisappearAndDie(); + void DespawnBoatGhosts(uint64& m_uiCreatureGUID) + { + if (m_uiCreatureGUID) + if (Creature* pTemp = Unit::GetCreature(*me, m_uiCreatureGUID)) + pTemp->DisappearAndDie(); + + m_uiCreatureGUID = 0; + } + }; - m_uiCreatureGUID = 0; - } }; -CreatureAI* GetAI_boss_ymiron(Creature* pCreature) -{ - return new boss_ymironAI(pCreature); -} void AddSC_boss_ymiron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ymiron"; - newscript->GetAI = &GetAI_boss_ymiron; - newscript->RegisterSelf(); + new boss_ymiron(); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index dbbd7b058f2..ae295dacc15 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -34,9 +34,9 @@ enum GameObjects ENTRY_GORK_PALEHOOF_SPHERE = 188593 }; -struct instance_pinnacle : public ScriptedInstance +struct instance_pinnacle : public InstanceScript { - instance_pinnacle(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_pinnacle(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 uiSvalaSorrowgrave; uint64 uiGortokPalehoof; @@ -242,17 +242,20 @@ struct instance_pinnacle : public ScriptedInstance OUT_LOAD_INST_DATA_COMPLETE; } }; - -InstanceData* GetInstanceData_instance_utgarde_pinnacle(Map* pMap) + class instance_utgarde_pinnacle : public InstanceMapScript { - return new instance_pinnacle(pMap); -} +public: + instance_utgarde_pinnacle() : InstanceMapScript("instance_utgarde_pinnacle") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_pinnacle(pMap); + } + + +}; void AddSC_instance_utgarde_pinnacle() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_utgarde_pinnacle"; - newscript->GetInstanceData = &GetInstanceData_instance_utgarde_pinnacle; - newscript->RegisterSelf(); + new instance_utgarde_pinnacle(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp index 124a8f0b8b8..131b3b9080b 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp @@ -52,166 +52,171 @@ UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`= #define EVENT_ROCK_SHOWER 5 //set = 20s cd,unkown cd #define EVENT_SHIELD_CRUSH 6 //set = 30s cd #define EVENT_WHIRL 8 //set= 10s cd - -struct boss_archavonAI : public ScriptedAI + class boss_archavon : public CreatureScript { - boss_archavonAI(Creature *c) : ScriptedAI(c) +public: + boss_archavon() : CreatureScript("boss_archavon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_archavonAI (pCreature); } - ScriptedInstance* pInstance; - EventMap events; - - void Reset() + struct boss_archavonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, NOT_STARTED); - } - - void KilledUnit(Unit* /*Victim*/) {} - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); - events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); - events.ScheduleEvent(EVENT_STOMP, 45000); - events.ScheduleEvent(EVENT_BERSERK, 300000); - - if (pInstance) - pInstance->SetData(DATA_ARCHAVON_EVENT, IN_PROGRESS); - } - - // Below UpdateAI may need review/debug. - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + boss_archavonAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_ROCK_SHARDS: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ROCK_SHARDS); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); - return; - case EVENT_CHOKING_CLOUD: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CRUSHING_LEAP, true); //10y~80y, ignore range - events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); - return; - case EVENT_STOMP: - DoCast(me->getVictim(), SPELL_STOMP); - events.ScheduleEvent(EVENT_IMPALE, 3000); - events.ScheduleEvent(EVENT_STOMP, 45000); - return; - case EVENT_IMPALE: - DoCast(me->getVictim(), SPELL_IMPALE); - return; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - DoScriptText(EMOTE_BERSERK, me); - return; - } + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + InstanceScript* pInstance; + EventMap events; + + void Reset() + { + events.Reset(); + + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, NOT_STARTED); + } + + void KilledUnit(Unit* /*Victim*/) {} + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); + events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); + events.ScheduleEvent(EVENT_STOMP, 45000); + events.ScheduleEvent(EVENT_BERSERK, 300000); + + if (pInstance) + pInstance->SetData(DATA_ARCHAVON_EVENT, IN_PROGRESS); + } + + // Below UpdateAI may need review/debug. + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ROCK_SHARDS: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ROCK_SHARDS); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 15000); + return; + case EVENT_CHOKING_CLOUD: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CRUSHING_LEAP, true); //10y~80y, ignore range + events.ScheduleEvent(EVENT_CHOKING_CLOUD, 30000); + return; + case EVENT_STOMP: + DoCast(me->getVictim(), SPELL_STOMP); + events.ScheduleEvent(EVENT_IMPALE, 3000); + events.ScheduleEvent(EVENT_STOMP, 45000); + return; + case EVENT_IMPALE: + DoCast(me->getVictim(), SPELL_IMPALE); + return; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + DoScriptText(EMOTE_BERSERK, me); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; /*###### ## Mob Archavon Warder -######*/ -struct mob_archavon_warderAI : public ScriptedAI //npc 32353 +######*/ class mob_archavon_warder : public CreatureScript { - mob_archavon_warderAI(Creature *c) : ScriptedAI(c) {} +public: + mob_archavon_warder() : CreatureScript("mob_archavon_warder") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_archavon_warderAI(pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_archavon_warderAI : public ScriptedAI //npc 32353 { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_ROCK_SHOWER, 2000); - events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); - events.ScheduleEvent(EVENT_WHIRL, 7500); - } + mob_archavon_warderAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + EventMap events; - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_ROCK_SHOWER: - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_ROCK_SHOWER); - events.ScheduleEvent(EVENT_ROCK_SHARDS, 6000); - return; - } - case EVENT_SHIELD_CRUSH: - DoCast(me->getVictim(), SPELL_SHIELD_CRUSH); - events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); - return; - case EVENT_WHIRL: - DoCast(me->getVictim(), SPELL_WHIRL); - events.ScheduleEvent(EVENT_WHIRL, 8000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + events.ScheduleEvent(EVENT_ROCK_SHOWER, 2000); + events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); + events.ScheduleEvent(EVENT_WHIRL, 7500); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_ROCK_SHOWER: + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_ROCK_SHOWER); + events.ScheduleEvent(EVENT_ROCK_SHARDS, 6000); + return; + } + case EVENT_SHIELD_CRUSH: + DoCast(me->getVictim(), SPELL_SHIELD_CRUSH); + events.ScheduleEvent(EVENT_SHIELD_CRUSH, 20000); + return; + case EVENT_WHIRL: + DoCast(me->getVictim(), SPELL_WHIRL); + events.ScheduleEvent(EVENT_WHIRL, 8000); + return; + } + } + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_archavon_warder(Creature* pCreature) -{ - return new mob_archavon_warderAI(pCreature); -} -CreatureAI* GetAI_boss_archavon(Creature* pCreature) -{ - return new boss_archavonAI (pCreature); -} void AddSC_boss_archavon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_archavon"; - newscript->GetAI = &GetAI_boss_archavon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_archavon_warder"; - newscript->GetAI = &GetAI_mob_archavon_warder; - newscript->RegisterSelf(); + new boss_archavon(); + new mob_archavon_warder(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 6757d28a208..f9da757a34a 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -56,214 +56,219 @@ struct Position TempestMinions[MAX_TEMPEST_MINIONS] = /*###### ## Emalon the Storm Watcher -######*/ -struct boss_emalonAI : public BossAI +######*/ class boss_emalon : public CreatureScript { - boss_emalonAI(Creature *c) : BossAI(c, DATA_EMALON_EVENT) +public: + boss_emalon() : CreatureScript("boss_emalon") { } + + CreatureAI* GetAI(Creature *_Creature) { + return new boss_emalonAI (_Creature); } - void Reset() + struct boss_emalonAI : public BossAI { - _Reset(); - - for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) - me->SummonCreature(MOB_TEMPEST_MINION, TempestMinions[i], TEMPSUMMON_CORPSE_DESPAWN, 0); - } - - void JustSummoned(Creature *summoned) - { - BossAI::JustSummoned(summoned); - - if (me->getVictim() && summoned->AI()) - summoned->AI()->AttackStart(me->getVictim()); - } - - void EnterCombat(Unit * who) - { - if (!summons.empty()) + boss_emalonAI(Creature *c) : BossAI(c, DATA_EMALON_EVENT) { - for (std::list::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) - { - Creature *minion = Unit::GetCreature(*me, *itr); - if (minion && minion->isAlive() && !minion->getVictim() && minion->AI()) - minion->AI()->AttackStart(who); - } } - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000); - events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); - events.ScheduleEvent(EVENT_BERSERK, 360000); - events.ScheduleEvent(EVENT_OVERCHARGE, 45000); - - _EnterCombat(); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) + _Reset(); + + for (uint8 i = 0; i < MAX_TEMPEST_MINIONS; ++i) + me->SummonCreature(MOB_TEMPEST_MINION, TempestMinions[i], TEMPSUMMON_CORPSE_DESPAWN, 0); + } + + void JustSummoned(Creature *summoned) + { + BossAI::JustSummoned(summoned); + + if (me->getVictim() && summoned->AI()) + summoned->AI()->AttackStart(me->getVictim()); + } + + void EnterCombat(Unit * who) + { + if (!summons.empty()) { - case EVENT_CHAIN_LIGHTNING: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 25000); - break; - case EVENT_LIGHTNING_NOVA: - DoCastAOE(SPELL_LIGHTNING_NOVA, false); - events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); - break; - case EVENT_OVERCHARGE: - if (!summons.empty()) + for (std::list::const_iterator itr = summons.begin(); itr != summons.end(); ++itr) { - std::list::const_iterator itr = summons.begin(); - std::advance(itr, urand(0, summons.size()-1)); Creature *minion = Unit::GetCreature(*me, *itr); - if (minion && minion->isAlive()) - { - minion->CastSpell(me, SPELL_OVERCHARGED, true); - minion->SetHealth(minion->GetMaxHealth()); - DoScriptText(EMOTE_OVERCHARGE, me); - events.ScheduleEvent(EVENT_OVERCHARGE, 45000); - } + if (minion && minion->isAlive() && !minion->getVictim() && minion->AI()) + minion->AI()->AttackStart(who); } - break; - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK); - DoScriptText(EMOTE_BERSERK, me); - break; } + + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 5000); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); + events.ScheduleEvent(EVENT_BERSERK, 360000); + events.ScheduleEvent(EVENT_OVERCHARGE, 45000); + + _EnterCombat(); } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_CHAIN_LIGHTNING: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 25000); + break; + case EVENT_LIGHTNING_NOVA: + DoCastAOE(SPELL_LIGHTNING_NOVA, false); + events.ScheduleEvent(EVENT_LIGHTNING_NOVA, 40000); + break; + case EVENT_OVERCHARGE: + if (!summons.empty()) + { + std::list::const_iterator itr = summons.begin(); + std::advance(itr, urand(0, summons.size()-1)); + Creature *minion = Unit::GetCreature(*me, *itr); + if (minion && minion->isAlive()) + { + minion->CastSpell(me, SPELL_OVERCHARGED, true); + minion->SetHealth(minion->GetMaxHealth()); + DoScriptText(EMOTE_OVERCHARGE, me); + events.ScheduleEvent(EVENT_OVERCHARGE, 45000); + } + } + break; + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK); + DoScriptText(EMOTE_BERSERK, me); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; /*###### ## Tempest Minion -######*/ -struct mob_tempest_minionAI : public ScriptedAI +######*/ class mob_tempest_minion : public CreatureScript { - mob_tempest_minionAI(Creature *c) : ScriptedAI(c) +public: + mob_tempest_minion() : CreatureScript("mob_tempest_minion") { } + + CreatureAI* GetAI(Creature *_Creature) { - pInstance = c->GetInstanceData(); + return new mob_tempest_minionAI (_Creature); } - ScriptedInstance* pInstance; - - EventMap events; - - uint32 uiOverchargedTimer; - - void Reset() + struct mob_tempest_minionAI : public ScriptedAI { - events.Reset(); - - uiOverchargedTimer = 0; - } - - void JustDied(Unit* /*Killer*/) - { - if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) + mob_tempest_minionAI(Creature *c) : ScriptedAI(c) { - if (pEmalon->isAlive()) - { - pEmalon->SummonCreature(MOB_TEMPEST_MINION, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoScriptText(EMOTE_MINION_RESPAWN, me); - } + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit * who) - { - DoZoneInCombat(); - events.ScheduleEvent(EVENT_SHOCK, 20000); + InstanceScript* pInstance; - if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) + EventMap events; + + uint32 uiOverchargedTimer; + + void Reset() { - if (!pEmalon->getVictim() && pEmalon->AI()) - pEmalon->AI()->AttackStart(who); + events.Reset(); + + uiOverchargedTimer = 0; } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - if (Aura *overchargedAura = me->GetAura(SPELL_OVERCHARGED)) + void JustDied(Unit* /*Killer*/) { - if (overchargedAura->GetStackAmount() < 10) + if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) { - if (uiOverchargedTimer <= diff) + if (pEmalon->isAlive()) { - DoCast(me, SPELL_OVERCHARGED); - uiOverchargedTimer = 2000; - } else uiOverchargedTimer -=diff; - } - else - { - if (overchargedAura->GetStackAmount() == 10) - { - DoCast(me, SPELL_OVERCHARGED_BLAST); - me->ForcedDespawn(); + pEmalon->SummonCreature(MOB_TEMPEST_MINION, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); DoScriptText(EMOTE_MINION_RESPAWN, me); } } } - while (uint32 eventId = events.ExecuteEvent()) + void EnterCombat(Unit * who) { - switch(eventId) + DoZoneInCombat(); + events.ScheduleEvent(EVENT_SHOCK, 20000); + + if (Creature *pEmalon = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EMALON) : 0)) { - case EVENT_SHOCK: - DoCast(me->getVictim(), SPELL_SHOCK); - events.ScheduleEvent(EVENT_SHOCK, 20000); - return; + if (!pEmalon->getVictim() && pEmalon->AI()) + pEmalon->AI()->AttackStart(who); } } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + if (Aura *overchargedAura = me->GetAura(SPELL_OVERCHARGED)) + { + if (overchargedAura->GetStackAmount() < 10) + { + if (uiOverchargedTimer <= diff) + { + DoCast(me, SPELL_OVERCHARGED); + uiOverchargedTimer = 2000; + } else uiOverchargedTimer -=diff; + } + else + { + if (overchargedAura->GetStackAmount() == 10) + { + DoCast(me, SPELL_OVERCHARGED_BLAST); + me->ForcedDespawn(); + DoScriptText(EMOTE_MINION_RESPAWN, me); + } + } + } + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHOCK: + DoCast(me->getVictim(), SPELL_SHOCK); + events.ScheduleEvent(EVENT_SHOCK, 20000); + return; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_tempest_minion(Creature *_Creature) -{ - return new mob_tempest_minionAI (_Creature); -} -CreatureAI* GetAI_boss_emalon(Creature *_Creature) -{ - return new boss_emalonAI (_Creature); -} void AddSC_boss_emalon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_emalon"; - newscript->GetAI = &GetAI_boss_emalon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tempest_minion"; - newscript->GetAI = &GetAI_mob_tempest_minion; - newscript->RegisterSelf(); + new boss_emalon(); + new mob_tempest_minion(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index f8bc8295f21..27a723622a2 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -62,160 +62,165 @@ enum Spells SPELL_FW_METEOR_FISTS_B = 67331, SPELL_FW_METEOR_FISTS_B_H = 68160, }; - -struct boss_koralonAI : public ScriptedAI + class boss_koralon : public CreatureScript { - boss_koralonAI(Creature *c) : ScriptedAI(c) +public: + boss_koralon() : CreatureScript("boss_koralon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_koralonAI (pCreature); } - ScriptedInstance *pInstance; - EventMap events; - - void Reset() + struct boss_koralonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, NOT_STARTED); - } - - void KilledUnit(Unit* /*Victim*/) {} - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - - DoCast(me, SPELL_BURNING_FURY); - - events.ScheduleEvent(EVENT_BURNING_FURY, 20000); // TODO check timer - events.ScheduleEvent(EVENT_BURNING_BREATH, 15000); // 1st after 15sec, then every 45sec - events.ScheduleEvent(EVENT_METEOR_FISTS_A, 75000); // 1st after 75sec, then every 45sec - events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); // TODO check timer - - if (pInstance) - pInstance->SetData(DATA_KORALON_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + boss_koralonAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_BURNING_FURY: - DoCast(me, SPELL_BURNING_FURY); - events.ScheduleEvent(EVENT_BURNING_FURY, 20000); - return; - case EVENT_BURNING_BREATH: - DoCast(me, RAID_MODE(SPELL_BURNING_BREATH,SPELL_BURNING_BREATH_H)); - events.ScheduleEvent(EVENT_BURNING_BREATH, 45000); - return; - case EVENT_METEOR_FISTS_A: - DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_A,SPELL_METEOR_FISTS_A_H)); - events.ScheduleEvent(EVENT_METEOR_FISTS_B, 1500); - return; - case EVENT_METEOR_FISTS_B: - DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_B,SPELL_METEOR_FISTS_B_H)); - events.ScheduleEvent(EVENT_METEOR_FISTS_A, 45000); - return; - case EVENT_FLAME_CINDER_A: - DoCast(me, RAID_MODE(SPELL_FLAME_CINDER_A,SPELL_FLAME_CINDER_A_H)); - events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); - return; - } + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + + InstanceScript *pInstance; + EventMap events; + + void Reset() + { + events.Reset(); + + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, NOT_STARTED); + } + + void KilledUnit(Unit* /*Victim*/) {} + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + + DoCast(me, SPELL_BURNING_FURY); + + events.ScheduleEvent(EVENT_BURNING_FURY, 20000); // TODO check timer + events.ScheduleEvent(EVENT_BURNING_BREATH, 15000); // 1st after 15sec, then every 45sec + events.ScheduleEvent(EVENT_METEOR_FISTS_A, 75000); // 1st after 75sec, then every 45sec + events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); // TODO check timer + + if (pInstance) + pInstance->SetData(DATA_KORALON_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_BURNING_FURY: + DoCast(me, SPELL_BURNING_FURY); + events.ScheduleEvent(EVENT_BURNING_FURY, 20000); + return; + case EVENT_BURNING_BREATH: + DoCast(me, RAID_MODE(SPELL_BURNING_BREATH,SPELL_BURNING_BREATH_H)); + events.ScheduleEvent(EVENT_BURNING_BREATH, 45000); + return; + case EVENT_METEOR_FISTS_A: + DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_A,SPELL_METEOR_FISTS_A_H)); + events.ScheduleEvent(EVENT_METEOR_FISTS_B, 1500); + return; + case EVENT_METEOR_FISTS_B: + DoCast(me, RAID_MODE(SPELL_METEOR_FISTS_B,SPELL_METEOR_FISTS_B_H)); + events.ScheduleEvent(EVENT_METEOR_FISTS_A, 45000); + return; + case EVENT_FLAME_CINDER_A: + DoCast(me, RAID_MODE(SPELL_FLAME_CINDER_A,SPELL_FLAME_CINDER_A_H)); + events.ScheduleEvent(EVENT_FLAME_CINDER_A, 30000); + return; + } + } + DoMeleeAttackIfReady(); + } + }; + }; /*###### ## Mob Flame Warder -######*/ -struct mob_flame_warderAI : public ScriptedAI +######*/ class mob_flame_warder : public CreatureScript { - mob_flame_warderAI(Creature *c) : ScriptedAI(c) {} +public: + mob_flame_warder() : CreatureScript("mob_flame_warder") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_flame_warderAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_flame_warderAI : public ScriptedAI { - DoZoneInCombat(); + mob_flame_warderAI(Creature *c) : ScriptedAI(c) {} - events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 5000); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 10000); - } + EventMap events; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_FW_LAVA_BIRST: - DoCast(me->getVictim(), RAID_MODE(SPELL_FW_LAVA_BIRST,SPELL_FW_LAVA_BIRST_H)); - events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 15000); - return; - case EVENT_FW_METEOR_FISTS_A: - DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_A,SPELL_FW_METEOR_FISTS_A_H)); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_B, 1500); - return; - case EVENT_FW_METEOR_FISTS_B: - DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_B,SPELL_FW_METEOR_FISTS_B_H)); - events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 20000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + + events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 5000); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 10000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FW_LAVA_BIRST: + DoCast(me->getVictim(), RAID_MODE(SPELL_FW_LAVA_BIRST,SPELL_FW_LAVA_BIRST_H)); + events.ScheduleEvent(EVENT_FW_LAVA_BIRST, 15000); + return; + case EVENT_FW_METEOR_FISTS_A: + DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_A,SPELL_FW_METEOR_FISTS_A_H)); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_B, 1500); + return; + case EVENT_FW_METEOR_FISTS_B: + DoCast(me, RAID_MODE(SPELL_FW_METEOR_FISTS_B,SPELL_FW_METEOR_FISTS_B_H)); + events.ScheduleEvent(EVENT_FW_METEOR_FISTS_A, 20000); + return; + } + } + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_koralon(Creature* pCreature) -{ - return new boss_koralonAI (pCreature); -} -CreatureAI* GetAI_mob_flame_warder(Creature* pCreature) -{ - return new mob_flame_warderAI (pCreature); -} void AddSC_boss_koralon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_koralon"; - newscript->GetAI = &GetAI_boss_koralon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_flame_warder"; - newscript->GetAI = &GetAI_mob_flame_warder; - newscript->RegisterSelf(); + new boss_koralon(); + new mob_flame_warder(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index eddf62700fe..97285286379 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -52,249 +52,260 @@ UPDATE `creature_template` SET `ScriptName`='mob_frozen_orb' WHERE `entry`='3845 // Mob Frozen Orb #define MOB_FROZEN_ORB 38456 // 1 in 10 mode and 3 in 25 mode - -struct boss_toravonAI : public ScriptedAI + class boss_toravon : public CreatureScript { - boss_toravonAI(Creature *c) : ScriptedAI(c) +public: + boss_toravon() : CreatureScript("boss_toravon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_toravonAI (pCreature); } - ScriptedInstance *pInstance; - EventMap events; - - void Reset() + struct boss_toravonAI : public ScriptedAI { - events.Reset(); - - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, NOT_STARTED); - } - - void KilledUnit(Unit* /*Victim*/) {} - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - - DoCast(me, SPELL_FROZEN_MALLET); - - events.ScheduleEvent(EVENT_FROZEN_ORB, 11000); - events.ScheduleEvent(EVENT_WHITEOUT, 13000); - events.ScheduleEvent(EVENT_FREEZING_GROUND, 15000); - - if (pInstance) - pInstance->SetData(DATA_TORAVON_EVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - if (me->hasUnitState(UNIT_STAT_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) + boss_toravonAI(Creature *c) : ScriptedAI(c) { - switch(eventId) - { - case EVENT_FROZEN_ORB: - DoCast(me, SPELL_FROZEN_ORB); - events.ScheduleEvent(EVENT_FROZEN_ORB, 38000); - return; - case EVENT_WHITEOUT: - DoCast(me, SPELL_WHITEOUT); - events.ScheduleEvent(EVENT_WHITEOUT, 38000); - return; - case EVENT_FREEZING_GROUND: - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FREEZING_GROUND); - events.ScheduleEvent(EVENT_FREEZING_GROUND, 20000); - return; - } + pInstance = c->GetInstanceScript(); } - DoMeleeAttackIfReady(); - } + + InstanceScript *pInstance; + EventMap events; + + void Reset() + { + events.Reset(); + + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, NOT_STARTED); + } + + void KilledUnit(Unit* /*Victim*/) {} + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + + DoCast(me, SPELL_FROZEN_MALLET); + + events.ScheduleEvent(EVENT_FROZEN_ORB, 11000); + events.ScheduleEvent(EVENT_WHITEOUT, 13000); + events.ScheduleEvent(EVENT_FREEZING_GROUND, 15000); + + if (pInstance) + pInstance->SetData(DATA_TORAVON_EVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->hasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FROZEN_ORB: + DoCast(me, SPELL_FROZEN_ORB); + events.ScheduleEvent(EVENT_FROZEN_ORB, 38000); + return; + case EVENT_WHITEOUT: + DoCast(me, SPELL_WHITEOUT); + events.ScheduleEvent(EVENT_WHITEOUT, 38000); + return; + case EVENT_FREEZING_GROUND: + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FREEZING_GROUND); + events.ScheduleEvent(EVENT_FREEZING_GROUND, 20000); + return; + } + } + DoMeleeAttackIfReady(); + } + }; + }; /*###### ## Mob Frost Warder -######*/ -struct mob_frost_warderAI : public ScriptedAI +######*/ class mob_frost_warder : public CreatureScript { - mob_frost_warderAI(Creature *c) : ScriptedAI(c) {} +public: + mob_frost_warder() : CreatureScript("mob_frost_warder") { } - EventMap events; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - events.Reset(); + return new mob_frost_warderAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_frost_warderAI : public ScriptedAI { - DoZoneInCombat(); + mob_frost_warderAI(Creature *c) : ScriptedAI(c) {} - DoCast(me, SPELL_FROZEN_MALLET); + EventMap events; - events.ScheduleEvent(EVENT_FROST_BLAST, 5000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void Reset() { - switch(eventId) - { - case EVENT_FROST_BLAST: - DoCast(me->getVictim(), SPELL_FROST_BLAST); - events.ScheduleEvent(EVENT_FROST_BLAST, 20000); - return; - } + events.Reset(); } - DoMeleeAttackIfReady(); - } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + + DoCast(me, SPELL_FROZEN_MALLET); + + events.ScheduleEvent(EVENT_FROST_BLAST, 5000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_FROST_BLAST: + DoCast(me->getVictim(), SPELL_FROST_BLAST); + events.ScheduleEvent(EVENT_FROST_BLAST, 20000); + return; + } + } + DoMeleeAttackIfReady(); + } + }; + }; /*###### ## Mob Frozen Orb -######*/ -struct mob_frozen_orbAI : public ScriptedAI +######*/ class mob_frozen_orb : public CreatureScript { - mob_frozen_orbAI(Creature *c) : ScriptedAI(c) {} +public: + mob_frozen_orb() : CreatureScript("mob_frozen_orb") { } - bool done; - uint32 killtimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - done = false; - killtimer = 60000; // if after this time there is no victim -> destroy! + return new mob_frozen_orbAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_frozen_orbAI : public ScriptedAI { - DoZoneInCombat(); - } + mob_frozen_orbAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!done) + bool done; + uint32 killtimer; + + void Reset() { - DoCast(me, SPELL_FROZEN_ORB_AURA, true); - DoCast(me, SPELL_FROZEN_ORB_DMG, true); - done = true; + done = false; + killtimer = 60000; // if after this time there is no victim -> destroy! } - if (killtimer <= diff) + void EnterCombat(Unit * /*who*/) { - if (!UpdateVictim()) - me->ForcedDespawn(); - killtimer = 10000; + DoZoneInCombat(); } - else - killtimer -= diff; - } + + void UpdateAI(const uint32 diff) + { + if (!done) + { + DoCast(me, SPELL_FROZEN_ORB_AURA, true); + DoCast(me, SPELL_FROZEN_ORB_DMG, true); + done = true; + } + + if (killtimer <= diff) + { + if (!UpdateVictim()) + me->ForcedDespawn(); + killtimer = 10000; + } + else + killtimer -= diff; + } + }; + }; /*###### ## Mob Frozen Orb Stalker -######*/ -struct mob_frozen_orb_stalkerAI : public Scripted_NoMovementAI +######*/ class mob_frozen_orb_stalker : public CreatureScript { - mob_frozen_orb_stalkerAI(Creature* c) : Scripted_NoMovementAI(c) - { - c->SetVisibility(VISIBILITY_OFF); - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); - c->SetReactState(REACT_PASSIVE); +public: + mob_frozen_orb_stalker() : CreatureScript("mob_frozen_orb_stalker") { } - pInstance = c->GetInstanceData(); - spawned = false; + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_frozen_orb_stalkerAI (pCreature); } - ScriptedInstance *pInstance; - bool spawned; - - void UpdateAI(const uint32 /*diff*/) + struct mob_frozen_orb_stalkerAI : public Scripted_NoMovementAI { - if (spawned) - return; - - spawned = true; - if (!pInstance) - return; - - Unit* pToravon = me->GetCreature(*me, pInstance->GetData64(DATA_TORAVON)); - if (!pToravon) - return; - - uint8 num_orbs = RAID_MODE(1, 3); - for (uint8 i=0; iGetNearPoint(pToravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f); - me->SetPosition(pos, true); - DoCast(me, SPELL_FROZEN_ORB_SUMMON); + c->SetVisibility(VISIBILITY_OFF); + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_DISABLE_MOVE); + c->SetReactState(REACT_PASSIVE); + + pInstance = c->GetInstanceScript(); + spawned = false; } - } + + InstanceScript *pInstance; + bool spawned; + + void UpdateAI(const uint32 /*diff*/) + { + if (spawned) + return; + + spawned = true; + if (!pInstance) + return; + + Unit* pToravon = me->GetCreature(*me, pInstance->GetData64(DATA_TORAVON)); + if (!pToravon) + return; + + uint8 num_orbs = RAID_MODE(1, 3); + for (uint8 i=0; iGetNearPoint(pToravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f); + me->SetPosition(pos, true); + DoCast(me, SPELL_FROZEN_ORB_SUMMON); + } + } + }; + }; -CreatureAI* GetAI_boss_toravon(Creature* pCreature) -{ - return new boss_toravonAI (pCreature); -} -CreatureAI* GetAI_mob_frost_warder(Creature* pCreature) -{ - return new mob_frost_warderAI (pCreature); -} -CreatureAI* GetAI_mob_frozen_orb(Creature* pCreature) -{ - return new mob_frozen_orbAI (pCreature); -} -CreatureAI* GetAI_mob_frozen_orb_stalker(Creature* pCreature) -{ - return new mob_frozen_orb_stalkerAI (pCreature); -} void AddSC_boss_toravon() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_toravon"; - newscript->GetAI = &GetAI_boss_toravon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frost_warder"; - newscript->GetAI = &GetAI_mob_frost_warder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frozen_orb"; - newscript->GetAI = &GetAI_mob_frozen_orb; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frozen_orb_stalker"; - newscript->GetAI = &GetAI_mob_frozen_orb_stalker; - newscript->RegisterSelf(); + new boss_toravon(); + new mob_frost_warder(); + new mob_frozen_orb(); + new mob_frozen_orb_stalker(); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index e7449acafb4..5478d632a70 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -26,135 +26,138 @@ 3 - Koralon the Flame Watcher event 4 - Toravon the Ice Watcher event */ - -struct instance_archavon : public ScriptedInstance + class instance_archavon : public InstanceMapScript { - instance_archavon(Map *Map) : ScriptedInstance(Map) {}; +public: + instance_archavon() : InstanceMapScript("instance_archavon") { } - uint32 uiEncounters[ENCOUNTERS]; - - uint64 uiArchavon; - uint64 uiEmalon; - uint64 uiKoralon; - uint64 uiToravon; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* map) { - uiArchavon = 0; - uiEmalon = 0; - uiKoralon = 0; - uiToravon = 0; - - for (uint8 i = 0; i < ENCOUNTERS; i++) - uiEncounters[i] = NOT_STARTED; + return new instance_archavon_InstanceMapScript(map); } - bool IsEncounterInProgress() const + struct instance_archavon_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < ENCOUNTERS; i++) - if (uiEncounters[i] == IN_PROGRESS) - return true; + instance_archavon_InstanceMapScript(Map *Map) : InstanceScript(Map) {}; - return false; - } + uint32 uiEncounters[ENCOUNTERS]; - void OnCreatureCreate(Creature *creature, bool /*add*/) - { - switch(creature->GetEntry()) + uint64 uiArchavon; + uint64 uiEmalon; + uint64 uiKoralon; + uint64 uiToravon; + + void Initialize() { - case CREATURE_ARCHAVON: uiArchavon = creature->GetGUID(); break; - case CREATURE_EMALON: uiEmalon = creature->GetGUID(); break; - case CREATURE_KORALON: uiKoralon = creature->GetGUID(); break; - case CREATURE_TORAVON: uiToravon = creature->GetGUID(); break; - } - } + uiArchavon = 0; + uiEmalon = 0; + uiKoralon = 0; + uiToravon = 0; - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_ARCHAVON_EVENT: return uiEncounters[0]; - case DATA_EMALON_EVENT: return uiEncounters[1]; - case DATA_KORALON_EVENT: return uiEncounters[2]; - case DATA_TORAVON_EVENT: return uiEncounters[3]; - } - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_ARCHAVON: return uiArchavon; - case DATA_EMALON: return uiEmalon; - case DATA_KORALON: return uiKoralon; - case DATA_TORAVON: return uiToravon; - } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_ARCHAVON_EVENT: uiEncounters[0] = data; break; - case DATA_EMALON_EVENT: uiEncounters[1] = data; break; - case DATA_KORALON_EVENT: uiEncounters[2] = data; break; - case DATA_TORAVON_EVENT: uiEncounters[3] = data; break; - } - - if (data == DONE) - SaveToDB(); - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << uiEncounters[0] << " " << uiEncounters[1] << " " << uiEncounters[2] << " " << uiEncounters[3]; - - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - - return NULL; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream stream(in); - stream >> uiEncounters[0] >> uiEncounters[1] >> uiEncounters[2] >> uiEncounters[3]; - - for (uint8 i = 0; i < ENCOUNTERS; ++i) - if (uiEncounters[i] == IN_PROGRESS) + for (uint8 i = 0; i < ENCOUNTERS; i++) uiEncounters[i] = NOT_STARTED; + } + + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < ENCOUNTERS; i++) + if (uiEncounters[i] == IN_PROGRESS) + return true; + + return false; + } + + void OnCreatureCreate(Creature *creature, bool /*add*/) + { + switch(creature->GetEntry()) + { + case CREATURE_ARCHAVON: uiArchavon = creature->GetGUID(); break; + case CREATURE_EMALON: uiEmalon = creature->GetGUID(); break; + case CREATURE_KORALON: uiKoralon = creature->GetGUID(); break; + case CREATURE_TORAVON: uiToravon = creature->GetGUID(); break; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_ARCHAVON_EVENT: return uiEncounters[0]; + case DATA_EMALON_EVENT: return uiEncounters[1]; + case DATA_KORALON_EVENT: return uiEncounters[2]; + case DATA_TORAVON_EVENT: return uiEncounters[3]; + } + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_ARCHAVON: return uiArchavon; + case DATA_EMALON: return uiEmalon; + case DATA_KORALON: return uiKoralon; + case DATA_TORAVON: return uiToravon; + } + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_ARCHAVON_EVENT: uiEncounters[0] = data; break; + case DATA_EMALON_EVENT: uiEncounters[1] = data; break; + case DATA_KORALON_EVENT: uiEncounters[2] = data; break; + case DATA_TORAVON_EVENT: uiEncounters[3] = data; break; + } + + if (data == DONE) + SaveToDB(); + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << uiEncounters[0] << " " << uiEncounters[1] << " " << uiEncounters[2] << " " << uiEncounters[3]; + + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + + return NULL; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream stream(in); + stream >> uiEncounters[0] >> uiEncounters[1] >> uiEncounters[2] >> uiEncounters[3]; + + for (uint8 i = 0; i < ENCOUNTERS; ++i) + if (uiEncounters[i] == IN_PROGRESS) + uiEncounters[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_archavon(Map* map) -{ - return new instance_archavon(map); -} void AddSC_instance_archavon() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_archavon"; - newscript->GetInstanceData = &GetInstanceData_instance_archavon; - newscript->RegisterSelf(); + new instance_archavon(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 8e760ba00c6..937a0bcb3a2 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -44,118 +44,120 @@ enum Yells SAY_SPECIAL_ATTACK_1 = -1608008, SAY_SPECIAL_ATTACK_2 = -1608009 }; - -struct boss_cyanigosaAI : public ScriptedAI + class boss_cyanigosa : public CreatureScript { - boss_cyanigosaAI(Creature *c) : ScriptedAI(c) +public: + boss_cyanigosa() : CreatureScript("boss_cyanigosa") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_cyanigosaAI (pCreature); } - uint32 uiArcaneVacuumTimer; - uint32 uiBlizzardTimer; - uint32 uiManaDestructionTimer; - uint32 uiTailSweepTimer; - uint32 uiUncontrollableEnergyTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_cyanigosaAI : public ScriptedAI { - uiArcaneVacuumTimer = 10000; - uiBlizzardTimer = 15000; - uiManaDestructionTimer = 30000; - uiTailSweepTimer = 20000; - uiUncontrollableEnergyTimer = 25000; - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); - } - - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_REMOVE_NPC) == 1) + boss_cyanigosaAI(Creature *c) : ScriptedAI(c) { - me->ForcedDespawn(); - pInstance->SetData(DATA_REMOVE_NPC, 0); + pInstance = c->GetInstanceScript(); } - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 uiArcaneVacuumTimer; + uint32 uiBlizzardTimer; + uint32 uiManaDestructionTimer; + uint32 uiTailSweepTimer; + uint32 uiUncontrollableEnergyTimer; - if (uiArcaneVacuumTimer <= diff) + InstanceScript* pInstance; + + void Reset() { - DoCast(SPELL_ARCANE_VACUUM); uiArcaneVacuumTimer = 10000; - } else uiArcaneVacuumTimer -= diff; - - if (uiBlizzardTimer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_BLIZZARD); uiBlizzardTimer = 15000; - } else uiBlizzardTimer -= diff; - - if (uiTailSweepTimer <= diff) - { - DoCast(SPELL_TAIL_SWEEP); + uiManaDestructionTimer = 30000; uiTailSweepTimer = 20000; - } else uiTailSweepTimer -= diff; - - if (uiUncontrollableEnergyTimer <= diff) - { - DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); uiUncontrollableEnergyTimer = 25000; - } else uiUncontrollableEnergyTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, NOT_STARTED); + } - if (IsHeroic()) - if (uiManaDestructionTimer <= diff) + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, IN_PROGRESS); + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (pInstance && pInstance->GetData(DATA_REMOVE_NPC) == 1) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MANA_DESTRUCTION); - uiManaDestructionTimer = 30000; - } else uiManaDestructionTimer -= diff; + me->ForcedDespawn(); + pInstance->SetData(DATA_REMOVE_NPC, 0); + } - DoMeleeAttackIfReady(); - } + //Return since we have no target + if (!UpdateVictim()) + return; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (uiArcaneVacuumTimer <= diff) + { + DoCast(SPELL_ARCANE_VACUUM); + uiArcaneVacuumTimer = 10000; + } else uiArcaneVacuumTimer -= diff; - if (pInstance) - pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); - } + if (uiBlizzardTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_BLIZZARD); + uiBlizzardTimer = 15000; + } else uiBlizzardTimer -= diff; + + if (uiTailSweepTimer <= diff) + { + DoCast(SPELL_TAIL_SWEEP); + uiTailSweepTimer = 20000; + } else uiTailSweepTimer -= diff; + + if (uiUncontrollableEnergyTimer <= diff) + { + DoCastVictim(SPELL_UNCONTROLLABLE_ENERGY); + uiUncontrollableEnergyTimer = 25000; + } else uiUncontrollableEnergyTimer -= diff; + + if (IsHeroic()) + if (uiManaDestructionTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MANA_DESTRUCTION); + uiManaDestructionTimer = 30000; + } else uiManaDestructionTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_CYANIGOSA_EVENT, DONE); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_cyanigosa(Creature* pCreature) -{ - return new boss_cyanigosaAI (pCreature); -} void AddSC_boss_cyanigosa() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_cyanigosa"; - newscript->GetAI = &GetAI_boss_cyanigosa; - newscript->RegisterSelf(); + new boss_cyanigosa(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index d25f87ca230..5a61a91eacc 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -42,207 +42,214 @@ enum Yells SAY_ADD_KILLED = -1608016, SAY_BOTH_ADDS_KILLED = -1608017 }; - -struct boss_erekemAI : public ScriptedAI + class boss_erekem : public CreatureScript { - boss_erekemAI(Creature *c) : ScriptedAI(c) +public: + boss_erekem() : CreatureScript("boss_erekem") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_erekemAI (pCreature); } - uint32 uiBloodlustTimer; - uint32 uiChainHealTimer; - uint32 uiEarthShockTimer; - uint32 uiLightningBoltTimer; - uint32 uiEarthShieldTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_erekemAI : public ScriptedAI { - uiBloodlustTimer = 15000; - uiChainHealTimer = 0; - uiEarthShockTimer = urand(2000,8000); - uiLightningBoltTimer = urand(5000,10000); - uiEarthShieldTimer = 20000; - if (pInstance) + boss_erekemAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) - { - if (!pGuard1->isAlive()) - pGuard1->Respawn(); - } - if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) - { - if (!pGuard2->isAlive()) - pGuard2->Respawn(); - } - } + uint32 uiBloodlustTimer; + uint32 uiChainHealTimer; + uint32 uiEarthShockTimer; + uint32 uiLightningBoltTimer; + uint32 uiEarthShieldTimer; - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + InstanceScript* pInstance; - if (me->Attack(pWho, true)) + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + uiBloodlustTimer = 15000; + uiChainHealTimer = 0; + uiEarthShockTimer = urand(2000,8000); + uiLightningBoltTimer = urand(5000,10000); + uiEarthShieldTimer = 20000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) { - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - if (!pGuard1->getVictim() && pGuard1->AI()) - pGuard1->AI()->AttackStart(pWho); + if (!pGuard1->isAlive()) + pGuard1->Respawn(); } if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) { - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - if (!pGuard2->getVictim() && pGuard2->AI()) - pGuard2->AI()->AttackStart(pWho); + if (!pGuard2->isAlive()) + pGuard2->Respawn(); } } - } - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - DoCast(me, SPELL_EARTH_SHIELD); - - if (pInstance) + void AttackStart(Unit* pWho) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EREKEM_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //spam stormstrike in hc mode if spawns are dead - if (IsHeroic()) - { - if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + if (me->Attack(pWho, true)) { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + + if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + { + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + if (!pGuard1->getVictim() && pGuard1->AI()) + pGuard1->AI()->AttackStart(pWho); + } if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) { - if (!pGuard1->isAlive() && !pGuard2->isAlive()) - DoCast(me->getVictim(), SPELL_STORMSTRIKE); + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + if (!pGuard2->getVictim() && pGuard2->AI()) + pGuard2->AI()->AttackStart(pWho); } } } - if (uiEarthShieldTimer <= diff) + void EnterCombat(Unit* /*pWho*/) { + DoScriptText(SAY_AGGRO, me); DoCast(me, SPELL_EARTH_SHIELD); - uiEarthShieldTimer = 20000; - } else uiEarthShieldTimer -= diff; - if (uiChainHealTimer <= diff) - { - if (uint64 TargetGUID = GetChainHealTargetGUID()) + if (pInstance) { - if (Creature *pTarget = Unit::GetCreature(*me, TargetGUID)) - DoCast(pTarget, SPELL_CHAIN_HEAL); + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_EREKEM_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } - //If one of the adds is dead spawn heals faster - Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); - Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); - uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; - } - } else uiChainHealTimer -= diff; - - if (uiBloodlustTimer <= diff) - { - DoCast(me, SPELL_BLOODLUST); - uiBloodlustTimer = urand(35000,45000); - } else uiBloodlustTimer -= diff; - - if (uiEarthShockTimer <= diff) - { - DoCast(me->getVictim(), SPELL_EARTH_SHOCK); - uiEarthShockTimer = urand(8000,13000); - } else uiEarthShockTimer -= diff; - - if (uiLightningBoltTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_LIGHTNING_BOLT); - uiLightningBoltTimer = urand(18000,24000); - } else uiLightningBoltTimer -= diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + void MoveInLineOfSight(Unit* /*who*/) {} - uint64 GetChainHealTargetGUID() - { - if (HealthBelowPct(85)) - return me->GetGUID(); + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); - if (pGuard1 && pGuard1->isAlive() && (pGuard1->GetHealth()*100 <= pGuard1->GetMaxHealth() * 75)) - return pGuard1->GetGUID(); + //spam stormstrike in hc mode if spawns are dead + if (IsHeroic()) + { + if (Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0)) + { + if (Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0)) + { + if (!pGuard1->isAlive() && !pGuard2->isAlive()) + DoCast(me->getVictim(), SPELL_STORMSTRIKE); + } + } + } - Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); - if (pGuard2 && pGuard2->isAlive() && (pGuard2->GetHealth()*100 <= pGuard2->GetMaxHealth() * 75)) - return pGuard2->GetGUID(); + if (uiEarthShieldTimer <= diff) + { + DoCast(me, SPELL_EARTH_SHIELD); + uiEarthShieldTimer = 20000; + } else uiEarthShieldTimer -= diff; + + if (uiChainHealTimer <= diff) + { + if (uint64 TargetGUID = GetChainHealTargetGUID()) + { + if (Creature *pTarget = Unit::GetCreature(*me, TargetGUID)) + DoCast(pTarget, SPELL_CHAIN_HEAL); + + //If one of the adds is dead spawn heals faster + Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); + Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); + uiChainHealTimer = ((pGuard1 && !pGuard1->isAlive()) || (pGuard2 && !pGuard2->isAlive()) ? 3000 : 8000) + rand()%3000; + } + } else uiChainHealTimer -= diff; + + if (uiBloodlustTimer <= diff) + { + DoCast(me, SPELL_BLOODLUST); + uiBloodlustTimer = urand(35000,45000); + } else uiBloodlustTimer -= diff; + + if (uiEarthShockTimer <= diff) + { + DoCast(me->getVictim(), SPELL_EARTH_SHOCK); + uiEarthShockTimer = urand(8000,13000); + } else uiEarthShockTimer -= diff; + + if (uiLightningBoltTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_LIGHTNING_BOLT); + uiLightningBoltTimer = urand(18000,24000); + } else uiLightningBoltTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + uint64 GetChainHealTargetGUID() + { + if (HealthBelowPct(85)) + return me->GetGUID(); + + Creature *pGuard1 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_1) : 0); + if (pGuard1 && pGuard1->isAlive() && (pGuard1->GetHealth()*100 <= pGuard1->GetMaxHealth() * 75)) + return pGuard1->GetGUID(); + + Creature *pGuard2 = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_EREKEM_GUARD_2) : 0); + if (pGuard2 && pGuard2->isAlive() && (pGuard2->GetHealth()*100 <= pGuard2->GetMaxHealth() * 75)) + return pGuard2->GetGUID(); + + return 0; + } + }; - return 0; - } }; -CreatureAI* GetAI_boss_erekem(Creature* pCreature) -{ - return new boss_erekemAI (pCreature); -} enum GuardSpells { @@ -250,86 +257,84 @@ enum GuardSpells SPELL_HOWLING_SCREECH = 54462, SPELL_STRIKE = 14516 }; - -struct mob_erekem_guardAI : public ScriptedAI + class mob_erekem_guard : public CreatureScript { - mob_erekem_guardAI(Creature *c) : ScriptedAI(c) +public: + mob_erekem_guard() : CreatureScript("mob_erekem_guard") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_erekem_guardAI (pCreature); } - uint32 uiGushingWoundTimer; - uint32 uiHowlingScreechTimer; - uint32 uiStrikeTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct mob_erekem_guardAI : public ScriptedAI { - uiStrikeTimer = urand(4000,8000); - uiHowlingScreechTimer = urand(8000,13000); - uiGushingWoundTimer = urand(1000,3000); - } - - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) + mob_erekem_guardAI(Creature *c) : ScriptedAI(c) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + pInstance = c->GetInstanceScript(); } - } - void MoveInLineOfSight(Unit* /*who*/) {} + uint32 uiGushingWoundTimer; + uint32 uiHowlingScreechTimer; + uint32 uiStrikeTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - DoMeleeAttackIfReady(); - - if (uiStrikeTimer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_STRIKE); uiStrikeTimer = urand(4000,8000); - } else uiStrikeTimer -= diff; - - if (uiHowlingScreechTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HOWLING_SCREECH); uiHowlingScreechTimer = urand(8000,13000); - } else uiHowlingScreechTimer -= diff; + uiGushingWoundTimer = urand(1000,3000); + } - if (uiGushingWoundTimer <= diff) + void AttackStart(Unit* pWho) { - DoCast(me->getVictim(), SPELL_GUSHING_WOUND); - uiGushingWoundTimer = urand(7000,12000); - } else uiGushingWoundTimer -= diff; - } + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + + if (uiStrikeTimer <= diff) + { + DoCast(me->getVictim(), SPELL_STRIKE); + uiStrikeTimer = urand(4000,8000); + } else uiStrikeTimer -= diff; + + if (uiHowlingScreechTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HOWLING_SCREECH); + uiHowlingScreechTimer = urand(8000,13000); + } else uiHowlingScreechTimer -= diff; + + if (uiGushingWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GUSHING_WOUND); + uiGushingWoundTimer = urand(7000,12000); + } else uiGushingWoundTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_erekem_guard(Creature* pCreature) -{ - return new mob_erekem_guardAI (pCreature); -} void AddSC_boss_erekem() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_erekem"; - newscript->GetAI = &GetAI_boss_erekem; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_erekem_guard"; - newscript->GetAI = &GetAI_mob_erekem_guard; - newscript->RegisterSelf(); + new boss_erekem(); + new mob_erekem_guard(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index fe216d8db4e..f101c36cfb9 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -70,326 +70,331 @@ static Position SpawnLoc[MAX_SPAWN_LOC]= {1918.97, 850.645, 47.225, 4.136}, {1935.50, 796.224, 52.492, 4.224}, }; - -struct boss_ichoronAI : public ScriptedAI + class boss_ichoron : public CreatureScript { - boss_ichoronAI(Creature* pCreature) : ScriptedAI(pCreature), m_waterElements(pCreature) +public: + boss_ichoron() : CreatureScript("boss_ichoron") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_ichoronAI (pCreature); } - bool bIsExploded; - bool bIsFrenzy; - bool bAchievement; - - uint32 uiBubbleCheckerTimer; - uint32 uiWaterBoltVolleyTimer; - - ScriptedInstance* pInstance; - - SummonList m_waterElements; - - void Reset() + struct boss_ichoronAI : public ScriptedAI { - bIsExploded = false; - bIsFrenzy = false; - bAchievement = true; - uiBubbleCheckerTimer = 1000; - uiWaterBoltVolleyTimer = urand(10000, 15000); - - me->SetVisibility(VISIBILITY_ON); - DespawnWaterElements(); - - if (pInstance) + boss_ichoronAI(Creature* pCreature) : ScriptedAI(pCreature), m_waterElements(pCreature) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - } - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - - DoCast(me, SPELL_PROTECTIVE_BUBBLE); - - if (pInstance) - { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ICHORON_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); - } - } - - void DoAction(const int32 param) - { - if (!me->isAlive()) - return; - - switch(param) - { - case ACTION_WATER_ELEMENT_HIT: - me->SetHealth(me->GetHealth() + me->GetMaxHealth() * 0.01); - - if (bIsExploded) - DoExplodeCompleted(); - - bAchievement = false; - break; - case ACTION_WATER_ELEMENT_KILLED: - uint32 damage = (me->GetMaxHealth()*3)/100; - me->SetHealth(me->GetHealth() - damage); - me->LowerPlayerDamageReq(damage); - break; - } - } - - void DespawnWaterElements() - { - m_waterElements.DespawnAll(); - } - - // call when explode shall stop. - // either when "hit" by a bubble, or when there is no bubble left. - void DoExplodeCompleted() - { - bIsExploded = false; - - if (!HealthBelowPct(25)) - { - DoScriptText(SAY_BUBBLE, me); - DoCast(me, SPELL_PROTECTIVE_BUBBLE, true); + pInstance = pCreature->GetInstanceScript(); } - me->SetVisibility(VISIBILITY_ON); - me->GetMotionMaster()->MoveChase(me->getVictim()); - } + bool bIsExploded; + bool bIsFrenzy; + bool bAchievement; - void MoveInLineOfSight(Unit* /*pWho*/) {} + uint32 uiBubbleCheckerTimer; + uint32 uiWaterBoltVolleyTimer; - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded) + SummonList m_waterElements; + + void Reset() { - DoScriptText(SAY_ENRAGE, me); - DoCast(me, SPELL_FRENZY, true); - bIsFrenzy = true; - } + bIsExploded = false; + bIsFrenzy = false; + bAchievement = true; + uiBubbleCheckerTimer = 1000; + uiWaterBoltVolleyTimer = urand(10000, 15000); - if (!bIsFrenzy) - { - if (uiBubbleCheckerTimer <= uiDiff) + me->SetVisibility(VISIBILITY_ON); + DespawnWaterElements(); + + if (pInstance) { - if (!bIsExploded) - { - if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0)) + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + + DoCast(me, SPELL_PROTECTIVE_BUBBLE); + + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ICHORON_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) { - DoScriptText(SAY_SHATTER, me); - DoCast(me, SPELL_WATER_BLAST); - DoCast(me, SPELL_DRAINED); - bIsExploded = true; - me->AttackStop(); - me->SetVisibility(VISIBILITY_OFF); - for (uint8 i = 0; i < 10; i++) + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + + void AttackStart(Unit* pWho) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void DoAction(const int32 param) + { + if (!me->isAlive()) + return; + + switch(param) + { + case ACTION_WATER_ELEMENT_HIT: + me->SetHealth(me->GetHealth() + me->GetMaxHealth() * 0.01); + + if (bIsExploded) + DoExplodeCompleted(); + + bAchievement = false; + break; + case ACTION_WATER_ELEMENT_KILLED: + uint32 damage = (me->GetMaxHealth()*3)/100; + me->SetHealth(me->GetHealth() - damage); + me->LowerPlayerDamageReq(damage); + break; + } + } + + void DespawnWaterElements() + { + m_waterElements.DespawnAll(); + } + + // call when explode shall stop. + // either when "hit" by a bubble, or when there is no bubble left. + void DoExplodeCompleted() + { + bIsExploded = false; + + if (!HealthBelowPct(25)) + { + DoScriptText(SAY_BUBBLE, me); + DoCast(me, SPELL_PROTECTIVE_BUBBLE, true); + } + + me->SetVisibility(VISIBILITY_ON); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + + void MoveInLineOfSight(Unit* /*pWho*/) {} + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded) + { + DoScriptText(SAY_ENRAGE, me); + DoCast(me, SPELL_FRENZY, true); + bIsFrenzy = true; + } + + if (!bIsFrenzy) + { + if (uiBubbleCheckerTimer <= uiDiff) + { + if (!bIsExploded) + { + if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0)) { - int tmp = urand(0, MAX_SPAWN_LOC-1); - me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN); + DoScriptText(SAY_SHATTER, me); + DoCast(me, SPELL_WATER_BLAST); + DoCast(me, SPELL_DRAINED); + bIsExploded = true; + me->AttackStop(); + me->SetVisibility(VISIBILITY_OFF); + for (uint8 i = 0; i < 10; i++) + { + int tmp = urand(0, MAX_SPAWN_LOC-1); + me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN); + } + } + } + else + { + bool bIsWaterElementsAlive = false; + if (!m_waterElements.empty()) + { + for (std::list::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) + if (Creature* pTemp = Unit::GetCreature(*me, *itr)) + if (pTemp->isAlive()) + { + bIsWaterElementsAlive = true; + break; + } + } + + if (!bIsWaterElementsAlive) + DoExplodeCompleted(); + } + uiBubbleCheckerTimer = 1000; + } + else uiBubbleCheckerTimer -= uiDiff; + } + + if (!bIsExploded) + { + if (uiWaterBoltVolleyTimer <= uiDiff) + { + DoCast(me, SPELL_WATER_BOLT_VOLLEY); + uiWaterBoltVolleyTimer = urand(10000, 15000); + } + else uiWaterBoltVolleyTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (bIsExploded) + { + bIsExploded = false; + me->SetVisibility(VISIBILITY_ON); + } + + DespawnWaterElements(); + + if (pInstance) + { + if (IsHeroic() && bAchievement) + pInstance->DoCompleteAchievement(ACHIEVEMENT_DEHYDRATION); + + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); + } + } + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned) + { + pSummoned->SetSpeed(MOVE_RUN, 0.3f); + pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); + m_waterElements.push_back(pSummoned->GetGUID()); + pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); + } + } + + + void SummonedCreatureDespawn(Creature *pSummoned) + { + if (pSummoned) + { + m_waterElements.remove(pSummoned->GetGUID()); + pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); + } + } + + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; + +}; + + class mob_ichor_globule : public CreatureScript +{ +public: + mob_ichor_globule() : CreatureScript("mob_ichor_globule") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ichor_globuleAI (pCreature); + } + + struct mob_ichor_globuleAI : public ScriptedAI + { + mob_ichor_globuleAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiRangeCheck_Timer; + + void Reset() + { + uiRangeCheck_Timer = 1000; + } + + void AttackStart(Unit* /*pWho*/) + { + return; + } + + void UpdateAI(const uint32 uiDiff) + { + if (uiRangeCheck_Timer < uiDiff) + { + if (pInstance) + { + if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) + { + if (me->IsWithinDist(pIchoron, 2.0f , false)) + { + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); + me->ForcedDespawn(); } } } - else - { - bool bIsWaterElementsAlive = false; - if (!m_waterElements.empty()) - { - for (std::list::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr) - if (Creature* pTemp = Unit::GetCreature(*me, *itr)) - if (pTemp->isAlive()) - { - bIsWaterElementsAlive = true; - break; - } - } - - if (!bIsWaterElementsAlive) - DoExplodeCompleted(); - } - uiBubbleCheckerTimer = 1000; + uiRangeCheck_Timer = 1000; } - else uiBubbleCheckerTimer -= uiDiff; + else uiRangeCheck_Timer -= uiDiff; } - if (!bIsExploded) + void JustDied(Unit* /*pKiller*/) { - if (uiWaterBoltVolleyTimer <= uiDiff) - { - DoCast(me, SPELL_WATER_BOLT_VOLLEY); - uiWaterBoltVolleyTimer = urand(10000, 15000); - } - else uiWaterBoltVolleyTimer -= uiDiff; - - DoMeleeAttackIfReady(); + DoCast(me, SPELL_SPLASH); + if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) + if (pIchoron->AI()) + pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); } - } + }; - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (bIsExploded) - { - bIsExploded = false; - me->SetVisibility(VISIBILITY_ON); - } - - DespawnWaterElements(); - - if (pInstance) - { - if (IsHeroic() && bAchievement) - pInstance->DoCompleteAchievement(ACHIEVEMENT_DEHYDRATION); - - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); - } - } - } - - void JustSummoned(Creature* pSummoned) - { - if (pSummoned) - { - pSummoned->SetSpeed(MOVE_RUN, 0.3f); - pSummoned->GetMotionMaster()->MoveFollow(me, 0, 0); - m_waterElements.push_back(pSummoned->GetGUID()); - pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); - } - } - - - void SummonedCreatureDespawn(Creature *pSummoned) - { - if (pSummoned) - { - m_waterElements.remove(pSummoned->GetGUID()); - pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); - } - } - - void KilledUnit(Unit * victim) - { - if (victim == me) - return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_ichoron(Creature* pCreature) -{ - return new boss_ichoronAI (pCreature); -} - -struct mob_ichor_globuleAI : public ScriptedAI -{ - mob_ichor_globuleAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiRangeCheck_Timer; - - void Reset() - { - uiRangeCheck_Timer = 1000; - } - - void AttackStart(Unit* /*pWho*/) - { - return; - } - - void UpdateAI(const uint32 uiDiff) - { - if (uiRangeCheck_Timer < uiDiff) - { - if (pInstance) - { - if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) - { - if (me->IsWithinDist(pIchoron, 2.0f , false)) - { - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_HIT); - me->ForcedDespawn(); - } - } - } - uiRangeCheck_Timer = 1000; - } - else uiRangeCheck_Timer -= uiDiff; - } - - void JustDied(Unit* /*pKiller*/) - { - DoCast(me, SPELL_SPLASH); - if (Creature* pIchoron = Unit::GetCreature(*me, pInstance->GetData64(DATA_ICHORON))) - if (pIchoron->AI()) - pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED); - } -}; - -CreatureAI* GetAI_mob_ichor_globule(Creature* pCreature) -{ - return new mob_ichor_globuleAI (pCreature); -} void AddSC_boss_ichoron() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_ichoron"; - newscript->GetAI = &GetAI_boss_ichoron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ichor_globule"; - newscript->GetAI = &GetAI_mob_ichor_globule; - newscript->RegisterSelf(); + new boss_ichoron(); + new mob_ichor_globule(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index 7a86fedf849..2a41ac671a1 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -28,134 +28,136 @@ enum Spells SPELL_LAVA_BURN = 54249, H_SPELL_LAVA_BURN = 59594 }; - -struct boss_lavanthorAI : public ScriptedAI + class boss_lavanthor : public CreatureScript { - boss_lavanthorAI(Creature *c) : ScriptedAI(c) +public: + boss_lavanthor() : CreatureScript("boss_lavanthor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_lavanthorAI (pCreature); } - uint32 uiFireboltTimer; - uint32 uiFlameBreathTimer; - uint32 uiLavaBurnTimer; - uint32 uiCauterizingFlamesTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_lavanthorAI : public ScriptedAI { - uiFireboltTimer = 1000; - uiFlameBreathTimer = 5000; - uiLavaBurnTimer = 10000; - uiCauterizingFlamesTimer = 3000; - if (pInstance) + boss_lavanthorAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) + uint32 uiFireboltTimer; + uint32 uiFlameBreathTimer; + uint32 uiLavaBurnTimer; + uint32 uiCauterizingFlamesTimer; + + InstanceScript* pInstance; + + void Reset() { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_LAVANTHOR_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) + uiFireboltTimer = 1000; + uiFlameBreathTimer = 5000; + uiLavaBurnTimer = 10000; + uiCauterizingFlamesTimer = 3000; + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_LAVANTHOR_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + + void AttackStart(Unit* pWho) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiFireboltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBOLT); + uiFireboltTimer = urand(5000,13000); + } else uiFireboltTimer -= diff; + + if (uiFlameBreathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAME_BREATH); + uiFlameBreathTimer = urand(10000,15000); + } else uiFlameBreathTimer -= diff; + + if (uiLavaBurnTimer <= diff) + { + DoCast(me->getVictim(), SPELL_LAVA_BURN); + uiLavaBurnTimer = urand(15000,23000); + } + + if (IsHeroic()) + { + if (uiCauterizingFlamesTimer <= diff) { - EnterEvadeMode(); - return; + DoCast(me->getVictim(), SPELL_CAUTERIZING_FLAMES); + uiCauterizingFlamesTimer = urand(10000,16000); + } else uiCauterizingFlamesTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); - } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiFireboltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FIREBOLT); - uiFireboltTimer = urand(5000,13000); - } else uiFireboltTimer -= diff; - - if (uiFlameBreathTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAME_BREATH); - uiFlameBreathTimer = urand(10000,15000); - } else uiFlameBreathTimer -= diff; - - if (uiLavaBurnTimer <= diff) - { - DoCast(me->getVictim(), SPELL_LAVA_BURN); - uiLavaBurnTimer = urand(15000,23000); - } - - if (IsHeroic()) - { - if (uiCauterizingFlamesTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CAUTERIZING_FLAMES); - uiCauterizingFlamesTimer = urand(10000,16000); - } else uiCauterizingFlamesTimer -= diff; - } - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); } } - } + }; + }; -CreatureAI* GetAI_boss_lavanthor(Creature* pCreature) -{ - return new boss_lavanthorAI (pCreature); -} void AddSC_boss_lavanthor() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_lavanthor"; - newscript->GetAI = &GetAI_boss_lavanthor; - newscript->RegisterSelf(); + new boss_lavanthor(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 0abcbbf720c..ace7a7b2304 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -24,116 +24,118 @@ enum Spells SPELL_CORROSIVE_SALIVA = 54527, SPELL_OPTIC_LINK = 54396 }; - -struct boss_moraggAI : public ScriptedAI + class boss_moragg : public CreatureScript { - boss_moraggAI(Creature *c) : ScriptedAI(c) +public: + boss_moragg() : CreatureScript("boss_moragg") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_moraggAI (pCreature); } - uint32 uiOpticLinkTimer; - uint32 uiCorrosiveSalivaTimer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_moraggAI : public ScriptedAI { - uiOpticLinkTimer = 10000; - uiCorrosiveSalivaTimer = 5000; - - if (pInstance) + boss_moraggAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit* /*who*/) - { - if (pInstance) + uint32 uiOpticLinkTimer; + uint32 uiCorrosiveSalivaTimer; + + InstanceScript* pInstance; + + void Reset() { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MORAGG_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; + uiOpticLinkTimer = 10000; + uiCorrosiveSalivaTimer = 5000; + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MORAGG_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + + void AttackStart(Unit* pWho) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiOpticLinkTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_OPTIC_LINK); + uiOpticLinkTimer = 15000; + } else uiOpticLinkTimer -= diff; + + if (uiCorrosiveSalivaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVE_SALIVA); + uiCorrosiveSalivaTimer = 10000; + } else uiCorrosiveSalivaTimer -= diff; + + DoMeleeAttackIfReady(); + } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT,13); } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); - } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiOpticLinkTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_OPTIC_LINK); - uiOpticLinkTimer = 15000; - } else uiOpticLinkTimer -= diff; - - if (uiCorrosiveSalivaTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CORROSIVE_SALIVA); - uiCorrosiveSalivaTimer = 10000; - } else uiCorrosiveSalivaTimer -= diff; - - DoMeleeAttackIfReady(); - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT,13); } } - } + }; + }; -CreatureAI* GetAI_boss_moragg(Creature* pCreature) -{ - return new boss_moraggAI (pCreature); -} void AddSC_boss_moragg() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_moragg"; - newscript->GetAI = &GetAI_boss_moragg; - newscript->RegisterSelf(); + new boss_moragg(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 8fb3f200852..14ccba54392 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -56,246 +56,251 @@ enum Yells SAY_REPEAT_SUMMON_2 = -1608035, SAY_SUMMON_ENERGY = -1608036 }; - -struct boss_xevozzAI : public ScriptedAI + class boss_xevozz : public CreatureScript { - boss_xevozzAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + boss_xevozz() : CreatureScript("boss_xevozz") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new boss_xevozzAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 uiSummonEtherealSphere_Timer; - uint32 uiArcaneBarrageVolley_Timer; - uint32 uiArcaneBuffet_Timer; - - void Reset() + struct boss_xevozzAI : public ScriptedAI { - if (pInstance) + boss_xevozzAI(Creature* pCreature) : ScriptedAI(pCreature) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = pCreature->GetInstanceScript(); } - uiSummonEtherealSphere_Timer = urand(10000, 12000); - uiArcaneBarrageVolley_Timer = urand(20000, 22000); - uiArcaneBuffet_Timer = uiSummonEtherealSphere_Timer + urand(5000, 6000); - DespawnSphere(); - } + InstanceScript* pInstance; - void DespawnSphere() - { - std::list assistList; - GetCreatureListWithEntryInGrid(assistList,me, NPC_ETHEREAL_SPHERE ,150.0f); + uint32 uiSummonEtherealSphere_Timer; + uint32 uiArcaneBarrageVolley_Timer; + uint32 uiArcaneBuffet_Timer; - if (assistList.empty()) - return; - - for (std::list::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) - { - if (Creature* pSphere = *iter) - pSphere->Kill(pSphere, false); - } - } - - void JustSummoned(Creature* pSummoned) - { - pSummoned->SetSpeed(MOVE_RUN, 0.5f); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - pSummoned->AddThreat(pTarget, 0.00f); - pSummoned->AI()->AttackStart(pTarget); - } - } - - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; - - if (me->Attack(pWho, true)) - { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); - } - } - - void EnterCombat(Unit* /*pWho*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_XEVOZZ_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) - { - EnterEvadeMode(); - return; - } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void MoveInLineOfSight(Unit* /*pWho*/) {} - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (uiArcaneBarrageVolley_Timer < uiDiff) - { - DoCast(me, SPELL_ARCANE_BARRAGE_VOLLEY); - uiArcaneBarrageVolley_Timer = urand(20000, 22000); - } - else uiArcaneBarrageVolley_Timer -= uiDiff; - - if (uiArcaneBuffet_Timer) - if (uiArcaneBuffet_Timer < uiDiff) - { - DoCast(me->getVictim(), SPELL_ARCANE_BUFFET); - uiArcaneBuffet_Timer = 0; - } - else uiArcaneBuffet_Timer -= uiDiff; - - if (uiSummonEtherealSphere_Timer < uiDiff) - { - DoScriptText(SAY_SPAWN, me); - DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1); - if (IsHeroic()) // extra one for heroic - me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000); - - uiSummonEtherealSphere_Timer = urand(45000, 47000); - uiArcaneBuffet_Timer = urand(5000, 6000); - } - else uiSummonEtherealSphere_Timer -= uiDiff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*pKiller*/) - { - DoScriptText(SAY_DEATH, me); - - DespawnSphere(); - - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); - pInstance->SetData(DATA_WAVE_COUNT, 13); - } - } - } - void KilledUnit(Unit* pVictim) - { - if (pVictim == me) - return; - - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } -}; - -CreatureAI* GetAI_boss_xevozz(Creature* pCreature) -{ - return new boss_xevozzAI (pCreature); -} - -struct mob_ethereal_sphereAI : public ScriptedAI -{ - mob_ethereal_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 uiSummonPlayers_Timer; - uint32 uiRangeCheck_Timer; - - void Reset() - { - uiSummonPlayers_Timer = urand(33000, 35000); - uiRangeCheck_Timer = 1000; - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!me->HasAura(SPELL_POWER_BALL_VISUAL)) - DoCast(me, SPELL_POWER_BALL_VISUAL); - - if (uiRangeCheck_Timer < uiDiff) + void Reset() { if (pInstance) { - if (Creature* pXevozz = Unit::GetCreature(*me, pInstance->GetData64(DATA_XEVOZZ))) + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + + uiSummonEtherealSphere_Timer = urand(10000, 12000); + uiArcaneBarrageVolley_Timer = urand(20000, 22000); + uiArcaneBuffet_Timer = uiSummonEtherealSphere_Timer + urand(5000, 6000); + DespawnSphere(); + } + + void DespawnSphere() + { + std::list assistList; + GetCreatureListWithEntryInGrid(assistList,me, NPC_ETHEREAL_SPHERE ,150.0f); + + if (assistList.empty()) + return; + + for (std::list::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + { + if (Creature* pSphere = *iter) + pSphere->Kill(pSphere, false); + } + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->SetSpeed(MOVE_RUN, 0.5f); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + pSummoned->AddThreat(pTarget, 0.00f); + pSummoned->AI()->AttackStart(pTarget); + } + } + + void AttackStart(Unit* pWho) + { + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void EnterCombat(Unit* /*pWho*/) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_XEVOZZ_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + + void MoveInLineOfSight(Unit* /*pWho*/) {} + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiArcaneBarrageVolley_Timer < uiDiff) + { + DoCast(me, SPELL_ARCANE_BARRAGE_VOLLEY); + uiArcaneBarrageVolley_Timer = urand(20000, 22000); + } + else uiArcaneBarrageVolley_Timer -= uiDiff; + + if (uiArcaneBuffet_Timer) + if (uiArcaneBuffet_Timer < uiDiff) { - float fDistance = me->GetDistance2d(pXevozz); - if (fDistance <= 3) - DoCast(pXevozz, SPELL_ARCANE_POWER); - else - DoCast(me, 35845); //Is it blizzlike? + DoCast(me->getVictim(), SPELL_ARCANE_BUFFET); + uiArcaneBuffet_Timer = 0; + } + else uiArcaneBuffet_Timer -= uiDiff; + + if (uiSummonEtherealSphere_Timer < uiDiff) + { + DoScriptText(SAY_SPAWN, me); + DoCast(me, SPELL_SUMMON_ETHEREAL_SPHERE_1); + if (IsHeroic()) // extra one for heroic + me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 40000); + + uiSummonEtherealSphere_Timer = urand(45000, 47000); + uiArcaneBuffet_Timer = urand(5000, 6000); + } + else uiSummonEtherealSphere_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*pKiller*/) + { + DoScriptText(SAY_DEATH, me); + + DespawnSphere(); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + { + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance->SetData(DATA_WAVE_COUNT, 13); } } - uiRangeCheck_Timer = 1000; } - else uiRangeCheck_Timer -= uiDiff; - - if (uiSummonPlayers_Timer < uiDiff) + void KilledUnit(Unit* pVictim) { - DoCast(me, SPELL_SUMMON_PLAYERS); // not working right + if (pVictim == me) + return; - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - - if (!PlayerList.isEmpty()) - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (i->getSource()->isAlive()) - DoTeleportPlayer(i->getSource(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), i->getSource()->GetOrientation()); - } - - uiSummonPlayers_Timer = urand(33000, 35000); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - else uiSummonPlayers_Timer -= uiDiff; - } + }; + }; -CreatureAI* GetAI_mob_ethereal_sphere(Creature* pCreature) + class mob_ethereal_sphere : public CreatureScript { - return new mob_ethereal_sphereAI (pCreature); -} +public: + mob_ethereal_sphere() : CreatureScript("mob_ethereal_sphere") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ethereal_sphereAI (pCreature); + } + + struct mob_ethereal_sphereAI : public ScriptedAI + { + mob_ethereal_sphereAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 uiSummonPlayers_Timer; + uint32 uiRangeCheck_Timer; + + void Reset() + { + uiSummonPlayers_Timer = urand(33000, 35000); + uiRangeCheck_Timer = 1000; + } + + void UpdateAI(const uint32 uiDiff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!me->HasAura(SPELL_POWER_BALL_VISUAL)) + DoCast(me, SPELL_POWER_BALL_VISUAL); + + if (uiRangeCheck_Timer < uiDiff) + { + if (pInstance) + { + if (Creature* pXevozz = Unit::GetCreature(*me, pInstance->GetData64(DATA_XEVOZZ))) + { + float fDistance = me->GetDistance2d(pXevozz); + if (fDistance <= 3) + DoCast(pXevozz, SPELL_ARCANE_POWER); + else + DoCast(me, 35845); //Is it blizzlike? + } + } + uiRangeCheck_Timer = 1000; + } + else uiRangeCheck_Timer -= uiDiff; + + if (uiSummonPlayers_Timer < uiDiff) + { + DoCast(me, SPELL_SUMMON_PLAYERS); // not working right + + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + + if (!PlayerList.isEmpty()) + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (i->getSource()->isAlive()) + DoTeleportPlayer(i->getSource(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), i->getSource()->GetOrientation()); + } + + uiSummonPlayers_Timer = urand(33000, 35000); + } + else uiSummonPlayers_Timer -= uiDiff; + } + }; + +}; + void AddSC_boss_xevozz() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_xevozz"; - newscript->GetAI = &GetAI_boss_xevozz; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ethereal_sphere"; - newscript->GetAI = &GetAI_mob_ethereal_sphere; - newscript->RegisterSelf(); + new boss_xevozz(); + new mob_ethereal_sphere(); } diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index ebe703aae38..2ad81179266 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -46,143 +46,145 @@ enum Yells SAY_SHIELD = -1608043, SAY_WHISPER = -1608044 }; - -struct boss_zuramatAI : public ScriptedAI + class boss_zuramat : public CreatureScript { - boss_zuramatAI(Creature *c) : ScriptedAI(c) +public: + boss_zuramat() : CreatureScript("boss_zuramat") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_zuramatAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 SpellVoidShiftTimer; - uint32 SpellSummonVoidTimer; - uint32 SpellShroudOfDarknessTimer; - - void Reset() + struct boss_zuramatAI : public ScriptedAI { - if (pInstance) + boss_zuramatAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); } - SpellShroudOfDarknessTimer = 22000; - SpellVoidShiftTimer = 15000; - SpellSummonVoidTimer = 12000; - } + InstanceScript* pInstance; - void AttackStart(Unit* pWho) - { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + uint32 SpellVoidShiftTimer; + uint32 SpellSummonVoidTimer; + uint32 SpellShroudOfDarknessTimer; - if (me->Attack(pWho, true)) + void Reset() { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - DoStartMovement(pWho); + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, NOT_STARTED); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, NOT_STARTED); + } + + SpellShroudOfDarknessTimer = 22000; + SpellVoidShiftTimer = 15000; + SpellSummonVoidTimer = 12000; } - } - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) + void AttackStart(Unit* pWho) { - if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ZURAMAT_CELL))) - if (pDoor->GetGoState() == GO_STATE_READY) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + DoStartMovement(pWho); + } + } + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + { + if (GameObject *pDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_ZURAMAT_CELL))) + if (pDoor->GetGoState() == GO_STATE_READY) + { + EnterEvadeMode(); + return; + } + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) + pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); + } + } + + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (SpellSummonVoidTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SUMMON_VOID_SENTRY, false); + SpellSummonVoidTimer = 20000; + } else SpellSummonVoidTimer -=diff; + + if (SpellVoidShiftTimer <= diff) + { + if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pUnit, SPELL_VOID_SHIFT); + SpellVoidShiftTimer = 20000; + } else SpellVoidShiftTimer -=diff; + + if (SpellShroudOfDarknessTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHROUD_OF_DARKNESS); + SpellShroudOfDarknessTimer = 20000; + } else SpellShroudOfDarknessTimer -=diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + { + if (pInstance->GetData(DATA_WAVE_COUNT) == 6) { - EnterEvadeMode(); - return; + pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 7); + } + else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) + { + pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); + pInstance->SetData(DATA_WAVE_COUNT, 13); } - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - pInstance->SetData(DATA_1ST_BOSS_EVENT, IN_PROGRESS); - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - pInstance->SetData(DATA_2ND_BOSS_EVENT, IN_PROGRESS); - } - } - - void MoveInLineOfSight(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (SpellSummonVoidTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SUMMON_VOID_SENTRY, false); - SpellSummonVoidTimer = 20000; - } else SpellSummonVoidTimer -=diff; - - if (SpellVoidShiftTimer <= diff) - { - if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_VOID_SHIFT); - SpellVoidShiftTimer = 20000; - } else SpellVoidShiftTimer -=diff; - - if (SpellShroudOfDarknessTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHROUD_OF_DARKNESS); - SpellShroudOfDarknessTimer = 20000; - } else SpellShroudOfDarknessTimer -=diff; - - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - { - if (pInstance->GetData(DATA_WAVE_COUNT) == 6) - { - pInstance->SetData(DATA_1ST_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 7); - } - else if (pInstance->GetData(DATA_WAVE_COUNT) == 12) - { - pInstance->SetData(DATA_2ND_BOSS_EVENT, DONE); - pInstance->SetData(DATA_WAVE_COUNT, 13); } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + + void JustSummoned(Creature* summon) + { + summon->AI()->AttackStart(me->getVictim()); + summon->AI()->DoCastAOE(SPELL_ZURAMAT_ADD_2); + summon->SetPhaseMask(17,true); + } + }; - void JustSummoned(Creature* summon) - { - summon->AI()->AttackStart(me->getVictim()); - summon->AI()->DoCastAOE(SPELL_ZURAMAT_ADD_2); - summon->SetPhaseMask(17,true); - } }; -CreatureAI* GetAI_boss_zuramat(Creature* pCreature) -{ - return new boss_zuramatAI (pCreature); -} void AddSC_boss_zuramat() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_zuramat"; - newscript->GetAI = &GetAI_boss_zuramat; - newscript->RegisterSelf(); + new boss_zuramat(); } diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 80051ace614..c0e7cfdbb88 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -102,709 +102,712 @@ enum Achievements { ACHIEV_DEFENSELESS = 1816 }; - -struct instance_violet_hold : public ScriptedInstance + class instance_violet_hold : public InstanceMapScript { - instance_violet_hold(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_violet_hold() : InstanceMapScript("instance_violet_hold") { } - uint64 uiMoragg; - uint64 uiErekem; - uint64 uiErekemGuard[2]; - uint64 uiIchoron; - uint64 uiLavanthor; - uint64 uiXevozz; - uint64 uiZuramat; - uint64 uiCyanigosa; - uint64 uiSinclari; - - uint64 uiMoraggCell; - uint64 uiErekemCell; - uint64 uiErekemLeftGuardCell; - uint64 uiErekemRightGuardCell; - uint64 uiIchoronCell; - uint64 uiLavanthorCell; - uint64 uiXevozzCell; - uint64 uiZuramatCell; - uint64 uiMainDoor; - uint64 uiTeleportationPortal; - uint64 uiSaboteurPortal; - - uint64 uiActivationCrystal[3]; - - uint32 uiActivationTimer; - uint32 uiCyanigosaEventTimer; - uint32 uiDoorSpellTimer; - - std::set trashMobs; // to kill with crystal - - uint8 uiWaveCount; - uint8 uiLocation; - uint8 uiFirstBoss; - uint8 uiSecondBoss; - uint8 uiRemoveNpc; - - uint8 uiDoorIntegrity; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - uint8 uiCountErekemGuards; - uint8 uiCountActivationCrystals; - uint8 uiCyanigosaEventPhase; - uint8 uiMainEventPhase; // SPECIAL: pre event animations, IN_PROGRESS: event itself - - bool bActive; - bool bWiped; - bool bIsDoorSpellCasted; - bool bCrystalActivated; - - std::list NpcAtDoorCastingList; - - std::string str_data; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - uiMoragg = 0; - uiErekem = 0; - uiIchoron = 0; - uiLavanthor = 0; - uiXevozz = 0; - uiZuramat = 0; - uiCyanigosa = 0; - uiSinclari = 0; + return new instance_violet_hold_InstanceMapScript(pMap); + } - uiMoraggCell = 0; - uiErekemCell = 0; - uiErekemGuard[0] = 0; - uiErekemGuard[1] = 0; - uiIchoronCell = 0; - uiLavanthorCell = 0; - uiXevozzCell = 0; - uiZuramatCell = 0; - uiMainDoor = 0; - uiTeleportationPortal = 0; - uiSaboteurPortal = 0; + struct instance_violet_hold_InstanceMapScript : public InstanceScript + { + instance_violet_hold_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - trashMobs.clear(); + uint64 uiMoragg; + uint64 uiErekem; + uint64 uiErekemGuard[2]; + uint64 uiIchoron; + uint64 uiLavanthor; + uint64 uiXevozz; + uint64 uiZuramat; + uint64 uiCyanigosa; + uint64 uiSinclari; + + uint64 uiMoraggCell; + uint64 uiErekemCell; + uint64 uiErekemLeftGuardCell; + uint64 uiErekemRightGuardCell; + uint64 uiIchoronCell; + uint64 uiLavanthorCell; + uint64 uiXevozzCell; + uint64 uiZuramatCell; + uint64 uiMainDoor; + uint64 uiTeleportationPortal; + uint64 uiSaboteurPortal; + + uint64 uiActivationCrystal[3]; + + uint32 uiActivationTimer; + uint32 uiCyanigosaEventTimer; + uint32 uiDoorSpellTimer; + + std::set trashMobs; // to kill with crystal + + uint8 uiWaveCount; + uint8 uiLocation; + uint8 uiFirstBoss; + uint8 uiSecondBoss; + uint8 uiRemoveNpc; + + uint8 uiDoorIntegrity; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 uiCountErekemGuards; + uint8 uiCountActivationCrystals; + uint8 uiCyanigosaEventPhase; + uint8 uiMainEventPhase; // SPECIAL: pre event animations, IN_PROGRESS: event itself + + bool bActive; + bool bWiped; + bool bIsDoorSpellCasted; + bool bCrystalActivated; + + std::list NpcAtDoorCastingList; + + std::string str_data; + + void Initialize() + { + uiMoragg = 0; + uiErekem = 0; + uiIchoron = 0; + uiLavanthor = 0; + uiXevozz = 0; + uiZuramat = 0; + uiCyanigosa = 0; + uiSinclari = 0; + + uiMoraggCell = 0; + uiErekemCell = 0; + uiErekemGuard[0] = 0; + uiErekemGuard[1] = 0; + uiIchoronCell = 0; + uiLavanthorCell = 0; + uiXevozzCell = 0; + uiZuramatCell = 0; + uiMainDoor = 0; + uiTeleportationPortal = 0; + uiSaboteurPortal = 0; + + trashMobs.clear(); - uiRemoveNpc = 0; + uiRemoveNpc = 0; - uiDoorIntegrity = 100; + uiDoorIntegrity = 100; - uiWaveCount = 0; - uiLocation = urand(0,5); - uiFirstBoss = 0; - uiSecondBoss = 0; - uiCountErekemGuards = 0; - uiCountActivationCrystals = 0; - uiCyanigosaEventPhase = 1; + uiWaveCount = 0; + uiLocation = urand(0,5); + uiFirstBoss = 0; + uiSecondBoss = 0; + uiCountErekemGuards = 0; + uiCountActivationCrystals = 0; + uiCyanigosaEventPhase = 1; - uiActivationTimer = 5000; - uiDoorSpellTimer = 2000; - uiCyanigosaEventTimer = 3*IN_MILLISECONDS; + uiActivationTimer = 5000; + uiDoorSpellTimer = 2000; + uiCyanigosaEventTimer = 3*IN_MILLISECONDS; - bActive = false; - bIsDoorSpellCasted = false; - bCrystalActivated = false; + bActive = false; + bIsDoorSpellCasted = false; + bCrystalActivated = false; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } - - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; - - return false; - } - - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch(pCreature->GetEntry()) - { - case CREATURE_XEVOZZ: - uiXevozz = pCreature->GetGUID(); - break; - case CREATURE_LAVANTHOR: - uiLavanthor = pCreature->GetGUID(); - break; - case CREATURE_ICHORON: - uiIchoron = pCreature->GetGUID(); - break; - case CREATURE_ZURAMAT: - uiZuramat = pCreature->GetGUID(); - break; - case CREATURE_EREKEM: - uiErekem = pCreature->GetGUID(); - break; - case CREATURE_EREKEM_GUARD: - if (uiCountErekemGuards < 2) - { - uiErekemGuard[uiCountErekemGuards++] = pCreature->GetGUID(); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - } - break; - case CREATURE_MORAGG: - uiMoragg = pCreature->GetGUID(); - break; - case CREATURE_CYANIGOSA: - uiCyanigosa = pCreature->GetGUID(); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - break; - case CREATURE_SINCLARI: - uiSinclari = pCreature->GetGUID(); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - if (add && (pCreature->GetGUID() == uiFirstBoss || pCreature->GetGUID() == uiSecondBoss)) + bool IsEncounterInProgress() const { - pCreature->AllLootRemovedFromCorpse(); - pCreature->RemoveLootMode(1); - } - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case GO_EREKEM_GUARD_1_DOOR: - uiErekemLeftGuardCell = pGo->GetGUID(); - break; - case GO_EREKEM_GUARD_2_DOOR: - uiErekemRightGuardCell = pGo->GetGUID(); - break; - case GO_EREKEM_DOOR: - uiErekemCell = pGo->GetGUID(); - break; - case GO_ZURAMAT_DOOR: - uiZuramatCell = pGo->GetGUID(); - break; - case GO_LAVANTHOR_DOOR: - uiLavanthorCell = pGo->GetGUID(); - break; - case GO_MORAGG_DOOR: - uiMoraggCell = pGo->GetGUID(); - break; - case GO_ICHORON_DOOR: - uiIchoronCell = pGo->GetGUID(); - break; - case GO_XEVOZZ_DOOR: - uiXevozzCell = pGo->GetGUID(); - break; - case GO_MAIN_DOOR: - uiMainDoor = pGo->GetGUID(); - break; - case GO_ACTIVATION_CRYSTAL: - if (uiCountActivationCrystals < 3) - uiActivationCrystal[uiCountActivationCrystals++] = pGo->GetGUID(); - break; + return false; } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnCreatureCreate(Creature* pCreature, bool add) { - case DATA_1ST_BOSS_EVENT: - m_auiEncounter[0] = data; - if (data == DONE) - SaveToDB(); - break; - case DATA_2ND_BOSS_EVENT: - m_auiEncounter[1] = data; - if (data == DONE) - SaveToDB(); - break; - case DATA_CYANIGOSA_EVENT: - m_auiEncounter[2] = data; - if (data == DONE) - { - SaveToDB(); - uiMainEventPhase = DONE; - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_ACTIVE); - if (!bCrystalActivated && uiDoorIntegrity == 100) - DoCompleteAchievement(ACHIEV_DEFENSELESS); - } - break; - case DATA_WAVE_COUNT: - uiWaveCount = data; - bActive = true; - break; - case DATA_REMOVE_NPC: - uiRemoveNpc = data; - break; - case DATA_PORTAL_LOCATION: - uiLocation = (uint8)data; - break; - case DATA_DOOR_INTEGRITY: - uiDoorIntegrity = data; - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity); - break; - case DATA_NPC_PRESENCE_AT_DOOR_ADD: - NpcAtDoorCastingList.push_back(data); - break; - case DATA_NPC_PRESENCE_AT_DOOR_REMOVE: - if(!NpcAtDoorCastingList.empty()) - NpcAtDoorCastingList.pop_back(); - break; - case DATA_MAIN_DOOR: - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - { - switch(data) + switch(pCreature->GetEntry()) + { + case CREATURE_XEVOZZ: + uiXevozz = pCreature->GetGUID(); + break; + case CREATURE_LAVANTHOR: + uiLavanthor = pCreature->GetGUID(); + break; + case CREATURE_ICHORON: + uiIchoron = pCreature->GetGUID(); + break; + case CREATURE_ZURAMAT: + uiZuramat = pCreature->GetGUID(); + break; + case CREATURE_EREKEM: + uiErekem = pCreature->GetGUID(); + break; + case CREATURE_EREKEM_GUARD: + if (uiCountErekemGuards < 2) { - case GO_STATE_ACTIVE: + uiErekemGuard[uiCountErekemGuards++] = pCreature->GetGUID(); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + } + break; + case CREATURE_MORAGG: + uiMoragg = pCreature->GetGUID(); + break; + case CREATURE_CYANIGOSA: + uiCyanigosa = pCreature->GetGUID(); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + break; + case CREATURE_SINCLARI: + uiSinclari = pCreature->GetGUID(); + break; + } + + if (add && (pCreature->GetGUID() == uiFirstBoss || pCreature->GetGUID() == uiSecondBoss)) + { + pCreature->AllLootRemovedFromCorpse(); + pCreature->RemoveLootMode(1); + } + } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case GO_EREKEM_GUARD_1_DOOR: + uiErekemLeftGuardCell = pGo->GetGUID(); + break; + case GO_EREKEM_GUARD_2_DOOR: + uiErekemRightGuardCell = pGo->GetGUID(); + break; + case GO_EREKEM_DOOR: + uiErekemCell = pGo->GetGUID(); + break; + case GO_ZURAMAT_DOOR: + uiZuramatCell = pGo->GetGUID(); + break; + case GO_LAVANTHOR_DOOR: + uiLavanthorCell = pGo->GetGUID(); + break; + case GO_MORAGG_DOOR: + uiMoraggCell = pGo->GetGUID(); + break; + case GO_ICHORON_DOOR: + uiIchoronCell = pGo->GetGUID(); + break; + case GO_XEVOZZ_DOOR: + uiXevozzCell = pGo->GetGUID(); + break; + case GO_MAIN_DOOR: + uiMainDoor = pGo->GetGUID(); + break; + case GO_ACTIVATION_CRYSTAL: + if (uiCountActivationCrystals < 3) + uiActivationCrystal[uiCountActivationCrystals++] = pGo->GetGUID(); + break; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_1ST_BOSS_EVENT: + m_auiEncounter[0] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_2ND_BOSS_EVENT: + m_auiEncounter[1] = data; + if (data == DONE) + SaveToDB(); + break; + case DATA_CYANIGOSA_EVENT: + m_auiEncounter[2] = data; + if (data == DONE) + { + SaveToDB(); + uiMainEventPhase = DONE; + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_ACTIVE); + if (!bCrystalActivated && uiDoorIntegrity == 100) + DoCompleteAchievement(ACHIEV_DEFENSELESS); + } + break; + case DATA_WAVE_COUNT: + uiWaveCount = data; + bActive = true; + break; + case DATA_REMOVE_NPC: + uiRemoveNpc = data; + break; + case DATA_PORTAL_LOCATION: + uiLocation = (uint8)data; + break; + case DATA_DOOR_INTEGRITY: + uiDoorIntegrity = data; + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, uiDoorIntegrity); + break; + case DATA_NPC_PRESENCE_AT_DOOR_ADD: + NpcAtDoorCastingList.push_back(data); + break; + case DATA_NPC_PRESENCE_AT_DOOR_REMOVE: + if(!NpcAtDoorCastingList.empty()) + NpcAtDoorCastingList.pop_back(); + break; + case DATA_MAIN_DOOR: + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + { + switch(data) + { + case GO_STATE_ACTIVE: + pMainDoor->SetGoState(GO_STATE_ACTIVE); + break; + case GO_STATE_READY: + pMainDoor->SetGoState(GO_STATE_READY); + break; + case GO_STATE_ACTIVE_ALTERNATIVE: + pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + break; + } + } + break; + case DATA_START_BOSS_ENCOUNTER: + switch(uiWaveCount) + { + case 6: + StartBossEncounter(uiFirstBoss); break; - case GO_STATE_READY: - pMainDoor->SetGoState(GO_STATE_READY); - break; - case GO_STATE_ACTIVE_ALTERNATIVE: - pMainDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); + case 12: + StartBossEncounter(uiSecondBoss); break; } - } - break; - case DATA_START_BOSS_ENCOUNTER: - switch(uiWaveCount) + break; + case DATA_ACTIVATE_CRYSTAL: + ActivateCrystal(); + break; + case DATA_MAIN_EVENT_PHASE: + uiMainEventPhase = data; + if (data == IN_PROGRESS) // Start event + { + if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) + pMainDoor->SetGoState(GO_STATE_READY); + uiWaveCount = 1; + bActive = true; + uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. + } + break; + } + } + + void SetData64(uint32 type, uint64 data) + { + switch(type) + { + case DATA_ADD_TRASH_MOB: + trashMobs.insert(data); + break; + case DATA_DEL_TRASH_MOB: + trashMobs.erase(data); + break; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_1ST_BOSS_EVENT: return m_auiEncounter[0]; + case DATA_2ND_BOSS_EVENT: return m_auiEncounter[1]; + case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2]; + case DATA_WAVE_COUNT: return uiWaveCount; + case DATA_REMOVE_NPC: return uiRemoveNpc; + case DATA_PORTAL_LOCATION: return uiLocation; + case DATA_DOOR_INTEGRITY: return uiDoorIntegrity; + case DATA_NPC_PRESENCE_AT_DOOR: return NpcAtDoorCastingList.size(); + case DATA_FIRST_BOSS: return uiFirstBoss; + case DATA_SECOND_BOSS: return uiSecondBoss; + case DATA_MAIN_EVENT_PHASE: return uiMainEventPhase; + } + + return 0; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MORAGG: return uiMoragg; + case DATA_EREKEM: return uiErekem; + case DATA_EREKEM_GUARD_1: return uiErekemGuard[0]; + case DATA_EREKEM_GUARD_2: return uiErekemGuard[1]; + case DATA_ICHORON: return uiIchoron; + case DATA_LAVANTHOR: return uiLavanthor; + case DATA_XEVOZZ: return uiXevozz; + case DATA_ZURAMAT: return uiZuramat; + case DATA_CYANIGOSA: return uiCyanigosa; + case DATA_MORAGG_CELL: return uiMoraggCell; + case DATA_EREKEM_CELL: return uiErekemCell; + case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell; + case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell; + case DATA_ICHORON_CELL: return uiIchoronCell; + case DATA_LAVANTHOR_CELL: return uiLavanthorCell; + case DATA_XEVOZZ_CELL: return uiXevozzCell; + case DATA_ZURAMAT_CELL: return uiZuramatCell; + case DATA_MAIN_DOOR: return uiMainDoor; + case DATA_SINCLARI: return uiSinclari; + case DATA_TELEPORTATION_PORTAL: return uiTeleportationPortal; + case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal; + } + + return 0; + } + + void SpawnPortal() + { + SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1,5))%6); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + if(Creature *portal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[GetData(DATA_PORTAL_LOCATION)],TEMPSUMMON_CORPSE_DESPAWN)) + uiTeleportationPortal = portal->GetGUID(); + } + + void StartBossEncounter(uint8 uiBoss, bool bForceRespawn = true) + { + Creature* pBoss = NULL; + + switch(uiBoss) + { + case BOSS_MORAGG: + HandleGameObject(uiMoraggCell,bForceRespawn); + pBoss = instance->GetCreature(uiMoragg); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); + break; + case BOSS_EREKEM: + HandleGameObject(uiErekemCell, bForceRespawn); + HandleGameObject(uiErekemRightGuardCell, bForceRespawn); + HandleGameObject(uiErekemLeftGuardCell, bForceRespawn); + + pBoss = instance->GetCreature(uiErekem); + + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); + + if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0])) + { + if (bForceRespawn) + pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + else + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); + } + + if (Creature* pGuard2 = instance->GetCreature(uiErekemGuard[1])) + { + if (bForceRespawn) + pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + else + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); + } + break; + case BOSS_ICHORON: + HandleGameObject(uiIchoronCell,bForceRespawn); + pBoss = instance->GetCreature(uiIchoron); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); + break; + case BOSS_LAVANTHOR: + HandleGameObject(uiLavanthorCell,bForceRespawn); + pBoss = instance->GetCreature(uiLavanthor); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); + break; + case BOSS_XEVOZZ: + HandleGameObject(uiXevozzCell,bForceRespawn); + pBoss = instance->GetCreature(uiXevozz); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); + break; + case BOSS_ZURAMAT: + HandleGameObject(uiZuramatCell,bForceRespawn); + pBoss = instance->GetCreature(uiZuramat); + if (pBoss) + pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); + break; + } + + // generic boss state changes + if (pBoss) + { + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetReactState(REACT_AGGRESSIVE); + + if (!bForceRespawn) { - case 6: - StartBossEncounter(uiFirstBoss); - break; - case 12: - StartBossEncounter(uiSecondBoss); - break; + if (pBoss->isDead()) + { + // respawn but avoid to be looted again + pBoss->Respawn(); + pBoss->RemoveLootMode(1); + } + pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + uiWaveCount = 0; } - break; - case DATA_ACTIVATE_CRYSTAL: - ActivateCrystal(); - break; - case DATA_MAIN_EVENT_PHASE: - uiMainEventPhase = data; - if (data == IN_PROGRESS) // Start event + } + } + + void AddWave() + { + DoUpdateWorldState(WORLD_STATE_VH, 1); + DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount); + + switch(uiWaveCount) + { + case 6: + if (uiFirstBoss == 0) + uiFirstBoss = urand(1,6); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + { + if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) + uiSaboteurPortal = pPortal->GetGUID(); + if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) + pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + } + break; + case 12: + if (uiSecondBoss == 0) + do + { + uiSecondBoss = urand(1,6); + } while (uiSecondBoss == uiFirstBoss); + if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + { + if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) + uiSaboteurPortal = pPortal->GetGUID(); + if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) + pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); + } + break; + case 18: + { + Creature *pSinclari = instance->GetCreature(uiSinclari); + if (pSinclari) + pSinclari->SummonCreature(CREATURE_CYANIGOSA,CyanigosasSpawnLocation,TEMPSUMMON_DEAD_DESPAWN); + break; + } + case 1: { if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) pMainDoor->SetGoState(GO_STATE_READY); - uiWaveCount = 1; - bActive = true; - uiRemoveNpc = 0; // might not have been reset after a wipe on a boss. + DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); } - break; - } - } - - void SetData64(uint32 type, uint64 data) - { - switch(type) - { - case DATA_ADD_TRASH_MOB: - trashMobs.insert(data); - break; - case DATA_DEL_TRASH_MOB: - trashMobs.erase(data); - break; - } - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_1ST_BOSS_EVENT: return m_auiEncounter[0]; - case DATA_2ND_BOSS_EVENT: return m_auiEncounter[1]; - case DATA_CYANIGOSA_EVENT: return m_auiEncounter[2]; - case DATA_WAVE_COUNT: return uiWaveCount; - case DATA_REMOVE_NPC: return uiRemoveNpc; - case DATA_PORTAL_LOCATION: return uiLocation; - case DATA_DOOR_INTEGRITY: return uiDoorIntegrity; - case DATA_NPC_PRESENCE_AT_DOOR: return NpcAtDoorCastingList.size(); - case DATA_FIRST_BOSS: return uiFirstBoss; - case DATA_SECOND_BOSS: return uiSecondBoss; - case DATA_MAIN_EVENT_PHASE: return uiMainEventPhase; - } - - return 0; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_MORAGG: return uiMoragg; - case DATA_EREKEM: return uiErekem; - case DATA_EREKEM_GUARD_1: return uiErekemGuard[0]; - case DATA_EREKEM_GUARD_2: return uiErekemGuard[1]; - case DATA_ICHORON: return uiIchoron; - case DATA_LAVANTHOR: return uiLavanthor; - case DATA_XEVOZZ: return uiXevozz; - case DATA_ZURAMAT: return uiZuramat; - case DATA_CYANIGOSA: return uiCyanigosa; - case DATA_MORAGG_CELL: return uiMoraggCell; - case DATA_EREKEM_CELL: return uiErekemCell; - case DATA_EREKEM_RIGHT_GUARD_CELL: return uiErekemRightGuardCell; - case DATA_EREKEM_LEFT_GUARD_CELL: return uiErekemLeftGuardCell; - case DATA_ICHORON_CELL: return uiIchoronCell; - case DATA_LAVANTHOR_CELL: return uiLavanthorCell; - case DATA_XEVOZZ_CELL: return uiXevozzCell; - case DATA_ZURAMAT_CELL: return uiZuramatCell; - case DATA_MAIN_DOOR: return uiMainDoor; - case DATA_SINCLARI: return uiSinclari; - case DATA_TELEPORTATION_PORTAL: return uiTeleportationPortal; - case DATA_SABOTEUR_PORTAL: return uiSaboteurPortal; - } - - return 0; - } - - void SpawnPortal() - { - SetData(DATA_PORTAL_LOCATION, (GetData(DATA_PORTAL_LOCATION) + urand(1,5))%6); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) - if(Creature *portal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL,PortalLocation[GetData(DATA_PORTAL_LOCATION)],TEMPSUMMON_CORPSE_DESPAWN)) - uiTeleportationPortal = portal->GetGUID(); - } - - void StartBossEncounter(uint8 uiBoss, bool bForceRespawn = true) - { - Creature* pBoss = NULL; - - switch(uiBoss) - { - case BOSS_MORAGG: - HandleGameObject(uiMoraggCell,bForceRespawn); - pBoss = instance->GetCreature(uiMoragg); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove1); - break; - case BOSS_EREKEM: - HandleGameObject(uiErekemCell, bForceRespawn); - HandleGameObject(uiErekemRightGuardCell, bForceRespawn); - HandleGameObject(uiErekemLeftGuardCell, bForceRespawn); - - pBoss = instance->GetCreature(uiErekem); - - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove2); - - if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0])) - { - if (bForceRespawn) - pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - else - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); - } - - if (Creature* pGuard2 = instance->GetCreature(uiErekemGuard[1])) - { - if (bForceRespawn) - pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - else - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); - } - break; - case BOSS_ICHORON: - HandleGameObject(uiIchoronCell,bForceRespawn); - pBoss = instance->GetCreature(uiIchoron); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove3); - break; - case BOSS_LAVANTHOR: - HandleGameObject(uiLavanthorCell,bForceRespawn); - pBoss = instance->GetCreature(uiLavanthor); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove4); - break; - case BOSS_XEVOZZ: - HandleGameObject(uiXevozzCell,bForceRespawn); - pBoss = instance->GetCreature(uiXevozz); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove5); - break; - case BOSS_ZURAMAT: - HandleGameObject(uiZuramatCell,bForceRespawn); - pBoss = instance->GetCreature(uiZuramat); - if (pBoss) - pBoss->GetMotionMaster()->MovePoint(0, BossStartMove6); - break; - } - - // generic boss state changes - if (pBoss) - { - pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pBoss->SetReactState(REACT_AGGRESSIVE); - - if (!bForceRespawn) - { - if (pBoss->isDead()) - { - // respawn but avoid to be looted again - pBoss->Respawn(); - pBoss->RemoveLootMode(1); - } - pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - uiWaveCount = 0; + default: + SpawnPortal(); + break; } } - } - void AddWave() - { - DoUpdateWorldState(WORLD_STATE_VH, 1); - DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, uiWaveCount); - - switch(uiWaveCount) + std::string GetSaveData() { - case 6: - if (uiFirstBoss == 0) - uiFirstBoss = urand(1,6); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << "V H " << (uint16)m_auiEncounter[0] + << " " << (uint16)m_auiEncounter[1] + << " " << (uint16)m_auiEncounter[2] + << " " << (uint16)uiFirstBoss + << " " << (uint16)uiSecondBoss; + + str_data = saveStream.str(); + + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + + if (dataHead1 == 'V' && dataHead2 == 'H') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + uiFirstBoss = data3; + uiSecondBoss = data4; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + + bool CheckWipe() + { + Map::PlayerList const &players = instance->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + Player* pPlayer = itr->getSource(); + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + return false; + } + + return true; + } + + void Update(uint32 diff) + { + if (!instance->HavePlayers()) + return; + + // portals should spawn if other portal is dead and doors are closed + if (bActive && uiMainEventPhase == IN_PROGRESS) + { + if (uiActivationTimer < diff) { - if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) - uiSaboteurPortal = pPortal->GetGUID(); - if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) - pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); - } - break; - case 12: - if (uiSecondBoss == 0) - do + AddWave(); + bActive = false; + uiActivationTimer = 5000; + } else uiActivationTimer -= diff; + } + + // if main event is in progress and players have wiped then reset instance + if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) + { + SetData(DATA_REMOVE_NPC, 1); + StartBossEncounter(uiFirstBoss, false); + StartBossEncounter(uiSecondBoss, false); + + SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); + SetData(DATA_WAVE_COUNT, 0); + uiMainEventPhase = NOT_STARTED; + + if (Creature* pSinclari = instance->GetCreature(uiSinclari)) + { + pSinclari->SetVisibility(VISIBILITY_ON); + + std::list GuardList; + pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) { - uiSecondBoss = urand(1,6); - } while (uiSecondBoss == uiFirstBoss); - if (Creature *pSinclari = instance->GetCreature(uiSinclari)) - { - if(Creature *pPortal = pSinclari->SummonCreature(CREATURE_TELEPORTATION_PORTAL, MiddleRoomPortalSaboLocation, TEMPSUMMON_CORPSE_DESPAWN)) - uiSaboteurPortal = pPortal->GetGUID(); - if (Creature *pAzureSaboteur = pSinclari->SummonCreature(CREATURE_SABOTEOUR, MiddleRoomLocation, TEMPSUMMON_DEAD_DESPAWN)) - pAzureSaboteur->CastSpell(pAzureSaboteur, SABOTEUR_SHIELD_EFFECT, false); - } - break; - case 18: - { - Creature *pSinclari = instance->GetCreature(uiSinclari); - if (pSinclari) - pSinclari->SummonCreature(CREATURE_CYANIGOSA,CyanigosasSpawnLocation,TEMPSUMMON_DEAD_DESPAWN); - break; - } - case 1: - { - if (GameObject* pMainDoor = instance->GetGameObject(uiMainDoor)) - pMainDoor->SetGoState(GO_STATE_READY); - DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, 100); - } - default: - SpawnPortal(); - break; - } - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "V H " << (uint16)m_auiEncounter[0] - << " " << (uint16)m_auiEncounter[1] - << " " << (uint16)m_auiEncounter[2] - << " " << (uint16)uiFirstBoss - << " " << (uint16)uiSecondBoss; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - - if (dataHead1 == 'V' && dataHead2 == 'H') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - uiFirstBoss = data3; - uiSecondBoss = data4; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - - bool CheckWipe() - { - Map::PlayerList const &players = instance->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - Player* pPlayer = itr->getSource(); - if (pPlayer->isGameMaster()) - continue; - - if (pPlayer->isAlive()) - return false; - } - - return true; - } - - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; - - // portals should spawn if other portal is dead and doors are closed - if (bActive && uiMainEventPhase == IN_PROGRESS) - { - if (uiActivationTimer < diff) - { - AddWave(); - bActive = false; - uiActivationTimer = 5000; - } else uiActivationTimer -= diff; - } - - // if main event is in progress and players have wiped then reset instance - if ( uiMainEventPhase == IN_PROGRESS && CheckWipe()) - { - SetData(DATA_REMOVE_NPC, 1); - StartBossEncounter(uiFirstBoss, false); - StartBossEncounter(uiSecondBoss, false); - - SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); - SetData(DATA_WAVE_COUNT, 0); - uiMainEventPhase = NOT_STARTED; - - if (Creature* pSinclari = instance->GetCreature(uiSinclari)) - { - pSinclari->SetVisibility(VISIBILITY_ON); - - std::list GuardList; - pSinclari->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) - { - for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) - { - if (Creature* pGuard = *itr) + for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->SetVisibility(VISIBILITY_ON); - pGuard->SetReactState(REACT_AGGRESSIVE); - pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); + if (Creature* pGuard = *itr) + { + pGuard->SetVisibility(VISIBILITY_ON); + pGuard->SetReactState(REACT_AGGRESSIVE); + pGuard->GetMotionMaster()->MovePoint(1,pGuard->GetHomePosition()); + } } } + pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); + pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); + } + } + + // Cyanigosa is spawned but not tranformed, prefight event + Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); + if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) + { + if (uiCyanigosaEventTimer <= diff) + { + switch(uiCyanigosaEventPhase) + { + case 1: + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); + DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); + uiCyanigosaEventTimer = 7*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 2: + pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); + uiCyanigosaEventTimer = 7*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 3: + pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); + pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); + pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pCyanigosa->SetReactState(REACT_AGGRESSIVE); + uiCyanigosaEventTimer = 2*IN_MILLISECONDS; + ++uiCyanigosaEventPhase; + break; + case 4: + uiCyanigosaEventPhase = 0; + break; + } + } else uiCyanigosaEventTimer -= diff; + } + + // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active + if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) + { + // if door integrity is > 0 then decrase it's integrity state + if(GetData(DATA_DOOR_INTEGRITY)) + { + if(uiDoorSpellTimer < diff) + { + SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); + uiDoorSpellTimer =2000; + } else uiDoorSpellTimer -= diff; + } + // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) + else + { + SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); + uiMainEventPhase = FAIL; } - pSinclari->GetMotionMaster()->MovePoint(1,pSinclari->GetHomePosition()); - pSinclari->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NOT_SELECTABLE); } } - // Cyanigosa is spawned but not tranformed, prefight event - Creature *pCyanigosa = instance->GetCreature(uiCyanigosa); - if (pCyanigosa && !pCyanigosa->HasAura(CYANIGOSA_SPELL_TRANSFORM)) + void ActivateCrystal() { - if (uiCyanigosaEventTimer <= diff) + // Kill all mobs registered with SetData64(ADD_TRASH_MOB) + // TODO: All visual, spells etc + for (std::set::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) { - switch(uiCyanigosaEventPhase) - { - case 1: - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); - DoScriptText(CYANIGOSA_SAY_SPAWN, pCyanigosa); - uiCyanigosaEventTimer = 7*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 2: - pCyanigosa->GetMotionMaster()->MoveJump(MiddleRoomLocation.GetPositionX(), MiddleRoomLocation.GetPositionY(), MiddleRoomLocation.GetPositionZ(), 10.0f, 20.0f); - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_BLUE_AURA, false); - uiCyanigosaEventTimer = 7*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 3: - pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); - pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); - pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); - pCyanigosa->SetReactState(REACT_AGGRESSIVE); - uiCyanigosaEventTimer = 2*IN_MILLISECONDS; - ++uiCyanigosaEventPhase; - break; - case 4: - uiCyanigosaEventPhase = 0; - break; - } - } else uiCyanigosaEventTimer -= diff; + Creature* pCreature = instance->GetCreature(*itr); + if (pCreature && pCreature->isAlive()) + pCreature->CastSpell(pCreature,SPELL_ARCANE_LIGHTNING,true); // Who should cast the spell? + } } - // if there are NPCs in front of the prison door, which are casting the door seal spell and doors are active - if (GetData(DATA_NPC_PRESENCE_AT_DOOR) && uiMainEventPhase == IN_PROGRESS) + void ProcessEvent(GameObject* pGO, uint32 uiEventId) { - // if door integrity is > 0 then decrase it's integrity state - if(GetData(DATA_DOOR_INTEGRITY)) + switch(uiEventId) { - if(uiDoorSpellTimer < diff) - { - SetData(DATA_DOOR_INTEGRITY,GetData(DATA_DOOR_INTEGRITY)-1); - uiDoorSpellTimer =2000; - } else uiDoorSpellTimer -= diff; + case EVENT_ACTIVATE_CRYSTAL: + bCrystalActivated = true; // Activation by player's will throw event signal + ActivateCrystal(); + break; } - // else set door state to active (means door will open and group have failed to sustain mob invasion on the door) - else - { - SetData(DATA_MAIN_DOOR,GO_STATE_ACTIVE); - uiMainEventPhase = FAIL; - } - } } - void ActivateCrystal() - { - // Kill all mobs registered with SetData64(ADD_TRASH_MOB) - // TODO: All visual, spells etc - for (std::set::const_iterator itr = trashMobs.begin(); itr != trashMobs.end(); ++itr) - { - Creature* pCreature = instance->GetCreature(*itr); - if (pCreature && pCreature->isAlive()) - pCreature->CastSpell(pCreature,SPELL_ARCANE_LIGHTNING,true); // Who should cast the spell? - } - } - - void ProcessEvent(GameObject* pGO, uint32 uiEventId) - { - switch(uiEventId) - { - case EVENT_ACTIVATE_CRYSTAL: - bCrystalActivated = true; // Activation by player's will throw event signal - ActivateCrystal(); - break; - } -} +}; }; -InstanceData* GetInstanceData_instance_violet_hold(Map* pMap) -{ - return new instance_violet_hold(pMap); -} void AddSC_instance_violet_hold() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_violet_hold"; - newscript->GetInstanceData = &GetInstanceData_instance_violet_hold; - newscript->RegisterSelf(); + new instance_violet_hold(); } diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 47d649b9e9b..59547c7ca5c 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -247,412 +247,434 @@ const float SaboteurFinalPos6[5][3] = const Position MovePosition = {1806.955566, 803.851807, 44.363323}; const Position playerTeleportPosition = {1830.531006, 803.939758, 44.340508, 6.281611}; const Position sinclariOutsidePosition = {1817.315674, 804.060608, 44.363998}; - -struct npc_sinclariAI : public ScriptedAI + class npc_sinclari_vh : public CreatureScript { - npc_sinclariAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_sinclari_vh() : CreatureScript("npc_sinclari_vh") { } + + bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pInstance = pCreature->GetInstanceData(); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_sinclari_vh::npc_sinclariAI, (pCreature->AI()))->uiPhase = 1; + if (InstanceScript *pInstance = pCreature->GetInstanceScript()) + pInstance->SetData(DATA_MAIN_EVENT_PHASE,SPECIAL); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(),playerTeleportPosition.GetPositionY(),playerTeleportPosition.GetPositionZ(),playerTeleportPosition.GetOrientation(),true); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - ScriptedInstance* pInstance; - - uint8 uiPhase; - uint32 uiTimer; - - void Reset() + bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) { - uiPhase = 0; - uiTimer = 0; - - me->SetReactState(REACT_AGGRESSIVE); - - std::list GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) { - for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) + switch (pInstance->GetData(DATA_MAIN_EVENT_PHASE)) { - if (Creature* pGuard = *itr) + case NOT_STARTED: + case FAIL: // Allow to start event if not started or wiped + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + case IN_PROGRESS: // Allow to teleport inside if event is in progress + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_I_WANT_IN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); + break; + default: + pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); + } + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_sinclariAI(pCreature); + } + + struct npc_sinclariAI : public ScriptedAI + { + npc_sinclariAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint8 uiPhase; + uint32 uiTimer; + + void Reset() + { + uiPhase = 0; + uiTimer = 0; + + me->SetReactState(REACT_AGGRESSIVE); + + std::list GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) + { + for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->DisappearAndDie(); - pGuard->Respawn(); - pGuard->SetVisibility(VISIBILITY_ON); - pGuard->SetReactState(REACT_AGGRESSIVE); + if (Creature* pGuard = *itr) + { + pGuard->DisappearAndDie(); + pGuard->Respawn(); + pGuard->SetVisibility(VISIBILITY_ON); + pGuard->SetReactState(REACT_AGGRESSIVE); + } } } } - } - void UpdateAI(const uint32 uiDiff) - { - ScriptedAI::UpdateAI(uiDiff); - - if (uiPhase) + void UpdateAI(const uint32 uiDiff) { - if (uiTimer <= uiDiff) + ScriptedAI::UpdateAI(uiDiff); + + if (uiPhase) { - switch(uiPhase) + if (uiTimer <= uiDiff) { - case 1: - DoScriptText(SAY_SINCLARI_1, me); - uiTimer = 4000; - uiPhase = 2; - break; - case 2: + switch(uiPhase) { - std::list GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) - for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) - { - if (Creature* pGuard = *itr) + case 1: + DoScriptText(SAY_SINCLARI_1, me); + uiTimer = 4000; + uiPhase = 2; + break; + case 2: + { + std::list GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) + for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pGuard->GetMotionMaster()->MovePoint(0, MovePosition); + if (Creature* pGuard = *itr) + { + pGuard->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pGuard->GetMotionMaster()->MovePoint(0, MovePosition); + } } - } - uiTimer = 6000; - uiPhase = 3; - break; - } - case 3: - { - std::list GuardList; - me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); - if (!GuardList.empty()) - for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) - { - if (Creature* pGuard = *itr) + uiTimer = 6000; + uiPhase = 3; + break; + } + case 3: + { + std::list GuardList; + me->GetCreatureListWithEntryInGrid(GuardList, NPC_VIOLET_HOLD_GUARD, 40.0f); + if (!GuardList.empty()) + for (std::list::const_iterator itr = GuardList.begin(); itr != GuardList.end(); ++itr) { - pGuard->SetVisibility(VISIBILITY_OFF); - pGuard->SetReactState(REACT_PASSIVE); + if (Creature* pGuard = *itr) + { + pGuard->SetVisibility(VISIBILITY_OFF); + pGuard->SetReactState(REACT_PASSIVE); + } } - } - uiTimer = 2000; - uiPhase = 4; - break; + uiTimer = 2000; + uiPhase = 4; + break; + } + case 4: + me->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); + uiTimer = 4000; + uiPhase = 5; + break; + case 5: + if (pInstance) + pInstance->SetData(DATA_MAIN_EVENT_PHASE,IN_PROGRESS); + me->SetReactState(REACT_PASSIVE); + uiTimer = 0; + uiPhase = 0; + break; } - case 4: - me->GetMotionMaster()->MovePoint(0, sinclariOutsidePosition); - uiTimer = 4000; - uiPhase = 5; - break; - case 5: - if (pInstance) - pInstance->SetData(DATA_MAIN_EVENT_PHASE,IN_PROGRESS); - me->SetReactState(REACT_PASSIVE); - uiTimer = 0; - uiPhase = 0; - break; } + else uiTimer -= uiDiff; } - else uiTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_sinclari(Creature* pCreature) -{ - return new npc_sinclariAI(pCreature); -} -bool GossipHello_npc_sinclari(Player* pPlayer, Creature* pCreature) + + class mob_azure_saboteur : public CreatureScript { - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) +public: + mob_azure_saboteur() : CreatureScript("mob_azure_saboteur") { } + + CreatureAI* GetAI(Creature* pCreature) const { - switch (pInstance->GetData(DATA_MAIN_EVENT_PHASE)) + return new mob_azure_saboteurAI (pCreature); + } + + struct mob_azure_saboteurAI : public npc_escortAI + { + mob_azure_saboteurAI(Creature *c):npc_escortAI(c) { - case NOT_STARTED: - case FAIL: // Allow to start event if not started or wiped - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_1,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_START_EVENT,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - case IN_PROGRESS: // Allow to teleport inside if event is in progress - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_I_WANT_IN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(13853, pCreature->GetGUID()); - break; - default: - pPlayer->SEND_GOSSIP_MENU(13910, pCreature->GetGUID()); + pInstance = c->GetInstanceScript(); + bHasGotMovingPoints = false; + uiBoss = 0; + Reset(); } - } - return true; -} -bool GossipSelect_npc_sinclari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sinclariAI, (pCreature->AI()))->uiPhase = 1; - if (ScriptedInstance *pInstance = pCreature->GetInstanceData()) - pInstance->SetData(DATA_MAIN_EVENT_PHASE,SPECIAL); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(13854, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->NearTeleportTo(playerTeleportPosition.GetPositionX(),playerTeleportPosition.GetPositionY(),playerTeleportPosition.GetPositionZ(),playerTeleportPosition.GetOrientation(),true); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - return true; -} + InstanceScript* pInstance; + bool bHasGotMovingPoints; + uint32 uiBoss; -struct mob_azure_saboteurAI : public npc_escortAI -{ - mob_azure_saboteurAI(Creature *c):npc_escortAI(c) - { - pInstance = c->GetInstanceData(); - bHasGotMovingPoints = false; - uiBoss = 0; - Reset(); - } - - ScriptedInstance* pInstance; - bool bHasGotMovingPoints; - uint32 uiBoss; - - void Reset() - { - if (pInstance && !uiBoss) - uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS) : pInstance->GetData(DATA_SECOND_BOSS); - } - - void WaypointReached(uint32 uiWPointId) - { - switch(uiBoss) + void Reset() { - case 1: - if(uiWPointId == 2) - FinishPointReached(); - break; - case 2: - if(uiWPointId == 2) - FinishPointReached(); - break; - case 3: - if(uiWPointId == 1) - FinishPointReached(); - break; - case 4: - if(uiWPointId == 0) - FinishPointReached(); - break; - case 5: - if(uiWPointId == 0) - FinishPointReached(); - break; - case 6: - if(uiWPointId == 4) - FinishPointReached(); - break; + if (pInstance && !uiBoss) + uiBoss = pInstance->GetData(DATA_WAVE_COUNT) == 6 ? pInstance->GetData(DATA_FIRST_BOSS) : pInstance->GetData(DATA_SECOND_BOSS); } - } - - void UpdateAI(const uint32 diff) - { - if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS)) - me->CastStop(); - - npc_escortAI::UpdateAI(diff); - if(!bHasGotMovingPoints) + void WaypointReached(uint32 uiWPointId) { - bHasGotMovingPoints = true; switch(uiBoss) { case 1: - for(int i=0;i<3;i++) - AddWaypoint(i,SaboteurFinalPos1[i][0],SaboteurFinalPos1[i][1],SaboteurFinalPos1[i][2],0); - me->SetHomePosition(SaboteurFinalPos1[2][0],SaboteurFinalPos1[2][1],SaboteurFinalPos1[2][2],4.762346); + if(uiWPointId == 2) + FinishPointReached(); break; case 2: - for(int i=0;i<3;i++) - AddWaypoint(i,SaboteurFinalPos2[i][0],SaboteurFinalPos2[i][1],SaboteurFinalPos2[i][2],0); - me->SetHomePosition(SaboteurFinalPos2[2][0],SaboteurFinalPos2[2][1],SaboteurFinalPos2[2][2],1.862674); + if(uiWPointId == 2) + FinishPointReached(); break; case 3: - for(int i=0;i<2;i++) - AddWaypoint(i,SaboteurFinalPos3[i][0],SaboteurFinalPos3[i][1],SaboteurFinalPos3[i][2],0); - me->SetHomePosition(SaboteurFinalPos3[1][0],SaboteurFinalPos3[1][1],SaboteurFinalPos3[1][2],5.500638); + if(uiWPointId == 1) + FinishPointReached(); break; case 4: - AddWaypoint(0,SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],0); - me->SetHomePosition(SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],3.991108); + if(uiWPointId == 0) + FinishPointReached(); break; case 5: - AddWaypoint(0,SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],0); - me->SetHomePosition(SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],1.100841); + if(uiWPointId == 0) + FinishPointReached(); break; case 6: - for(int i=0;i<5;i++) - AddWaypoint(i,SaboteurFinalPos6[i][0],SaboteurFinalPos6[i][1],SaboteurFinalPos6[i][2],0); - me->SetHomePosition(SaboteurFinalPos6[4][0],SaboteurFinalPos6[4][1],SaboteurFinalPos6[4][2],0.983031); + if(uiWPointId == 4) + FinishPointReached(); break; } - - SetDespawnAtEnd(false); - Start(true,true); } - } + + void UpdateAI(const uint32 diff) + { + if (pInstance && pInstance->GetData(DATA_MAIN_EVENT_PHASE != IN_PROGRESS)) + me->CastStop(); + + npc_escortAI::UpdateAI(diff); + + if(!bHasGotMovingPoints) + { + bHasGotMovingPoints = true; + switch(uiBoss) + { + case 1: + for(int i=0;i<3;i++) + AddWaypoint(i,SaboteurFinalPos1[i][0],SaboteurFinalPos1[i][1],SaboteurFinalPos1[i][2],0); + me->SetHomePosition(SaboteurFinalPos1[2][0],SaboteurFinalPos1[2][1],SaboteurFinalPos1[2][2],4.762346); + break; + case 2: + for(int i=0;i<3;i++) + AddWaypoint(i,SaboteurFinalPos2[i][0],SaboteurFinalPos2[i][1],SaboteurFinalPos2[i][2],0); + me->SetHomePosition(SaboteurFinalPos2[2][0],SaboteurFinalPos2[2][1],SaboteurFinalPos2[2][2],1.862674); + break; + case 3: + for(int i=0;i<2;i++) + AddWaypoint(i,SaboteurFinalPos3[i][0],SaboteurFinalPos3[i][1],SaboteurFinalPos3[i][2],0); + me->SetHomePosition(SaboteurFinalPos3[1][0],SaboteurFinalPos3[1][1],SaboteurFinalPos3[1][2],5.500638); + break; + case 4: + AddWaypoint(0,SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],0); + me->SetHomePosition(SaboteurFinalPos4[0],SaboteurFinalPos4[1],SaboteurFinalPos4[2],3.991108); + break; + case 5: + AddWaypoint(0,SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],0); + me->SetHomePosition(SaboteurFinalPos5[0],SaboteurFinalPos5[1],SaboteurFinalPos5[2],1.100841); + break; + case 6: + for(int i=0;i<5;i++) + AddWaypoint(i,SaboteurFinalPos6[i][0],SaboteurFinalPos6[i][1],SaboteurFinalPos6[i][2],0); + me->SetHomePosition(SaboteurFinalPos6[4][0],SaboteurFinalPos6[4][1],SaboteurFinalPos6[4][2],0.983031); + break; + } + + SetDespawnAtEnd(false); + Start(true,true); + } + } + + void FinishPointReached() + { + me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); + me->DisappearAndDie(); + Creature* pSaboPort = Unit::GetCreature((*me),pInstance->GetData64(DATA_SABOTEUR_PORTAL)); + if (pSaboPort) + pSaboPort->DisappearAndDie(); + pInstance->SetData(DATA_START_BOSS_ENCOUNTER, 1); + } + }; - void FinishPointReached() - { - me->CastSpell(me, SABOTEUR_SHIELD_DISRUPTION, false); - me->DisappearAndDie(); - Creature* pSaboPort = Unit::GetCreature((*me),pInstance->GetData64(DATA_SABOTEUR_PORTAL)); - if (pSaboPort) - pSaboPort->DisappearAndDie(); - pInstance->SetData(DATA_START_BOSS_ENCOUNTER, 1); - } }; -CreatureAI* GetAI_mob_azure_saboteur(Creature* pCreature) + class npc_teleportation_portal_vh : public CreatureScript { - return new mob_azure_saboteurAI (pCreature); -} +public: + npc_teleportation_portal_vh() : CreatureScript("npc_teleportation_portal_vh") { } -struct npc_teleportation_portalAI : public ScriptedAI -{ - npc_teleportation_portalAI(Creature *c) : ScriptedAI(c), listOfMobs(me) + CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) { - pInstance = c->GetInstanceData(); - uiTypeOfMobsPortal = urand(0,1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs - bPortalGuardianOrKeeperOrEliteSpawn = false; + return new npc_teleportation_portalAI(pCreature); } - uint32 uiSpawnTimer; - bool bPortalGuardianOrKeeperOrEliteSpawn; - uint8 uiTypeOfMobsPortal; - - SummonList listOfMobs; - - ScriptedInstance *pInstance; - - void Reset() + struct npc_teleportation_portalAI : public ScriptedAI { - uiSpawnTimer = 10000; - bPortalGuardianOrKeeperOrEliteSpawn = false; - } - - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!pInstance) //Massive usage of pInstance, global check - return; - - if (pInstance->GetData(DATA_REMOVE_NPC) == 1) + npc_teleportation_portalAI(Creature *c) : ScriptedAI(c), listOfMobs(me) { - me->ForcedDespawn(); - pInstance->SetData(DATA_REMOVE_NPC, 0); + pInstance = c->GetInstanceScript(); + uiTypeOfMobsPortal = urand(0,1); // 0 - elite mobs 1 - portal guardian or portal keeper with regular mobs + bPortalGuardianOrKeeperOrEliteSpawn = false; } - uint8 uiWaveCount = pInstance->GetData(DATA_WAVE_COUNT); - if ((uiWaveCount == 6) || (uiWaveCount == 12)) //Don't spawn mobs on boss encounters - return; + uint32 uiSpawnTimer; + bool bPortalGuardianOrKeeperOrEliteSpawn; + uint8 uiTypeOfMobsPortal; + + SummonList listOfMobs; - switch(uiTypeOfMobsPortal) + InstanceScript *pInstance; + + void Reset() { - // spawn elite mobs and then set portals visibility to make it look like it dissapeard - case 0: - if (!bPortalGuardianOrKeeperOrEliteSpawn) - { + uiSpawnTimer = 10000; + bPortalGuardianOrKeeperOrEliteSpawn = false; + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!pInstance) //Massive usage of pInstance, global check + return; + + if (pInstance->GetData(DATA_REMOVE_NPC) == 1) + { + me->ForcedDespawn(); + pInstance->SetData(DATA_REMOVE_NPC, 0); + } + + uint8 uiWaveCount = pInstance->GetData(DATA_WAVE_COUNT); + if ((uiWaveCount == 6) || (uiWaveCount == 12)) //Don't spawn mobs on boss encounters + return; + + switch(uiTypeOfMobsPortal) + { + // spawn elite mobs and then set portals visibility to make it look like it dissapeard + case 0: + if (!bPortalGuardianOrKeeperOrEliteSpawn) + { + if (uiSpawnTimer <= diff) + { + bPortalGuardianOrKeeperOrEliteSpawn = true; + uint8 k = uiWaveCount < 12 ? 2 : 3; + for (uint8 i = 0; i < k; ++i) + { + uint32 entry = RAND(CREATURE_AZURE_CAPTAIN,CREATURE_AZURE_RAIDER,CREATURE_AZURE_STALKER,CREATURE_AZURE_SORCEROR); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } + me->SetVisibility(VISIBILITY_OFF); + } else uiSpawnTimer -= diff; + } + else + { + // if all spawned elites have died kill portal + if (listOfMobs.empty()) + { + me->Kill(me, false); + me->RemoveCorpse(); + } + } + break; + // spawn portal guardian or portal keeper with regular mobs + case 1: if (uiSpawnTimer <= diff) { - bPortalGuardianOrKeeperOrEliteSpawn = true; - uint8 k = uiWaveCount < 12 ? 2 : 3; - for (uint8 i = 0; i < k; ++i) + if (bPortalGuardianOrKeeperOrEliteSpawn) { - uint32 entry = RAND(CREATURE_AZURE_CAPTAIN,CREATURE_AZURE_RAIDER,CREATURE_AZURE_STALKER,CREATURE_AZURE_SORCEROR); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + uint8 k = pInstance->GetData(DATA_WAVE_COUNT) < 12 ? 3 : 4; + for (uint8 i = 0; i < k; ++i) + { + uint32 entry = RAND(CREATURE_AZURE_INVADER_1,CREATURE_AZURE_INVADER_2,CREATURE_AZURE_SPELLBREAKER_1,CREATURE_AZURE_SPELLBREAKER_2,CREATURE_AZURE_MAGE_SLAYER_1,CREATURE_AZURE_MAGE_SLAYER_2,CREATURE_AZURE_BINDER_1,CREATURE_AZURE_BINDER_2); + DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); + } } - me->SetVisibility(VISIBILITY_OFF); + else + { + bPortalGuardianOrKeeperOrEliteSpawn = true; + uint32 entry = RAND(CREATURE_PORTAL_GUARDIAN, CREATURE_PORTAL_KEEPER); + if (Creature *pPortalKeeper = DoSummon(entry, me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) + me->CastSpell(pPortalKeeper, SPELL_PORTAL_CHANNEL, false); + } + uiSpawnTimer = SPAWN_TIME; } else uiSpawnTimer -= diff; - } - else - { - // if all spawned elites have died kill portal - if (listOfMobs.empty()) + + if (bPortalGuardianOrKeeperOrEliteSpawn && !me->IsNonMeleeSpellCasted(false)) { me->Kill(me, false); me->RemoveCorpse(); } - } - break; - // spawn portal guardian or portal keeper with regular mobs - case 1: - if (uiSpawnTimer <= diff) - { - if (bPortalGuardianOrKeeperOrEliteSpawn) - { - uint8 k = pInstance->GetData(DATA_WAVE_COUNT) < 12 ? 3 : 4; - for (uint8 i = 0; i < k; ++i) - { - uint32 entry = RAND(CREATURE_AZURE_INVADER_1,CREATURE_AZURE_INVADER_2,CREATURE_AZURE_SPELLBREAKER_1,CREATURE_AZURE_SPELLBREAKER_2,CREATURE_AZURE_MAGE_SLAYER_1,CREATURE_AZURE_MAGE_SLAYER_2,CREATURE_AZURE_BINDER_1,CREATURE_AZURE_BINDER_2); - DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN); - } - } - else - { - bPortalGuardianOrKeeperOrEliteSpawn = true; - uint32 entry = RAND(CREATURE_PORTAL_GUARDIAN, CREATURE_PORTAL_KEEPER); - if (Creature *pPortalKeeper = DoSummon(entry, me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN)) - me->CastSpell(pPortalKeeper, SPELL_PORTAL_CHANNEL, false); - } - uiSpawnTimer = SPAWN_TIME; - } else uiSpawnTimer -= diff; - - if (bPortalGuardianOrKeeperOrEliteSpawn && !me->IsNonMeleeSpellCasted(false)) - { - me->Kill(me, false); - me->RemoveCorpse(); - } - break; + break; + } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_WAVE_COUNT,pInstance->GetData(DATA_WAVE_COUNT)+1); + } - void JustSummoned(Creature *pSummoned) - { - listOfMobs.Summon(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); - } + void JustSummoned(Creature *pSummoned) + { + listOfMobs.Summon(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_ADD_TRASH_MOB,pSummoned->GetGUID()); + } + + void SummonedMobDied(Creature *pSummoned) + { + listOfMobs.Despawn(pSummoned); + if (pSummoned) + pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); + } + }; - void SummonedMobDied(Creature *pSummoned) - { - listOfMobs.Despawn(pSummoned); - if (pSummoned) - pInstance->SetData64(DATA_DEL_TRASH_MOB,pSummoned->GetGUID()); - } }; -CreatureAI* GetAI_npc_teleportation_portal(Creature *pCreature) -{ - return new npc_teleportation_portalAI(pCreature); -} - struct violet_hold_trashAI : public npc_escortAI { violet_hold_trashAI(Creature *c):npc_escortAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); bHasGotMovingPoints = false; if (pInstance) portalLocationID = pInstance->GetData(DATA_PORTAL_LOCATION); @@ -660,7 +682,7 @@ struct violet_hold_trashAI : public npc_escortAI } public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool bHasGotMovingPoints; uint32 portalLocationID; uint32 secondPortalRouteID; @@ -756,7 +778,7 @@ struct violet_hold_trashAI : public npc_escortAI void JustDied(Unit *unit) { if (Creature* portal = Unit::GetCreature((*me),pInstance->GetData64(DATA_TELEPORTATION_PORTAL))) - CAST_AI(npc_teleportation_portalAI,portal->AI())->SummonedMobDied(me); + CAST_AI(npc_teleportation_portal_vh::npc_teleportation_portalAI,portal->AI())->SummonedMobDied(me); if (pInstance) pInstance->SetData(DATA_NPC_PRESENCE_AT_DOOR_REMOVE,1); } @@ -770,532 +792,530 @@ struct violet_hold_trashAI : public npc_escortAI } }; - -struct mob_azure_invaderAI : public violet_hold_trashAI + class mob_azure_invader : public CreatureScript { - mob_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) +public: + mob_azure_invader() : CreatureScript("mob_azure_invader") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_azure_invaderAI (pCreature); } - uint32 uiCleaveTimer; - uint32 uiImpaleTimer; - uint32 uiBrutalStrikeTimer; - uint32 uiSunderArmorTimer; - - void Reset() + struct mob_azure_invaderAI : public violet_hold_trashAI { - uiCleaveTimer = 5000; - uiImpaleTimer = 4000; - uiBrutalStrikeTimer = 5000; - uiSunderArmorTimer = 4000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (me->GetEntry() == CREATURE_AZURE_INVADER_1) + mob_azure_invaderAI(Creature *c) : violet_hold_trashAI(c) { - if (uiCleaveTimer <= diff) - { - DoCast(me->getVictim(),SPELL_CLEAVE); - uiCleaveTimer = 5000; - } else uiCleaveTimer -= diff; - - if (uiImpaleTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_IMPALE); - uiImpaleTimer = 4000; - } else uiImpaleTimer -= diff; + pInstance = c->GetInstanceScript(); } - if (me->GetEntry() == CREATURE_AZURE_INVADER_2) - { - if (uiBrutalStrikeTimer <= diff) - { - DoCast(me->getVictim(),SPELL_BRUTAL_STRIKE); - uiBrutalStrikeTimer = 5000; - } else uiBrutalStrikeTimer -= diff; + uint32 uiCleaveTimer; + uint32 uiImpaleTimer; + uint32 uiBrutalStrikeTimer; + uint32 uiSunderArmorTimer; - if (uiSunderArmorTimer <= diff) + void Reset() + { + uiCleaveTimer = 5000; + uiImpaleTimer = 4000; + uiBrutalStrikeTimer = 5000; + uiSunderArmorTimer = 4000; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_INVADER_1) { - DoCast(me->getVictim(),SPELL_SUNDER_ARMOR); - uiSunderArmorTimer = urand(8000,10000); - } else uiSunderArmorTimer -= diff; + if (uiCleaveTimer <= diff) + { + DoCast(me->getVictim(),SPELL_CLEAVE); + uiCleaveTimer = 5000; + } else uiCleaveTimer -= diff; + + if (uiImpaleTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_IMPALE); + uiImpaleTimer = 4000; + } else uiImpaleTimer -= diff; + } + + if (me->GetEntry() == CREATURE_AZURE_INVADER_2) + { + if (uiBrutalStrikeTimer <= diff) + { + DoCast(me->getVictim(),SPELL_BRUTAL_STRIKE); + uiBrutalStrikeTimer = 5000; + } else uiBrutalStrikeTimer -= diff; + + if (uiSunderArmorTimer <= diff) + { + DoCast(me->getVictim(),SPELL_SUNDER_ARMOR); + uiSunderArmorTimer = urand(8000,10000); + } else uiSunderArmorTimer -= diff; + + DoMeleeAttackIfReady(); + } DoMeleeAttackIfReady(); } - - DoMeleeAttackIfReady(); - } + }; }; - -struct mob_azure_spellbreakerAI : public violet_hold_trashAI + class mob_azure_binder : public CreatureScript { - mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) +public: + mob_azure_binder() : CreatureScript("mob_azure_binder") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_azure_binderAI (pCreature); } - uint32 uiArcaneBlastTimer; - uint32 uiSlowTimer; - uint32 uiChainsOfIceTimer; - uint32 uiConeOfColdTimer; - - void Reset() + struct mob_azure_binderAI : public violet_hold_trashAI { - uiArcaneBlastTimer = 5000; - uiSlowTimer = 4000; - uiChainsOfIceTimer = 5000; - uiConeOfColdTimer = 4000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_1) + mob_azure_binderAI(Creature *c) : violet_hold_trashAI(c) { - if (uiArcaneBlastTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BLAST,H_SPELL_ARCANE_BLAST)); - uiArcaneBlastTimer = 6000; - } else uiArcaneBlastTimer -= diff; + pInstance = c->GetInstanceScript(); + } - if (uiSlowTimer <= diff) + uint32 uiArcaneExplosionTimer; + uint32 uiArcainBarrageTimer; + uint32 uiFrostNovaTimer; + uint32 uiFrostboltTimer; + + void Reset() + { + uiArcaneExplosionTimer = 5000; + uiArcainBarrageTimer = 4000; + uiFrostNovaTimer = 5000; + uiFrostboltTimer = 4000; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_BINDER_1) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (uiArcaneExplosionTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_ARCANE_EXPLOSION,H_SPELL_ARCANE_EXPLOSION)); + uiArcaneExplosionTimer = 5000; + } else uiArcaneExplosionTimer -= diff; + + if (uiArcainBarrageTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (pTarget) - DoCast(pTarget,SPELL_SLOW); - uiSlowTimer = 5000; - } else uiSlowTimer -= diff; - } + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BARRAGE,H_SPELL_ARCANE_BARRAGE)); + uiArcainBarrageTimer = 6000; + } else uiArcainBarrageTimer -= diff; + } - if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_2) - { - if (uiChainsOfIceTimer <= diff) + if (me->GetEntry() == CREATURE_AZURE_BINDER_2) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_CHAINS_OF_ICE); - uiChainsOfIceTimer = 7000; - } else uiChainsOfIceTimer -= diff; + if (uiFrostNovaTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_FROST_NOVA,H_SPELL_FROST_NOVA)); + uiFrostNovaTimer = 5000; + } else uiFrostNovaTimer -= diff; - if (uiConeOfColdTimer <= diff) - { - DoCast(DUNGEON_MODE(SPELL_CONE_OF_COLD,H_SPELL_CONE_OF_COLD)); - uiConeOfColdTimer = 5000; - } else uiConeOfColdTimer -= diff; - } - - DoMeleeAttackIfReady(); - } -}; - -struct mob_azure_binderAI : public violet_hold_trashAI -{ - mob_azure_binderAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneExplosionTimer; - uint32 uiArcainBarrageTimer; - uint32 uiFrostNovaTimer; - uint32 uiFrostboltTimer; - - void Reset() - { - uiArcaneExplosionTimer = 5000; - uiArcainBarrageTimer = 4000; - uiFrostNovaTimer = 5000; - uiFrostboltTimer = 4000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (me->GetEntry() == CREATURE_AZURE_BINDER_1) - { - if (uiArcaneExplosionTimer <= diff) - { - DoCast(DUNGEON_MODE(SPELL_ARCANE_EXPLOSION,H_SPELL_ARCANE_EXPLOSION)); - uiArcaneExplosionTimer = 5000; - } else uiArcaneExplosionTimer -= diff; - - if (uiArcainBarrageTimer <= diff) - { + if (uiFrostboltTimer <= diff) + { Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BARRAGE,H_SPELL_ARCANE_BARRAGE)); - uiArcainBarrageTimer = 6000; - } else uiArcainBarrageTimer -= diff; + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_FROSTBOLT,H_SPELL_FROSTBOLT)); + uiFrostboltTimer = 6000; + } else uiFrostboltTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_azure_mage_slayer : public CreatureScript +{ +public: + mob_azure_mage_slayer() : CreatureScript("mob_azure_mage_slayer") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_mage_slayerAI (pCreature); + } + + struct mob_azure_mage_slayerAI : public violet_hold_trashAI + { + mob_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); } - if (me->GetEntry() == CREATURE_AZURE_BINDER_2) - { - if (uiFrostNovaTimer <= diff) - { - DoCast(DUNGEON_MODE(SPELL_FROST_NOVA,H_SPELL_FROST_NOVA)); - uiFrostNovaTimer = 5000; - } else uiFrostNovaTimer -= diff; + uint32 uiArcaneEmpowermentTimer; + uint32 uiSpellLockTimer; - if (uiFrostboltTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_FROSTBOLT,H_SPELL_FROSTBOLT)); - uiFrostboltTimer = 6000; - } else uiFrostboltTimer -= diff; + void Reset() + { + uiArcaneEmpowermentTimer = 5000; + uiSpellLockTimer = 5000; } - DoMeleeAttackIfReady(); - } -}; - -struct mob_azure_mage_slayerAI : public violet_hold_trashAI -{ - mob_azure_mage_slayerAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneEmpowermentTimer; - uint32 uiSpellLockTimer; - - void Reset() - { - uiArcaneEmpowermentTimer = 5000; - uiSpellLockTimer = 5000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_1) + void UpdateAI(const uint32 diff) { - if (uiArcaneEmpowermentTimer <= diff) + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_1) { - DoCast(me,SPELL_ARCANE_EMPOWERMENT); - uiArcaneEmpowermentTimer = 14000; - } else uiArcaneEmpowermentTimer -= diff; + if (uiArcaneEmpowermentTimer <= diff) + { + DoCast(me,SPELL_ARCANE_EMPOWERMENT); + uiArcaneEmpowermentTimer = 14000; + } else uiArcaneEmpowermentTimer -= diff; + } + + if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_2) + { + if (uiSpellLockTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_SPELL_LOCK); + uiSpellLockTimer = 9000; + } else uiSpellLockTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_azure_raider : public CreatureScript +{ +public: + mob_azure_raider() : CreatureScript("mob_azure_raider") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_raiderAI (pCreature); + } + + struct mob_azure_raiderAI : public violet_hold_trashAI + { + mob_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); } - if (me->GetEntry() == CREATURE_AZURE_MAGE_SLAYER_2) + uint32 uiConcussionBlowTimer; + uint32 uiMagicReflectionTimer; + + void Reset() { - if (uiSpellLockTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,SPELL_SPELL_LOCK); - uiSpellLockTimer = 9000; - } else uiSpellLockTimer -= diff; - } - - DoMeleeAttackIfReady(); - } -}; - -struct mob_azure_captainAI : public violet_hold_trashAI -{ - mob_azure_captainAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiMortalStrikeTimer; - uint32 uiWhirlwindTimer; - - void Reset() - { - uiMortalStrikeTimer = 5000; - uiWhirlwindTimer = 8000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (uiMortalStrikeTimer <= diff) - { - DoCast(me->getVictim(),SPELL_MORTAL_STRIKE); - uiMortalStrikeTimer = 5000; - } else uiMortalStrikeTimer -= diff; - - if (uiWhirlwindTimer <= diff) - { - DoCast(me,SPELL_WHIRLWIND_OF_STEEL); - uiWhirlwindTimer = 8000; - } else uiWhirlwindTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_azure_sorcerorAI : public violet_hold_trashAI -{ - mob_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiArcaneStreamTimer; - uint32 uiArcaneStreamTimerStartingValueHolder; - uint32 uiManaDetonationTimer; - - void Reset() - { - uiArcaneStreamTimer = 4000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - uiManaDetonationTimer = 5000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (uiArcaneStreamTimer <= diff) - { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_STREAM,H_SPELL_ARCANE_STREAM)); - uiArcaneStreamTimer = urand(0,5000)+5000; - uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; - } else uiArcaneStreamTimer -= diff; - - if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) - { - DoCast(DUNGEON_MODE(SPELL_MANA_DETONATION,H_SPELL_MANA_DETONATION)); - uiManaDetonationTimer = urand(2000,6000); - } else uiManaDetonationTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct mob_azure_raiderAI : public violet_hold_trashAI -{ - mob_azure_raiderAI(Creature *c) : violet_hold_trashAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiConcussionBlowTimer; - uint32 uiMagicReflectionTimer; - - void Reset() - { - uiConcussionBlowTimer = 5000; - uiMagicReflectionTimer = 8000; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (uiConcussionBlowTimer <= diff) - { - DoCast(me->getVictim(),SPELL_CONCUSSION_BLOW); uiConcussionBlowTimer = 5000; - } else uiConcussionBlowTimer -= diff; + uiMagicReflectionTimer = 8000; + } - if (uiMagicReflectionTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(SPELL_MAGIC_REFLECTION); - uiMagicReflectionTimer = urand(10000,15000); - } else uiMagicReflectionTimer -= diff; + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); - DoMeleeAttackIfReady(); + if (!UpdateVictim()) + return; + + if (uiConcussionBlowTimer <= diff) + { + DoCast(me->getVictim(),SPELL_CONCUSSION_BLOW); + uiConcussionBlowTimer = 5000; + } else uiConcussionBlowTimer -= diff; + + if (uiMagicReflectionTimer <= diff) + { + DoCast(SPELL_MAGIC_REFLECTION); + uiMagicReflectionTimer = urand(10000,15000); + } else uiMagicReflectionTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_azure_stalker : public CreatureScript +{ +public: + mob_azure_stalker() : CreatureScript("mob_azure_stalker") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_stalkerAI (pCreature); } + + struct mob_azure_stalkerAI : public violet_hold_trashAI + { + mob_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } + uint32 uiBackstabTimer; + uint32 uiTacticalBlinkTimer; + bool TacticalBlinkCasted; + + void Reset() + { + uiBackstabTimer = 1300; + uiTacticalBlinkTimer = 8000; + TacticalBlinkCasted =false; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (!TacticalBlinkCasted) + { + if (uiTacticalBlinkTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true); + if (pTarget) + DoCast(pTarget,SPELL_TACTICAL_BLINK); + uiTacticalBlinkTimer = 6000; + TacticalBlinkCasted = true; + } else uiTacticalBlinkTimer -= diff; + } + + else + { + if (uiBackstabTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true); + DoCast(pTarget,SPELL_BACKSTAB); + TacticalBlinkCasted = false; + uiBackstabTimer =1300; + } else uiBackstabTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -struct mob_azure_stalkerAI : public violet_hold_trashAI +class mob_azure_spellbreaker : public CreatureScript { - mob_azure_stalkerAI(Creature *c) : violet_hold_trashAI(c) +public: + mob_azure_spellbreaker() : CreatureScript("mob_azure_spellbreaker") { } + + struct mob_azure_spellbreakerAI : public violet_hold_trashAI { - pInstance = c->GetInstanceData(); - } - uint32 uiBackstabTimer; - uint32 uiTacticalBlinkTimer; - bool TacticalBlinkCasted; - - void Reset() - { - uiBackstabTimer = 1300; - uiTacticalBlinkTimer = 8000; - TacticalBlinkCasted =false; - } - - void UpdateAI(const uint32 diff) - { - violet_hold_trashAI::UpdateAI(diff); - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (!TacticalBlinkCasted) + mob_azure_spellbreakerAI(Creature* c) : violet_hold_trashAI(c) { - if (uiTacticalBlinkTimer <= diff) + pInstance = c->GetInstanceScript(); + } + + uint32 uiArcaneBlastTimer; + uint32 uiSlowTimer; + uint32 uiChainsOfIceTimer; + uint32 uiConeOfColdTimer; + + void Reset() + { + uiArcaneBlastTimer = 5000; + uiSlowTimer = 4000; + uiChainsOfIceTimer = 5000; + uiConeOfColdTimer = 4000; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_1) { - Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 40, true); + if (uiArcaneBlastTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_BLAST,H_SPELL_ARCANE_BLAST)); + uiArcaneBlastTimer = 6000; + } else uiArcaneBlastTimer -= diff; + + if (uiSlowTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_SLOW); + uiSlowTimer = 5000; + } else uiSlowTimer -= diff; + } + + if (me->GetEntry() == CREATURE_AZURE_SPELLBREAKER_2) + { + if (uiChainsOfIceTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget,SPELL_CHAINS_OF_ICE); + uiChainsOfIceTimer = 7000; + } else uiChainsOfIceTimer -= diff; + + if (uiConeOfColdTimer <= diff) + { + DoCast(DUNGEON_MODE(SPELL_CONE_OF_COLD,H_SPELL_CONE_OF_COLD)); + uiConeOfColdTimer = 5000; + } else uiConeOfColdTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_spellbreakerAI (pCreature); + } +}; class mob_azure_captain : public CreatureScript +{ +public: + mob_azure_captain() : CreatureScript("mob_azure_captain") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_captainAI (pCreature); + } + + struct mob_azure_captainAI : public violet_hold_trashAI + { + mob_azure_captainAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } + + uint32 uiMortalStrikeTimer; + uint32 uiWhirlwindTimer; + + void Reset() + { + uiMortalStrikeTimer = 5000; + uiWhirlwindTimer = 8000; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (uiMortalStrikeTimer <= diff) + { + DoCast(me->getVictim(),SPELL_MORTAL_STRIKE); + uiMortalStrikeTimer = 5000; + } else uiMortalStrikeTimer -= diff; + + if (uiWhirlwindTimer <= diff) + { + DoCast(me,SPELL_WHIRLWIND_OF_STEEL); + uiWhirlwindTimer = 8000; + } else uiWhirlwindTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class mob_azure_sorceror : public CreatureScript +{ +public: + mob_azure_sorceror() : CreatureScript("mob_azure_sorceror") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_azure_sorcerorAI (pCreature); + } + + struct mob_azure_sorcerorAI : public violet_hold_trashAI + { + mob_azure_sorcerorAI(Creature *c) : violet_hold_trashAI(c) + { + pInstance = c->GetInstanceScript(); + } + + uint32 uiArcaneStreamTimer; + uint32 uiArcaneStreamTimerStartingValueHolder; + uint32 uiManaDetonationTimer; + + void Reset() + { + uiArcaneStreamTimer = 4000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + uiManaDetonationTimer = 5000; + } + + void UpdateAI(const uint32 diff) + { + violet_hold_trashAI::UpdateAI(diff); + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (uiArcaneStreamTimer <= diff) + { + Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); if (pTarget) - DoCast(pTarget,SPELL_TACTICAL_BLINK); - uiTacticalBlinkTimer = 6000; - TacticalBlinkCasted = true; - } else uiTacticalBlinkTimer -= diff; - } + DoCast(pTarget,DUNGEON_MODE(SPELL_ARCANE_STREAM,H_SPELL_ARCANE_STREAM)); + uiArcaneStreamTimer = urand(0,5000)+5000; + uiArcaneStreamTimerStartingValueHolder = uiArcaneStreamTimer; + } else uiArcaneStreamTimer -= diff; - else - { - if (uiBackstabTimer <= diff) + if (uiManaDetonationTimer <= diff && uiArcaneStreamTimer >=1500 && uiArcaneStreamTimer <= uiArcaneStreamTimerStartingValueHolder/2) { - Unit* pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0, 10, true); - DoCast(pTarget,SPELL_BACKSTAB); - TacticalBlinkCasted = false; - uiBackstabTimer =1300; - } else uiBackstabTimer -= diff; + DoCast(DUNGEON_MODE(SPELL_MANA_DETONATION,H_SPELL_MANA_DETONATION)); + uiManaDetonationTimer = urand(2000,6000); + } else uiManaDetonationTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -CreatureAI* GetAI_mob_azure_invader(Creature* pCreature) -{ - return new mob_azure_invaderAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_spellbreaker(Creature* pCreature) -{ - return new mob_azure_spellbreakerAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_binder(Creature* pCreature) -{ - return new mob_azure_binderAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_mage_slayer(Creature* pCreature) -{ - return new mob_azure_mage_slayerAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_captain(Creature* pCreature) -{ - return new mob_azure_captainAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_sorceror(Creature* pCreature) -{ - return new mob_azure_sorcerorAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_raider(Creature* pCreature) -{ - return new mob_azure_raiderAI (pCreature); -} - -CreatureAI* GetAI_mob_azure_stalker(Creature* pCreature) -{ - return new mob_azure_stalkerAI (pCreature); -} - void AddSC_violet_hold() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_sinclari_vh"; - newscript->GetAI = &GetAI_npc_sinclari; - newscript->pGossipHello = &GossipHello_npc_sinclari; - newscript->pGossipSelect = &GossipSelect_npc_sinclari; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_teleportation_portal_vh"; - newscript->GetAI = &GetAI_npc_teleportation_portal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_invader"; - newscript->GetAI = &GetAI_mob_azure_invader; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_spellbreaker"; - newscript->GetAI = &GetAI_mob_azure_invader; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_binder"; - newscript->GetAI = &GetAI_mob_azure_binder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_mage_slayer"; - newscript->GetAI = &GetAI_mob_azure_mage_slayer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_captain"; - newscript->GetAI = &GetAI_mob_azure_captain; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_sorceror"; - newscript->GetAI = &GetAI_mob_azure_sorceror; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_raider"; - newscript->GetAI = &GetAI_mob_azure_raider; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_stalker"; - newscript->GetAI = &GetAI_mob_azure_stalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_azure_saboteur"; - newscript->GetAI = &GetAI_mob_azure_saboteur; - newscript->RegisterSelf(); + new npc_sinclari_vh(); + new npc_teleportation_portal_vh(); + new mob_azure_invader(); + new mob_azure_spellbreaker(); + new mob_azure_binder(); + new mob_azure_mage_slayer(); + new mob_azure_captain(); + new mob_azure_sorceror(); + new mob_azure_raider(); + new mob_azure_stalker(); + new mob_azure_saboteur(); } diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index d405c1e15af..a0357b2af8d 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -802,7 +802,7 @@ public: pGo->UseDoorOrButton(20); } - if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbrAI, pCreature->AI())) + if (npc_escortAI* pEscortAI = CAST_AI(npc_lurgglbr::npc_lurgglbrAI, pCreature->AI())) pEscortAI->Start(true, false, pPlayer->GetGUID()); switch (pPlayer->GetTeam()) @@ -2126,7 +2126,7 @@ public: (me->HasAura(SPELL_AURA_NOTSOBIG_1) || me->HasAura(SPELL_AURA_NOTSOBIG_2) || me->HasAura(SPELL_AURA_NOTSOBIG_3) || me->HasAura(SPELL_AURA_NOTSOBIG_4))) { - Quest const* qInfo = objmgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(QUEST_YOU_RE_NOT_SO_BIG_NOW); if (qInfo) CAST_PLR(pKiller)->KilledMonsterCredit(qInfo->ReqCreatureOrGOId[0],0); } diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index e9224e6365c..2b849cc3d12 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -252,7 +252,7 @@ public: if (quest->GetQuestId() == QUEST_A_RIGHTEOUS_SERMON) { DoScriptText(SAY_WP_0, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallardAI, pCreature->AI())) + if (npc_escortAI* pEscortAI = CAST_AI(npc_inquisitor_hallard::npc_inquisitor_hallardAI, pCreature->AI())) { pEscortAI->Start(true, false, pPlayer->GetGUID(), 0, true); pCreature->GetMotionMaster()->MovePoint(0, 3801.543, -679.350, 213.75); diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 03bd63f6284..fcf0775f0c8 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -318,7 +318,7 @@ public: Mrfloppy->GetMotionMaster()->MoveFollow(pCreature, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); } - if (npc_escortAI* pEscortAI = CAST_AI(npc_emilyAI, (pCreature->AI()))) + if (npc_escortAI* pEscortAI = CAST_AI(npc_emily::npc_emilyAI, (pCreature->AI()))) pEscortAI->Start(true, false, pPlayer->GetGUID()); } return true; diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 5c846d71760..cd175d20797 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -430,7 +430,7 @@ public: { if (pQuest->GetQuestId() == QUEST_DISASTER) { - if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_heliceAI, pCreature->AI())) + if (npc_engineer_heliceAI* pEscortAI = CAST_AI(npc_engineer_helice::npc_engineer_heliceAI, pCreature->AI())) { pCreature->GetMotionMaster()->MoveJumpTo(0, 0.4, 0.4); pCreature->setFaction(113); diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index aa6d7e9d9f2..715ec52d2e7 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -470,7 +470,7 @@ public: bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblinAI, pCreature->AI()); + npc_escortAI* pEscortAI = CAST_AI(npc_injured_goblin::npc_injured_goblinAI, pCreature->AI()); if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index a11b886d65f..8d9cccd473c 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -1362,7 +1362,7 @@ public: { pPlayer->CLOSE_GOSSIP_MENU(); pCreature->CastSpell(pPlayer, SPELL_QUEST_CREDIT, true); - CAST_AI(npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; + CAST_AI(npc_crusade_recruit::npc_crusade_recruitAI, (pCreature->AI()))->m_uiPhase = 1; pCreature->SetInFront(pPlayer); pCreature->SendMovementFlagUpdate(); } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index ff3778af19a..fb60f310285 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -42,12 +42,12 @@ void OPvPCapturePointEP_EWT::ChangeState() // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_H)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } @@ -63,7 +63,7 @@ void OPvPCapturePointEP_EWT::ChangeState() artkit = 2; SummonSupportUnitAtNorthpassTower(ALLIANCE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: if (m_value == -m_maxValue) @@ -73,7 +73,7 @@ void OPvPCapturePointEP_EWT::ChangeState() artkit = 1; SummonSupportUnitAtNorthpassTower(HORDE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -193,12 +193,12 @@ void OPvPCapturePointEP_NPT::ChangeState() // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_NPT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; } @@ -214,7 +214,7 @@ void OPvPCapturePointEP_NPT::ChangeState() artkit = 2; SummonGO(ALLIANCE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); break; case OBJECTIVESTATE_HORDE: if (m_value == -m_maxValue) @@ -224,7 +224,7 @@ void OPvPCapturePointEP_NPT::ChangeState() artkit = 1; SummonGO(HORDE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -340,12 +340,12 @@ void OPvPCapturePointEP_CGT::ChangeState() // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_A)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_H)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_CGT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; } @@ -361,7 +361,7 @@ void OPvPCapturePointEP_CGT::ChangeState() artkit = 2; LinkGraveYard(ALLIANCE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = ALLIANCE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); break; case OBJECTIVESTATE_HORDE: if (m_value == -m_maxValue) @@ -371,7 +371,7 @@ void OPvPCapturePointEP_CGT::ChangeState() artkit = 1; LinkGraveYard(HORDE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = HORDE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -462,8 +462,8 @@ void OPvPCapturePointEP_CGT::LinkGraveYard(uint32 team) if (m_GraveyardSide != team) { m_GraveyardSide = team; - objmgr.RemoveGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); - objmgr.AddGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); + sObjectMgr.RemoveGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); + sObjectMgr.AddGraveYardLink(EP_GraveYardId,EP_GraveYardZone,team,false); } } @@ -482,12 +482,12 @@ void OPvPCapturePointEP_PWT::ChangeState() // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { - sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); + sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } @@ -503,7 +503,7 @@ void OPvPCapturePointEP_PWT::ChangeState() SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: if (m_value == -m_maxValue) @@ -513,7 +513,7 @@ void OPvPCapturePointEP_PWT::ChangeState() SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; - if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); + if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index b438d4c5ee7..9967f1e234f 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -175,13 +175,13 @@ void OPvPCapturePointHP::ChangeState() field = HP_MAP_A[m_TowerType]; if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--; - sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_A[m_TowerType])); + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_A[m_TowerType])); break; case OBJECTIVESTATE_HORDE: field = HP_MAP_H[m_TowerType]; if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--; - sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_H[m_TowerType])); + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(HP_LANG_LOOSE_H[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: field = HP_MAP_N[m_TowerType]; @@ -216,7 +216,7 @@ void OPvPCapturePointHP::ChangeState() artkit2 = HP_TowerArtKit_A[m_TowerType]; if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3) ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++; - sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); break; case OBJECTIVESTATE_HORDE: field = HP_MAP_H[m_TowerType]; @@ -224,7 +224,7 @@ void OPvPCapturePointHP::ChangeState() artkit2 = HP_TowerArtKit_H[m_TowerType]; if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3) ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++; - sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); + sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: field = HP_MAP_N[m_TowerType]; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 57eff0c9f19..47aad9ef6bb 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -69,7 +69,7 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() if (cr->isAlive()) ++cnt; } - else if (CreatureData const * cd = objmgr.GetCreatureData(GUID_LOPART(itr->second))) + else if (CreatureData const * cd = sObjectMgr.GetCreatureData(GUID_LOPART(itr->second))) { if (!cd->is_dead) ++cnt; @@ -137,15 +137,15 @@ void OPvPCapturePointNA::DeSpawnGOs() void OPvPCapturePointNA::FactionTakeOver(uint32 team) { if (m_ControllingFaction) - objmgr.RemoveGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); + sObjectMgr.RemoveGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); if (m_ControllingFaction == ALLIANCE) - sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_A)); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_A)); else if (m_ControllingFaction == HORDE) - sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_H)); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOOSE_H)); m_ControllingFaction = team; if (m_ControllingFaction) - objmgr.AddGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); + sObjectMgr.AddGraveYardLink(NA_HALAA_GRAVEYARD,NA_HALAA_GRAVEYARD_ZONE,m_ControllingFaction,false); DeSpawnGOs(); DeSpawnNPCs(); SpawnGOsForTeam(team); @@ -163,7 +163,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 0); m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 1); m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); - sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A)); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A)); } else { @@ -175,7 +175,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 1); m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0); m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); - sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H)); + sWorld.SendZoneText(NA_HALAA_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H)); } UpdateWyvernRoostWorldState(NA_ROOST_S); UpdateWyvernRoostWorldState(NA_ROOST_N); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 3e21fa2b6ce..92ea965b465 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -94,7 +94,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger) if (m_Gathered_A >= SI_MAX_RESOURCES) { TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR); - sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A)); + sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A)); m_LastController = ALLIANCE; m_Gathered_A = 0; m_Gathered_H = 0; @@ -119,7 +119,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger) if (m_Gathered_H >= SI_MAX_RESOURCES) { TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR); - sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H)); + sWorld.SendZoneText(OutdoorPvPSIBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H)); m_LastController = HORDE; m_Gathered_A = 0; m_Gathered_H = 0; @@ -163,7 +163,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId) return true; } - if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask(), plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY)) + if (!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask(), plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY)) { delete go; } @@ -192,7 +192,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player *plr, uint32 spellId) delete go; return true; } - if (!go->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask() ,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY)) + if (!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),SI_SILITHYST_MOUND, map, plr->GetPhaseMask() ,plr->GetPositionX(),plr->GetPositionY(),plr->GetPositionZ(),plr->GetOrientation(),0,0,0,0,100,GO_STATE_READY)) { delete go; } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index a68241c8691..d3fcc07592f 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -250,14 +250,14 @@ void OPvPCapturePointTF::ChangeState() { if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; - sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A)); + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A)); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; - sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_H)); + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_H)); } uint32 artkit = 21; @@ -269,7 +269,7 @@ void OPvPCapturePointTF::ChangeState() artkit = 2; if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlledm_AllianceTowersControlled++; - sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; @@ -278,7 +278,7 @@ void OPvPCapturePointTF::ChangeState() artkit = 1; if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlledm_HordeTowersControlled++; - sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); + sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index a0ad6fc9507..ca4ff375efe 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -78,14 +78,14 @@ void OPvPCapturePointZM_Beacon::ChangeState() { if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseA[m_TowerType])); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(ZMBeaconLooseA[m_TowerType])); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconLooseH[m_TowerType])); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(ZMBeaconLooseH[m_TowerType])); } switch(m_State) @@ -94,13 +94,13 @@ void OPvPCapturePointZM_Beacon::ChangeState() m_TowerState = ZM_TOWERSTATE_A; if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlledm_AllianceTowersControlled++; - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); break; case OBJECTIVESTATE_HORDE: m_TowerState = ZM_TOWERSTATE_H; if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlledm_HordeTowersControlled++; - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: @@ -216,28 +216,28 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player *plr, uint64 guid) if (plr->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A) { if (m_GraveYardState == ZM_GRAVEYARD_H) - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_H)); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_H)); m_GraveYardState = ZM_GRAVEYARD_A; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0,ZM_Banner_A.entry,ZM_Banner_A.map,ZM_Banner_A.x,ZM_Banner_A.y,ZM_Banner_A.z,ZM_Banner_A.o,ZM_Banner_A.rot0,ZM_Banner_A.rot1,ZM_Banner_A.rot2,ZM_Banner_A.rot3); - objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy - objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy + sObjectMgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE); // rem gy + sObjectMgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy m_PvP->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF); plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); } else if (plr->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H) { if (m_GraveYardState == ZM_GRAVEYARD_A) - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_A)); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOOSE_GY_A)); m_GraveYardState = ZM_GRAVEYARD_H; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0,ZM_Banner_H.entry,ZM_Banner_H.map,ZM_Banner_H.x,ZM_Banner_H.y,ZM_Banner_H.z,ZM_Banner_H.o,ZM_Banner_H.rot0,ZM_Banner_H.rot1,ZM_Banner_H.rot2,ZM_Banner_H.rot3); - objmgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy - objmgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy + sObjectMgr.RemoveGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE); // rem gy + sObjectMgr.AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy m_PvP->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF); plr->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); - sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); + sWorld.SendZoneText(ZM_GRAVEYARD_ZONE,sObjectMgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); } UpdateTowerState(); } @@ -311,7 +311,7 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction) if (m_FlagCarrierGUID) { // remove flag from carrier, reset flag carrier guid - Player * p = objmgr.GetPlayer(m_FlagCarrierGUID); + Player * p = sObjectMgr.GetPlayer(m_FlagCarrierGUID); if (p) { p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp index 353da092dba..6b5f02789dc 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_exarch_maladaar.cpp @@ -40,83 +40,90 @@ EndContentData */ #define SPELL_MORTAL_STRIKE 37335 #define SPELL_FREEZING_TRAP 37368 #define SPELL_HAMMER_OF_JUSTICE 37369 - -struct mob_stolen_soulAI : public ScriptedAI + class mob_stolen_soul : public CreatureScript { - mob_stolen_soulAI(Creature *c) : ScriptedAI(c) {} +public: + mob_stolen_soul() : CreatureScript("mob_stolen_soul") { } - uint8 myClass; - uint32 Class_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Class_Timer = 1000; + return new mob_stolen_soulAI (pCreature); } - void EnterCombat(Unit * /*who*/) - { } - - void SetMyClass(uint8 myclass) + struct mob_stolen_soulAI : public ScriptedAI { - myClass = myclass; - } + mob_stolen_soulAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint8 myClass; + uint32 Class_Timer; - if (Class_Timer <= diff) + void Reset() { - switch (myClass) - { - case CLASS_WARRIOR: - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - Class_Timer = 6000; - break; - case CLASS_PALADIN: - DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); - Class_Timer = 6000; - break; - case CLASS_HUNTER: - DoCast(me->getVictim(), SPELL_FREEZING_TRAP); - Class_Timer = 20000; - break; - case CLASS_ROGUE: - DoCast(me->getVictim(), SPELL_HEMORRHAGE); - Class_Timer = 10000; - break; - case CLASS_PRIEST: - DoCast(me->getVictim(), SPELL_MIND_FLAY); - Class_Timer = 5000; - break; - case CLASS_SHAMAN: - DoCast(me->getVictim(), SPELL_FROSTSHOCK); - Class_Timer = 8000; - break; - case CLASS_MAGE: - DoCast(me->getVictim(), SPELL_FIREBALL); - Class_Timer = 5000; - break; - case CLASS_WARLOCK: - DoCast(me->getVictim(), SPELL_CURSE_OF_AGONY); - Class_Timer = 20000; - break; - case CLASS_DRUID: - DoCast(me->getVictim(), SPELL_MOONFIRE); - Class_Timer = 10000; - break; - } - } else Class_Timer -= diff; + Class_Timer = 1000; + } + + void EnterCombat(Unit * /*who*/) + { } + + void SetMyClass(uint8 myclass) + { + myClass = myclass; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Class_Timer <= diff) + { + switch (myClass) + { + case CLASS_WARRIOR: + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + Class_Timer = 6000; + break; + case CLASS_PALADIN: + DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); + Class_Timer = 6000; + break; + case CLASS_HUNTER: + DoCast(me->getVictim(), SPELL_FREEZING_TRAP); + Class_Timer = 20000; + break; + case CLASS_ROGUE: + DoCast(me->getVictim(), SPELL_HEMORRHAGE); + Class_Timer = 10000; + break; + case CLASS_PRIEST: + DoCast(me->getVictim(), SPELL_MIND_FLAY); + Class_Timer = 5000; + break; + case CLASS_SHAMAN: + DoCast(me->getVictim(), SPELL_FROSTSHOCK); + Class_Timer = 8000; + break; + case CLASS_MAGE: + DoCast(me->getVictim(), SPELL_FIREBALL); + Class_Timer = 5000; + break; + case CLASS_WARLOCK: + DoCast(me->getVictim(), SPELL_CURSE_OF_AGONY); + Class_Timer = 20000; + break; + case CLASS_DRUID: + DoCast(me->getVictim(), SPELL_MOONFIRE); + Class_Timer = 10000; + break; + } + } else Class_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_stolen_soul(Creature* pCreature) -{ - return new mob_stolen_soulAI (pCreature); -} #define SAY_INTRO -1558000 #define SAY_SUMMON -1558001 @@ -142,209 +149,209 @@ CreatureAI* GetAI_mob_stolen_soul(Creature* pCreature) #define SPELL_SUMMON_AVATAR 32424 #define ENTRY_STOLEN_SOUL 18441 - -struct boss_exarch_maladaarAI : public ScriptedAI + class boss_exarch_maladaar : public CreatureScript { - boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) +public: + boss_exarch_maladaar() : CreatureScript("boss_exarch_maladaar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - HasTaunted = false; + return new boss_exarch_maladaarAI (pCreature); } - uint32 soulmodel; - uint64 soulholder; - uint8 soulclass; - - uint32 Fear_timer; - uint32 Ribbon_of_Souls_timer; - uint32 StolenSoul_Timer; - - bool HasTaunted; - bool Avatar_summoned; - - void Reset() + struct boss_exarch_maladaarAI : public ScriptedAI { - soulmodel = 0; - soulholder = 0; - soulclass = 0; - - Fear_timer = 15000 + rand()% 5000; - Ribbon_of_Souls_timer = 5000; - StolenSoul_Timer = 25000 + rand()% 10000; - - Avatar_summoned = false; - } - - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && me->IsWithinDistInMap(who, 150.0)) + boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) { - DoScriptText(SAY_INTRO, me); - HasTaunted = true; + HasTaunted = false; } - ScriptedAI::MoveInLineOfSight(who); - } + uint32 soulmodel; + uint64 soulholder; + uint8 soulclass; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - } + uint32 Fear_timer; + uint32 Ribbon_of_Souls_timer; + uint32 StolenSoul_Timer; - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == ENTRY_STOLEN_SOUL) + bool HasTaunted; + bool Avatar_summoned; + + void Reset() { - //SPELL_STOLEN_SOUL_VISUAL has shapeshift effect, but not implemented feature in Trinity for this spell. - summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); - summoned->SetDisplayId(soulmodel); - summoned->setFaction(me->getFaction()); + soulmodel = 0; + soulholder = 0; + soulclass = 0; - if (Unit *pTarget = Unit::GetUnit(*me,soulholder)) + Fear_timer = 15000 + rand()% 5000; + Ribbon_of_Souls_timer = 5000; + StolenSoul_Timer = 25000 + rand()% 10000; + + Avatar_summoned = false; + } + + void MoveInLineOfSight(Unit *who) + { + if (!HasTaunted && me->IsWithinDistInMap(who, 150.0)) { - - CAST_AI(mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); - summoned->AI()->AttackStart(pTarget); + DoScriptText(SAY_INTRO, me); + HasTaunted = true; } - } - } - void KilledUnit(Unit* /*victim*/) - { - if (rand()%2) - return; - - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - //When Exarch Maladar is defeated D'ore appear. - me->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!Avatar_summoned && ((me->GetHealth()*100) / me->GetMaxHealth() < 25)) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - - DoScriptText(SAY_SUMMON, me); - - DoCast(me, SPELL_SUMMON_AVATAR); - Avatar_summoned = true; - StolenSoul_Timer = 15000 + rand()% 15000; + ScriptedAI::MoveInLineOfSight(who); } - if (StolenSoul_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + } + + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == ENTRY_STOLEN_SOUL) { - if (pTarget->GetTypeId() == TYPEID_PLAYER) + //SPELL_STOLEN_SOUL_VISUAL has shapeshift effect, but not implemented feature in Trinity for this spell. + summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); + summoned->SetDisplayId(soulmodel); + summoned->setFaction(me->getFaction()); + + if (Unit *pTarget = Unit::GetUnit(*me,soulholder)) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - uint32 i = urand(1,2); - if (i == 1) - DoScriptText(SAY_ROAR, me); - else - DoScriptText(SAY_SOUL_CLEAVE, me); - - soulmodel = pTarget->GetDisplayId(); - soulholder = pTarget->GetGUID(); - soulclass = pTarget->getClass(); - - DoCast(pTarget, SPELL_STOLEN_SOUL); - me->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - - StolenSoul_Timer = 20000 + rand()% 10000; - } else StolenSoul_Timer = 1000; + CAST_AI(mob_stolen_soul::mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); + summoned->AI()->AttackStart(pTarget); + } } - } else StolenSoul_Timer -= diff; + } - if (Ribbon_of_Souls_timer <= diff) + void KilledUnit(Unit* /*victim*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_RIBBON_OF_SOULS); + if (rand()%2) + return; - Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000); - } else Ribbon_of_Souls_timer -= diff; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } - if (Fear_timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me, SPELL_SOUL_SCREAM); - Fear_timer = 15000 + rand()% 15000; - } else Fear_timer -= diff; + DoScriptText(SAY_DEATH, me); + //When Exarch Maladar is defeated D'ore appear. + me->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!Avatar_summoned && ((me->GetHealth()*100) / me->GetMaxHealth() < 25)) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + DoScriptText(SAY_SUMMON, me); + + DoCast(me, SPELL_SUMMON_AVATAR); + Avatar_summoned = true; + StolenSoul_Timer = 15000 + rand()% 15000; + } + + if (StolenSoul_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget->GetTypeId() == TYPEID_PLAYER) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + uint32 i = urand(1,2); + if (i == 1) + DoScriptText(SAY_ROAR, me); + else + DoScriptText(SAY_SOUL_CLEAVE, me); + + soulmodel = pTarget->GetDisplayId(); + soulholder = pTarget->GetGUID(); + soulclass = pTarget->getClass(); + + DoCast(pTarget, SPELL_STOLEN_SOUL); + me->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + + StolenSoul_Timer = 20000 + rand()% 10000; + } else StolenSoul_Timer = 1000; + } + } else StolenSoul_Timer -= diff; + + if (Ribbon_of_Souls_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_RIBBON_OF_SOULS); + + Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000); + } else Ribbon_of_Souls_timer -= diff; + + if (Fear_timer <= diff) + { + DoCast(me, SPELL_SOUL_SCREAM); + Fear_timer = 15000 + rand()% 15000; + } else Fear_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_exarch_maladaar(Creature* pCreature) -{ - return new boss_exarch_maladaarAI (pCreature); -} #define SPELL_AV_MORTAL_STRIKE 16856 #define SPELL_AV_SUNDER_ARMOR 16145 - -struct mob_avatar_of_martyredAI : public ScriptedAI + class mob_avatar_of_martyred : public CreatureScript { - mob_avatar_of_martyredAI(Creature *c) : ScriptedAI(c) {} +public: + mob_avatar_of_martyred() : CreatureScript("mob_avatar_of_martyred") { } - uint32 Mortal_Strike_timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Mortal_Strike_timer = 10000; + return new mob_avatar_of_martyredAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_avatar_of_martyredAI : public ScriptedAI { - } + mob_avatar_of_martyredAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Mortal_Strike_timer; - if (Mortal_Strike_timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_AV_MORTAL_STRIKE); - Mortal_Strike_timer = 10000 + rand()%20 * 1000; - } else Mortal_Strike_timer -= diff; + Mortal_Strike_timer = 10000; + } + + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Mortal_Strike_timer <= diff) + { + DoCast(me->getVictim(), SPELL_AV_MORTAL_STRIKE); + Mortal_Strike_timer = 10000 + rand()%20 * 1000; + } else Mortal_Strike_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_avatar_of_martyred(Creature* pCreature) -{ - return new mob_avatar_of_martyredAI (pCreature); -} void AddSC_boss_exarch_maladaar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_exarch_maladaar"; - newscript->GetAI = &GetAI_boss_exarch_maladaar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_avatar_of_martyred"; - newscript->GetAI = &GetAI_mob_avatar_of_martyred; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_stolen_soul"; - newscript->GetAI = &GetAI_mob_stolen_soul; - newscript->RegisterSelf(); + new boss_exarch_maladaar(); + new mob_avatar_of_martyred(); + new mob_stolen_soul(); } - diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index 6c584e16744..572da08bfe1 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -39,175 +39,180 @@ EndScriptData */ #define SPELL_FOCUS_FIRE_VISUAL 42075 //need to find better visual #define EMOTE_FOCUSES_ON "focuses on " - -struct boss_shirrak_the_dead_watcherAI : public ScriptedAI + class boss_shirrak_the_dead_watcher : public CreatureScript { - boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) +public: + boss_shirrak_the_dead_watcher() : CreatureScript("boss_shirrak_the_dead_watcher") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_shirrak_the_dead_watcherAI (pCreature); } - uint32 Inhibitmagic_Timer; - uint32 Attractmagic_Timer; - uint32 Carnivorousbite_Timer; - uint32 FocusFire_Timer; - - uint64 FocusedTargetGUID; - - void Reset() + struct boss_shirrak_the_dead_watcherAI : public ScriptedAI { - Inhibitmagic_Timer = 0; - Attractmagic_Timer = 28000; - Carnivorousbite_Timer = 10000; - FocusFire_Timer = 17000; - FocusedTargetGUID = 0; - } - - void EnterCombat(Unit * /*who*/) - { } - - void JustSummoned(Creature *summoned) - { - if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) + boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) { - summoned->CastSpell(summoned,SPELL_FOCUS_FIRE_VISUAL,false); - summoned->setFaction(me->getFaction()); - summoned->SetLevel(me->getLevel()); - summoned->addUnitState(UNIT_STAT_ROOT); - - if (Unit *pFocusedTarget = Unit::GetUnit(*me, FocusedTargetGUID)) - summoned->AI()->AttackStart(pFocusedTarget); } - } - void UpdateAI(const uint32 diff) - { - //Inhibitmagic_Timer - if (Inhibitmagic_Timer <= diff) + uint32 Inhibitmagic_Timer; + uint32 Attractmagic_Timer; + uint32 Carnivorousbite_Timer; + uint32 FocusFire_Timer; + + uint64 FocusedTargetGUID; + + void Reset() { - float dist; - Map* pMap = me->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* i_pl = i->getSource()) - if (i_pl->isAlive() && (dist = i_pl->IsWithinDist(me, 45))) - { - i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); - me->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 35) - me->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 25) - me->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 15) - me->AddAura(SPELL_INHIBITMAGIC, i_pl); - } - Inhibitmagic_Timer = 3000+(rand()%1000); - } else Inhibitmagic_Timer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - //Attractmagic_Timer - if (Attractmagic_Timer <= diff) - { - DoCast(me, SPELL_ATTRACTMAGIC); - Attractmagic_Timer = 30000; - Carnivorousbite_Timer = 1500; - } else Attractmagic_Timer -= diff; - - //Carnivorousbite_Timer - if (Carnivorousbite_Timer <= diff) - { - DoCast(me, SPELL_CARNIVOROUSBITE); + Inhibitmagic_Timer = 0; + Attractmagic_Timer = 28000; Carnivorousbite_Timer = 10000; - } else Carnivorousbite_Timer -= diff; + FocusFire_Timer = 17000; + FocusedTargetGUID = 0; + } - //FocusFire_Timer - if (FocusFire_Timer <= diff) + void EnterCombat(Unit * /*who*/) + { } + + void JustSummoned(Creature *summoned) { - // Summon Focus Fire & Emote - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) + if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) { - FocusedTargetGUID = pTarget->GetGUID(); - me->SummonCreature(ENTRY_FOCUS_FIRE,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); + summoned->CastSpell(summoned,SPELL_FOCUS_FIRE_VISUAL,false); + summoned->setFaction(me->getFaction()); + summoned->SetLevel(me->getLevel()); + summoned->addUnitState(UNIT_STAT_ROOT); - // TODO: Find better way to handle emote - // Emote - std::string *emote = new std::string(EMOTE_FOCUSES_ON); - emote->append(pTarget->GetName()); - emote->append("!"); - const char* text = emote->c_str(); - me->MonsterTextEmote(text, 0, true); - delete emote; + if (Unit *pFocusedTarget = Unit::GetUnit(*me, FocusedTargetGUID)) + summoned->AI()->AttackStart(pFocusedTarget); } - FocusFire_Timer = 15000+(rand()%5000); - } else FocusFire_Timer -= diff; + } - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_shirrak_the_dead_watcher(Creature* pCreature) -{ - return new boss_shirrak_the_dead_watcherAI (pCreature); -} - -struct mob_focus_fireAI : public ScriptedAI -{ - mob_focus_fireAI(Creature *c) : ScriptedAI(c) - { - } - - uint32 FieryBlast_Timer; - bool fiery1, fiery2; - - void Reset() - { - FieryBlast_Timer = 3000+(rand()%1000); - fiery1 = fiery2 = true; - } - - void EnterCombat(Unit * /*who*/) - { } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //FieryBlast_Timer - if (fiery2 && FieryBlast_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_FIERY_BLAST); + //Inhibitmagic_Timer + if (Inhibitmagic_Timer <= diff) + { + float dist; + Map* pMap = me->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive() && (dist = i_pl->IsWithinDist(me, 45))) + { + i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); + me->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 35) + me->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 25) + me->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 15) + me->AddAura(SPELL_INHIBITMAGIC, i_pl); + } + Inhibitmagic_Timer = 3000+(rand()%1000); + } else Inhibitmagic_Timer -= diff; - if (fiery1) fiery1 = false; - else if (fiery2) fiery2 = false; + //Return since we have no target + if (!UpdateVictim()) + return; - FieryBlast_Timer = 1000; - } else FieryBlast_Timer -= diff; + //Attractmagic_Timer + if (Attractmagic_Timer <= diff) + { + DoCast(me, SPELL_ATTRACTMAGIC); + Attractmagic_Timer = 30000; + Carnivorousbite_Timer = 1500; + } else Attractmagic_Timer -= diff; + + //Carnivorousbite_Timer + if (Carnivorousbite_Timer <= diff) + { + DoCast(me, SPELL_CARNIVOROUSBITE); + Carnivorousbite_Timer = 10000; + } else Carnivorousbite_Timer -= diff; + + //FocusFire_Timer + if (FocusFire_Timer <= diff) + { + // Summon Focus Fire & Emote + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) + { + FocusedTargetGUID = pTarget->GetGUID(); + me->SummonCreature(ENTRY_FOCUS_FIRE,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); + + // TODO: Find better way to handle emote + // Emote + std::string *emote = new std::string(EMOTE_FOCUSES_ON); + emote->append(pTarget->GetName()); + emote->append("!"); + const char* text = emote->c_str(); + me->MonsterTextEmote(text, 0, true); + delete emote; + } + FocusFire_Timer = 15000+(rand()%5000); + } else FocusFire_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_focus_fire(Creature* pCreature) + class mob_focus_fire : public CreatureScript { - return new mob_focus_fireAI (pCreature); -} +public: + mob_focus_fire() : CreatureScript("mob_focus_fire") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_focus_fireAI (pCreature); + } + + struct mob_focus_fireAI : public ScriptedAI + { + mob_focus_fireAI(Creature *c) : ScriptedAI(c) + { + } + + uint32 FieryBlast_Timer; + bool fiery1, fiery2; + + void Reset() + { + FieryBlast_Timer = 3000+(rand()%1000); + fiery1 = fiery2 = true; + } + + void EnterCombat(Unit * /*who*/) + { } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //FieryBlast_Timer + if (fiery2 && FieryBlast_Timer <= diff) + { + DoCast(me, SPELL_FIERY_BLAST); + + if (fiery1) fiery1 = false; + else if (fiery2) fiery2 = false; + + FieryBlast_Timer = 1000; + } else FieryBlast_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + void AddSC_boss_shirrak_the_dead_watcher() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shirrak_the_dead_watcher"; - newscript->GetAI = &GetAI_boss_shirrak_the_dead_watcher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_focus_fire"; - newscript->GetAI = &GetAI_mob_focus_fire; - newscript->RegisterSelf(); + new boss_shirrak_the_dead_watcher(); + new mob_focus_fire(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index d38c6d03662..1c3f65082ff 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -54,307 +54,314 @@ enum ePrince NR_INITIAL_BEACONS = 3 }; - -struct boss_nexusprince_shaffarAI : public ScriptedAI + class boss_nexusprince_shaffar : public CreatureScript { - boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; } +public: + boss_nexusprince_shaffar() : CreatureScript("boss_nexusprince_shaffar") { } - uint32 Blink_Timer; - uint32 Beacon_Timer; - uint32 FireBall_Timer; - uint32 Frostbolt_Timer; - uint32 FrostNova_Timer; - - SummonList summons; - - bool HasTaunted; - bool CanBlink; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Blink_Timer = 1500; - Beacon_Timer = 10000; - FireBall_Timer = 8000; - Frostbolt_Timer = 4000; - FrostNova_Timer = 15000; - - CanBlink = false; - - float dist = 8.0f; - float posX, posY, posZ, angle; - me->GetHomePosition(posX, posY, posZ, angle); - - me->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - me->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - me->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + return new boss_nexusprince_shaffarAI (pCreature); } - void EnterEvadeMode() + struct boss_nexusprince_shaffarAI : public ScriptedAI { - summons.DespawnAll(); - ScriptedAI::EnterEvadeMode(); - } + boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; } - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) + uint32 Blink_Timer; + uint32 Beacon_Timer; + uint32 FireBall_Timer; + uint32 Frostbolt_Timer; + uint32 FrostNova_Timer; + + SummonList summons; + + bool HasTaunted; + bool CanBlink; + + void Reset() { - DoScriptText(SAY_INTRO, me); - HasTaunted = true; - } - } + Blink_Timer = 1500; + Beacon_Timer = 10000; + FireBall_Timer = 8000; + Frostbolt_Timer = 4000; + FrostNova_Timer = 15000; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + CanBlink = false; - DoZoneInCombat(); - summons.DoZoneInCombat(); - } + float dist = 8.0f; + float posX, posY, posZ, angle; + me->GetHomePosition(posX, posY, posZ, angle); - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == NPC_BEACON) - { - summoned->CastSpell(summoned,SPELL_ETHEREAL_BEACON_VISUAL,false); - - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(pTarget); + me->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + me->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + me->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); } - summons.Summon(summoned); - } - - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEAD, me); - summons.DespawnAll(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (FrostNova_Timer <= diff) + void EnterEvadeMode() { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); + summons.DespawnAll(); + ScriptedAI::EnterEvadeMode(); + } - DoCast(me, SPELL_FROSTNOVA); - FrostNova_Timer = 17500 + rand()%7500; - CanBlink = true; - } else FrostNova_Timer -= diff; - - if (Frostbolt_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 4500 + rand()%1500; - } else Frostbolt_Timer -= diff; + if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f)) + { + DoScriptText(SAY_INTRO, me); + HasTaunted = true; + } + } - if (FireBall_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_FIREBALL); - FireBall_Timer = 4500 + rand()%1500; - } else FireBall_Timer -= diff; + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - if (CanBlink) + DoZoneInCombat(); + summons.DoZoneInCombat(); + } + + void JustSummoned(Creature *summoned) { - if (Blink_Timer <= diff) + if (summoned->GetEntry() == NPC_BEACON) + { + summoned->CastSpell(summoned,SPELL_ETHEREAL_BEACON_VISUAL,false); + + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(pTarget); + } + + summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature *summon) + { + summons.Despawn(summon); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEAD, me); + summons.DespawnAll(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (FrostNova_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) me->InterruptNonMeleeSpells(true); - //expire movement, will prevent from running right back to victim after cast - //(but should MoveChase be used again at a certain time or should he not move?) - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); + DoCast(me, SPELL_FROSTNOVA); + FrostNova_Timer = 17500 + rand()%7500; + CanBlink = true; + } else FrostNova_Timer -= diff; - DoCast(me, SPELL_BLINK); - Blink_Timer = 1000 + rand()%1500; - CanBlink = false; - } else Blink_Timer -= diff; + if (Frostbolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 4500 + rand()%1500; + } else Frostbolt_Timer -= diff; + + if (FireBall_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FIREBALL); + FireBall_Timer = 4500 + rand()%1500; + } else FireBall_Timer -= diff; + + if (CanBlink) + { + if (Blink_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + //expire movement, will prevent from running right back to victim after cast + //(but should MoveChase be used again at a certain time or should he not move?) + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + + DoCast(me, SPELL_BLINK); + Blink_Timer = 1000 + rand()%1500; + CanBlink = false; + } else Blink_Timer -= diff; + } + + if (Beacon_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + if (!urand(0,3)) + DoScriptText(SAY_SUMMON, me); + + DoCast(me, SPELL_ETHEREAL_BEACON, true); + + Beacon_Timer = 10000; + } else Beacon_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (Beacon_Timer <= diff) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - - if (!urand(0,3)) - DoScriptText(SAY_SUMMON, me); - - DoCast(me, SPELL_ETHEREAL_BEACON, true); - - Beacon_Timer = 10000; - } else Beacon_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_nexusprince_shaffar(Creature* pCreature) -{ - return new boss_nexusprince_shaffarAI (pCreature); -} enum eEnums { SPELL_ARCANE_BOLT = 15254, SPELL_ETHEREAL_APPRENTICE = 32372 // Summon 18430 }; - -struct mob_ethereal_beaconAI : public ScriptedAI + class mob_ethereal_beacon : public CreatureScript { - mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) +public: + mob_ethereal_beacon() : CreatureScript("mob_ethereal_beacon") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_ethereal_beaconAI (pCreature); } - uint32 Apprentice_Timer; - uint32 ArcaneBolt_Timer; - uint32 Check_Timer; - - void KillSelf() + struct mob_ethereal_beaconAI : public ScriptedAI { - me->Kill(me); - } - - void Reset() - { - Apprentice_Timer = DUNGEON_MODE(20000, 10000); - ArcaneBolt_Timer = 1000; - Check_Timer = 1000; - } - - void EnterCombat(Unit * who) - { - // Send Shaffar to fight - Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); - if (!Shaffar || Shaffar->isDead()) + mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) { - KillSelf(); - return; } - if (!Shaffar->isInCombat()) - Shaffar->AI()->AttackStart(who); - } - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(me->getVictim()); - } + uint32 Apprentice_Timer; + uint32 ArcaneBolt_Timer; + uint32 Check_Timer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Check_Timer <= diff) + void KillSelf() { - Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); - if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) + me->Kill(me); + } + + void Reset() + { + Apprentice_Timer = DUNGEON_MODE(20000, 10000); + ArcaneBolt_Timer = 1000; + Check_Timer = 1000; + } + + void EnterCombat(Unit * who) + { + // Send Shaffar to fight + Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); + if (!Shaffar || Shaffar->isDead()) { KillSelf(); return; } - Check_Timer = 1000; - } else Check_Timer -= diff; + if (!Shaffar->isInCombat()) + Shaffar->AI()->AttackStart(who); + } - if (ArcaneBolt_Timer <= diff) + void JustSummoned(Creature *summoned) { - DoCast(me->getVictim(), SPELL_ARCANE_BOLT); - ArcaneBolt_Timer = 2000 + rand()%2500; - } else ArcaneBolt_Timer -= diff; + summoned->AI()->AttackStart(me->getVictim()); + } - if (Apprentice_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); + if (!UpdateVictim()) + return; + + if (Check_Timer <= diff) + { + Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); + if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) + { + KillSelf(); + return; + } + Check_Timer = 1000; + } else Check_Timer -= diff; + + if (ArcaneBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BOLT); + ArcaneBolt_Timer = 2000 + rand()%2500; + } else ArcaneBolt_Timer -= diff; + + if (Apprentice_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + DoCast(me, SPELL_ETHEREAL_APPRENTICE, true); + me->ForcedDespawn(); + return; + } else Apprentice_Timer -= diff; + } + }; - DoCast(me, SPELL_ETHEREAL_APPRENTICE, true); - me->ForcedDespawn(); - return; - } else Apprentice_Timer -= diff; - } }; -CreatureAI* GetAI_mob_ethereal_beacon(Creature* pCreature) -{ - return new mob_ethereal_beaconAI (pCreature); -} enum eEthereal { SPELL_ETHEREAL_APPRENTICE_FIREBOLT = 32369, SPELL_ETHEREAL_APPRENTICE_FROSTBOLT = 32370 }; - -struct mob_ethereal_apprenticeAI : public ScriptedAI + class mob_ethereal_apprentice : public CreatureScript { - mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} +public: + mob_ethereal_apprentice() : CreatureScript("mob_ethereal_apprentice") { } - uint32 Cast_Timer; - - bool isFireboltTurn; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Cast_Timer = 3000; - isFireboltTurn = true; + return new mob_ethereal_apprenticeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_ethereal_apprenticeAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} - if (Cast_Timer <= diff) + uint32 Cast_Timer; + + bool isFireboltTurn; + + void Reset() { - if (isFireboltTurn) - { - DoCast(me->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); - isFireboltTurn = false; - }else{ - DoCast(me->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); - isFireboltTurn = true; - } Cast_Timer = 3000; - } else Cast_Timer -= diff; - } + isFireboltTurn = true; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Cast_Timer <= diff) + { + if (isFireboltTurn) + { + DoCast(me->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); + isFireboltTurn = false; + }else{ + DoCast(me->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); + isFireboltTurn = true; + } + Cast_Timer = 3000; + } else Cast_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_ethereal_apprentice(Creature* pCreature) -{ - return new mob_ethereal_apprenticeAI (pCreature); -} void AddSC_boss_nexusprince_shaffar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_nexusprince_shaffar"; - newscript->GetAI = &GetAI_boss_nexusprince_shaffar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ethereal_beacon"; - newscript->GetAI = &GetAI_mob_ethereal_beacon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ethereal_apprentice"; - newscript->GetAI = &GetAI_mob_ethereal_apprentice; - newscript->RegisterSelf(); + new boss_nexusprince_shaffar(); + new mob_ethereal_beacon(); + new mob_ethereal_apprentice(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp index da9c0c4a520..b22a38049ef 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_pandemonius.cpp @@ -40,89 +40,91 @@ EndScriptData */ #define H_SPELL_VOID_BLAST 38760 #define SPELL_DARK_SHELL 32358 #define H_SPELL_DARK_SHELL 38759 - -struct boss_pandemoniusAI : public ScriptedAI + class boss_pandemonius : public CreatureScript { - boss_pandemoniusAI(Creature *c) : ScriptedAI(c) +public: + boss_pandemonius() : CreatureScript("boss_pandemonius") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_pandemoniusAI (pCreature); } - uint32 VoidBlast_Timer; - uint32 DarkShell_Timer; - uint32 VoidBlast_Counter; - - void Reset() + struct boss_pandemoniusAI : public ScriptedAI { - VoidBlast_Timer = 8000+rand()%15000; - DarkShell_Timer = 20000; - VoidBlast_Counter = 0; - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (VoidBlast_Timer <= diff) + boss_pandemoniusAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_VOID_BLAST); - VoidBlast_Timer = 500; - ++VoidBlast_Counter; - } - - if (VoidBlast_Counter == 5) - { - VoidBlast_Timer = 15000+rand()%10000; - VoidBlast_Counter = 0; - } - } else VoidBlast_Timer -= diff; - - if (!VoidBlast_Counter) - { - if (DarkShell_Timer <= diff) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - - DoScriptText(EMOTE_DARK_SHELL, me); - - DoCast(me, SPELL_DARK_SHELL); - DarkShell_Timer = 20000; - } else DarkShell_Timer -= diff; } - DoMeleeAttackIfReady(); - } + uint32 VoidBlast_Timer; + uint32 DarkShell_Timer; + uint32 VoidBlast_Counter; + + void Reset() + { + VoidBlast_Timer = 8000+rand()%15000; + DarkShell_Timer = 20000; + VoidBlast_Counter = 0; + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (VoidBlast_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_VOID_BLAST); + VoidBlast_Timer = 500; + ++VoidBlast_Counter; + } + + if (VoidBlast_Counter == 5) + { + VoidBlast_Timer = 15000+rand()%10000; + VoidBlast_Counter = 0; + } + } else VoidBlast_Timer -= diff; + + if (!VoidBlast_Counter) + { + if (DarkShell_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + + DoScriptText(EMOTE_DARK_SHELL, me); + + DoCast(me, SPELL_DARK_SHELL); + DarkShell_Timer = 20000; + } else DarkShell_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_pandemonius(Creature* pCreature) -{ - return new boss_pandemoniusAI (pCreature); -} void AddSC_boss_pandemonius() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_pandemonius"; - newscript->GetAI = &GetAI_boss_pandemonius; - newscript->RegisterSelf(); + new boss_pandemonius(); } - diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp index 4a76d46904d..7b45add961a 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_darkweaver_syth.cpp @@ -52,365 +52,375 @@ EndScriptData */ #define SPELL_ARCANE_BUFFET DUNGEON_MODE(33527, 38138) #define SPELL_FROST_BUFFET DUNGEON_MODE(33528, 38142) #define SPELL_SHADOW_BUFFET DUNGEON_MODE(33529, 38143) - -struct boss_darkweaver_sythAI : public ScriptedAI + class boss_darkweaver_syth : public CreatureScript { - boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) +public: + boss_darkweaver_syth() : CreatureScript("boss_darkweaver_syth") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_darkweaver_sythAI (pCreature); } - uint32 flameshock_timer; - uint32 arcaneshock_timer; - uint32 frostshock_timer; - uint32 shadowshock_timer; - uint32 chainlightning_timer; - - bool summon90; - bool summon50; - bool summon10; - - void Reset() + struct boss_darkweaver_sythAI : public ScriptedAI { - flameshock_timer = 2000; - arcaneshock_timer = 4000; - frostshock_timer = 6000; - shadowshock_timer = 8000; - chainlightning_timer = 15000; - - summon90 = false; - summon50 = false; - summon10 = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } - - void KilledUnit(Unit* /*victim*/) - { - if (rand()%2) - return; - - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void JustSummoned(Creature *summoned) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(pTarget); - } - - void SythSummoning() - { - DoScriptText(SAY_SUMMON, me); - - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - DoCast(me, SPELL_SUMMON_SYTH_ARCANE, true); //front - DoCast(me, SPELL_SUMMON_SYTH_FIRE, true); //back - DoCast(me, SPELL_SUMMON_SYTH_FROST, true); //left - DoCast(me, SPELL_SUMMON_SYTH_SHADOW, true); //right - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (((me->GetHealth()*100) / me->GetMaxHealth() < 90) && !summon90) + boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) { - SythSummoning(); - summon90 = true; } - if (((me->GetHealth()*100) / me->GetMaxHealth() < 50) && !summon50) + uint32 flameshock_timer; + uint32 arcaneshock_timer; + uint32 frostshock_timer; + uint32 shadowshock_timer; + uint32 chainlightning_timer; + + bool summon90; + bool summon50; + bool summon10; + + void Reset() { - SythSummoning(); - summon50 = true; + flameshock_timer = 2000; + arcaneshock_timer = 4000; + frostshock_timer = 6000; + shadowshock_timer = 8000; + chainlightning_timer = 15000; + + summon90 = false; + summon50 = false; + summon10 = false; } - if (((me->GetHealth()*100) / me->GetMaxHealth() < 10) && !summon10) + void EnterCombat(Unit * /*who*/) { - SythSummoning(); - summon10 = true; + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); } - if (flameshock_timer <= diff) + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } + + void KilledUnit(Unit* /*victim*/) + { + if (rand()%2) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void JustSummoned(Creature *summoned) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FLAME_SHOCK); + summoned->AI()->AttackStart(pTarget); + } - flameshock_timer = 10000 + rand()%5000; - } else flameshock_timer -= diff; - - if (arcaneshock_timer <= diff) + void SythSummoning() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_ARCANE_SHOCK); + DoScriptText(SAY_SUMMON, me); - arcaneshock_timer = 10000 + rand()%5000; - } else arcaneshock_timer -= diff; + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - if (frostshock_timer <= diff) + DoCast(me, SPELL_SUMMON_SYTH_ARCANE, true); //front + DoCast(me, SPELL_SUMMON_SYTH_FIRE, true); //back + DoCast(me, SPELL_SUMMON_SYTH_FROST, true); //left + DoCast(me, SPELL_SUMMON_SYTH_SHADOW, true); //right + } + + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FROST_SHOCK); + if (!UpdateVictim()) + return; - frostshock_timer = 10000 + rand()%5000; - } else frostshock_timer -= diff; + if (((me->GetHealth()*100) / me->GetMaxHealth() < 90) && !summon90) + { + SythSummoning(); + summon90 = true; + } - if (shadowshock_timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SHADOW_SHOCK); + if (((me->GetHealth()*100) / me->GetMaxHealth() < 50) && !summon50) + { + SythSummoning(); + summon50 = true; + } - shadowshock_timer = 10000 + rand()%5000; - } else shadowshock_timer -= diff; + if (((me->GetHealth()*100) / me->GetMaxHealth() < 10) && !summon10) + { + SythSummoning(); + summon10 = true; + } - if (chainlightning_timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + if (flameshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FLAME_SHOCK); - chainlightning_timer = 25000; - } else chainlightning_timer -= diff; + flameshock_timer = 10000 + rand()%5000; + } else flameshock_timer -= diff; + + if (arcaneshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_ARCANE_SHOCK); + + arcaneshock_timer = 10000 + rand()%5000; + } else arcaneshock_timer -= diff; + + if (frostshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FROST_SHOCK); + + frostshock_timer = 10000 + rand()%5000; + } else frostshock_timer -= diff; + + if (shadowshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SHADOW_SHOCK); + + shadowshock_timer = 10000 + rand()%5000; + } else shadowshock_timer -= diff; + + if (chainlightning_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + + chainlightning_timer = 25000; + } else chainlightning_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_darkweaver_syth(Creature* pCreature) -{ - return new boss_darkweaver_sythAI (pCreature); -} /* ELEMENTALS */ - -struct mob_syth_fireAI : public ScriptedAI +class mob_syth_fire : public CreatureScript { - mob_syth_fireAI(Creature *c) : ScriptedAI(c) +public: + mob_syth_fire() : CreatureScript("mob_syth_fire") { } + + struct mob_syth_fireAI : public ScriptedAI { - } - - uint32 flameshock_timer; - uint32 flamebuffet_timer; - - void Reset() - { - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); - flameshock_timer = 2500; - flamebuffet_timer = 5000; - } - - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (flameshock_timer <= diff) + mob_syth_fireAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FLAME_SHOCK); + } - flameshock_timer = 5000; - } else flameshock_timer -= diff; + uint32 flameshock_timer; + uint32 flamebuffet_timer; - if (flamebuffet_timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FLAME_BUFFET); - + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + flameshock_timer = 2500; flamebuffet_timer = 5000; - } else flamebuffet_timer -= diff; + } - DoMeleeAttackIfReady(); - } -}; + void EnterCombat(Unit * /*who*/) { } -CreatureAI* GetAI_mob_syth_fire(Creature* pCreature) -{ - return new mob_syth_fireAI (pCreature); -} - -struct mob_syth_arcaneAI : public ScriptedAI -{ - mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) - { - } - - uint32 arcaneshock_timer; - uint32 arcanebuffet_timer; - - void Reset() - { - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ARCANE, true); - arcaneshock_timer = 2500; - arcanebuffet_timer = 5000; - } - - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (arcaneshock_timer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_ARCANE_SHOCK); + if (!UpdateVictim()) + return; - arcaneshock_timer = 5000; - } else arcaneshock_timer -= diff; + if (flameshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FLAME_SHOCK); - if (arcanebuffet_timer <= diff) + flameshock_timer = 5000; + } else flameshock_timer -= diff; + + if (flamebuffet_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FLAME_BUFFET); + + flamebuffet_timer = 5000; + } else flamebuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_syth_fireAI (pCreature); + } +}; class mob_syth_arcane : public CreatureScript +{ +public: + mob_syth_arcane() : CreatureScript("mob_syth_arcane") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_syth_arcaneAI (pCreature); + } + + struct mob_syth_arcaneAI : public ScriptedAI + { + mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_ARCANE_BUFFET); + } + uint32 arcaneshock_timer; + uint32 arcanebuffet_timer; + + void Reset() + { + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ARCANE, true); + arcaneshock_timer = 2500; arcanebuffet_timer = 5000; - } else arcanebuffet_timer -= diff; + } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit * /*who*/) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (arcaneshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_ARCANE_SHOCK); + + arcaneshock_timer = 5000; + } else arcaneshock_timer -= diff; + + if (arcanebuffet_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_ARCANE_BUFFET); + + arcanebuffet_timer = 5000; + } else arcanebuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; }; -CreatureAI* GetAI_mob_syth_arcane(Creature* pCreature) + class mob_syth_frost : public CreatureScript { - return new mob_syth_arcaneAI (pCreature); -} +public: + mob_syth_frost() : CreatureScript("mob_syth_frost") { } -struct mob_syth_frostAI : public ScriptedAI -{ - mob_syth_frostAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_syth_frostAI (pCreature); } - uint32 frostshock_timer; - uint32 frostbuffet_timer; - - void Reset() + struct mob_syth_frostAI : public ScriptedAI { - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - frostshock_timer = 2500; - frostbuffet_timer = 5000; - } - - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (frostshock_timer <= diff) + mob_syth_frostAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FROST_SHOCK); + } - frostshock_timer = 5000; - } else frostshock_timer -= diff; + uint32 frostshock_timer; + uint32 frostbuffet_timer; - if (frostbuffet_timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_FROST_BUFFET); - + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + frostshock_timer = 2500; frostbuffet_timer = 5000; - } else frostbuffet_timer -= diff; + } + + void EnterCombat(Unit * /*who*/) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (frostshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FROST_SHOCK); + + frostshock_timer = 5000; + } else frostshock_timer -= diff; + + if (frostbuffet_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_FROST_BUFFET); + + frostbuffet_timer = 5000; + } else frostbuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_syth_frost(Creature* pCreature) + class mob_syth_shadow : public CreatureScript { - return new mob_syth_frostAI (pCreature); -} +public: + mob_syth_shadow() : CreatureScript("mob_syth_shadow") { } -struct mob_syth_shadowAI : public ScriptedAI -{ - mob_syth_shadowAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_syth_shadowAI (pCreature); } - uint32 shadowshock_timer; - uint32 shadowbuffet_timer; - - void Reset() + struct mob_syth_shadowAI : public ScriptedAI { - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_SHADOW, true); - shadowshock_timer = 2500; - shadowbuffet_timer = 5000; - } - - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (shadowshock_timer <= diff) + mob_syth_shadowAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SHADOW_SHOCK); + } - shadowshock_timer = 5000; - } else shadowshock_timer -= diff; + uint32 shadowshock_timer; + uint32 shadowbuffet_timer; - if (shadowbuffet_timer <= diff) + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_SHADOW_BUFFET); - + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_SHADOW, true); + shadowshock_timer = 2500; shadowbuffet_timer = 5000; - } else shadowbuffet_timer -= diff; + } + + void EnterCombat(Unit * /*who*/) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (shadowshock_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SHADOW_SHOCK); + + shadowshock_timer = 5000; + } else shadowshock_timer -= diff; + + if (shadowbuffet_timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_SHADOW_BUFFET); + + shadowbuffet_timer = 5000; + } else shadowbuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_syth_shadow(Creature* pCreature) -{ - return new mob_syth_shadowAI (pCreature); -} void AddSC_boss_darkweaver_syth() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_darkweaver_syth"; - newscript->GetAI = &GetAI_boss_darkweaver_syth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_syth_fire"; - newscript->GetAI = &GetAI_mob_syth_arcane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_syth_arcane"; - newscript->GetAI = &GetAI_mob_syth_arcane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_syth_frost"; - newscript->GetAI = &GetAI_mob_syth_frost; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_syth_shadow"; - newscript->GetAI = &GetAI_mob_syth_shadow; - newscript->RegisterSelf(); + new boss_darkweaver_syth(); + new mob_syth_fire(); + new mob_syth_arcane(); + new mob_syth_frost(); + new mob_syth_shadow(); } - diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp index 83cf669824f..462c9373a9c 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp @@ -51,165 +51,167 @@ EndScriptData */ #define SPELL_ARCANE_EXPLOSION 38197 #define H_SPELL_ARCANE_EXPLOSION 40425 - -struct boss_talon_king_ikissAI : public ScriptedAI + class boss_talon_king_ikiss : public CreatureScript { - boss_talon_king_ikissAI(Creature *c) : ScriptedAI(c) +public: + boss_talon_king_ikiss() : CreatureScript("boss_talon_king_ikiss") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_talon_king_ikissAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 ArcaneVolley_Timer; - uint32 Sheep_Timer; - uint32 Blink_Timer; - uint32 Slow_Timer; - - bool ManaShield; - bool Blink; - bool Intro; - - void Reset() + struct boss_talon_king_ikissAI : public ScriptedAI { - ArcaneVolley_Timer = 5000; - Sheep_Timer = 8000; - Blink_Timer = 35000; - Slow_Timer = 15000+rand()%15000; - Blink = false; - Intro = false; - ManaShield = false; - } - - void MoveInLineOfSight(Unit *who) - { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + boss_talon_king_ikissAI(Creature *c) : ScriptedAI(c) { - if (!Intro && me->IsWithinDistInMap(who, 100)) - { - Intro = true; - DoScriptText(SAY_INTRO, me); - } + pInstance = c->GetInstanceScript(); + } - if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + InstanceScript* pInstance; + + uint32 ArcaneVolley_Timer; + uint32 Sheep_Timer; + uint32 Blink_Timer; + uint32 Slow_Timer; + + bool ManaShield; + bool Blink; + bool Intro; + + void Reset() + { + ArcaneVolley_Timer = 5000; + Sheep_Timer = 8000; + Blink_Timer = 35000; + Slow_Timer = 15000+rand()%15000; + Blink = false; + Intro = false; + ManaShield = false; + } + + void MoveInLineOfSight(Unit *who) + { + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + { + if (!Intro && me->IsWithinDistInMap(who, 100)) + { + Intro = true; + DoScriptText(SAY_INTRO, me); + } + + if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) + { + //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + AttackStart(who); + } + } + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_IKISSDOOREVENT, DONE); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) return; - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) + if (Blink) { - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - AttackStart(who); + DoCast(me, SPELL_ARCANE_EXPLOSION); + DoCast(me, SPELL_ARCANE_BUBBLE, true); + Blink = false; } - } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - } + if (ArcaneVolley_Timer <= diff) + { + DoCast(me, SPELL_ARCANE_VOLLEY); + ArcaneVolley_Timer = 7000+rand()%5000; + } else ArcaneVolley_Timer -= diff; - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); + if (Sheep_Timer <= diff) + { + Unit *pTarget; - if (pInstance) - pInstance->SetData(DATA_IKISSDOOREVENT, DONE); - } + //second top aggro target in normal, random target in heroic correct? + if (IsHeroic()) + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + else + pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } + if (pTarget) + DoCast(pTarget, SPELL_POLYMORPH); + Sheep_Timer = 15000+rand()%2500; + } else Sheep_Timer -= diff; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + //may not be correct time to cast + if (!ManaShield && ((me->GetHealth()*100) / me->GetMaxHealth() < 20)) + { + DoCast(me, SPELL_MANA_SHIELD); + ManaShield = true; + } - if (Blink) - { - DoCast(me, SPELL_ARCANE_EXPLOSION); - DoCast(me, SPELL_ARCANE_BUBBLE, true); - Blink = false; - } - - if (ArcaneVolley_Timer <= diff) - { - DoCast(me, SPELL_ARCANE_VOLLEY); - ArcaneVolley_Timer = 7000+rand()%5000; - } else ArcaneVolley_Timer -= diff; - - if (Sheep_Timer <= diff) - { - Unit *pTarget; - - //second top aggro target in normal, random target in heroic correct? if (IsHeroic()) - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - else - pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); - - if (pTarget) - DoCast(pTarget, SPELL_POLYMORPH); - Sheep_Timer = 15000+rand()%2500; - } else Sheep_Timer -= diff; - - //may not be correct time to cast - if (!ManaShield && ((me->GetHealth()*100) / me->GetMaxHealth() < 20)) - { - DoCast(me, SPELL_MANA_SHIELD); - ManaShield = true; - } - - if (IsHeroic()) - { - if (Slow_Timer <= diff) { - DoCast(me, H_SPELL_SLOW); - Slow_Timer = 15000+rand()%25000; - } else Slow_Timer -= diff; - } - - if (Blink_Timer <= diff) - { - DoScriptText(EMOTE_ARCANE_EXP, me); - - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); - - //Spell doesn't work, but we use for visual effect at least - DoCast(pTarget, SPELL_BLINK); - - float X = pTarget->GetPositionX(); - float Y = pTarget->GetPositionY(); - float Z = pTarget->GetPositionZ(); - - DoTeleportTo(X,Y,Z); - - DoCast(pTarget, SPELL_BLINK_TELEPORT); - Blink = true; + if (Slow_Timer <= diff) + { + DoCast(me, H_SPELL_SLOW); + Slow_Timer = 15000+rand()%25000; + } else Slow_Timer -= diff; } - Blink_Timer = 35000+rand()%5000; - } else Blink_Timer -= diff; - if (!Blink) - DoMeleeAttackIfReady(); - } + if (Blink_Timer <= diff) + { + DoScriptText(EMOTE_ARCANE_EXP, me); + + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + //Spell doesn't work, but we use for visual effect at least + DoCast(pTarget, SPELL_BLINK); + + float X = pTarget->GetPositionX(); + float Y = pTarget->GetPositionY(); + float Z = pTarget->GetPositionZ(); + + DoTeleportTo(X,Y,Z); + + DoCast(pTarget, SPELL_BLINK_TELEPORT); + Blink = true; + } + Blink_Timer = 35000+rand()%5000; + } else Blink_Timer -= diff; + + if (!Blink) + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_talon_king_ikiss(Creature* pCreature) -{ - return new boss_talon_king_ikissAI (pCreature); -} void AddSC_boss_talon_king_ikiss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_talon_king_ikiss"; - newscript->GetAI = &GetAI_boss_talon_king_ikiss; - newscript->RegisterSelf(); + new boss_talon_king_ikiss(); } - diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 61b891c7535..3b53b40869f 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -31,63 +31,65 @@ enum eEnums NPC_ANZU = 23035, IKISS_DOOR = 177203, }; - -struct instance_sethekk_halls : public ScriptedInstance + class instance_sethekk_halls : public InstanceMapScript { - instance_sethekk_halls(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_sethekk_halls() : InstanceMapScript("instance_sethekk_halls") { } - uint32 AnzuEncounter; - uint64 m_uiIkissDoorGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - AnzuEncounter = NOT_STARTED; - m_uiIkissDoorGUID = 0; + return new instance_sethekk_halls_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_sethekk_halls_InstanceMapScript : public InstanceScript { - if (pCreature->GetEntry() == NPC_ANZU) + instance_sethekk_halls_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint32 AnzuEncounter; + uint64 m_uiIkissDoorGUID; + + void Initialize() { - if (AnzuEncounter >= IN_PROGRESS) - pCreature->DisappearAndDie(); - else - AnzuEncounter = IN_PROGRESS; + AnzuEncounter = NOT_STARTED; + m_uiIkissDoorGUID = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - if (pGo->GetEntry() == IKISS_DOOR) - m_uiIkissDoorGUID = pGo->GetGUID(); - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_IKISSDOOREVENT: - if (data == DONE) - DoUseDoorOrButton(m_uiIkissDoorGUID,DAY*IN_MILLISECONDS); - break; - case TYPE_ANZU_ENCOUNTER: - AnzuEncounter = data; - break; + if (pCreature->GetEntry() == NPC_ANZU) + { + if (AnzuEncounter >= IN_PROGRESS) + pCreature->DisappearAndDie(); + else + AnzuEncounter = IN_PROGRESS; + } } - } + + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + if (pGo->GetEntry() == IKISS_DOOR) + m_uiIkissDoorGUID = pGo->GetGUID(); + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_IKISSDOOREVENT: + if (data == DONE) + DoUseDoorOrButton(m_uiIkissDoorGUID,DAY*IN_MILLISECONDS); + break; + case TYPE_ANZU_ENCOUNTER: + AnzuEncounter = data; + break; + } + } + }; + }; -InstanceData* GetInstanceData_instance_sethekk_halls(Map* pMap) -{ - return new instance_sethekk_halls(pMap); -} void AddSC_instance_sethekk_halls() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_sethekk_halls"; - newscript->GetInstanceData = &GetInstanceData_instance_sethekk_halls; - newscript->RegisterSelf(); + new instance_sethekk_halls(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp index f039b7c7fab..9d2b9598ae5 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_ambassador_hellmaw.cpp @@ -43,166 +43,168 @@ enum eEnums SPELL_FEAR = 33547, SPELL_ENRAGE = 34970 }; - -struct boss_ambassador_hellmawAI : public npc_escortAI + class boss_ambassador_hellmaw : public CreatureScript { - boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + boss_ambassador_hellmaw() : CreatureScript("boss_ambassador_hellmaw") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); + return new boss_ambassador_hellmawAI(pCreature); } - ScriptedInstance* m_pInstance; - - uint32 EventCheck_Timer; - uint32 CorrosiveAcid_Timer; - uint32 Fear_Timer; - uint32 Enrage_Timer; - bool Intro; - bool IsBanished; - bool Enraged; - - void Reset() + struct boss_ambassador_hellmawAI : public npc_escortAI { - EventCheck_Timer = 5000; - CorrosiveAcid_Timer = 5000 + rand()%5000; - Fear_Timer = 25000 + rand()%5000; - Enrage_Timer = 180000; - Intro = false; - IsBanished = true; - Enraged = false; - - if (m_pInstance && me->isAlive()) + boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) - DoCast(me, SPELL_BANISH, true); + m_pInstance = pCreature->GetInstanceScript(); } - } - void JustReachedHome() - { - if (m_pInstance) - m_pInstance->SetData(TYPE_HELLMAW, FAIL); - } + InstanceScript* m_pInstance; - void MoveInLineOfSight(Unit* pWho) - { - if (me->HasAura(SPELL_BANISH)) - return; + uint32 EventCheck_Timer; + uint32 CorrosiveAcid_Timer; + uint32 Fear_Timer; + uint32 Enrage_Timer; + bool Intro; + bool IsBanished; + bool Enraged; - npc_escortAI::MoveInLineOfSight(pWho); - } - - void WaypointReached(uint32 /*i*/) - { - } - - void DoIntro() - { - if (me->HasAura(SPELL_BANISH)) - me->RemoveAurasDueToSpell(SPELL_BANISH); - - IsBanished = false; - Intro = true; - - if (m_pInstance) + void Reset() { - if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) + EventCheck_Timer = 5000; + CorrosiveAcid_Timer = 5000 + rand()%5000; + Fear_Timer = 25000 + rand()%5000; + Enrage_Timer = 180000; + Intro = false; + IsBanished = true; + Enraged = false; + + if (m_pInstance && me->isAlive()) { - DoScriptText(SAY_INTRO, me); - Start(true, false, 0, NULL, false, true); + if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) + DoCast(me, SPELL_BANISH, true); } - - m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (m_pInstance) - m_pInstance->SetData(TYPE_HELLMAW, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!Intro && !HasEscortState(STATE_ESCORT_ESCORTING)) + void JustReachedHome() { - if (EventCheck_Timer <= diff) + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, FAIL); + } + + void MoveInLineOfSight(Unit* pWho) + { + if (me->HasAura(SPELL_BANISH)) + return; + + npc_escortAI::MoveInLineOfSight(pWho); + } + + void WaypointReached(uint32 /*i*/) + { + } + + void DoIntro() + { + if (me->HasAura(SPELL_BANISH)) + me->RemoveAurasDueToSpell(SPELL_BANISH); + + IsBanished = false; + Intro = true; + + if (m_pInstance) { - if (m_pInstance) + if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) { - if (m_pInstance->GetData(TYPE_OVERSEER) == DONE) - { - DoIntro(); - return; - } + DoScriptText(SAY_INTRO, me); + Start(true, false, 0, NULL, false, true); } - EventCheck_Timer = 5000; - return; - } - else - { - EventCheck_Timer -= diff; - return; + + m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); } } - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (me->HasAura(SPELL_BANISH, 0)) + void EnterCombat(Unit * /*who*/) { - EnterEvadeMode(); - return; + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); } - if (CorrosiveAcid_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me->getVictim(), SPELL_CORROSIVE_ACID); - CorrosiveAcid_Timer = 15000 + rand()%10000; - } else CorrosiveAcid_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - if (Fear_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoCast(me, SPELL_FEAR); - Fear_Timer = 20000 + rand()%15000; - } else Fear_Timer -= diff; + DoScriptText(SAY_DEATH, me); - if (IsHeroic()) + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, DONE); + } + + void UpdateAI(const uint32 diff) { - if (!Enraged && Enrage_Timer <= diff) + if (!Intro && !HasEscortState(STATE_ESCORT_ESCORTING)) { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else Enrage_Timer -= diff; + if (EventCheck_Timer <= diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_OVERSEER) == DONE) + { + DoIntro(); + return; + } + } + EventCheck_Timer = 5000; + return; + } + else + { + EventCheck_Timer -= diff; + return; + } + } + + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (me->HasAura(SPELL_BANISH, 0)) + { + EnterEvadeMode(); + return; + } + + if (CorrosiveAcid_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CORROSIVE_ACID); + CorrosiveAcid_Timer = 15000 + rand()%10000; + } else CorrosiveAcid_Timer -= diff; + + if (Fear_Timer <= diff) + { + DoCast(me, SPELL_FEAR); + Fear_Timer = 20000 + rand()%15000; + } else Fear_Timer -= diff; + + if (IsHeroic()) + { + if (!Enraged && Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else Enrage_Timer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature) -{ - return new boss_ambassador_hellmawAI(pCreature); -} void AddSC_boss_ambassador_hellmaw() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ambassador_hellmaw"; - newscript->GetAI = &GetAI_boss_ambassador_hellmaw; - newscript->RegisterSelf(); + new boss_ambassador_hellmaw(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index 817b71200f0..1ee4035af1c 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -53,119 +53,121 @@ EndScriptData */ #define SAY2_SLAY2 -1555025 #define SAY2_HELP -1555026 #define SAY2_DEATH -1555027 - -struct boss_blackheart_the_inciterAI : public ScriptedAI + class boss_blackheart_the_inciter : public CreatureScript { - boss_blackheart_the_inciterAI(Creature *c) : ScriptedAI(c) +public: + boss_blackheart_the_inciter() : CreatureScript("boss_blackheart_the_inciter") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_blackheart_the_inciterAI (pCreature); } - ScriptedInstance *pInstance; - - bool InciteChaos; - uint32 InciteChaos_Timer; - uint32 InciteChaosWait_Timer; - uint32 Charge_Timer; - uint32 Knockback_Timer; - - void Reset() + struct boss_blackheart_the_inciterAI : public ScriptedAI { - InciteChaos = false; - InciteChaos_Timer = 20000; - InciteChaosWait_Timer = 15000; - Charge_Timer = 5000; - Knockback_Timer = 15000; - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, NOT_STARTED); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (InciteChaos) + boss_blackheart_the_inciterAI(Creature *c) : ScriptedAI(c) { - if (InciteChaosWait_Timer <= diff) - { - InciteChaos = false; - InciteChaosWait_Timer = 15000; - } else InciteChaosWait_Timer -= diff; - - return; + pInstance = c->GetInstanceScript(); } - if (InciteChaos_Timer <= diff) - { - DoCast(me, SPELL_INCITE_CHAOS); + InstanceScript *pInstance; - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + bool InciteChaos; + uint32 InciteChaos_Timer; + uint32 InciteChaosWait_Timer; + uint32 Charge_Timer; + uint32 Knockback_Timer; + + void Reset() + { + InciteChaos = false; + InciteChaos_Timer = 20000; + InciteChaosWait_Timer = 15000; + Charge_Timer = 5000; + Knockback_Timer = 15000; + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, NOT_STARTED); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (InciteChaos) { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - pTarget->CastSpell(pTarget,SPELL_INCITE_CHAOS_B,true); + if (InciteChaosWait_Timer <= diff) + { + InciteChaos = false; + InciteChaosWait_Timer = 15000; + } else InciteChaosWait_Timer -= diff; + + return; } - DoResetThreat(); - InciteChaos = true; - InciteChaos_Timer = 40000; - return; - } else InciteChaos_Timer -= diff; + if (InciteChaos_Timer <= diff) + { + DoCast(me, SPELL_INCITE_CHAOS); - //Charge_Timer - if (Charge_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_CHARGE); - Charge_Timer = 15000 + rand()%10000; - } else Charge_Timer -= diff; + std::list t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + pTarget->CastSpell(pTarget,SPELL_INCITE_CHAOS_B,true); + } - //Knockback_Timer - if (Knockback_Timer <= diff) - { - DoCast(me, SPELL_WAR_STOMP); - Knockback_Timer = 18000 + rand()%6000; - } else Knockback_Timer -= diff; + DoResetThreat(); + InciteChaos = true; + InciteChaos_Timer = 40000; + return; + } else InciteChaos_Timer -= diff; + + //Charge_Timer + if (Charge_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_CHARGE); + Charge_Timer = 15000 + rand()%10000; + } else Charge_Timer -= diff; + + //Knockback_Timer + if (Knockback_Timer <= diff) + { + DoCast(me, SPELL_WAR_STOMP); + Knockback_Timer = 18000 + rand()%6000; + } else Knockback_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_blackheart_the_inciter(Creature* pCreature) -{ - return new boss_blackheart_the_inciterAI (pCreature); -} void AddSC_boss_blackheart_the_inciter() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_blackheart_the_inciter"; - newscript->GetAI = &GetAI_boss_blackheart_the_inciter; - newscript->RegisterSelf(); + new boss_blackheart_the_inciter(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 4234c0c1271..ea1b0ad41b7 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -61,255 +61,260 @@ float VoidPortalCoords[5][3] = {-209.3401, -262.7564, 17.1}, {-261.4533, -297.3298, 17.1} }; - -struct mob_voidtravelerAI : public ScriptedAI + class mob_voidtraveler : public CreatureScript { - mob_voidtravelerAI(Creature *c) : ScriptedAI(c) +public: + mob_voidtraveler() : CreatureScript("mob_voidtraveler") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_voidtravelerAI (pCreature); } - uint64 VorpilGUID; - uint32 move; - bool sacrificed; - - void Reset() + struct mob_voidtravelerAI : public ScriptedAI { - VorpilGUID = 0; - move = 0; - sacrificed = false; - } - - void EnterCombat(Unit * /*who*/){} - - void UpdateAI(const uint32 diff) - { - if (!VorpilGUID) + mob_voidtravelerAI(Creature *c) : ScriptedAI(c) { - me->Kill(me); - return; } - if (move <= diff) - { - Creature *Vorpil = Unit::GetCreature(*me, VorpilGUID); - if (!Vorpil) - { - VorpilGUID = 0; - return; - } - if (sacrificed) - { - me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil); - Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth()/25); - DoCast(me, SPELL_SHADOW_NOVA, true); - me->Kill(me); - return; - } - me->GetMotionMaster()->MoveFollow(Vorpil,0,0); - if (me->IsWithinDist(Vorpil, 3)) - { - DoCast(me, SPELL_SACRIFICE, false); - sacrificed = true; - move = 500; - return; - } - if (!Vorpil->isInCombat() || Vorpil->isDead()) + uint64 VorpilGUID; + uint32 move; + bool sacrificed; + + void Reset() + { + VorpilGUID = 0; + move = 0; + sacrificed = false; + } + + void EnterCombat(Unit * /*who*/){} + + void UpdateAI(const uint32 diff) + { + if (!VorpilGUID) { me->Kill(me); return; } - move = 1000; - } else move -= diff; - } -}; -CreatureAI* GetAI_mob_voidtraveler(Creature* pCreature) -{ - return new mob_voidtravelerAI (pCreature); -} - -struct boss_grandmaster_vorpilAI : public ScriptedAI -{ - boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - Intro = false; - } - - ScriptedInstance *pInstance; - bool Intro, HelpYell; - bool sumportals; - - uint32 ShadowBoltVolley_Timer; - uint32 DrawShadows_Timer; - uint32 summonTraveler_Timer; - uint32 banish_Timer; - uint64 PortalsGuid[5]; - - void Reset() - { - ShadowBoltVolley_Timer = 7000 + rand()%7000; - DrawShadows_Timer = 45000; - summonTraveler_Timer = 90000; - banish_Timer = 17000; - HelpYell = false; - destroyPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); - } - - void summonPortals() - { - if (!sumportals) - { - for (uint8 i = 0; i < 5; ++i) + if (move <= diff) { - Creature *Portal = NULL; - Portal = me->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); - if (Portal) + Creature *Vorpil = Unit::GetCreature(*me, VorpilGUID); + if (!Vorpil) { - PortalsGuid[i] = Portal->GetGUID(); - Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); + VorpilGUID = 0; + return; } - } - sumportals = true; - summonTraveler_Timer = 5000; + + if (sacrificed) + { + me->AddAura(DUNGEON_MODE(SPELL_EMPOWERING_SHADOWS, H_SPELL_EMPOWERING_SHADOWS), Vorpil); + Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth()/25); + DoCast(me, SPELL_SHADOW_NOVA, true); + me->Kill(me); + return; + } + me->GetMotionMaster()->MoveFollow(Vorpil,0,0); + if (me->IsWithinDist(Vorpil, 3)) + { + DoCast(me, SPELL_SACRIFICE, false); + sacrificed = true; + move = 500; + return; + } + if (!Vorpil->isInCombat() || Vorpil->isDead()) + { + me->Kill(me); + return; + } + move = 1000; + } else move -= diff; } - } + }; - void destroyPortals() - { - if (sumportals) - { - for (uint8 i = 0; i < 5; ++i) - { - Unit *Portal = Unit::GetUnit((*me), PortalsGuid[i]); - if (Portal && Portal->isAlive()) - Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - PortalsGuid[i] = 0; - } - sumportals = false; - } - } - - void spawnVoidTraveler() - { - int pos = urand(0,4); - me->SummonCreature(MOB_VOID_TRAVELER,VoidPortalCoords[pos][0],VoidPortalCoords[pos][1],VoidPortalCoords[pos][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,5000); - if (!HelpYell) - { - DoScriptText(SAY_HELP, me); - HelpYell = true; - } - } - - void JustSummoned(Creature *summoned) - { - if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER) - CAST_AI(mob_voidtravelerAI, summoned->AI())->VorpilGUID = me->GetGUID(); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - destroyPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - summonPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); - } - - void MoveInLineOfSight(Unit *who) - { - ScriptedAI::MoveInLineOfSight(who); - - if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsHostileTo(who)) - { - DoScriptText(SAY_INTRO, me); - Intro = true; - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (ShadowBoltVolley_Timer <= diff) - { - DoCast(me, SPELL_SHADOWBOLT_VOLLEY); - ShadowBoltVolley_Timer = 15000 + rand()%15000; - } else ShadowBoltVolley_Timer -= diff; - - if (IsHeroic() && banish_Timer <= diff) - { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,false); - if (pTarget) - { - DoCast(pTarget, SPELL_BANISH); - banish_Timer = 16000; - } - } else banish_Timer -= diff; - - if (DrawShadows_Timer <= diff) - { - Map* pMap = me->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* i_pl = i->getSource()) - if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH)) - i_pl->TeleportTo(me->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); - - me->GetMap()->CreatureRelocation(me, VorpilPosition[0],VorpilPosition[1],VorpilPosition[2],0.0f); - DoCast(me, SPELL_DRAW_SHADOWS, true); - - DoCast(me, SPELL_RAIN_OF_FIRE); - - ShadowBoltVolley_Timer = 6000; - DrawShadows_Timer = 30000; - } else DrawShadows_Timer -= diff; - - if (summonTraveler_Timer <= diff) - { - spawnVoidTraveler(); - summonTraveler_Timer = 10000; - //enrage at 20% - if ((me->GetHealth()*5) < me->GetMaxHealth()) - summonTraveler_Timer = 5000; - } else summonTraveler_Timer -=diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_grandmaster_vorpil(Creature* pCreature) + class boss_grandmaster_vorpil : public CreatureScript { - return new boss_grandmaster_vorpilAI (pCreature); -} +public: + boss_grandmaster_vorpil() : CreatureScript("boss_grandmaster_vorpil") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_grandmaster_vorpilAI (pCreature); + } + + struct boss_grandmaster_vorpilAI : public ScriptedAI + { + boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + Intro = false; + } + + InstanceScript *pInstance; + bool Intro, HelpYell; + bool sumportals; + + uint32 ShadowBoltVolley_Timer; + uint32 DrawShadows_Timer; + uint32 summonTraveler_Timer; + uint32 banish_Timer; + uint64 PortalsGuid[5]; + + void Reset() + { + ShadowBoltVolley_Timer = 7000 + rand()%7000; + DrawShadows_Timer = 45000; + summonTraveler_Timer = 90000; + banish_Timer = 17000; + HelpYell = false; + destroyPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); + } + + void summonPortals() + { + if (!sumportals) + { + for (uint8 i = 0; i < 5; ++i) + { + Creature *Portal = NULL; + Portal = me->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); + if (Portal) + { + PortalsGuid[i] = Portal->GetGUID(); + Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); + } + } + sumportals = true; + summonTraveler_Timer = 5000; + } + } + + void destroyPortals() + { + if (sumportals) + { + for (uint8 i = 0; i < 5; ++i) + { + Unit *Portal = Unit::GetUnit((*me), PortalsGuid[i]); + if (Portal && Portal->isAlive()) + Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + PortalsGuid[i] = 0; + } + sumportals = false; + } + } + + void spawnVoidTraveler() + { + int pos = urand(0,4); + me->SummonCreature(MOB_VOID_TRAVELER,VoidPortalCoords[pos][0],VoidPortalCoords[pos][1],VoidPortalCoords[pos][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,5000); + if (!HelpYell) + { + DoScriptText(SAY_HELP, me); + HelpYell = true; + } + } + + void JustSummoned(Creature *summoned) + { + if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER) + CAST_AI(mob_voidtraveler::mob_voidtravelerAI, summoned->AI())->VorpilGUID = me->GetGUID(); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + destroyPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + summonPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); + } + + void MoveInLineOfSight(Unit *who) + { + ScriptedAI::MoveInLineOfSight(who); + + if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsHostileTo(who)) + { + DoScriptText(SAY_INTRO, me); + Intro = true; + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (ShadowBoltVolley_Timer <= diff) + { + DoCast(me, SPELL_SHADOWBOLT_VOLLEY); + ShadowBoltVolley_Timer = 15000 + rand()%15000; + } else ShadowBoltVolley_Timer -= diff; + + if (IsHeroic() && banish_Timer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,false); + if (pTarget) + { + DoCast(pTarget, SPELL_BANISH); + banish_Timer = 16000; + } + } else banish_Timer -= diff; + + if (DrawShadows_Timer <= diff) + { + Map* pMap = me->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH)) + i_pl->TeleportTo(me->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); + + me->GetMap()->CreatureRelocation(me, VorpilPosition[0],VorpilPosition[1],VorpilPosition[2],0.0f); + DoCast(me, SPELL_DRAW_SHADOWS, true); + + DoCast(me, SPELL_RAIN_OF_FIRE); + + ShadowBoltVolley_Timer = 6000; + DrawShadows_Timer = 30000; + } else DrawShadows_Timer -= diff; + + if (summonTraveler_Timer <= diff) + { + spawnVoidTraveler(); + summonTraveler_Timer = 10000; + //enrage at 20% + if ((me->GetHealth()*5) < me->GetMaxHealth()) + summonTraveler_Timer = 5000; + } else summonTraveler_Timer -=diff; + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_grandmaster_vorpil() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_grandmaster_vorpil"; - newscript->GetAI = &GetAI_boss_grandmaster_vorpil; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_voidtraveler"; - newscript->GetAI = &GetAI_mob_voidtraveler; - newscript->RegisterSelf(); + new boss_grandmaster_vorpil(); + new mob_voidtraveler(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index ef6565bb7cf..b37eccada5a 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -35,173 +35,175 @@ EndScriptData */ #define SPELL_MAGNETIC_PULL 33689 #define SPELL_SONIC_SHOCK 38797 #define SPELL_THUNDERING_STORM 39365 - -struct boss_murmurAI : public ScriptedAI + class boss_murmur : public CreatureScript { - boss_murmurAI(Creature *c) : ScriptedAI(c) +public: + boss_murmur() : CreatureScript("boss_murmur") { } + + CreatureAI* GetAI(Creature* pCreature) const { - SetCombatMovement(false); + return new boss_murmurAI (pCreature); } - uint32 SonicBoom_Timer; - uint32 MurmursTouch_Timer; - uint32 Resonance_Timer; - uint32 MagneticPull_Timer; - uint32 SonicShock_Timer; - uint32 ThunderingStorm_Timer; - bool SonicBoom; - - void Reset() + struct boss_murmurAI : public ScriptedAI { - SonicBoom_Timer = 30000; - MurmursTouch_Timer = 8000 + rand()%12000; - Resonance_Timer = 5000; - MagneticPull_Timer = 15000 + rand()%15000; - ThunderingStorm_Timer = 15000; - SonicShock_Timer = 10000; - SonicBoom = false; - - //database should have `RegenHealth`=0 to prevent regen - uint32 hp = (me->GetMaxHealth()*40)/100; - if (hp) me->SetHealth(hp); - me->ResetPlayerDamageReq(); - } - - void SonicBoomEffect() - { - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + boss_murmurAI(Creature *c) : ScriptedAI(c) { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) - { - //Not do anything without aura, spell can be resisted! - if (pTarget->HasAura(SPELL_SONIC_BOOM_CAST) && me->IsWithinDistInMap(pTarget, 34.0f)) - { - //This will be wrong calculation. Also, comments suggest it must deal damage - pTarget->SetHealth(uint32(pTarget->GetMaxHealth() - pTarget->GetMaxHealth() * 0.8)); - } - } + SetCombatMovement(false); } - } - void EnterCombat(Unit * /*who*/) { } + uint32 SonicBoom_Timer; + uint32 MurmursTouch_Timer; + uint32 Resonance_Timer; + uint32 MagneticPull_Timer; + uint32 SonicShock_Timer; + uint32 ThunderingStorm_Timer; + bool SonicBoom; - // Sonic Boom instant damage (needs core fix instead of this) - void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) - { - if (pTarget && pTarget->isAlive() && spell && spell->Id == uint32(SPELL_SONIC_BOOM_EFFECT)) - me->DealDamage(pTarget,(pTarget->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target or casting - if (!UpdateVictim() || me->IsNonMeleeSpellCasted(false)) - return; - - // Sonic Boom - if (SonicBoom) + void Reset() { - DoCast(me, SPELL_SONIC_BOOM_EFFECT, true); - SonicBoomEffect(); - - SonicBoom = false; - Resonance_Timer = 1500; - } - if (SonicBoom_Timer <= diff) - { - DoScriptText(EMOTE_SONIC_BOOM, me); - DoCast(me, SPELL_SONIC_BOOM_CAST); SonicBoom_Timer = 30000; - SonicBoom = true; - return; - } else SonicBoom_Timer -= diff; + MurmursTouch_Timer = 8000 + rand()%12000; + Resonance_Timer = 5000; + MagneticPull_Timer = 15000 + rand()%15000; + ThunderingStorm_Timer = 15000; + SonicShock_Timer = 10000; + SonicBoom = false; - // Murmur's Touch - if (MurmursTouch_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,80,true)) - DoCast(pTarget, SPELL_MURMURS_TOUCH); - MurmursTouch_Timer = 25000 + rand()%10000; - } else MurmursTouch_Timer -= diff; - - // Resonance - if (!SonicBoom && !(me->IsWithinMeleeRange(me->getVictim()))) - { - if (Resonance_Timer <= diff) - { - DoCast(me, SPELL_RESONANCE); - Resonance_Timer = 5000; - } else Resonance_Timer -= diff; + //database should have `RegenHealth`=0 to prevent regen + uint32 hp = (me->GetMaxHealth()*40)/100; + if (hp) me->SetHealth(hp); + me->ResetPlayerDamageReq(); } - // Magnetic Pull - if (MagneticPull_Timer <= diff) + void SonicBoomEffect() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) - { - DoCast(pTarget, SPELL_MAGNETIC_PULL); - MagneticPull_Timer = 15000+rand()%15000; - return; - } - MagneticPull_Timer = 500; - } else MagneticPull_Timer -= diff; + std::list t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + { + //Not do anything without aura, spell can be resisted! + if (pTarget->HasAura(SPELL_SONIC_BOOM_CAST) && me->IsWithinDistInMap(pTarget, 34.0f)) + { + //This will be wrong calculation. Also, comments suggest it must deal damage + pTarget->SetHealth(uint32(pTarget->GetMaxHealth() - pTarget->GetMaxHealth() * 0.8)); + } + } + } + } - if (IsHeroic()) + void EnterCombat(Unit * /*who*/) { } + + // Sonic Boom instant damage (needs core fix instead of this) + void SpellHitTarget(Unit *pTarget, const SpellEntry *spell) { - // Thundering Storm - if (ThunderingStorm_Timer <= diff) + if (pTarget && pTarget->isAlive() && spell && spell->Id == uint32(SPELL_SONIC_BOOM_EFFECT)) + me->DealDamage(pTarget,(pTarget->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target or casting + if (!UpdateVictim() || me->IsNonMeleeSpellCasted(false)) + return; + + // Sonic Boom + if (SonicBoom) + { + DoCast(me, SPELL_SONIC_BOOM_EFFECT, true); + SonicBoomEffect(); + + SonicBoom = false; + Resonance_Timer = 1500; + } + if (SonicBoom_Timer <= diff) + { + DoScriptText(EMOTE_SONIC_BOOM, me); + DoCast(me, SPELL_SONIC_BOOM_CAST); + SonicBoom_Timer = 30000; + SonicBoom = true; + return; + } else SonicBoom_Timer -= diff; + + // Murmur's Touch + if (MurmursTouch_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,80,true)) + DoCast(pTarget, SPELL_MURMURS_TOUCH); + MurmursTouch_Timer = 25000 + rand()%10000; + } else MurmursTouch_Timer -= diff; + + // Resonance + if (!SonicBoom && !(me->IsWithinMeleeRange(me->getVictim()))) + { + if (Resonance_Timer <= diff) + { + DoCast(me, SPELL_RESONANCE); + Resonance_Timer = 5000; + } else Resonance_Timer -= diff; + } + + // Magnetic Pull + if (MagneticPull_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive()) + { + DoCast(pTarget, SPELL_MAGNETIC_PULL); + MagneticPull_Timer = 15000+rand()%15000; + return; + } + MagneticPull_Timer = 500; + } else MagneticPull_Timer -= diff; + + if (IsHeroic()) + { + // Thundering Storm + if (ThunderingStorm_Timer <= diff) + { + std::list& m_threatlist = me->getThreatManager().getThreatList(); + for (std::list::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + if (Unit *pTarget = Unit::GetUnit((*me),(*i)->getUnitGuid())) + if (pTarget->isAlive() && !me->IsWithinDist(pTarget, 35, false)) + DoCast(pTarget, SPELL_THUNDERING_STORM, true); + ThunderingStorm_Timer = 15000; + } else ThunderingStorm_Timer -= diff; + + // Sonic Shock + if (SonicShock_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,20,false)) + if (pTarget->isAlive()) + DoCast(pTarget, SPELL_SONIC_SHOCK); + SonicShock_Timer = 10000+rand()%10000; + } else SonicShock_Timer -= diff; + } + + // Select nearest most aggro target if top aggro too far + if (!me->isAttackReady()) + return; + if (!me->IsWithinMeleeRange(me->getVictim())) { std::list& m_threatlist = me->getThreatManager().getThreatList(); for (std::list::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit *pTarget = Unit::GetUnit((*me),(*i)->getUnitGuid())) - if (pTarget->isAlive() && !me->IsWithinDist(pTarget, 35, false)) - DoCast(pTarget, SPELL_THUNDERING_STORM, true); - ThunderingStorm_Timer = 15000; - } else ThunderingStorm_Timer -= diff; + if (pTarget->isAlive() && me->IsWithinMeleeRange(pTarget)) + { + me->TauntApply(pTarget); + break; + } + } - // Sonic Shock - if (SonicShock_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,20,false)) - if (pTarget->isAlive()) - DoCast(pTarget, SPELL_SONIC_SHOCK); - SonicShock_Timer = 10000+rand()%10000; - } else SonicShock_Timer -= diff; + DoMeleeAttackIfReady(); } + }; - // Select nearest most aggro target if top aggro too far - if (!me->isAttackReady()) - return; - if (!me->IsWithinMeleeRange(me->getVictim())) - { - std::list& m_threatlist = me->getThreatManager().getThreatList(); - for (std::list::const_iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - if (Unit *pTarget = Unit::GetUnit((*me),(*i)->getUnitGuid())) - if (pTarget->isAlive() && me->IsWithinMeleeRange(pTarget)) - { - me->TauntApply(pTarget); - break; - } - } - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_murmur(Creature* pCreature) -{ - return new boss_murmurAI (pCreature); -} void AddSC_boss_murmur() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_murmur"; - newscript->GetAI = &GetAI_boss_murmur; - newscript->RegisterSelf(); + new boss_murmur(); } - diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index b5b917547a6..5ff41763644 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -37,193 +37,195 @@ EndScriptData */ 3 - Grandmaster Vorpil event 4 - Murmur event */ - -struct instance_shadow_labyrinth : public ScriptedInstance + class instance_shadow_labyrinth : public InstanceMapScript { - instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_shadow_labyrinth() : InstanceMapScript("instance_shadow_labyrinth") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 m_uiRefectoryDoorGUID; - uint64 m_uiScreamingHallDoorGUID; - - uint64 m_uiGrandmasterVorpil; - uint32 m_uiFelOverseerCount; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiRefectoryDoorGUID = 0; - m_uiScreamingHallDoorGUID = 0; - - m_uiGrandmasterVorpil = 0; - m_uiFelOverseerCount = 0; + return new instance_shadow_labyrinth_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_shadow_labyrinth_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_shadow_labyrinth_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + uint64 m_uiRefectoryDoorGUID; + uint64 m_uiScreamingHallDoorGUID; + + uint64 m_uiGrandmasterVorpil; + uint32 m_uiFelOverseerCount; + + void Initialize() { - case REFECTORY_DOOR: - m_uiRefectoryDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case SCREAMING_HALL_DOOR: - m_uiScreamingHallDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiRefectoryDoorGUID = 0; + m_uiScreamingHallDoorGUID = 0; + + m_uiGrandmasterVorpil = 0; + m_uiFelOverseerCount = 0; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + bool IsEncounterInProgress() const { - case 18732: - m_uiGrandmasterVorpil = pCreature->GetGUID(); - break; - case 18796: - if (pCreature->isAlive()) - { - ++m_uiFelOverseerCount; - sLog.outDebug("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); - } - break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; } - } - void SetData(uint32 type, uint32 uiData) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case TYPE_HELLMAW: - m_auiEncounter[0] = uiData; - break; + switch(pGo->GetEntry()) + { + case REFECTORY_DOOR: + m_uiRefectoryDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case SCREAMING_HALL_DOOR: + m_uiScreamingHallDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + } + } - case TYPE_OVERSEER: - if (uiData != DONE) - { - sLog.outError("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); - return; - } - if (m_uiFelOverseerCount) - { - --m_uiFelOverseerCount; - - if (m_uiFelOverseerCount) - sLog.outDebug("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); - else + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 18732: + m_uiGrandmasterVorpil = pCreature->GetGUID(); + break; + case 18796: + if (pCreature->isAlive()) { - m_auiEncounter[1] = DONE; - sLog.outDebug("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + ++m_uiFelOverseerCount; + sLog.outDebug("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); } - } - break; - - case DATA_BLACKHEARTTHEINCITEREVENT: - if (uiData == DONE) - DoUseDoorOrButton(m_uiRefectoryDoorGUID); - m_auiEncounter[2] = uiData; - break; - - case DATA_GRANDMASTERVORPILEVENT: - if (uiData == DONE) - DoUseDoorOrButton(m_uiScreamingHallDoorGUID); - m_auiEncounter[3] = uiData; - break; - - case DATA_MURMUREVENT: - m_auiEncounter[4] = uiData; - break; + break; + } } - if (uiData == DONE) + void SetData(uint32 type, uint32 uiData) { - if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) + switch(type) + { + case TYPE_HELLMAW: + m_auiEncounter[0] = uiData; + break; + + case TYPE_OVERSEER: + if (uiData != DONE) + { + sLog.outError("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); + return; + } + if (m_uiFelOverseerCount) + { + --m_uiFelOverseerCount; + + if (m_uiFelOverseerCount) + sLog.outDebug("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); + else + { + m_auiEncounter[1] = DONE; + sLog.outDebug("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + } + } + break; + + case DATA_BLACKHEARTTHEINCITEREVENT: + if (uiData == DONE) + DoUseDoorOrButton(m_uiRefectoryDoorGUID); + m_auiEncounter[2] = uiData; + break; + + case DATA_GRANDMASTERVORPILEVENT: + if (uiData == DONE) + DoUseDoorOrButton(m_uiScreamingHallDoorGUID); + m_auiEncounter[3] = uiData; + break; + + case DATA_MURMUREVENT: + m_auiEncounter[4] = uiData; + break; + } + + if (uiData == DONE) + { + if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) + return; + + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_HELLMAW: return m_auiEncounter[0]; + case TYPE_OVERSEER: return m_auiEncounter[1]; + case DATA_GRANDMASTERVORPILEVENT: return m_auiEncounter[3]; + case DATA_MURMUREVENT: return m_auiEncounter[4]; + } + return false; + } + + uint64 GetData64(uint32 identifier) + { + if (identifier == DATA_GRANDMASTERVORPIL) + return m_uiGrandmasterVorpil; + + return 0; + } + + std::string GetSaveData() + { + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; return; + } - OUT_SAVE_INST_DATA; + OUT_LOAD_INST_DATA(in); - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]; - str_data = saveStream.str(); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + OUT_LOAD_INST_DATA_COMPLETE; } - } + }; - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_HELLMAW: return m_auiEncounter[0]; - case TYPE_OVERSEER: return m_auiEncounter[1]; - case DATA_GRANDMASTERVORPILEVENT: return m_auiEncounter[3]; - case DATA_MURMUREVENT: return m_auiEncounter[4]; - } - return false; - } - - uint64 GetData64(uint32 identifier) - { - if (identifier == DATA_GRANDMASTERVORPIL) - return m_uiGrandmasterVorpil; - - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_shadow_labyrinth(Map* pMap) -{ - return new instance_shadow_labyrinth(pMap); -} void AddSC_instance_shadow_labyrinth() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_shadow_labyrinth"; - newscript->GetInstanceData = &GetInstanceData_instance_shadow_labyrinth; - newscript->RegisterSelf(); + new instance_shadow_labyrinth(); } - diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.cpp b/src/server/scripts/Outland/BlackTemple/black_temple.cpp index bae84641086..d5020064ce8 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/black_temple.cpp @@ -36,36 +36,36 @@ EndContentData */ #define SPELL_TELEPORT 41566 // s41566 - Teleport to Ashtongue NPC's #define GOSSIP_OLUM1 "Teleport me to the other Ashtongue Deathsworn" - -bool GossipHello_npc_spirit_of_olum(Player* pPlayer, Creature* pCreature) + class npc_spirit_of_olum : public CreatureScript { - ScriptedInstance* pInstance = pCreature->GetInstanceData(); +public: + npc_spirit_of_olum() : CreatureScript("npc_spirit_of_olum") { } - if (pInstance && (pInstance->GetData(DATA_SUPREMUSEVENT) >= DONE) && (pInstance->GetData(DATA_HIGHWARLORDNAJENTUSEVENT) >= DONE)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_OLUM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->InterruptNonMeleeSpells(false); + pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, false); + return true; + } -bool GossipSelect_npc_spirit_of_olum(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CLOSE_GOSSIP_MENU(); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + InstanceScript* pInstance = pCreature->GetInstanceScript(); + + if (pInstance && (pInstance->GetData(DATA_SUPREMUSEVENT) >= DONE) && (pInstance->GetData(DATA_HIGHWARLORDNAJENTUSEVENT) >= DONE)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_OLUM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; - pPlayer->InterruptNonMeleeSpells(false); - pPlayer->CastSpell(pPlayer, SPELL_TELEPORT, false); - return true; -} void AddSC_black_temple() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_spirit_of_olum"; - newscript->pGossipHello = &GossipHello_npc_spirit_of_olum; - newscript->pGossipSelect = &GossipSelect_npc_spirit_of_olum; - newscript->RegisterSelf(); + new npc_spirit_of_olum(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index b7fee842206..ad52ca56a70 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -54,281 +54,283 @@ EndScriptData */ #define SPELL_BERSERK 45078 //This is used to sort the players by distance in preparation for the Bloodboil cast. - -struct boss_gurtogg_bloodboilAI : public ScriptedAI + class boss_gurtogg_bloodboil : public CreatureScript { - boss_gurtogg_bloodboilAI(Creature *c) : ScriptedAI(c) +public: + boss_gurtogg_bloodboil() : CreatureScript("boss_gurtogg_bloodboil") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gurtogg_bloodboilAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 TargetGUID; - - float TargetThreat; - - uint32 BloodboilTimer; - uint32 BloodboilCount; - uint32 AcidGeyserTimer; - uint32 AcidicWoundTimer; - uint32 ArcingSmashTimer; - uint32 EnrageTimer; - uint32 FelAcidTimer; - uint32 EjectTimer; - uint32 BewilderingStrikeTimer; - uint32 PhaseChangeTimer; - - bool Phase1; - - void Reset() + struct boss_gurtogg_bloodboilAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, NOT_STARTED); - - TargetGUID = 0; - - TargetThreat = 0; - - BloodboilTimer = 10000; - BloodboilCount = 0; - AcidGeyserTimer = 1000; - AcidicWoundTimer = 6000; - ArcingSmashTimer = 19000; - EnrageTimer = 600000; - FelAcidTimer = 25000; - EjectTimer = 10000; - BewilderingStrikeTimer = 15000; - PhaseChangeTimer = 60000; - - Phase1 = true; - - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, DONE); - - DoScriptText(SAY_DEATH, me); - } - - // Note: This seems like a very complicated fix. The fix needs to be handled by the core, as implementation of limited-target AoE spells are still not limited. - void CastBloodboil() - { - // Get the Threat List - std::list m_threatlist = me->getThreatManager().getThreatList(); - - if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue - return; - - std::list targets; - std::list::const_iterator itr = m_threatlist.begin(); - for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container + boss_gurtogg_bloodboilAI(Creature *c) : ScriptedAI(c) { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //only on alive players - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - targets.push_back(pTarget); + pInstance = c->GetInstanceScript(); } - //Sort the list of players - targets.sort(Trinity::ObjectDistanceOrderPred(me, false)); - //Resize so we only get top 5 - targets.resize(5); + InstanceScript* pInstance; - //Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp - /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL); - if (spellInfo) + uint64 TargetGUID; + + float TargetThreat; + + uint32 BloodboilTimer; + uint32 BloodboilCount; + uint32 AcidGeyserTimer; + uint32 AcidicWoundTimer; + uint32 ArcingSmashTimer; + uint32 EnrageTimer; + uint32 FelAcidTimer; + uint32 EjectTimer; + uint32 BewilderingStrikeTimer; + uint32 PhaseChangeTimer; + + bool Phase1; + + void Reset() { - for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) - { - Unit *pTarget = *itr; - if (!pTarget) return; - for (uint32 i = 0; i<3; ++i) - { - uint8 eff = spellInfo->Effect[i]; - if (eff >= TOTAL_SPELL_EFFECTS) - continue; + if (pInstance) + pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, NOT_STARTED); - Aura *Aur = new Aura(spellInfo, i, pTarget, pTarget, pTarget); - pTarget->AddAura(Aur); - } - } - }*/ - } + TargetGUID = 0; - void RevertThreatOnTarget(uint64 guid) - { - Unit* pUnit = NULL; - pUnit = Unit::GetUnit((*me), guid); - if (pUnit) - { - if (DoGetThreat(pUnit)) - DoModifyThreatPercent(pUnit, -100); - if (TargetThreat) - me->AddThreat(pUnit, TargetThreat); - } - } + TargetThreat = 0; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (ArcingSmashTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCING_SMASH); - ArcingSmashTimer = 10000; - } else ArcingSmashTimer -= diff; - - if (FelAcidTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FEL_ACID); + BloodboilTimer = 10000; + BloodboilCount = 0; + AcidGeyserTimer = 1000; + AcidicWoundTimer = 6000; + ArcingSmashTimer = 19000; + EnrageTimer = 600000; FelAcidTimer = 25000; - } else FelAcidTimer -= diff; + EjectTimer = 10000; + BewilderingStrikeTimer = 15000; + PhaseChangeTimer = 60000; - if (!me->HasAura(SPELL_BERSERK)) - { - if (EnrageTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - DoScriptText(RAND(SAY_ENRAGE1,SAY_ENRAGE2), me); - } else EnrageTimer -= diff; + Phase1 = true; + + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } - if (Phase1) + void EnterCombat(Unit * /*who*/) { - if (BewilderingStrikeTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BEWILDERING_STRIKE); - float mt_threat = DoGetThreat(me->getVictim()); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) - me->AddThreat(pTarget, mt_threat); - BewilderingStrikeTimer = 20000; - } else BewilderingStrikeTimer -= diff; + DoZoneInCombat(); + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, IN_PROGRESS); + } - if (EjectTimer <= diff) - { - DoCast(me->getVictim(), SPELL_EJECT1); - DoModifyThreatPercent(me->getVictim(), -40); - EjectTimer = 15000; - } else EjectTimer -= diff; + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - if (AcidicWoundTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ACIDIC_WOUND); - AcidicWoundTimer = 10000; - } else AcidicWoundTimer -= diff; + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_GURTOGGBLOODBOILEVENT, DONE); - if (BloodboilTimer <= diff) + DoScriptText(SAY_DEATH, me); + } + + // Note: This seems like a very complicated fix. The fix needs to be handled by the core, as implementation of limited-target AoE spells are still not limited. + void CastBloodboil() + { + // Get the Threat List + std::list m_threatlist = me->getThreatManager().getThreatList(); + + if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue + return; + + std::list targets; + std::list::const_iterator itr = m_threatlist.begin(); + for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { - if (BloodboilCount < 5) // Only cast it five times. + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + //only on alive players + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + targets.push_back(pTarget); + } + + //Sort the list of players + targets.sort(Trinity::ObjectDistanceOrderPred(me, false)); + //Resize so we only get top 5 + targets.resize(5); + + //Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp + /*SpellEntry const *spellInfo = GetSpellStore()->LookupEntry(SPELL_BLOODBOIL); + if (spellInfo) + { + for (std::list::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) { - //CastBloodboil(); // Causes issues on windows, so is commented out. - DoCast(me->getVictim(), SPELL_BLOODBOIL); - ++BloodboilCount; - BloodboilTimer = 10000*BloodboilCount; + Unit *pTarget = *itr; + if (!pTarget) return; + for (uint32 i = 0; i<3; ++i) + { + uint8 eff = spellInfo->Effect[i]; + if (eff >= TOTAL_SPELL_EFFECTS) + continue; + + Aura *Aur = new Aura(spellInfo, i, pTarget, pTarget, pTarget); + pTarget->AddAura(Aur); + } } - } else BloodboilTimer -= diff; + }*/ } - if (!Phase1) + void RevertThreatOnTarget(uint64 guid) { - if (AcidGeyserTimer <= diff) + Unit* pUnit = NULL; + pUnit = Unit::GetUnit((*me), guid); + if (pUnit) { - DoCast(me->getVictim(), SPELL_ACID_GEYSER); - AcidGeyserTimer = 30000; - } else AcidGeyserTimer -= diff; - - if (EjectTimer <= diff) - { - DoCast(me->getVictim(), SPELL_EJECT2); - EjectTimer = 15000; - } else EjectTimer -= diff; + if (DoGetThreat(pUnit)) + DoModifyThreatPercent(pUnit, -100); + if (TargetThreat) + me->AddThreat(pUnit, TargetThreat); + } } - if (PhaseChangeTimer <= diff) + void UpdateAI(const uint32 diff) { + if (!UpdateVictim()) + return; + + if (ArcingSmashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCING_SMASH); + ArcingSmashTimer = 10000; + } else ArcingSmashTimer -= diff; + + if (FelAcidTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FEL_ACID); + FelAcidTimer = 25000; + } else FelAcidTimer -= diff; + + if (!me->HasAura(SPELL_BERSERK)) + { + if (EnrageTimer <= diff) + { + DoCast(me, SPELL_BERSERK); + DoScriptText(RAND(SAY_ENRAGE1,SAY_ENRAGE2), me); + } else EnrageTimer -= diff; + } + if (Phase1) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget && pTarget->isAlive()) + if (BewilderingStrikeTimer <= diff) { - Phase1 = false; + DoCast(me->getVictim(), SPELL_BEWILDERING_STRIKE); + float mt_threat = DoGetThreat(me->getVictim()); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 1)) + me->AddThreat(pTarget, mt_threat); + BewilderingStrikeTimer = 20000; + } else BewilderingStrikeTimer -= diff; - TargetThreat = DoGetThreat(pTarget); - TargetGUID = pTarget->GetGUID(); - pTarget->CastSpell(me, SPELL_TAUNT_GURTOGG, true); - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); - me->AddThreat(pTarget, 50000000.0f); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - // If VMaps are disabled, this spell can call the whole instance - DoCast(me, SPELL_INSIGNIFIGANCE, true); - DoCast(pTarget, SPELL_FEL_RAGE_TARGET, true); - DoCast(pTarget, SPELL_FEL_RAGE_2, true); - /* These spells do not work, comment them out for now. - DoCast(pTarget, SPELL_FEL_RAGE_2, true); - DoCast(pTarget, SPELL_FEL_RAGE_3, true);*/ + if (EjectTimer <= diff) + { + DoCast(me->getVictim(), SPELL_EJECT1); + DoModifyThreatPercent(me->getVictim(), -40); + EjectTimer = 15000; + } else EjectTimer -= diff; - //Cast this without triggered so that it appears in combat logs and shows visual. - DoCast(me, SPELL_FEL_RAGE_SELF); + if (AcidicWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ACIDIC_WOUND); + AcidicWoundTimer = 10000; + } else AcidicWoundTimer -= diff; - DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), me); - - AcidGeyserTimer = 1000; - PhaseChangeTimer = 30000; - } - } else // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage - { - if (TargetGUID) - RevertThreatOnTarget(TargetGUID); - TargetGUID = 0; - Phase1 = true; - BloodboilTimer = 10000; - BloodboilCount = 0; - AcidicWoundTimer += 2000; - ArcingSmashTimer += 2000; - FelAcidTimer += 2000; - EjectTimer += 2000; - PhaseChangeTimer = 60000; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); + if (BloodboilTimer <= diff) + { + if (BloodboilCount < 5) // Only cast it five times. + { + //CastBloodboil(); // Causes issues on windows, so is commented out. + DoCast(me->getVictim(), SPELL_BLOODBOIL); + ++BloodboilCount; + BloodboilTimer = 10000*BloodboilCount; + } + } else BloodboilTimer -= diff; } - } else PhaseChangeTimer -= diff; - DoMeleeAttackIfReady(); - } + if (!Phase1) + { + if (AcidGeyserTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ACID_GEYSER); + AcidGeyserTimer = 30000; + } else AcidGeyserTimer -= diff; + + if (EjectTimer <= diff) + { + DoCast(me->getVictim(), SPELL_EJECT2); + EjectTimer = 15000; + } else EjectTimer -= diff; + } + + if (PhaseChangeTimer <= diff) + { + if (Phase1) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget && pTarget->isAlive()) + { + Phase1 = false; + + TargetThreat = DoGetThreat(pTarget); + TargetGUID = pTarget->GetGUID(); + pTarget->CastSpell(me, SPELL_TAUNT_GURTOGG, true); + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + me->AddThreat(pTarget, 50000000.0f); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + // If VMaps are disabled, this spell can call the whole instance + DoCast(me, SPELL_INSIGNIFIGANCE, true); + DoCast(pTarget, SPELL_FEL_RAGE_TARGET, true); + DoCast(pTarget, SPELL_FEL_RAGE_2, true); + /* These spells do not work, comment them out for now. + DoCast(pTarget, SPELL_FEL_RAGE_2, true); + DoCast(pTarget, SPELL_FEL_RAGE_3, true);*/ + + //Cast this without triggered so that it appears in combat logs and shows visual. + DoCast(me, SPELL_FEL_RAGE_SELF); + + DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), me); + + AcidGeyserTimer = 1000; + PhaseChangeTimer = 30000; + } + } else // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage + { + if (TargetGUID) + RevertThreatOnTarget(TargetGUID); + TargetGUID = 0; + Phase1 = true; + BloodboilTimer = 10000; + BloodboilCount = 0; + AcidicWoundTimer += 2000; + ArcingSmashTimer += 2000; + FelAcidTimer += 2000; + EjectTimer += 2000; + PhaseChangeTimer = 60000; + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); + } + } else PhaseChangeTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_gurtogg_bloodboil(Creature* pCreature) -{ - return new boss_gurtogg_bloodboilAI (pCreature); -} void AddSC_boss_gurtogg_bloodboil() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gurtogg_bloodboil"; - newscript->GetAI = &GetAI_boss_gurtogg_bloodboil; - newscript->RegisterSelf(); + new boss_gurtogg_bloodboil(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 7b464639026..3ce2571de4d 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -363,1464 +363,1464 @@ static Animation DemonTransformation[]= #define EMOTE_SETS_GAZE_ON "sets its gaze on $N!" #define EMOTE_UNABLE_TO_SUMMON "is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter." - -/************************************** Illidan's AI ***************************************/ -struct boss_illidan_stormrageAI : public ScriptedAI + class mob_flame_of_azzinoth : public CreatureScript { - boss_illidan_stormrageAI(Creature* c) : ScriptedAI(c), Summons(me) - { - pInstance = c->GetInstanceData(); - DoCast(me, SPELL_DUAL_WIELD, true); +public: + mob_flame_of_azzinoth() : CreatureScript("mob_flame_of_azzinoth") { } - SpellEntry *TempSpell = GET_SPELL(SPELL_SHADOWFIEND_PASSIVE); - if (TempSpell) - TempSpell->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends + CreatureAI* GetAI(Creature* pCreature) const + { + return new flame_of_azzinothAI (pCreature); } - ScriptedInstance* pInstance; - - PhaseIllidan Phase; - EventIllidan Event; - uint32 Timer[EVENT_ENRAGE + 1]; - - uint32 TalkCount; - uint32 TransformCount; - uint32 FlightCount; - - uint32 HoverPoint; - - uint64 AkamaGUID; - uint64 MaievGUID; - uint64 FlameGUID[2]; - uint64 GlaiveGUID[2]; - - SummonList Summons; - - void Reset(); - - void JustSummoned(Creature* summon); - - void SummonedCreatureDespawn(Creature* summon) + struct flame_of_azzinothAI : public ScriptedAI { - if (summon->GetCreatureInfo()->Entry == FLAME_OF_AZZINOTH) - { - for (uint8 i = 0; i < 2; ++i) - if (summon->GetGUID() == FlameGUID[i]) - FlameGUID[i] = 0; + flame_of_azzinothAI(Creature *c) : ScriptedAI(c) {} - if (!FlameGUID[0] && !FlameGUID[1] && Phase != PHASE_ILLIDAN_NULL) + uint32 FlameBlastTimer; + uint32 CheckTimer; + uint64 GlaiveGUID; + + void Reset() + { + FlameBlastTimer = 15000; + CheckTimer = 5000; + GlaiveGUID = 0; + } + + void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} + + void ChargeCheck() + { + Unit *pTarget = SelectTarget(SELECT_TARGET_FARTHEST, 0, 200, false); + if (pTarget && (!me->IsWithinCombatRange(pTarget, FLAME_CHARGE_DISTANCE))) { - me->InterruptNonMeleeSpells(true); - EnterPhase(PHASE_FLIGHT_SEQUENCE); + me->AddThreat(pTarget, 5000000.0f); + AttackStart(pTarget); + DoCast(pTarget, SPELL_CHARGE); + me->MonsterTextEmote(EMOTE_SETS_GAZE_ON, pTarget->GetGUID()); } } - Summons.Despawn(summon); - } - void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) - { - if (FlightCount == 7) //change hover point + void EnrageCheck() { - if (me->getVictim()) + if (GETUNIT(Glaive, GlaiveGUID)) { - me->SetInFront(me->getVictim()); - me->StopMoving(); - } - EnterPhase(PHASE_FLIGHT); - } - else // handle flight sequence - Timer[EVENT_FLIGHT_SEQUENCE] = 1000; - } - - void EnterCombat(Unit * /*who*/) - { - me->setActive(true); - DoZoneInCombat(); - } - - void AttackStart(Unit *who) - { - if (!who || Phase >= PHASE_TALK_SEQUENCE) - return; - - if (Phase == PHASE_FLIGHT || Phase == PHASE_DEMON) - AttackStartNoMove(who); - else - ScriptedAI::AttackStart(who); - } - - void MoveInLineOfSight(Unit *) {} - - void JustDied(Unit * /*killer*/) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (!pInstance) - return; - - pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, DONE); // Completed - - for (uint8 i = DATA_GAMEOBJECT_ILLIDAN_DOOR_R; i < DATA_GAMEOBJECT_ILLIDAN_DOOR_L + 1; ++i) - pInstance->HandleGameObject(pInstance->GetData64(i), true); - } - - void KilledUnit(Unit * victim) - { - if (victim == me) return; - // TODO: Find better way to handle emote - switch (urand(0,1)) - { - case 0: - me->MonsterYell(SAY_KILL1, LANG_UNIVERSAL, victim->GetGUID()); - DoPlaySoundToSet(me, SOUND_KILL1); - break; - case 1: - me->MonsterYell(SAY_KILL2, LANG_UNIVERSAL, victim->GetGUID()); - DoPlaySoundToSet(me, SOUND_KILL2); - break; - } - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = 0; - if (done_by->GetGUID() == MaievGUID) - done_by->AddThreat(me, -(3*(float)damage)/4); // do not let maiev tank him - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_GLAIVE_RETURNS) // Re-equip our warblades! - { - if (!me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)) - SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - else - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - } - } - - void DeleteFromThreatList(uint64 TargetGUID) - { - for (std::list::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) - { - if ((*itr)->getUnitGuid() == TargetGUID) - { - (*itr)->removeReference(); - break; - } - } - } - - void Talk(uint32 count) - { - Timer[EVENT_TALK_SEQUENCE] = Conversation[count].timer; - - Creature* pCreature = NULL; - if (Conversation[count].pCreature == ILLIDAN_STORMRAGE) - pCreature = me; - else if (Conversation[count].pCreature == AKAMA) - pCreature = (Unit::GetCreature((*me), AkamaGUID)); - else if (Conversation[count].pCreature == MAIEV_SHADOWSONG) - pCreature = (Unit::GetCreature((*me), MaievGUID)); - - if (pCreature) - { - if (Conversation[count].emote) - pCreature->HandleEmoteCommand(Conversation[count].emote); // Make the Creature do some animation! - if (Conversation[count].text) - pCreature->MonsterYell(Conversation[count].text, LANG_UNIVERSAL, 0); // Have the Creature yell out some text - if (Conversation[count].sound) - DoPlaySoundToSet(pCreature, Conversation[count].sound); // Play some sound on the creature - } - } - - void EnterPhase(PhaseIllidan NextPhase); - void CastEyeBlast(); - void SummonFlamesOfAzzinoth(); - void SummonMaiev(); - void HandleTalkSequence(); - void HandleFlightSequence() - { - switch(FlightCount) - { - case 1://lift off - me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); - me->StopMoving(); - me->MonsterYell(SAY_TAKEOFF, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_TAKEOFF); - Timer[EVENT_FLIGHT_SEQUENCE] = 3000; - break; - case 2://move to center - me->GetMotionMaster()->MovePoint(0, CENTER_X + 5, CENTER_Y, CENTER_Z); //+5, for SPELL_THROW_GLAIVE bug - Timer[EVENT_FLIGHT_SEQUENCE] = 0; - break; - case 3://throw one glaive - { - uint8 i=1; - Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Glaive) + if (!me->IsWithinDistInMap(Glaive, FLAME_ENRAGE_DISTANCE)) { - GlaiveGUID[i] = Glaive->GetGUID(); - Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Glaive->SetDisplayId(11686); - Glaive->setFaction(me->getFaction()); - DoCast(Glaive, SPELL_THROW_GLAIVE2); - } - } - Timer[EVENT_FLIGHT_SEQUENCE] = 700; - break; - case 4://throw another - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - { - uint8 i=0; - Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Glaive) - { - GlaiveGUID[i] = Glaive->GetGUID(); - Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Glaive->SetDisplayId(11686); - Glaive->setFaction(me->getFaction()); - DoCast(Glaive, SPELL_THROW_GLAIVE, true); - } - } - Timer[EVENT_FLIGHT_SEQUENCE] = 5000; - break; - case 5://summon flames - SummonFlamesOfAzzinoth(); - Timer[EVENT_FLIGHT_SEQUENCE] = 3000; - break; - case 6://fly to hover point - me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); - Timer[EVENT_FLIGHT_SEQUENCE] = 0; - break; - case 7://return to center - me->GetMotionMaster()->MovePoint(0, CENTER_X, CENTER_Y, CENTER_Z); - Timer[EVENT_FLIGHT_SEQUENCE] = 0; - break; - case 8://glaive return - for (uint8 i = 0; i < 2; ++i) - { - if (GlaiveGUID[i]) - { - Unit* Glaive = Unit::GetUnit((*me), GlaiveGUID[i]); - if (Glaive) + Glaive->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_FLAME_ENRAGE, true); + DoResetThreat(); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget && pTarget->isAlive()) { - Glaive->CastSpell(me, SPELL_GLAIVE_RETURNS, false); // Make it look like the Glaive flies back up to us - Glaive->SetDisplayId(11686); // disappear but not die for now + me->AddThreat(me->getVictim(), 5000000.0f); + AttackStart(me->getVictim()); } } + else if (!me->HasAura(SPELL_AZZINOTH_CHANNEL)) + { + Glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false); + me->RemoveAurasDueToSpell(SPELL_FLAME_ENRAGE); + } } - Timer[EVENT_FLIGHT_SEQUENCE] = 2000; - break; - case 9://land - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->StopMoving(); - me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); - for (uint8 i = 0; i < 2; ++i) + } + + void SetGlaiveGUID(uint64 guid){ GlaiveGUID = guid; } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (FlameBlastTimer <= diff) { - if (GlaiveGUID[i]) - { - if (GETUNIT(Glaive, GlaiveGUID[i])) - { - Glaive->SetVisibility(VISIBILITY_OFF); - Glaive->setDeathState(JUST_DIED); // Despawn the Glaive - } - GlaiveGUID[i] = 0; - } - } - Timer[EVENT_FLIGHT_SEQUENCE] = 2000; - break; - case 10://attack - DoResetThreat(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - EnterPhase(PHASE_NORMAL_2); - break; - default: - break; - } - ++FlightCount; - } + DoCast(me->getVictim(), SPELL_BLAZE_SUMMON, true); //appear at victim + DoCast(me->getVictim(), SPELL_FLAME_BLAST); + FlameBlastTimer = 15000; //10000 is official-like? + DoZoneInCombat(); //in case someone is revived + } else FlameBlastTimer -= diff; - void HandleTransformSequence() - { - if (DemonTransformation[TransformCount].unaura) - me->RemoveAurasDueToSpell(DemonTransformation[TransformCount].unaura); - - if (DemonTransformation[TransformCount].aura) - DoCast(me, DemonTransformation[TransformCount].aura, true); - - if (DemonTransformation[TransformCount].displayid) - me->SetDisplayId(DemonTransformation[TransformCount].displayid); // It's morphin time! - - if (DemonTransformation[TransformCount].equip) - { - // Requip warglaives if needed - SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE); - me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); - } - else - { - // Unequip warglaives if needed - SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - } - - switch(TransformCount) - { - case 2: - DoResetThreat(); - break; - case 4: - EnterPhase(PHASE_DEMON); - break; - case 7: - DoResetThreat(); - break; - case 9: - if (MaievGUID) - EnterPhase(PHASE_NORMAL_MAIEV); // Depending on whether we summoned Maiev, we switch to either phase 5 or 3 - else - EnterPhase(PHASE_NORMAL_2); - break; - default: - break; - } - if (Phase == PHASE_TRANSFORM_SEQUENCE) - Timer[EVENT_TRANSFORM_SEQUENCE] = DemonTransformation[TransformCount].timer; - ++TransformCount; - } - - void UpdateAI(const uint32 diff) - { - if ((!UpdateVictim()) && Phase < PHASE_TALK_SEQUENCE) - return; - - Event = EVENT_NULL; - for (uint32 i = 1; i <= MaxTimer[Phase]; ++i) - { - if (Timer[i]) // Event is enabled - if (Timer[i] <= diff) - { - if (!Event) // No event with higher priority - Event = (EventIllidan)i; - } - else Timer[i] -= diff; - } - - switch(Phase) - { - case PHASE_NORMAL: - if (HPPCT(me) < 65) - EnterPhase(PHASE_FLIGHT_SEQUENCE); - break; - - case PHASE_NORMAL_2: - if (HPPCT(me) < 30) - EnterPhase(PHASE_TALK_SEQUENCE); - break; - - case PHASE_NORMAL_MAIEV: - if (HPPCT(me) < 1) - EnterPhase(PHASE_TALK_SEQUENCE); - break; - - case PHASE_TALK_SEQUENCE: - if (Event == EVENT_TALK_SEQUENCE) - HandleTalkSequence(); - break; - - case PHASE_FLIGHT_SEQUENCE: - if (Event == EVENT_FLIGHT_SEQUENCE) - HandleFlightSequence(); - break; - - case PHASE_TRANSFORM_SEQUENCE: - if (Event == EVENT_TRANSFORM_SEQUENCE) - HandleTransformSequence(); - break; - } - - if (me->IsNonMeleeSpellCasted(false)) - return; - - if (Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !me->HasAura(SPELL_CAGED)) - { - switch(Event) + if (CheckTimer <= diff) { - //PHASE_NORMAL - case EVENT_BERSERK: - me->MonsterYell(SAY_ENRAGE, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_ENRAGE); - DoCast(me, SPELL_BERSERK, true); - Timer[EVENT_BERSERK] = 5000;//The buff actually lasts forever. - break; + ChargeCheck(); + EnrageCheck(); + CheckTimer = 1000; + } else CheckTimer -= diff; - case EVENT_TAUNT: - { - uint32 random = rand()%4; - char* yell = RandomTaunts[random].text; - uint32 soundid = RandomTaunts[random].sound; - if (yell) - me->MonsterYell(yell, LANG_UNIVERSAL, 0); - if (soundid) - DoPlaySoundToSet(me, soundid); - } - Timer[EVENT_TAUNT] = 25000 + rand()%10000; - break; - - case EVENT_SHEAR: - // no longer exists in 3.0.2 - //DoCast(me->getVictim(), SPELL_SHEAR); - Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000); - break; - - case EVENT_FLAME_CRASH: - DoCast(me->getVictim(), SPELL_FLAME_CRASH); - Timer[EVENT_FLAME_CRASH] = 30000 + rand()%10000; - break; - - case EVENT_PARASITIC_SHADOWFIEND: - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true)) - DoCast(pTarget, SPELL_PARASITIC_SHADOWFIEND, true); - Timer[EVENT_PARASITIC_SHADOWFIEND] = 35000 + rand()%10000; - } - break; - - case EVENT_PARASITE_CHECK: - Timer[EVENT_PARASITE_CHECK] = 0; - break; - - case EVENT_DRAW_SOUL: - DoCast(me->getVictim(), SPELL_DRAW_SOUL); - Timer[EVENT_DRAW_SOUL] = 50000 + rand()%10000; - break; - - //PHASE_NORMAL_2 - case EVENT_AGONIZING_FLAMES: - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AGONIZING_FLAMES); - Timer[EVENT_AGONIZING_FLAMES] = 0; - break; - - case EVENT_TRANSFORM_NORMAL: - EnterPhase(PHASE_TRANSFORM_SEQUENCE); - break; - - //PHASE_NORMAL_MAIEV - case EVENT_ENRAGE: - DoCast(me, SPELL_ENRAGE); - Timer[EVENT_ENRAGE] = 0; - break; - - default: - break; - } DoMeleeAttackIfReady(); } + }; - if (Phase == PHASE_FLIGHT) - { - switch(Event) - { - case EVENT_FIREBALL: - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); - Timer[EVENT_FIREBALL] = 3000; - break; +}; - case EVENT_DARK_BARRAGE: - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DARK_BARRAGE); - Timer[EVENT_DARK_BARRAGE] = 0; - break; +/************************************** Illidan's AI ***************************************/ class boss_illidan_stormrage : public CreatureScript +{ +public: + boss_illidan_stormrage() : CreatureScript("boss_illidan_stormrage") { } - case EVENT_EYE_BLAST: - CastEyeBlast(); - Timer[EVENT_EYE_BLAST] = 0; - break; - - case EVENT_MOVE_POINT: - Phase = PHASE_FLIGHT_SEQUENCE; - Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point - HoverPoint += (rand()%3 + 1); - if (HoverPoint > 3) - HoverPoint -= 4; - me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); - break; - - default: - break; - } - } - - if (Phase == PHASE_DEMON) - { - switch(Event) - { - case EVENT_SHADOW_BLAST: - me->GetMotionMaster()->Clear(false); - if (!me->IsWithinDistInMap(me->getVictim(), 50)||!me->IsWithinLOSInMap(me->getVictim())) - me->GetMotionMaster()->MoveChase(me->getVictim(), 30); - else - me->GetMotionMaster()->MoveIdle(); - DoCast(me->getVictim(), SPELL_SHADOW_BLAST); - Timer[EVENT_SHADOW_BLAST] = 4000; - break; - case EVENT_SHADOWDEMON: - DoCast(me, SPELL_SUMMON_SHADOWDEMON); - Timer[EVENT_SHADOWDEMON] = 0; - Timer[EVENT_FLAME_BURST] += 10000; - break; - case EVENT_FLAME_BURST: - DoCast(me, SPELL_FLAME_BURST); - Timer[EVENT_FLAME_BURST] = 15000; - break; - case EVENT_TRANSFORM_DEMON: - EnterPhase(PHASE_TRANSFORM_SEQUENCE); - break; - default: - break; - } - } + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_illidan_stormrageAI (pCreature); } + + struct boss_illidan_stormrageAI : public ScriptedAI + { + boss_illidan_stormrageAI(Creature* c) : ScriptedAI(c), Summons(me) + { + pInstance = c->GetInstanceScript(); + DoCast(me, SPELL_DUAL_WIELD, true); + + SpellEntry *TempSpell = GET_SPELL(SPELL_SHADOWFIEND_PASSIVE); + if (TempSpell) + TempSpell->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends + } + + InstanceScript* pInstance; + + PhaseIllidan Phase; + EventIllidan Event; + uint32 Timer[EVENT_ENRAGE + 1]; + + uint32 TalkCount; + uint32 TransformCount; + uint32 FlightCount; + + uint32 HoverPoint; + + uint64 AkamaGUID; + uint64 MaievGUID; + uint64 FlameGUID[2]; + uint64 GlaiveGUID[2]; + + SummonList Summons; + + void Reset(); + + void JustSummoned(Creature* summon); + + void SummonedCreatureDespawn(Creature* summon) + { + if (summon->GetCreatureInfo()->Entry == FLAME_OF_AZZINOTH) + { + for (uint8 i = 0; i < 2; ++i) + if (summon->GetGUID() == FlameGUID[i]) + FlameGUID[i] = 0; + + if (!FlameGUID[0] && !FlameGUID[1] && Phase != PHASE_ILLIDAN_NULL) + { + me->InterruptNonMeleeSpells(true); + EnterPhase(PHASE_FLIGHT_SEQUENCE); + } + } + Summons.Despawn(summon); + } + + void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) + { + if (FlightCount == 7) //change hover point + { + if (me->getVictim()) + { + me->SetInFront(me->getVictim()); + me->StopMoving(); + } + EnterPhase(PHASE_FLIGHT); + } + else // handle flight sequence + Timer[EVENT_FLIGHT_SEQUENCE] = 1000; + } + + void EnterCombat(Unit * /*who*/) + { + me->setActive(true); + DoZoneInCombat(); + } + + void AttackStart(Unit *who) + { + if (!who || Phase >= PHASE_TALK_SEQUENCE) + return; + + if (Phase == PHASE_FLIGHT || Phase == PHASE_DEMON) + AttackStartNoMove(who); + else + ScriptedAI::AttackStart(who); + } + + void MoveInLineOfSight(Unit *) {} + + void JustDied(Unit * /*killer*/) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (!pInstance) + return; + + pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, DONE); // Completed + + for (uint8 i = DATA_GAMEOBJECT_ILLIDAN_DOOR_R; i < DATA_GAMEOBJECT_ILLIDAN_DOOR_L + 1; ++i) + pInstance->HandleGameObject(pInstance->GetData64(i), true); + } + + void KilledUnit(Unit * victim) + { + if (victim == me) return; + // TODO: Find better way to handle emote + switch (urand(0,1)) + { + case 0: + me->MonsterYell(SAY_KILL1, LANG_UNIVERSAL, victim->GetGUID()); + DoPlaySoundToSet(me, SOUND_KILL1); + break; + case 1: + me->MonsterYell(SAY_KILL2, LANG_UNIVERSAL, victim->GetGUID()); + DoPlaySoundToSet(me, SOUND_KILL2); + break; + } + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage >= me->GetHealth() && done_by != me) + damage = 0; + if (done_by->GetGUID() == MaievGUID) + done_by->AddThreat(me, -(3*(float)damage)/4); // do not let maiev tank him + } + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_GLAIVE_RETURNS) // Re-equip our warblades! + { + if (!me->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)) + SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + else + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + } + } + + void DeleteFromThreatList(uint64 TargetGUID) + { + for (std::list::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + { + if ((*itr)->getUnitGuid() == TargetGUID) + { + (*itr)->removeReference(); + break; + } + } + } + + void Talk(uint32 count) + { + Timer[EVENT_TALK_SEQUENCE] = Conversation[count].timer; + + Creature* pCreature = NULL; + if (Conversation[count].pCreature == ILLIDAN_STORMRAGE) + pCreature = me; + else if (Conversation[count].pCreature == AKAMA) + pCreature = (Unit::GetCreature((*me), AkamaGUID)); + else if (Conversation[count].pCreature == MAIEV_SHADOWSONG) + pCreature = (Unit::GetCreature((*me), MaievGUID)); + + if (pCreature) + { + if (Conversation[count].emote) + pCreature->HandleEmoteCommand(Conversation[count].emote); // Make the Creature do some animation! + if (Conversation[count].text) + pCreature->MonsterYell(Conversation[count].text, LANG_UNIVERSAL, 0); // Have the Creature yell out some text + if (Conversation[count].sound) + DoPlaySoundToSet(pCreature, Conversation[count].sound); // Play some sound on the creature + } + } + + void EnterPhase(PhaseIllidan NextPhase) + { + DoZoneInCombat(); + switch(NextPhase) + { + case PHASE_NORMAL: + case PHASE_NORMAL_2: + case PHASE_NORMAL_MAIEV: + AttackStart(me->getVictim()); + Timer[EVENT_TAUNT] = 32000; + Timer[EVENT_SHEAR] = 10000 + rand()%15 * 1000; + Timer[EVENT_FLAME_CRASH] = 20000; + Timer[EVENT_PARASITIC_SHADOWFIEND] = 25000; + Timer[EVENT_PARASITE_CHECK] = 0; + Timer[EVENT_DRAW_SOUL] = 30000; + if (NextPhase == PHASE_NORMAL) + break; + Timer[EVENT_AGONIZING_FLAMES] = 35000; + Timer[EVENT_TRANSFORM_NORMAL] = 60000; + if (NextPhase == PHASE_NORMAL_2) + break; + Timer[EVENT_ENRAGE] = 30000 + rand()%10 * 1000; + break; + case PHASE_FLIGHT: + Timer[EVENT_FIREBALL] = 1000; + if (!(rand()%4)) + Timer[EVENT_DARK_BARRAGE] = 10000; + Timer[EVENT_EYE_BLAST] = 10000 + rand()%15 * 1000; + Timer[EVENT_MOVE_POINT] = 20000 + rand()%20 * 1000; + break; + case PHASE_DEMON: + Timer[EVENT_SHADOW_BLAST] = 1000; + Timer[EVENT_FLAME_BURST] = 10000; + Timer[EVENT_SHADOWDEMON] = 30000; + Timer[EVENT_TRANSFORM_DEMON] = 60000; + AttackStart(me->getVictim()); + break; + case PHASE_TALK_SEQUENCE: + Timer[EVENT_TALK_SEQUENCE] = 100; + me->RemoveAllAuras(); + me->InterruptNonMeleeSpells(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(false); + me->AttackStop(); + break; + case PHASE_FLIGHT_SEQUENCE: + if (Phase == PHASE_NORMAL) //lift off + { + FlightCount = 1; + Timer[EVENT_FLIGHT_SEQUENCE] = 1; + me->RemoveAllAuras(); + me->InterruptNonMeleeSpells(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->Clear(false); + me->AttackStop(); + } + else //land + Timer[EVENT_FLIGHT_SEQUENCE] = 2000; + break; + case PHASE_TRANSFORM_SEQUENCE: + if (Phase == PHASE_DEMON) + Timer[EVENT_TRANSFORM_SEQUENCE] = 500; + else + { + TransformCount = 0; + Timer[EVENT_TRANSFORM_SEQUENCE] = 500; + me->MonsterYell(SAY_MORPH, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_MORPH); + } + me->GetMotionMaster()->Clear(); + me->AttackStop(); + break; + default: + break; + } + if (MaievGUID) + { + GETCRE(Maiev, MaievGUID); + if (Maiev && Maiev->isAlive()) + Maiev->AI()->DoAction(NextPhase); + } + Phase = NextPhase; + Event = EVENT_NULL; + } + void CastEyeBlast() + { + me->InterruptNonMeleeSpells(false); + + me->MonsterYell(SAY_EYE_BLAST, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_EYE_BLAST); + + float distx, disty, dist[2]; + for (uint8 i = 0; i < 2; ++i) + { + distx = EyeBlast[i].x - HoverPosition[HoverPoint].x; + disty = EyeBlast[i].y - HoverPosition[HoverPoint].y; + dist[i] = distx * distx + disty * disty; + } + Locations initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; + for (uint8 i = 0; i < 2; ++i) + { + distx = GlaivePosition[i].x - HoverPosition[HoverPoint].x; + disty = GlaivePosition[i].y - HoverPosition[HoverPoint].y; + dist[i] = distx * distx + disty * disty; + } + Locations final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; + + final.x = 2 * final.x - initial.x; + final.y = 2 * final.y - initial.y; + + Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); + if (!Trigger) return; + + Trigger->SetSpeed(MOVE_WALK, 3); + Trigger->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); + + //Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); + DoCast(Trigger, SPELL_EYE_BLAST); + } + void SummonFlamesOfAzzinoth() + { + me->MonsterYell(SAY_SUMMONFLAMES, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_SUMMONFLAMES); + + for (uint8 i = 0; i < 2; ++i) + { + if (GETUNIT(Glaive, GlaiveGUID[i])) + { + Creature* Flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + if (Flame) + { + Flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction + Flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); + FlameGUID[i] = Flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase + CAST_AI(mob_flame_of_azzinoth::flame_of_azzinothAI, Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); + Glaive->CastSpell(Flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it. + } + } + } + } + void SummonMaiev() + { + DoCast(me, SPELL_SHADOW_PRISON, true); + DoCast(me, 40403, true); + if (!MaievGUID) // If Maiev cannot be summoned, reset the encounter and post some errors to the console. + { + EnterEvadeMode(); + me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0); + sLog.outError("SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); + } + } + + void HandleTalkSequence(); + + void HandleFlightSequence() + { + switch(FlightCount) + { + case 1://lift off + me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); + me->StopMoving(); + me->MonsterYell(SAY_TAKEOFF, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_TAKEOFF); + Timer[EVENT_FLIGHT_SEQUENCE] = 3000; + break; + case 2://move to center + me->GetMotionMaster()->MovePoint(0, CENTER_X + 5, CENTER_Y, CENTER_Z); //+5, for SPELL_THROW_GLAIVE bug + Timer[EVENT_FLIGHT_SEQUENCE] = 0; + break; + case 3://throw one glaive + { + uint8 i=1; + Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Glaive) + { + GlaiveGUID[i] = Glaive->GetGUID(); + Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Glaive->SetDisplayId(11686); + Glaive->setFaction(me->getFaction()); + DoCast(Glaive, SPELL_THROW_GLAIVE2); + } + } + Timer[EVENT_FLIGHT_SEQUENCE] = 700; + break; + case 4://throw another + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + { + uint8 i=0; + Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Glaive) + { + GlaiveGUID[i] = Glaive->GetGUID(); + Glaive->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Glaive->SetDisplayId(11686); + Glaive->setFaction(me->getFaction()); + DoCast(Glaive, SPELL_THROW_GLAIVE, true); + } + } + Timer[EVENT_FLIGHT_SEQUENCE] = 5000; + break; + case 5://summon flames + SummonFlamesOfAzzinoth(); + Timer[EVENT_FLIGHT_SEQUENCE] = 3000; + break; + case 6://fly to hover point + me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); + Timer[EVENT_FLIGHT_SEQUENCE] = 0; + break; + case 7://return to center + me->GetMotionMaster()->MovePoint(0, CENTER_X, CENTER_Y, CENTER_Z); + Timer[EVENT_FLIGHT_SEQUENCE] = 0; + break; + case 8://glaive return + for (uint8 i = 0; i < 2; ++i) + { + if (GlaiveGUID[i]) + { + Unit* Glaive = Unit::GetUnit((*me), GlaiveGUID[i]); + if (Glaive) + { + Glaive->CastSpell(me, SPELL_GLAIVE_RETURNS, false); // Make it look like the Glaive flies back up to us + Glaive->SetDisplayId(11686); // disappear but not die for now + } + } + } + Timer[EVENT_FLIGHT_SEQUENCE] = 2000; + break; + case 9://land + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->StopMoving(); + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + for (uint8 i = 0; i < 2; ++i) + { + if (GlaiveGUID[i]) + { + if (GETUNIT(Glaive, GlaiveGUID[i])) + { + Glaive->SetVisibility(VISIBILITY_OFF); + Glaive->setDeathState(JUST_DIED); // Despawn the Glaive + } + GlaiveGUID[i] = 0; + } + } + Timer[EVENT_FLIGHT_SEQUENCE] = 2000; + break; + case 10://attack + DoResetThreat(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + EnterPhase(PHASE_NORMAL_2); + break; + default: + break; + } + ++FlightCount; + } + + void HandleTransformSequence() + { + if (DemonTransformation[TransformCount].unaura) + me->RemoveAurasDueToSpell(DemonTransformation[TransformCount].unaura); + + if (DemonTransformation[TransformCount].aura) + DoCast(me, DemonTransformation[TransformCount].aura, true); + + if (DemonTransformation[TransformCount].displayid) + me->SetDisplayId(DemonTransformation[TransformCount].displayid); // It's morphin time! + + if (DemonTransformation[TransformCount].equip) + { + // Requip warglaives if needed + SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_ID_OFF_HAND, EQUIP_NO_CHANGE); + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + } + else + { + // Unequip warglaives if needed + SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + } + + switch(TransformCount) + { + case 2: + DoResetThreat(); + break; + case 4: + EnterPhase(PHASE_DEMON); + break; + case 7: + DoResetThreat(); + break; + case 9: + if (MaievGUID) + EnterPhase(PHASE_NORMAL_MAIEV); // Depending on whether we summoned Maiev, we switch to either phase 5 or 3 + else + EnterPhase(PHASE_NORMAL_2); + break; + default: + break; + } + if (Phase == PHASE_TRANSFORM_SEQUENCE) + Timer[EVENT_TRANSFORM_SEQUENCE] = DemonTransformation[TransformCount].timer; + ++TransformCount; + } + + void UpdateAI(const uint32 diff) + { + if ((!UpdateVictim()) && Phase < PHASE_TALK_SEQUENCE) + return; + + Event = EVENT_NULL; + for (uint32 i = 1; i <= MaxTimer[Phase]; ++i) + { + if (Timer[i]) // Event is enabled + if (Timer[i] <= diff) + { + if (!Event) // No event with higher priority + Event = (EventIllidan)i; + } + else Timer[i] -= diff; + } + + switch(Phase) + { + case PHASE_NORMAL: + if (HPPCT(me) < 65) + EnterPhase(PHASE_FLIGHT_SEQUENCE); + break; + + case PHASE_NORMAL_2: + if (HPPCT(me) < 30) + EnterPhase(PHASE_TALK_SEQUENCE); + break; + + case PHASE_NORMAL_MAIEV: + if (HPPCT(me) < 1) + EnterPhase(PHASE_TALK_SEQUENCE); + break; + + case PHASE_TALK_SEQUENCE: + if (Event == EVENT_TALK_SEQUENCE) + HandleTalkSequence(); + break; + + case PHASE_FLIGHT_SEQUENCE: + if (Event == EVENT_FLIGHT_SEQUENCE) + HandleFlightSequence(); + break; + + case PHASE_TRANSFORM_SEQUENCE: + if (Event == EVENT_TRANSFORM_SEQUENCE) + HandleTransformSequence(); + break; + } + + if (me->IsNonMeleeSpellCasted(false)) + return; + + if (Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !me->HasAura(SPELL_CAGED)) + { + switch(Event) + { + //PHASE_NORMAL + case EVENT_BERSERK: + me->MonsterYell(SAY_ENRAGE, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_ENRAGE); + DoCast(me, SPELL_BERSERK, true); + Timer[EVENT_BERSERK] = 5000;//The buff actually lasts forever. + break; + + case EVENT_TAUNT: + { + uint32 random = rand()%4; + char* yell = RandomTaunts[random].text; + uint32 soundid = RandomTaunts[random].sound; + if (yell) + me->MonsterYell(yell, LANG_UNIVERSAL, 0); + if (soundid) + DoPlaySoundToSet(me, soundid); + } + Timer[EVENT_TAUNT] = 25000 + rand()%10000; + break; + + case EVENT_SHEAR: + // no longer exists in 3.0.2 + //DoCast(me->getVictim(), SPELL_SHEAR); + Timer[EVENT_SHEAR] = 25000 + (rand()%16 * 1000); + break; + + case EVENT_FLAME_CRASH: + DoCast(me->getVictim(), SPELL_FLAME_CRASH); + Timer[EVENT_FLAME_CRASH] = 30000 + rand()%10000; + break; + + case EVENT_PARASITIC_SHADOWFIEND: + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true)) + DoCast(pTarget, SPELL_PARASITIC_SHADOWFIEND, true); + Timer[EVENT_PARASITIC_SHADOWFIEND] = 35000 + rand()%10000; + } + break; + + case EVENT_PARASITE_CHECK: + Timer[EVENT_PARASITE_CHECK] = 0; + break; + + case EVENT_DRAW_SOUL: + DoCast(me->getVictim(), SPELL_DRAW_SOUL); + Timer[EVENT_DRAW_SOUL] = 50000 + rand()%10000; + break; + + //PHASE_NORMAL_2 + case EVENT_AGONIZING_FLAMES: + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AGONIZING_FLAMES); + Timer[EVENT_AGONIZING_FLAMES] = 0; + break; + + case EVENT_TRANSFORM_NORMAL: + EnterPhase(PHASE_TRANSFORM_SEQUENCE); + break; + + //PHASE_NORMAL_MAIEV + case EVENT_ENRAGE: + DoCast(me, SPELL_ENRAGE); + Timer[EVENT_ENRAGE] = 0; + break; + + default: + break; + } + DoMeleeAttackIfReady(); + } + + if (Phase == PHASE_FLIGHT) + { + switch(Event) + { + case EVENT_FIREBALL: + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FIREBALL); + Timer[EVENT_FIREBALL] = 3000; + break; + + case EVENT_DARK_BARRAGE: + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_DARK_BARRAGE); + Timer[EVENT_DARK_BARRAGE] = 0; + break; + + case EVENT_EYE_BLAST: + CastEyeBlast(); + Timer[EVENT_EYE_BLAST] = 0; + break; + + case EVENT_MOVE_POINT: + Phase = PHASE_FLIGHT_SEQUENCE; + Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point + HoverPoint += (rand()%3 + 1); + if (HoverPoint > 3) + HoverPoint -= 4; + me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); + break; + + default: + break; + } + } + + if (Phase == PHASE_DEMON) + { + switch(Event) + { + case EVENT_SHADOW_BLAST: + me->GetMotionMaster()->Clear(false); + if (!me->IsWithinDistInMap(me->getVictim(), 50)||!me->IsWithinLOSInMap(me->getVictim())) + me->GetMotionMaster()->MoveChase(me->getVictim(), 30); + else + me->GetMotionMaster()->MoveIdle(); + DoCast(me->getVictim(), SPELL_SHADOW_BLAST); + Timer[EVENT_SHADOW_BLAST] = 4000; + break; + case EVENT_SHADOWDEMON: + DoCast(me, SPELL_SUMMON_SHADOWDEMON); + Timer[EVENT_SHADOWDEMON] = 0; + Timer[EVENT_FLAME_BURST] += 10000; + break; + case EVENT_FLAME_BURST: + DoCast(me, SPELL_FLAME_BURST); + Timer[EVENT_FLAME_BURST] = 15000; + break; + case EVENT_TRANSFORM_DEMON: + EnterPhase(PHASE_TRANSFORM_SEQUENCE); + break; + default: + break; + } + } + } + }; + }; /********************************** End of Illidan AI ******************************************/ -struct flame_of_azzinothAI : public ScriptedAI -{ - flame_of_azzinothAI(Creature *c) : ScriptedAI(c) {} - - uint32 FlameBlastTimer; - uint32 CheckTimer; - uint64 GlaiveGUID; - - void Reset() - { - FlameBlastTimer = 15000; - CheckTimer = 5000; - GlaiveGUID = 0; - } - - void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} - - void ChargeCheck() - { - Unit *pTarget = SelectTarget(SELECT_TARGET_FARTHEST, 0, 200, false); - if (pTarget && (!me->IsWithinCombatRange(pTarget, FLAME_CHARGE_DISTANCE))) - { - me->AddThreat(pTarget, 5000000.0f); - AttackStart(pTarget); - DoCast(pTarget, SPELL_CHARGE); - me->MonsterTextEmote(EMOTE_SETS_GAZE_ON, pTarget->GetGUID()); - } - } - - void EnrageCheck() - { - if (GETUNIT(Glaive, GlaiveGUID)) - { - if (!me->IsWithinDistInMap(Glaive, FLAME_ENRAGE_DISTANCE)) - { - Glaive->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_FLAME_ENRAGE, true); - DoResetThreat(); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget && pTarget->isAlive()) - { - me->AddThreat(me->getVictim(), 5000000.0f); - AttackStart(me->getVictim()); - } - } - else if (!me->HasAura(SPELL_AZZINOTH_CHANNEL)) - { - Glaive->CastSpell(me, SPELL_AZZINOTH_CHANNEL, false); - me->RemoveAurasDueToSpell(SPELL_FLAME_ENRAGE); - } - } - } - - void SetGlaiveGUID(uint64 guid){ GlaiveGUID = guid; } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (FlameBlastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BLAZE_SUMMON, true); //appear at victim - DoCast(me->getVictim(), SPELL_FLAME_BLAST); - FlameBlastTimer = 15000; //10000 is official-like? - DoZoneInCombat(); //in case someone is revived - } else FlameBlastTimer -= diff; - - if (CheckTimer <= diff) - { - ChargeCheck(); - EnrageCheck(); - CheckTimer = 1000; - } else CheckTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - /******* Functions and vars for Akama's AI ******/ -struct npc_akama_illidanAI : public ScriptedAI +class boss_maiev_shadowsong : public CreatureScript { - npc_akama_illidanAI(Creature* c) : ScriptedAI(c) +public: + boss_maiev_shadowsong() : CreatureScript("boss_maiev_shadowsong") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - JustCreated = true; + return new boss_maievAI (pCreature); } - bool JustCreated; - ScriptedInstance* pInstance; - PhaseAkama Phase; - bool Event; - uint32 Timer; - - uint64 IllidanGUID; - uint64 ChannelGUID; - uint64 SpiritGUID[2]; - uint64 GateGUID; - uint64 DoorGUID[2]; - - uint32 ChannelCount; - uint32 WalkCount; - uint32 TalkCount; - uint32 Check_Timer; - - void Reset() + struct boss_maievAI : public ScriptedAI { - WalkCount = 0; - if (pInstance) + boss_maievAI(Creature *c) : ScriptedAI(c) {}; + + uint64 IllidanGUID; + + PhaseIllidan Phase; + EventMaiev Event; + uint32 Timer[5]; + uint32 MaxTimer; + + void Reset() { - pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED); - - IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); - GateGUID = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE); - DoorGUID[0] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R); - DoorGUID[1] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L); - - if (JustCreated)//close all doors at create - { - pInstance->HandleGameObject(GateGUID, false); - - for (uint8 i = 0; i < 2; ++i) - pInstance->HandleGameObject(DoorGUID[i], false); - //JustCreated = false; - }else - {//open all doors, raid wiped - pInstance->HandleGameObject(GateGUID, true); - WalkCount = 1;//skip first wp - for (uint8 i = 0; i < 2; ++i) - pInstance->HandleGameObject(DoorGUID[i], true); - } - } - else - { - IllidanGUID = 0; - GateGUID = 0; - DoorGUID[0] = 0; - DoorGUID[1] = 0; - } - - ChannelGUID = 0; - SpiritGUID[0] = 0; - SpiritGUID[1] = 0; - - Phase = PHASE_AKAMA_NULL; - Timer = 0; - - ChannelCount = 0; - TalkCount = 0; - Check_Timer = 5000; - - KillAllElites(); - - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has strange values.. - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - me->setActive(false); - me->SetVisibility(VISIBILITY_OFF); - } - - // Do not call reset in Akama's evade mode, as this will stop him from summoning minions after he kills the first bit - void EnterEvadeMode() - { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - } - - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void MovementInform(uint32 MovementType, uint32 /*Data*/) - { - if (MovementType == POINT_MOTION_TYPE) - Timer = 1; - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage > me->GetHealth() || done_by->GetGUID() != IllidanGUID) - damage = 0; - } - - void KillAllElites() - { - std::list& threatList = me->getThreatManager().getThreatList(); - std::vector eliteList; - for (std::list::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) - eliteList.push_back(pUnit); - } - for (std::vector::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) - (*itr)->setDeathState(JUST_DIED); - EnterEvadeMode(); - } - - void BeginTalk() - { - if (!pInstance) - return; - - pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS); - for (uint8 i = 0; i < 2; ++i) - pInstance->HandleGameObject(DoorGUID[i], false); - if (GETCRE(Illidan, IllidanGUID)) - { - Illidan->RemoveAurasDueToSpell(SPELL_KNEEL); - me->SetInFront(Illidan); - Illidan->SetInFront(me); - me->GetMotionMaster()->MoveIdle(); - Illidan->GetMotionMaster()->MoveIdle(); - CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->AkamaGUID = me->GetGUID(); - CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); - } - } - - void BeginChannel() - { - me->setActive(true); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - if (!JustCreated) - return; - float x, y, z; - if (GETGO(Gate, GateGUID)) - Gate->GetPosition(x, y, z); - else - return;//if door not spawned, don't crash server - - if (Creature* Channel = me->SummonCreature(ILLIDAN_DOOR_TRIGGER, x, y, z+5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) - { - ChannelGUID = Channel->GetGUID(); - Channel->SetDisplayId(11686); // Invisible but spell visuals can still be seen. - DoCast(Channel, SPELL_AKAMA_DOOR_FAIL); - } - - for (uint8 i = 0; i < 2; ++i) - if (Creature* Spirit = me->SummonCreature(i ? SPIRIT_OF_OLUM : SPIRIT_OF_UDALO, SpiritSpawns[i].x, SpiritSpawns[i].y, SpiritSpawns[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) - { - Spirit->SetVisibility(VISIBILITY_OFF); - SpiritGUID[i] = Spirit->GetGUID(); - } - } - - void BeginWalk() - { - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->SetSpeed(MOVE_RUN, 1.0f); - me->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); - } - - void EnterPhase(PhaseAkama NextPhase) - { - if (!pInstance) - return; - switch(NextPhase) - { - case PHASE_CHANNEL: - BeginChannel(); - Timer = 5000; - ChannelCount = 0; - break; - case PHASE_WALK: - if (Phase == PHASE_CHANNEL) - WalkCount = 0; - else if (Phase == PHASE_TALK) - { - if (GETCRE(Illidan, IllidanGUID)) - CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); - EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - ++WalkCount; - } - JustCreated = false; - BeginWalk(); - Timer = 0; - break; - case PHASE_TALK: - if (Phase == PHASE_WALK) - { - BeginTalk(); - Timer = 0; - } - else if (Phase == PHASE_FIGHT_ILLIDAN) - { - Timer = 1; - TalkCount = 0; - } - break; - case PHASE_FIGHT_ILLIDAN: - if (GETUNIT(Illidan, IllidanGUID)) - { - me->AddThreat(Illidan, 10000000.0f); - me->GetMotionMaster()->MoveChase(Illidan); - } - Timer = 30000; //chain lightning - break; - case PHASE_FIGHT_MINIONS: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - Timer = 10000 + rand()%6000;//summon minion - break; - case PHASE_RETURN: - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - KillAllElites(); - WalkCount = 0; - BeginWalk(); - Timer = 1; - break; - default: - break; - } - Phase = NextPhase; - Event = false; - } - - void HandleTalkSequence() - { - switch(TalkCount) - { - case 0: - if (GETCRE(Illidan, IllidanGUID)) - { - CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->Timer[EVENT_TAUNT] += 30000; - Illidan->MonsterYell(SAY_AKAMA_MINION, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(Illidan, SOUND_AKAMA_MINION); - } - Timer = 8000; - break; - case 1: - me->MonsterYell(SAY_AKAMA_LEAVE, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_AKAMA_LEAVE); - Timer = 3000; - break; - case 2: - EnterPhase(PHASE_WALK); - break; - } - ++TalkCount; - } - - void HandleChannelSequence() - { - Unit* Channel = NULL, *Spirit[2]; - if (ChannelCount <= 5) - { - Channel = Unit::GetUnit((*me), ChannelGUID); - Spirit[0] = Unit::GetUnit((*me), SpiritGUID[0]); - Spirit[1] = Unit::GetUnit((*me), SpiritGUID[1]); - if (!Channel || !Spirit[0] || !Spirit[1]) - return; - } - - switch(ChannelCount) - { - case 0: // channel failed - me->InterruptNonMeleeSpells(true); - Timer = 2000; - break; - case 1: // spirit appear - Spirit[0]->SetVisibility(VISIBILITY_ON); - Spirit[1]->SetVisibility(VISIBILITY_ON); - Timer = 2000; - break; - case 2: // spirit help - DoCast(Channel, SPELL_AKAMA_DOOR_CHANNEL); - Spirit[0]->CastSpell(Channel, SPELL_DEATHSWORN_DOOR_CHANNEL,false); - Spirit[1]->CastSpell(Channel, SPELL_DEATHSWORN_DOOR_CHANNEL,false); - Timer = 5000; - break; - case 3: //open the gate - me->InterruptNonMeleeSpells(true); - Spirit[0]->InterruptNonMeleeSpells(true); - Spirit[1]->InterruptNonMeleeSpells(true); - if (pInstance) - pInstance->HandleGameObject(GateGUID, true); - Timer = 2000; - break; - case 4: - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - Timer = 2000; - break; - case 5: - me->MonsterYell(SAY_AKAMA_BEWARE, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_AKAMA_BEWARE); - Channel->setDeathState(JUST_DIED); - Spirit[0]->SetVisibility(VISIBILITY_OFF); - Spirit[1]->SetVisibility(VISIBILITY_OFF); - Timer = 3000; - break; - case 6: - EnterPhase(PHASE_WALK); - break; - default: - break; - } - ++ChannelCount; - } - - void HandleWalkSequence() - { - switch(WalkCount) - { - case 6: - for (uint8 i = 0; i < 2; ++i) - if (pInstance) - pInstance->HandleGameObject(DoorGUID[i], true); - break; - case 8: - if (Phase == PHASE_WALK) - EnterPhase(PHASE_TALK); - else - EnterPhase(PHASE_FIGHT_ILLIDAN); - break; - case 12: - EnterPhase(PHASE_FIGHT_MINIONS); - break; - } - - if (Phase == PHASE_WALK) - { - Timer = 0; - ++WalkCount; - me->GetMotionMaster()->MovePoint(WalkCount, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); - } - } - - void UpdateAI(const uint32 diff) - { - if (me->GetVisibility() == VISIBILITY_OFF) - { - if (Check_Timer <= diff) - { - if (pInstance && pInstance->GetData(DATA_ILLIDARICOUNCILEVENT) == DONE) - me->SetVisibility(VISIBILITY_ON); - - Check_Timer = 5000; - } else Check_Timer -= diff; - } - Event = false; - if (Timer) - { - if (Timer <= diff) - Event = true; - else Timer -= diff; - } - - if (Event) - { - switch(Phase) - { - case PHASE_CHANNEL: - if (JustCreated) - HandleChannelSequence(); - else{ - EnterPhase(PHASE_WALK); - } - break; - case PHASE_TALK: - HandleTalkSequence(); - break; - case PHASE_WALK: - case PHASE_RETURN: - HandleWalkSequence(); - break; - case PHASE_FIGHT_ILLIDAN: - { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && HPPCT(Illidan) < 90) - EnterPhase(PHASE_TALK); - else - { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - Timer = 30000; - } - } - break; - case PHASE_FIGHT_MINIONS: - { - float x, y, z; - me->GetPosition(x, y, z); - Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); - //Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x, y, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); - if (Elite) - { - Elite->AI()->AttackStart(me); - Elite->AddThreat(me, 1000000.0f); - AttackStart(Elite); - me->AddThreat(Elite, 1000000.0f); - } - Timer = 10000 + rand()%6000; - GETUNIT(Illidan, IllidanGUID); - if (Illidan && HPPCT(Illidan) < 10) - EnterPhase(PHASE_RETURN); - } - break; - default: - break; - } - } - - if (!UpdateVictim()) - return; - - if (me->GetHealth()*100 / me->GetMaxHealth() < 20) - DoCast(me, SPELL_HEALING_POTION); - - DoMeleeAttackIfReady(); - } -}; - -struct boss_maievAI : public ScriptedAI -{ - boss_maievAI(Creature *c) : ScriptedAI(c) {}; - - uint64 IllidanGUID; - - PhaseIllidan Phase; - EventMaiev Event; - uint32 Timer[5]; - uint32 MaxTimer; - - void Reset() - { - MaxTimer = 0; - Phase = PHASE_NORMAL_MAIEV; - IllidanGUID = 0; - Timer[EVENT_MAIEV_STEALTH] = 0; - Timer[EVENT_MAIEV_TAUNT] = 22000 + rand()%21 * 1000; - Timer[EVENT_MAIEV_SHADOW_STRIKE] = 30000; - SetEquipmentSlots(false, 44850, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 45738); - } - - void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) {} - void EnterEvadeMode() {} - void GetIllidanGUID(uint64 guid) { IllidanGUID = guid; } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != IllidanGUID) - damage = 0; - else - { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && Illidan->getVictim() == me) - damage = me->GetMaxHealth()/10; - if (damage >= me->GetHealth()) - damage = 0; - } - } - - void AttackStart(Unit *who) - { - if (!who || Timer[EVENT_MAIEV_STEALTH]) - return; - - if (Phase == PHASE_TALK_SEQUENCE) - AttackStartNoMove(who); - else if (Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE) - { - GETUNIT(Illidan, IllidanGUID); - if (Illidan && me->IsWithinDistInMap(Illidan, 25)) - BlinkToPlayer();//Do not let dread aura hurt her. - AttackStartNoMove(who); - } - else - ScriptedAI::AttackStart(who); - } - - void DoAction(const int32 param) - { - if (param > PHASE_ILLIDAN_NULL && param < PHASE_ILLIDAN_MAX) - EnterPhase(PhaseIllidan(param)); - } - - void EnterPhase(PhaseIllidan NextPhase)//This is in fact Illidan's phase. - { - switch(NextPhase) - { - case PHASE_TALK_SEQUENCE: - if (Timer[EVENT_MAIEV_STEALTH]) - { - me->SetHealth(me->GetMaxHealth()); - me->SetVisibility(VISIBILITY_ON); - Timer[EVENT_MAIEV_STEALTH] = 0; - } - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->Clear(false); - me->AttackStop(); - me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); MaxTimer = 0; - break; - case PHASE_TRANSFORM_SEQUENCE: - MaxTimer = 4; - Timer[EVENT_MAIEV_TAUNT] += 10000; - Timer[EVENT_MAIEV_THROW_DAGGER] = 2000; - break; - case PHASE_DEMON: - break; - case PHASE_NORMAL_MAIEV: - MaxTimer = 4; - Timer[EVENT_MAIEV_TAUNT] += 10000; - Timer[EVENT_MAIEV_TRAP] = 22000; - break; - default: - break; + Phase = PHASE_NORMAL_MAIEV; + IllidanGUID = 0; + Timer[EVENT_MAIEV_STEALTH] = 0; + Timer[EVENT_MAIEV_TAUNT] = 22000 + rand()%21 * 1000; + Timer[EVENT_MAIEV_SHADOW_STRIKE] = 30000; + SetEquipmentSlots(false, 44850, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, 45738); } - if (Timer[EVENT_MAIEV_STEALTH]) - MaxTimer = 1; - Phase = NextPhase; - } - void BlinkTo(float x, float y, float z) - { - me->AttackStop(); - me->InterruptNonMeleeSpells(false); - me->GetMotionMaster()->Clear(false); - DoTeleportTo(x, y, z); - DoCast(me, SPELL_TELEPORT_VISUAL, true); - } + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit * /*who*/) {} + void EnterEvadeMode() {} + void GetIllidanGUID(uint64 guid) { IllidanGUID = guid; } - void BlinkToPlayer() - { - if (GETCRE(Illidan, IllidanGUID)) + void DamageTaken(Unit *done_by, uint32 &damage) { - Unit *pTarget = CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0); - - if (!pTarget || !me->IsWithinDistInMap(pTarget, 80) || Illidan->IsWithinDistInMap(pTarget, 20)) - { - uint8 pos = rand()%4; - BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z); - } + if (done_by->GetGUID() != IllidanGUID) + damage = 0; else { - float x, y, z; - pTarget->GetPosition(x, y, z); - BlinkTo(x, y, z); + GETUNIT(Illidan, IllidanGUID); + if (Illidan && Illidan->getVictim() == me) + damage = me->GetMaxHealth()/10; + if (damage >= me->GetHealth()) + damage = 0; } } - } - void UpdateAI(const uint32 diff) - { - if ((!UpdateVictim()) - && !Timer[EVENT_MAIEV_STEALTH]) - return; + void AttackStart(Unit *who) + { + if (!who || Timer[EVENT_MAIEV_STEALTH]) + return; - Event = EVENT_MAIEV_NULL; - for (uint8 i = 1; i <= MaxTimer; ++i) - if (Timer[i]) + if (Phase == PHASE_TALK_SEQUENCE) + AttackStartNoMove(who); + else if (Phase == PHASE_DEMON || Phase == PHASE_TRANSFORM_SEQUENCE) { - if (Timer[i] <= diff) - Event = (EventMaiev)i; - else Timer[i] -= diff; + GETUNIT(Illidan, IllidanGUID); + if (Illidan && me->IsWithinDistInMap(Illidan, 25)) + BlinkToPlayer();//Do not let dread aura hurt her. + AttackStartNoMove(who); } + else + ScriptedAI::AttackStart(who); + } - switch(Event) + void DoAction(const int32 param) + { + if (param > PHASE_ILLIDAN_NULL && param < PHASE_ILLIDAN_MAX) + EnterPhase(PhaseIllidan(param)); + } + + void EnterPhase(PhaseIllidan NextPhase)//This is in fact Illidan's phase. + { + switch(NextPhase) { - case EVENT_MAIEV_STEALTH: + case PHASE_TALK_SEQUENCE: + if (Timer[EVENT_MAIEV_STEALTH]) { me->SetHealth(me->GetMaxHealth()); me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); Timer[EVENT_MAIEV_STEALTH] = 0; - BlinkToPlayer(); - EnterPhase(Phase); } + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->Clear(false); + me->AttackStop(); + me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); + MaxTimer = 0; break; - case EVENT_MAIEV_TAUNT: - { - uint32 random = rand()%4; - char* text = MaievTaunts[random].text; - uint32 sound = MaievTaunts[random].sound; - me->MonsterYell(text, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, sound); - Timer[EVENT_MAIEV_TAUNT] = 22000 + rand()%21 * 1000; - } + case PHASE_TRANSFORM_SEQUENCE: + MaxTimer = 4; + Timer[EVENT_MAIEV_TAUNT] += 10000; + Timer[EVENT_MAIEV_THROW_DAGGER] = 2000; break; - case EVENT_MAIEV_SHADOW_STRIKE: - DoCast(me->getVictim(), SPELL_SHADOW_STRIKE); - Timer[EVENT_MAIEV_SHADOW_STRIKE] = 60000; + case PHASE_DEMON: break; - case EVENT_MAIEV_TRAP: - if (Phase == PHASE_NORMAL_MAIEV) - { - BlinkToPlayer(); - DoCast(me, SPELL_CAGE_TRAP_SUMMON); - Timer[EVENT_MAIEV_TRAP] = 22000; - } - else - { - if (!me->IsWithinDistInMap(me->getVictim(), 40)) - me->GetMotionMaster()->MoveChase(me->getVictim(), 30); - DoCast(me->getVictim(), SPELL_THROW_DAGGER); - Timer[EVENT_MAIEV_THROW_DAGGER] = 2000; - } + case PHASE_NORMAL_MAIEV: + MaxTimer = 4; + Timer[EVENT_MAIEV_TAUNT] += 10000; + Timer[EVENT_MAIEV_TRAP] = 22000; break; default: break; } - - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) - { - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (GETCRE(Illidan, IllidanGUID)) - CAST_AI(boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); - me->AttackStop(); - Timer[EVENT_MAIEV_STEALTH] = 60000; //reappear after 1 minute + if (Timer[EVENT_MAIEV_STEALTH]) MaxTimer = 1; - } + Phase = NextPhase; + } - if (Phase == PHASE_NORMAL_MAIEV) - DoMeleeAttackIfReady(); - } -}; - -bool GossipSelect_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_akama_illidanAI, pCreature->AI())->EnterPhase(PHASE_CHANNEL); - } - return true; -} - -bool GossipHello_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(10465, pCreature->GetGUID()); - - return true; -} - -struct cage_trap_triggerAI : public ScriptedAI -{ - cage_trap_triggerAI(Creature *c) : ScriptedAI(c) {} - - uint64 IllidanGUID; - uint32 DespawnTimer; - - bool Active; - bool SummonedBeams; - - void Reset() - { - IllidanGUID = 0; - - Active = false; - SummonedBeams = false; - - DespawnTimer = 0; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void EnterCombat(Unit * /*who*/){} - - void MoveInLineOfSight(Unit *who) - { - if (!Active) - return; - - if (who && (who->GetTypeId() != TYPEID_PLAYER)) + void BlinkTo(float x, float y, float z) { - if (who->GetEntry() == ILLIDAN_STORMRAGE) // Check if who is Illidan + me->AttackStop(); + me->InterruptNonMeleeSpells(false); + me->GetMotionMaster()->Clear(false); + DoTeleportTo(x, y, z); + DoCast(me, SPELL_TELEPORT_VISUAL, true); + } + + void BlinkToPlayer() + { + if (GETCRE(Illidan, IllidanGUID)) { - if (!IllidanGUID && me->IsWithinDistInMap(who, 3) && (!who->HasAura(SPELL_CAGED))) + Unit *pTarget = CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->SelectUnit(SELECT_TARGET_RANDOM, 0); + + if (!pTarget || !me->IsWithinDistInMap(pTarget, 80) || Illidan->IsWithinDistInMap(pTarget, 20)) { - IllidanGUID = who->GetGUID(); - who->CastSpell(who, SPELL_CAGED, true); - DespawnTimer = 5000; - if (who->HasAura(SPELL_ENRAGE)) - who->RemoveAurasDueToSpell(SPELL_ENRAGE); // Dispel his enrage - //if (GameObject* CageTrap = pInstance->instance->GetGameObject(pInstance->GetData64(CageTrapGUID))) - // CageTrap->SetLootState(GO_JUST_DEACTIVATED); + uint8 pos = rand()%4; + BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z); + } + else + { + float x, y, z; + pTarget->GetPosition(x, y, z); + BlinkTo(x, y, z); } } } - } - void UpdateAI(const uint32 diff) - { - if (DespawnTimer) - if (DespawnTimer <= diff) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - else DespawnTimer -= diff; - - //if (IllidanGUID && !SummonedBeams) - //{ - // if (Unit* Illidan = Unit::GetUnit(*me, IllidanGUID) - // { - // //TODO: Find proper spells and properly apply 'caged' Illidan effect - // } - //} - } -}; - -bool GOHello_cage_trap(Player* pPlayer, GameObject* pGo) -{ - float x, y, z; - pPlayer->GetPosition(x, y, z); - - // Grid search for nearest live Creature of entry 23304 within 10 yards - if (Creature* pTrigger = pGo->FindNearestCreature(23304, 10.0f)) - CAST_AI(cage_trap_triggerAI, pTrigger->AI())->Active = true; - pGo->SetGoState(GO_STATE_ACTIVE); - return true; -} - -struct shadow_demonAI : public ScriptedAI -{ - shadow_demonAI(Creature *c) : ScriptedAI(c) {} - - uint64 TargetGUID; - - void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} - - void Reset() - { - TargetGUID = 0; - DoCast(me, SPELL_SHADOW_DEMON_PASSIVE, true); - } - - void JustDied(Unit * /*killer*/) - { - if (Unit *pTarget = Unit::GetUnit((*me), TargetGUID)) - pTarget->RemoveAurasDueToSpell(SPELL_PARALYZE); - } - - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) return; - - if (me->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players. - - if (!me->getVictim()->HasAura(SPELL_PARALYZE)) + void UpdateAI(const uint32 diff) { - TargetGUID = me->getVictim()->GetGUID(); - me->AddThreat(me->getVictim(), 10000000.0f); - DoCast(me->getVictim(), SPELL_PURPLE_BEAM, true); - DoCast(me->getVictim(), SPELL_PARALYZE, true); + if ((!UpdateVictim()) + && !Timer[EVENT_MAIEV_STEALTH]) + return; + + Event = EVENT_MAIEV_NULL; + for (uint8 i = 1; i <= MaxTimer; ++i) + if (Timer[i]) + { + if (Timer[i] <= diff) + Event = (EventMaiev)i; + else Timer[i] -= diff; + } + + switch(Event) + { + case EVENT_MAIEV_STEALTH: + { + me->SetHealth(me->GetMaxHealth()); + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Timer[EVENT_MAIEV_STEALTH] = 0; + BlinkToPlayer(); + EnterPhase(Phase); + } + break; + case EVENT_MAIEV_TAUNT: + { + uint32 random = rand()%4; + char* text = MaievTaunts[random].text; + uint32 sound = MaievTaunts[random].sound; + me->MonsterYell(text, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, sound); + Timer[EVENT_MAIEV_TAUNT] = 22000 + rand()%21 * 1000; + } + break; + case EVENT_MAIEV_SHADOW_STRIKE: + DoCast(me->getVictim(), SPELL_SHADOW_STRIKE); + Timer[EVENT_MAIEV_SHADOW_STRIKE] = 60000; + break; + case EVENT_MAIEV_TRAP: + if (Phase == PHASE_NORMAL_MAIEV) + { + BlinkToPlayer(); + DoCast(me, SPELL_CAGE_TRAP_SUMMON); + Timer[EVENT_MAIEV_TRAP] = 22000; + } + else + { + if (!me->IsWithinDistInMap(me->getVictim(), 40)) + me->GetMotionMaster()->MoveChase(me->getVictim(), 30); + DoCast(me->getVictim(), SPELL_THROW_DAGGER); + Timer[EVENT_MAIEV_THROW_DAGGER] = 2000; + } + break; + default: + break; + } + + if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (GETCRE(Illidan, IllidanGUID)) + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); + me->AttackStop(); + Timer[EVENT_MAIEV_STEALTH] = 60000; //reappear after 1 minute + MaxTimer = 1; + } + + if (Phase == PHASE_NORMAL_MAIEV) + DoMeleeAttackIfReady(); } - // Kill our target if we're very close. - if (me->IsWithinDistInMap(me->getVictim(), 3)) - DoCast(me->getVictim(), SPELL_CONSUME_SOUL); - } + }; + }; - -// Shadowfiends interact with Illidan, setting more targets in Illidan's hashmap -struct mob_parasitic_shadowfiendAI : public ScriptedAI + class npc_akama_illidan : public CreatureScript { - mob_parasitic_shadowfiendAI(Creature* c) : ScriptedAI(c) +public: + npc_akama_illidan() : CreatureScript("npc_akama_illidan") { } + + struct npc_akama_illidanAI : public ScriptedAI { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - uint64 IllidanGUID; - uint32 CheckTimer; - - void Reset() - { - if (pInstance) - IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); - else - IllidanGUID = 0; - - CheckTimer = 5000; - DoCast(me, SPELL_SHADOWFIEND_PASSIVE, true); - } - - void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); } - - void DoMeleeAttackIfReady() - { - if (me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) + npc_akama_illidanAI(Creature* c) : ScriptedAI(c) { - if (!me->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND) - && !me->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2)) + pInstance = c->GetInstanceScript(); + JustCreated = true; + } + bool JustCreated; + InstanceScript* pInstance; + + PhaseAkama Phase; + bool Event; + uint32 Timer; + + uint64 IllidanGUID; + uint64 ChannelGUID; + uint64 SpiritGUID[2]; + uint64 GateGUID; + uint64 DoorGUID[2]; + + uint32 ChannelCount; + uint32 WalkCount; + uint32 TalkCount; + uint32 Check_Timer; + + void Reset() + { + WalkCount = 0; + if (pInstance) { - if (Creature* illidan = Unit::GetCreature((*me),IllidanGUID))//summon only in 1. phase - if (CAST_AI(boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) - me->CastSpell(me->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack - } - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); - } - } + pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED); - void UpdateAI(const uint32 diff) - { - if (!me->getVictim()) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true)) - AttackStart(pTarget); + IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); + GateGUID = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_GATE); + DoorGUID[0] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_R); + DoorGUID[1] = pInstance->GetData64(DATA_GAMEOBJECT_ILLIDAN_DOOR_L); + + if (JustCreated)//close all doors at create + { + pInstance->HandleGameObject(GateGUID, false); + + for (uint8 i = 0; i < 2; ++i) + pInstance->HandleGameObject(DoorGUID[i], false); + //JustCreated = false; + }else + {//open all doors, raid wiped + pInstance->HandleGameObject(GateGUID, true); + WalkCount = 1;//skip first wp + for (uint8 i = 0; i < 2; ++i) + pInstance->HandleGameObject(DoorGUID[i], true); + } + } else { - me->SetVisibility(VISIBILITY_OFF); - me->setDeathState(JUST_DIED); + IllidanGUID = 0; + GateGUID = 0; + DoorGUID[0] = 0; + DoorGUID[1] = 0; + } + + ChannelGUID = 0; + SpiritGUID[0] = 0; + SpiritGUID[1] = 0; + + Phase = PHASE_AKAMA_NULL; + Timer = 0; + + ChannelCount = 0; + TalkCount = 0; + Check_Timer = 5000; + + KillAllElites(); + + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has strange values.. + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->setActive(false); + me->SetVisibility(VISIBILITY_OFF); + } + + // Do not call reset in Akama's evade mode, as this will stop him from summoning minions after he kills the first bit + void EnterEvadeMode() + { + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + } + + void EnterCombat(Unit * /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void MovementInform(uint32 MovementType, uint32 /*Data*/) + { + if (MovementType == POINT_MOTION_TYPE) + Timer = 1; + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (damage > me->GetHealth() || done_by->GetGUID() != IllidanGUID) + damage = 0; + } + + void KillAllElites() + { + std::list& threatList = me->getThreatManager().getThreatList(); + std::vector eliteList; + for (std::list::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) + eliteList.push_back(pUnit); + } + for (std::vector::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) + (*itr)->setDeathState(JUST_DIED); + EnterEvadeMode(); + } + + void BeginTalk() + { + if (!pInstance) return; + + pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS); + for (uint8 i = 0; i < 2; ++i) + pInstance->HandleGameObject(DoorGUID[i], false); + if (GETCRE(Illidan, IllidanGUID)) + { + Illidan->RemoveAurasDueToSpell(SPELL_KNEEL); + me->SetInFront(Illidan); + Illidan->SetInFront(me); + me->GetMotionMaster()->MoveIdle(); + Illidan->GetMotionMaster()->MoveIdle(); + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->AkamaGUID = me->GetGUID(); + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->EnterPhase(PHASE_TALK_SEQUENCE); } } - if (CheckTimer <= diff) + void BeginChannel() { - GETUNIT(Illidan, IllidanGUID); - if (!Illidan || CAST_CRE(Illidan)->IsInEvadeMode()) - { - me->SetVisibility(VISIBILITY_OFF); - me->setDeathState(JUST_DIED); + me->setActive(true); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + if (!JustCreated) return; - } else CheckTimer = 5000; - } else CheckTimer -= diff; + float x, y, z; + if (GETGO(Gate, GateGUID)) + Gate->GetPosition(x, y, z); + else + return;//if door not spawned, don't crash server - DoMeleeAttackIfReady(); - } -}; + if (Creature* Channel = me->SummonCreature(ILLIDAN_DOOR_TRIGGER, x, y, z+5, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000)) + { + ChannelGUID = Channel->GetGUID(); + Channel->SetDisplayId(11686); // Invisible but spell visuals can still be seen. + DoCast(Channel, SPELL_AKAMA_DOOR_FAIL); + } -struct blade_of_azzinothAI : public NullCreatureAI -{ - blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {} + for (uint8 i = 0; i < 2; ++i) + if (Creature* Spirit = me->SummonCreature(i ? SPIRIT_OF_OLUM : SPIRIT_OF_UDALO, SpiritSpawns[i].x, SpiritSpawns[i].y, SpiritSpawns[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + { + Spirit->SetVisibility(VISIBILITY_OFF); + SpiritGUID[i] = Spirit->GetGUID(); + } + } - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + void BeginWalk() + { + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->SetSpeed(MOVE_RUN, 1.0f); + me->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); + } + + void EnterPhase(PhaseAkama NextPhase) + { + if (!pInstance) + return; + switch(NextPhase) + { + case PHASE_CHANNEL: + BeginChannel(); + Timer = 5000; + ChannelCount = 0; + break; + case PHASE_WALK: + if (Phase == PHASE_CHANNEL) + WalkCount = 0; + else if (Phase == PHASE_TALK) + { + if (GETCRE(Illidan, IllidanGUID)) + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->DeleteFromThreatList(me->GetGUID()); + EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + ++WalkCount; + } + JustCreated = false; + BeginWalk(); + Timer = 0; + break; + case PHASE_TALK: + if (Phase == PHASE_WALK) + { + BeginTalk(); + Timer = 0; + } + else if (Phase == PHASE_FIGHT_ILLIDAN) + { + Timer = 1; + TalkCount = 0; + } + break; + case PHASE_FIGHT_ILLIDAN: + if (GETUNIT(Illidan, IllidanGUID)) + { + me->AddThreat(Illidan, 10000000.0f); + me->GetMotionMaster()->MoveChase(Illidan); + } + Timer = 30000; //chain lightning + break; + case PHASE_FIGHT_MINIONS: + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + Timer = 10000 + rand()%6000;//summon minion + break; + case PHASE_RETURN: + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + KillAllElites(); + WalkCount = 0; + BeginWalk(); + Timer = 1; + break; + default: + break; + } + Phase = NextPhase; + Event = false; + } + + void HandleTalkSequence() + { + switch(TalkCount) + { + case 0: + if (GETCRE(Illidan, IllidanGUID)) + { + CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, Illidan->AI())->Timer[EVENT_TAUNT] += 30000; + Illidan->MonsterYell(SAY_AKAMA_MINION, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(Illidan, SOUND_AKAMA_MINION); + } + Timer = 8000; + break; + case 1: + me->MonsterYell(SAY_AKAMA_LEAVE, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_AKAMA_LEAVE); + Timer = 3000; + break; + case 2: + EnterPhase(PHASE_WALK); + break; + } + ++TalkCount; + } + + void HandleChannelSequence() + { + Unit* Channel = NULL, *Spirit[2]; + if (ChannelCount <= 5) + { + Channel = Unit::GetUnit((*me), ChannelGUID); + Spirit[0] = Unit::GetUnit((*me), SpiritGUID[0]); + Spirit[1] = Unit::GetUnit((*me), SpiritGUID[1]); + if (!Channel || !Spirit[0] || !Spirit[1]) + return; + } + + switch(ChannelCount) + { + case 0: // channel failed + me->InterruptNonMeleeSpells(true); + Timer = 2000; + break; + case 1: // spirit appear + Spirit[0]->SetVisibility(VISIBILITY_ON); + Spirit[1]->SetVisibility(VISIBILITY_ON); + Timer = 2000; + break; + case 2: // spirit help + DoCast(Channel, SPELL_AKAMA_DOOR_CHANNEL); + Spirit[0]->CastSpell(Channel, SPELL_DEATHSWORN_DOOR_CHANNEL,false); + Spirit[1]->CastSpell(Channel, SPELL_DEATHSWORN_DOOR_CHANNEL,false); + Timer = 5000; + break; + case 3: //open the gate + me->InterruptNonMeleeSpells(true); + Spirit[0]->InterruptNonMeleeSpells(true); + Spirit[1]->InterruptNonMeleeSpells(true); + if (pInstance) + pInstance->HandleGameObject(GateGUID, true); + Timer = 2000; + break; + case 4: + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + Timer = 2000; + break; + case 5: + me->MonsterYell(SAY_AKAMA_BEWARE, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_AKAMA_BEWARE); + Channel->setDeathState(JUST_DIED); + Spirit[0]->SetVisibility(VISIBILITY_OFF); + Spirit[1]->SetVisibility(VISIBILITY_OFF); + Timer = 3000; + break; + case 6: + EnterPhase(PHASE_WALK); + break; + default: + break; + } + ++ChannelCount; + } + + void HandleWalkSequence() + { + switch(WalkCount) + { + case 6: + for (uint8 i = 0; i < 2; ++i) + if (pInstance) + pInstance->HandleGameObject(DoorGUID[i], true); + break; + case 8: + if (Phase == PHASE_WALK) + EnterPhase(PHASE_TALK); + else + EnterPhase(PHASE_FIGHT_ILLIDAN); + break; + case 12: + EnterPhase(PHASE_FIGHT_MINIONS); + break; + } + + if (Phase == PHASE_WALK) + { + Timer = 0; + ++WalkCount; + me->GetMotionMaster()->MovePoint(WalkCount, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); + } + } + + void UpdateAI(const uint32 diff) + { + if (me->GetVisibility() == VISIBILITY_OFF) + { + if (Check_Timer <= diff) + { + if (pInstance && pInstance->GetData(DATA_ILLIDARICOUNCILEVENT) == DONE) + me->SetVisibility(VISIBILITY_ON); + + Check_Timer = 5000; + } else Check_Timer -= diff; + } + Event = false; + if (Timer) + { + if (Timer <= diff) + Event = true; + else Timer -= diff; + } + + if (Event) + { + switch(Phase) + { + case PHASE_CHANNEL: + if (JustCreated) + HandleChannelSequence(); + else{ + EnterPhase(PHASE_WALK); + } + break; + case PHASE_TALK: + HandleTalkSequence(); + break; + case PHASE_WALK: + case PHASE_RETURN: + HandleWalkSequence(); + break; + case PHASE_FIGHT_ILLIDAN: + { + GETUNIT(Illidan, IllidanGUID); + if (Illidan && HPPCT(Illidan) < 90) + EnterPhase(PHASE_TALK); + else + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + Timer = 30000; + } + } + break; + case PHASE_FIGHT_MINIONS: + { + float x, y, z; + me->GetPosition(x, y, z); + Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x+rand()%10, y+rand()%10, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); + //Creature* Elite = me->SummonCreature(ILLIDARI_ELITE, x, y, z, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000); + if (Elite) + { + Elite->AI()->AttackStart(me); + Elite->AddThreat(me, 1000000.0f); + AttackStart(Elite); + me->AddThreat(Elite, 1000000.0f); + } + Timer = 10000 + rand()%6000; + GETUNIT(Illidan, IllidanGUID); + if (Illidan && HPPCT(Illidan) < 10) + EnterPhase(PHASE_RETURN); + } + break; + default: + break; + } + } + + if (!UpdateVictim()) + return; + + if (me->GetHealth()*100 / me->GetMaxHealth() < 20) + DoCast(me, SPELL_HEALING_POTION); + + DoMeleeAttackIfReady(); + } + }; + + bool GossipSelect_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (spell->Id == SPELL_THROW_GLAIVE2 || spell->Id == SPELL_THROW_GLAIVE) - me->SetDisplayId(21431);//appear when hit by Illidan's glaive + if (uiAction == GOSSIP_ACTION_INFO_DEF) // Time to begin the Event + { + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_akama_illidan::npc_akama_illidanAI, pCreature->AI())->EnterPhase(PHASE_CHANNEL); + } + return true; } + + bool GossipHello_npc_akama_at_illidan(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(10465, pCreature->GetGUID()); + + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_akama_illidanAI(pCreature); + } + }; -void boss_illidan_stormrageAI::Reset() +void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() { if (pInstance) pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, NOT_STARTED); @@ -1833,9 +1833,9 @@ void boss_illidan_stormrageAI::Reset() Akama->Respawn(); else { - CAST_AI(npc_akama_illidanAI, Akama->AI())->EnterEvadeMode(); + CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterEvadeMode(); Akama->GetMotionMaster()->MoveTargetedHome(); - CAST_AI(npc_akama_illidanAI, Akama->AI())->Reset(); + CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->Reset(); } } AkamaGUID = 0; @@ -1867,7 +1867,7 @@ void boss_illidan_stormrageAI::Reset() Summons.DespawnAll(); } -void boss_illidan_stormrageAI::JustSummoned(Creature* summon) +void boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(Creature* summon) { Summons.Summon(summon); switch(summon->GetEntry()) @@ -1900,7 +1900,7 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon) summon->SetVisibility(VISIBILITY_OFF); // Leave her invisible until she has to talk summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); MaievGUID = summon->GetGUID(); - CAST_AI(boss_maievAI, summon->AI())->GetIllidanGUID(me->GetGUID()); + CAST_AI(boss_maiev_shadowsong::boss_maievAI, summon->AI())->GetIllidanGUID(me->GetGUID()); summon->AI()->DoAction(PHASE_TALK_SEQUENCE); } break; @@ -1914,7 +1914,7 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon) } } -void boss_illidan_stormrageAI::HandleTalkSequence() +void boss_illidan_stormrage::boss_illidan_stormrageAI::HandleTalkSequence() { switch(TalkCount) { @@ -1932,7 +1932,7 @@ void boss_illidan_stormrageAI::HandleTalkSequence() { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); me->AddThreat(Akama, 100.0f); - CAST_AI(npc_akama_illidanAI, Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); + CAST_AI(npc_akama_illidan::npc_akama_illidanAI, Akama->AI())->EnterPhase(PHASE_FIGHT_ILLIDAN); EnterPhase(PHASE_NORMAL); } break; @@ -1997,254 +1997,262 @@ void boss_illidan_stormrageAI::HandleTalkSequence() if (Phase == PHASE_TALK_SEQUENCE) Talk(TalkCount); // This function does most of the talking ++TalkCount; -} - -void boss_illidan_stormrageAI::CastEyeBlast() +} class mob_cage_trap_trigger : public CreatureScript { - me->InterruptNonMeleeSpells(false); +public: + mob_cage_trap_trigger() : CreatureScript("mob_cage_trap_trigger") { } - me->MonsterYell(SAY_EYE_BLAST, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_EYE_BLAST); - - float distx, disty, dist[2]; - for (uint8 i = 0; i < 2; ++i) + CreatureAI* GetAI(Creature* pCreature) const { - distx = EyeBlast[i].x - HoverPosition[HoverPoint].x; - disty = EyeBlast[i].y - HoverPosition[HoverPoint].y; - dist[i] = distx * distx + disty * disty; + return new cage_trap_triggerAI (pCreature); } - Locations initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; - for (uint8 i = 0; i < 2; ++i) + + struct cage_trap_triggerAI : public ScriptedAI { - distx = GlaivePosition[i].x - HoverPosition[HoverPoint].x; - disty = GlaivePosition[i].y - HoverPosition[HoverPoint].y; - dist[i] = distx * distx + disty * disty; - } - Locations final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; + cage_trap_triggerAI(Creature *c) : ScriptedAI(c) {} - final.x = 2 * final.x - initial.x; - final.y = 2 * final.y - initial.y; + uint64 IllidanGUID; + uint32 DespawnTimer; - Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); - if (!Trigger) return; + bool Active; + bool SummonedBeams; - Trigger->SetSpeed(MOVE_WALK, 3); - Trigger->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); - - //Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); - DoCast(Trigger, SPELL_EYE_BLAST); -} - -void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth() -{ - me->MonsterYell(SAY_SUMMONFLAMES, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_SUMMONFLAMES); - - for (uint8 i = 0; i < 2; ++i) - { - if (GETUNIT(Glaive, GlaiveGUID[i])) + void Reset() { - Creature* Flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - if (Flame) + IllidanGUID = 0; + + Active = false; + SummonedBeams = false; + + DespawnTimer = 0; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/){} + + void MoveInLineOfSight(Unit *who) + { + if (!Active) + return; + + if (who && (who->GetTypeId() != TYPEID_PLAYER)) { - Flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction - Flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); - FlameGUID[i] = Flame->GetGUID(); // Record GUID in order to check if they're dead later on to move to the next phase - CAST_AI(flame_of_azzinothAI, Flame->AI())->SetGlaiveGUID(GlaiveGUID[i]); - Glaive->CastSpell(Flame, SPELL_AZZINOTH_CHANNEL, false); // Glaives do some random Beam type channel on it. + if (who->GetEntry() == ILLIDAN_STORMRAGE) // Check if who is Illidan + { + if (!IllidanGUID && me->IsWithinDistInMap(who, 3) && (!who->HasAura(SPELL_CAGED))) + { + IllidanGUID = who->GetGUID(); + who->CastSpell(who, SPELL_CAGED, true); + DespawnTimer = 5000; + if (who->HasAura(SPELL_ENRAGE)) + who->RemoveAurasDueToSpell(SPELL_ENRAGE); // Dispel his enrage + //if (GameObject* CageTrap = pInstance->instance->GetGameObject(pInstance->GetData64(CageTrapGUID))) + // CageTrap->SetLootState(GO_JUST_DEACTIVATED); + } + } } } - } -} -void boss_illidan_stormrageAI::SummonMaiev() -{ - DoCast(me, SPELL_SHADOW_PRISON, true); - DoCast(me, 40403, true); - if (!MaievGUID) // If Maiev cannot be summoned, reset the encounter and post some errors to the console. - { - EnterEvadeMode(); - me->MonsterTextEmote(EMOTE_UNABLE_TO_SUMMON, 0); - sLog.outError("SD2 ERROR: Unable to summon Maiev Shadowsong (entry: 23197). Check your database to see if you have the proper SQL for Maiev Shadowsong (entry: 23197)"); - } -} - -void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase) -{ - DoZoneInCombat(); - switch(NextPhase) - { - case PHASE_NORMAL: - case PHASE_NORMAL_2: - case PHASE_NORMAL_MAIEV: - AttackStart(me->getVictim()); - Timer[EVENT_TAUNT] = 32000; - Timer[EVENT_SHEAR] = 10000 + rand()%15 * 1000; - Timer[EVENT_FLAME_CRASH] = 20000; - Timer[EVENT_PARASITIC_SHADOWFIEND] = 25000; - Timer[EVENT_PARASITE_CHECK] = 0; - Timer[EVENT_DRAW_SOUL] = 30000; - if (NextPhase == PHASE_NORMAL) - break; - Timer[EVENT_AGONIZING_FLAMES] = 35000; - Timer[EVENT_TRANSFORM_NORMAL] = 60000; - if (NextPhase == PHASE_NORMAL_2) - break; - Timer[EVENT_ENRAGE] = 30000 + rand()%10 * 1000; - break; - case PHASE_FLIGHT: - Timer[EVENT_FIREBALL] = 1000; - if (!(rand()%4)) - Timer[EVENT_DARK_BARRAGE] = 10000; - Timer[EVENT_EYE_BLAST] = 10000 + rand()%15 * 1000; - Timer[EVENT_MOVE_POINT] = 20000 + rand()%20 * 1000; - break; - case PHASE_DEMON: - Timer[EVENT_SHADOW_BLAST] = 1000; - Timer[EVENT_FLAME_BURST] = 10000; - Timer[EVENT_SHADOWDEMON] = 30000; - Timer[EVENT_TRANSFORM_DEMON] = 60000; - AttackStart(me->getVictim()); - break; - case PHASE_TALK_SEQUENCE: - Timer[EVENT_TALK_SEQUENCE] = 100; - me->RemoveAllAuras(); - me->InterruptNonMeleeSpells(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(false); - me->AttackStop(); - break; - case PHASE_FLIGHT_SEQUENCE: - if (Phase == PHASE_NORMAL) //lift off + void UpdateAI(const uint32 diff) { - FlightCount = 1; - Timer[EVENT_FLIGHT_SEQUENCE] = 1; - me->RemoveAllAuras(); - me->InterruptNonMeleeSpells(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->Clear(false); - me->AttackStop(); + if (DespawnTimer) + if (DespawnTimer <= diff) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + else DespawnTimer -= diff; + + //if (IllidanGUID && !SummonedBeams) + //{ + // if (Unit* Illidan = Unit::GetUnit(*me, IllidanGUID) + // { + // //TODO: Find proper spells and properly apply 'caged' Illidan effect + // } + //} } - else //land - Timer[EVENT_FLIGHT_SEQUENCE] = 2000; - break; - case PHASE_TRANSFORM_SEQUENCE: - if (Phase == PHASE_DEMON) - Timer[EVENT_TRANSFORM_SEQUENCE] = 500; - else - { - TransformCount = 0; - Timer[EVENT_TRANSFORM_SEQUENCE] = 500; - me->MonsterYell(SAY_MORPH, LANG_UNIVERSAL, 0); - DoPlaySoundToSet(me, SOUND_MORPH); - } - me->GetMotionMaster()->Clear(); - me->AttackStop(); - break; - default: - break; - } - if (MaievGUID) + }; + +}; + class gameobject_cage_trap : public GameObjectScript +{ +public: + gameobject_cage_trap() : GameObjectScript("gameobject_cage_trap") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - GETCRE(Maiev, MaievGUID); - if (Maiev && Maiev->isAlive()) - Maiev->AI()->DoAction(NextPhase); + float x, y, z; + pPlayer->GetPosition(x, y, z); + + // Grid search for nearest live Creature of entry 23304 within 10 yards + if (Creature* pTrigger = pGo->FindNearestCreature(23304, 10.0f)) + CAST_AI(mob_cage_trap_trigger::cage_trap_triggerAI, pTrigger->AI())->Active = true; + pGo->SetGoState(GO_STATE_ACTIVE); + return true; } - Phase = NextPhase; - Event = EVENT_NULL; -} -CreatureAI* GetAI_boss_illidan_stormrage(Creature* pCreature) +}; + class mob_shadow_demon : public CreatureScript { - return new boss_illidan_stormrageAI (pCreature); -} +public: + mob_shadow_demon() : CreatureScript("mob_shadow_demon") { } -CreatureAI* GetAI_npc_akama_at_illidan(Creature* pCreature) -{ - return new npc_akama_illidanAI(pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new shadow_demonAI (pCreature); + } -CreatureAI* GetAI_boss_maiev(Creature* pCreature) -{ - return new boss_maievAI (pCreature); -} + struct shadow_demonAI : public ScriptedAI + { + shadow_demonAI(Creature *c) : ScriptedAI(c) {} -CreatureAI* GetAI_mob_flame_of_azzinoth(Creature* pCreature) -{ - return new flame_of_azzinothAI (pCreature); -} + uint64 TargetGUID; -CreatureAI* GetAI_cage_trap_trigger(Creature* pCreature) -{ - return new cage_trap_triggerAI (pCreature); -} + void EnterCombat(Unit * /*who*/) {DoZoneInCombat();} -CreatureAI* GetAI_shadow_demon(Creature* pCreature) -{ - return new shadow_demonAI (pCreature); -} + void Reset() + { + TargetGUID = 0; + DoCast(me, SPELL_SHADOW_DEMON_PASSIVE, true); + } -CreatureAI* GetAI_blade_of_azzinoth(Creature* pCreature) -{ - return new blade_of_azzinothAI (pCreature); -} + void JustDied(Unit * /*killer*/) + { + if (Unit *pTarget = Unit::GetUnit((*me), TargetGUID)) + pTarget->RemoveAurasDueToSpell(SPELL_PARALYZE); + } -CreatureAI* GetAI_parasitic_shadowfiend(Creature* pCreature) + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) return; + + if (me->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players. + + if (!me->getVictim()->HasAura(SPELL_PARALYZE)) + { + TargetGUID = me->getVictim()->GetGUID(); + me->AddThreat(me->getVictim(), 10000000.0f); + DoCast(me->getVictim(), SPELL_PURPLE_BEAM, true); + DoCast(me->getVictim(), SPELL_PARALYZE, true); + } + // Kill our target if we're very close. + if (me->IsWithinDistInMap(me->getVictim(), 3)) + DoCast(me->getVictim(), SPELL_CONSUME_SOUL); + } + }; + +}; + class mob_blade_of_azzinoth : public CreatureScript { - return new mob_parasitic_shadowfiendAI (pCreature); -} +public: + mob_blade_of_azzinoth() : CreatureScript("mob_blade_of_azzinoth") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new blade_of_azzinothAI (pCreature); + } + + struct blade_of_azzinothAI : public NullCreatureAI + { + blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_THROW_GLAIVE2 || spell->Id == SPELL_THROW_GLAIVE) + me->SetDisplayId(21431);//appear when hit by Illidan's glaive + } + }; + +}; + class mob_parasitic_shadowfiend : public CreatureScript +{ +public: + mob_parasitic_shadowfiend() : CreatureScript("mob_parasitic_shadowfiend") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_parasitic_shadowfiendAI (pCreature); + } + + // Shadowfiends interact with Illidan, setting more targets in Illidan's hashmap + struct mob_parasitic_shadowfiendAI : public ScriptedAI + { + mob_parasitic_shadowfiendAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + uint64 IllidanGUID; + uint32 CheckTimer; + + void Reset() + { + if (pInstance) + IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE); + else + IllidanGUID = 0; + + CheckTimer = 5000; + DoCast(me, SPELL_SHADOWFIEND_PASSIVE, true); + } + + void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); } + + void DoMeleeAttackIfReady() + { + if (me->isAttackReady() && me->IsWithinMeleeRange(me->getVictim())) + { + if (!me->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND) + && !me->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2)) + { + if (Creature* illidan = Unit::GetCreature((*me),IllidanGUID))//summon only in 1. phase + if (CAST_AI(boss_illidan_stormrage::boss_illidan_stormrageAI, illidan->AI())->Phase == PHASE_NORMAL) + me->CastSpell(me->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack + } + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + } + + void UpdateAI(const uint32 diff) + { + if (!me->getVictim()) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true)) + AttackStart(pTarget); + else + { + me->SetVisibility(VISIBILITY_OFF); + me->setDeathState(JUST_DIED); + return; + } + } + + if (CheckTimer <= diff) + { + GETUNIT(Illidan, IllidanGUID); + if (!Illidan || CAST_CRE(Illidan)->IsInEvadeMode()) + { + me->SetVisibility(VISIBILITY_OFF); + me->setDeathState(JUST_DIED); + return; + } else CheckTimer = 5000; + } else CheckTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_boss_illidan() { - Script* newscript; - - newscript = new Script; - newscript->Name = "boss_illidan_stormrage"; - newscript->GetAI = &GetAI_boss_illidan_stormrage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_akama_illidan"; - newscript->GetAI = &GetAI_npc_akama_at_illidan; - newscript->pGossipHello = &GossipHello_npc_akama_at_illidan; - newscript->pGossipSelect = &GossipSelect_npc_akama_at_illidan; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_maiev_shadowsong"; - newscript->GetAI = &GetAI_boss_maiev; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_flame_of_azzinoth"; - newscript->GetAI = &GetAI_mob_flame_of_azzinoth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_blade_of_azzinoth"; - newscript->GetAI = &GetAI_blade_of_azzinoth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "gameobject_cage_trap"; - newscript->pGOHello = &GOHello_cage_trap; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_cage_trap_trigger"; - newscript->GetAI = &GetAI_cage_trap_trigger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadow_demon"; - newscript->GetAI = &GetAI_shadow_demon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_parasitic_shadowfiend"; - newscript->GetAI = &GetAI_parasitic_shadowfiend; - newscript->RegisterSelf(); + new boss_illidan_stormrage(); + new npc_akama_illidan(); + new boss_maiev_shadowsong(); + new mob_flame_of_azzinoth(); + new mob_blade_of_azzinoth(); + new gameobject_cage_trap(); + new mob_cage_trap_trigger(); + new mob_shadow_demon(); + new mob_parasitic_shadowfiend(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index cb72486972b..71aa4e8a4bd 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -77,228 +77,230 @@ static Locations TeleportPoint[]= {930.548, 284.888, 193.367}, {965.997, 278.398, 195.777} }; - -struct boss_shahrazAI : public ScriptedAI + class boss_mother_shahraz : public CreatureScript { - boss_shahrazAI(Creature *c) : ScriptedAI(c) +public: + boss_mother_shahraz() : CreatureScript("boss_mother_shahraz") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_shahrazAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 TargetGUID[3]; - uint32 BeamTimer; - uint32 BeamCount; - uint32 CurrentBeam; - uint32 PrismaticShieldTimer; - uint32 FatalAttractionTimer; - uint32 FatalAttractionExplodeTimer; - uint32 ShriekTimer; - uint32 SaberTimer; - uint32 RandomYellTimer; - uint32 EnrageTimer; - uint32 ExplosionCount; - - bool Enraged; - - void Reset() + struct boss_shahrazAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, NOT_STARTED); - - for (uint8 i = 0; i<3; ++i) - TargetGUID[i] = 0; - - BeamTimer = 20000; // Timers may be incorrect - BeamCount = 0; - CurrentBeam = 0; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful - PrismaticShieldTimer = 0; - FatalAttractionTimer = 60000; - FatalAttractionExplodeTimer = 70000; - ShriekTimer = 30000; - SaberTimer = 35000; - RandomYellTimer = 70000 + rand()%41 * 1000; - EnrageTimer = 600000; - ExplosionCount = 0; - - Enraged = false; - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, IN_PROGRESS); - - DoZoneInCombat(); - DoScriptText(SAY_AGGRO, me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, DONE); - - DoScriptText(SAY_DEATH, me); - } - - void TeleportPlayers() - { - uint32 random = rand()%7; - float X = TeleportPoint[random].x; - float Y = TeleportPoint[random].y; - float Z = TeleportPoint[random].z; - for (uint8 i = 0; i < 3; ++i) + boss_shahrazAI(Creature *c) : ScriptedAI(c) { - Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) - { - TargetGUID[i] = pUnit->GetGUID(); - pUnit->CastSpell(pUnit, SPELL_TELEPORT_VISUAL, true); - DoTeleportPlayer(pUnit, X, Y, Z, pUnit->GetOrientation()); - } - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !Enraged) - { - Enraged = true; - DoCast(me, SPELL_ENRAGE, true); - DoScriptText(SAY_ENRAGE, me); + pInstance = c->GetInstanceScript(); } - //Randomly cast one beam. - if (BeamTimer <= diff) + InstanceScript* pInstance; + + uint64 TargetGUID[3]; + uint32 BeamTimer; + uint32 BeamCount; + uint32 CurrentBeam; + uint32 PrismaticShieldTimer; + uint32 FatalAttractionTimer; + uint32 FatalAttractionExplodeTimer; + uint32 ShriekTimer; + uint32 SaberTimer; + uint32 RandomYellTimer; + uint32 EnrageTimer; + uint32 ExplosionCount; + + bool Enraged; + + void Reset() { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget || !pTarget->isAlive()) - return; + if (pInstance) + pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, NOT_STARTED); - BeamTimer = 9000; + for (uint8 i = 0; i<3; ++i) + TargetGUID[i] = 0; - switch(CurrentBeam) - { - case 0: - DoCast(pTarget, SPELL_BEAM_SINISTER); - break; - case 1: - DoCast(pTarget, SPELL_BEAM_VILE); - break; - case 2: - DoCast(pTarget, SPELL_BEAM_WICKED); - break; - case 3: - DoCast(pTarget, SPELL_BEAM_SINFUL); - break; - } - ++BeamCount; - uint32 Beam = CurrentBeam; - if (BeamCount > 3) - while (CurrentBeam == Beam) - CurrentBeam = rand()%3; - - } else BeamTimer -= diff; - - // Random Prismatic Shield every 15 seconds. - if (PrismaticShieldTimer <= diff) - { - uint32 random = rand()%6; - if (PrismaticAuras[random]) - DoCast(me, PrismaticAuras[random]); - PrismaticShieldTimer = 15000; - } else PrismaticShieldTimer -= diff; - - // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other. - if (FatalAttractionTimer <= diff) - { + BeamTimer = 20000; // Timers may be incorrect + BeamCount = 0; + CurrentBeam = 0; // 0 - Sinister, 1 - Vile, 2 - Wicked, 3 - Sinful + PrismaticShieldTimer = 0; + FatalAttractionTimer = 60000; + FatalAttractionExplodeTimer = 70000; + ShriekTimer = 30000; + SaberTimer = 35000; + RandomYellTimer = 70000 + rand()%41 * 1000; + EnrageTimer = 600000; ExplosionCount = 0; - TeleportPlayers(); + Enraged = false; + } - DoScriptText(RAND(SAY_SPELL2,SAY_SPELL3), me); - FatalAttractionExplodeTimer = 2000; - FatalAttractionTimer = 40000 + rand()%31 * 1000; - } else FatalAttractionTimer -= diff; - - if (FatalAttractionExplodeTimer <= diff) + void EnterCombat(Unit * /*who*/) { - // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later. - if (ExplosionCount < 3) + if (pInstance) + pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, IN_PROGRESS); + + DoZoneInCombat(); + DoScriptText(SAY_AGGRO, me); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_MOTHERSHAHRAZEVENT, DONE); + + DoScriptText(SAY_DEATH, me); + } + + void TeleportPlayers() + { + uint32 random = rand()%7; + float X = TeleportPoint[random].x; + float Y = TeleportPoint[random].y; + float Z = TeleportPoint[random].z; + for (uint8 i = 0; i < 3; ++i) { - for (uint8 i = 0; i < 3; ++i) + Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) { - Unit* pUnit = NULL; - if (TargetGUID[i]) - { - pUnit = Unit::GetUnit((*me), TargetGUID[i]); - if (pUnit) - pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true); - TargetGUID[i] = 0; - } + TargetGUID[i] = pUnit->GetGUID(); + pUnit->CastSpell(pUnit, SPELL_TELEPORT_VISUAL, true); + DoTeleportPlayer(pUnit, X, Y, Z, pUnit->GetOrientation()); } - - ++ExplosionCount; - FatalAttractionExplodeTimer = 1000; } - else + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !Enraged) { - FatalAttractionExplodeTimer = FatalAttractionTimer + 2000; - ExplosionCount = 0; + Enraged = true; + DoCast(me, SPELL_ENRAGE, true); + DoScriptText(SAY_ENRAGE, me); } - } else FatalAttractionExplodeTimer -= diff; - if (ShriekTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SILENCING_SHRIEK); - ShriekTimer = 25000+rand()%10 * 1000; - } else ShriekTimer -= diff; + //Randomly cast one beam. + if (BeamTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (!pTarget || !pTarget->isAlive()) + return; - if (SaberTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SABER_LASH); - SaberTimer = 25000+rand()%10 * 1000; - } else SaberTimer -= diff; + BeamTimer = 9000; - //Enrage - if (!me->HasAura(SPELL_BERSERK)) - if (EnrageTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - DoScriptText(SAY_ENRAGE, me); - } else EnrageTimer -= diff; + switch(CurrentBeam) + { + case 0: + DoCast(pTarget, SPELL_BEAM_SINISTER); + break; + case 1: + DoCast(pTarget, SPELL_BEAM_VILE); + break; + case 2: + DoCast(pTarget, SPELL_BEAM_WICKED); + break; + case 3: + DoCast(pTarget, SPELL_BEAM_SINFUL); + break; + } + ++BeamCount; + uint32 Beam = CurrentBeam; + if (BeamCount > 3) + while (CurrentBeam == Beam) + CurrentBeam = rand()%3; - //Random taunts - if (RandomYellTimer <= diff) - { - DoScriptText(RAND(SAY_TAUNT1,SAY_TAUNT2,SAY_TAUNT3), me); - RandomYellTimer = 60000 + rand()%91 * 1000; - } else RandomYellTimer -= diff; + } else BeamTimer -= diff; + + // Random Prismatic Shield every 15 seconds. + if (PrismaticShieldTimer <= diff) + { + uint32 random = rand()%6; + if (PrismaticAuras[random]) + DoCast(me, PrismaticAuras[random]); + PrismaticShieldTimer = 15000; + } else PrismaticShieldTimer -= diff; + + // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other. + if (FatalAttractionTimer <= diff) + { + ExplosionCount = 0; + + TeleportPlayers(); + + DoScriptText(RAND(SAY_SPELL2,SAY_SPELL3), me); + FatalAttractionExplodeTimer = 2000; + FatalAttractionTimer = 40000 + rand()%31 * 1000; + } else FatalAttractionTimer -= diff; + + if (FatalAttractionExplodeTimer <= diff) + { + // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later. + if (ExplosionCount < 3) + { + for (uint8 i = 0; i < 3; ++i) + { + Unit* pUnit = NULL; + if (TargetGUID[i]) + { + pUnit = Unit::GetUnit((*me), TargetGUID[i]); + if (pUnit) + pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true); + TargetGUID[i] = 0; + } + } + + ++ExplosionCount; + FatalAttractionExplodeTimer = 1000; + } + else + { + FatalAttractionExplodeTimer = FatalAttractionTimer + 2000; + ExplosionCount = 0; + } + } else FatalAttractionExplodeTimer -= diff; + + if (ShriekTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCING_SHRIEK); + ShriekTimer = 25000+rand()%10 * 1000; + } else ShriekTimer -= diff; + + if (SaberTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SABER_LASH); + SaberTimer = 25000+rand()%10 * 1000; + } else SaberTimer -= diff; + + //Enrage + if (!me->HasAura(SPELL_BERSERK)) + if (EnrageTimer <= diff) + { + DoCast(me, SPELL_BERSERK); + DoScriptText(SAY_ENRAGE, me); + } else EnrageTimer -= diff; + + //Random taunts + if (RandomYellTimer <= diff) + { + DoScriptText(RAND(SAY_TAUNT1,SAY_TAUNT2,SAY_TAUNT3), me); + RandomYellTimer = 60000 + rand()%91 * 1000; + } else RandomYellTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shahraz(Creature* pCreature) -{ - return new boss_shahrazAI (pCreature); -} void AddSC_boss_mother_shahraz() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_mother_shahraz"; - newscript->GetAI = &GetAI_boss_shahraz; - newscript->RegisterSelf(); + new boss_mother_shahraz(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 1482cb84bd2..2bde4116d38 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -100,593 +100,608 @@ static Position2d Coords[]= {450.4, 137.4}, {450.4, 168.3} }; - -struct npc_enslaved_soulAI : public ScriptedAI + class npc_enslaved_soul : public CreatureScript { - npc_enslaved_soulAI(Creature *c) : ScriptedAI(c) {} +public: + npc_enslaved_soul() : CreatureScript("npc_enslaved_soul") { } - uint64 ReliquaryGUID; - - void Reset() {ReliquaryGUID = 0;} - - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, ENSLAVED_SOUL_PASSIVE, true); - DoZoneInCombat(); + return new npc_enslaved_soulAI (pCreature); } - void JustDied(Unit *killer); -}; - -struct boss_reliquary_of_soulsAI : public ScriptedAI -{ - boss_reliquary_of_soulsAI(Creature *c) : ScriptedAI(c) + struct npc_enslaved_soulAI : public ScriptedAI { - pInstance = c->GetInstanceData(); - EssenceGUID = 0; - } + npc_enslaved_soulAI(Creature *c) : ScriptedAI(c) {} - ScriptedInstance* pInstance; + uint64 ReliquaryGUID; - uint64 EssenceGUID; + void Reset() {ReliquaryGUID = 0;} - uint32 Phase; - uint32 Counter; - uint32 Timer; - - uint32 SoulCount; - uint32 SoulDeathCount; - - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, NOT_STARTED); - - if (EssenceGUID) + void EnterCombat(Unit* /*who*/) { - if (Creature* Essence = Unit::GetCreature(*me, EssenceGUID)) - { - Essence->ForcedDespawn(); - } + DoCast(me, ENSLAVED_SOUL_PASSIVE, true); + DoZoneInCombat(); + } + + void JustDied(Unit * /*killer*/); + }; + +}; + class boss_reliquary_of_souls : public CreatureScript +{ +public: + boss_reliquary_of_souls() : CreatureScript("boss_reliquary_of_souls") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_reliquary_of_soulsAI (pCreature); + } + + struct boss_reliquary_of_soulsAI : public ScriptedAI + { + boss_reliquary_of_soulsAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); EssenceGUID = 0; } - Phase = 0; + InstanceScript* pInstance; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); - me->RemoveAurasDueToSpell(SPELL_SUBMERGE); - } + uint64 EssenceGUID; - void EnterCombat(Unit* who) - { - me->AddThreat(who, 10000.0f); - DoZoneInCombat(); - if (pInstance) - pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, IN_PROGRESS); + uint32 Phase; + uint32 Counter; + uint32 Timer; - Phase = 1; - Counter = 0; - Timer = 0; - } + uint32 SoulCount; + uint32 SoulDeathCount; - bool SummonSoul() - { - uint32 random = rand()%6; - float x = Coords[random].x; - float y = Coords[random].y; - Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); - if (!Soul) return false; - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + void Reset() { - CAST_AI(npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); - Soul->AI()->AttackStart(pTarget); - } else EnterEvadeMode(); - return true; - } + if (pInstance) + pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, NOT_STARTED); - void MergeThreatList(Creature *pTarget) - { - if (!pTarget) - return; - - std::list& m_threatlist = pTarget->getThreatManager().getThreatList(); - std::list::const_iterator itr = m_threatlist.begin(); - for (; itr != m_threatlist.end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit) + if (EssenceGUID) { - DoModifyThreatPercent(pUnit, -100); - float threat = pTarget->getThreatManager().getThreat(pUnit); - me->AddThreat(pUnit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences). + if (Creature* Essence = Unit::GetCreature(*me, EssenceGUID)) + { + Essence->ForcedDespawn(); + } + EssenceGUID = 0; + } + + Phase = 0; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + me->RemoveAurasDueToSpell(SPELL_SUBMERGE); + } + + void EnterCombat(Unit* who) + { + me->AddThreat(who, 10000.0f); + DoZoneInCombat(); + if (pInstance) + pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, IN_PROGRESS); + + Phase = 1; + Counter = 0; + Timer = 0; + } + + bool SummonSoul() + { + uint32 random = rand()%6; + float x = Coords[random].x; + float y = Coords[random].y; + Creature* Soul = me->SummonCreature(CREATURE_ENSLAVED_SOUL, x, y, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0); + if (!Soul) return false; + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + CAST_AI(npc_enslaved_soul::npc_enslaved_soulAI, Soul->AI())->ReliquaryGUID = me->GetGUID(); + Soul->AI()->AttackStart(pTarget); + } else EnterEvadeMode(); + return true; + } + + void MergeThreatList(Creature *pTarget) + { + if (!pTarget) + return; + + std::list& m_threatlist = pTarget->getThreatManager().getThreatList(); + std::list::const_iterator itr = m_threatlist.begin(); + for (; itr != m_threatlist.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit) + { + DoModifyThreatPercent(pUnit, -100); + float threat = pTarget->getThreatManager().getThreat(pUnit); + me->AddThreat(pUnit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences). + } } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!Phase) - return; - - if (me->getThreatManager().getThreatList().empty()) // Reset if event is begun and we don't have a threatlist + void JustDied(Unit* /*killer*/) { - EnterEvadeMode(); - return; + if (pInstance) + pInstance->SetData(DATA_RELIQUARYOFSOULSEVENT, DONE); } - Creature* Essence = NULL; - if (EssenceGUID) + void UpdateAI(const uint32 diff) { - Essence = Unit::GetCreature(*me, EssenceGUID); - if (!Essence) + if (!Phase) + return; + + if (me->getThreatManager().getThreatList().empty()) // Reset if event is begun and we don't have a threatlist { EnterEvadeMode(); return; } - } - if (Timer <= diff) - { - switch(Counter) + Creature* Essence = NULL; + if (EssenceGUID) { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); // I R ANNNGRRRY! - DoStartNoMovement(me); - Timer = 3000; - break; - case 1: - Timer = 2800; - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); // Release the cube - DoCast(me, SPELL_SUBMERGE); - DoStartNoMovement(me); - break; - case 2: - Timer = 5000; - if (Creature* Summon = DoSpawnCreature(23417+Phase, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)) + Essence = Unit::GetCreature(*me, EssenceGUID); + if (!Essence) { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); // Ribs: open - Summon->AI()->AttackStart(SelectUnit(SELECT_TARGET_TOPAGGRO, 0)); - EssenceGUID = Summon->GetGUID(); - DoStartNoMovement(me); - } else EnterEvadeMode(); - break; - case 3: - Timer = 1000; - if (Phase == 3) - { - if (!Essence->isAlive()) - DoCast(me, 7, true); - else return; + EnterEvadeMode(); + return; } - else + } + + if (Timer <= diff) + { + switch(Counter) { - if (Essence->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); // I R ANNNGRRRY! + DoStartNoMovement(me); + Timer = 3000; + break; + case 1: + Timer = 2800; + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE); // Release the cube + DoCast(me, SPELL_SUBMERGE); + DoStartNoMovement(me); + break; + case 2: + Timer = 5000; + if (Creature* Summon = DoSpawnCreature(23417+Phase, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0)) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); // Ribs: open + Summon->AI()->AttackStart(SelectUnit(SELECT_TARGET_TOPAGGRO, 0)); + EssenceGUID = Summon->GetGUID(); + DoStartNoMovement(me); + } else EnterEvadeMode(); + break; + case 3: + Timer = 1000; + if (Phase == 3) + { + if (!Essence->isAlive()) + DoCast(me, 7, true); + else return; + } + else + { + if (Essence->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + MergeThreatList(Essence); + Essence->RemoveAllAuras(); + Essence->DeleteThreatList(); + Essence->GetMotionMaster()->MoveFollow(me,0.0f,0.0f); + } else return; + } + break; + case 4: + Timer = 1500; + if (Essence->IsWithinDistInMap(me, 10)) + { + Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); //rotate and disappear + Timer = 2000; + me->RemoveAurasDueToSpell(SPELL_SUBMERGE); + } + else { MergeThreatList(Essence); Essence->RemoveAllAuras(); Essence->DeleteThreatList(); - Essence->GetMotionMaster()->MoveFollow(me,0.0f,0.0f); - } else return; - } - break; - case 4: - Timer = 1500; - if (Essence->IsWithinDistInMap(me, 10)) - { - Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE,374); //rotate and disappear - Timer = 2000; - me->RemoveAurasDueToSpell(SPELL_SUBMERGE); - } - else - { - MergeThreatList(Essence); - Essence->RemoveAllAuras(); - Essence->DeleteThreatList(); - Essence->GetMotionMaster()->MoveFollow(me, 0, 0); + Essence->GetMotionMaster()->MoveFollow(me, 0, 0); + return; + } + break; + case 5: + if (Phase == 1) + { + DoScriptText(SUFF_SAY_AFTER, Essence); + } + else + { + DoScriptText(DESI_SAY_AFTER, Essence); + } + Essence->ForcedDespawn(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); + EssenceGUID = 0; + SoulCount = 0; + SoulDeathCount = 0; + Timer = 3000; + break; + case 6: + if (SoulCount < NUMBER_ENSLAVED_SOUL) + { + if (SummonSoul()) + ++SoulCount; + Timer = 500; + return; + } + break; + case 7: + if (SoulDeathCount >= SoulCount) + { + Counter = 1; + ++Phase; + Timer = 5000; + } return; + default: + break; } - break; - case 5: - if (Phase == 1) - { - DoScriptText(SUFF_SAY_AFTER, Essence); - } - else - { - DoScriptText(DESI_SAY_AFTER, Essence); - } - Essence->ForcedDespawn(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE,0); - EssenceGUID = 0; - SoulCount = 0; - SoulDeathCount = 0; - Timer = 3000; - break; - case 6: - if (SoulCount < NUMBER_ENSLAVED_SOUL) - { - if (SummonSoul()) - ++SoulCount; - Timer = 500; - return; - } - break; - case 7: - if (SoulDeathCount >= SoulCount) - { - Counter = 1; - ++Phase; - Timer = 5000; - } - return; - default: - break; - } - ++Counter; - } else Timer -= diff; - } + ++Counter; + } else Timer -= diff; + } + }; + }; - -struct boss_essence_of_sufferingAI : public ScriptedAI -{ - boss_essence_of_sufferingAI(Creature *c) : ScriptedAI(c) {} - - uint64 StatAuraGUID; - - uint32 AggroYellTimer; - uint32 FixateTimer; - uint32 EnrageTimer; - uint32 SoulDrainTimer; - uint32 AuraTimer; - - void Reset() - { - StatAuraGUID = 0; - - AggroYellTimer = 5000; - FixateTimer = 8000; - EnrageTimer = 30000; - SoulDrainTimer = 45000; - AuraTimer = 5000; - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (damage >= me->GetHealth()) - { - damage = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->Yell(SUFF_SAY_RECAP,LANG_UNIVERSAL,0); - DoScriptText(SUFF_SAY_RECAP, me); - } - } - - void EnterCombat(Unit * /*who*/) - { - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - { - DoScriptText(SUFF_SAY_FREED, me); - DoZoneInCombat(); - DoCast(me, AURA_OF_SUFFERING, true); // linked aura need core support - DoCast(me, ESSENCE_OF_SUFFERING_PASSIVE, true); - DoCast(me, ESSENCE_OF_SUFFERING_PASSIVE2, true); - } - else return; - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SUFF_SAY_SLAY1,SUFF_SAY_SLAY2,SUFF_SAY_SLAY3), me); - } - - void CastFixate() - { - std::list& m_threatlist = me->getThreatManager().getThreatList(); - if (m_threatlist.empty()) - return; // No point continuing if empty threatlist. - std::list targets; - std::list::const_iterator itr = m_threatlist.begin(); - for (; itr != m_threatlist.end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players - targets.push_back(pUnit); - } - if (targets.empty()) - return; // No targets added for some reason. No point continuing. - targets.sort(Trinity::ObjectDistanceOrderPred(me)); // Sort players by distance. - targets.resize(1); // Only need closest target. - Unit *pTarget = targets.front(); // Get the first target. - if (pTarget) - pTarget->CastSpell(me, SPELL_FIXATE_TAUNT, true); - DoResetThreat(); - me->AddThreat(pTarget,1000000); - } - - void UpdateAI(const uint32 diff) - { - if (me->isInCombat()) - { - //Supposed to be cast on nearest target - if (FixateTimer <= diff) - { - CastFixate(); - FixateTimer = 5000; - if (!(rand()%16)) - { - DoScriptText(SUFF_SAY_AGGRO, me); - } - } else FixateTimer -= diff; - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - if (EnrageTimer <= diff) - { - DoCast(me, SPELL_ENRAGE); - EnrageTimer = 60000; - DoScriptText(SUFF_EMOTE_ENRAGE, me); - } else EnrageTimer -= diff; - - if (SoulDrainTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SOUL_DRAIN); - SoulDrainTimer = 60000; - } else SoulDrainTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_essence_of_desireAI : public ScriptedAI -{ - boss_essence_of_desireAI(Creature *c) : ScriptedAI(c) {} - - uint32 RuneShieldTimer; - uint32 DeadenTimer; - uint32 SoulShockTimer; - - void Reset() - { - RuneShieldTimer = 60000; - DeadenTimer = 30000; - SoulShockTimer = 5000; - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CONFUSE, true); - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by == me) - return; - - if (damage >= me->GetHealth()) - { - damage = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SUFF_SAY_RECAP, me); - } - else - { - int32 bp0 = damage / 2; - me->CastCustomSpell(done_by, AURA_OF_DESIRE_DAMAGE, &bp0, NULL, NULL, true); - } - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) - for (uint8 i = 0; i < 3; ++i) - if (spell->Effect[i] == SPELL_EFFECT_INTERRUPT_CAST) - if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK - || me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN) - me->InterruptSpell(CURRENT_GENERIC_SPELL, false); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(DESI_SAY_FREED, me); - DoZoneInCombat(); - DoCast(me, AURA_OF_DESIRE, true); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(DESI_SAY_SLAY1,DESI_SAY_SLAY2,DESI_SAY_SLAY3), me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (RuneShieldTimer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_RUNE_SHIELD, true); - SoulShockTimer += 2000; - DeadenTimer += 2000; - RuneShieldTimer = 60000; - } else RuneShieldTimer -= diff; - - if (SoulShockTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SOUL_SHOCK); - SoulShockTimer = 5000; - } else SoulShockTimer -= diff; - - if (DeadenTimer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_DEADEN); - DeadenTimer = 25000 + rand()%10000; - if (!(rand()%2)) - { - DoScriptText(DESI_SAY_SPEC, me); - } - } else DeadenTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_essence_of_angerAI : public ScriptedAI -{ - boss_essence_of_angerAI(Creature *c) : ScriptedAI(c) {} - - uint64 AggroTargetGUID; - - uint32 CheckTankTimer; - uint32 SoulScreamTimer; - uint32 SpiteTimer; - - std::list SpiteTargetGUID; - - bool CheckedAggro; - - void Reset() - { - AggroTargetGUID = 0; - - CheckTankTimer = 5000; - SoulScreamTimer = 10000; - SpiteTimer = 30000; - - SpiteTargetGUID.clear(); - - CheckedAggro = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(ANGER_SAY_FREED,ANGER_SAY_FREED2), me); - - DoZoneInCombat(); - DoCast(me, AURA_OF_ANGER, true); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(ANGER_SAY_DEATH, me); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(ANGER_SAY_SLAY1,ANGER_SAY_SLAY2), me); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!CheckedAggro) - { - AggroTargetGUID = me->getVictim()->GetGUID(); - CheckedAggro = true; - } - - if (CheckTankTimer <= diff) - { - if (me->getVictim()->GetGUID() != AggroTargetGUID) - { - DoScriptText(ANGER_SAY_BEFORE, me); - DoCast(me, SPELL_SELF_SEETHE, true); - AggroTargetGUID = me->getVictim()->GetGUID(); - } - CheckTankTimer = 2000; - } else CheckTankTimer -= diff; - - if (SoulScreamTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SOUL_SCREAM); - SoulScreamTimer = 9000 + rand()%2000; - if (!(rand()%3)) - { - DoScriptText(ANGER_SAY_SPEC, me); - } - } else SoulScreamTimer -= diff; - - if (SpiteTimer <= diff) - { - DoCast(me, SPELL_SPITE_TARGET); - SpiteTimer = 30000; - DoScriptText(ANGER_SAY_SPEC, me); - } else SpiteTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -void npc_enslaved_soulAI::JustDied(Unit * /*killer*/) + void npc_enslaved_soul::npc_enslaved_soulAI::JustDied(Unit * /*killer*/) { if (ReliquaryGUID) if (Creature *Reliquary = (Unit::GetCreature((*me), ReliquaryGUID))) - ++(CAST_AI(boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount); + ++(CAST_AI(boss_reliquary_of_souls::boss_reliquary_of_soulsAI, Reliquary->AI())->SoulDeathCount); DoCast(me, SPELL_SOUL_RELEASE, true); } - -CreatureAI* GetAI_boss_reliquary_of_souls(Creature* pCreature) + class boss_essence_of_suffering : public CreatureScript { - return new boss_reliquary_of_soulsAI (pCreature); -} +public: + boss_essence_of_suffering() : CreatureScript("boss_essence_of_suffering") { } -CreatureAI* GetAI_boss_essence_of_suffering(Creature* pCreature) -{ - return new boss_essence_of_sufferingAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_essence_of_sufferingAI (pCreature); + } -CreatureAI* GetAI_boss_essence_of_desire(Creature* pCreature) -{ - return new boss_essence_of_desireAI (pCreature); -} + struct boss_essence_of_sufferingAI : public ScriptedAI + { + boss_essence_of_sufferingAI(Creature *c) : ScriptedAI(c) {} -CreatureAI* GetAI_boss_essence_of_anger(Creature* pCreature) -{ - return new boss_essence_of_angerAI (pCreature); -} + uint64 StatAuraGUID; -CreatureAI* GetAI_npc_enslaved_soul(Creature* pCreature) + uint32 AggroYellTimer; + uint32 FixateTimer; + uint32 EnrageTimer; + uint32 SoulDrainTimer; + uint32 AuraTimer; + + void Reset() + { + StatAuraGUID = 0; + + AggroYellTimer = 5000; + FixateTimer = 8000; + EnrageTimer = 30000; + SoulDrainTimer = 45000; + AuraTimer = 5000; + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (damage >= me->GetHealth()) + { + damage = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->Yell(SUFF_SAY_RECAP,LANG_UNIVERSAL,0); + DoScriptText(SUFF_SAY_RECAP, me); + } + } + + void EnterCombat(Unit * /*who*/) + { + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + { + DoScriptText(SUFF_SAY_FREED, me); + DoZoneInCombat(); + DoCast(me, AURA_OF_SUFFERING, true); // linked aura need core support + DoCast(me, ESSENCE_OF_SUFFERING_PASSIVE, true); + DoCast(me, ESSENCE_OF_SUFFERING_PASSIVE2, true); + } + else return; + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SUFF_SAY_SLAY1,SUFF_SAY_SLAY2,SUFF_SAY_SLAY3), me); + } + + void CastFixate() + { + std::list& m_threatlist = me->getThreatManager().getThreatList(); + if (m_threatlist.empty()) + return; // No point continuing if empty threatlist. + std::list targets; + std::list::const_iterator itr = m_threatlist.begin(); + for (; itr != m_threatlist.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players + targets.push_back(pUnit); + } + if (targets.empty()) + return; // No targets added for some reason. No point continuing. + targets.sort(Trinity::ObjectDistanceOrderPred(me)); // Sort players by distance. + targets.resize(1); // Only need closest target. + Unit *pTarget = targets.front(); // Get the first target. + if (pTarget) + pTarget->CastSpell(me, SPELL_FIXATE_TAUNT, true); + DoResetThreat(); + me->AddThreat(pTarget,1000000); + } + + void UpdateAI(const uint32 diff) + { + if (me->isInCombat()) + { + //Supposed to be cast on nearest target + if (FixateTimer <= diff) + { + CastFixate(); + FixateTimer = 5000; + if (!(rand()%16)) + { + DoScriptText(SUFF_SAY_AGGRO, me); + } + } else FixateTimer -= diff; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (EnrageTimer <= diff) + { + DoCast(me, SPELL_ENRAGE); + EnrageTimer = 60000; + DoScriptText(SUFF_EMOTE_ENRAGE, me); + } else EnrageTimer -= diff; + + if (SoulDrainTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SOUL_DRAIN); + SoulDrainTimer = 60000; + } else SoulDrainTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_essence_of_desire : public CreatureScript { - return new npc_enslaved_soulAI (pCreature); -} +public: + boss_essence_of_desire() : CreatureScript("boss_essence_of_desire") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_essence_of_desireAI (pCreature); + } + + struct boss_essence_of_desireAI : public ScriptedAI + { + boss_essence_of_desireAI(Creature *c) : ScriptedAI(c) {} + + uint32 RuneShieldTimer; + uint32 DeadenTimer; + uint32 SoulShockTimer; + + void Reset() + { + RuneShieldTimer = 60000; + DeadenTimer = 30000; + SoulShockTimer = 5000; + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_CONFUSE, true); + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by == me) + return; + + if (damage >= me->GetHealth()) + { + damage = 0; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoScriptText(SUFF_SAY_RECAP, me); + } + else + { + int32 bp0 = damage / 2; + me->CastCustomSpell(done_by, AURA_OF_DESIRE_DAMAGE, &bp0, NULL, NULL, true); + } + } + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) + for (uint8 i = 0; i < 3; ++i) + if (spell->Effect[i] == SPELL_EFFECT_INTERRUPT_CAST) + if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_SOUL_SHOCK + || me->GetCurrentSpell(CURRENT_GENERIC_SPELL)->m_spellInfo->Id == SPELL_DEADEN) + me->InterruptSpell(CURRENT_GENERIC_SPELL, false); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(DESI_SAY_FREED, me); + DoZoneInCombat(); + DoCast(me, AURA_OF_DESIRE, true); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(DESI_SAY_SLAY1,DESI_SAY_SLAY2,DESI_SAY_SLAY3), me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (RuneShieldTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_RUNE_SHIELD, true); + SoulShockTimer += 2000; + DeadenTimer += 2000; + RuneShieldTimer = 60000; + } else RuneShieldTimer -= diff; + + if (SoulShockTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SOUL_SHOCK); + SoulShockTimer = 5000; + } else SoulShockTimer -= diff; + + if (DeadenTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_DEADEN); + DeadenTimer = 25000 + rand()%10000; + if (!(rand()%2)) + { + DoScriptText(DESI_SAY_SPEC, me); + } + } else DeadenTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_essence_of_anger : public CreatureScript +{ +public: + boss_essence_of_anger() : CreatureScript("boss_essence_of_anger") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_essence_of_angerAI (pCreature); + } + + struct boss_essence_of_angerAI : public ScriptedAI + { + boss_essence_of_angerAI(Creature *c) : ScriptedAI(c) {} + + uint64 AggroTargetGUID; + + uint32 CheckTankTimer; + uint32 SoulScreamTimer; + uint32 SpiteTimer; + + std::list SpiteTargetGUID; + + bool CheckedAggro; + + void Reset() + { + AggroTargetGUID = 0; + + CheckTankTimer = 5000; + SoulScreamTimer = 10000; + SpiteTimer = 30000; + + SpiteTargetGUID.clear(); + + CheckedAggro = false; + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(ANGER_SAY_FREED,ANGER_SAY_FREED2), me); + + DoZoneInCombat(); + DoCast(me, AURA_OF_ANGER, true); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(ANGER_SAY_DEATH, me); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(ANGER_SAY_SLAY1,ANGER_SAY_SLAY2), me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!CheckedAggro) + { + AggroTargetGUID = me->getVictim()->GetGUID(); + CheckedAggro = true; + } + + if (CheckTankTimer <= diff) + { + if (me->getVictim()->GetGUID() != AggroTargetGUID) + { + DoScriptText(ANGER_SAY_BEFORE, me); + DoCast(me, SPELL_SELF_SEETHE, true); + AggroTargetGUID = me->getVictim()->GetGUID(); + } + CheckTankTimer = 2000; + } else CheckTankTimer -= diff; + + if (SoulScreamTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SOUL_SCREAM); + SoulScreamTimer = 9000 + rand()%2000; + if (!(rand()%3)) + { + DoScriptText(ANGER_SAY_SPEC, me); + } + } else SoulScreamTimer -= diff; + + if (SpiteTimer <= diff) + { + DoCast(me, SPELL_SPITE_TARGET); + SpiteTimer = 30000; + DoScriptText(ANGER_SAY_SPEC, me); + } else SpiteTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + + + + + + + void AddSC_boss_reliquary_of_souls() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_reliquary_of_souls"; - newscript->GetAI = &GetAI_boss_reliquary_of_souls; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_essence_of_suffering"; - newscript->GetAI = &GetAI_boss_essence_of_suffering; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_essence_of_desire"; - newscript->GetAI = &GetAI_boss_essence_of_desire; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_essence_of_anger"; - newscript->GetAI = &GetAI_boss_essence_of_anger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_enslaved_soul"; - newscript->GetAI = &GetAI_npc_enslaved_soul; - newscript->RegisterSelf(); + new boss_reliquary_of_souls(); + new boss_essence_of_suffering(); + new boss_essence_of_desire(); + new boss_essence_of_anger(); + new npc_enslaved_soul(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 937f52542be..f03398c3838 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -106,768 +106,773 @@ static Location BrokenWP[]= #define CREATURE_BROKEN 23319 const uint32 spawnEntries[4]= { 23523, 23318, 23524 }; - -struct mob_ashtongue_channelerAI : public ScriptedAI + class mob_ashtongue_channeler : public CreatureScript { - mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} +public: + mob_ashtongue_channeler() : CreatureScript("mob_ashtongue_channeler") { } - uint64 ShadeGUID; + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_ashtongue_channelerAI (pCreature); + } + + struct mob_ashtongue_channelerAI : public ScriptedAI + { + mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} + + uint64 ShadeGUID; + + void Reset() {} + void JustDied(Unit* /*killer*/); + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) {} + }; - void Reset() {} - void JustDied(Unit* /*killer*/); - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) {} }; - -struct mob_ashtongue_sorcererAI : public ScriptedAI + class mob_ashtongue_sorcerer : public CreatureScript { - mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} +public: + mob_ashtongue_sorcerer() : CreatureScript("mob_ashtongue_sorcerer") { } - uint64 ShadeGUID; - uint32 CheckTimer; - bool StartBanishing; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - StartBanishing = false; - CheckTimer = 5000; + return new mob_ashtongue_sorcererAI (pCreature); } - void JustDied(Unit* /*killer*/); - void EnterCombat(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) + struct mob_ashtongue_sorcererAI : public ScriptedAI { - if (StartBanishing) - return; + mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} - if (CheckTimer <= diff) + uint64 ShadeGUID; + uint32 CheckTimer; + bool StartBanishing; + + void Reset() { - Creature* Shade = Unit::GetCreature((*me), ShadeGUID); - if (Shade && Shade->isAlive() && me->isAlive()) - { - if (me->IsWithinDist(Shade, 20,false)) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL, true); - DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL_2, true); - - StartBanishing = true; - } - } - CheckTimer = 2000; - } else CheckTimer -= diff; - } -}; - -struct boss_shade_of_akamaAI : public ScriptedAI -{ - boss_shade_of_akamaAI(Creature* c) : ScriptedAI(c), summons(me) - { - pInstance = c->GetInstanceData(); - AkamaGUID = pInstance ? pInstance->GetData64(DATA_AKAMA_SHADE) : 0; - me->setActive(true);//if view distance is too low - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - } - - ScriptedInstance* pInstance; - - std::list Channelers; - std::list Sorcerers; - uint64 AkamaGUID; - - uint32 SorcererCount; - uint32 DeathCount; - - uint32 ReduceHealthTimer; - uint32 SummonTimer; - uint32 ResetTimer; - uint32 DefenderTimer; // They are on a flat 15 second timer, independant of the other summon Creature timer. - - bool IsBanished; - bool HasKilledAkama; - bool reseting; - bool GridSearcherSucceeded; - bool HasKilledAkamaAndReseting; - SummonList summons; - - void Reset() - { - reseting = true; - HasKilledAkamaAndReseting = false; - - GridSearcherSucceeded = false; - - Sorcerers.clear(); - summons.DespawnAll();//despawn all adds - - if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID)) - { - Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//turn gossip on so players can restart the event - if (Akama->isDead()) - { - Akama->Respawn();//respawn akama if dead - Akama->AI()->EnterEvadeMode(); - } + StartBanishing = false; + CheckTimer = 5000; } - SorcererCount = 0; - DeathCount = 0; - SummonTimer = 10000; - ReduceHealthTimer = 0; - ResetTimer = 60000; - DefenderTimer = 15000; - - IsBanished = true; - HasKilledAkama = false; - - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //me->GetMotionMaster()->Clear(); - //me->GetMotionMaster()->MoveIdle(); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); - - if (pInstance) - pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED); - - reseting = false; - } - void JustDied(Unit* /*killer*/) - { - summons.DespawnAll(); - } - void JustSummoned(Creature *summon) - { - if (summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) - summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature *summon) - { - if (summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) - summons.Despawn(summon); - } - - void MoveInLineOfSight(Unit * /*who*/) - { - if (!GridSearcherSucceeded) + void JustDied(Unit* /*killer*/); + void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 diff) { - FindChannelers(); + if (StartBanishing) + return; - if (!Channelers.empty()) + if (CheckTimer <= diff) { - for (std::list::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + Creature* Shade = Unit::GetCreature((*me), ShadeGUID); + if (Shade && Shade->isAlive() && me->isAlive()) { - Creature* Channeler = (Unit::GetCreature(*me, *itr)); - if (Channeler) + if (me->IsWithinDist(Shade, 20,false)) { - if (Channeler->isDead()) - { - Channeler->RemoveCorpse(); - Channeler->Respawn(); - } + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL, true); + DoCast(Shade, SPELL_SHADE_SOUL_CHANNEL_2, true); - Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true); - Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true); - Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - GridSearcherSucceeded = true; + StartBanishing = true; } } - } else sLog.outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); + CheckTimer = 2000; + } else CheckTimer -= diff; } + }; + +}; + class boss_shade_of_akama : public CreatureScript +{ +public: + boss_shade_of_akama() : CreatureScript("boss_shade_of_akama") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_shade_of_akamaAI (pCreature); } - void AttackStart(Unit* who) + struct boss_shade_of_akamaAI : public ScriptedAI { - if (!who || IsBanished) return; - - if (who->isTargetableForAttack() && who != me) - DoStartMovement(who); - } - - void IncrementDeathCount(uint64 guid = 0) // If guid is set, will remove it from list of sorcerer - { - if (reseting) - return; - - sLog.outDebug("TSCR: Increasing Death Count for Shade of Akama encounter"); - ++DeathCount; - me->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2); - if (guid) + boss_shade_of_akamaAI(Creature* c) : ScriptedAI(c), summons(me) { - if (Sorcerers.empty()) - sLog.outError("SD2 ERROR: Shade of Akama - attempt to remove guid %u from Sorcerers list but list is already empty", guid); - else Sorcerers.remove(guid); + pInstance = c->GetInstanceScript(); + AkamaGUID = pInstance ? pInstance->GetData64(DATA_AKAMA_SHADE) : 0; + me->setActive(true);//if view distance is too low + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } - } - void SummonCreature() - { - uint32 random = rand()%2; - float X = SpawnLocations[random].x; - float Y = SpawnLocations[random].y; - // max of 6 sorcerers can be summoned - if ((rand()%3 == 0) && (DeathCount > 0) && (SorcererCount < 7)) + InstanceScript* pInstance; + + std::list Channelers; + std::list Sorcerers; + uint64 AkamaGUID; + + uint32 SorcererCount; + uint32 DeathCount; + + uint32 ReduceHealthTimer; + uint32 SummonTimer; + uint32 ResetTimer; + uint32 DefenderTimer; // They are on a flat 15 second timer, independant of the other summon Creature timer. + + bool IsBanished; + bool HasKilledAkama; + bool reseting; + bool GridSearcherSucceeded; + bool HasKilledAkamaAndReseting; + SummonList summons; + + void Reset() { - Creature* Sorcerer = me->SummonCreature(CREATURE_SORCERER, X, Y, Z_SPAWN, 0, TEMPSUMMON_DEAD_DESPAWN, 0); - if (Sorcerer) + reseting = true; + HasKilledAkamaAndReseting = false; + + GridSearcherSucceeded = false; + + Sorcerers.clear(); + summons.DespawnAll();//despawn all adds + + if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID)) { - CAST_AI(mob_ashtongue_sorcererAI, Sorcerer->AI())->ShadeGUID = me->GetGUID(); - Sorcerer->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Sorcerer->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - Sorcerer->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - Sorcerers.push_back(Sorcerer->GetGUID()); - --DeathCount; - ++SorcererCount; + Akama->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//turn gossip on so players can restart the event + if (Akama->isDead()) + { + Akama->Respawn();//respawn akama if dead + Akama->AI()->EnterEvadeMode(); + } + } + SorcererCount = 0; + DeathCount = 0; + + SummonTimer = 10000; + ReduceHealthTimer = 0; + ResetTimer = 60000; + DefenderTimer = 15000; + + IsBanished = true; + HasKilledAkama = false; + + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //me->GetMotionMaster()->Clear(); + //me->GetMotionMaster()->MoveIdle(); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN); + + if (pInstance) + pInstance->SetData(DATA_SHADEOFAKAMAEVENT, NOT_STARTED); + + reseting = false; + } + void JustDied(Unit* /*killer*/) + { + summons.DespawnAll(); + } + void JustSummoned(Creature *summon) + { + if (summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) + { + if (summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) + summons.Despawn(summon); + } + + void MoveInLineOfSight(Unit * /*who*/) + { + if (!GridSearcherSucceeded) + { + FindChannelers(); + + if (!Channelers.empty()) + { + for (std::list::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + { + Creature* Channeler = (Unit::GetCreature(*me, *itr)); + if (Channeler) + { + if (Channeler->isDead()) + { + Channeler->RemoveCorpse(); + Channeler->Respawn(); + } + + Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true); + Channeler->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL_2, true); + Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + GridSearcherSucceeded = true; + } + } + } else sLog.outError("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly"); } } - else + + void AttackStart(Unit* who) { - for (uint8 i = 0; i < 3; ++i) + if (!who || IsBanished) return; + + if (who->isTargetableForAttack() && who != me) + DoStartMovement(who); + } + + void IncrementDeathCount(uint64 guid = 0) // If guid is set, will remove it from list of sorcerer + { + if (reseting) + return; + + sLog.outDebug("TSCR: Increasing Death Count for Shade of Akama encounter"); + ++DeathCount; + me->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2); + if (guid) { - Creature* Spawn = me->SummonCreature(spawnEntries[i], X, Y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); - if (Spawn) + if (Sorcerers.empty()) + sLog.outError("SD2 ERROR: Shade of Akama - attempt to remove guid %u from Sorcerers list but list is already empty", guid); + else Sorcerers.remove(guid); + } + } + + void SummonCreature() + { + uint32 random = rand()%2; + float X = SpawnLocations[random].x; + float Y = SpawnLocations[random].y; + // max of 6 sorcerers can be summoned + if ((rand()%3 == 0) && (DeathCount > 0) && (SorcererCount < 7)) + { + Creature* Sorcerer = me->SummonCreature(CREATURE_SORCERER, X, Y, Z_SPAWN, 0, TEMPSUMMON_DEAD_DESPAWN, 0); + if (Sorcerer) { - Spawn->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - Spawn->GetMotionMaster()->MovePoint(0, AGGRO_X, AGGRO_Y, AGGRO_Z); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - Spawn->AI()->AttackStart(pTarget); + CAST_AI(mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI, Sorcerer->AI())->ShadeGUID = me->GetGUID(); + Sorcerer->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Sorcerer->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + Sorcerer->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + Sorcerers.push_back(Sorcerer->GetGUID()); + --DeathCount; + ++SorcererCount; + } + } + else + { + for (uint8 i = 0; i < 3; ++i) + { + Creature* Spawn = me->SummonCreature(spawnEntries[i], X, Y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); + if (Spawn) + { + Spawn->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + Spawn->GetMotionMaster()->MovePoint(0, AGGRO_X, AGGRO_Y, AGGRO_Z); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + Spawn->AI()->AttackStart(pTarget); + } } } } - } - void FindChannelers() - { - std::list ChannelerList; - me->GetCreatureListWithEntryInGrid(ChannelerList,CREATURE_CHANNELER,50.0f); - - if (!ChannelerList.empty()) + void FindChannelers() { - for (std::list::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) + std::list ChannelerList; + me->GetCreatureListWithEntryInGrid(ChannelerList,CREATURE_CHANNELER,50.0f); + + if (!ChannelerList.empty()) { - CAST_AI(mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID(); - Channelers.push_back((*itr)->GetGUID()); - sLog.outDebug("TSCR: Shade of Akama Grid Search found channeler %u. Adding to list", (*itr)->GetGUID()); + for (std::list::const_iterator itr = ChannelerList.begin(); itr != ChannelerList.end(); ++itr) + { + CAST_AI(mob_ashtongue_channeler::mob_ashtongue_channelerAI, (*itr)->AI())->ShadeGUID = me->GetGUID(); + Channelers.push_back((*itr)->GetGUID()); + sLog.outDebug("TSCR: Shade of Akama Grid Search found channeler %u. Adding to list", (*itr)->GetGUID()); + } } - } - else sLog.outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); - } - - void SetSelectableChannelers() - { - if (Channelers.empty()) - { - sLog.outError("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); - return; + else sLog.outError("SD2 ERROR: Grid Search was unable to find any channelers. Shade of Akama encounter will be buggy"); } - for (std::list::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) - if (Creature* Channeler = (Unit::GetCreature(*me, *itr))) - Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - return; - - if (IsBanished) + void SetSelectableChannelers() { - // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check - if (me->getThreatManager().getThreatList().size() < 2) + if (Channelers.empty()) { - EnterEvadeMode(); + sLog.outError("SD2 ERROR: Channeler List is empty, Shade of Akama encounter will be buggy"); return; } - if (DefenderTimer <= diff) + for (std::list::const_iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr) + if (Creature* Channeler = (Unit::GetCreature(*me, *itr))) + Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void SetAkamaGUID(uint64 guid) { AkamaGUID = guid; } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) + return; + + if (IsBanished) { - uint32 ran = rand()%2; - Creature* Defender = me->SummonCreature(CREATURE_DEFENDER, SpawnLocations[ran].x, SpawnLocations[ran].y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); - if (Defender) + // Akama is set in the threatlist so when we reset, we make sure that he is not included in our check + if (me->getThreatManager().getThreatList().size() < 2) + { + EnterEvadeMode(); + return; + } + + if (DefenderTimer <= diff) + { + uint32 ran = rand()%2; + Creature* Defender = me->SummonCreature(CREATURE_DEFENDER, SpawnLocations[ran].x, SpawnLocations[ran].y, Z_SPAWN, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000); + if (Defender) + { + Defender->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + bool move = true; + if (AkamaGUID) + { + if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID)) + { + float x, y, z; + Akama->GetPosition(x,y,z); + // They move towards AKama + Defender->GetMotionMaster()->MovePoint(0, x, y, z); + Defender->AI()->AttackStart(Akama); + } else move = false; + } else move = false; + if (!move) + Defender->GetMotionMaster()->MovePoint(0, AKAMA_X, AKAMA_Y, AKAMA_Z); + } + DefenderTimer = 15000; + } else DefenderTimer -= diff; + + if (SummonTimer <= diff) + { + SummonCreature(); + SummonTimer = 35000; + } else SummonTimer -= diff; + + if (DeathCount >= 6) { - Defender->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - bool move = true; if (AkamaGUID) { - if (Creature* Akama = Unit::GetCreature(*me, AkamaGUID)) + Creature* Akama = Unit::GetCreature((*me), AkamaGUID); + if (Akama && Akama->isAlive()) { - float x, y, z; - Akama->GetPosition(x,y,z); - // They move towards AKama - Defender->GetMotionMaster()->MovePoint(0, x, y, z); - Defender->AI()->AttackStart(Akama); - } else move = false; - } else move = false; - if (!move) - Defender->GetMotionMaster()->MovePoint(0, AKAMA_X, AKAMA_Y, AKAMA_Z); - } - DefenderTimer = 15000; - } else DefenderTimer -= diff; - - if (SummonTimer <= diff) - { - SummonCreature(); - SummonTimer = 35000; - } else SummonTimer -= diff; - - if (DeathCount >= 6) - { - if (AkamaGUID) - { - Creature* Akama = Unit::GetCreature((*me), AkamaGUID); - if (Akama && Akama->isAlive()) - { - IsBanished = false; - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveChase(Akama); - Akama->GetMotionMaster()->Clear(); - // Shade should move to Akama, not the other way around - Akama->GetMotionMaster()->MoveIdle(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - // Crazy amount of threat - me->AddThreat(Akama, 10000000.0f); - Akama->AddThreat(me, 10000000.0f); - me->Attack(Akama, true); - Akama->Attack(me, true); + IsBanished = false; + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveChase(Akama); + Akama->GetMotionMaster()->Clear(); + // Shade should move to Akama, not the other way around + Akama->GetMotionMaster()->MoveIdle(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + // Crazy amount of threat + me->AddThreat(Akama, 10000000.0f); + Akama->AddThreat(me, 10000000.0f); + me->Attack(Akama, true); + Akama->Attack(me, true); + } } } } - } - else // No longer banished, let's fight Akama now - { - if (ReduceHealthTimer <= diff) + else // No longer banished, let's fight Akama now { - if (AkamaGUID) + if (ReduceHealthTimer <= diff) { - Creature* Akama = Unit::GetCreature((*me), AkamaGUID); - if (Akama && Akama->isAlive()) + if (AkamaGUID) { - //10 % less health every few seconds. - me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - ReduceHealthTimer = 12000; + Creature* Akama = Unit::GetCreature((*me), AkamaGUID); + if (Akama && Akama->isAlive()) + { + //10 % less health every few seconds. + me->DealDamage(Akama, Akama->GetMaxHealth()/10, NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + ReduceHealthTimer = 12000; + } } - } - } else ReduceHealthTimer -= diff; + } else ReduceHealthTimer -= diff; - if (HasKilledAkama) - { - if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug + if (HasKilledAkama) { - HasKilledAkamaAndReseting = true; - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(); - //me->SetHealth(me->GetMaxHealth()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->GetMotionMaster()->MoveTargetedHome(); + if (!HasKilledAkamaAndReseting)//do not let players kill Shade if Akama is dead and Shade is waiting for ResetTimer!! event would bug + { + HasKilledAkamaAndReseting = true; + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(); + //me->SetHealth(me->GetMaxHealth()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->GetMotionMaster()->MoveTargetedHome(); + } + if (ResetTimer <= diff) + { + EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama + return; + } else ResetTimer -= diff; } - if (ResetTimer <= diff) - { - EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama - return; - } else ResetTimer -= diff; + + DoMeleeAttackIfReady(); } - - DoMeleeAttackIfReady(); } - } + }; + }; - -void mob_ashtongue_channelerAI::JustDied(Unit* /*killer*/) + void mob_ashtongue_channeler::mob_ashtongue_channelerAI::JustDied(Unit* /*killer*/) { Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); if (Shade && Shade->isAlive()) - CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(); + CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(); else sLog.outError("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama."); } -void mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/) +void mob_ashtongue_sorcerer::mob_ashtongue_sorcererAI::JustDied(Unit* /*killer*/) { Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); if (Shade && Shade->isAlive()) - CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(me->GetGUID()); + CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IncrementDeathCount(me->GetGUID()); else sLog.outError("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama."); -} - -struct npc_akamaAI : public ScriptedAI +} class npc_akama_shade : public CreatureScript { - npc_akamaAI(Creature* c) : ScriptedAI(c), summons(me) +public: + npc_akama_shade() : CreatureScript("npc_akama_shade") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - ShadeHasDied = false; - StartCombat = false; - pInstance = c->GetInstanceData(); - ShadeGUID = pInstance ? pInstance->GetData64(DATA_SHADEOFAKAMA) : NOT_STARTED; - me->setActive(true); - EventBegun = false; - CastSoulRetrieveTimer = 0; - SoulRetrieveTimer = 0; - SummonBrokenTimer = 0; - EndingTalkCount = 0; - WayPointId = 0; - BrokenSummonIndex = 0; - BrokenList.clear(); - HasYelledOnce = false; - } - - ScriptedInstance* pInstance; - - uint64 ShadeGUID; - - uint32 DestructivePoisonTimer; - uint32 LightningBoltTimer; - uint32 CheckTimer; - uint32 CastSoulRetrieveTimer; - uint32 SoulRetrieveTimer; - uint32 SummonBrokenTimer; - uint32 EndingTalkCount; - uint32 WayPointId; - uint32 BrokenSummonIndex; - - std::list BrokenList; - - bool EventBegun; - bool ShadeHasDied; - bool StartCombat; - bool HasYelledOnce; - SummonList summons; - - void Reset() - { - DestructivePoisonTimer = 15000; - LightningBoltTimer = 10000; - CheckTimer = 2000; - - if (!EventBegun) + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time { - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has very very strange values - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_akama_shade::npc_akamaAI, pCreature->AI())->BeginEvent(pPlayer); } - summons.DespawnAll(); + + return true; } - void JustSummoned(Creature *summon) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (summon->GetEntry() == CREATURE_BROKEN) - summons.Summon(summon); - } - void SummonedCreatureDespawn(Creature *summon) - { - if (summon->GetEntry() == CREATURE_BROKEN) - summons.Despawn(summon); - } - - void EnterCombat(Unit* /*who*/) {} - - void BeginEvent(Player* pl) - { - if (!pInstance) - return; - - ShadeGUID = pInstance->GetData64(DATA_SHADEOFAKAMA); - if (!ShadeGUID) - return; - - Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); - if (Shade) + if (pPlayer->isAlive()) { - pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS); - // Prevent players from trying to restart event - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - CAST_AI(boss_shade_of_akamaAI, Shade->AI())->SetAkamaGUID(me->GetGUID()); - CAST_AI(boss_shade_of_akamaAI, Shade->AI())->SetSelectableChannelers(); - Shade->AddThreat(me, 1000000.0f); - me->CombatStart(Shade); - Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - Shade->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (pl) Shade->AddThreat(pl, 1.0f); - DoZoneInCombat(Shade); - EventBegun = true; + 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; } - void MovementInform(uint32 type, uint32 id) + CreatureAI* GetAI(Creature* pCreature) const { - if (type != POINT_MOTION_TYPE) - return; + return new npc_akamaAI (pCreature); + } - switch(id) + struct npc_akamaAI : public ScriptedAI + { + npc_akamaAI(Creature* c) : ScriptedAI(c), summons(me) { - case 0: ++WayPointId; break; + ShadeHasDied = false; + StartCombat = false; + pInstance = c->GetInstanceScript(); + ShadeGUID = pInstance ? pInstance->GetData64(DATA_SHADEOFAKAMA) : NOT_STARTED; + me->setActive(true); + EventBegun = false; + CastSoulRetrieveTimer = 0; + SoulRetrieveTimer = 0; + SummonBrokenTimer = 0; + EndingTalkCount = 0; + WayPointId = 0; + BrokenSummonIndex = 0; + BrokenList.clear(); + HasYelledOnce = false; + } - case 1: - if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID)) + InstanceScript* pInstance; + + uint64 ShadeGUID; + + uint32 DestructivePoisonTimer; + uint32 LightningBoltTimer; + uint32 CheckTimer; + uint32 CastSoulRetrieveTimer; + uint32 SoulRetrieveTimer; + uint32 SummonBrokenTimer; + uint32 EndingTalkCount; + uint32 WayPointId; + uint32 BrokenSummonIndex; + + std::list BrokenList; + + bool EventBegun; + bool ShadeHasDied; + bool StartCombat; + bool HasYelledOnce; + SummonList summons; + + void Reset() + { + DestructivePoisonTimer = 15000; + LightningBoltTimer = 10000; + CheckTimer = 2000; + + if (!EventBegun) { - me->SetUInt64Value(UNIT_FIELD_TARGET, ShadeGUID); - DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE); - EndingTalkCount = 0; - SoulRetrieveTimer = 16000; + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has very very strange values + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - break; - } - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - EventBegun = false; - ShadeHasDied = false; - StartCombat = false; - CastSoulRetrieveTimer = 0; - SoulRetrieveTimer = 0; - SummonBrokenTimer = 0; - EndingTalkCount = 0; - WayPointId = 0; - BrokenSummonIndex = 0; - BrokenList.clear(); - HasYelledOnce = false; - Creature* Shade = Unit::GetCreature((*me), ShadeGUID); - if (Shade && Shade->isAlive()) - CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; - summons.DespawnAll(); - } - - void UpdateAI(const uint32 diff) - { - if (!EventBegun) - return; - - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 15 && !HasYelledOnce) - { - DoScriptText(SAY_LOW_HEALTH, me); - HasYelledOnce = true; + summons.DespawnAll(); } - if (ShadeGUID && !StartCombat) + void JustSummoned(Creature *summon) { + if (summon->GetEntry() == CREATURE_BROKEN) + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) + { + if (summon->GetEntry() == CREATURE_BROKEN) + summons.Despawn(summon); + } + + void EnterCombat(Unit* /*who*/) {} + + void BeginEvent(Player* pl) + { + if (!pInstance) + return; + + ShadeGUID = pInstance->GetData64(DATA_SHADEOFAKAMA); + if (!ShadeGUID) + return; + Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); - if (Shade && Shade->isAlive()) + if (Shade) { - if (CAST_AI(boss_shade_of_akamaAI, Shade->AI())->IsBanished) - { - if (CastSoulRetrieveTimer <= diff) - { - DoCast(Shade, SPELL_AKAMA_SOUL_CHANNEL); - CastSoulRetrieveTimer = 500; - } else CastSoulRetrieveTimer -= diff; - } - else - { - me->InterruptNonMeleeSpells(false); - StartCombat = true; - } + pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS); + // Prevent players from trying to restart event + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->SetAkamaGUID(me->GetGUID()); + CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->SetSelectableChannelers(); + Shade->AddThreat(me, 1000000.0f); + me->CombatStart(Shade); + Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + Shade->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (pl) Shade->AddThreat(pl, 1.0f); + DoZoneInCombat(Shade); + EventBegun = true; } } - if (ShadeHasDied && (WayPointId == 1)) + void MovementInform(uint32 type, uint32 id) { - if (pInstance) - pInstance->SetData(DATA_SHADEOFAKAMAEVENT, DONE); - me->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[1].x, AkamaWP[1].y, AkamaWP[1].z); - ++WayPointId; + if (type != POINT_MOTION_TYPE) + return; + + switch(id) + { + case 0: ++WayPointId; break; + + case 1: + if (Creature* Shade = Unit::GetCreature(*me, ShadeGUID)) + { + me->SetUInt64Value(UNIT_FIELD_TARGET, ShadeGUID); + DoCast(Shade, SPELL_AKAMA_SOUL_RETRIEVE); + EndingTalkCount = 0; + SoulRetrieveTimer = 16000; + } + break; + } } - if (!ShadeHasDied && StartCombat) - { - if (CheckTimer <= diff) - { - if (ShadeGUID) - { - Creature* Shade = Unit::GetCreature((*me), ShadeGUID); - if (Shade && !Shade->isAlive()) - { - ShadeHasDied = true; - WayPointId = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[0].x, AkamaWP[0].y, AkamaWP[0].z); - } - if (Shade && Shade->isAlive()) - { - if (Shade->getThreatManager().getThreatList().size() < 2) - Shade->AI()->EnterEvadeMode(); - } - } - CheckTimer = 5000; - } else CheckTimer -= diff; - } - - if (SummonBrokenTimer && BrokenSummonIndex < 4) - { - if (SummonBrokenTimer <= diff) - { - for (uint8 i = 0; i < 4; ++i) - { - float x = BrokenCoords[BrokenSummonIndex].x + (i*5); - float y = BrokenCoords[BrokenSummonIndex].y + (1*5); - float z = BrokenCoords[BrokenSummonIndex].z; - float o = BrokenCoords[BrokenSummonIndex].o; - Creature* Broken = me->SummonCreature(CREATURE_BROKEN, x, y, z, o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000); - if (Broken) - { - float wx = BrokenWP[BrokenSummonIndex].x + (i*5); - float wy = BrokenWP[BrokenSummonIndex].y + (i*5); - float wz = BrokenWP[BrokenSummonIndex].z; - Broken->GetMotionMaster()->MovePoint(0, wx, wy, wz); - Broken->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - BrokenList.push_back(Broken->GetGUID()); - } - } - ++BrokenSummonIndex; - SummonBrokenTimer = 1000; - } else SummonBrokenTimer -= diff; - } - - if (SoulRetrieveTimer) - if (SoulRetrieveTimer <= diff) - { - switch(EndingTalkCount) - { - case 0: - me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - ++EndingTalkCount; - SoulRetrieveTimer = 2000; - SummonBrokenTimer = 1; - break; - case 1: - DoScriptText(SAY_FREE, me); - ++EndingTalkCount; - SoulRetrieveTimer = 25000; - break; - case 2: - if (!BrokenList.empty()) - { - bool Yelled = false; - for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature(*me, *itr)) - { - if (!Yelled) - { - DoScriptText(SAY_BROKEN_FREE_01, pUnit); - Yelled = true; - } - pUnit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); - } - } - ++EndingTalkCount; - SoulRetrieveTimer = 1500; - break; - case 3: - if (!BrokenList.empty()) - { - for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature(*me, *itr)) - // This is the incorrect spell, but can't seem to find the right one. - pUnit->CastSpell(pUnit, 39656, true); - } - ++EndingTalkCount; - SoulRetrieveTimer = 5000; - break; - case 4: - if (!BrokenList.empty()) - { - for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature((*me), *itr)) - pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); - } - SoulRetrieveTimer = 0; - break; - } - } else SoulRetrieveTimer -= diff; - - if (!UpdateVictim()) - return; - - if (DestructivePoisonTimer <= diff) + void JustDied(Unit* /*killer*/) { + DoScriptText(SAY_DEATH, me); + EventBegun = false; + ShadeHasDied = false; + StartCombat = false; + CastSoulRetrieveTimer = 0; + SoulRetrieveTimer = 0; + SummonBrokenTimer = 0; + EndingTalkCount = 0; + WayPointId = 0; + BrokenSummonIndex = 0; + BrokenList.clear(); + HasYelledOnce = false; Creature* Shade = Unit::GetCreature((*me), ShadeGUID); if (Shade && Shade->isAlive()) - DoCast(Shade, SPELL_DESTRUCTIVE_POISON); - DestructivePoisonTimer = 15000; - } else DestructivePoisonTimer -= diff; + CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; + summons.DespawnAll(); + } - if (LightningBoltTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_LIGHTNING_BOLT); - LightningBoltTimer = 10000; - } else LightningBoltTimer -= diff; + if (!EventBegun) + return; + + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 15 && !HasYelledOnce) + { + DoScriptText(SAY_LOW_HEALTH, me); + HasYelledOnce = true; + } + + if (ShadeGUID && !StartCombat) + { + Creature* Shade = (Unit::GetCreature((*me), ShadeGUID)); + if (Shade && Shade->isAlive()) + { + if (CAST_AI(boss_shade_of_akama::boss_shade_of_akamaAI, Shade->AI())->IsBanished) + { + if (CastSoulRetrieveTimer <= diff) + { + DoCast(Shade, SPELL_AKAMA_SOUL_CHANNEL); + CastSoulRetrieveTimer = 500; + } else CastSoulRetrieveTimer -= diff; + } + else + { + me->InterruptNonMeleeSpells(false); + StartCombat = true; + } + } + } + + if (ShadeHasDied && (WayPointId == 1)) + { + if (pInstance) + pInstance->SetData(DATA_SHADEOFAKAMAEVENT, DONE); + me->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[1].x, AkamaWP[1].y, AkamaWP[1].z); + ++WayPointId; + } + + if (!ShadeHasDied && StartCombat) + { + if (CheckTimer <= diff) + { + if (ShadeGUID) + { + Creature* Shade = Unit::GetCreature((*me), ShadeGUID); + if (Shade && !Shade->isAlive()) + { + ShadeHasDied = true; + WayPointId = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(WayPointId, AkamaWP[0].x, AkamaWP[0].y, AkamaWP[0].z); + } + if (Shade && Shade->isAlive()) + { + if (Shade->getThreatManager().getThreatList().size() < 2) + Shade->AI()->EnterEvadeMode(); + } + } + CheckTimer = 5000; + } else CheckTimer -= diff; + } + + if (SummonBrokenTimer && BrokenSummonIndex < 4) + { + if (SummonBrokenTimer <= diff) + { + for (uint8 i = 0; i < 4; ++i) + { + float x = BrokenCoords[BrokenSummonIndex].x + (i*5); + float y = BrokenCoords[BrokenSummonIndex].y + (1*5); + float z = BrokenCoords[BrokenSummonIndex].z; + float o = BrokenCoords[BrokenSummonIndex].o; + Creature* Broken = me->SummonCreature(CREATURE_BROKEN, x, y, z, o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000); + if (Broken) + { + float wx = BrokenWP[BrokenSummonIndex].x + (i*5); + float wy = BrokenWP[BrokenSummonIndex].y + (i*5); + float wz = BrokenWP[BrokenSummonIndex].z; + Broken->GetMotionMaster()->MovePoint(0, wx, wy, wz); + Broken->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + BrokenList.push_back(Broken->GetGUID()); + } + } + ++BrokenSummonIndex; + SummonBrokenTimer = 1000; + } else SummonBrokenTimer -= diff; + } + + if (SoulRetrieveTimer) + if (SoulRetrieveTimer <= diff) + { + switch(EndingTalkCount) + { + case 0: + me->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + ++EndingTalkCount; + SoulRetrieveTimer = 2000; + SummonBrokenTimer = 1; + break; + case 1: + DoScriptText(SAY_FREE, me); + ++EndingTalkCount; + SoulRetrieveTimer = 25000; + break; + case 2: + if (!BrokenList.empty()) + { + bool Yelled = false; + for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + if (Creature* pUnit = Unit::GetCreature(*me, *itr)) + { + if (!Yelled) + { + DoScriptText(SAY_BROKEN_FREE_01, pUnit); + Yelled = true; + } + pUnit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + } + } + ++EndingTalkCount; + SoulRetrieveTimer = 1500; + break; + case 3: + if (!BrokenList.empty()) + { + for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + if (Creature* pUnit = Unit::GetCreature(*me, *itr)) + // This is the incorrect spell, but can't seem to find the right one. + pUnit->CastSpell(pUnit, 39656, true); + } + ++EndingTalkCount; + SoulRetrieveTimer = 5000; + break; + case 4: + if (!BrokenList.empty()) + { + for (std::list::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) + if (Creature* pUnit = Unit::GetCreature((*me), *itr)) + pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); + } + SoulRetrieveTimer = 0; + break; + } + } else SoulRetrieveTimer -= diff; + + if (!UpdateVictim()) + return; + + if (DestructivePoisonTimer <= diff) + { + Creature* Shade = Unit::GetCreature((*me), ShadeGUID); + if (Shade && Shade->isAlive()) + DoCast(Shade, SPELL_DESTRUCTIVE_POISON); + DestructivePoisonTimer = 15000; + } else DestructivePoisonTimer -= diff; + + if (LightningBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_LIGHTNING_BOLT); + LightningBoltTimer = 10000; + } else LightningBoltTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_shade_of_akama(Creature* pCreature) -{ - return new boss_shade_of_akamaAI (pCreature); -} -CreatureAI* GetAI_mob_ashtongue_channeler(Creature* pCreature) -{ - return new mob_ashtongue_channelerAI (pCreature); -} - -CreatureAI* GetAI_mob_ashtongue_sorcerer(Creature* pCreature) -{ - return new mob_ashtongue_sorcererAI (pCreature); -} - -CreatureAI* GetAI_npc_akama_shade(Creature* pCreature) -{ - return new npc_akamaAI (pCreature); -} - -bool GossipSelect_npc_akama(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) //Fight time - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_akamaAI, pCreature->AI())->BeginEvent(pPlayer); - } - - return true; -} - -bool GossipHello_npc_akama(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->isAlive()) - { - 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; -} void AddSC_boss_shade_of_akama() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_shade_of_akama"; - newscript->GetAI = &GetAI_boss_shade_of_akama; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ashtongue_channeler"; - newscript->GetAI = &GetAI_mob_ashtongue_channeler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ashtongue_sorcerer"; - newscript->GetAI = &GetAI_mob_ashtongue_sorcerer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_akama_shade"; - newscript->GetAI = &GetAI_npc_akama_shade; - newscript->pGossipHello = &GossipHello_npc_akama; - newscript->pGossipSelect = &GossipSelect_npc_akama; - newscript->RegisterSelf(); + new boss_shade_of_akama(); + new mob_ashtongue_channeler(); + new mob_ashtongue_sorcerer(); + new npc_akama_shade(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 7dc197994fe..6a1b3c4d735 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -52,247 +52,255 @@ EndScriptData */ #define EVENT_HATEFUL_STRIKE 6 #define GCD_CAST 1 - -struct molten_flameAI : public NullCreatureAI + class molten_flame : public CreatureScript { - molten_flameAI(Creature *c) : NullCreatureAI(c) {} +public: + molten_flame() : CreatureScript("molten_flame") { } - void InitializeAI() + CreatureAI* GetAI(Creature* pCreature) const { - float x, y, z; - me->GetNearPoint(me, x, y, z, 1, 100, M_PI*2*rand_norm()); - me->GetMotionMaster()->MovePoint(0, x, y, z); - me->SetVisibility(VISIBILITY_OFF); - me->CastSpell(me,SPELL_MOLTEN_FLAME,true); + return new molten_flameAI (pCreature); } + + struct molten_flameAI : public NullCreatureAI + { + molten_flameAI(Creature *c) : NullCreatureAI(c) {} + + void InitializeAI() + { + float x, y, z; + me->GetNearPoint(me, x, y, z, 1, 100, M_PI*2*rand_norm()); + me->GetMotionMaster()->MovePoint(0, x, y, z); + me->SetVisibility(VISIBILITY_OFF); + me->CastSpell(me,SPELL_MOLTEN_FLAME,true); + } + }; + }; - -struct boss_supremusAI : public ScriptedAI + class boss_supremus : public CreatureScript { - boss_supremusAI(Creature *c) : ScriptedAI(c), summons(me) +public: + boss_supremus() : CreatureScript("boss_supremus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_supremusAI (pCreature); } - ScriptedInstance* pInstance; - EventMap events; - SummonList summons; - uint32 phase; - - void Reset() + struct boss_supremusAI : public ScriptedAI { - if (pInstance) + boss_supremusAI(Creature *c) : ScriptedAI(c), summons(me) { - if (me->isAlive()) + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + SummonList summons; + uint32 phase; + + void Reset() + { + if (pInstance) { - pInstance->SetData(DATA_SUPREMUSEVENT, NOT_STARTED); - //ToggleDoors(true); - } - //else ToggleDoors(false); - } - - phase = 0; - - events.Reset(); - summons.DespawnAll(); - } - - void EnterCombat(Unit * /*who*/) - { - if (pInstance) - pInstance->SetData(DATA_SUPREMUSEVENT, IN_PROGRESS); - - ChangePhase(); - events.ScheduleEvent(EVENT_BERSERK, 900000, GCD_CAST); - events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); - } - - void ChangePhase() - { - if (!phase || phase == PHASE_CHASE) - { - phase = PHASE_STRIKE; - summons.DoAction(EVENT_VOLCANO, 0); - events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); - me->SetSpeed(MOVE_RUN, 1.2f); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); - } - else - { - phase = PHASE_CHASE; - events.ScheduleEvent(EVENT_VOLCANO, 5000, GCD_CAST, PHASE_CHASE); - events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); - me->SetSpeed(MOVE_RUN, 0.9f); - me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); - me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); - } - DoResetThreat(); - DoZoneInCombat(); - events.SetPhase(phase); - events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000, GCD_CAST); - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) - { - pInstance->SetData(DATA_SUPREMUSEVENT, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GAMEOBJECT_SUPREMUS_DOORS), true); - } - summons.DespawnAll(); - } - - void JustSummoned(Creature *summon) {summons.Summon(summon);} - void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - - Unit* CalculateHatefulStrikeTarget() - { - uint32 health = 0; - Unit *pTarget = NULL; - - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && me->IsWithinMeleeRange(pUnit)) - { - if (pUnit->GetHealth() > health) + if (me->isAlive()) { - health = pUnit->GetHealth(); - pTarget = pUnit; + pInstance->SetData(DATA_SUPREMUSEVENT, NOT_STARTED); + //ToggleDoors(true); + } + //else ToggleDoors(false); + } + + phase = 0; + + events.Reset(); + summons.DespawnAll(); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_SUPREMUSEVENT, IN_PROGRESS); + + ChangePhase(); + events.ScheduleEvent(EVENT_BERSERK, 900000, GCD_CAST); + events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); + } + + void ChangePhase() + { + if (!phase || phase == PHASE_CHASE) + { + phase = PHASE_STRIKE; + summons.DoAction(EVENT_VOLCANO, 0); + events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); + me->SetSpeed(MOVE_RUN, 1.2f); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); + } + else + { + phase = PHASE_CHASE; + events.ScheduleEvent(EVENT_VOLCANO, 5000, GCD_CAST, PHASE_CHASE); + events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); + me->SetSpeed(MOVE_RUN, 0.9f); + me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + me->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); + } + DoResetThreat(); + DoZoneInCombat(); + events.SetPhase(phase); + events.ScheduleEvent(EVENT_SWITCH_PHASE, 60000, GCD_CAST); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + { + pInstance->SetData(DATA_SUPREMUSEVENT, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GAMEOBJECT_SUPREMUS_DOORS), true); + } + summons.DespawnAll(); + } + + void JustSummoned(Creature *summon) {summons.Summon(summon);} + void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} + + Unit* CalculateHatefulStrikeTarget() + { + uint32 health = 0; + Unit *pTarget = NULL; + + std::list& m_threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = m_threatlist.begin(); + for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && me->IsWithinMeleeRange(pUnit)) + { + if (pUnit->GetHealth() > health) + { + health = pUnit->GetHealth(); + pTarget = pUnit; + } } } + + return pTarget; } - return pTarget; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) + void UpdateAI(const uint32 diff) { - switch(eventId) + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) { - case EVENT_BERSERK: - DoCast(me, SPELL_BERSERK, true); - break; - case EVENT_FLAME: - DoCast(me, SPELL_MOLTEN_PUNCH); - events.DelayEvents(1500, GCD_CAST); - events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); - break; - case EVENT_HATEFUL_STRIKE: - if (Unit *pTarget = CalculateHatefulStrikeTarget()) - DoCast(pTarget, SPELL_HATEFUL_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); - break; - case EVENT_SWITCH_TARGET: - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) - { - DoResetThreat(); - me->AddThreat(pTarget, 5000000.0f); - DoScriptText(EMOTE_NEW_TARGET, me); - } - events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); - break; - case EVENT_VOLCANO: + switch(eventId) { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true); - if (!pTarget) pTarget = me->getVictim(); - if (pTarget) - { - //DoCast(pTarget, SPELL_VOLCANIC_SUMMON);//movement bugged - me->SummonCreature(CREATURE_VOLCANO,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); - DoScriptText(EMOTE_GROUND_CRACK, me); + case EVENT_BERSERK: + DoCast(me, SPELL_BERSERK, true); + break; + case EVENT_FLAME: + DoCast(me, SPELL_MOLTEN_PUNCH); events.DelayEvents(1500, GCD_CAST); + events.ScheduleEvent(EVENT_FLAME, 20000, GCD_CAST); + break; + case EVENT_HATEFUL_STRIKE: + if (Unit *pTarget = CalculateHatefulStrikeTarget()) + DoCast(pTarget, SPELL_HATEFUL_STRIKE); + events.DelayEvents(1000, GCD_CAST); + events.ScheduleEvent(EVENT_HATEFUL_STRIKE, 5000, GCD_CAST, PHASE_STRIKE); + break; + case EVENT_SWITCH_TARGET: + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true)) + { + DoResetThreat(); + me->AddThreat(pTarget, 5000000.0f); + DoScriptText(EMOTE_NEW_TARGET, me); + } + events.ScheduleEvent(EVENT_SWITCH_TARGET, 10000, 0, PHASE_CHASE); + break; + case EVENT_VOLCANO: + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 999, true); + if (!pTarget) pTarget = me->getVictim(); + if (pTarget) + { + //DoCast(pTarget, SPELL_VOLCANIC_SUMMON);//movement bugged + me->SummonCreature(CREATURE_VOLCANO,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); + DoScriptText(EMOTE_GROUND_CRACK, me); + events.DelayEvents(1500, GCD_CAST); + } + events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE); + return; } - events.ScheduleEvent(EVENT_VOLCANO, 10000, GCD_CAST, PHASE_CHASE); - return; + case EVENT_SWITCH_PHASE: + ChangePhase(); + break; } - case EVENT_SWITCH_PHASE: - ChangePhase(); - break; } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; - -struct npc_volcanoAI : public Scripted_NoMovementAI + class npc_volcano : public CreatureScript { - npc_volcanoAI(Creature *c) : Scripted_NoMovementAI(c) {} +public: + npc_volcano() : CreatureScript("npc_volcano") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //DoCast(me, SPELL_VOLCANIC_ERUPTION); - me->SetReactState(REACT_PASSIVE); - wait = 3000; - } - uint32 wait; - - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit * /*who*/) {} - - void DoAction(const uint32 /*info*/) - { - me->RemoveAura(SPELL_VOLCANIC_ERUPTION); + return new npc_volcanoAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_volcanoAI : public Scripted_NoMovementAI { - if (wait <= diff)//wait 3secs before casting + npc_volcanoAI(Creature *c) : Scripted_NoMovementAI(c) {} + + void Reset() { - DoCast(me, SPELL_VOLCANIC_ERUPTION); - wait = 60000; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //DoCast(me, SPELL_VOLCANIC_ERUPTION); + me->SetReactState(REACT_PASSIVE); + wait = 3000; } - else wait -= diff; - } + uint32 wait; + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit * /*who*/) {} + + void DoAction(const uint32 /*info*/) + { + me->RemoveAura(SPELL_VOLCANIC_ERUPTION); + } + + void UpdateAI(const uint32 diff) + { + if (wait <= diff)//wait 3secs before casting + { + DoCast(me, SPELL_VOLCANIC_ERUPTION); + wait = 60000; + } + else wait -= diff; + } + + }; }; -CreatureAI* GetAI_boss_supremus(Creature* pCreature) -{ - return new boss_supremusAI (pCreature); -} -CreatureAI* GetAI_molten_flame(Creature* pCreature) -{ - return new molten_flameAI (pCreature); -} -CreatureAI* GetAI_npc_volcano(Creature* pCreature) -{ - return new npc_volcanoAI (pCreature); -} void AddSC_boss_supremus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_supremus"; - newscript->GetAI = &GetAI_boss_supremus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "molten_flame"; - newscript->GetAI = &GetAI_molten_flame; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_volcano"; - newscript->GetAI = &GetAI_npc_volcano; - newscript->RegisterSelf(); + new boss_supremus(); + new molten_flame(); + new npc_volcano(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 92b5a0a6134..ca398c36564 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -50,461 +50,469 @@ EndScriptData */ #define CREATURE_DOOM_BLOSSOM 23123 #define CREATURE_SHADOWY_CONSTRUCT 23111 - -struct mob_doom_blossomAI : public ScriptedAI + class mob_doom_blossom : public CreatureScript { - mob_doom_blossomAI(Creature *c) : ScriptedAI(c) {} +public: + mob_doom_blossom() : CreatureScript("mob_doom_blossom") { } - uint32 CheckTeronTimer; - uint32 ShadowBoltTimer; - uint64 TeronGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CheckTeronTimer = 5000; - ShadowBoltTimer = 12000; - TeronGUID = 0; + return new mob_doom_blossomAI(pCreature); } - void EnterCombat(Unit * /*who*/) { } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void Despawn() + struct mob_doom_blossomAI : public ScriptedAI { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); - } + mob_doom_blossomAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (CheckTeronTimer <= diff) + uint32 CheckTeronTimer; + uint32 ShadowBoltTimer; + uint64 TeronGUID; + + void Reset() { - if (TeronGUID) - { - DoZoneInCombat(); - - Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); - if ((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode())) - Despawn(); - } - else - Despawn(); - CheckTeronTimer = 5000; - } else CheckTeronTimer -= diff; - - if (ShadowBoltTimer < diff && me->isInCombat()) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOWBOLT); - ShadowBoltTimer = 10000; - } else ShadowBoltTimer -= diff; - return; - } - - void SetTeronGUID(uint64 guid){ TeronGUID = guid; } -}; - -struct mob_shadowy_constructAI : public ScriptedAI -{ - mob_shadowy_constructAI(Creature* c) : ScriptedAI(c) {} - - uint64 GhostGUID; - uint64 TeronGUID; - - uint32 CheckPlayerTimer; - uint32 CheckTeronTimer; - - void Reset() - { - GhostGUID = 0; - TeronGUID = 0; - - CheckPlayerTimer = 2000; - CheckTeronTimer = 5000; - } - - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) - { - if (!who || (!who->isAlive()) || (who->GetGUID() == GhostGUID)) - return; - - ScriptedAI::MoveInLineOfSight(who); - } - -/* Comment it out for now. NOTE TO FUTURE DEV: UNCOMMENT THIS OUT ONLY AFTER MIND CONTROL IS IMPLEMENTED - void DamageTaken(Unit* done_by, uint32 &damage) - { - if (done_by->GetGUID() != GhostGUID) - damage = 0; // Only the ghost can deal damage. - } - */ - - void CheckPlayers() - { - std::list& m_threatlist = me->getThreatManager().getThreatList(); - if (m_threatlist.empty()) - return; // No threat list. Don't continue. - std::list::const_iterator itr = m_threatlist.begin(); - std::list targets; - for (; itr != m_threatlist.end(); ++itr) - { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - targets.push_back(pUnit); + ShadowBoltTimer = 12000; + TeronGUID = 0; } - targets.sort(Trinity::ObjectDistanceOrderPred(me)); - Unit *pTarget = targets.front(); - if (pTarget && me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) + + void EnterCombat(Unit * /*who*/) { } + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void Despawn() { - DoCast(pTarget, SPELL_ATROPHY); - me->AI()->AttackStart(pTarget); + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); } - } - void UpdateAI(const uint32 diff) - { - if (CheckPlayerTimer <= diff) + void UpdateAI(const uint32 diff) { - CheckPlayers(); - CheckPlayerTimer = 3000; - } else CheckPlayerTimer -= diff; - - if (CheckTeronTimer <= diff) - { - Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); - if (!Teron || !Teron->isAlive() || Teron->IsInEvadeMode()) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - - CheckTeronTimer = 5000; - } else CheckTeronTimer -= diff; - } -}; - -struct boss_teron_gorefiendAI : public ScriptedAI -{ - boss_teron_gorefiendAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 IncinerateTimer; - uint32 SummonDoomBlossomTimer; - uint32 EnrageTimer; - uint32 CrushingShadowsTimer; - uint32 ShadowOfDeathTimer; - uint32 SummonShadowsTimer; - uint32 RandomYellTimer; - uint32 AggroTimer; - - uint64 AggroTargetGUID; - uint64 GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost - - bool Intro; - bool Done; - - void Reset() - { - if (pInstance) - pInstance->SetData(DATA_TERONGOREFIENDEVENT, NOT_STARTED); - - IncinerateTimer = 20000 + rand()%11000; - SummonDoomBlossomTimer = 12000; - EnrageTimer = 600000; - CrushingShadowsTimer = 22000; - SummonShadowsTimer = 60000; - RandomYellTimer = 50000; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - // Start off unattackable so that the intro is done properly - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - AggroTimer = 20000; - AggroTargetGUID = 0; - Intro = false; - Done = false; - } - - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit* pWho) - { - if (!Intro && pWho->GetTypeId() == TYPEID_PLAYER && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && pWho->isInAccessiblePlaceFor(me)) - { - if (me->IsWithinDistInMap(pWho, VISIBLE_RANGE) && me->IsWithinLOSInMap(pWho)) + if (CheckTeronTimer <= diff) { - if (pInstance) - pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS); - - me->GetMotionMaster()->Clear(false); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_INTRO, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); - AggroTargetGUID = pWho->GetGUID(); - Intro = true; - } - } - if (Done) - ScriptedAI::MoveInLineOfSight(pWho); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_TERONGOREFIENDEVENT, DONE); - - DoScriptText(SAY_DEATH, me); - } - - float CalculateRandomLocation(float Loc, uint32 radius) - { - float coord = Loc; - switch (urand(0,1)) - { - case 0: - coord += rand()%radius; - break; - case 1: - coord -= rand()%radius; - break; - } - return coord; - } - - void SetThreatList(Creature* Blossom) - { - if (!Blossom) return; - - std::list& m_threatlist = me->getThreatManager().getThreatList(); - std::list::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - { - float threat = DoGetThreat(pUnit); - Blossom->AddThreat(pUnit, threat); - } - } - } - - void MindControlGhost() - { - /************************************************************************/ - /** NOTE FOR FUTURE DEVELOPER: PROPERLY IMPLEMENT THE GHOST PORTION *****/ - /** ONLY AFTER TrinIty FULLY IMPLEMENTS MIND CONTROL ABILITIES *****/ - /** THE CURRENT CODE IN THIS FUNCTION IS ONLY THE BEGINNING OF *****/ - /** WHAT IS FULLY NECESSARY FOR GOREFIEND TO BE 100% COMPLETE *****/ - /************************************************************************/ - - Unit* Ghost = NULL; - if (GhostGUID) - Ghost = Unit::GetUnit((*me), GhostGUID); - if (Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH)) - { - /*float x,y,z; - Ghost->GetPosition(x,y,z); - Creature* control = me->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000); - if (control) - { - CAST_PLR(Ghost)->Possess(control); - Ghost->DealDamage(Ghost, Ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, - false); - }*/ - for (uint8 i = 0; i < 4; ++i) - { - Creature* Construct = NULL; - float X = CalculateRandomLocation(Ghost->GetPositionX(), 10); - float Y = CalculateRandomLocation(Ghost->GetPositionY(), 10); - Construct = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, Y, Ghost->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); - if (Construct) + if (TeronGUID) { - Construct->CastSpell(Construct, SPELL_PASSIVE_SHADOWFORM, true); - SetThreatList(Construct); // Use same function as Doom Blossom to set Threat List. - CAST_AI(mob_shadowy_constructAI, Construct->AI())->GhostGUID = GhostGUID; - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) // someone's trying to solo. - pTarget = me->getVictim(); - - if (pTarget) - Construct->GetMotionMaster()->MoveChase(pTarget); - } - } - } - } - - void UpdateAI(const uint32 diff) - { - if (Intro && !Done) - { - if (AggroTimer <= diff) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - DoScriptText(SAY_AGGRO, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - Done = true; - if (AggroTargetGUID) - { - Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID); - if (pUnit) - AttackStart(pUnit); - DoZoneInCombat(); + + Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); + if ((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode())) + Despawn(); } else - { - EnterEvadeMode(); - return; - } - } else AggroTimer -= diff; - } + Despawn(); - if (!UpdateVictim() || !Done) + CheckTeronTimer = 5000; + } else CheckTeronTimer -= diff; + + if (ShadowBoltTimer < diff && me->isInCombat()) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOWBOLT); + ShadowBoltTimer = 10000; + } else ShadowBoltTimer -= diff; return; - - if (SummonShadowsTimer <= diff) - { - //MindControlGhost(); - - for (uint8 i = 0; i < 2; ++i) - { - Creature* Shadow = NULL; - float X = CalculateRandomLocation(me->GetPositionX(), 10); - Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); - if (Shadow) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) - pTarget = me->getVictim(); - - if (pTarget) - Shadow->AI()->AttackStart(pTarget); - } - } - SummonShadowsTimer = 60000; - } else SummonShadowsTimer -= diff; - - if (SummonDoomBlossomTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - float X = CalculateRandomLocation(pTarget->GetPositionX(), 20); - float Y = CalculateRandomLocation(pTarget->GetPositionY(), 20); - float Z = pTarget->GetPositionZ(); - Z = me->GetMap()->GetHeight(X, Y, Z); - Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); - if (DoomBlossom) - { - DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoomBlossom->setFaction(me->getFaction()); - DoomBlossom->AddThreat(pTarget, 1.0f); - CAST_AI(mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); - pTarget->CombatStart(DoomBlossom); - SetThreatList(DoomBlossom); - SummonDoomBlossomTimer = 35000; - } - } - } else SummonDoomBlossomTimer -= diff; - - if (IncinerateTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) - pTarget = me->getVictim(); - - if (pTarget) - { - DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), me); - DoCast(pTarget, SPELL_INCINERATE); - IncinerateTimer = 20000 + rand()%31 * 1000; - } - } else IncinerateTimer -= diff; - - if (CrushingShadowsTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget && pTarget->isAlive()) - DoCast(pTarget, SPELL_CRUSHING_SHADOWS); - CrushingShadowsTimer = 10000 + rand()%16 * 1000; - } else CrushingShadowsTimer -= diff; - - /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/ - /*if (ShadowOfDeathTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - - if (!pTarget) - pTarget = me->getVictim(); - - if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) - { - DoCast(pTarget, SPELL_SHADOW_OF_DEATH); - GhostGUID = pTarget->GetGUID(); - ShadowOfDeathTimer = 30000; - SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player - } - } else ShadowOfDeathTimer -= diff;*/ - - if (RandomYellTimer <= diff) - { - DoScriptText(RAND(SAY_SPELL1,SAY_SPELL2), me); - RandomYellTimer = 50000 + rand()%51 * 1000; - } else RandomYellTimer -= diff; - - if (!me->HasAura(SPELL_BERSERK)) - { - if (EnrageTimer <= diff) - { - DoCast(me, SPELL_BERSERK); - DoScriptText(SAY_ENRAGE, me); - } else EnrageTimer -= diff; } - DoMeleeAttackIfReady(); + void SetTeronGUID(uint64 guid){ TeronGUID = guid; } + }; + +}; + class mob_shadowy_construct : public CreatureScript +{ +public: + mob_shadowy_construct() : CreatureScript("mob_shadowy_construct") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shadowy_constructAI(pCreature); } + + struct mob_shadowy_constructAI : public ScriptedAI + { + mob_shadowy_constructAI(Creature* c) : ScriptedAI(c) {} + + uint64 GhostGUID; + uint64 TeronGUID; + + uint32 CheckPlayerTimer; + uint32 CheckTeronTimer; + + void Reset() + { + GhostGUID = 0; + TeronGUID = 0; + + CheckPlayerTimer = 2000; + CheckTeronTimer = 5000; + } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) + { + if (!who || (!who->isAlive()) || (who->GetGUID() == GhostGUID)) + return; + + ScriptedAI::MoveInLineOfSight(who); + } + + /* Comment it out for now. NOTE TO FUTURE DEV: UNCOMMENT THIS OUT ONLY AFTER MIND CONTROL IS IMPLEMENTED + void DamageTaken(Unit* done_by, uint32 &damage) + { + if (done_by->GetGUID() != GhostGUID) + damage = 0; // Only the ghost can deal damage. + } + */ + + void CheckPlayers() + { + std::list& m_threatlist = me->getThreatManager().getThreatList(); + if (m_threatlist.empty()) + return; // No threat list. Don't continue. + std::list::const_iterator itr = m_threatlist.begin(); + std::list targets; + for (; itr != m_threatlist.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) + targets.push_back(pUnit); + } + targets.sort(Trinity::ObjectDistanceOrderPred(me)); + Unit *pTarget = targets.front(); + if (pTarget && me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) + { + DoCast(pTarget, SPELL_ATROPHY); + me->AI()->AttackStart(pTarget); + } + } + + void UpdateAI(const uint32 diff) + { + if (CheckPlayerTimer <= diff) + { + CheckPlayers(); + CheckPlayerTimer = 3000; + } else CheckPlayerTimer -= diff; + + if (CheckTeronTimer <= diff) + { + Creature* Teron = (Unit::GetCreature((*me), TeronGUID)); + if (!Teron || !Teron->isAlive() || Teron->IsInEvadeMode()) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + + CheckTeronTimer = 5000; + } else CheckTeronTimer -= diff; + } + }; + +}; + class boss_teron_gorefiend : public CreatureScript +{ +public: + boss_teron_gorefiend() : CreatureScript("boss_teron_gorefiend") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_teron_gorefiendAI (pCreature); + } + + struct boss_teron_gorefiendAI : public ScriptedAI + { + boss_teron_gorefiendAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 IncinerateTimer; + uint32 SummonDoomBlossomTimer; + uint32 EnrageTimer; + uint32 CrushingShadowsTimer; + uint32 ShadowOfDeathTimer; + uint32 SummonShadowsTimer; + uint32 RandomYellTimer; + uint32 AggroTimer; + + uint64 AggroTargetGUID; + uint64 GhostGUID; // Player that gets killed by Shadow of Death and gets turned into a ghost + + bool Intro; + bool Done; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_TERONGOREFIENDEVENT, NOT_STARTED); + + IncinerateTimer = 20000 + rand()%11000; + SummonDoomBlossomTimer = 12000; + EnrageTimer = 600000; + CrushingShadowsTimer = 22000; + SummonShadowsTimer = 60000; + RandomYellTimer = 50000; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + // Start off unattackable so that the intro is done properly + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + AggroTimer = 20000; + AggroTargetGUID = 0; + Intro = false; + Done = false; + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit* pWho) + { + if (!Intro && pWho->GetTypeId() == TYPEID_PLAYER && pWho->isTargetableForAttack() && me->IsHostileTo(pWho) && pWho->isInAccessiblePlaceFor(me)) + { + if (me->IsWithinDistInMap(pWho, VISIBLE_RANGE) && me->IsWithinLOSInMap(pWho)) + { + if (pInstance) + pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS); + + me->GetMotionMaster()->Clear(false); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoScriptText(SAY_INTRO, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK); + AggroTargetGUID = pWho->GetGUID(); + Intro = true; + } + } + if (Done) + ScriptedAI::MoveInLineOfSight(pWho); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_TERONGOREFIENDEVENT, DONE); + + DoScriptText(SAY_DEATH, me); + } + + float CalculateRandomLocation(float Loc, uint32 radius) + { + float coord = Loc; + switch (urand(0,1)) + { + case 0: + coord += rand()%radius; + break; + case 1: + coord -= rand()%radius; + break; + } + return coord; + } + + void SetThreatList(Creature* Blossom) + { + if (!Blossom) return; + + std::list& m_threatlist = me->getThreatManager().getThreatList(); + std::list::const_iterator i = m_threatlist.begin(); + for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) + { + float threat = DoGetThreat(pUnit); + Blossom->AddThreat(pUnit, threat); + } + } + } + + void MindControlGhost() + { + /************************************************************************/ + /** NOTE FOR FUTURE DEVELOPER: PROPERLY IMPLEMENT THE GHOST PORTION *****/ + /** ONLY AFTER TrinIty FULLY IMPLEMENTS MIND CONTROL ABILITIES *****/ + /** THE CURRENT CODE IN THIS FUNCTION IS ONLY THE BEGINNING OF *****/ + /** WHAT IS FULLY NECESSARY FOR GOREFIEND TO BE 100% COMPLETE *****/ + /************************************************************************/ + + Unit* Ghost = NULL; + if (GhostGUID) + Ghost = Unit::GetUnit((*me), GhostGUID); + if (Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH)) + { + /*float x,y,z; + Ghost->GetPosition(x,y,z); + Creature* control = me->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000); + if (control) + { + CAST_PLR(Ghost)->Possess(control); + Ghost->DealDamage(Ghost, Ghost->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, + false); + }*/ + for (uint8 i = 0; i < 4; ++i) + { + Creature* Construct = NULL; + float X = CalculateRandomLocation(Ghost->GetPositionX(), 10); + float Y = CalculateRandomLocation(Ghost->GetPositionY(), 10); + Construct = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, Y, Ghost->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000); + if (Construct) + { + Construct->CastSpell(Construct, SPELL_PASSIVE_SHADOWFORM, true); + SetThreatList(Construct); // Use same function as Doom Blossom to set Threat List. + CAST_AI(mob_shadowy_construct::mob_shadowy_constructAI, Construct->AI())->GhostGUID = GhostGUID; + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) // someone's trying to solo. + pTarget = me->getVictim(); + + if (pTarget) + Construct->GetMotionMaster()->MoveChase(pTarget); + } + } + } + } + + void UpdateAI(const uint32 diff) + { + if (Intro && !Done) + { + if (AggroTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + DoScriptText(SAY_AGGRO, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + Done = true; + if (AggroTargetGUID) + { + Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID); + if (pUnit) + AttackStart(pUnit); + + DoZoneInCombat(); + } + else + { + EnterEvadeMode(); + return; + } + } else AggroTimer -= diff; + } + + if (!UpdateVictim() || !Done) + return; + + if (SummonShadowsTimer <= diff) + { + //MindControlGhost(); + + for (uint8 i = 0; i < 2; ++i) + { + Creature* Shadow = NULL; + float X = CalculateRandomLocation(me->GetPositionX(), 10); + Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0); + if (Shadow) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) + pTarget = me->getVictim(); + + if (pTarget) + Shadow->AI()->AttackStart(pTarget); + } + } + SummonShadowsTimer = 60000; + } else SummonShadowsTimer -= diff; + + if (SummonDoomBlossomTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + float X = CalculateRandomLocation(pTarget->GetPositionX(), 20); + float Y = CalculateRandomLocation(pTarget->GetPositionY(), 20); + float Z = pTarget->GetPositionZ(); + Z = me->GetMap()->GetHeight(X, Y, Z); + Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); + if (DoomBlossom) + { + DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoomBlossom->setFaction(me->getFaction()); + DoomBlossom->AddThreat(pTarget, 1.0f); + CAST_AI(mob_doom_blossom::mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID()); + pTarget->CombatStart(DoomBlossom); + SetThreatList(DoomBlossom); + SummonDoomBlossomTimer = 35000; + } + } + } else SummonDoomBlossomTimer -= diff; + + if (IncinerateTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) + pTarget = me->getVictim(); + + if (pTarget) + { + DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), me); + DoCast(pTarget, SPELL_INCINERATE); + IncinerateTimer = 20000 + rand()%31 * 1000; + } + } else IncinerateTimer -= diff; + + if (CrushingShadowsTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget && pTarget->isAlive()) + DoCast(pTarget, SPELL_CRUSHING_SHADOWS); + CrushingShadowsTimer = 10000 + rand()%16 * 1000; + } else CrushingShadowsTimer -= diff; + + /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/ + /*if (ShadowOfDeathTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + + if (!pTarget) + pTarget = me->getVictim(); + + if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoCast(pTarget, SPELL_SHADOW_OF_DEATH); + GhostGUID = pTarget->GetGUID(); + ShadowOfDeathTimer = 30000; + SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player + } + } else ShadowOfDeathTimer -= diff;*/ + + if (RandomYellTimer <= diff) + { + DoScriptText(RAND(SAY_SPELL1,SAY_SPELL2), me); + RandomYellTimer = 50000 + rand()%51 * 1000; + } else RandomYellTimer -= diff; + + if (!me->HasAura(SPELL_BERSERK)) + { + if (EnrageTimer <= diff) + { + DoCast(me, SPELL_BERSERK); + DoScriptText(SAY_ENRAGE, me); + } else EnrageTimer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_doom_blossom(Creature* pCreature) -{ - return new mob_doom_blossomAI(pCreature); -} -CreatureAI* GetAI_mob_shadowy_construct(Creature* pCreature) -{ - return new mob_shadowy_constructAI(pCreature); -} -CreatureAI* GetAI_boss_teron_gorefiend(Creature* pCreature) -{ - return new boss_teron_gorefiendAI (pCreature); -} void AddSC_boss_teron_gorefiend() { - Script *newscript; - newscript = new Script; - newscript->Name = "mob_doom_blossom"; - newscript->GetAI = &GetAI_mob_doom_blossom; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shadowy_construct"; - newscript->GetAI = &GetAI_mob_shadowy_construct; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_teron_gorefiend"; - newscript->GetAI = &GetAI_boss_teron_gorefiend; - newscript->RegisterSelf(); + new mob_doom_blossom(); + new mob_shadowy_construct(); + new boss_teron_gorefiend(); } - diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 3f39cb0aea7..766f020291f 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -59,170 +59,174 @@ enum eEnums GCD_CAST = 1, GCD_YELL = 2 }; - -struct boss_najentusAI : public ScriptedAI + class boss_najentus : public CreatureScript { - boss_najentusAI(Creature *c) : ScriptedAI(c) +public: + boss_najentus() : CreatureScript("boss_najentus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_najentusAI (pCreature); } - ScriptedInstance* pInstance; - EventMap events; - - uint64 SpineTargetGUID; - - void Reset() + struct boss_najentusAI : public ScriptedAI { - events.Reset(); - - SpineTargetGUID = 0; - - if (pInstance) - pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, NOT_STARTED); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me); - events.DelayEvents(5000, GCD_YELL); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE); - - DoScriptText(SAY_DEATH, me); - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD)) + boss_najentusAI(Creature *c) : ScriptedAI(c) { - me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD); - DoCast(me, SPELL_TIDAL_BURST, true); + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + EventMap events; + + uint64 SpineTargetGUID; + + void Reset() + { + events.Reset(); + + SpineTargetGUID = 0; + + if (pInstance) + pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, NOT_STARTED); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(rand()%2 ? SAY_SLAY1 : SAY_SLAY2, me); + events.DelayEvents(5000, GCD_YELL); + } + + void JustDied(Unit * /*victim*/) + { + if (pInstance) + pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, DONE); + + DoScriptText(SAY_DEATH, me); + } + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD)) + { + me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD); + DoCast(me, SPELL_TIDAL_BURST, true); + ResetTimer(); + } + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, IN_PROGRESS); + + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST); + events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL); ResetTimer(); } - } - void EnterCombat(Unit * /*who*/) + bool RemoveImpalingSpine() + { + if (!SpineTargetGUID) return false; + Unit *pTarget = Unit::GetUnit(*me, SpineTargetGUID); + if (pTarget && pTarget->HasAura(SPELL_IMPALING_SPINE)) + pTarget->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); + SpineTargetGUID=0; + return true; + } + + void ResetTimer(uint32 inc = 0) + { + events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST); + events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST); + events.RescheduleEvent(EVENT_SHIELD, 60000 + inc); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + while (uint32 eventId = events.ExecuteEvent()) + { + switch(eventId) + { + case EVENT_SHIELD: + DoCast(me, SPELL_TIDAL_SHIELD, true); + ResetTimer(45000); + break; + case EVENT_BERSERK: + DoScriptText(SAY_ENRAGE2, me); + DoCast(me, SPELL_BERSERK, true); + events.DelayEvents(15000, GCD_YELL); + break; + case EVENT_SPINE: + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!pTarget) pTarget = me->getVictim(); + if (pTarget) + { + DoCast(pTarget, SPELL_IMPALING_SPINE, true); + SpineTargetGUID = pTarget->GetGUID(); + //must let target summon, otherwise you cannot click the spine + pTarget->SummonGameObject(GOBJECT_SPINE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); + DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me); + events.DelayEvents(1500, GCD_CAST); + events.DelayEvents(15000, GCD_YELL); + } + events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST); + return; + } + case EVENT_NEEDLE: + { + //DoCast(me, SPELL_NEEDLE_SPINE, true); + std::list pTargets; + SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true); + for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) + DoCast(*i, 39835, true); + events.ScheduleEvent(EVENT_NEEDLE, urand(15000,25000), GCD_CAST); + events.DelayEvents(1500, GCD_CAST); + return; + } + case EVENT_YELL: + DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me); + events.ScheduleEvent(EVENT_YELL, urand(25000,100000), GCD_YELL); + events.DelayEvents(15000, GCD_YELL); + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + class go_najentus_spine : public GameObjectScript +{ +public: + go_najentus_spine() : GameObjectScript("go_najentus_spine") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - if (pInstance) - pInstance->SetData(DATA_HIGHWARLORDNAJENTUSEVENT, IN_PROGRESS); - - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST); - events.ScheduleEvent(EVENT_YELL, 45000 + (rand()%76)*1000, GCD_YELL); - ResetTimer(); - } - - bool RemoveImpalingSpine() - { - if (!SpineTargetGUID) return false; - Unit *pTarget = Unit::GetUnit(*me, SpineTargetGUID); - if (pTarget && pTarget->HasAura(SPELL_IMPALING_SPINE)) - pTarget->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE); - SpineTargetGUID=0; + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + if (Creature* Najentus = Unit::GetCreature(*pGo, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS))) + if (CAST_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) + { + pPlayer->CastSpell(pPlayer, SPELL_CREATE_NAJENTUS_SPINE, true); + pGo->Delete(); + } return true; } - void ResetTimer(uint32 inc = 0) - { - events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST); - events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST); - events.RescheduleEvent(EVENT_SHIELD, 60000 + inc); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_SHIELD: - DoCast(me, SPELL_TIDAL_SHIELD, true); - ResetTimer(45000); - break; - case EVENT_BERSERK: - DoScriptText(SAY_ENRAGE2, me); - DoCast(me, SPELL_BERSERK, true); - events.DelayEvents(15000, GCD_YELL); - break; - case EVENT_SPINE: - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!pTarget) pTarget = me->getVictim(); - if (pTarget) - { - DoCast(pTarget, SPELL_IMPALING_SPINE, true); - SpineTargetGUID = pTarget->GetGUID(); - //must let target summon, otherwise you cannot click the spine - pTarget->SummonGameObject(GOBJECT_SPINE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30); - DoScriptText(rand()%2 ? SAY_NEEDLE1 : SAY_NEEDLE2, me); - events.DelayEvents(1500, GCD_CAST); - events.DelayEvents(15000, GCD_YELL); - } - events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST); - return; - } - case EVENT_NEEDLE: - { - //DoCast(me, SPELL_NEEDLE_SPINE, true); - std::list pTargets; - SelectTargetList(pTargets, 3, SELECT_TARGET_RANDOM, 80, true); - for (std::list::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i) - DoCast(*i, 39835, true); - events.ScheduleEvent(EVENT_NEEDLE, urand(15000,25000), GCD_CAST); - events.DelayEvents(1500, GCD_CAST); - return; - } - case EVENT_YELL: - DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me); - events.ScheduleEvent(EVENT_YELL, urand(25000,100000), GCD_YELL); - events.DelayEvents(15000, GCD_YELL); - break; - } - } - - DoMeleeAttackIfReady(); - } }; -bool GOHello_go_najentus_spine(Player* pPlayer, GameObject* pGo) -{ - if (ScriptedInstance* pInstance = pGo->GetInstanceData()) - if (Creature* Najentus = Unit::GetCreature(*pGo, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS))) - if (CAST_AI(boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) - { - pPlayer->CastSpell(pPlayer, SPELL_CREATE_NAJENTUS_SPINE, true); - pGo->Delete(); - } - return true; -} - -CreatureAI* GetAI_boss_najentus(Creature* pCreature) -{ - return new boss_najentusAI (pCreature); -} void AddSC_boss_najentus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_najentus"; - newscript->GetAI = &GetAI_boss_najentus; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_najentus_spine"; - newscript->pGOHello = &GOHello_go_najentus_spine; - newscript->RegisterSelf(); + new boss_najentus(); + new go_najentus_spine(); } - diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index c5fb8159a41..cea84c928a8 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -108,254 +108,276 @@ static CouncilYells CouncilEnrage[]= #define SPELL_VANISH 41479 #define SPELL_BERSERK 45078 - -struct mob_blood_elf_council_voice_triggerAI : public ScriptedAI + class mob_blood_elf_council_voice_trigger : public CreatureScript { - mob_blood_elf_council_voice_triggerAI(Creature* c) : ScriptedAI(c) +public: + mob_blood_elf_council_voice_trigger() : CreatureScript("mob_blood_elf_council_voice_trigger") { } + + CreatureAI* GetAI(Creature* c) { - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; + return new mob_blood_elf_council_voice_triggerAI(c); } - uint64 Council[4]; - - uint32 EnrageTimer; - uint32 AggroYellTimer; - - uint8 YellCounter; // Serves as the counter for both the aggro and enrage yells - - bool EventStarted; - - void Reset() + struct mob_blood_elf_council_voice_triggerAI : public ScriptedAI { - EnrageTimer = 900000; // 15 minutes - AggroYellTimer = 500; - - YellCounter = 0; - - EventStarted = false; - } - - // finds and stores the GUIDs for each Council member using instance data system. - void LoadCouncilGUIDs() - { - if (ScriptedInstance* pInstance = me->GetInstanceData()) + mob_blood_elf_council_voice_triggerAI(Creature* c) : ScriptedAI(c) { - Council[0] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); - Council[1] = pInstance->GetData64(DATA_VERASDARKSHADOW); - Council[2] = pInstance->GetData64(DATA_LADYMALANDE); - Council[3] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); - } else sLog.outError(ERROR_INST_DATA); - } + for (uint8 i = 0; i < 4; ++i) + Council[i] = 0; + } - void EnterCombat(Unit* /*who*/) {} + uint64 Council[4]; - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} + uint32 EnrageTimer; + uint32 AggroYellTimer; - void UpdateAI(const uint32 diff) - { - if (!EventStarted) - return; + uint8 YellCounter; // Serves as the counter for both the aggro and enrage yells - if (YellCounter > 3) - return; + bool EventStarted; - if (AggroYellTimer) + void Reset() { - if (AggroYellTimer <= diff) + EnrageTimer = 900000; // 15 minutes + AggroYellTimer = 500; + + YellCounter = 0; + + EventStarted = false; + } + + // finds and stores the GUIDs for each Council member using instance data system. + void LoadCouncilGUIDs() { - if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter])) + if (InstanceScript* pInstance = me->GetInstanceScript()) { - DoScriptText(CouncilAggro[YellCounter].entry, pMember); - AggroYellTimer = CouncilAggro[YellCounter].timer; - } - ++YellCounter; + Council[0] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); + Council[1] = pInstance->GetData64(DATA_VERASDARKSHADOW); + Council[2] = pInstance->GetData64(DATA_LADYMALANDE); + Council[3] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); + } else sLog.outError(ERROR_INST_DATA); + } + + void EnterCombat(Unit* /*who*/) {} + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!EventStarted) + return; + if (YellCounter > 3) - YellCounter = 0; // Reuse for Enrage Yells - } else AggroYellTimer -= diff; - } + return; - if (EnrageTimer) - { - if (EnrageTimer <= diff) - { - if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter])) + if (AggroYellTimer) { - pMember->CastSpell(pMember, SPELL_BERSERK, true); - DoScriptText(CouncilEnrage[YellCounter].entry, pMember); - EnrageTimer = CouncilEnrage[YellCounter].timer; + if (AggroYellTimer <= diff) + { + if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter])) + { + DoScriptText(CouncilAggro[YellCounter].entry, pMember); + AggroYellTimer = CouncilAggro[YellCounter].timer; + } + ++YellCounter; + if (YellCounter > 3) + YellCounter = 0; // Reuse for Enrage Yells + } else AggroYellTimer -= diff; + } + + if (EnrageTimer) + { + if (EnrageTimer <= diff) + { + if (Unit* pMember = Unit::GetUnit(*me, Council[YellCounter])) + { + pMember->CastSpell(pMember, SPELL_BERSERK, true); + DoScriptText(CouncilEnrage[YellCounter].entry, pMember); + EnrageTimer = CouncilEnrage[YellCounter].timer; + } + ++YellCounter; + } else EnrageTimer -= diff; } - ++YellCounter; - } else EnrageTimer -= diff; } - } + }; + }; - -struct mob_illidari_councilAI : public ScriptedAI + class mob_illidari_council : public CreatureScript { - mob_illidari_councilAI(Creature *c) : ScriptedAI(c) +public: + mob_illidari_council() : CreatureScript("mob_illidari_council") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; + return new mob_illidari_councilAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 Council[4]; - - uint32 CheckTimer; - uint32 EndEventTimer; - - uint8 DeathCount; - - bool EventBegun; - - void Reset() + struct mob_illidari_councilAI : public ScriptedAI { - CheckTimer = 2000; - EndEventTimer = 0; - - DeathCount = 0; - - Creature* pMember = NULL; - for (uint8 i = 0; i < 4; ++i) + mob_illidari_councilAI(Creature *c) : ScriptedAI(c) { - pMember = Unit::GetCreature((*me), Council[i]); - if (!pMember) - continue; - - if (!pMember->isAlive()) - { - pMember->RemoveCorpse(); - pMember->Respawn(); - } - pMember->AI()->EnterEvadeMode(); + pInstance = c->GetInstanceScript(); + for (uint8 i = 0; i < 4; ++i) + Council[i] = 0; } - if (pInstance) + InstanceScript* pInstance; + + uint64 Council[4]; + + uint32 CheckTimer; + uint32 EndEventTimer; + + uint8 DeathCount; + + bool EventBegun; + + void Reset() { - pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED); - if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) - VoiceTrigger->AI()->EnterEvadeMode(); - } + CheckTimer = 2000; + EndEventTimer = 0; - EventBegun = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(11686); - } - - void EnterCombat(Unit * /*who*/) {} - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - - void StartEvent(Unit *pTarget) - { - if (!pInstance) - return; - - if (pTarget && pTarget->isAlive()) - { - Council[0] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); - Council[1] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); - Council[2] = pInstance->GetData64(DATA_LADYMALANDE); - Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW); - - // Start the event for the Voice Trigger - if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) - { - CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); - CAST_AI(mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; - } + DeathCount = 0; + Creature* pMember = NULL; for (uint8 i = 0; i < 4; ++i) { - Unit* Member = NULL; - if (Council[i]) + pMember = Unit::GetCreature((*me), Council[i]); + if (!pMember) + continue; + + if (!pMember->isAlive()) { - Member = Unit::GetUnit((*me), Council[i]); - if (Member && Member->isAlive()) - CAST_CRE(Member)->AI()->AttackStart(pTarget); + pMember->RemoveCorpse(); + pMember->Respawn(); } + pMember->AI()->EnterEvadeMode(); } - pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, IN_PROGRESS); - - EventBegun = true; - } - } - - void UpdateAI(const uint32 diff) - { - if (!EventBegun) return; - - if (EndEventTimer) - { - if (EndEventTimer <= diff) + if (pInstance) { - if (DeathCount > 3) + pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED); + if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) + VoiceTrigger->AI()->EnterEvadeMode(); + } + + EventBegun = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(11686); + } + + void EnterCombat(Unit * /*who*/) {} + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + + void StartEvent(Unit *pTarget) + { + if (!pInstance) + return; + + if (pTarget && pTarget->isAlive()) + { + Council[0] = pInstance->GetData64(DATA_GATHIOSTHESHATTERER); + Council[1] = pInstance->GetData64(DATA_HIGHNETHERMANCERZEREVOR); + Council[2] = pInstance->GetData64(DATA_LADYMALANDE); + Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW); + + // Start the event for the Voice Trigger + if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) { - if (pInstance) - { - if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) - VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, DONE); - //me->SummonCreature(AKAMAID,746.466980f,304.394989f,311.90208f,6.272870f,TEMPSUMMON_DEAD_DESPAWN,0); - } - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return; + CAST_AI(mob_blood_elf_council_voice_trigger::mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->LoadCouncilGUIDs(); + CAST_AI(mob_blood_elf_council_voice_trigger::mob_blood_elf_council_voice_triggerAI, VoiceTrigger->AI())->EventStarted = true; } - Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount])); - if (pMember && pMember->isAlive()) - pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - ++DeathCount; - EndEventTimer = 1500; - } else EndEventTimer -= diff; - } - - if (CheckTimer) - { - if (CheckTimer <= diff) - { - uint8 EvadeCheck = 0; for (uint8 i = 0; i < 4; ++i) { + Unit* Member = NULL; if (Council[i]) { - if (Creature* Member = (Unit::GetCreature((*me), Council[i]))) + Member = Unit::GetUnit((*me), Council[i]); + if (Member && Member->isAlive()) + CAST_CRE(Member)->AI()->AttackStart(pTarget); + } + } + + pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, IN_PROGRESS); + + EventBegun = true; + } + } + + void UpdateAI(const uint32 diff) + { + if (!EventBegun) return; + + if (EndEventTimer) + { + if (EndEventTimer <= diff) + { + if (DeathCount > 3) + { + if (pInstance) { - // This is the evade/death check. - if (Member->isAlive() && !Member->getVictim()) - ++EvadeCheck; //If all members evade, we reset so that players can properly reset the event - else if (!Member->isAlive()) // If even one member dies, kill the rest, set instance data, and kill self. + if (Creature* VoiceTrigger = (Unit::GetCreature(*me, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE)))) + VoiceTrigger->DealDamage(VoiceTrigger, VoiceTrigger->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, DONE); + //me->SummonCreature(AKAMAID,746.466980f,304.394989f,311.90208f,6.272870f,TEMPSUMMON_DEAD_DESPAWN,0); + } + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return; + } + + Creature* pMember = (Unit::GetCreature(*me, Council[DeathCount])); + if (pMember && pMember->isAlive()) + pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + ++DeathCount; + EndEventTimer = 1500; + } else EndEventTimer -= diff; + } + + if (CheckTimer) + { + if (CheckTimer <= diff) + { + uint8 EvadeCheck = 0; + for (uint8 i = 0; i < 4; ++i) + { + if (Council[i]) + { + if (Creature* Member = (Unit::GetCreature((*me), Council[i]))) { - EndEventTimer = 1000; - CheckTimer = 0; - return; + // This is the evade/death check. + if (Member->isAlive() && !Member->getVictim()) + ++EvadeCheck; //If all members evade, we reset so that players can properly reset the event + else if (!Member->isAlive()) // If even one member dies, kill the rest, set instance data, and kill self. + { + EndEventTimer = 1000; + CheckTimer = 0; + return; + } } } } - } - if (EvadeCheck > 3) - Reset(); + if (EvadeCheck > 3) + Reset(); + + CheckTimer = 2000; + } else CheckTimer -= diff; + } - CheckTimer = 2000; - } else CheckTimer -= diff; } + }; - } }; struct boss_illidari_councilAI : public ScriptedAI { boss_illidari_councilAI(Creature* c) : ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); for (uint8 i = 0; i < 4; ++i) Council[i] = 0; LoadedGUIDs = false; @@ -363,7 +385,7 @@ struct boss_illidari_councilAI : public ScriptedAI uint64 Council[4]; - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool LoadedGUIDs; @@ -373,7 +395,7 @@ struct boss_illidari_councilAI : public ScriptedAI { Creature* Controller = (Unit::GetCreature(*me, pInstance->GetData64(DATA_ILLIDARICOUNCIL))); if (Controller) - CAST_AI(mob_illidari_councilAI, Controller->AI())->StartEvent(who); + CAST_AI(mob_illidari_council::mob_illidari_councilAI, Controller->AI())->StartEvent(who); } else { @@ -437,440 +459,434 @@ struct boss_illidari_councilAI : public ScriptedAI LoadedGUIDs = true; } }; - -struct boss_gathios_the_shattererAI : public boss_illidari_councilAI + class boss_gathios_the_shatterer : public CreatureScript { - boss_gathios_the_shattererAI(Creature *c) : boss_illidari_councilAI(c) {} +public: + boss_gathios_the_shatterer() : CreatureScript("boss_gathios_the_shatterer") { } - uint32 ConsecrationTimer; - uint32 HammerOfJusticeTimer; - uint32 SealTimer; - uint32 AuraTimer; - uint32 BlessingTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ConsecrationTimer = 40000; - HammerOfJusticeTimer = 10000; - SealTimer = 40000; - AuraTimer = 90000; - BlessingTimer = 60000; + return new boss_gathios_the_shattererAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_gathios_the_shattererAI : public boss_illidari_councilAI { - DoScriptText(SAY_GATH_SLAY, me); - } + boss_gathios_the_shattererAI(Creature *c) : boss_illidari_councilAI(c) {} - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_GATH_DEATH, me); - } + uint32 ConsecrationTimer; + uint32 HammerOfJusticeTimer; + uint32 SealTimer; + uint32 AuraTimer; + uint32 BlessingTimer; - Unit* SelectCouncilMember() - { - Unit* pUnit = me; - uint32 member = 0; // He chooses Lady Malande most often - - if (rand()%10 == 0) // But there is a chance he picks someone else. - member = urand(1, 3); - - if (member != 2) // No need to create another pointer to us using Unit::GetUnit - pUnit = Unit::GetUnit((*me), Council[member]); - return pUnit; - } - - void CastAuraOnCouncil() - { - uint32 spellid = 0; - switch (urand(0,1)) + void Reset() { - case 0: spellid = SPELL_DEVOTION_AURA; break; - case 1: spellid = SPELL_CHROMATIC_AURA; break; - } - for (uint8 i = 0; i < 4; ++i) - { - Unit* pUnit = Unit::GetUnit((*me), Council[i]); - if (pUnit) - pUnit->CastSpell(pUnit, spellid, true, 0, 0, me->GetGUID()); - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (BlessingTimer <= diff) - { - if (Unit* pUnit = SelectCouncilMember()) - { - switch (urand(0,1)) - { - case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD); break; - case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break; - } - } - BlessingTimer = 60000; - } else BlessingTimer -= diff; - - if (ConsecrationTimer <= diff) - { - DoCast(me, SPELL_CONSECRATION); ConsecrationTimer = 40000; - } else ConsecrationTimer -= diff; + HammerOfJusticeTimer = 10000; + SealTimer = 40000; + AuraTimer = 90000; + BlessingTimer = 60000; + } - if (HammerOfJusticeTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - // is in ~10-40 yd range - if (me->IsInRange(pTarget, 10.0f, 40.0f, false)) - { - DoCast(pTarget, SPELL_HAMMER_OF_JUSTICE); - HammerOfJusticeTimer = 20000; - } - } - } else HammerOfJusticeTimer -= diff; + DoScriptText(SAY_GATH_SLAY, me); + } - if (SealTimer <= diff) + void JustDied(Unit * /*victim*/) { + DoScriptText(SAY_GATH_DEATH, me); + } + + Unit* SelectCouncilMember() + { + Unit* pUnit = me; + uint32 member = 0; // He chooses Lady Malande most often + + if (rand()%10 == 0) // But there is a chance he picks someone else. + member = urand(1, 3); + + if (member != 2) // No need to create another pointer to us using Unit::GetUnit + pUnit = Unit::GetUnit((*me), Council[member]); + return pUnit; + } + + void CastAuraOnCouncil() + { + uint32 spellid = 0; switch (urand(0,1)) { - case 0: DoCast(me, SPELL_SEAL_OF_COMMAND); break; - case 1: DoCast(me, SPELL_SEAL_OF_BLOOD); break; + case 0: spellid = SPELL_DEVOTION_AURA; break; + case 1: spellid = SPELL_CHROMATIC_AURA; break; } - SealTimer = 40000; - } else SealTimer -= diff; - - if (AuraTimer <= diff) - { - CastAuraOnCouncil(); - AuraTimer = 90000; - } else AuraTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI -{ - boss_high_nethermancer_zerevorAI(Creature *c) : boss_illidari_councilAI(c) {} - - uint32 BlizzardTimer; - uint32 FlamestrikeTimer; - uint32 ArcaneBoltTimer; - uint32 DampenMagicTimer; - uint32 Cooldown; - uint32 ArcaneExplosionTimer; - - void Reset() - { - BlizzardTimer = 30000 + rand()%61 * 1000; - FlamestrikeTimer = 30000 + rand()%61 * 1000; - ArcaneBoltTimer = 10000; - DampenMagicTimer = 2000; - ArcaneExplosionTimer = 14000; - Cooldown = 0; - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_ZERE_SLAY, me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_ZERE_DEATH, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Cooldown) - { - if (Cooldown <= diff) Cooldown = 0; - else + for (uint8 i = 0; i < 4; ++i) { - Cooldown -= diff; - return; // Don't cast any other spells if global cooldown is still ticking + Unit* pUnit = Unit::GetUnit((*me), Council[i]); + if (pUnit) + pUnit->CastSpell(pUnit, spellid, true, 0, 0, me->GetGUID()); } } - if (DampenMagicTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_DAMPEN_MAGIC); - Cooldown = 1000; - DampenMagicTimer = 67200; // almost 1,12 minutes - ArcaneBoltTimer += 1000; // Give the Mage some time to spellsteal Dampen. - } else DampenMagicTimer -= diff; + if (!UpdateVictim()) + return; - if (ArcaneExplosionTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); - Cooldown = 1000; - ArcaneExplosionTimer = 14000; - } else ArcaneExplosionTimer -= diff; - - if (ArcaneBoltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_BOLT); - ArcaneBoltTimer = 3000; - Cooldown = 2000; - } else ArcaneBoltTimer -= diff; - - if (BlizzardTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (BlessingTimer <= diff) { - DoCast(pTarget, SPELL_BLIZZARD); - BlizzardTimer = 45000 + rand()%46 * 1000; - FlamestrikeTimer += 10000; - Cooldown = 1000; - } - } else BlizzardTimer -= diff; + if (Unit* pUnit = SelectCouncilMember()) + { + switch (urand(0,1)) + { + case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD); break; + case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break; + } + } + BlessingTimer = 60000; + } else BlessingTimer -= diff; - if (FlamestrikeTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + if (ConsecrationTimer <= diff) { - DoCast(pTarget, SPELL_FLAMESTRIKE); - FlamestrikeTimer = 55000 + rand()%46 * 1000; - BlizzardTimer += 10000; - Cooldown = 2000; - } - } else FlamestrikeTimer -= diff; - } -}; + DoCast(me, SPELL_CONSECRATION); + ConsecrationTimer = 40000; + } else ConsecrationTimer -= diff; -struct boss_lady_malandeAI : public boss_illidari_councilAI -{ - boss_lady_malandeAI(Creature *c) : boss_illidari_councilAI(c) {} - - uint32 EmpoweredSmiteTimer; - uint32 CircleOfHealingTimer; - uint32 DivineWrathTimer; - uint32 ReflectiveShieldTimer; - - void Reset() - { - EmpoweredSmiteTimer = 38000; - CircleOfHealingTimer = 20000; - DivineWrathTimer = 40000; - ReflectiveShieldTimer = 0; - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_MALA_SLAY, me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_MALA_DEATH, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (EmpoweredSmiteTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_EMPOWERED_SMITE); - EmpoweredSmiteTimer = 38000; - } - } else EmpoweredSmiteTimer -= diff; - - if (CircleOfHealingTimer <= diff) - { - DoCast(me, SPELL_CIRCLE_OF_HEALING); - CircleOfHealingTimer = 60000; - } else CircleOfHealingTimer -= diff; - - if (DivineWrathTimer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(pTarget, SPELL_DIVINE_WRATH); - DivineWrathTimer = 40000 + rand()%41 * 1000; - } - } else DivineWrathTimer -= diff; - - if (ReflectiveShieldTimer <= diff) - { - DoCast(me, SPELL_REFLECTIVE_SHIELD); - ReflectiveShieldTimer = 65000; - } else ReflectiveShieldTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct boss_veras_darkshadowAI : public boss_illidari_councilAI -{ - boss_veras_darkshadowAI(Creature *c) : boss_illidari_councilAI(c) {} - - uint64 EnvenomTargetGUID; - - uint32 DeadlyPoisonTimer; - uint32 VanishTimer; - uint32 AppearEnvenomTimer; - - bool HasVanished; - - void Reset() - { - EnvenomTargetGUID = 0; - - DeadlyPoisonTimer = 20000; - VanishTimer = 60000 + rand()%61 * 1000; - AppearEnvenomTimer = 150000; - - HasVanished = false; - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(SAY_VERA_SLAY, me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_VERA_DEATH, me); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!HasVanished) - { - if (DeadlyPoisonTimer <= diff) - { - DoCast(me->getVictim(), SPELL_DEADLY_POISON); - DeadlyPoisonTimer = 15000 + rand()%31 * 1000; - } else DeadlyPoisonTimer -= diff; - - if (AppearEnvenomTimer <= diff) // Cast Envenom. This is cast 4 seconds after Vanish is over - { - DoCast(me->getVictim(), SPELL_ENVENOM); - AppearEnvenomTimer = 90000; - } else AppearEnvenomTimer -= diff; - - if (VanishTimer <= diff) // Disappear and stop attacking, but follow a random unit + if (HammerOfJusticeTimer <= diff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { - VanishTimer = 30000; - AppearEnvenomTimer= 28000; - HasVanished = true; - me->SetVisibility(VISIBILITY_OFF); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoResetThreat(); - // Chase a unit. Check before DoMeleeAttackIfReady prevents from attacking - me->AddThreat(pTarget, 500000.0f); - me->GetMotionMaster()->MoveChase(pTarget); + // is in ~10-40 yd range + if (me->IsInRange(pTarget, 10.0f, 40.0f, false)) + { + DoCast(pTarget, SPELL_HAMMER_OF_JUSTICE); + HammerOfJusticeTimer = 20000; + } } - } else VanishTimer -= diff; + } else HammerOfJusticeTimer -= diff; + + if (SealTimer <= diff) + { + switch (urand(0,1)) + { + case 0: DoCast(me, SPELL_SEAL_OF_COMMAND); break; + case 1: DoCast(me, SPELL_SEAL_OF_BLOOD); break; + } + SealTimer = 40000; + } else SealTimer -= diff; + + if (AuraTimer <= diff) + { + CastAuraOnCouncil(); + AuraTimer = 90000; + } else AuraTimer -= diff; DoMeleeAttackIfReady(); } - else - { - if (VanishTimer <= diff) // Become attackable and poison current target - { - Unit *pTarget = me->getVictim(); - DoCast(pTarget, SPELL_DEADLY_POISON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoResetThreat(); - me->AddThreat(pTarget, 3000.0f); // Make Veras attack his target for a while, he will cast Envenom 4 seconds after. - DeadlyPoisonTimer += 6000; - VanishTimer = 90000; - AppearEnvenomTimer = 4000; - HasVanished = false; - } else VanishTimer -= diff; + }; - if (AppearEnvenomTimer <= diff) // Appear 2 seconds before becoming attackable (Shifting out of vanish) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); - me->SetVisibility(VISIBILITY_ON); - AppearEnvenomTimer = 6000; - } else AppearEnvenomTimer -= diff; - } +}; + class boss_high_nethermancer_zerevor : public CreatureScript +{ +public: + boss_high_nethermancer_zerevor() : CreatureScript("boss_high_nethermancer_zerevor") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_high_nethermancer_zerevorAI (pCreature); } + + struct boss_high_nethermancer_zerevorAI : public boss_illidari_councilAI + { + boss_high_nethermancer_zerevorAI(Creature *c) : boss_illidari_councilAI(c) {} + + uint32 BlizzardTimer; + uint32 FlamestrikeTimer; + uint32 ArcaneBoltTimer; + uint32 DampenMagicTimer; + uint32 Cooldown; + uint32 ArcaneExplosionTimer; + + void Reset() + { + BlizzardTimer = 30000 + rand()%61 * 1000; + FlamestrikeTimer = 30000 + rand()%61 * 1000; + ArcaneBoltTimer = 10000; + DampenMagicTimer = 2000; + ArcaneExplosionTimer = 14000; + Cooldown = 0; + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_ZERE_SLAY, me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_ZERE_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Cooldown) + { + if (Cooldown <= diff) Cooldown = 0; + else + { + Cooldown -= diff; + return; // Don't cast any other spells if global cooldown is still ticking + } + } + + if (DampenMagicTimer <= diff) + { + DoCast(me, SPELL_DAMPEN_MAGIC); + Cooldown = 1000; + DampenMagicTimer = 67200; // almost 1,12 minutes + ArcaneBoltTimer += 1000; // Give the Mage some time to spellsteal Dampen. + } else DampenMagicTimer -= diff; + + if (ArcaneExplosionTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); + Cooldown = 1000; + ArcaneExplosionTimer = 14000; + } else ArcaneExplosionTimer -= diff; + + if (ArcaneBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BOLT); + ArcaneBoltTimer = 3000; + Cooldown = 2000; + } else ArcaneBoltTimer -= diff; + + if (BlizzardTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_BLIZZARD); + BlizzardTimer = 45000 + rand()%46 * 1000; + FlamestrikeTimer += 10000; + Cooldown = 1000; + } + } else BlizzardTimer -= diff; + + if (FlamestrikeTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_FLAMESTRIKE); + FlamestrikeTimer = 55000 + rand()%46 * 1000; + BlizzardTimer += 10000; + Cooldown = 2000; + } + } else FlamestrikeTimer -= diff; + } + }; + +}; + class boss_lady_malande : public CreatureScript +{ +public: + boss_lady_malande() : CreatureScript("boss_lady_malande") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_lady_malandeAI (pCreature); + } + + struct boss_lady_malandeAI : public boss_illidari_councilAI + { + boss_lady_malandeAI(Creature *c) : boss_illidari_councilAI(c) {} + + uint32 EmpoweredSmiteTimer; + uint32 CircleOfHealingTimer; + uint32 DivineWrathTimer; + uint32 ReflectiveShieldTimer; + + void Reset() + { + EmpoweredSmiteTimer = 38000; + CircleOfHealingTimer = 20000; + DivineWrathTimer = 40000; + ReflectiveShieldTimer = 0; + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_MALA_SLAY, me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_MALA_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (EmpoweredSmiteTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_EMPOWERED_SMITE); + EmpoweredSmiteTimer = 38000; + } + } else EmpoweredSmiteTimer -= diff; + + if (CircleOfHealingTimer <= diff) + { + DoCast(me, SPELL_CIRCLE_OF_HEALING); + CircleOfHealingTimer = 60000; + } else CircleOfHealingTimer -= diff; + + if (DivineWrathTimer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(pTarget, SPELL_DIVINE_WRATH); + DivineWrathTimer = 40000 + rand()%41 * 1000; + } + } else DivineWrathTimer -= diff; + + if (ReflectiveShieldTimer <= diff) + { + DoCast(me, SPELL_REFLECTIVE_SHIELD); + ReflectiveShieldTimer = 65000; + } else ReflectiveShieldTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + class boss_veras_darkshadow : public CreatureScript +{ +public: + boss_veras_darkshadow() : CreatureScript("boss_veras_darkshadow") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_veras_darkshadowAI (pCreature); + } + + struct boss_veras_darkshadowAI : public boss_illidari_councilAI + { + boss_veras_darkshadowAI(Creature *c) : boss_illidari_councilAI(c) {} + + uint64 EnvenomTargetGUID; + + uint32 DeadlyPoisonTimer; + uint32 VanishTimer; + uint32 AppearEnvenomTimer; + + bool HasVanished; + + void Reset() + { + EnvenomTargetGUID = 0; + + DeadlyPoisonTimer = 20000; + VanishTimer = 60000 + rand()%61 * 1000; + AppearEnvenomTimer = 150000; + + HasVanished = false; + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(SAY_VERA_SLAY, me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_VERA_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!HasVanished) + { + if (DeadlyPoisonTimer <= diff) + { + DoCast(me->getVictim(), SPELL_DEADLY_POISON); + DeadlyPoisonTimer = 15000 + rand()%31 * 1000; + } else DeadlyPoisonTimer -= diff; + + if (AppearEnvenomTimer <= diff) // Cast Envenom. This is cast 4 seconds after Vanish is over + { + DoCast(me->getVictim(), SPELL_ENVENOM); + AppearEnvenomTimer = 90000; + } else AppearEnvenomTimer -= diff; + + if (VanishTimer <= diff) // Disappear and stop attacking, but follow a random unit + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + VanishTimer = 30000; + AppearEnvenomTimer= 28000; + HasVanished = true; + me->SetVisibility(VISIBILITY_OFF); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoResetThreat(); + // Chase a unit. Check before DoMeleeAttackIfReady prevents from attacking + me->AddThreat(pTarget, 500000.0f); + me->GetMotionMaster()->MoveChase(pTarget); + } + } else VanishTimer -= diff; + + DoMeleeAttackIfReady(); + } + else + { + if (VanishTimer <= diff) // Become attackable and poison current target + { + Unit *pTarget = me->getVictim(); + DoCast(pTarget, SPELL_DEADLY_POISON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoResetThreat(); + me->AddThreat(pTarget, 3000.0f); // Make Veras attack his target for a while, he will cast Envenom 4 seconds after. + DeadlyPoisonTimer += 6000; + VanishTimer = 90000; + AppearEnvenomTimer = 4000; + HasVanished = false; + } else VanishTimer -= diff; + + if (AppearEnvenomTimer <= diff) // Appear 2 seconds before becoming attackable (Shifting out of vanish) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + me->SetVisibility(VISIBILITY_ON); + AppearEnvenomTimer = 6000; + } else AppearEnvenomTimer -= diff; + } + } + }; + }; -CreatureAI* GetAI_mob_blood_elf_council_voice_trigger(Creature* c) -{ - return new mob_blood_elf_council_voice_triggerAI(c); -} -CreatureAI* GetAI_mob_illidari_council(Creature* pCreature) -{ - return new mob_illidari_councilAI (pCreature); -} -CreatureAI* GetAI_boss_gathios_the_shatterer(Creature* pCreature) -{ - return new boss_gathios_the_shattererAI (pCreature); -} -CreatureAI* GetAI_boss_lady_malande(Creature* pCreature) -{ - return new boss_lady_malandeAI (pCreature); -} -CreatureAI* GetAI_boss_veras_darkshadow(Creature* pCreature) -{ - return new boss_veras_darkshadowAI (pCreature); -} -CreatureAI* GetAI_boss_high_nethermancer_zerevor(Creature* pCreature) -{ - return new boss_high_nethermancer_zerevorAI (pCreature); -} void AddSC_boss_illidari_council() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_illidari_council"; - newscript->GetAI = &GetAI_mob_illidari_council; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_blood_elf_council_voice_trigger"; - newscript->GetAI = &GetAI_mob_blood_elf_council_voice_trigger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_gathios_the_shatterer"; - newscript->GetAI = &GetAI_boss_gathios_the_shatterer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lady_malande"; - newscript->GetAI = &GetAI_boss_lady_malande; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_veras_darkshadow"; - newscript->GetAI = &GetAI_boss_veras_darkshadow; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_high_nethermancer_zerevor"; - newscript->GetAI = &GetAI_boss_high_nethermancer_zerevor; - newscript->RegisterSelf(); + new mob_illidari_council(); + new mob_blood_elf_council_voice_trigger(); + new boss_gathios_the_shatterer(); + new boss_lady_malande(); + new boss_veras_darkshadow(); + new boss_high_nethermancer_zerevor(); } - diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index 7d5c5a9a3af..dacf35c4c3a 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -39,310 +39,312 @@ EndScriptData */ 7 - Illidari Council Event 8 - Illidan Stormrage Event */ - -struct instance_black_temple : public ScriptedInstance + class instance_black_temple : public InstanceMapScript { - instance_black_temple(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_black_temple() : InstanceMapScript("instance_black_temple") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 Najentus; - uint64 Akama; // This is the Akama that starts the Illidan encounter. - uint64 Akama_Shade; // This is the Akama that starts the Shade of Akama encounter. - uint64 ShadeOfAkama; - uint64 Supremus; - uint64 LadyMalande; - uint64 GathiosTheShatterer; - uint64 HighNethermancerZerevor; - uint64 VerasDarkshadow; - uint64 IllidariCouncil; - uint64 BloodElfCouncilVoice; - uint64 IllidanStormrage; - - uint64 NajentusGate; - uint64 MainTempleDoors; - uint64 ShadeOfAkamaDoor; - uint64 CommonDoor;//Teron - uint64 TeronDoor; - uint64 GuurtogDoor; - uint64 MotherDoor; - uint64 TempleDoor;//Befor mother - uint64 CouncilDoor; - uint64 SimpleDoor;//council - uint64 IllidanGate; - uint64 IllidanDoor[2]; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - Najentus = 0; - Akama = 0; - Akama_Shade = 0; - ShadeOfAkama = 0; - Supremus = 0; - LadyMalande = 0; - GathiosTheShatterer = 0; - HighNethermancerZerevor = 0; - VerasDarkshadow = 0; - IllidariCouncil = 0; - BloodElfCouncilVoice = 0; - IllidanStormrage = 0; - - NajentusGate = 0; - MainTempleDoors = 0; - ShadeOfAkamaDoor= 0; - CommonDoor = 0;//teron - TeronDoor = 0; - GuurtogDoor = 0; - MotherDoor = 0; - TempleDoor = 0; - SimpleDoor = 0;//Bycouncil - CouncilDoor = 0; - IllidanGate = 0; - IllidanDoor[0] = 0; - IllidanDoor[1] = 0; + return new instance_black_temple_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_black_temple_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_black_temple_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - Player* GetPlayerInMap() - { - Map::PlayerList const& players = instance->GetPlayers(); + uint64 Najentus; + uint64 Akama; // This is the Akama that starts the Illidan encounter. + uint64 Akama_Shade; // This is the Akama that starts the Shade of Akama encounter. + uint64 ShadeOfAkama; + uint64 Supremus; + uint64 LadyMalande; + uint64 GathiosTheShatterer; + uint64 HighNethermancerZerevor; + uint64 VerasDarkshadow; + uint64 IllidariCouncil; + uint64 BloodElfCouncilVoice; + uint64 IllidanStormrage; - if (!players.isEmpty()) + uint64 NajentusGate; + uint64 MainTempleDoors; + uint64 ShadeOfAkamaDoor; + uint64 CommonDoor;//Teron + uint64 TeronDoor; + uint64 GuurtogDoor; + uint64 MotherDoor; + uint64 TempleDoor;//Befor mother + uint64 CouncilDoor; + uint64 SimpleDoor;//council + uint64 IllidanGate; + uint64 IllidanDoor[2]; + + void Initialize() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + Najentus = 0; + Akama = 0; + Akama_Shade = 0; + ShadeOfAkama = 0; + Supremus = 0; + LadyMalande = 0; + GathiosTheShatterer = 0; + HighNethermancerZerevor = 0; + VerasDarkshadow = 0; + IllidariCouncil = 0; + BloodElfCouncilVoice = 0; + IllidanStormrage = 0; + + NajentusGate = 0; + MainTempleDoors = 0; + ShadeOfAkamaDoor= 0; + CommonDoor = 0;//teron + TeronDoor = 0; + GuurtogDoor = 0; + MotherDoor = 0; + TempleDoor = 0; + SimpleDoor = 0;//Bycouncil + CouncilDoor = 0; + IllidanGate = 0; + IllidanDoor[0] = 0; + IllidanDoor[1] = 0; + } + + bool IsEncounterInProgress() const + { + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + Player* GetPlayerInMap() + { + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* plr = itr->getSource()) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } + } + + sLog.outDebug("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); + return NULL; + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) + { + switch(pCreature->GetEntry()) + { + case 22887: Najentus = pCreature->GetGUID(); break; + case 23089: Akama = pCreature->GetGUID(); break; + case 22990: Akama_Shade = pCreature->GetGUID(); break; + case 22841: ShadeOfAkama = pCreature->GetGUID(); break; + case 22898: Supremus = pCreature->GetGUID(); break; + case 22917: IllidanStormrage = pCreature->GetGUID(); break; + case 22949: GathiosTheShatterer = pCreature->GetGUID(); break; + case 22950: HighNethermancerZerevor = pCreature->GetGUID(); break; + case 22951: LadyMalande = pCreature->GetGUID(); break; + case 22952: VerasDarkshadow = pCreature->GetGUID(); break; + case 23426: IllidariCouncil = pCreature->GetGUID(); break; + case 23499: BloodElfCouncilVoice = pCreature->GetGUID(); break; } } - sLog.outDebug("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 22887: Najentus = pCreature->GetGUID(); break; - case 23089: Akama = pCreature->GetGUID(); break; - case 22990: Akama_Shade = pCreature->GetGUID(); break; - case 22841: ShadeOfAkama = pCreature->GetGUID(); break; - case 22898: Supremus = pCreature->GetGUID(); break; - case 22917: IllidanStormrage = pCreature->GetGUID(); break; - case 22949: GathiosTheShatterer = pCreature->GetGUID(); break; - case 22950: HighNethermancerZerevor = pCreature->GetGUID(); break; - case 22951: LadyMalande = pCreature->GetGUID(); break; - case 22952: VerasDarkshadow = pCreature->GetGUID(); break; - case 23426: IllidariCouncil = pCreature->GetGUID(); break; - case 23499: BloodElfCouncilVoice = pCreature->GetGUID(); break; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case 185483: NajentusGate = pGo->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards) - if (m_auiEncounter[0] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185882: MainTempleDoors = pGo->GetGUID();// Main Temple Doors - right past Supermoose (Supremus) - if (m_auiEncounter[1] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185478: ShadeOfAkamaDoor = pGo->GetGUID();break; - case 185480: CommonDoor = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE)HandleGameObject(NULL,true,pGo);break; - case 186153: TeronDoor = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185892: GuurtogDoor = pGo->GetGUID(); - if (m_auiEncounter[4] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185479: TempleDoor = pGo->GetGUID(); - if (m_auiEncounter[5] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185482: MotherDoor = pGo->GetGUID(); - if (m_auiEncounter[6] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185481: CouncilDoor = pGo->GetGUID(); - if (m_auiEncounter[7] == DONE)HandleGameObject(NULL,true,pGo);break; - case 186152: SimpleDoor = pGo->GetGUID(); - if (m_auiEncounter[7] == DONE)HandleGameObject(NULL,true,pGo);break; - case 185905: IllidanGate = pGo->GetGUID(); break; // Gate leading to Temple Summit - case 186261: IllidanDoor[0] = pGo->GetGUID(); break; // Right door at Temple Summit - case 186262: IllidanDoor[1] = pGo->GetGUID(); break; // Left door at Temple Summit - } - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_HIGHWARLORDNAJENTUS: return Najentus; - case DATA_AKAMA: return Akama; - case DATA_AKAMA_SHADE: return Akama_Shade; - case DATA_SHADEOFAKAMA: return ShadeOfAkama; - case DATA_SUPREMUS: return Supremus; - case DATA_ILLIDANSTORMRAGE: return IllidanStormrage; - case DATA_GATHIOSTHESHATTERER: return GathiosTheShatterer; - case DATA_HIGHNETHERMANCERZEREVOR: return HighNethermancerZerevor; - case DATA_LADYMALANDE: return LadyMalande; - case DATA_VERASDARKSHADOW: return VerasDarkshadow; - case DATA_ILLIDARICOUNCIL: return IllidariCouncil; - case DATA_GAMEOBJECT_NAJENTUS_GATE: return NajentusGate; - case DATA_GAMEOBJECT_ILLIDAN_GATE: return IllidanGate; - case DATA_GAMEOBJECT_ILLIDAN_DOOR_R: return IllidanDoor[0]; - case DATA_GAMEOBJECT_ILLIDAN_DOOR_L: return IllidanDoor[1]; - case DATA_GAMEOBJECT_SUPREMUS_DOORS: return MainTempleDoors; - case DATA_BLOOD_ELF_COUNCIL_VOICE: return BloodElfCouncilVoice; + switch(pGo->GetEntry()) + { + case 185483: NajentusGate = pGo->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards) + if (m_auiEncounter[0] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185882: MainTempleDoors = pGo->GetGUID();// Main Temple Doors - right past Supermoose (Supremus) + if (m_auiEncounter[1] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185478: ShadeOfAkamaDoor = pGo->GetGUID();break; + case 185480: CommonDoor = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE)HandleGameObject(NULL,true,pGo);break; + case 186153: TeronDoor = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185892: GuurtogDoor = pGo->GetGUID(); + if (m_auiEncounter[4] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185479: TempleDoor = pGo->GetGUID(); + if (m_auiEncounter[5] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185482: MotherDoor = pGo->GetGUID(); + if (m_auiEncounter[6] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185481: CouncilDoor = pGo->GetGUID(); + if (m_auiEncounter[7] == DONE)HandleGameObject(NULL,true,pGo);break; + case 186152: SimpleDoor = pGo->GetGUID(); + if (m_auiEncounter[7] == DONE)HandleGameObject(NULL,true,pGo);break; + case 185905: IllidanGate = pGo->GetGUID(); break; // Gate leading to Temple Summit + case 186261: IllidanDoor[0] = pGo->GetGUID(); break; // Right door at Temple Summit + case 186262: IllidanDoor[1] = pGo->GetGUID(); break; // Left door at Temple Summit + } } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) + uint64 GetData64(uint32 identifier) { - case DATA_HIGHWARLORDNAJENTUSEVENT: + switch(identifier) + { + case DATA_HIGHWARLORDNAJENTUS: return Najentus; + case DATA_AKAMA: return Akama; + case DATA_AKAMA_SHADE: return Akama_Shade; + case DATA_SHADEOFAKAMA: return ShadeOfAkama; + case DATA_SUPREMUS: return Supremus; + case DATA_ILLIDANSTORMRAGE: return IllidanStormrage; + case DATA_GATHIOSTHESHATTERER: return GathiosTheShatterer; + case DATA_HIGHNETHERMANCERZEREVOR: return HighNethermancerZerevor; + case DATA_LADYMALANDE: return LadyMalande; + case DATA_VERASDARKSHADOW: return VerasDarkshadow; + case DATA_ILLIDARICOUNCIL: return IllidariCouncil; + case DATA_GAMEOBJECT_NAJENTUS_GATE: return NajentusGate; + case DATA_GAMEOBJECT_ILLIDAN_GATE: return IllidanGate; + case DATA_GAMEOBJECT_ILLIDAN_DOOR_R: return IllidanDoor[0]; + case DATA_GAMEOBJECT_ILLIDAN_DOOR_L: return IllidanDoor[1]; + case DATA_GAMEOBJECT_SUPREMUS_DOORS: return MainTempleDoors; + case DATA_BLOOD_ELF_COUNCIL_VOICE: return BloodElfCouncilVoice; + } + + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_HIGHWARLORDNAJENTUSEVENT: + if (data == DONE) + { + HandleGameObject(NajentusGate, true); + } + m_auiEncounter[0] = data;break; + case DATA_SUPREMUSEVENT: + if (data == DONE) + { + HandleGameObject(NajentusGate, true); + } + m_auiEncounter[1] = data; break; + case DATA_SHADEOFAKAMAEVENT: + if (data == IN_PROGRESS) + { + HandleGameObject(ShadeOfAkamaDoor, false); + } else HandleGameObject(ShadeOfAkamaDoor, true); + m_auiEncounter[2] = data; break; + case DATA_TERONGOREFIENDEVENT: + if (data == IN_PROGRESS) + { + HandleGameObject(TeronDoor, false); + HandleGameObject(CommonDoor, false); + }else + { + HandleGameObject(TeronDoor, true); + HandleGameObject(CommonDoor, true); + } + m_auiEncounter[3] = data; break; + case DATA_GURTOGGBLOODBOILEVENT: + if (data == DONE) + { + HandleGameObject(GuurtogDoor, true); + } + m_auiEncounter[4] = data; break; + case DATA_RELIQUARYOFSOULSEVENT: + if (data == DONE) + { + HandleGameObject(TempleDoor, true); + } + m_auiEncounter[5] = data; break; + case DATA_MOTHERSHAHRAZEVENT: + if (data == DONE) + { + HandleGameObject(MotherDoor, true); + } + m_auiEncounter[6] = data; break; + case DATA_ILLIDARICOUNCILEVENT: + if (data == IN_PROGRESS) + { + HandleGameObject(CouncilDoor, false); + HandleGameObject(SimpleDoor, false); + }else + { + HandleGameObject(CouncilDoor, true); + HandleGameObject(SimpleDoor, true); + } + m_auiEncounter[7] = data; break; + case DATA_ILLIDANSTORMRAGEEVENT: m_auiEncounter[8] = data; break; + } + if (data == DONE) { - HandleGameObject(NajentusGate, true); + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] + << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] + << " " << m_auiEncounter[8]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; } - m_auiEncounter[0] = data;break; - case DATA_SUPREMUSEVENT: - if (data == DONE) - { - HandleGameObject(NajentusGate, true); - } - m_auiEncounter[1] = data; break; - case DATA_SHADEOFAKAMAEVENT: - if (data == IN_PROGRESS) - { - HandleGameObject(ShadeOfAkamaDoor, false); - } else HandleGameObject(ShadeOfAkamaDoor, true); - m_auiEncounter[2] = data; break; - case DATA_TERONGOREFIENDEVENT: - if (data == IN_PROGRESS) - { - HandleGameObject(TeronDoor, false); - HandleGameObject(CommonDoor, false); - }else - { - HandleGameObject(TeronDoor, true); - HandleGameObject(CommonDoor, true); - } - m_auiEncounter[3] = data; break; - case DATA_GURTOGGBLOODBOILEVENT: - if (data == DONE) - { - HandleGameObject(GuurtogDoor, true); - } - m_auiEncounter[4] = data; break; - case DATA_RELIQUARYOFSOULSEVENT: - if (data == DONE) - { - HandleGameObject(TempleDoor, true); - } - m_auiEncounter[5] = data; break; - case DATA_MOTHERSHAHRAZEVENT: - if (data == DONE) - { - HandleGameObject(MotherDoor, true); - } - m_auiEncounter[6] = data; break; - case DATA_ILLIDARICOUNCILEVENT: - if (data == IN_PROGRESS) - { - HandleGameObject(CouncilDoor, false); - HandleGameObject(SimpleDoor, false); - }else - { - HandleGameObject(CouncilDoor, true); - HandleGameObject(SimpleDoor, true); - } - m_auiEncounter[7] = data; break; - case DATA_ILLIDANSTORMRAGEEVENT: m_auiEncounter[8] = data; break; } - if (data == DONE) + uint32 GetData(uint32 type) { - OUT_SAVE_INST_DATA; + switch(type) + { + case DATA_HIGHWARLORDNAJENTUSEVENT: return m_auiEncounter[0]; + case DATA_SUPREMUSEVENT: return m_auiEncounter[1]; + case DATA_SHADEOFAKAMAEVENT: return m_auiEncounter[2]; + case DATA_TERONGOREFIENDEVENT: return m_auiEncounter[3]; + case DATA_GURTOGGBLOODBOILEVENT: return m_auiEncounter[4]; + case DATA_RELIQUARYOFSOULSEVENT: return m_auiEncounter[5]; + case DATA_MOTHERSHAHRAZEVENT: return m_auiEncounter[6]; + case DATA_ILLIDARICOUNCILEVENT: return m_auiEncounter[7]; + case DATA_ILLIDANSTORMRAGEEVENT: return m_auiEncounter[8]; + } - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] - << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] - << " " << m_auiEncounter[8]; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + return 0; } - } - uint32 GetData(uint32 type) - { - switch(type) + std::string GetSaveData() { - case DATA_HIGHWARLORDNAJENTUSEVENT: return m_auiEncounter[0]; - case DATA_SUPREMUSEVENT: return m_auiEncounter[1]; - case DATA_SHADEOFAKAMAEVENT: return m_auiEncounter[2]; - case DATA_TERONGOREFIENDEVENT: return m_auiEncounter[3]; - case DATA_GURTOGGBLOODBOILEVENT: return m_auiEncounter[4]; - case DATA_RELIQUARYOFSOULSEVENT: return m_auiEncounter[5]; - case DATA_MOTHERSHAHRAZEVENT: return m_auiEncounter[6]; - case DATA_ILLIDARICOUNCILEVENT: return m_auiEncounter[7]; - case DATA_ILLIDANSTORMRAGEEVENT: return m_auiEncounter[8]; + return str_data; } - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] + >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] + >> m_auiEncounter[7] >> m_auiEncounter[8]; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; } + }; - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] - >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] - >> m_auiEncounter[7] >> m_auiEncounter[8]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_black_temple(Map* pMap) -{ - return new instance_black_temple(pMap); -} void AddSC_instance_black_temple() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_black_temple"; - newscript->GetInstanceData = &GetInstanceData_instance_black_temple; - newscript->RegisterSelf(); + new instance_black_temple(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index a99aa661c97..e7e3d46955f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -93,656 +93,661 @@ EndScriptData */ #define OLUM_Z -7.54773f #define OLUM_O 0.401581f -//Fathom-Lord Karathress AI -struct boss_fathomlord_karathressAI : public ScriptedAI +//Fathom-Lord Karathress AI class boss_fathomlord_karathress : public CreatureScript { - boss_fathomlord_karathressAI(Creature *c) : ScriptedAI(c) +public: + boss_fathomlord_karathress() : CreatureScript("boss_fathomlord_karathress") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Advisors[0] = 0; - Advisors[1] = 0; - Advisors[2] = 0; + return new boss_fathomlord_karathressAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 CataclysmicBolt_Timer; - uint32 Enrage_Timer; - uint32 SearNova_Timer; - - bool BlessingOfTides; - - uint64 Advisors[3]; - - void Reset() + struct boss_fathomlord_karathressAI : public ScriptedAI { - CataclysmicBolt_Timer = 10000; - Enrage_Timer = 600000; //10 minutes - SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds - - BlessingOfTides = false; - - if (pInstance) + boss_fathomlord_karathressAI(Creature *c) : ScriptedAI(c) { - uint64 RAdvisors[3]; - RAdvisors[0] = pInstance->GetData64(DATA_SHARKKIS); - RAdvisors[1] = pInstance->GetData64(DATA_TIDALVESS); - RAdvisors[2] = pInstance->GetData64(DATA_CARIBDIS); - //Respawn of the 3 Advisors - Creature* pAdvisor = NULL; - for (int i=0; i<3; ++i) - - if (RAdvisors[i]) - { - pAdvisor = (Unit::GetCreature((*me), RAdvisors[i])); - if (pAdvisor && !pAdvisor->isAlive()) - { - pAdvisor->Respawn(); - pAdvisor->AI()->EnterEvadeMode(); - pAdvisor->GetMotionMaster()->MoveTargetedHome(); - } - } - pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); + pInstance = c->GetInstanceScript(); + Advisors[0] = 0; + Advisors[1] = 0; + Advisors[2] = 0; } - } + InstanceScript* pInstance; - void EventSharkkisDeath() - { - DoScriptText(SAY_GAIN_ABILITY1, me); - DoCast(me, SPELL_POWER_OF_SHARKKIS); - } + uint32 CataclysmicBolt_Timer; + uint32 Enrage_Timer; + uint32 SearNova_Timer; - void EventTidalvessDeath() - { - DoScriptText(SAY_GAIN_ABILITY2, me); - DoCast(me, SPELL_POWER_OF_TIDALVESS); - } + bool BlessingOfTides; - void EventCaribdisDeath() - { - DoScriptText(SAY_GAIN_ABILITY3, me); - DoCast(me, SPELL_POWER_OF_CARIBDIS); - } + uint64 Advisors[3]; - void GetAdvisors() - { - if (!pInstance) - return; - - Advisors[0] = pInstance->GetData64(DATA_SHARKKIS); - Advisors[1] = pInstance->GetData64(DATA_TIDALVESS); - Advisors[2] = pInstance->GetData64(DATA_CARIBDIS); - } - - void StartEvent(Unit *who) - { - if (!pInstance) - return; - - GetAdvisors(); - - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - - pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); - pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit * /*killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, DONE); - - //support for quest 10944 - me->SummonCreature(SEER_OLUM, OLUM_X, OLUM_Y, OLUM_Z, OLUM_O, TEMPSUMMON_TIMED_DESPAWN, 3600000); - } - - void EnterCombat(Unit * who) - { - StartEvent(who); - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - - if (pTarget) - { - AttackStart(pTarget); - GetAdvisors(); - } - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { - EnterEvadeMode(); - return; - } - - //CataclysmicBolt_Timer - if (CataclysmicBolt_Timer <= diff) - { - //select a random unit other than the main tank - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); - - //if there aren't other units, cast on the tank - if (!pTarget) - pTarget = me->getVictim(); - - if (pTarget) - DoCast(pTarget, SPELL_CATACLYSMIC_BOLT); CataclysmicBolt_Timer = 10000; - } else CataclysmicBolt_Timer -= diff; + Enrage_Timer = 600000; //10 minutes + SearNova_Timer = 20000+rand()%40000; // 20 - 60 seconds - //SearNova_Timer - if (SearNova_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SEAR_NOVA); - SearNova_Timer = 20000+rand()%40000; - } else SearNova_Timer -= diff; + BlessingOfTides = false; - //Enrage_Timer - if (Enrage_Timer <= diff) - { - DoCast(me, SPELL_ENRAGE); - Enrage_Timer = 90000; - } else Enrage_Timer -= diff; + if (pInstance) + { + uint64 RAdvisors[3]; + RAdvisors[0] = pInstance->GetData64(DATA_SHARKKIS); + RAdvisors[1] = pInstance->GetData64(DATA_TIDALVESS); + RAdvisors[2] = pInstance->GetData64(DATA_CARIBDIS); + //Respawn of the 3 Advisors + Creature* pAdvisor = NULL; + for (int i=0; i<3; ++i) - //Blessing of Tides Trigger - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= 75 && !BlessingOfTides) - { - BlessingOfTides = true; - bool continueTriggering = false; - Creature* Advisor; - for (uint8 i = 0; i < 4; ++i) - if (Advisors[i]) + if (RAdvisors[i]) { - Advisor = (Unit::GetCreature(*me, Advisors[i])); - if (Advisor && Advisor->isAlive()) + pAdvisor = (Unit::GetCreature((*me), RAdvisors[i])); + if (pAdvisor && !pAdvisor->isAlive()) { - continueTriggering = true; - break; + pAdvisor->Respawn(); + pAdvisor->AI()->EnterEvadeMode(); + pAdvisor->GetMotionMaster()->MoveTargetedHome(); } } - if (continueTriggering) - { - DoCast(me, SPELL_BLESSING_OF_THE_TIDES); - me->MonsterYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL); - DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES); + pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } + } - DoMeleeAttackIfReady(); - } -}; - -//Fathom-Guard Sharkkis AI -struct boss_fathomguard_sharkkisAI : public ScriptedAI -{ - boss_fathomguard_sharkkisAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 LeechingThrow_Timer; - uint32 TheBeastWithin_Timer; - uint32 Multishot_Timer; - uint32 Pet_Timer; - - bool pet; - - uint64 SummonedPet; - - void Reset() - { - LeechingThrow_Timer = 20000; - TheBeastWithin_Timer = 30000; - Multishot_Timer = 15000; - Pet_Timer = 10000; - - pet = false; - - Creature *Pet = Unit::GetCreature(*me, SummonedPet); - if (Pet && Pet->isAlive()) + void EventSharkkisDeath() { - Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + DoScriptText(SAY_GAIN_ABILITY1, me); + DoCast(me, SPELL_POWER_OF_SHARKKIS); } - SummonedPet = 0; - - if (pInstance) - pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) + void EventTidalvessDeath() { - Creature *Karathress = NULL; - Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); - - if (Karathress) - CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); - CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); + DoScriptText(SAY_GAIN_ABILITY2, me); + DoCast(me, SPELL_POWER_OF_TIDALVESS); } - } - void EnterCombat(Unit * who) - { - if (pInstance) + void EventCaribdisDeath() { + DoScriptText(SAY_GAIN_ABILITY3, me); + DoCast(me, SPELL_POWER_OF_CARIBDIS); + } + + void GetAdvisors() + { + if (!pInstance) + return; + + Advisors[0] = pInstance->GetData64(DATA_SHARKKIS); + Advisors[1] = pInstance->GetData64(DATA_TIDALVESS); + Advisors[2] = pInstance->GetData64(DATA_CARIBDIS); + } + + void StartEvent(Unit *who) + { + if (!pInstance) + return; + + GetAdvisors(); + + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); + pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } + + void JustDied(Unit * /*killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, DONE); + + //support for quest 10944 + me->SummonCreature(SEER_OLUM, OLUM_X, OLUM_Y, OLUM_Z, OLUM_O, TEMPSUMMON_TIMED_DESPAWN, 3600000); + } + + void EnterCombat(Unit * who) + { + StartEvent(who); + } + + void UpdateAI(const uint32 diff) + { + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + + if (pTarget) + { + AttackStart(pTarget); + GetAdvisors(); + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) + { + EnterEvadeMode(); + return; + } + + //CataclysmicBolt_Timer + if (CataclysmicBolt_Timer <= diff) + { + //select a random unit other than the main tank + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); + + //if there aren't other units, cast on the tank + if (!pTarget) + pTarget = me->getVictim(); + + if (pTarget) + DoCast(pTarget, SPELL_CATACLYSMIC_BOLT); + CataclysmicBolt_Timer = 10000; + } else CataclysmicBolt_Timer -= diff; + + //SearNova_Timer + if (SearNova_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SEAR_NOVA); + SearNova_Timer = 20000+rand()%40000; + } else SearNova_Timer -= diff; + + //Enrage_Timer + if (Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enrage_Timer = 90000; + } else Enrage_Timer -= diff; + + //Blessing of Tides Trigger + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= 75 && !BlessingOfTides) + { + BlessingOfTides = true; + bool continueTriggering = false; + Creature* Advisor; + for (uint8 i = 0; i < 4; ++i) + if (Advisors[i]) + { + Advisor = (Unit::GetCreature(*me, Advisors[i])); + if (Advisor && Advisor->isAlive()) + { + continueTriggering = true; + break; + } + } + if (continueTriggering) + { + DoCast(me, SPELL_BLESSING_OF_THE_TIDES); + me->MonsterYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES); + } + } + + DoMeleeAttackIfReady(); + } + }; + +}; + +//Fathom-Guard Sharkkis AI class boss_fathomguard_sharkkis : public CreatureScript +{ +public: + boss_fathomguard_sharkkis() : CreatureScript("boss_fathomguard_sharkkis") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_fathomguard_sharkkisAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_fathomguard_sharkkisAI : public ScriptedAI { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + boss_fathomguard_sharkkisAI(Creature *c) : ScriptedAI(c) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - - if (pTarget) - { - AttackStart(pTarget); - } + pInstance = c->GetInstanceScript(); } - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { - EnterEvadeMode(); - return; - } + uint32 LeechingThrow_Timer; + uint32 TheBeastWithin_Timer; + uint32 Multishot_Timer; + uint32 Pet_Timer; - //LeechingThrow_Timer - if (LeechingThrow_Timer <= diff) + bool pet; + + uint64 SummonedPet; + + void Reset() { - DoCast(me->getVictim(), SPELL_LEECHING_THROW); LeechingThrow_Timer = 20000; - } else LeechingThrow_Timer -= diff; + TheBeastWithin_Timer = 30000; + Multishot_Timer = 15000; + Pet_Timer = 10000; - //Multishot_Timer - if (Multishot_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MULTISHOT); - Multishot_Timer = 20000; - } else Multishot_Timer -= diff; + pet = false; - //TheBeastWithin_Timer - if (TheBeastWithin_Timer <= diff) - { - DoCast(me, SPELL_THE_BEAST_WITHIN); Creature *Pet = Unit::GetCreature(*me, SummonedPet); if (Pet && Pet->isAlive()) { - Pet->CastSpell(Pet, SPELL_PET_ENRAGE, true); + Pet->DealDamage(Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } - TheBeastWithin_Timer = 30000; - } else TheBeastWithin_Timer -= diff; - //Pet_Timer - if (Pet_Timer < diff && pet == false) + SummonedPet = 0; + + if (pInstance) + pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); + } + + void JustDied(Unit * /*victim*/) { - pet = true; - //uint32 spell_id; - uint32 pet_id; - if (!urand(0,1)) + if (pInstance) { - //spell_id = SPELL_SUMMON_FATHOM_LURKER; - pet_id = CREATURE_FATHOM_LURKER; - } - else - { - //spell_id = SPELL_SUMMON_FATHOM_SPOREBAT; - pet_id = CREATURE_FATHOM_SPOREBAT; - } - //DoCast(me, spell_id, true); - Creature *Pet = DoSpawnCreature(pet_id,0,0,0,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (Pet && pTarget) - { - Pet->AI()->AttackStart(pTarget); - SummonedPet = Pet->GetGUID(); - } - } else Pet_Timer -= diff; + Creature *Karathress = NULL; + Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); + + if (Karathress) + if (!me->isAlive() && Karathress) + CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventSharkkisDeath(); + } + } + + void EnterCombat(Unit * who) + { + if (pInstance) + { + pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); + } + } + + void UpdateAI(const uint32 diff) + { + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + + if (pTarget) + { + AttackStart(pTarget); + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) + { + EnterEvadeMode(); + return; + } + + //LeechingThrow_Timer + if (LeechingThrow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LEECHING_THROW); + LeechingThrow_Timer = 20000; + } else LeechingThrow_Timer -= diff; + + //Multishot_Timer + if (Multishot_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MULTISHOT); + Multishot_Timer = 20000; + } else Multishot_Timer -= diff; + + //TheBeastWithin_Timer + if (TheBeastWithin_Timer <= diff) + { + DoCast(me, SPELL_THE_BEAST_WITHIN); + Creature *Pet = Unit::GetCreature(*me, SummonedPet); + if (Pet && Pet->isAlive()) + { + Pet->CastSpell(Pet, SPELL_PET_ENRAGE, true); + } + TheBeastWithin_Timer = 30000; + } else TheBeastWithin_Timer -= diff; + + //Pet_Timer + if (Pet_Timer < diff && pet == false) + { + pet = true; + //uint32 spell_id; + uint32 pet_id; + if (!urand(0,1)) + { + //spell_id = SPELL_SUMMON_FATHOM_LURKER; + pet_id = CREATURE_FATHOM_LURKER; + } + else + { + //spell_id = SPELL_SUMMON_FATHOM_SPOREBAT; + pet_id = CREATURE_FATHOM_SPOREBAT; + } + //DoCast(me, spell_id, true); + Creature *Pet = DoSpawnCreature(pet_id,0,0,0,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (Pet && pTarget) + { + Pet->AI()->AttackStart(pTarget); + SummonedPet = Pet->GetGUID(); + } + } else Pet_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -//Fathom-Guard Tidalvess AI -struct boss_fathomguard_tidalvessAI : public ScriptedAI +//Fathom-Guard Tidalvess AI class boss_fathomguard_tidalvess : public CreatureScript { - boss_fathomguard_tidalvessAI(Creature *c) : ScriptedAI(c) +public: + boss_fathomguard_tidalvess() : CreatureScript("boss_fathomguard_tidalvess") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_fathomguard_tidalvessAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 FrostShock_Timer; - uint32 Spitfire_Timer; - uint32 PoisonCleansing_Timer; - uint32 Earthbind_Timer; - - void Reset() + struct boss_fathomguard_tidalvessAI : public ScriptedAI { - FrostShock_Timer = 25000; - Spitfire_Timer = 60000; - PoisonCleansing_Timer = 30000; - Earthbind_Timer = 45000; - - if (pInstance) - pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) + boss_fathomguard_tidalvessAI(Creature *c) : ScriptedAI(c) { - Creature *Karathress = NULL; - Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); - - if (Karathress) - if (!me->isAlive() && Karathress) - CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit * who) - { - if (pInstance) + InstanceScript* pInstance; + + uint32 FrostShock_Timer; + uint32 Spitfire_Timer; + uint32 PoisonCleansing_Timer; + uint32 Earthbind_Timer; + + void Reset() { - pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); - pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); + FrostShock_Timer = 25000; + Spitfire_Timer = 60000; + PoisonCleansing_Timer = 30000; + Earthbind_Timer = 45000; + + if (pInstance) + pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); } - DoCast(me, SPELL_WINDFURY_WEAPON); - } - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + void JustDied(Unit * /*victim*/) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - - if (pTarget) + if (pInstance) { - AttackStart(pTarget); + Creature *Karathress = NULL; + Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); + + if (Karathress) + if (!me->isAlive() && Karathress) + CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventTidalvessDeath(); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { - EnterEvadeMode(); - return; - } - - if (!me->HasAura(SPELL_WINDFURY_WEAPON)) + void EnterCombat(Unit * who) { + if (pInstance) + { + pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); + } DoCast(me, SPELL_WINDFURY_WEAPON); } - //FrostShock_Timer - if (FrostShock_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 25000+rand()%5000; - } else FrostShock_Timer -= diff; - - //Spitfire_Timer - if (Spitfire_Timer <= diff) - { - DoCast(me, SPELL_SPITFIRE_TOTEM); - Unit *SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM); - if (SpitfireTotem) + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { - CAST_CRE(SpitfireTotem)->AI()->AttackStart(me->getVictim()); - } - Spitfire_Timer = 60000; - } else Spitfire_Timer -= diff; + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - //PoisonCleansing_Timer - if (PoisonCleansing_Timer <= diff) - { - DoCast(me, SPELL_POISON_CLEANSING_TOTEM); - PoisonCleansing_Timer = 30000; - } else PoisonCleansing_Timer -= diff; - - //Earthbind_Timer - if (Earthbind_Timer <= diff) - { - DoCast(me, SPELL_EARTHBIND_TOTEM); - Earthbind_Timer = 45000; - } else Earthbind_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -//Fathom-Guard Caribdis AI -struct boss_fathomguard_caribdisAI : public ScriptedAI -{ - boss_fathomguard_caribdisAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - uint32 WaterBoltVolley_Timer; - uint32 TidalSurge_Timer; - uint32 Heal_Timer; - uint32 Cyclone_Timer; - - void Reset() - { - WaterBoltVolley_Timer = 35000; - TidalSurge_Timer = 15000+rand()%5000; - Heal_Timer = 55000; - Cyclone_Timer = 30000+rand()%10000; - - if (pInstance) - pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance) - { - Creature *Karathress = NULL; - Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); - - if (Karathress) - if (!me->isAlive() && Karathress) - CAST_AI(boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); - } - } - - void EnterCombat(Unit * who) - { - if (pInstance) - { - pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); - pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); - } - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); - - if (pTarget) - { - AttackStart(pTarget); - } - } - - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) - { - EnterEvadeMode(); - return; - } - - //WaterBoltVolley_Timer - if (WaterBoltVolley_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WATER_BOLT_VOLLEY); - WaterBoltVolley_Timer = 30000; - } else WaterBoltVolley_Timer -= diff; - - //TidalSurge_Timer - if (TidalSurge_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_TIDAL_SURGE); - // Hacky way to do it - won't trigger elseways - me->getVictim()->CastSpell(me->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true); - TidalSurge_Timer = 15000+rand()%5000; - } else TidalSurge_Timer -= diff; - - //Cyclone_Timer - if (Cyclone_Timer <= diff) - { - //DoCast(me, SPELL_SUMMON_CYCLONE); // Doesn't work - Cyclone_Timer = 30000+rand()%10000; - Creature *Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); - if (Cyclone) - { - CAST_CRE(Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); - Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Cyclone->setFaction(me->getFaction()); - Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) { - Cyclone->AI()->AttackStart(pTarget); + AttackStart(pTarget); } } - } else Cyclone_Timer -= diff; - //Heal_Timer - if (Heal_Timer <= diff) - { - // It can be cast on any of the mobs - Unit *pUnit = NULL; + //Return since we have no target + if (!UpdateVictim()) + return; - while (pUnit == NULL || !pUnit->isAlive()) + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { - pUnit = selectAdvisorUnit(); + EnterEvadeMode(); + return; } - if (pUnit && pUnit->isAlive()) - DoCast(pUnit, SPELL_HEAL); - Heal_Timer = 60000; - } else Heal_Timer -= diff; - - DoMeleeAttackIfReady(); - } - - Unit* selectAdvisorUnit() - { - Unit* pUnit = NULL; - if (pInstance) - { - switch(rand()%4) + if (!me->HasAura(SPELL_WINDFURY_WEAPON)) { - case 0: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS)); - break; - case 1: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS)); - break; - case 2: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS)); - break; - case 3: - pUnit = me; - break; + DoCast(me, SPELL_WINDFURY_WEAPON); } - } else pUnit = me; - return pUnit; + //FrostShock_Timer + if (FrostShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + FrostShock_Timer = 25000+rand()%5000; + } else FrostShock_Timer -= diff; + + //Spitfire_Timer + if (Spitfire_Timer <= diff) + { + DoCast(me, SPELL_SPITFIRE_TOTEM); + Unit *SpitfireTotem = Unit::GetUnit(*me, CREATURE_SPITFIRE_TOTEM); + if (SpitfireTotem) + { + CAST_CRE(SpitfireTotem)->AI()->AttackStart(me->getVictim()); + } + Spitfire_Timer = 60000; + } else Spitfire_Timer -= diff; + + //PoisonCleansing_Timer + if (PoisonCleansing_Timer <= diff) + { + DoCast(me, SPELL_POISON_CLEANSING_TOTEM); + PoisonCleansing_Timer = 30000; + } else PoisonCleansing_Timer -= diff; + + //Earthbind_Timer + if (Earthbind_Timer <= diff) + { + DoCast(me, SPELL_EARTHBIND_TOTEM); + Earthbind_Timer = 45000; + } else Earthbind_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; + }; -CreatureAI* GetAI_boss_fathomlord_karathress(Creature* pCreature) +//Fathom-Guard Caribdis AI class boss_fathomguard_caribdis : public CreatureScript { - return new boss_fathomlord_karathressAI (pCreature); -} +public: + boss_fathomguard_caribdis() : CreatureScript("boss_fathomguard_caribdis") { } -CreatureAI* GetAI_boss_fathomguard_sharkkis(Creature* pCreature) -{ - return new boss_fathomguard_sharkkisAI (pCreature); -} + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_fathomguard_caribdisAI (pCreature); + } -CreatureAI* GetAI_boss_fathomguard_tidalvess(Creature* pCreature) -{ - return new boss_fathomguard_tidalvessAI (pCreature); -} + struct boss_fathomguard_caribdisAI : public ScriptedAI + { + boss_fathomguard_caribdisAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } -CreatureAI* GetAI_boss_fathomguard_caribdis(Creature* pCreature) -{ - return new boss_fathomguard_caribdisAI (pCreature); -} + InstanceScript* pInstance; + + uint32 WaterBoltVolley_Timer; + uint32 TidalSurge_Timer; + uint32 Heal_Timer; + uint32 Cyclone_Timer; + + void Reset() + { + WaterBoltVolley_Timer = 35000; + TidalSurge_Timer = 15000+rand()%5000; + Heal_Timer = 55000; + Cyclone_Timer = 30000+rand()%10000; + + if (pInstance) + pInstance->SetData(DATA_KARATHRESSEVENT, NOT_STARTED); + } + + void JustDied(Unit * /*victim*/) + { + if (pInstance) + { + Creature *Karathress = NULL; + Karathress = (Unit::GetCreature((*me), pInstance->GetData64(DATA_KARATHRESS))); + + if (Karathress) + if (!me->isAlive() && Karathress) + CAST_AI(boss_fathomlord_karathress::boss_fathomlord_karathressAI, Karathress->AI())->EventCaribdisDeath(); + } + } + + void EnterCombat(Unit * who) + { + if (pInstance) + { + pInstance->SetData64(DATA_KARATHRESSEVENT_STARTER, who->GetGUID()); + pInstance->SetData(DATA_KARATHRESSEVENT, IN_PROGRESS); + } + } + + void UpdateAI(const uint32 diff) + { + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); + + if (pTarget) + { + AttackStart(pTarget); + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) + { + EnterEvadeMode(); + return; + } + + //WaterBoltVolley_Timer + if (WaterBoltVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WATER_BOLT_VOLLEY); + WaterBoltVolley_Timer = 30000; + } else WaterBoltVolley_Timer -= diff; + + //TidalSurge_Timer + if (TidalSurge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TIDAL_SURGE); + // Hacky way to do it - won't trigger elseways + me->getVictim()->CastSpell(me->getVictim(), SPELL_TIDAL_SURGE_FREEZE, true); + TidalSurge_Timer = 15000+rand()%5000; + } else TidalSurge_Timer -= diff; + + //Cyclone_Timer + if (Cyclone_Timer <= diff) + { + //DoCast(me, SPELL_SUMMON_CYCLONE); // Doesn't work + Cyclone_Timer = 30000+rand()%10000; + Creature *Cyclone = me->SummonCreature(CREATURE_CYCLONE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 15000); + if (Cyclone) + { + CAST_CRE(Cyclone)->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.0f); + Cyclone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Cyclone->setFaction(me->getFaction()); + Cyclone->CastSpell(Cyclone, SPELL_CYCLONE_CYCLONE, true); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + Cyclone->AI()->AttackStart(pTarget); + } + } + } else Cyclone_Timer -= diff; + + //Heal_Timer + if (Heal_Timer <= diff) + { + // It can be cast on any of the mobs + Unit *pUnit = NULL; + + while (pUnit == NULL || !pUnit->isAlive()) + { + pUnit = selectAdvisorUnit(); + } + + if (pUnit && pUnit->isAlive()) + DoCast(pUnit, SPELL_HEAL); + Heal_Timer = 60000; + } else Heal_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + Unit* selectAdvisorUnit() + { + Unit* pUnit = NULL; + if (pInstance) + { + switch(rand()%4) + { + case 0: + pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS)); + break; + case 1: + pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS)); + break; + case 2: + pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS)); + break; + case 3: + pUnit = me; + break; + } + } else pUnit = me; + return pUnit; + } + }; +}; void AddSC_boss_fathomlord_karathress() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_fathomlord_karathress"; - newscript->GetAI = &GetAI_boss_fathomlord_karathress; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_fathomguard_sharkkis"; - newscript->GetAI = &GetAI_boss_fathomguard_sharkkis; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_fathomguard_tidalvess"; - newscript->GetAI = &GetAI_boss_fathomguard_tidalvess; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_fathomguard_caribdis"; - newscript->GetAI = &GetAI_boss_fathomguard_caribdis; - newscript->RegisterSelf(); + new boss_fathomlord_karathress(); + new boss_fathomguard_sharkkis(); + new boss_fathomguard_tidalvess(); + new boss_fathomguard_caribdis(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp index 1e75a4e65fd..5c53176be0b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp @@ -75,307 +75,309 @@ EndScriptData */ #define SPAWN_Y_DIFF3 -4.72702 #define SPAWN_X_DIFF4 12.577011 #define SPAWN_Y_DIFF4 4.72702 - -struct boss_hydross_the_unstableAI : public ScriptedAI + class boss_hydross_the_unstable : public CreatureScript { - boss_hydross_the_unstableAI(Creature *c) : ScriptedAI(c), Summons(me) +public: + boss_hydross_the_unstable() : CreatureScript("boss_hydross_the_unstable") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_hydross_the_unstableAI (pCreature); } - ScriptedInstance* pInstance; - - uint64 beams[2]; - uint32 PosCheck_Timer; - uint32 MarkOfHydross_Timer; - uint32 MarkOfCorruption_Timer; - uint32 WaterTomb_Timer; - uint32 VileSludge_Timer; - uint32 MarkOfHydross_Count; - uint32 MarkOfCorruption_Count; - uint32 EnrageTimer; - bool CorruptedForm; - bool beam; - SummonList Summons; - - void Reset() + struct boss_hydross_the_unstableAI : public ScriptedAI { - DeSummonBeams(); - beams[0] = 0; - beams[1] = 0; - PosCheck_Timer = 2500; - MarkOfHydross_Timer = 15000; - MarkOfCorruption_Timer = 15000; - WaterTomb_Timer = 7000; - VileSludge_Timer = 7000; - MarkOfHydross_Count = 0; - MarkOfCorruption_Count = 0; - EnrageTimer = 600000; - - CorruptedForm = false; - me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); - - me->SetDisplayId(MODEL_CLEAN); - - if (pInstance) - pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED); - beam = false; - Summons.DespawnAll(); - } - - void SummonBeams() - { - Creature* beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0); - if (beamer) + boss_hydross_the_unstableAI(Creature *c) : ScriptedAI(c), Summons(me) { - beamer->CastSpell(me,SPELL_BLUE_BEAM,true); - beamer->SetDisplayId(11686); //invisible - beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[0]=beamer->GetGUID(); + pInstance = c->GetInstanceScript(); } - beamer = beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-219.918,-371.308,22.0042,2.73072,TEMPSUMMON_CORPSE_DESPAWN,0); - if (beamer) + + InstanceScript* pInstance; + + uint64 beams[2]; + uint32 PosCheck_Timer; + uint32 MarkOfHydross_Timer; + uint32 MarkOfCorruption_Timer; + uint32 WaterTomb_Timer; + uint32 VileSludge_Timer; + uint32 MarkOfHydross_Count; + uint32 MarkOfCorruption_Count; + uint32 EnrageTimer; + bool CorruptedForm; + bool beam; + SummonList Summons; + + void Reset() { - beamer->CastSpell(me,SPELL_BLUE_BEAM,true); - beamer->SetDisplayId(11686); //invisible - beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - beams[1]=beamer->GetGUID(); + DeSummonBeams(); + beams[0] = 0; + beams[1] = 0; + PosCheck_Timer = 2500; + MarkOfHydross_Timer = 15000; + MarkOfCorruption_Timer = 15000; + WaterTomb_Timer = 7000; + VileSludge_Timer = 7000; + MarkOfHydross_Count = 0; + MarkOfCorruption_Count = 0; + EnrageTimer = 600000; + + CorruptedForm = false; + me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); + + me->SetDisplayId(MODEL_CLEAN); + + if (pInstance) + pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED); + beam = false; + Summons.DespawnAll(); } - } - void DeSummonBeams() - { - for (uint8 i=0; i<2; ++i) + + void SummonBeams() { - Creature* mob = Unit::GetCreature(*me,beams[i]); - if (mob) + Creature* beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-258.333,-356.34,22.0499,5.90835,TEMPSUMMON_CORPSE_DESPAWN,0); + if (beamer) { - mob->setDeathState(DEAD); - mob->RemoveCorpse(); + beamer->CastSpell(me,SPELL_BLUE_BEAM,true); + beamer->SetDisplayId(11686); //invisible + beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + beams[0]=beamer->GetGUID(); + } + beamer = beamer = me->SummonCreature(ENTRY_BEAM_DUMMY,-219.918,-371.308,22.0042,2.73072,TEMPSUMMON_CORPSE_DESPAWN,0); + if (beamer) + { + beamer->CastSpell(me,SPELL_BLUE_BEAM,true); + beamer->SetDisplayId(11686); //invisible + beamer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + beams[1]=beamer->GetGUID(); } } - } - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - if (CorruptedForm) + void DeSummonBeams() { - DoScriptText(RAND(SAY_CORRUPT_SLAY1,SAY_CORRUPT_SLAY2), me); - } - else - { - DoScriptText(RAND(SAY_CLEAN_SLAY1,SAY_CLEAN_SLAY2), me); - } - } - - void JustSummoned(Creature* summoned) - { - if (summoned->GetEntry() == ENTRY_PURE_SPAWN) - { - summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); - Summons.Summon(summoned); - } - if (summoned->GetEntry() == ENTRY_TAINTED_SPAWN) - { - summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); - Summons.Summon(summoned); - } - } - - void SummonedCreatureDespawn(Creature *summon) - { - Summons.Despawn(summon); - } - - void JustDied(Unit * /*victim*/) - { - if (CorruptedForm) - DoScriptText(SAY_CORRUPT_DEATH, me); - else - DoScriptText(SAY_CLEAN_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, DONE); - Summons.DespawnAll(); - } - - void UpdateAI(const uint32 diff) - { - if (!beam) - { - SummonBeams(); - beam=true; - } - //Return since we have no target - if (!UpdateVictim()) - return; - - // corrupted form - if (CorruptedForm) - { - //MarkOfCorruption_Timer - if (MarkOfCorruption_Timer <= diff) + for (uint8 i=0; i<2; ++i) { - if (MarkOfCorruption_Count <= 5) + Creature* mob = Unit::GetCreature(*me,beams[i]); + if (mob) { - uint32 mark_spell = 0; + mob->setDeathState(DEAD); + mob->RemoveCorpse(); + } + } + } + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); - switch (MarkOfCorruption_Count) + if (pInstance) + pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, IN_PROGRESS); + } + + void KilledUnit(Unit * /*victim*/) + { + if (CorruptedForm) + { + DoScriptText(RAND(SAY_CORRUPT_SLAY1,SAY_CORRUPT_SLAY2), me); + } + else + { + DoScriptText(RAND(SAY_CLEAN_SLAY1,SAY_CLEAN_SLAY2), me); + } + } + + void JustSummoned(Creature* summoned) + { + if (summoned->GetEntry() == ENTRY_PURE_SPAWN) + { + summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); + Summons.Summon(summoned); + } + if (summoned->GetEntry() == ENTRY_TAINTED_SPAWN) + { + summoned->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + summoned->CastSpell(summoned,SPELL_ELEMENTAL_SPAWNIN,true); + Summons.Summon(summoned); + } + } + + void SummonedCreatureDespawn(Creature *summon) + { + Summons.Despawn(summon); + } + + void JustDied(Unit * /*victim*/) + { + if (CorruptedForm) + DoScriptText(SAY_CORRUPT_DEATH, me); + else + DoScriptText(SAY_CLEAN_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, DONE); + Summons.DespawnAll(); + } + + void UpdateAI(const uint32 diff) + { + if (!beam) + { + SummonBeams(); + beam=true; + } + //Return since we have no target + if (!UpdateVictim()) + return; + + // corrupted form + if (CorruptedForm) + { + //MarkOfCorruption_Timer + if (MarkOfCorruption_Timer <= diff) + { + if (MarkOfCorruption_Count <= 5) { - case 0: mark_spell = SPELL_MARK_OF_CORRUPTION1; break; - case 1: mark_spell = SPELL_MARK_OF_CORRUPTION2; break; - case 2: mark_spell = SPELL_MARK_OF_CORRUPTION3; break; - case 3: mark_spell = SPELL_MARK_OF_CORRUPTION4; break; - case 4: mark_spell = SPELL_MARK_OF_CORRUPTION5; break; - case 5: mark_spell = SPELL_MARK_OF_CORRUPTION6; break; + uint32 mark_spell = 0; + + switch (MarkOfCorruption_Count) + { + case 0: mark_spell = SPELL_MARK_OF_CORRUPTION1; break; + case 1: mark_spell = SPELL_MARK_OF_CORRUPTION2; break; + case 2: mark_spell = SPELL_MARK_OF_CORRUPTION3; break; + case 3: mark_spell = SPELL_MARK_OF_CORRUPTION4; break; + case 4: mark_spell = SPELL_MARK_OF_CORRUPTION5; break; + case 5: mark_spell = SPELL_MARK_OF_CORRUPTION6; break; + } + + DoCast(me->getVictim(), mark_spell); + + if (MarkOfCorruption_Count < 5) + ++MarkOfCorruption_Count; } - DoCast(me->getVictim(), mark_spell); + MarkOfCorruption_Timer = 15000; + } else MarkOfCorruption_Timer -= diff; - if (MarkOfCorruption_Count < 5) - ++MarkOfCorruption_Count; - } - - MarkOfCorruption_Timer = 15000; - } else MarkOfCorruption_Timer -= diff; - - //VileSludge_Timer - if (VileSludge_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_VILE_SLUDGE); - - VileSludge_Timer = 15000; - } else VileSludge_Timer -= diff; - - //PosCheck_Timer - if (PosCheck_Timer <= diff) - { - if (me->IsWithinDist2d(HYDROSS_X, HYDROSS_Y, SWITCH_RADIUS)) + //VileSludge_Timer + if (VileSludge_Timer <= diff) { - // switch to clean form - me->SetDisplayId(MODEL_CLEAN); - CorruptedForm = false; - MarkOfHydross_Count = 0; + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_VILE_SLUDGE); - DoScriptText(SAY_SWITCH_TO_CLEAN, me); - DoResetThreat(); - SummonBeams(); + VileSludge_Timer = 15000; + } else VileSludge_Timer -= diff; - // spawn 4 adds - DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - - me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); - } - - PosCheck_Timer = 2500; - } else PosCheck_Timer -=diff; - } - // clean form - else - { - //MarkOfHydross_Timer - if (MarkOfHydross_Timer <= diff) - { - if (MarkOfHydross_Count <= 5) + //PosCheck_Timer + if (PosCheck_Timer <= diff) { - uint32 mark_spell = NULL; - - switch(MarkOfHydross_Count) + if (me->IsWithinDist2d(HYDROSS_X, HYDROSS_Y, SWITCH_RADIUS)) { - case 0: mark_spell = SPELL_MARK_OF_HYDROSS1; break; - case 1: mark_spell = SPELL_MARK_OF_HYDROSS2; break; - case 2: mark_spell = SPELL_MARK_OF_HYDROSS3; break; - case 3: mark_spell = SPELL_MARK_OF_HYDROSS4; break; - case 4: mark_spell = SPELL_MARK_OF_HYDROSS5; break; - case 5: mark_spell = SPELL_MARK_OF_HYDROSS6; break; + // switch to clean form + me->SetDisplayId(MODEL_CLEAN); + CorruptedForm = false; + MarkOfHydross_Count = 0; + + DoScriptText(SAY_SWITCH_TO_CLEAN, me); + DoResetThreat(); + SummonBeams(); + + // spawn 4 adds + DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_PURE_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + + me->SetMeleeDamageSchool(SPELL_SCHOOL_FROST); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, false); } - DoCast(me->getVictim(), mark_spell); - - if (MarkOfHydross_Count < 5) - ++MarkOfHydross_Count; - } - - MarkOfHydross_Timer = 15000; - } else MarkOfHydross_Timer -= diff; - - //WaterTomb_Timer - if (WaterTomb_Timer <= diff) + PosCheck_Timer = 2500; + } else PosCheck_Timer -=diff; + } + // clean form + else { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); - if (pTarget) - DoCast(pTarget, SPELL_WATER_TOMB); - - WaterTomb_Timer = 7000; - } else WaterTomb_Timer -= diff; - - //PosCheck_Timer - if (PosCheck_Timer <= diff) - { - if (!me->IsWithinDist2d(HYDROSS_X, HYDROSS_Y, SWITCH_RADIUS)) + //MarkOfHydross_Timer + if (MarkOfHydross_Timer <= diff) { - // switch to corrupted form - me->SetDisplayId(MODEL_CORRUPT); - MarkOfCorruption_Count = 0; - CorruptedForm = true; + if (MarkOfHydross_Count <= 5) + { + uint32 mark_spell = NULL; - DoScriptText(SAY_SWITCH_TO_CORRUPT, me); - DoResetThreat(); - DeSummonBeams(); + switch(MarkOfHydross_Count) + { + case 0: mark_spell = SPELL_MARK_OF_HYDROSS1; break; + case 1: mark_spell = SPELL_MARK_OF_HYDROSS2; break; + case 2: mark_spell = SPELL_MARK_OF_HYDROSS3; break; + case 3: mark_spell = SPELL_MARK_OF_HYDROSS4; break; + case 4: mark_spell = SPELL_MARK_OF_HYDROSS5; break; + case 5: mark_spell = SPELL_MARK_OF_HYDROSS6; break; + } - // spawn 4 adds - DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoCast(me->getVictim(), mark_spell); - me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); - me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); - } + if (MarkOfHydross_Count < 5) + ++MarkOfHydross_Count; + } - PosCheck_Timer = 2500; - } else PosCheck_Timer -=diff; + MarkOfHydross_Timer = 15000; + } else MarkOfHydross_Timer -= diff; + + //WaterTomb_Timer + if (WaterTomb_Timer <= diff) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); + if (pTarget) + DoCast(pTarget, SPELL_WATER_TOMB); + + WaterTomb_Timer = 7000; + } else WaterTomb_Timer -= diff; + + //PosCheck_Timer + if (PosCheck_Timer <= diff) + { + if (!me->IsWithinDist2d(HYDROSS_X, HYDROSS_Y, SWITCH_RADIUS)) + { + // switch to corrupted form + me->SetDisplayId(MODEL_CORRUPT); + MarkOfCorruption_Count = 0; + CorruptedForm = true; + + DoScriptText(SAY_SWITCH_TO_CORRUPT, me); + DoResetThreat(); + DeSummonBeams(); + + // spawn 4 adds + DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF1, SPAWN_Y_DIFF1, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF2, SPAWN_Y_DIFF2, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF3, SPAWN_Y_DIFF3, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + DoSpawnCreature(ENTRY_TAINTED_SPAWN, SPAWN_X_DIFF4, SPAWN_Y_DIFF4, 3, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + + me->SetMeleeDamageSchool(SPELL_SCHOOL_NATURE); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_NATURE, true); + me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false); + } + + PosCheck_Timer = 2500; + } else PosCheck_Timer -=diff; + } + + //EnrageTimer + if (EnrageTimer <= diff) + { + DoCast(me, SPELL_ENRAGE); + EnrageTimer = 60000; + } else EnrageTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - //EnrageTimer - if (EnrageTimer <= diff) - { - DoCast(me, SPELL_ENRAGE); - EnrageTimer = 60000; - } else EnrageTimer -= diff; - - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_hydross_the_unstable(Creature* pCreature) -{ - return new boss_hydross_the_unstableAI (pCreature); -} void AddSC_boss_hydross_the_unstable() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_hydross_the_unstable"; - newscript->GetAI = &GetAI_boss_hydross_the_unstable; - newscript->RegisterSelf(); + new boss_hydross_the_unstable(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 4f037936873..96c3662631b 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -132,910 +132,925 @@ float ShieldGeneratorChannelPos[4][4] = {49.3126, -943.398, 42.5501, 2.40174} }; -//Lady Vashj AI -struct boss_lady_vashjAI : public ScriptedAI +//Lady Vashj AI class boss_lady_vashj : public CreatureScript { - boss_lady_vashjAI (Creature *c) : ScriptedAI(c) +public: + boss_lady_vashj() : CreatureScript("boss_lady_vashj") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - Intro = false; - JustCreated = true; - c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on Creature create (no need do intro if wiped) + return new boss_lady_vashjAI (pCreature); } - ScriptedInstance *pInstance; - - uint64 ShieldGeneratorChannel[4]; - - uint32 AggroTimer; - uint32 ShockBlast_Timer; - uint32 Entangle_Timer; - uint32 StaticCharge_Timer; - uint32 ForkedLightning_Timer; - uint32 Check_Timer; - uint32 EnchantedElemental_Timer; - uint32 TaintedElemental_Timer; - uint32 CoilfangElite_Timer; - uint32 CoilfangStrider_Timer; - uint32 SummonSporebat_Timer; - uint32 SummonSporebat_StaticTimer; - uint8 EnchantedElemental_Pos; - uint8 Phase; - - bool Entangle; - bool Intro; - bool CanAttack; - bool JustCreated; - - void Reset() + struct boss_lady_vashjAI : public ScriptedAI { - AggroTimer = 19000; - ShockBlast_Timer = 1+rand()%60000; - Entangle_Timer = 30000; - StaticCharge_Timer = 10000+rand()%15000; - ForkedLightning_Timer = 2000; - Check_Timer = 15000; - EnchantedElemental_Timer = 5000; - TaintedElemental_Timer = 50000; - CoilfangElite_Timer = 45000+rand()%5000; - CoilfangStrider_Timer = 60000+rand()%10000; - SummonSporebat_Timer = 10000; - SummonSporebat_StaticTimer = 30000; - EnchantedElemental_Pos = 0; - Phase = 0; - - Entangle = false; - if (JustCreated) + boss_lady_vashjAI (Creature *c) : ScriptedAI(c) { - CanAttack = false; - JustCreated = false; - } else CanAttack = true; - - Unit *remo; - for (uint8 i = 0; i < 4; ++i) - { - remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]); - if (remo) - remo->setDeathState(JUST_DIED); + pInstance = c->GetInstanceScript(); + Intro = false; + JustCreated = true; + c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on Creature create (no need do intro if wiped) } - if (pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); - ShieldGeneratorChannel[0] = 0; - ShieldGeneratorChannel[1] = 0; - ShieldGeneratorChannel[2] = 0; - ShieldGeneratorChannel[3] = 0; + InstanceScript *pInstance; - me->SetCorpseDelay(1000*60*60); - } + uint64 ShieldGeneratorChannel[4]; - //Called when a tainted elemental dies - void EventTaintedElementalDeath() - { - //the next will spawn 50 seconds after the previous one's death - if (TaintedElemental_Timer > 50000) - TaintedElemental_Timer = 50000; - } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } + uint32 AggroTimer; + uint32 ShockBlast_Timer; + uint32 Entangle_Timer; + uint32 StaticCharge_Timer; + uint32 ForkedLightning_Timer; + uint32 Check_Timer; + uint32 EnchantedElemental_Timer; + uint32 TaintedElemental_Timer; + uint32 CoilfangElite_Timer; + uint32 CoilfangStrider_Timer; + uint32 SummonSporebat_Timer; + uint32 SummonSporebat_StaticTimer; + uint8 EnchantedElemental_Pos; + uint8 Phase; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + bool Entangle; + bool Intro; + bool CanAttack; + bool JustCreated; - if (pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, DONE); - } - - void StartEvent() - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3,SAY_AGGRO4), me); - - Phase = 1; - - if (pInstance) - pInstance->SetData(DATA_LADYVASHJEVENT, IN_PROGRESS); - } - - void EnterCombat(Unit * who) - { - if (pInstance) + void Reset() { - //remove old tainted cores to prevent cheating in phase 2 - Map* pMap = me->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + AggroTimer = 19000; + ShockBlast_Timer = 1+rand()%60000; + Entangle_Timer = 30000; + StaticCharge_Timer = 10000+rand()%15000; + ForkedLightning_Timer = 2000; + Check_Timer = 15000; + EnchantedElemental_Timer = 5000; + TaintedElemental_Timer = 50000; + CoilfangElite_Timer = 45000+rand()%5000; + CoilfangStrider_Timer = 60000+rand()%10000; + SummonSporebat_Timer = 10000; + SummonSporebat_StaticTimer = 30000; + EnchantedElemental_Pos = 0; + Phase = 0; + + Entangle = false; + if (JustCreated) { - if (Player* i_pl = i->getSource()) + CanAttack = false; + JustCreated = false; + } else CanAttack = true; + + Unit *remo; + for (uint8 i = 0; i < 4; ++i) + { + remo = Unit::GetUnit(*me, ShieldGeneratorChannel[i]); + if (remo) + remo->setDeathState(JUST_DIED); + } + + if (pInstance) + pInstance->SetData(DATA_LADYVASHJEVENT, NOT_STARTED); + ShieldGeneratorChannel[0] = 0; + ShieldGeneratorChannel[1] = 0; + ShieldGeneratorChannel[2] = 0; + ShieldGeneratorChannel[3] = 0; + + me->SetCorpseDelay(1000*60*60); + } + + //Called when a tainted elemental dies + void EventTaintedElementalDeath() + { + //the next will spawn 50 seconds after the previous one's death + if (TaintedElemental_Timer > 50000) + TaintedElemental_Timer = 50000; + } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_LADYVASHJEVENT, DONE); + } + + void StartEvent() + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3,SAY_AGGRO4), me); + + Phase = 1; + + if (pInstance) + pInstance->SetData(DATA_LADYVASHJEVENT, IN_PROGRESS); + } + + void EnterCombat(Unit * who) + { + if (pInstance) + { + //remove old tainted cores to prevent cheating in phase 2 + Map* pMap = me->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - i_pl->DestroyItemCount(31088, 1, true); + if (Player* i_pl = i->getSource()) + { + i_pl->DestroyItemCount(31088, 1, true); + } + } + } + StartEvent();//this is EnterCombat(), so were are 100% in combat, start the event + + if (Phase != 2) + AttackStart(who); + } + + void MoveInLineOfSight(Unit *who) + { + if (!Intro) + { + Intro = true; + DoScriptText(SAY_INTRO, me); + } + if (!CanAttack) + return; + if (!who || me->getVictim()) + return; + + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + { + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) + { + //if (who->HasStealthAura()) + // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + + if (!me->isInCombat())//AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking + StartEvent(); + + if (Phase != 2) + AttackStart(who); } } } - StartEvent();//this is EnterCombat(), so were are 100% in combat, start the event - if (Phase != 2) - AttackStart(who); - } - - void MoveInLineOfSight(Unit *who) - { - if (!Intro) + void CastShootOrMultishot() { - Intro = true; - DoScriptText(SAY_INTRO, me); - } - if (!CanAttack) - return; - if (!who || me->getVictim()) - return; - - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) - { - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) + switch (urand(0,1)) { - //if (who->HasStealthAura()) - // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - - if (!me->isInCombat())//AttackStart() sets UNIT_FLAG_IN_COMBAT, so this msut be before attacking - StartEvent(); - - if (Phase != 2) - AttackStart(who); + case 0: + //Shoot + //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. + DoCast(me->getVictim(), SPELL_SHOOT); + break; + case 1: + //Multishot + //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. + DoCast(me->getVictim(), SPELL_MULTI_SHOT); + break; + } + if (rand()%3) + { + DoScriptText(RAND(SAY_BOWSHOT1,SAY_BOWSHOT2), me); } } - } - void CastShootOrMultishot() - { - switch (urand(0,1)) + void UpdateAI(const uint32 diff) { - case 0: - //Shoot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits her target for 4097-5543 Physical damage. - DoCast(me->getVictim(), SPELL_SHOOT); - break; - case 1: - //Multishot - //Used in Phases 1 and 3 after Entangle or while having nobody in melee range. A shot that hits 1 person and 4 people around him for 6475-7525 physical damage. - DoCast(me->getVictim(), SPELL_MULTI_SHOT); - break; - } - if (rand()%3) - { - DoScriptText(RAND(SAY_BOWSHOT1,SAY_BOWSHOT2), me); - } - } - - void UpdateAI(const uint32 diff) - { - if (!CanAttack && Intro) - { - if (AggroTimer <= diff) + if (!CanAttack && Intro) { - CanAttack = true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - AggroTimer=19000; - }else + if (AggroTimer <= diff) + { + CanAttack = true; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + AggroTimer=19000; + }else + { + AggroTimer-=diff; + return; + } + } + //to prevent abuses during phase 2 + if (Phase == 2 && !me->getVictim() && me->isInCombat()) { - AggroTimer-=diff; + EnterEvadeMode(); return; } - } - //to prevent abuses during phase 2 - if (Phase == 2 && !me->getVictim() && me->isInCombat()) - { - EnterEvadeMode(); - return; - } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (Phase == 1 || Phase == 3) - { - //ShockBlast_Timer - if (ShockBlast_Timer <= diff) + if (Phase == 1 || Phase == 3) { - //Shock Burst - //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. - DoCast(me->getVictim(), SPELL_SHOCK_BLAST); - me->TauntApply(me->getVictim()); - - ShockBlast_Timer = 1000+rand()%14000; //random cooldown - } else ShockBlast_Timer -= diff; - - //StaticCharge_Timer - if (StaticCharge_Timer <= diff) - { - //Static Charge - //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. - Unit *pTarget = NULL; - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); - - if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) - //cast Static Charge every 2 seconds for 20 seconds - DoCast(pTarget, SPELL_STATIC_CHARGE_TRIGGER); - - StaticCharge_Timer = 10000+rand()%20000; //blizzlike - } else StaticCharge_Timer -= diff; - - //Entangle_Timer - if (Entangle_Timer <= diff) - { - if (!Entangle) + //ShockBlast_Timer + if (ShockBlast_Timer <= diff) { - //Entangle - //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. - DoCast(me->getVictim(), SPELL_ENTANGLE); - Entangle = true; - Entangle_Timer = 10000; + //Shock Burst + //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list. + DoCast(me->getVictim(), SPELL_SHOCK_BLAST); + me->TauntApply(me->getVictim()); + + ShockBlast_Timer = 1000+rand()%14000; //random cooldown + } else ShockBlast_Timer -= diff; + + //StaticCharge_Timer + if (StaticCharge_Timer <= diff) + { + //Static Charge + //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic. + Unit *pTarget = NULL; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true); + + if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER)) + //cast Static Charge every 2 seconds for 20 seconds + DoCast(pTarget, SPELL_STATIC_CHARGE_TRIGGER); + + StaticCharge_Timer = 10000+rand()%20000; //blizzlike + } else StaticCharge_Timer -= diff; + + //Entangle_Timer + if (Entangle_Timer <= diff) + { + if (!Entangle) + { + //Entangle + //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom. + DoCast(me->getVictim(), SPELL_ENTANGLE); + Entangle = true; + Entangle_Timer = 10000; + } + else + { + CastShootOrMultishot(); + Entangle = false; + Entangle_Timer = 20000+rand()%5000; + } + } else Entangle_Timer -= diff; + + //Phase 1 + if (Phase == 1) + { + //Start phase 2 + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 70) + { + //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. + Phase = 2; + + me->GetMotionMaster()->Clear(); + DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); + + Creature *pCreature; + for (uint8 i = 0; i < 4; ++i) + { + pCreature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + if (pCreature) + ShieldGeneratorChannel[i] = pCreature->GetGUID(); + } + DoScriptText(SAY_PHASE2, me); + } } + //Phase 3 else { - CastShootOrMultishot(); - Entangle = false; - Entangle_Timer = 20000+rand()%5000; - } - } else Entangle_Timer -= diff; - - //Phase 1 - if (Phase == 1) - { - //Start phase 2 - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 70) - { - //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable. - Phase = 2; - - me->GetMotionMaster()->Clear(); - DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - - Creature *pCreature; - for (uint8 i = 0; i < 4; ++i) + //SummonSporebat_Timer + if (SummonSporebat_Timer <= diff) { - pCreature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0], ShieldGeneratorChannelPos[i][1], ShieldGeneratorChannelPos[i][2], ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - if (pCreature) - ShieldGeneratorChannel[i] = pCreature->GetGUID(); - } - DoScriptText(SAY_PHASE2, me); + Creature *Sporebat = NULL; + Sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0); + + if (Sporebat) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + Sporebat->AI()->AttackStart(pTarget); + } + + //summon sporebats faster and faster + if (SummonSporebat_StaticTimer > 1000) + SummonSporebat_StaticTimer -= 1000; + + SummonSporebat_Timer = SummonSporebat_StaticTimer; + + if (SummonSporebat_Timer < 5000) + SummonSporebat_Timer = 5000; + + } else SummonSporebat_Timer -= diff; } + + //Melee attack + DoMeleeAttackIfReady(); + + //Check_Timer - used to check if somebody is in melee range + if (Check_Timer <= diff) + { + bool InMeleeRange = false; + Unit *pTarget; + std::list t_list = me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + //if in melee range + if (pTarget && pTarget->IsWithinDistInMap(me, 5)) + { + InMeleeRange = true; + break; + } + } + + //if nobody is in melee range + if (!InMeleeRange) + CastShootOrMultishot(); + + Check_Timer = 5000; + } else Check_Timer -= diff; } - //Phase 3 + //Phase 2 else { - //SummonSporebat_Timer - if (SummonSporebat_Timer <= diff) + //ForkedLightning_Timer + if (ForkedLightning_Timer <= diff) { - Creature *Sporebat = NULL; - Sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0); + //Forked Lightning + //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (Sporebat) + if (!pTarget) + pTarget = me->getVictim(); + + DoCast(pTarget, SPELL_FORKED_LIGHTNING); + + ForkedLightning_Timer = 2000+rand()%6000; //blizzlike + } else ForkedLightning_Timer -= diff; + + //EnchantedElemental_Timer + if (EnchantedElemental_Timer <= diff) + { + Creature *Elemental; + Elemental = me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); + + if (EnchantedElemental_Pos == 7) + EnchantedElemental_Pos = 0; + else + ++EnchantedElemental_Pos; + + EnchantedElemental_Timer = 10000+rand()%5000; + } else EnchantedElemental_Timer -= diff; + + //TaintedElemental_Timer + if (TaintedElemental_Timer <= diff) + { + Creature *Tain_Elemental; + uint32 pos = rand()%8; + Tain_Elemental = me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0); + + TaintedElemental_Timer = 120000; + } else TaintedElemental_Timer -= diff; + + //CoilfangElite_Timer + if (CoilfangElite_Timer <= diff) + { + uint32 pos = rand()%3; + Creature* CoilfangElite = NULL; + CoilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if (CoilfangElite) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget) - Sporebat->AI()->AttackStart(pTarget); + CoilfangElite->AI()->AttackStart(pTarget); + else if (me->getVictim()) + CoilfangElite->AI()->AttackStart(me->getVictim()); } + CoilfangElite_Timer = 45000+rand()%5000; + } else CoilfangElite_Timer -= diff; - //summon sporebats faster and faster - if (SummonSporebat_StaticTimer > 1000) - SummonSporebat_StaticTimer -= 1000; - - SummonSporebat_Timer = SummonSporebat_StaticTimer; - - if (SummonSporebat_Timer < 5000) - SummonSporebat_Timer = 5000; - - } else SummonSporebat_Timer -= diff; - } - - //Melee attack - DoMeleeAttackIfReady(); - - //Check_Timer - used to check if somebody is in melee range - if (Check_Timer <= diff) - { - bool InMeleeRange = false; - Unit *pTarget; - std::list t_list = me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + //CoilfangStrider_Timer + if (CoilfangStrider_Timer <= diff) { - pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //if in melee range - if (pTarget && pTarget->IsWithinDistInMap(me, 5)) + uint32 pos = rand()%3; + Creature* CoilfangStrider = NULL; + CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if (CoilfangStrider) { - InMeleeRange = true; - break; + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + CoilfangStrider->AI()->AttackStart(pTarget); + else if (me->getVictim()) + CoilfangStrider->AI()->AttackStart(me->getVictim()); } - } + CoilfangStrider_Timer = 60000+rand()%10000; + } else CoilfangStrider_Timer -= diff; - //if nobody is in melee range - if (!InMeleeRange) - CastShootOrMultishot(); + //Check_Timer + if (Check_Timer <= diff) + { + //Start Phase 3 + if (pInstance && pInstance->GetData(DATA_CANSTARTPHASE3)) + { + //set life 50% + me->SetHealth(me->GetMaxHealth()/2); - Check_Timer = 5000; - } else Check_Timer -= diff; + me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); + + DoScriptText(SAY_PHASE3, me); + + Phase = 3; + + //return to the tank + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + Check_Timer = 1000; + } else Check_Timer -= diff; + } } - //Phase 2 - else - { - //ForkedLightning_Timer - if (ForkedLightning_Timer <= diff) - { - //Forked Lightning - //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage. - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + }; - if (!pTarget) - pTarget = me->getVictim(); - - DoCast(pTarget, SPELL_FORKED_LIGHTNING); - - ForkedLightning_Timer = 2000+rand()%6000; //blizzlike - } else ForkedLightning_Timer -= diff; - - //EnchantedElemental_Timer - if (EnchantedElemental_Timer <= diff) - { - Creature *Elemental; - Elemental = me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0); - - if (EnchantedElemental_Pos == 7) - EnchantedElemental_Pos = 0; - else - ++EnchantedElemental_Pos; - - EnchantedElemental_Timer = 10000+rand()%5000; - } else EnchantedElemental_Timer -= diff; - - //TaintedElemental_Timer - if (TaintedElemental_Timer <= diff) - { - Creature *Tain_Elemental; - uint32 pos = rand()%8; - Tain_Elemental = me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0); - - TaintedElemental_Timer = 120000; - } else TaintedElemental_Timer -= diff; - - //CoilfangElite_Timer - if (CoilfangElite_Timer <= diff) - { - uint32 pos = rand()%3; - Creature* CoilfangElite = NULL; - CoilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (CoilfangElite) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - CoilfangElite->AI()->AttackStart(pTarget); - else if (me->getVictim()) - CoilfangElite->AI()->AttackStart(me->getVictim()); - } - CoilfangElite_Timer = 45000+rand()%5000; - } else CoilfangElite_Timer -= diff; - - //CoilfangStrider_Timer - if (CoilfangStrider_Timer <= diff) - { - uint32 pos = rand()%3; - Creature* CoilfangStrider = NULL; - CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (CoilfangStrider) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - CoilfangStrider->AI()->AttackStart(pTarget); - else if (me->getVictim()) - CoilfangStrider->AI()->AttackStart(me->getVictim()); - } - CoilfangStrider_Timer = 60000+rand()%10000; - } else CoilfangStrider_Timer -= diff; - - //Check_Timer - if (Check_Timer <= diff) - { - //Start Phase 3 - if (pInstance && pInstance->GetData(DATA_CANSTARTPHASE3)) - { - //set life 50% - me->SetHealth(me->GetMaxHealth()/2); - - me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER); - - DoScriptText(SAY_PHASE3, me); - - Phase = 3; - - //return to the tank - me->GetMotionMaster()->MoveChase(me->getVictim()); - } - Check_Timer = 1000; - } else Check_Timer -= diff; - } - } }; //Enchanted Elemental -//If one of them reaches Vashj he will increase her damage done by 5%. -struct mob_enchanted_elementalAI : public ScriptedAI +//If one of them reaches Vashj he will increase her damage done by 5%. class mob_enchanted_elemental : public CreatureScript { - mob_enchanted_elementalAI(Creature *c) : ScriptedAI(c) +public: + mob_enchanted_elemental() : CreatureScript("mob_enchanted_elemental") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_enchanted_elementalAI (pCreature); } - ScriptedInstance *pInstance; - uint32 move; - uint32 phase; - float x, y, z; - - uint64 VashjGUID; - - void Reset() + struct mob_enchanted_elementalAI : public ScriptedAI { - me->SetSpeed(MOVE_WALK,0.6);//walk - me->SetSpeed(MOVE_RUN,0.6);//run - move = 0; - phase = 1; - - VashjGUID = 0; - - for (int i = 0; i<8; ++i)//search for nearest waypoint (up on stairs) + mob_enchanted_elementalAI(Creature *c) : ScriptedAI(c) { - if (!x || !y || !z) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + uint32 move; + uint32 phase; + float x, y, z; + + uint64 VashjGUID; + + void Reset() + { + me->SetSpeed(MOVE_WALK,0.6);//walk + me->SetSpeed(MOVE_RUN,0.6);//run + move = 0; + phase = 1; + + VashjGUID = 0; + + for (int i = 0; i<8; ++i)//search for nearest waypoint (up on stairs) { - x = ElementWPPos[i][0]; - y = ElementWPPos[i][1]; - z = ElementWPPos[i][2]; - } - else - { - if (me->GetDistance(ElementWPPos[i][0],ElementWPPos[i][1],ElementWPPos[i][2]) < me->GetDistance(x,y,z)) + if (!x || !y || !z) { x = ElementWPPos[i][0]; y = ElementWPPos[i][1]; z = ElementWPPos[i][2]; } - } - } - if (pInstance) - VashjGUID = pInstance->GetData64(DATA_LADYVASHJ); - } - - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; - - if (!VashjGUID) - return; - - if (move <= diff) - { - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (phase == 1) - me->GetMotionMaster()->MovePoint(0, x, y, z); - if (phase == 1 && me->IsWithinDist3d(x,y,z, 0.1)) - phase = 2; - if (phase == 2) - { - me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - phase = 3; - } - if (phase == 3) - { - me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); - if (me->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3)) - DoCast(me, SPELL_SURGE); - } - if (Creature *Vashj = Unit::GetCreature(*me, VashjGUID)) - { - if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead()) + else { - //call Unsummon() - me->Kill(me); + if (me->GetDistance(ElementWPPos[i][0],ElementWPPos[i][1],ElementWPPos[i][2]) < me->GetDistance(x,y,z)) + { + x = ElementWPPos[i][0]; + y = ElementWPPos[i][1]; + z = ElementWPPos[i][2]; + } } } - move = 1000; - } else move -= diff; - } + if (pInstance) + VashjGUID = pInstance->GetData64(DATA_LADYVASHJ); + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; + + if (!VashjGUID) + return; + + if (move <= diff) + { + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (phase == 1) + me->GetMotionMaster()->MovePoint(0, x, y, z); + if (phase == 1 && me->IsWithinDist3d(x,y,z, 0.1)) + phase = 2; + if (phase == 2) + { + me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); + phase = 3; + } + if (phase == 3) + { + me->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); + if (me->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3)) + DoCast(me, SPELL_SURGE); + } + if (Creature *Vashj = Unit::GetCreature(*me, VashjGUID)) + { + if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead()) + { + //call Unsummon() + me->Kill(me); + } + } + move = 1000; + } else move -= diff; + } + }; + }; //Tainted Elemental -//This mob has 7,900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3,000 nature damage and placing a posion doing 2,000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental -struct mob_tainted_elementalAI : public ScriptedAI +//This mob has 7,900 life, doesn't move, and shoots Poison Bolts at one person anywhere in the area, doing 3,000 nature damage and placing a posion doing 2,000 damage every 2 seconds. He will switch targets often, or sometimes just hang on a single player, but there is nothing you can do about it except heal the damage and kill the Tainted Elemental class mob_tainted_elemental : public CreatureScript { - mob_tainted_elementalAI(Creature *c) : ScriptedAI(c) +public: + mob_tainted_elemental() : CreatureScript("mob_tainted_elemental") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_tainted_elementalAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 PoisonBolt_Timer; - uint32 Despawn_Timer; - - void Reset() + struct mob_tainted_elementalAI : public ScriptedAI { - PoisonBolt_Timer = 5000+rand()%5000; - Despawn_Timer = 30000; - } - - void JustDied(Unit * /*killer*/) - { - if (pInstance) + mob_tainted_elementalAI(Creature *c) : ScriptedAI(c) { - Creature *Vashj = NULL; - Vashj = (Unit::GetCreature((*me), pInstance->GetData64(DATA_LADYVASHJ))); - - if (Vashj) - CAST_AI(boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath(); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit * who) - { - me->AddThreat(who, 0.1f); - } + InstanceScript *pInstance; - void UpdateAI(const uint32 diff) - { - //PoisonBolt_Timer - if (PoisonBolt_Timer <= diff) + uint32 PoisonBolt_Timer; + uint32 Despawn_Timer; + + void Reset() { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - - if (pTarget && pTarget->IsWithinDistInMap(me, 30)) - DoCast(pTarget, SPELL_POISON_BOLT); - PoisonBolt_Timer = 5000+rand()%5000; - } else PoisonBolt_Timer -= diff; - - //Despawn_Timer - if (Despawn_Timer <= diff) - { - //call Unsummon() - me->setDeathState(DEAD); - - //to prevent crashes - Despawn_Timer = 1000; - } else Despawn_Timer -= diff; - } -}; - -//Toxic Sporebat -//Toxic Spores: Used in Phase 3 by the Spore Bats, it creates a contaminated green patch of ground, dealing about 2775-3225 nature damage every second to anyone who stands in it. -struct mob_toxic_sporebatAI : public ScriptedAI -{ - mob_toxic_sporebatAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - EnterEvadeMode(); - } - - ScriptedInstance *pInstance; - - uint32 movement_timer; - uint32 ToxicSpore_Timer; - uint32 bolt_timer; - uint32 Check_Timer; - - void Reset() - { - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->setFaction(14); - movement_timer = 0; - ToxicSpore_Timer = 5000; - bolt_timer = 5500; - Check_Timer = 1000; - } - - void EnterCombat(Unit * /*who*/) - { - - } - - void MoveInLineOfSight(Unit * /*who*/) - { - - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (id == 1) - movement_timer = 0; - } - - void UpdateAI (const uint32 diff) - { - //Random movement - if (movement_timer <= diff) - { - uint32 rndpos = rand()%8; - me->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); - movement_timer = 6000; - } else movement_timer -= diff; - - //toxic spores - if (bolt_timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - { - Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); - if (trig) - { - trig->setFaction(14); - trig->CastSpell(trig, SPELL_TOXIC_SPORES,true); - } - } - bolt_timer = 10000+rand()%5000; + Despawn_Timer = 30000; } - else bolt_timer -= diff; - //Check_Timer - if (Check_Timer <= diff) + void JustDied(Unit * /*killer*/) { if (pInstance) { - //check if vashj is death - Unit *Vashj = NULL; - Vashj = Unit::GetUnit((*me), pInstance->GetData64(DATA_LADYVASHJ)); - if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) - { - //remove - me->setDeathState(DEAD); - me->RemoveCorpse(); - me->setFaction(35); - } - } + Creature *Vashj = NULL; + Vashj = (Unit::GetCreature((*me), pInstance->GetData64(DATA_LADYVASHJ))); - Check_Timer = 1000; - } else Check_Timer -= diff; + if (Vashj) + CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->EventTaintedElementalDeath(); + } + } + + void EnterCombat(Unit * who) + { + me->AddThreat(who, 0.1f); + } + + void UpdateAI(const uint32 diff) + { + //PoisonBolt_Timer + if (PoisonBolt_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + + if (pTarget && pTarget->IsWithinDistInMap(me, 30)) + DoCast(pTarget, SPELL_POISON_BOLT); + + PoisonBolt_Timer = 5000+rand()%5000; + } else PoisonBolt_Timer -= diff; + + //Despawn_Timer + if (Despawn_Timer <= diff) + { + //call Unsummon() + me->setDeathState(DEAD); + + //to prevent crashes + Despawn_Timer = 1000; + } else Despawn_Timer -= diff; + } + }; + +}; + +//Toxic Sporebat +//Toxic Spores: Used in Phase 3 by the Spore Bats, it creates a contaminated green patch of ground, dealing about 2775-3225 nature damage every second to anyone who stands in it. class mob_toxic_sporebat : public CreatureScript +{ +public: + mob_toxic_sporebat() : CreatureScript("mob_toxic_sporebat") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_toxic_sporebatAI (pCreature); } + + struct mob_toxic_sporebatAI : public ScriptedAI + { + mob_toxic_sporebatAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + EnterEvadeMode(); + } + + InstanceScript *pInstance; + + uint32 movement_timer; + uint32 ToxicSpore_Timer; + uint32 bolt_timer; + uint32 Check_Timer; + + void Reset() + { + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->setFaction(14); + movement_timer = 0; + ToxicSpore_Timer = 5000; + bolt_timer = 5500; + Check_Timer = 1000; + } + + void EnterCombat(Unit * /*who*/) + { + + } + + void MoveInLineOfSight(Unit * /*who*/) + { + + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) + movement_timer = 0; + } + + void UpdateAI (const uint32 diff) + { + //Random movement + if (movement_timer <= diff) + { + uint32 rndpos = rand()%8; + me->GetMotionMaster()->MovePoint(1,SporebatWPPos[rndpos][0], SporebatWPPos[rndpos][1], SporebatWPPos[rndpos][2]); + movement_timer = 6000; + } else movement_timer -= diff; + + //toxic spores + if (bolt_timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + Creature* trig = me->SummonCreature(TOXIC_SPORES_TRIGGER,pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,30000); + if (trig) + { + trig->setFaction(14); + trig->CastSpell(trig, SPELL_TOXIC_SPORES,true); + } + } + bolt_timer = 10000+rand()%5000; + } + else bolt_timer -= diff; + + //Check_Timer + if (Check_Timer <= diff) + { + if (pInstance) + { + //check if vashj is death + Unit *Vashj = NULL; + Vashj = Unit::GetUnit((*me), pInstance->GetData64(DATA_LADYVASHJ)); + if (!Vashj || (Vashj && !Vashj->isAlive()) || (Vashj && CAST_AI(boss_lady_vashj::boss_lady_vashjAI, CAST_CRE(Vashj)->AI())->Phase != 3)) + { + //remove + me->setDeathState(DEAD); + me->RemoveCorpse(); + me->setFaction(35); + } + } + + Check_Timer = 1000; + } else Check_Timer -= diff; + } + }; + }; //Coilfang Elite -//It's an elite Naga mob with 170,000 HP. It does about 5000 damage on plate, and has a nasty cleave hitting for about 7500 damage -CreatureAI* GetAI_mob_coilfang_elite(Creature* pCreature) +//It's an elite Naga mob with 170,000 HP. It does about 5000 damage on plate, and has a nasty cleave hitting for about 7500 damage class mob_coilfang_elite : public CreatureScript { - SimpleAI* ai = new SimpleAI (pCreature); +public: + mob_coilfang_elite() : CreatureScript("mob_coilfang_elite") { } - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 31345; //Cleave - ai->Spell[0].Cooldown = 15000; - ai->Spell[0].CooldownRandomAddition = 5000; - ai->Spell[0].First_Cast = 5000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; - - ai->EnterEvadeMode(); - - return ai; -} - -//Coilfang Strider -//It hits plate for about 8000 damage, has a Mind Blast spell doing about 3000 shadow damage, and a Psychic Scream Aura, which fears everybody in a 8 yard range of it every 2-3 seconds , for 5 seconds and increasing their movement speed by 150% during the fear. -CreatureAI* GetAI_mob_coilfang_strider(Creature* pCreature) -{ - SimpleAI* ai = new SimpleAI (pCreature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = 41374; //Mind Blast - ai->Spell[0].Cooldown = 30000; - ai->Spell[0].CooldownRandomAddition = 10000; - ai->Spell[0].First_Cast = 8000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - //Scream aura not implemented - - ai->EnterEvadeMode(); - - return ai; -} - -struct mob_shield_generator_channelAI : public ScriptedAI -{ - mob_shield_generator_channelAI(Creature *c) : ScriptedAI(c) + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + SimpleAI* ai = new SimpleAI (pCreature); + + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = 31345; //Cleave + ai->Spell[0].Cooldown = 15000; + ai->Spell[0].CooldownRandomAddition = 5000; + ai->Spell[0].First_Cast = 5000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_RANDOM; + + ai->EnterEvadeMode(); + + return ai; } - ScriptedInstance *pInstance; - uint32 Check_Timer; - bool Casted; - void Reset() - { - Check_Timer = 0; - Casted = false; - me->SetDisplayId(11686); //invisible - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } - - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit * /*who*/) {} - - void UpdateAI (const uint32 diff) - { - if (!pInstance) - return; - - if (Check_Timer <= diff) - { - Unit *Vashj = NULL; - Vashj = Unit::GetUnit((*me), pInstance->GetData64(DATA_LADYVASHJ)); - - if (Vashj && Vashj->isAlive()) - { - //start visual channel - if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER)) - { - DoCast(Vashj, SPELL_MAGIC_BARRIER, true); - Casted = true; - } - } - Check_Timer = 1000; - } else Check_Timer -= diff; - } }; -bool ItemUse_item_tainted_core(Player* pPlayer, Item* /*_Item*/, SpellCastTargets const& targets) +//Coilfang Strider +//It hits plate for about 8000 damage, has a Mind Blast spell doing about 3000 shadow damage, and a Psychic Scream Aura, which fears everybody in a 8 yard range of it every 2-3 seconds , for 5 seconds and increasing their movement speed by 150% during the fear. class mob_coilfang_strider : public CreatureScript { - ScriptedInstance *pInstance = pPlayer->GetInstanceData(); +public: + mob_coilfang_strider() : CreatureScript("mob_coilfang_strider") { } - if (!pInstance) + CreatureAI* GetAI(Creature* pCreature) const { - pPlayer->GetSession()->SendNotification(TEXT_NOT_INITIALIZED); + SimpleAI* ai = new SimpleAI (pCreature); + + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = 41374; //Mind Blast + ai->Spell[0].Cooldown = 30000; + ai->Spell[0].CooldownRandomAddition = 10000; + ai->Spell[0].First_Cast = 8000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + + //Scream aura not implemented + + ai->EnterEvadeMode(); + + return ai; + } + +}; + class mob_shield_generator_channel : public CreatureScript +{ +public: + mob_shield_generator_channel() : CreatureScript("mob_shield_generator_channel") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_shield_generator_channelAI (pCreature); + } + + struct mob_shield_generator_channelAI : public ScriptedAI + { + mob_shield_generator_channelAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + uint32 Check_Timer; + bool Casted; + void Reset() + { + Check_Timer = 0; + Casted = false; + me->SetDisplayId(11686); //invisible + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit * /*who*/) {} + + void UpdateAI (const uint32 diff) + { + if (!pInstance) + return; + + if (Check_Timer <= diff) + { + Unit *Vashj = NULL; + Vashj = Unit::GetUnit((*me), pInstance->GetData64(DATA_LADYVASHJ)); + + if (Vashj && Vashj->isAlive()) + { + //start visual channel + if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER)) + { + DoCast(Vashj, SPELL_MAGIC_BARRIER, true); + Casted = true; + } + } + Check_Timer = 1000; + } else Check_Timer -= diff; + } + }; + +}; + class item_tainted_core : public ItemScript +{ +public: + item_tainted_core() : ItemScript("item_tainted_core") { } + + bool OnUse(Player* pPlayer, Item* /*_Item*/, SpellCastTargets const& targets) + { + InstanceScript *pInstance = pPlayer->GetInstanceScript(); + + if (!pInstance) + { + pPlayer->GetSession()->SendNotification(TEXT_NOT_INITIALIZED); + return true; + } + + Creature *Vashj = NULL; + Vashj = (Unit::GetCreature((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ))); + if (Vashj && (CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->Phase == 2)) + { + if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT) + { + uint32 identifier; + uint8 channel_identifier; + switch(targets.getGOTarget()->GetEntry()) + { + case 185052: + identifier = DATA_SHIELDGENERATOR1; + channel_identifier = 0; + break; + case 185053: + identifier = DATA_SHIELDGENERATOR2; + channel_identifier = 1; + break; + case 185051: + identifier = DATA_SHIELDGENERATOR3; + channel_identifier = 2; + break; + case 185054: + identifier = DATA_SHIELDGENERATOR4; + channel_identifier = 3; + break; + default: + return true; + } + + if (pInstance->GetData(identifier)) + { + pPlayer->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED); + return true; + } + + //get and remove channel + Unit *Channel = NULL; + Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashj::boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]); + if (Channel) + { + //call Unsummon() + Channel->setDeathState(JUST_DIED); + } + + pInstance->SetData(identifier, 1); + + //remove this item + pPlayer->DestroyItemCount(31088, 1, true); + return true; + } + else if (targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT) + return false; + else if (targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) + { + pPlayer->DestroyItemCount(31088, 1, true); + pPlayer->CastSpell(targets.getUnitTarget(), 38134, true); + return true; + } + } return true; } - Creature *Vashj = NULL; - Vashj = (Unit::GetCreature((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ))); - if (Vashj && CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase == 2) - { - if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT) - { - uint32 identifier; - uint8 channel_identifier; - switch(targets.getGOTarget()->GetEntry()) - { - case 185052: - identifier = DATA_SHIELDGENERATOR1; - channel_identifier = 0; - break; - case 185053: - identifier = DATA_SHIELDGENERATOR2; - channel_identifier = 1; - break; - case 185051: - identifier = DATA_SHIELDGENERATOR3; - channel_identifier = 2; - break; - case 185054: - identifier = DATA_SHIELDGENERATOR4; - channel_identifier = 3; - break; - default: - return true; - } - - if (pInstance->GetData(identifier)) - { - pPlayer->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED); - return true; - } - - //get and remove channel - Unit *Channel = NULL; - Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]); - if (Channel) - { - //call Unsummon() - Channel->setDeathState(JUST_DIED); - } - - pInstance->SetData(identifier, 1); - - //remove this item - pPlayer->DestroyItemCount(31088, 1, true); - return true; - } - else if (targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT) - return false; - else if (targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) - { - pPlayer->DestroyItemCount(31088, 1, true); - pPlayer->CastSpell(targets.getUnitTarget(), 38134, true); - return true; - } - } - return true; -} - -CreatureAI* GetAI_boss_lady_vashj(Creature* pCreature) -{ - return new boss_lady_vashjAI (pCreature); -} - -CreatureAI* GetAI_mob_enchanted_elemental(Creature* pCreature) -{ - return new mob_enchanted_elementalAI (pCreature); -} - -CreatureAI* GetAI_mob_tainted_elemental(Creature* pCreature) -{ - return new mob_tainted_elementalAI (pCreature); -} - -CreatureAI* GetAI_mob_toxic_sporebat(Creature* pCreature) -{ - return new mob_toxic_sporebatAI (pCreature); -} - -CreatureAI* GetAI_mob_shield_generator_channel(Creature* pCreature) -{ - return new mob_shield_generator_channelAI (pCreature); -} +}; void AddSC_boss_lady_vashj() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_lady_vashj"; - newscript->GetAI = &GetAI_boss_lady_vashj; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_enchanted_elemental"; - newscript->GetAI = &GetAI_mob_enchanted_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_tainted_elemental"; - newscript->GetAI = &GetAI_mob_tainted_elemental; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_toxic_sporebat"; - newscript->GetAI = &GetAI_mob_toxic_sporebat; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_coilfang_elite"; - newscript->GetAI = &GetAI_mob_coilfang_elite; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_coilfang_strider"; - newscript->GetAI = &GetAI_mob_coilfang_strider; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_shield_generator_channel"; - newscript->GetAI = &GetAI_mob_shield_generator_channel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "item_tainted_core"; - newscript->pItemUse = &ItemUse_item_tainted_core; - newscript->RegisterSelf(); + new boss_lady_vashj(); + new mob_enchanted_elemental(); + new mob_tainted_elemental(); + new mob_toxic_sporebat(); + new mob_coilfang_elite(); + new mob_coilfang_strider(); + new mob_shield_generator_channel(); + new item_tainted_core(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index 0392ebaaad8..589127d3140 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -66,724 +66,733 @@ EndScriptData */ #define SAY_FINAL_FORM -1548018 #define SAY_FREE -1548019 #define SAY_DEATH -1548020 - -struct mob_inner_demonAI : public ScriptedAI + class mob_inner_demon : public CreatureScript { - mob_inner_demonAI(Creature *c) : ScriptedAI(c) +public: + mob_inner_demon() : CreatureScript("mob_inner_demon") { } + + CreatureAI* GetAI(Creature* pCreature) const { - victimGUID = 0; + return new mob_inner_demonAI (pCreature); } - uint32 ShadowBolt_Timer; - - uint32 Link_Timer; - uint64 victimGUID; - - void Reset() + struct mob_inner_demonAI : public ScriptedAI { - ShadowBolt_Timer = 10000; - Link_Timer = 1000; - } - void JustDied(Unit * /*victim*/) - { - Unit* pUnit = Unit::GetUnit((*me),victimGUID); - if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER)) - pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetGUID() != victimGUID && done_by->GetGUID() != me->GetGUID()) + mob_inner_demonAI(Creature *c) : ScriptedAI(c) { - damage = 0; - DoModifyThreatPercent(done_by, -100); + victimGUID = 0; } - } - void EnterCombat(Unit * /*who*/) - { - if (!victimGUID) return; - } + uint32 ShadowBolt_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Link_Timer; + uint64 victimGUID; - if (me->getVictim()->GetGUID() != victimGUID) + void Reset() { - DoModifyThreatPercent(me->getVictim(), -100); - Unit* owner = Unit::GetUnit((*me),victimGUID); - if (owner && owner->isAlive()) + ShadowBolt_Timer = 10000; + Link_Timer = 1000; + } + void JustDied(Unit * /*victim*/) + { + Unit* pUnit = Unit::GetUnit((*me),victimGUID); + if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER)) + pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetGUID() != victimGUID && done_by->GetGUID() != me->GetGUID()) { - me->AddThreat(owner,999999); - AttackStart(owner); - } else if (owner && owner->isDead()) - { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return; + damage = 0; + DoModifyThreatPercent(done_by, -100); } } - if (Link_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SOUL_LINK, true); - Link_Timer = 1000; - } else Link_Timer -= diff; - - if (!me->HasAura(AURA_DEMONIC_ALIGNMENT)) - DoCast(me, AURA_DEMONIC_ALIGNMENT, true); - - if (ShadowBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOWBOLT, false); - ShadowBolt_Timer = 10000; - } else ShadowBolt_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -//Original Leotheras the Blind AI -struct boss_leotheras_the_blindAI : public ScriptedAI -{ - boss_leotheras_the_blindAI(Creature *c) : ScriptedAI(c) - { - c->GetPosition(x,y,z); - pInstance = c->GetInstanceData(); - Demon = 0; - - for (uint8 i = 0; i < 3; ++i)//clear guids - SpellBinderGUID[i] = 0; - } - - ScriptedInstance *pInstance; - - uint32 Whirlwind_Timer; - uint32 ChaosBlast_Timer; - uint32 SwitchToDemon_Timer; - uint32 SwitchToHuman_Timer; - uint32 Berserk_Timer; - uint32 InnerDemons_Timer; - uint32 BanishTimer; - - bool DealDamage; - bool NeedThreatReset; - bool DemonForm; - bool IsFinalForm; - bool EnrageUsed; - float x,y,z; - - uint64 InnderDemon[5]; - uint32 InnerDemon_Count; - uint64 Demon; - uint64 SpellBinderGUID[3]; - - void Reset() - { - CheckChannelers(); - BanishTimer = 1000; - Whirlwind_Timer = 15000; - ChaosBlast_Timer = 1000; - SwitchToDemon_Timer = 45000; - SwitchToHuman_Timer = 60000; - Berserk_Timer = 600000; - InnerDemons_Timer = 30000; - me->SetCanDualWield(true); - DealDamage = true; - DemonForm = false; - IsFinalForm = false; - NeedThreatReset = false; - EnrageUsed = false; - InnerDemon_Count = 0; - me->SetSpeed(MOVE_RUN, 2.0f, true); - me->SetDisplayId(MODEL_NIGHTELF); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); - DoCast(me, SPELL_DUAL_WIELD, true); - me->SetCorpseDelay(1000*60*60); - if (pInstance) - pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, NOT_STARTED); - } - - void CheckChannelers(/*bool DoEvade = true*/) - { - for (uint8 i = 0; i < 3; ++i) - { - if (Creature *add = Unit::GetCreature(*me,SpellBinderGUID[i])) - add->DisappearAndDie(); - - float nx = x; - float ny = y; - float o = 2.4f; - if (i == 0) {nx += 10; ny -= 5; o=2.5f;} - if (i == 1) {nx -= 8; ny -= 7; o=0.9f;} - if (i == 2) {nx -= 3; ny += 9; o=5.0f;} - Creature* binder = me->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0); - if (binder) - SpellBinderGUID[i] = binder->GetGUID(); - + if (!victimGUID) return; } - } - void MoveInLineOfSight(Unit *who) - { - if (me->HasAura(AURA_BANISH)) - return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + void UpdateAI(const uint32 diff) { - if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + //Return since we have no target + if (!UpdateVictim()) return; - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius)) + if (me->getVictim()->GetGUID() != victimGUID) { - // Check first that object is in an angle in front of this one before LoS check - if (me->HasInArc(M_PI/2.0f, who) && me->IsWithinLOSInMap(who)) + DoModifyThreatPercent(me->getVictim(), -100); + Unit* owner = Unit::GetUnit((*me),victimGUID); + if (owner && owner->isAlive()) { - AttackStart(who); + me->AddThreat(owner,999999); + AttackStart(owner); + } else if (owner && owner->isDead()) + { + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return; } } - } - } - void StartEvent() - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, IN_PROGRESS); - } - - void CheckBanish() - { - uint8 AliveChannelers = 0; - for (uint8 i = 0; i < 3; ++i) - { - Unit *add = Unit::GetUnit(*me,SpellBinderGUID[i]); - if (add && add->isAlive()) - ++AliveChannelers; - } - - // channelers == 0 remove banish aura - if (AliveChannelers == 0 && me->HasAura(AURA_BANISH)) - { - // removing banish aura - me->RemoveAurasDueToSpell(AURA_BANISH); - - // Leotheras is getting immune again - me->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); - - // changing model to bloodelf - me->SetDisplayId(MODEL_NIGHTELF); - - // and reseting equipment - me->LoadEquipment(me->GetEquipmentId()); - - if (pInstance && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + if (Link_Timer <= diff) { - Unit *victim = NULL; - victim = Unit::GetUnit(*me, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); - if (victim) - me->getThreatManager().addThreat(victim, 1); - StartEvent(); - } + DoCast(me->getVictim(), SPELL_SOUL_LINK, true); + Link_Timer = 1000; + } else Link_Timer -= diff; + + if (!me->HasAura(AURA_DEMONIC_ALIGNMENT)) + DoCast(me, AURA_DEMONIC_ALIGNMENT, true); + + if (ShadowBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOWBOLT, false); + ShadowBolt_Timer = 10000; + } else ShadowBolt_Timer -= diff; + + DoMeleeAttackIfReady(); } - else if (AliveChannelers != 0 && !me->HasAura(AURA_BANISH)) + }; + +}; + +//Original Leotheras the Blind AI class boss_leotheras_the_blind : public CreatureScript +{ +public: + boss_leotheras_the_blind() : CreatureScript("boss_leotheras_the_blind") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_leotheras_the_blindAI (pCreature); + } + + struct boss_leotheras_the_blindAI : public ScriptedAI + { + boss_leotheras_the_blindAI(Creature *c) : ScriptedAI(c) { - // channelers != 0 apply banish aura - // removing Leotheras banish immune to apply AURA_BANISH - me->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); - DoCast(me, AURA_BANISH); + c->GetPosition(x,y,z); + pInstance = c->GetInstanceScript(); + Demon = 0; - // changing model - me->SetDisplayId(MODEL_DEMON); + for (uint8 i = 0; i < 3; ++i)//clear guids + SpellBinderGUID[i] = 0; + } - // and removing weapons + InstanceScript *pInstance; + + uint32 Whirlwind_Timer; + uint32 ChaosBlast_Timer; + uint32 SwitchToDemon_Timer; + uint32 SwitchToHuman_Timer; + uint32 Berserk_Timer; + uint32 InnerDemons_Timer; + uint32 BanishTimer; + + bool DealDamage; + bool NeedThreatReset; + bool DemonForm; + bool IsFinalForm; + bool EnrageUsed; + float x,y,z; + + uint64 InnderDemon[5]; + uint32 InnerDemon_Count; + uint64 Demon; + uint64 SpellBinderGUID[3]; + + void Reset() + { + CheckChannelers(); + BanishTimer = 1000; + Whirlwind_Timer = 15000; + ChaosBlast_Timer = 1000; + SwitchToDemon_Timer = 45000; + SwitchToHuman_Timer = 60000; + Berserk_Timer = 600000; + InnerDemons_Timer = 30000; + me->SetCanDualWield(true); + DealDamage = true; + DemonForm = false; + IsFinalForm = false; + NeedThreatReset = false; + EnrageUsed = false; + InnerDemon_Count = 0; + me->SetSpeed(MOVE_RUN, 2.0f, true); + me->SetDisplayId(MODEL_NIGHTELF); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + DoCast(me, SPELL_DUAL_WIELD, true); + me->SetCorpseDelay(1000*60*60); + if (pInstance) + pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, NOT_STARTED); } - } - //Despawn all Inner Demon summoned - void DespawnDemon() - { - for (uint8 i=0; i<5; ++i) + void CheckChannelers(/*bool DoEvade = true*/) { - if (InnderDemon[i]) + for (uint8 i = 0; i < 3; ++i) { - //delete creature - Creature* pCreature = Unit::GetCreature((*me), InnderDemon[i]); - if (pCreature && pCreature->isAlive()) - { - pCreature->ForcedDespawn(); - } - InnderDemon[i] = 0; + if (Creature *add = Unit::GetCreature(*me,SpellBinderGUID[i])) + add->DisappearAndDie(); + + float nx = x; + float ny = y; + float o = 2.4f; + if (i == 0) {nx += 10; ny -= 5; o=2.5f;} + if (i == 1) {nx -= 8; ny -= 7; o=0.9f;} + if (i == 2) {nx -= 3; ny += 9; o=5.0f;} + Creature* binder = me->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0); + if (binder) + SpellBinderGUID[i] = binder->GetGUID(); + } } - - InnerDemon_Count = 0; - } - - void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core - { - for (uint8 i=0; i<5; ++i) + void MoveInLineOfSight(Unit *who) { - if (InnderDemon[i] > 0) + if (me->HasAura(AURA_BANISH)) + return; + + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) { - Creature* pUnit = Unit::GetCreature((*me), InnderDemon[i]); - if (pUnit && pUnit->isAlive()) + if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius)) { - Unit* pUnit_pTarget = Unit::GetUnit(*pUnit, CAST_AI(mob_inner_demonAI, pUnit->AI())->victimGUID); - if (pUnit_pTarget && pUnit_pTarget->isAlive()) + // Check first that object is in an angle in front of this one before LoS check + if (me->HasInArc(M_PI/2.0f, who) && me->IsWithinLOSInMap(who)) { - pUnit->CastSpell(pUnit_pTarget, SPELL_CONSUMING_MADNESS, true); - DoModifyThreatPercent(pUnit_pTarget, -100); + AttackStart(who); } } } } - } - void KilledUnit(Unit * victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - if (DemonForm) + void StartEvent() { - DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), me); + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, IN_PROGRESS); } - else + + void CheckBanish() { - DoScriptText(RAND(SAY_NIGHTELF_SLAY1,SAY_NIGHTELF_SLAY2,SAY_NIGHTELF_SLAY3), me); - } - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - //despawn copy - if (Demon) - { - if (Creature* pDemon = Unit::GetCreature(*me, Demon)) - pDemon->ForcedDespawn(); - } - if (pInstance) - pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - if (me->HasAura(AURA_BANISH)) - return; - - me->LoadEquipment(me->GetEquipmentId()); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (me->HasAura(AURA_BANISH) || !UpdateVictim()) - { - if (BanishTimer <= diff) + uint8 AliveChannelers = 0; + for (uint8 i = 0; i < 3; ++i) { - CheckBanish();//no need to check every update tick - BanishTimer = 1000; - } else BanishTimer -= diff; - return; - } - if (me->HasAura(SPELL_WHIRLWIND)) - if (Whirlwind_Timer <= diff) + Unit *add = Unit::GetUnit(*me,SpellBinderGUID[i]); + if (add && add->isAlive()) + ++AliveChannelers; + } + + // channelers == 0 remove banish aura + if (AliveChannelers == 0 && me->HasAura(AURA_BANISH)) { - Unit *newTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (newTarget) + // removing banish aura + me->RemoveAurasDueToSpell(AURA_BANISH); + + // Leotheras is getting immune again + me->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true); + + // changing model to bloodelf + me->SetDisplayId(MODEL_NIGHTELF); + + // and reseting equipment + me->LoadEquipment(me->GetEquipmentId()); + + if (pInstance && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { - DoResetThreat(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0,newTarget->GetPositionX(),newTarget->GetPositionY(),newTarget->GetPositionZ()); + Unit *victim = NULL; + victim = Unit::GetUnit(*me, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + if (victim) + me->getThreatManager().addThreat(victim, 1); + StartEvent(); } - Whirlwind_Timer = 2000; - } else Whirlwind_Timer -= diff; + } + else if (AliveChannelers != 0 && !me->HasAura(AURA_BANISH)) + { + // channelers != 0 apply banish aura + // removing Leotheras banish immune to apply AURA_BANISH + me->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false); + DoCast(me, AURA_BANISH); - // reseting after changing forms and after ending whirlwind - if (NeedThreatReset && !me->HasAura(SPELL_WHIRLWIND)) + // changing model + me->SetDisplayId(MODEL_DEMON); + + // and removing weapons + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + } + } + + //Despawn all Inner Demon summoned + void DespawnDemon() { - // when changing forms seting timers (or when ending whirlwind - to avoid adding new variable i use Whirlwind_Timer to countdown 2s while whirlwinding) + for (uint8 i=0; i<5; ++i) + { + if (InnderDemon[i]) + { + //delete creature + Creature* pCreature = Unit::GetCreature((*me), InnderDemon[i]); + if (pCreature && pCreature->isAlive()) + { + pCreature->ForcedDespawn(); + } + InnderDemon[i] = 0; + } + } + + InnerDemon_Count = 0; + } + + void CastConsumingMadness() //remove this once SPELL_INSIDIOUS_WHISPER is supported by core + { + for (uint8 i=0; i<5; ++i) + { + if (InnderDemon[i] > 0) + { + Creature* pUnit = Unit::GetCreature((*me), InnderDemon[i]); + if (pUnit && pUnit->isAlive()) + { + Unit* pUnit_pTarget = Unit::GetUnit(*pUnit, CAST_AI(mob_inner_demon::mob_inner_demonAI, pUnit->AI())->victimGUID); + if (pUnit_pTarget && pUnit_pTarget->isAlive()) + { + pUnit->CastSpell(pUnit_pTarget, SPELL_CONSUMING_MADNESS, true); + DoModifyThreatPercent(pUnit_pTarget, -100); + } + } + } + } + } + + void KilledUnit(Unit * victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) + return; + if (DemonForm) - InnerDemons_Timer = 30000; + { + DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), me); + } else - Whirlwind_Timer = 15000; - - NeedThreatReset = false; - DoResetThreat(); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveChase(me->getVictim()); + { + DoScriptText(RAND(SAY_NIGHTELF_SLAY1,SAY_NIGHTELF_SLAY2,SAY_NIGHTELF_SLAY3), me); + } } - //Enrage_Timer (10 min) - if (Berserk_Timer < diff && !EnrageUsed) + void JustDied(Unit * /*victim*/) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_BERSERK); - EnrageUsed = true; - } else Berserk_Timer -= diff; + DoScriptText(SAY_DEATH, me); - if (!DemonForm) - { - //Whirldind Timer - if (!me->HasAura(SPELL_WHIRLWIND)) + //despawn copy + if (Demon) { + if (Creature* pDemon = Unit::GetCreature(*me, Demon)) + pDemon->ForcedDespawn(); + } + if (pInstance) + pInstance->SetData(DATA_LEOTHERASTHEBLINDEVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + if (me->HasAura(AURA_BANISH)) + return; + + me->LoadEquipment(me->GetEquipmentId()); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (me->HasAura(AURA_BANISH) || !UpdateVictim()) + { + if (BanishTimer <= diff) + { + CheckBanish();//no need to check every update tick + BanishTimer = 1000; + } else BanishTimer -= diff; + return; + } + if (me->HasAura(SPELL_WHIRLWIND)) if (Whirlwind_Timer <= diff) { - DoCast(me, SPELL_WHIRLWIND); - // while whirlwinding this variable is used to countdown target's change + Unit *newTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (newTarget) + { + DoResetThreat(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0,newTarget->GetPositionX(),newTarget->GetPositionY(),newTarget->GetPositionZ()); + } Whirlwind_Timer = 2000; - NeedThreatReset = true; } else Whirlwind_Timer -= diff; - } - //Switch_Timer - if (!IsFinalForm) - if (SwitchToDemon_Timer <= diff) + // reseting after changing forms and after ending whirlwind + if (NeedThreatReset && !me->HasAura(SPELL_WHIRLWIND)) + { + // when changing forms seting timers (or when ending whirlwind - to avoid adding new variable i use Whirlwind_Timer to countdown 2s while whirlwinding) + if (DemonForm) + InnerDemons_Timer = 30000; + else + Whirlwind_Timer = 15000; + + NeedThreatReset = false; + DoResetThreat(); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveChase(me->getVictim()); + } + + //Enrage_Timer (10 min) + if (Berserk_Timer < diff && !EnrageUsed) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_BERSERK); + EnrageUsed = true; + } else Berserk_Timer -= diff; + + if (!DemonForm) + { + //Whirldind Timer + if (!me->HasAura(SPELL_WHIRLWIND)) { - //switch to demon form - me->RemoveAurasDueToSpell(SPELL_WHIRLWIND,0); - me->SetDisplayId(MODEL_DEMON); - DoScriptText(SAY_SWITCH_TO_DEMON, me); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); - DemonForm = true; + if (Whirlwind_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWIND); + // while whirlwinding this variable is used to countdown target's change + Whirlwind_Timer = 2000; + NeedThreatReset = true; + } else Whirlwind_Timer -= diff; + } + //Switch_Timer + + if (!IsFinalForm) + if (SwitchToDemon_Timer <= diff) + { + //switch to demon form + me->RemoveAurasDueToSpell(SPELL_WHIRLWIND,0); + me->SetDisplayId(MODEL_DEMON); + DoScriptText(SAY_SWITCH_TO_DEMON, me); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID , 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + DemonForm = true; + NeedThreatReset = true; + SwitchToDemon_Timer = 45000; + } else SwitchToDemon_Timer -= diff; + DoMeleeAttackIfReady(); + } + else + { + //ChaosBlast_Timer + if (!me->getVictim()) + return; + if (me->IsWithinDist(me->getVictim(), 30)) + me->StopMoving(); + if (ChaosBlast_Timer <= diff) + { + // will cast only when in range of spell + if (me->IsWithinDist(me->getVictim(), 30)) + { + //DoCast(me->getVictim(), SPELL_CHAOS_BLAST, true); + int damage = 100; + me->CastCustomSpell(me->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID()); + } + ChaosBlast_Timer = 3000; + } else ChaosBlast_Timer -= diff; + //Summon Inner Demon + if (InnerDemons_Timer <= diff) + { + std::list& ThreatList = me->getThreatManager().getThreatList(); + std::vector TargetList; + for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + { + Unit *tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->getVictim()->GetGUID() && TargetList.size()<5) + TargetList.push_back(tempTarget); + } + //SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); + for (std::vector::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + { + if ((*itr) && (*itr)->isAlive()) + { + Creature * demon = me->SummonCreature(INNER_DEMON_ID, (*itr)->GetPositionX()+10, (*itr)->GetPositionY()+10, (*itr)->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + if (demon) + { + demon->AI()->AttackStart((*itr)); + CAST_AI(mob_inner_demon::mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID(); + + (*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr); + + if (InnerDemon_Count > 4) + InnerDemon_Count = 0; + + //Safe storing of creatures + InnderDemon[InnerDemon_Count] = demon->GetGUID(); + + //Update demon count + ++InnerDemon_Count; + } + } + } + DoScriptText(SAY_INNER_DEMONS, me); + + InnerDemons_Timer = 999999; + } else InnerDemons_Timer -= diff; + + //Switch_Timer + if (SwitchToHuman_Timer <= diff) + { + //switch to nightelf form + me->SetDisplayId(MODEL_NIGHTELF); + me->LoadEquipment(me->GetEquipmentId()); + + CastConsumingMadness(); + DespawnDemon(); + + DemonForm = false; NeedThreatReset = true; - SwitchToDemon_Timer = 45000; - } else SwitchToDemon_Timer -= diff; - DoMeleeAttackIfReady(); + + SwitchToHuman_Timer = 60000; + } else SwitchToHuman_Timer -= diff; + } + + if (!IsFinalForm && (me->GetHealth()*100 / me->GetMaxHealth()) < 15) + { + //at this point he divides himself in two parts + CastConsumingMadness(); + DespawnDemon(); + Creature *Copy = NULL; + Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000); + if (Copy) + { + Demon = Copy->GetGUID(); + if (me->getVictim()) + Copy->AI()->AttackStart(me->getVictim()); + } + //set nightelf final form + IsFinalForm = true; + DemonForm = false; + + DoScriptText(SAY_FINAL_FORM, me); + me->SetDisplayId(MODEL_NIGHTELF); + me->LoadEquipment(me->GetEquipmentId()); + } } - else + }; + +}; + +//Leotheras the Blind Demon Form AI class boss_leotheras_the_blind_demonform : public CreatureScript +{ +public: + boss_leotheras_the_blind_demonform() : CreatureScript("boss_leotheras_the_blind_demonform") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_leotheras_the_blind_demonformAI (pCreature); + } + + struct boss_leotheras_the_blind_demonformAI : public ScriptedAI + { + boss_leotheras_the_blind_demonformAI(Creature *c) : ScriptedAI(c) {} + + uint32 ChaosBlast_Timer; + bool DealDamage; + + void Reset() { - //ChaosBlast_Timer - if (!me->getVictim()) + ChaosBlast_Timer = 1000; + DealDamage = true; + } + + void StartEvent() + { + DoScriptText(SAY_FREE, me); + } + + void KilledUnit(Unit * victim) + { + if (victim->GetTypeId() != TYPEID_PLAYER) return; + + DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), me); + } + + void JustDied(Unit * /*victim*/) + { + //invisibility (blizzlike, at the end of the fight he doesn't die, he disappears) + DoCast(me, 8149, true); + } + + void EnterCombat(Unit * /*who*/) + { + StartEvent(); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + //ChaosBlast_Timer if (me->IsWithinDist(me->getVictim(), 30)) me->StopMoving(); + if (ChaosBlast_Timer <= diff) - { - // will cast only when in range of spell + { + // will cast only when in range od spell if (me->IsWithinDist(me->getVictim(), 30)) { //DoCast(me->getVictim(), SPELL_CHAOS_BLAST, true); int damage = 100; me->CastCustomSpell(me->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID()); + ChaosBlast_Timer = 3000; } - ChaosBlast_Timer = 3000; - } else ChaosBlast_Timer -= diff; - //Summon Inner Demon - if (InnerDemons_Timer <= diff) + } else ChaosBlast_Timer -= diff; + + //Do NOT deal any melee damage to the target. + } + }; class mob_greyheart_spellbinder : public CreatureScript + +}; +{ +public: + mob_greyheart_spellbinder() : CreatureScript("mob_greyheart_spellbinder") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_greyheart_spellbinderAI (pCreature); + } + + struct mob_greyheart_spellbinderAI : public ScriptedAI + { + mob_greyheart_spellbinderAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + leotherasGUID = 0; + AddedBanish = false; + } + + InstanceScript *pInstance; + + uint64 leotherasGUID; + + uint32 Mindblast_Timer; + uint32 Earthshock_Timer; + + bool AddedBanish; + + void Reset() + { + Mindblast_Timer = 3000 + rand()%5000; + Earthshock_Timer = 5000 + rand()%5000; + + if (pInstance) { - std::list& ThreatList = me->getThreatManager().getThreatList(); - std::vector TargetList; - for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); + Creature *leotheras = Unit::GetCreature(*me, leotherasGUID); + if (leotheras && leotheras->isAlive()) + CAST_AI(boss_leotheras_the_blind::boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); + } + } + + void EnterCombat(Unit * who) + { + me->InterruptNonMeleeSpells(false); + if (pInstance) + pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); + } + + void JustRespawned() + { + AddedBanish = false; + Reset(); + } + + void CastChanneling() + { + if (!me->isInCombat() && !me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + { + if (leotherasGUID) { - Unit *tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->getVictim()->GetGUID() && TargetList.size()<5) - TargetList.push_back(tempTarget); + Creature *leotheras = Unit::GetCreature(*me, leotherasGUID); + if (leotheras && leotheras->isAlive()) + DoCast(leotheras, BANISH_BEAM); } - //SpellEntry *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); - for (std::vector::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + } + } + + void UpdateAI(const uint32 diff) + { + if (pInstance) + { + if (!leotherasGUID) + leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS); + + if (!me->isInCombat() && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) { - if ((*itr) && (*itr)->isAlive()) + Unit *victim = NULL; + victim = Unit::GetUnit(*me, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); + if (victim) + AttackStart(victim); + } + } + + if (!UpdateVictim()) + { + CastChanneling(); + return; + } + + if (pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) + { + EnterEvadeMode(); + return; + } + + if (Mindblast_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + if (pTarget)DoCast(pTarget, SPELL_MINDBLAST); + + Mindblast_Timer = 10000 + rand()%5000; + } else Mindblast_Timer -= diff; + + if (Earthshock_Timer <= diff) + { + Map* pMap = me->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + { + if (Player* i_pl = itr->getSource()) { - Creature * demon = me->SummonCreature(INNER_DEMON_ID, (*itr)->GetPositionX()+10, (*itr)->GetPositionY()+10, (*itr)->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - if (demon) + bool isCasting = false; + for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) + if (i_pl->GetCurrentSpell(i)) + isCasting = true; + + if (isCasting) { - demon->AI()->AttackStart((*itr)); - CAST_AI(mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID(); - - (*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr); - - if (InnerDemon_Count > 4) - InnerDemon_Count = 0; - - //Safe storing of creatures - InnderDemon[InnerDemon_Count] = demon->GetGUID(); - - //Update demon count - ++InnerDemon_Count; + DoCast(i_pl, SPELL_EARTHSHOCK); + break; } } } - DoScriptText(SAY_INNER_DEMONS, me); - - InnerDemons_Timer = 999999; - } else InnerDemons_Timer -= diff; - - //Switch_Timer - if (SwitchToHuman_Timer <= diff) - { - //switch to nightelf form - me->SetDisplayId(MODEL_NIGHTELF); - me->LoadEquipment(me->GetEquipmentId()); - - CastConsumingMadness(); - DespawnDemon(); - - DemonForm = false; - NeedThreatReset = true; - - SwitchToHuman_Timer = 60000; - } else SwitchToHuman_Timer -= diff; + Earthshock_Timer = 8000 + rand()%7000; + } else Earthshock_Timer -= diff; + DoMeleeAttackIfReady(); } - if (!IsFinalForm && (me->GetHealth()*100 / me->GetMaxHealth()) < 15) - { - //at this point he divides himself in two parts - CastConsumingMadness(); - DespawnDemon(); - Creature *Copy = NULL; - Copy = DoSpawnCreature(DEMON_FORM, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 6000); - if (Copy) - { - Demon = Copy->GetGUID(); - if (me->getVictim()) - Copy->AI()->AttackStart(me->getVictim()); - } - //set nightelf final form - IsFinalForm = true; - DemonForm = false; + void JustDied(Unit * /*killer*/) {} + }; - DoScriptText(SAY_FINAL_FORM, me); - me->SetDisplayId(MODEL_NIGHTELF); - me->LoadEquipment(me->GetEquipmentId()); - } - } }; -//Leotheras the Blind Demon Form AI -struct boss_leotheras_the_blind_demonformAI : public ScriptedAI -{ - boss_leotheras_the_blind_demonformAI(Creature *c) : ScriptedAI(c) {} - - uint32 ChaosBlast_Timer; - bool DealDamage; - - void Reset() - { - ChaosBlast_Timer = 1000; - DealDamage = true; - } - - void StartEvent() - { - DoScriptText(SAY_FREE, me); - } - - void KilledUnit(Unit * victim) - { - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - DoScriptText(RAND(SAY_DEMON_SLAY1,SAY_DEMON_SLAY2,SAY_DEMON_SLAY3), me); - } - - void JustDied(Unit * /*victim*/) - { - //invisibility (blizzlike, at the end of the fight he doesn't die, he disappears) - DoCast(me, 8149, true); - } - - void EnterCombat(Unit * /*who*/) - { - StartEvent(); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - //ChaosBlast_Timer - if (me->IsWithinDist(me->getVictim(), 30)) - me->StopMoving(); - - if (ChaosBlast_Timer <= diff) - { - // will cast only when in range od spell - if (me->IsWithinDist(me->getVictim(), 30)) - { - //DoCast(me->getVictim(), SPELL_CHAOS_BLAST, true); - int damage = 100; - me->CastCustomSpell(me->getVictim(), SPELL_CHAOS_BLAST, &damage, NULL, NULL, false, NULL, NULL, me->GetGUID()); - ChaosBlast_Timer = 3000; - } - } else ChaosBlast_Timer -= diff; - - //Do NOT deal any melee damage to the target. - } -}; -struct mob_greyheart_spellbinderAI : public ScriptedAI -{ - mob_greyheart_spellbinderAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - leotherasGUID = 0; - AddedBanish = false; - } - - ScriptedInstance *pInstance; - - uint64 leotherasGUID; - - uint32 Mindblast_Timer; - uint32 Earthshock_Timer; - - bool AddedBanish; - - void Reset() - { - Mindblast_Timer = 3000 + rand()%5000; - Earthshock_Timer = 5000 + rand()%5000; - - if (pInstance) - { - pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, 0); - Creature *leotheras = Unit::GetCreature(*me, leotherasGUID); - if (leotheras && leotheras->isAlive()) - CAST_AI(boss_leotheras_the_blindAI, leotheras->AI())->CheckChannelers(/*false*/); - } - } - - void EnterCombat(Unit * who) - { - me->InterruptNonMeleeSpells(false); - if (pInstance) - pInstance->SetData64(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID()); - } - - void JustRespawned() - { - AddedBanish = false; - Reset(); - } - - void CastChanneling() - { - if (!me->isInCombat() && !me->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - { - if (leotherasGUID) - { - Creature *leotheras = Unit::GetCreature(*me, leotherasGUID); - if (leotheras && leotheras->isAlive()) - DoCast(leotheras, BANISH_BEAM); - } - } - } - - void UpdateAI(const uint32 diff) - { - if (pInstance) - { - if (!leotherasGUID) - leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS); - - if (!me->isInCombat() && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) - { - Unit *victim = NULL; - victim = Unit::GetUnit(*me, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)); - if (victim) - AttackStart(victim); - } - } - - if (!UpdateVictim()) - { - CastChanneling(); - return; - } - - if (pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER)) - { - EnterEvadeMode(); - return; - } - - if (Mindblast_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - if (pTarget)DoCast(pTarget, SPELL_MINDBLAST); - - Mindblast_Timer = 10000 + rand()%5000; - } else Mindblast_Timer -= diff; - - if (Earthshock_Timer <= diff) - { - Map* pMap = me->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) - { - if (Player* i_pl = itr->getSource()) - { - bool isCasting = false; - for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i) - if (i_pl->GetCurrentSpell(i)) - isCasting = true; - - if (isCasting) - { - DoCast(i_pl, SPELL_EARTHSHOCK); - break; - } - } - } - Earthshock_Timer = 8000 + rand()%7000; - } else Earthshock_Timer -= diff; - DoMeleeAttackIfReady(); - } - - void JustDied(Unit * /*killer*/) {} -}; -CreatureAI* GetAI_boss_leotheras_the_blind(Creature* pCreature) -{ - return new boss_leotheras_the_blindAI (pCreature); -} - -CreatureAI* GetAI_boss_leotheras_the_blind_demonform(Creature* pCreature) -{ - return new boss_leotheras_the_blind_demonformAI (pCreature); -} - -CreatureAI* GetAI_mob_greyheart_spellbinder(Creature* pCreature) -{ - return new mob_greyheart_spellbinderAI (pCreature); -} - -CreatureAI* GetAI_mob_inner_demon(Creature* pCreature) -{ - return new mob_inner_demonAI (pCreature); -} void AddSC_boss_leotheras_the_blind() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_leotheras_the_blind"; - newscript->GetAI = &GetAI_boss_leotheras_the_blind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_leotheras_the_blind_demonform"; - newscript->GetAI = &GetAI_boss_leotheras_the_blind_demonform; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_greyheart_spellbinder"; - newscript->GetAI = &GetAI_mob_greyheart_spellbinder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_inner_demon"; - newscript->GetAI = &GetAI_mob_inner_demon; - newscript->RegisterSelf(); + new boss_leotheras_the_blind(); + new boss_leotheras_the_blind_demonform(); + new mob_greyheart_spellbinder(); + new mob_inner_demon(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 7bfd50407a6..1fdea194e71 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -65,396 +65,399 @@ float AddPos[9][3] = {14.388216, -423.468018, -19.625271}, //MOVE_GUARDIAN_2 X, Y, Z {42.471519, -445.115295, -19.769423} //MOVE_GUARDIAN_3 X, Y, Z }; - -struct boss_the_lurker_belowAI : public Scripted_NoMovementAI + class boss_the_lurker_below : public CreatureScript { - boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) +public: + boss_the_lurker_below() : CreatureScript("boss_the_lurker_below") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - SpellEntry *TempSpell = GET_SPELL(SPELL_SPOUT_ANIM); - if (TempSpell) + return new boss_the_lurker_belowAI (pCreature); + } + + struct boss_the_lurker_belowAI : public Scripted_NoMovementAI + { + boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(me) { - TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed - TempSpell->Effect[1] = 0; - TempSpell->Effect[2] = 0; + pInstance = c->GetInstanceScript(); + SpellEntry *TempSpell = GET_SPELL(SPELL_SPOUT_ANIM); + if (TempSpell) + { + TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed + TempSpell->Effect[1] = 0; + TempSpell->Effect[2] = 0; + } } - } - ScriptedInstance* pInstance; - SummonList Summons; + InstanceScript* pInstance; + SummonList Summons; - bool Spawned; - bool Submerged; - bool InRange; - bool CanStartEvent; - uint32 RotTimer; - uint32 SpoutAnimTimer; - uint32 WaterboltTimer; - uint32 SpoutTimer; - uint32 WhirlTimer; - uint32 PhaseTimer; - uint32 GeyserTimer; - uint32 CheckTimer; - uint32 WaitTimer; - uint32 WaitTimer2; + bool Spawned; + bool Submerged; + bool InRange; + bool CanStartEvent; + uint32 RotTimer; + uint32 SpoutAnimTimer; + uint32 WaterboltTimer; + uint32 SpoutTimer; + uint32 WhirlTimer; + uint32 PhaseTimer; + uint32 GeyserTimer; + uint32 CheckTimer; + uint32 WaitTimer; + uint32 WaitTimer2; - bool CheckCanStart()//check if players fished - { - if (pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED) - return false; - return true; - } - void Reset() - { - me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); - SpoutAnimTimer = 1000; - RotTimer = 0; - WaterboltTimer = 15000;//give time to get in range when fight starts - SpoutTimer = 45000; - WhirlTimer = 18000;//after avery spout - PhaseTimer = 120000; - GeyserTimer = rand()%5000 + 15000; - CheckTimer = 15000;//give time to get in range when fight starts - WaitTimer = 60000;//never reached - WaitTimer2 = 60000;//never reached - - Submerged = true;//will be false at combat start - Spawned = false; - InRange = false; - CanStartEvent = false; - - Summons.DespawnAll(); - - if (pInstance) + bool CheckCanStart()//check if players fished { - pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); - pInstance->SetData(DATA_STRANGE_POOL, NOT_STARTED); + if (pInstance && pInstance->GetData(DATA_STRANGE_POOL) == NOT_STARTED) + return false; + return true; } - DoCast(me, SPELL_SUBMERGE);//submerge anim - me->SetVisibility(VISIBILITY_OFF);//we start invis under water, submerged - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); - - Summons.DespawnAll(); - } - - void EnterCombat(Unit * who) - { - if (pInstance) - pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); - Scripted_NoMovementAI::EnterCombat(who); - } - - void MoveInLineOfSight(Unit *who) - { - if (!CanStartEvent)//boss is invisible, don't attack - return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + void Reset() { - float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, attackRadius)) + me->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + SpoutAnimTimer = 1000; + RotTimer = 0; + WaterboltTimer = 15000;//give time to get in range when fight starts + SpoutTimer = 45000; + WhirlTimer = 18000;//after avery spout + PhaseTimer = 120000; + GeyserTimer = rand()%5000 + 15000; + CheckTimer = 15000;//give time to get in range when fight starts + WaitTimer = 60000;//never reached + WaitTimer2 = 60000;//never reached + + Submerged = true;//will be false at combat start + Spawned = false; + InRange = false; + CanStartEvent = false; + + Summons.DespawnAll(); + + if (pInstance) + { + pInstance->SetData(DATA_THELURKERBELOWEVENT, NOT_STARTED); + pInstance->SetData(DATA_STRANGE_POOL, NOT_STARTED); + } + DoCast(me, SPELL_SUBMERGE);//submerge anim + me->SetVisibility(VISIBILITY_OFF);//we start invis under water, submerged + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, DONE); + + Summons.DespawnAll(); + } + + void EnterCombat(Unit * who) + { + if (pInstance) + pInstance->SetData(DATA_THELURKERBELOWEVENT, IN_PROGRESS); + Scripted_NoMovementAI::EnterCombat(who); + } + + void MoveInLineOfSight(Unit *who) + { + if (!CanStartEvent)//boss is invisible, don't attack + return; + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + { + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius)) + { + AttackStart(who); + } + } + } + + void MovementInform(uint32 type, uint32 /*id*/) + { + if (type == ROTATE_MOTION_TYPE) + me->SetReactState(REACT_AGGRESSIVE); + } + + void UpdateAI(const uint32 diff) + { + if (!CanStartEvent)//boss is invisible, don't attack + { + if (CheckCanStart()) + { + if (Submerged) + { + me->SetVisibility(VISIBILITY_ON); + Submerged = false; + WaitTimer2 = 500; + } + if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim + { + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); + DoCast(me, SPELL_EMERGE, false); + WaitTimer2 = 60000;//never reached + WaitTimer = 3000; + } else WaitTimer2 -= diff; + + if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack + { + WaitTimer = 3000; + CanStartEvent=true;//fresh fished from pool + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } else WaitTimer -= diff; + } + return; + } + + if (me->getThreatManager().getThreatList().empty())//check if should evade + { + if (me->isInCombat()) + EnterEvadeMode(); + return; + } + if (!Submerged) + { + if (PhaseTimer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_SUBMERGE); + PhaseTimer = 60000;//60secs submerged + Submerged = true; + } else PhaseTimer-=diff; + + if (SpoutTimer <= diff) + { + me->MonsterTextEmote(EMOTE_SPOUT,0,true); + me->SetReactState(REACT_PASSIVE); + me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); + SpoutTimer = 45000; + WhirlTimer = 20000;//whirl directly after spout + RotTimer = 20000; + return; + } else SpoutTimer -= diff; + + //Whirl directly after a Spout and at random times + if (WhirlTimer <= diff) + { + WhirlTimer = 18000; + DoCast(me, SPELL_WHIRL); + } else WhirlTimer -= diff; + + if (CheckTimer <= diff)//check if there are players in melee range + { + InRange = false; + Map* pMap = me->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (!PlayerList.isEmpty()) + { + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (me->IsWithinMeleeRange(i->getSource())) + InRange = true; + } + } + CheckTimer = 2000; + } else CheckTimer -= diff; + + if (RotTimer) + { + Map* pMap = me->GetMap(); + if (pMap->IsDungeon()) + { + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource() && i->getSource()->isAlive() && me->HasInArc((double)diff/20000*(double)M_PI*2,i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater()) + DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water + } + } + + if (SpoutAnimTimer <= diff) + { + DoCast(me, SPELL_SPOUT_ANIM, true); + SpoutAnimTimer = 1000; + } else SpoutAnimTimer -= diff; + + if (RotTimer <= diff) + { + RotTimer = 0; + } else RotTimer -= diff; + return; + } + + if (GeyserTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (!pTarget && me->getVictim()) + pTarget = me->getVictim(); + if (pTarget) + DoCast(pTarget, SPELL_GEYSER, true); + GeyserTimer = rand()%5000 + 15000; + } else GeyserTimer -= diff; + + if (!InRange)//if on players in melee range cast Waterbolt + { + if (WaterboltTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget && me->getVictim()) + pTarget = me->getVictim(); + if (pTarget) + DoCast(pTarget, SPELL_WATERBOLT, true); + WaterboltTimer = 3000; + } else WaterboltTimer -= diff; + } + + if (!UpdateCombatState()) + return; + + DoMeleeAttackIfReady(); + + }else//submerged + { + if (PhaseTimer <= diff) + { + Submerged = false; + me->InterruptNonMeleeSpells(false);//shouldn't be any + me->RemoveAllAuras(); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); + DoCast(me, SPELL_EMERGE, true); + Spawned = false; + SpoutTimer = 3000; // directly cast Spout after emerging! + PhaseTimer = 120000; + return; + } else PhaseTimer-=diff; + + if (me->getThreatManager().getThreatList().empty())//check if should evade + { + EnterEvadeMode(); + return; + } + if (!me->isInCombat()) + DoZoneInCombat(); + + if (!Spawned) + { + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + //spawn adds + for (uint8 i = 0; i < 9; ++i) + { + Creature* Summoned; + if (i < 6) + Summoned = me->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + else Summoned = me->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + + if (Summoned) + Summons.Summon(Summoned); + } + Spawned = true; + } + } + } + }; +}; + class mob_coilfang_guardian : public CreatureScript +{ +public: + mob_coilfang_guardian() : CreatureScript("mob_coilfang_guardian") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + SimpleAI* ai = new SimpleAI (pCreature); + + ai->Spell[0].Enabled = true; + ai->Spell[0].Spell_Id = SPELL_ARCINGSMASH; + ai->Spell[0].Cooldown = 15000; + ai->Spell[0].First_Cast = 5000; + ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; + + ai->Spell[1].Enabled = true; + ai->Spell[1].Spell_Id = SPELL_HAMSTRING; + ai->Spell[1].Cooldown = 10000; + ai->Spell[1].First_Cast = 2000; + ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; + + return ai; + } + +}; + class mob_coilfang_ambusher : public CreatureScript +{ +public: + mob_coilfang_ambusher() : CreatureScript("mob_coilfang_ambusher") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_coilfang_ambusherAI (pCreature); + } + + struct mob_coilfang_ambusherAI : public Scripted_NoMovementAI + { + mob_coilfang_ambusherAI(Creature *c) : Scripted_NoMovementAI(c) + { + SpellEntry *TempSpell = GET_SPELL(SPELL_SHOOT); + if (TempSpell) + TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg + } + + uint32 MultiShotTimer; + uint32 ShootBowTimer; + + void Reset() + { + MultiShotTimer = 10000; + ShootBowTimer = 4000; + + } + + void EnterCombat(Unit * /*who*/) + { + + } + + void MoveInLineOfSight(Unit *who) + { + if (!who || me->getVictim()) return; + + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 45)) { AttackStart(who); } } - } - void MovementInform(uint32 type, uint32 /*id*/) - { - if (type == ROTATE_MOTION_TYPE) - me->SetReactState(REACT_AGGRESSIVE); - } - - void UpdateAI(const uint32 diff) - { - if (!CanStartEvent)//boss is invisible, don't attack + void UpdateAI(const uint32 diff) { - if (CheckCanStart()) + if (MultiShotTimer <= diff) { - if (Submerged) - { - me->SetVisibility(VISIBILITY_ON); - Submerged = false; - WaitTimer2 = 500; - } - if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim - { - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); - DoCast(me, SPELL_EMERGE, false); - WaitTimer2 = 60000;//never reached - WaitTimer = 3000; - } else WaitTimer2 -= diff; + if (me->getVictim()) + DoCast(me->getVictim(), SPELL_SPREAD_SHOT, true); - if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack - { - WaitTimer = 3000; - CanStartEvent=true;//fresh fished from pool - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - } else WaitTimer -= diff; - } - return; - } + MultiShotTimer = 10000+rand()%10000; + ShootBowTimer += 1500;//add global cooldown + } else MultiShotTimer -= diff; - if (me->getThreatManager().getThreatList().empty())//check if should evade - { - if (me->isInCombat()) - EnterEvadeMode(); - return; - } - if (!Submerged) - { - if (PhaseTimer <= diff) + if (ShootBowTimer <= diff) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_SUBMERGE); - PhaseTimer = 60000;//60secs submerged - Submerged = true; - } else PhaseTimer-=diff; - - if (SpoutTimer <= diff) - { - me->MonsterTextEmote(EMOTE_SPOUT,0,true); - me->SetReactState(REACT_PASSIVE); - me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT); - SpoutTimer = 45000; - WhirlTimer = 20000;//whirl directly after spout - RotTimer = 20000; - return; - } else SpoutTimer -= diff; - - //Whirl directly after a Spout and at random times - if (WhirlTimer <= diff) - { - WhirlTimer = 18000; - DoCast(me, SPELL_WHIRL); - } else WhirlTimer -= diff; - - if (CheckTimer <= diff)//check if there are players in melee range - { - InRange = false; - Map* pMap = me->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (me->IsWithinMeleeRange(i->getSource())) - InRange = true; - } - } - CheckTimer = 2000; - } else CheckTimer -= diff; - - if (RotTimer) - { - Map* pMap = me->GetMap(); - if (pMap->IsDungeon()) - { - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - { - if (i->getSource() && i->getSource()->isAlive() && me->HasInArc((double)diff/20000*(double)M_PI*2,i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater()) - DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water - } - } - - if (SpoutAnimTimer <= diff) - { - DoCast(me, SPELL_SPOUT_ANIM, true); - SpoutAnimTimer = 1000; - } else SpoutAnimTimer -= diff; - - if (RotTimer <= diff) - { - RotTimer = 0; - } else RotTimer -= diff; - return; - } - - if (GeyserTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (!pTarget && me->getVictim()) - pTarget = me->getVictim(); + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + int bp0 = 1100; if (pTarget) - DoCast(pTarget, SPELL_GEYSER, true); - GeyserTimer = rand()%5000 + 15000; - } else GeyserTimer -= diff; - - if (!InRange)//if on players in melee range cast Waterbolt - { - if (WaterboltTimer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (!pTarget && me->getVictim()) - pTarget = me->getVictim(); - if (pTarget) - DoCast(pTarget, SPELL_WATERBOLT, true); - WaterboltTimer = 3000; - } else WaterboltTimer -= diff; - } - - if (!UpdateCombatState()) - return; - - DoMeleeAttackIfReady(); - - }else//submerged - { - if (PhaseTimer <= diff) - { - Submerged = false; - me->InterruptNonMeleeSpells(false);//shouldn't be any - me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED); - DoCast(me, SPELL_EMERGE, true); - Spawned = false; - SpoutTimer = 3000; // directly cast Spout after emerging! - PhaseTimer = 120000; - return; - } else PhaseTimer-=diff; - - if (me->getThreatManager().getThreatList().empty())//check if should evade - { - EnterEvadeMode(); - return; - } - if (!me->isInCombat()) - DoZoneInCombat(); - - if (!Spawned) - { - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - //spawn adds - for (uint8 i = 0; i < 9; ++i) - { - Creature* Summoned; - if (i < 6) - Summoned = me->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - else Summoned = me->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); - - if (Summoned) - Summons.Summon(Summoned); - } - Spawned = true; - } + me->CastCustomSpell(pTarget,SPELL_SHOOT,&bp0,NULL,NULL,true); + ShootBowTimer = 4000+rand()%5000; + MultiShotTimer += 1500;//add global cooldown + } else ShootBowTimer -= diff; } - } - }; + }; -CreatureAI* GetAI_mob_coilfang_guardian(Creature* pCreature) -{ - SimpleAI* ai = new SimpleAI (pCreature); - - ai->Spell[0].Enabled = true; - ai->Spell[0].Spell_Id = SPELL_ARCINGSMASH; - ai->Spell[0].Cooldown = 15000; - ai->Spell[0].First_Cast = 5000; - ai->Spell[0].Cast_Target_Type = CAST_HOSTILE_TARGET; - - ai->Spell[1].Enabled = true; - ai->Spell[1].Spell_Id = SPELL_HAMSTRING; - ai->Spell[1].Cooldown = 10000; - ai->Spell[1].First_Cast = 2000; - ai->Spell[1].Cast_Target_Type = CAST_HOSTILE_TARGET; - - return ai; -} - -struct mob_coilfang_ambusherAI : public Scripted_NoMovementAI -{ - mob_coilfang_ambusherAI(Creature *c) : Scripted_NoMovementAI(c) - { - SpellEntry *TempSpell = GET_SPELL(SPELL_SHOOT); - if (TempSpell) - TempSpell->Effect[0] = 2;//change spell effect from weapon % dmg to simple phisical dmg - } - - uint32 MultiShotTimer; - uint32 ShootBowTimer; - - void Reset() - { - MultiShotTimer = 10000; - ShootBowTimer = 4000; - - } - - void EnterCombat(Unit * /*who*/) - { - - } - - void MoveInLineOfSight(Unit *who) - { - if (!who || me->getVictim()) return; - - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 45)) - { - AttackStart(who); - } - } - - void UpdateAI(const uint32 diff) - { - if (MultiShotTimer <= diff) - { - if (me->getVictim()) - DoCast(me->getVictim(), SPELL_SPREAD_SHOT, true); - - MultiShotTimer = 10000+rand()%10000; - ShootBowTimer += 1500;//add global cooldown - } else MultiShotTimer -= diff; - - if (ShootBowTimer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - int bp0 = 1100; - if (pTarget) - me->CastCustomSpell(pTarget,SPELL_SHOOT,&bp0,NULL,NULL,true); - ShootBowTimer = 4000+rand()%5000; - MultiShotTimer += 1500;//add global cooldown - } else ShootBowTimer -= diff; - } }; -CreatureAI* GetAI_mob_coilfang_ambusher(Creature* pCreature) -{ - return new mob_coilfang_ambusherAI (pCreature); -} - -CreatureAI* GetAI_boss_the_lurker_below(Creature* pCreature) -{ - return new boss_the_lurker_belowAI (pCreature); -} - void AddSC_boss_the_lurker_below() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_the_lurker_below"; - newscript->GetAI = &GetAI_boss_the_lurker_below; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_coilfang_guardian"; - newscript->GetAI = &GetAI_mob_coilfang_guardian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_coilfang_ambusher"; - newscript->GetAI = &GetAI_mob_coilfang_ambusher; - newscript->RegisterSelf(); + new boss_the_lurker_below(); + new mob_coilfang_guardian(); + new mob_coilfang_ambusher(); } - - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index b040730f1a2..a6807ca69e6 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -97,274 +97,278 @@ float MurlocCords[10][5] = #define WATER_GLOBULE 21913 #define TIDEWALKER_LURKER 21920 -//Morogrim Tidewalker AI -struct boss_morogrim_tidewalkerAI : public ScriptedAI +//Morogrim Tidewalker AI class boss_morogrim_tidewalker : public CreatureScript { - boss_morogrim_tidewalkerAI(Creature *c) : ScriptedAI(c) +public: + boss_morogrim_tidewalker() : CreatureScript("boss_morogrim_tidewalker") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_morogrim_tidewalkerAI (pCreature); } - ScriptedInstance* pInstance; - - Map::PlayerList const *PlayerList; - - uint32 TidalWave_Timer; - uint32 WateryGrave_Timer; - uint32 Earthquake_Timer; - uint32 WateryGlobules_Timer; - uint32 globulespell[4]; - int8 Playercount; - int8 counter; - - bool Earthquake; - bool Phase2; - - void Reset() + struct boss_morogrim_tidewalkerAI : public ScriptedAI { - TidalWave_Timer = 10000; - WateryGrave_Timer = 30000; - Earthquake_Timer = 40000; - WateryGlobules_Timer = 0; - globulespell[0] = SPELL_SUMMON_WATER_GLOBULE_1; - globulespell[1] = SPELL_SUMMON_WATER_GLOBULE_2; - globulespell[2] = SPELL_SUMMON_WATER_GLOBULE_3; - globulespell[3] = SPELL_SUMMON_WATER_GLOBULE_4; - - Earthquake = false; - Phase2 = false; - - if (pInstance) - pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, NOT_STARTED); - } - - void StartEvent() - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, IN_PROGRESS); - } - - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, DONE); - } - - void EnterCombat(Unit * /*who*/) - { - PlayerList = &me->GetMap()->GetPlayers(); - Playercount = PlayerList->getSize(); - StartEvent(); - } - - void ApplyWateryGrave(Unit* pPlayer, uint8 i) - { - switch(i) + boss_morogrim_tidewalkerAI(Creature *c) : ScriptedAI(c) { - case 0: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_1, true); break; - case 1: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_2, true); break; - case 2: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_3, true); break; - case 3: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_4, true); break; + pInstance = c->GetInstanceScript(); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - //Earthquake_Timer - if (Earthquake_Timer <= diff) + Map::PlayerList const *PlayerList; + + uint32 TidalWave_Timer; + uint32 WateryGrave_Timer; + uint32 Earthquake_Timer; + uint32 WateryGlobules_Timer; + uint32 globulespell[4]; + int8 Playercount; + int8 counter; + + bool Earthquake; + bool Phase2; + + void Reset() { - if (!Earthquake) + TidalWave_Timer = 10000; + WateryGrave_Timer = 30000; + Earthquake_Timer = 40000; + WateryGlobules_Timer = 0; + globulespell[0] = SPELL_SUMMON_WATER_GLOBULE_1; + globulespell[1] = SPELL_SUMMON_WATER_GLOBULE_2; + globulespell[2] = SPELL_SUMMON_WATER_GLOBULE_3; + globulespell[3] = SPELL_SUMMON_WATER_GLOBULE_4; + + Earthquake = false; + Phase2 = false; + + if (pInstance) + pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, NOT_STARTED); + } + + void StartEvent() + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, IN_PROGRESS); + } + + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } + + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, DONE); + } + + void EnterCombat(Unit * /*who*/) + { + PlayerList = &me->GetMap()->GetPlayers(); + Playercount = PlayerList->getSize(); + StartEvent(); + } + + void ApplyWateryGrave(Unit* pPlayer, uint8 i) + { + switch(i) { - DoCast(me->getVictim(), SPELL_EARTHQUAKE); - Earthquake = true; - Earthquake_Timer = 10000; + case 0: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_1, true); break; + case 1: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_2, true); break; + case 2: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_3, true); break; + case 3: pPlayer->CastSpell(pPlayer, SPELL_WATERY_GRAVE_4, true); break; + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Earthquake_Timer + if (Earthquake_Timer <= diff) + { + if (!Earthquake) + { + DoCast(me->getVictim(), SPELL_EARTHQUAKE); + Earthquake = true; + Earthquake_Timer = 10000; + } + else + { + DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); + + for (uint8 i = 0; i < 10; ++i) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + Creature* Murloc = me->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + if (pTarget && Murloc) + Murloc->AI()->AttackStart(pTarget); + } + DoScriptText(EMOTE_EARTHQUAKE, me); + Earthquake = false; + Earthquake_Timer = 40000+rand()%5000; + } + } else Earthquake_Timer -= diff; + + //TidalWave_Timer + if (TidalWave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TIDAL_WAVE); + TidalWave_Timer = 20000; + } else TidalWave_Timer -= diff; + + if (!Phase2) + { + //WateryGrave_Timer + if (WateryGrave_Timer <= diff) + { + //Teleport 4 players under the waterfalls + Unit *pTarget; + std::set list; + std::set::const_iterator itr; + for (uint8 i = 0; i < 4; ++i) + { + counter = 0; + do + { + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 50, true); //target players only + if (counter < Playercount) + break; + if (pTarget) + itr = list.find(pTarget->GetGUID()); + ++counter; + } while (itr != list.end()); + + if (pTarget) + { + list.insert(pTarget->GetGUID()); + ApplyWateryGrave(pTarget, i); + } + } + + DoScriptText(RAND(SAY_SUMMON_BUBL1,SAY_SUMMON_BUBL2), me); + + DoScriptText(EMOTE_WATERY_GRAVE, me); + WateryGrave_Timer = 30000; + } else WateryGrave_Timer -= diff; + + //Start Phase2 + if (HealthBelowPct(25)) + Phase2 = true; } else { - DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me); - - for (uint8 i = 0; i < 10; ++i) + //WateryGlobules_Timer + if (WateryGlobules_Timer <= diff) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - Creature* Murloc = me->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - if (pTarget && Murloc) - Murloc->AI()->AttackStart(pTarget); - } - DoScriptText(EMOTE_EARTHQUAKE, me); - Earthquake = false; - Earthquake_Timer = 40000+rand()%5000; - } - } else Earthquake_Timer -= diff; - - //TidalWave_Timer - if (TidalWave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_TIDAL_WAVE); - TidalWave_Timer = 20000; - } else TidalWave_Timer -= diff; - - if (!Phase2) - { - //WateryGrave_Timer - if (WateryGrave_Timer <= diff) - { - //Teleport 4 players under the waterfalls - Unit *pTarget; - std::set list; - std::set::const_iterator itr; - for (uint8 i = 0; i < 4; ++i) - { - counter = 0; - do + Unit* pGlobuleTarget; + std::set globulelist; + std::set::const_iterator itr; + for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD { - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 50, true); //target players only - if (counter < Playercount) - break; - if (pTarget) - itr = list.find(pTarget->GetGUID()); - ++counter; - } while (itr != list.end()); - - if (pTarget) - { - list.insert(pTarget->GetGUID()); - ApplyWateryGrave(pTarget, i); - } - } - - DoScriptText(RAND(SAY_SUMMON_BUBL1,SAY_SUMMON_BUBL2), me); - - DoScriptText(EMOTE_WATERY_GRAVE, me); - WateryGrave_Timer = 30000; - } else WateryGrave_Timer -= diff; - - //Start Phase2 - if (HealthBelowPct(25)) - Phase2 = true; - } - else - { - //WateryGlobules_Timer - if (WateryGlobules_Timer <= diff) - { - Unit* pGlobuleTarget; - std::set globulelist; - std::set::const_iterator itr; - for (uint8 g = 0; g < 4; g++) //one unit can't cast more than one spell per update, so some players have to cast for us XD - { - counter = 0; - do - { - pGlobuleTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); + counter = 0; + do + { + pGlobuleTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true); + if (pGlobuleTarget) + itr = globulelist.find(pGlobuleTarget->GetGUID()); + if (counter > Playercount) + break; + ++counter; + } while (itr != globulelist.end()); if (pGlobuleTarget) - itr = globulelist.find(pGlobuleTarget->GetGUID()); - if (counter > Playercount) - break; - ++counter; - } while (itr != globulelist.end()); - if (pGlobuleTarget) - globulelist.insert(pGlobuleTarget->GetGUID()); - pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true); - } - DoScriptText(EMOTE_WATERY_GLOBULES, me); - WateryGlobules_Timer = 25000; - } else WateryGlobules_Timer -= diff; - } + globulelist.insert(pGlobuleTarget->GetGUID()); + pGlobuleTarget->CastSpell(pGlobuleTarget, globulespell[g], true); + } + DoScriptText(EMOTE_WATERY_GLOBULES, me); + WateryGlobules_Timer = 25000; + } else WateryGlobules_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; //Water Globule AI #define SPELL_GLOBULE_EXPLOSION 37871 - -struct mob_water_globuleAI : public ScriptedAI + class mob_water_globule : public CreatureScript { - mob_water_globuleAI(Creature *c) : ScriptedAI(c) {} +public: + mob_water_globule() : CreatureScript("mob_water_globule") { } - uint32 Check_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Check_Timer = 1000; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(14); + return new mob_water_globuleAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void MoveInLineOfSight(Unit *who) + struct mob_water_globuleAI : public ScriptedAI { - if (!who || me->getVictim()) - return; + mob_water_globuleAI(Creature *c) : ScriptedAI(c) {} - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + uint32 Check_Timer; + + void Reset() { - //no attack radius check - it attacks the first target that moves in his los - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - AttackStart(who); + Check_Timer = 1000; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(14); } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) {} - if (Check_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - if (me->IsWithinDistInMap(me->getVictim(), 5)) - { - DoCast(me->getVictim(), SPELL_GLOBULE_EXPLOSION); - - //despawn - me->ForcedDespawn(); + if (!who || me->getVictim()) return; - } - Check_Timer = 500; - } else Check_Timer -= diff; - //do NOT deal any melee damage to the target. - } + if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + { + //no attack radius check - it attacks the first target that moves in his los + //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + AttackStart(who); + } + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (Check_Timer <= diff) + { + if (me->IsWithinDistInMap(me->getVictim(), 5)) + { + DoCast(me->getVictim(), SPELL_GLOBULE_EXPLOSION); + + //despawn + me->ForcedDespawn(); + return; + } + Check_Timer = 500; + } else Check_Timer -= diff; + + //do NOT deal any melee damage to the target. + } + }; + }; -CreatureAI* GetAI_boss_morogrim_tidewalker(Creature* pCreature) -{ - return new boss_morogrim_tidewalkerAI (pCreature); -} -CreatureAI* GetAI_mob_water_globule(Creature* pCreature) -{ - return new mob_water_globuleAI (pCreature); -} void AddSC_boss_morogrim_tidewalker() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_morogrim_tidewalker"; - newscript->GetAI = &GetAI_boss_morogrim_tidewalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_water_globule"; - newscript->GetAI = &GetAI_mob_water_globule; - newscript->RegisterSelf(); + new boss_morogrim_tidewalker(); + new mob_water_globule(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 05944c1954e..ad52a76158c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -46,355 +46,358 @@ EndScriptData */ 4 - Morogrim Tidewalker Event 5 - Lady Vashj Event */ - -bool GOHello_go_bridge_console(Player* /*pPlayer*/, GameObject* pGo) + class go_bridge_console : public GameObjectScript { - ScriptedInstance* pInstance = pGo->GetInstanceData(); +public: + go_bridge_console() : GameObjectScript("go_bridge_console") { } - if (!pInstance) - return false; - - if (pInstance) - pInstance->SetData(DATA_CONTROL_CONSOLE, DONE); - - return true; -} - -struct instance_serpentshrine_cavern : public ScriptedInstance -{ - instance_serpentshrine_cavern(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 LurkerBelow; - uint64 Sharkkis; - uint64 Tidalvess; - uint64 Caribdis; - uint64 LadyVashj; - uint64 Karathress; - uint64 KarathressEvent_Starter; - uint64 LeotherasTheBlind; - uint64 LeotherasEventStarter; - - uint64 ControlConsole; - uint64 BridgePart[3]; - uint32 StrangePool; - uint32 FishingTimer; - uint32 LurkerSubEvent; - uint32 WaterCheckTimer; - uint32 FrenzySpawnTimer; - uint32 Water; - uint32 TrashCount; - - bool ShieldGeneratorDeactivated[4]; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - bool DoSpawnFrenzy; - - void Initialize() + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + InstanceScript* pInstance = pGo->GetInstanceScript(); - LurkerBelow = 0; - Sharkkis = 0; - Tidalvess = 0; - Caribdis = 0; - LadyVashj = 0; - Karathress = 0; - KarathressEvent_Starter = 0; - LeotherasTheBlind = 0; - LeotherasEventStarter = 0; + if (!pInstance) + return false; - ControlConsole = 0; - BridgePart[0] = 0; - BridgePart[1] = 0; - BridgePart[2] = 0; - StrangePool = 0; - Water = WATERSTATE_FRENZY; - - ShieldGeneratorDeactivated[0] = false; - ShieldGeneratorDeactivated[1] = false; - ShieldGeneratorDeactivated[2] = false; - ShieldGeneratorDeactivated[3] = false; - FishingTimer = 1000; - LurkerSubEvent = 0; - WaterCheckTimer = 500; - FrenzySpawnTimer = 2000; - DoSpawnFrenzy = false; - TrashCount = 0; + if (pInstance) + pInstance->SetData(DATA_CONTROL_CONSOLE, DONE); + return true; } - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; +}; + class instance_serpent_shrine : public InstanceMapScript +{ +public: + instance_serpent_shrine() : InstanceMapScript("instance_serpent_shrine") { } - return false; + InstanceScript* GetInstanceData_instance_serpentshrine_cavern_InstanceMapScript(Map* pMap) + { + return new instance_serpentshrine_cavern_InstanceMapScript(pMap); } - void Update (uint32 diff) + struct instance_serpentshrine_cavern_InstanceMapScript : public InstanceScript { - //Lurker Fishing event - if (LurkerSubEvent == LURKER_FISHING) + instance_serpentshrine_cavern_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 LurkerBelow; + uint64 Sharkkis; + uint64 Tidalvess; + uint64 Caribdis; + uint64 LadyVashj; + uint64 Karathress; + uint64 KarathressEvent_Starter; + uint64 LeotherasTheBlind; + uint64 LeotherasEventStarter; + + uint64 ControlConsole; + uint64 BridgePart[3]; + uint32 StrangePool; + uint32 FishingTimer; + uint32 LurkerSubEvent; + uint32 WaterCheckTimer; + uint32 FrenzySpawnTimer; + uint32 Water; + uint32 TrashCount; + + bool ShieldGeneratorDeactivated[4]; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + bool DoSpawnFrenzy; + + void Initialize() { - if (FishingTimer <= diff) - { - LurkerSubEvent = LURKER_HOOKED; - SetData(DATA_STRANGE_POOL, IN_PROGRESS);//just fished, signal Lurker script to emerge and start fight, we use IN_PROGRESS so it won't get saved and lurker will be alway invis at start if server restarted - } else FishingTimer -= diff; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + LurkerBelow = 0; + Sharkkis = 0; + Tidalvess = 0; + Caribdis = 0; + LadyVashj = 0; + Karathress = 0; + KarathressEvent_Starter = 0; + LeotherasTheBlind = 0; + LeotherasEventStarter = 0; + + ControlConsole = 0; + BridgePart[0] = 0; + BridgePart[1] = 0; + BridgePart[2] = 0; + StrangePool = 0; + Water = WATERSTATE_FRENZY; + + ShieldGeneratorDeactivated[0] = false; + ShieldGeneratorDeactivated[1] = false; + ShieldGeneratorDeactivated[2] = false; + ShieldGeneratorDeactivated[3] = false; + FishingTimer = 1000; + LurkerSubEvent = 0; + WaterCheckTimer = 500; + FrenzySpawnTimer = 2000; + DoSpawnFrenzy = false; + TrashCount = 0; + } - //Water checks - if (WaterCheckTimer <= diff) + + bool IsEncounterInProgress() const { - if (TrashCount >= MIN_KILLS) - Water = WATERSTATE_SCALDING; - else - Water = WATERSTATE_FRENZY; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - Map::PlayerList const &PlayerList = instance->GetPlayers(); - if (PlayerList.isEmpty()) - return; - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + return false; + } + + void Update (uint32 diff) + { + //Lurker Fishing event + if (LurkerSubEvent == LURKER_FISHING) { - if (Player* pPlayer = i->getSource()) + if (FishingTimer <= diff) { - if (pPlayer->isAlive() && /*i->getSource()->GetPositionZ() <= -21.434931f*/pPlayer->IsInWater()) - { - if (Water == WATERSTATE_SCALDING) - { + LurkerSubEvent = LURKER_HOOKED; + SetData(DATA_STRANGE_POOL, IN_PROGRESS);//just fished, signal Lurker script to emerge and start fight, we use IN_PROGRESS so it won't get saved and lurker will be alway invis at start if server restarted + } else FishingTimer -= diff; + } + //Water checks + if (WaterCheckTimer <= diff) + { + if (TrashCount >= MIN_KILLS) + Water = WATERSTATE_SCALDING; + else + Water = WATERSTATE_FRENZY; - if (!pPlayer->HasAura(SPELL_SCALDINGWATER)) - { - pPlayer->CastSpell(pPlayer, SPELL_SCALDINGWATER,true); - } - } else if (Water == WATERSTATE_FRENZY) + Map::PlayerList const &PlayerList = instance->GetPlayers(); + if (PlayerList.isEmpty()) + return; + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (Player* pPlayer = i->getSource()) + { + if (pPlayer->isAlive() && /*i->getSource()->GetPositionZ() <= -21.434931f*/pPlayer->IsInWater()) { - //spawn frenzy - if (DoSpawnFrenzy) + if (Water == WATERSTATE_SCALDING) { - if (Creature* frenzy = pPlayer->SummonCreature(MOB_COILFANG_FRENZY,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ(),pPlayer->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,2000)) + + if (!pPlayer->HasAura(SPELL_SCALDINGWATER)) { - frenzy->Attack(pPlayer,false); - frenzy->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + pPlayer->CastSpell(pPlayer, SPELL_SCALDINGWATER,true); + } + } else if (Water == WATERSTATE_FRENZY) + { + //spawn frenzy + if (DoSpawnFrenzy) + { + if (Creature* frenzy = pPlayer->SummonCreature(MOB_COILFANG_FRENZY,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ(),pPlayer->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,2000)) + { + frenzy->Attack(pPlayer,false); + frenzy->AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_LEVITATING); + } + DoSpawnFrenzy = false; } - DoSpawnFrenzy = false; } } + if (!pPlayer->IsInWater()) + pPlayer->RemoveAurasDueToSpell(SPELL_SCALDINGWATER); } - if (!pPlayer->IsInWater()) - pPlayer->RemoveAurasDueToSpell(SPELL_SCALDINGWATER); + } + WaterCheckTimer = 500;//remove stress from core + } else WaterCheckTimer -= diff; + if (FrenzySpawnTimer <= diff) + { + DoSpawnFrenzy = true; + FrenzySpawnTimer = 2000; + } else FrenzySpawnTimer -= diff; + } + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 184568: + ControlConsole = pGo->GetGUID(); + pGo->setActive(true); + break; + + case 184203: + BridgePart[0] = pGo->GetGUID(); + pGo->setActive(true); + break; + + case 184204: + BridgePart[1] = pGo->GetGUID(); + pGo->setActive(true); + break; + + case 184205: + BridgePart[2] = pGo->GetGUID(); + pGo->setActive(true); + break; + case GAMEOBJECT_FISHINGNODE_ENTRY://no way checking if fish is hooked, so we create a timed event + if (LurkerSubEvent == LURKER_NOT_STARTED) + { + FishingTimer = 10000+rand()%30000;//random time before lurker emerges + LurkerSubEvent = LURKER_FISHING; + } + break; } - WaterCheckTimer = 500;//remove stress from core - } else WaterCheckTimer -= diff; - if (FrenzySpawnTimer <= diff) + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - DoSpawnFrenzy = true; - FrenzySpawnTimer = 2000; - } else FrenzySpawnTimer -= diff; - } + switch(pCreature->GetEntry()) + { + case 21212: LadyVashj = pCreature->GetGUID(); break; + case 21214: Karathress = pCreature->GetGUID(); break; + case 21966: Sharkkis = pCreature->GetGUID(); break; + case 21217: LurkerBelow = pCreature->GetGUID(); break; + case 21965: Tidalvess = pCreature->GetGUID(); break; + case 21964: Caribdis = pCreature->GetGUID(); break; + case 21215: LeotherasTheBlind = pCreature->GetGUID(); break; + /*case TRASHMOB_COILFANG_PRIESTESS: + case TRASHMOB_COILFANG_SHATTERER: + if (pCreature->isAlive()) + ++TrashCount; + break;*/ + } + } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void SetData64(uint32 type, uint64 data) { - case 184568: - ControlConsole = pGo->GetGUID(); - pGo->setActive(true); - break; + if (type == DATA_KARATHRESSEVENT_STARTER) + KarathressEvent_Starter = data; + if (type == DATA_LEOTHERAS_EVENT_STARTER) + LeotherasEventStarter = data; + } - case 184203: - BridgePart[0] = pGo->GetGUID(); - pGo->setActive(true); - break; + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_THELURKERBELOW: return LurkerBelow; + case DATA_SHARKKIS: return Sharkkis; + case DATA_TIDALVESS: return Tidalvess; + case DATA_CARIBDIS: return Caribdis; + case DATA_LADYVASHJ: return LadyVashj; + case DATA_KARATHRESS: return Karathress; + case DATA_KARATHRESSEVENT_STARTER: return KarathressEvent_Starter; + case DATA_LEOTHERAS: return LeotherasTheBlind; + case DATA_LEOTHERAS_EVENT_STARTER: return LeotherasEventStarter; + } + return 0; + } - case 184204: - BridgePart[1] = pGo->GetGUID(); - pGo->setActive(true); - break; - - case 184205: - BridgePart[2] = pGo->GetGUID(); - pGo->setActive(true); - break; - case GAMEOBJECT_FISHINGNODE_ENTRY://no way checking if fish is hooked, so we create a timed event - if (LurkerSubEvent == LURKER_NOT_STARTED) + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_STRANGE_POOL: { - FishingTimer = 10000+rand()%30000;//random time before lurker emerges - LurkerSubEvent = LURKER_FISHING; + StrangePool = data; + if (data == NOT_STARTED) + LurkerSubEvent = LURKER_NOT_STARTED; } break; - } - } - - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) - { - case 21212: LadyVashj = pCreature->GetGUID(); break; - case 21214: Karathress = pCreature->GetGUID(); break; - case 21966: Sharkkis = pCreature->GetGUID(); break; - case 21217: LurkerBelow = pCreature->GetGUID(); break; - case 21965: Tidalvess = pCreature->GetGUID(); break; - case 21964: Caribdis = pCreature->GetGUID(); break; - case 21215: LeotherasTheBlind = pCreature->GetGUID(); break; - /*case TRASHMOB_COILFANG_PRIESTESS: - case TRASHMOB_COILFANG_SHATTERER: - if (pCreature->isAlive()) - ++TrashCount; - break;*/ - } - } - - void SetData64(uint32 type, uint64 data) - { - if (type == DATA_KARATHRESSEVENT_STARTER) - KarathressEvent_Starter = data; - if (type == DATA_LEOTHERAS_EVENT_STARTER) - LeotherasEventStarter = data; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_THELURKERBELOW: return LurkerBelow; - case DATA_SHARKKIS: return Sharkkis; - case DATA_TIDALVESS: return Tidalvess; - case DATA_CARIBDIS: return Caribdis; - case DATA_LADYVASHJ: return LadyVashj; - case DATA_KARATHRESS: return Karathress; - case DATA_KARATHRESSEVENT_STARTER: return KarathressEvent_Starter; - case DATA_LEOTHERAS: return LeotherasTheBlind; - case DATA_LEOTHERAS_EVENT_STARTER: return LeotherasEventStarter; - } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_STRANGE_POOL: - { - StrangePool = data; - if (data == NOT_STARTED) - LurkerSubEvent = LURKER_NOT_STARTED; - } - break; - case DATA_CONTROL_CONSOLE: - if (data == DONE) - { - HandleGameObject(BridgePart[0], true); - HandleGameObject(BridgePart[0], true); - HandleGameObject(BridgePart[0], true); - } - ControlConsole = data;break; - case DATA_TRASH : - { - if (data == 1 && TrashCount < MIN_KILLS) - ++TrashCount;//+1 died - SaveToDB(); - break; - } - case DATA_WATER : Water = data;break; - case DATA_HYDROSSTHEUNSTABLEEVENT: m_auiEncounter[0] = data; break; - case DATA_LEOTHERASTHEBLINDEVENT: m_auiEncounter[1] = data; break; - case DATA_THELURKERBELOWEVENT: m_auiEncounter[2] = data; break; - case DATA_KARATHRESSEVENT: m_auiEncounter[3] = data; break; - case DATA_MOROGRIMTIDEWALKEREVENT: m_auiEncounter[4] = data; break; - //Lady Vashj - case DATA_LADYVASHJEVENT: - if (data == NOT_STARTED) - { - ShieldGeneratorDeactivated[0] = false; - ShieldGeneratorDeactivated[1] = false; - ShieldGeneratorDeactivated[2] = false; - ShieldGeneratorDeactivated[3] = false; - } - m_auiEncounter[5] = data; break; - case DATA_SHIELDGENERATOR1:ShieldGeneratorDeactivated[0] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR2:ShieldGeneratorDeactivated[1] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false; break; - case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false; break; - } - - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case DATA_HYDROSSTHEUNSTABLEEVENT: return m_auiEncounter[0]; - case DATA_LEOTHERASTHEBLINDEVENT: return m_auiEncounter[1]; - case DATA_THELURKERBELOWEVENT: return m_auiEncounter[2]; - case DATA_KARATHRESSEVENT: return m_auiEncounter[3]; - case DATA_MOROGRIMTIDEWALKEREVENT: return m_auiEncounter[4]; + case DATA_CONTROL_CONSOLE: + if (data == DONE) + { + HandleGameObject(BridgePart[0], true); + HandleGameObject(BridgePart[0], true); + HandleGameObject(BridgePart[0], true); + } + ControlConsole = data;break; + case DATA_TRASH : + { + if (data == 1 && TrashCount < MIN_KILLS) + ++TrashCount;//+1 died + SaveToDB(); + break; + } + case DATA_WATER : Water = data;break; + case DATA_HYDROSSTHEUNSTABLEEVENT: m_auiEncounter[0] = data; break; + case DATA_LEOTHERASTHEBLINDEVENT: m_auiEncounter[1] = data; break; + case DATA_THELURKERBELOWEVENT: m_auiEncounter[2] = data; break; + case DATA_KARATHRESSEVENT: m_auiEncounter[3] = data; break; + case DATA_MOROGRIMTIDEWALKEREVENT: m_auiEncounter[4] = data; break; //Lady Vashj - case DATA_LADYVASHJEVENT: return m_auiEncounter[5]; - case DATA_SHIELDGENERATOR1: return ShieldGeneratorDeactivated[0]; - case DATA_SHIELDGENERATOR2: return ShieldGeneratorDeactivated[1]; - case DATA_SHIELDGENERATOR3: return ShieldGeneratorDeactivated[2]; - case DATA_SHIELDGENERATOR4: return ShieldGeneratorDeactivated[3]; - case DATA_CANSTARTPHASE3: - if (ShieldGeneratorDeactivated[0] && ShieldGeneratorDeactivated[1] && ShieldGeneratorDeactivated[2] && ShieldGeneratorDeactivated[3])return 1;break; - case DATA_STRANGE_POOL: return StrangePool; - case DATA_WATER: return Water; - } - return 0; - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << TrashCount; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; - } - return NULL; - } + case DATA_LADYVASHJEVENT: + if (data == NOT_STARTED) + { + ShieldGeneratorDeactivated[0] = false; + ShieldGeneratorDeactivated[1] = false; + ShieldGeneratorDeactivated[2] = false; + ShieldGeneratorDeactivated[3] = false; + } + m_auiEncounter[5] = data; break; + case DATA_SHIELDGENERATOR1:ShieldGeneratorDeactivated[0] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR2:ShieldGeneratorDeactivated[1] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR3:ShieldGeneratorDeactivated[2] = (data) ? true : false; break; + case DATA_SHIELDGENERATOR4:ShieldGeneratorDeactivated[3] = (data) ? true : false; break; + } - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + if (data == DONE) + SaveToDB(); } - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> TrashCount; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_HYDROSSTHEUNSTABLEEVENT: return m_auiEncounter[0]; + case DATA_LEOTHERASTHEBLINDEVENT: return m_auiEncounter[1]; + case DATA_THELURKERBELOWEVENT: return m_auiEncounter[2]; + case DATA_KARATHRESSEVENT: return m_auiEncounter[3]; + case DATA_MOROGRIMTIDEWALKEREVENT: return m_auiEncounter[4]; + //Lady Vashj + case DATA_LADYVASHJEVENT: return m_auiEncounter[5]; + case DATA_SHIELDGENERATOR1: return ShieldGeneratorDeactivated[0]; + case DATA_SHIELDGENERATOR2: return ShieldGeneratorDeactivated[1]; + case DATA_SHIELDGENERATOR3: return ShieldGeneratorDeactivated[2]; + case DATA_SHIELDGENERATOR4: return ShieldGeneratorDeactivated[3]; + case DATA_CANSTARTPHASE3: + if (ShieldGeneratorDeactivated[0] && ShieldGeneratorDeactivated[1] && ShieldGeneratorDeactivated[2] && ShieldGeneratorDeactivated[3])return 1;break; + case DATA_STRANGE_POOL: return StrangePool; + case DATA_WATER: return Water; + } + return 0; + } + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << TrashCount; + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + return NULL; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + OUT_LOAD_INST_DATA(in); + std::istringstream stream(in); + stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> TrashCount; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; + }; -InstanceData* GetInstanceData_instance_serpentshrine_cavern(Map* pMap) -{ - return new instance_serpentshrine_cavern(pMap); -} void AddSC_instance_serpentshrine_cavern() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_serpent_shrine"; - newscript->GetInstanceData = &GetInstanceData_instance_serpentshrine_cavern; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_bridge_console"; - newscript->pGOHello = &GOHello_go_bridge_console; - newscript->RegisterSelf(); + new instance_serpent_shrine(); + new go_bridge_console(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index a8969d18b8b..17a77ec822e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -43,147 +43,149 @@ EndContentData */ #define SPELL_LUNG_BURST 31481 #define SPELL_ENVELOPING_WINDS 31718 -struct boss_thespiaAI : public ScriptedAI +#define SPELL_WATER_BOLT_VOLLEY 34449 +#define H_SPELL_WATER_BOLT_VOLLEY 37924 + class boss_hydromancer_thespia : public CreatureScript { - boss_thespiaAI(Creature *c) : ScriptedAI(c) +public: + boss_hydromancer_thespia() : CreatureScript("boss_hydromancer_thespia") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_thespiaAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 LightningCloud_Timer; - uint32 LungBurst_Timer; - uint32 EnvelopingWinds_Timer; - - void Reset() + struct boss_thespiaAI : public ScriptedAI { - LightningCloud_Timer = 15000; - LungBurst_Timer = 7000; - EnvelopingWinds_Timer = 9000; - - if (pInstance) - pInstance->SetData(TYPE_HYDROMANCER_THESPIA, NOT_STARTED); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEAD, me); - - if (pInstance) - pInstance->SetData(TYPE_HYDROMANCER_THESPIA, DONE); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - - if (pInstance) - pInstance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //LightningCloud_Timer - if (LightningCloud_Timer <= diff) + boss_thespiaAI(Creature *c) : ScriptedAI(c) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LIGHTNING_CLOUD); + pInstance = c->GetInstanceScript(); + } - //cast twice in Heroic mode - if (IsHeroic()) + InstanceScript *pInstance; + + uint32 LightningCloud_Timer; + uint32 LungBurst_Timer; + uint32 EnvelopingWinds_Timer; + + void Reset() + { + LightningCloud_Timer = 15000; + LungBurst_Timer = 7000; + EnvelopingWinds_Timer = 9000; + + if (pInstance) + pInstance->SetData(TYPE_HYDROMANCER_THESPIA, NOT_STARTED); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEAD, me); + + if (pInstance) + pInstance->SetData(TYPE_HYDROMANCER_THESPIA, DONE); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2), me); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + + if (pInstance) + pInstance->SetData(TYPE_HYDROMANCER_THESPIA, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //LightningCloud_Timer + if (LightningCloud_Timer <= diff) + { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget, SPELL_LIGHTNING_CLOUD); - LightningCloud_Timer = 15000+rand()%10000; - } else LightningCloud_Timer -=diff; + //cast twice in Heroic mode + if (IsHeroic()) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LIGHTNING_CLOUD); - //LungBurst_Timer - if (LungBurst_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_LUNG_BURST); - LungBurst_Timer = 7000+rand()%5000; - } else LungBurst_Timer -=diff; + LightningCloud_Timer = 15000+rand()%10000; + } else LightningCloud_Timer -=diff; - //EnvelopingWinds_Timer - if (EnvelopingWinds_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_ENVELOPING_WINDS); + //LungBurst_Timer + if (LungBurst_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_LUNG_BURST); + LungBurst_Timer = 7000+rand()%5000; + } else LungBurst_Timer -=diff; - //cast twice in Heroic mode - if (IsHeroic()) + //EnvelopingWinds_Timer + if (EnvelopingWinds_Timer <= diff) + { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) DoCast(pTarget, SPELL_ENVELOPING_WINDS); - EnvelopingWinds_Timer = 10000+rand()%5000; - } else EnvelopingWinds_Timer -=diff; - DoMeleeAttackIfReady(); - } + //cast twice in Heroic mode + if (IsHeroic()) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_ENVELOPING_WINDS); + EnvelopingWinds_Timer = 10000+rand()%5000; + } else EnvelopingWinds_Timer -=diff; + + DoMeleeAttackIfReady(); + } + }; + }; - -#define SPELL_WATER_BOLT_VOLLEY 34449 -#define H_SPELL_WATER_BOLT_VOLLEY 37924 - -struct mob_coilfang_waterelementalAI : public ScriptedAI + class mob_coilfang_waterelemental : public CreatureScript { - mob_coilfang_waterelementalAI(Creature *c) : ScriptedAI(c) {} +public: + mob_coilfang_waterelemental() : CreatureScript("mob_coilfang_waterelemental") { } - uint32 WaterBoltVolley_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WaterBoltVolley_Timer = 3000+rand()%3000; + return new mob_coilfang_waterelementalAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) + struct mob_coilfang_waterelementalAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mob_coilfang_waterelementalAI(Creature *c) : ScriptedAI(c) {} - if (WaterBoltVolley_Timer <= diff) + uint32 WaterBoltVolley_Timer; + + void Reset() { - DoCast(me, SPELL_WATER_BOLT_VOLLEY); - WaterBoltVolley_Timer = 7000+rand()%5000; - } else WaterBoltVolley_Timer -= diff; + WaterBoltVolley_Timer = 3000+rand()%3000; + } + + void EnterCombat(Unit * /*who*/) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (WaterBoltVolley_Timer <= diff) + { + DoCast(me, SPELL_WATER_BOLT_VOLLEY); + WaterBoltVolley_Timer = 7000+rand()%5000; + } else WaterBoltVolley_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_thespiaAI(Creature* pCreature) -{ - return new boss_thespiaAI (pCreature); -} - -CreatureAI* GetAI_mob_coilfang_waterelementalAI(Creature* pCreature) -{ - return new mob_coilfang_waterelementalAI (pCreature); -} - void AddSC_boss_hydromancer_thespia() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_hydromancer_thespia"; - newscript->GetAI = &GetAI_boss_thespiaAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_coilfang_waterelemental"; - newscript->GetAI = &GetAI_mob_coilfang_waterelementalAI; - newscript->RegisterSelf(); + new boss_hydromancer_thespia(); + new mob_coilfang_waterelemental(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index 1c25800e2e6..d18174e35f0 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -47,136 +47,143 @@ EndContentData */ #define H_SPELL_ENRAGE 1 //corrent enrage spell not known #define ENTRY_STREAMRIGGER_MECHANIC 17951 - -struct boss_mekgineer_steamriggerAI : public ScriptedAI + class boss_mekgineer_steamrigger : public CreatureScript { - boss_mekgineer_steamriggerAI(Creature *c) : ScriptedAI(c) +public: + boss_mekgineer_steamrigger() : CreatureScript("boss_mekgineer_steamrigger") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_mekgineer_steamriggerAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 Shrink_Timer; - uint32 Saw_Blade_Timer; - uint32 Electrified_Net_Timer; - bool Summon75; - bool Summon50; - bool Summon25; - - void Reset() + struct boss_mekgineer_steamriggerAI : public ScriptedAI { - Shrink_Timer = 20000; - Saw_Blade_Timer = 15000; - Electrified_Net_Timer = 10000; - - Summon75 = false; - Summon50 = false; - Summon25 = false; - - if (pInstance) - pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, NOT_STARTED); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, DONE); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); - - if (pInstance) - pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, IN_PROGRESS); - } - - //no known summon spells exist - void SummonMechanichs() - { - DoScriptText(SAY_MECHANICS, me); - - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - - if (rand()%2) - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,-7,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - if (rand()%2) - DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,7,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Shrink_Timer <= diff) + boss_mekgineer_steamriggerAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 Shrink_Timer; + uint32 Saw_Blade_Timer; + uint32 Electrified_Net_Timer; + bool Summon75; + bool Summon50; + bool Summon25; + + void Reset() { - DoCast(me->getVictim(), SPELL_SUPER_SHRINK_RAY); Shrink_Timer = 20000; - } else Shrink_Timer -= diff; - - if (Saw_Blade_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - DoCast(pTarget, SPELL_SAW_BLADE); - else - DoCast(me->getVictim(), SPELL_SAW_BLADE); - Saw_Blade_Timer = 15000; - } else Saw_Blade_Timer -= diff; - - if (Electrified_Net_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ELECTRIFIED_NET); Electrified_Net_Timer = 10000; - } - else Electrified_Net_Timer -= diff; - if (!Summon75) + Summon75 = false; + Summon50 = false; + Summon25 = false; + + if (pInstance) + pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, NOT_STARTED); + } + + void JustDied(Unit* /*Killer*/) { - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 75) - { - SummonMechanichs(); - Summon75 = true; - } + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, DONE); } - if (!Summon50) + void KilledUnit(Unit* /*victim*/) { - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 50) - { - SummonMechanichs(); - Summon50 = true; - } + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); } - if (!Summon25) + void EnterCombat(Unit * /*who*/) { - if ((me->GetHealth()*100 / me->GetMaxHealth()) < 25) - { - SummonMechanichs(); - Summon25 = true; - } + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2,SAY_AGGRO_3), me); + + if (pInstance) + pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER, IN_PROGRESS); } - DoMeleeAttackIfReady(); - } + //no known summon spells exist + void SummonMechanichs() + { + DoScriptText(SAY_MECHANICS, me); + + DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); + DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); + DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,-5,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); + + if (rand()%2) + DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,5,-7,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); + if (rand()%2) + DoSpawnCreature(ENTRY_STREAMRIGGER_MECHANIC,7,-5,0,0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 240000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Shrink_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUPER_SHRINK_RAY); + Shrink_Timer = 20000; + } else Shrink_Timer -= diff; + + if (Saw_Blade_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + DoCast(pTarget, SPELL_SAW_BLADE); + else + DoCast(me->getVictim(), SPELL_SAW_BLADE); + + Saw_Blade_Timer = 15000; + } else Saw_Blade_Timer -= diff; + + if (Electrified_Net_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ELECTRIFIED_NET); + Electrified_Net_Timer = 10000; + } + else Electrified_Net_Timer -= diff; + + if (!Summon75) + { + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 75) + { + SummonMechanichs(); + Summon75 = true; + } + } + + if (!Summon50) + { + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 50) + { + SummonMechanichs(); + Summon50 = true; + } + } + + if (!Summon25) + { + if ((me->GetHealth()*100 / me->GetMaxHealth()) < 25) + { + SummonMechanichs(); + Summon25 = true; + } + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_mekgineer_steamrigger(Creature* pCreature) -{ - return new boss_mekgineer_steamriggerAI (pCreature); -} #define SPELL_DISPEL_MAGIC 17201 #define SPELL_REPAIR 31532 @@ -184,83 +191,80 @@ CreatureAI* GetAI_boss_mekgineer_steamrigger(Creature* pCreature) #define MAX_REPAIR_RANGE (13.0f) //we should be at least at this range for repair #define MIN_REPAIR_RANGE (7.0f) //we can stop movement at this range to repair but not required - -struct mob_steamrigger_mechanicAI : public ScriptedAI + class mob_steamrigger_mechanic : public CreatureScript { - mob_steamrigger_mechanicAI(Creature *c) : ScriptedAI(c) +public: + mob_steamrigger_mechanic() : CreatureScript("mob_steamrigger_mechanic") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_steamrigger_mechanicAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 Repair_Timer; - - void Reset() + struct mob_steamrigger_mechanicAI : public ScriptedAI { - Repair_Timer = 2000; - } - - void MoveInLineOfSight(Unit* /*who*/) - { - //react only if attacked - } - - void EnterCombat(Unit * /*who*/) { } - - void UpdateAI(const uint32 diff) - { - if (Repair_Timer <= diff) + mob_steamrigger_mechanicAI(Creature *c) : ScriptedAI(c) { - if (pInstance && pInstance->GetData64(DATA_MEKGINEERSTEAMRIGGER) && pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == IN_PROGRESS) + pInstance = c->GetInstanceScript(); + } + + InstanceScript* pInstance; + + uint32 Repair_Timer; + + void Reset() + { + Repair_Timer = 2000; + } + + void MoveInLineOfSight(Unit* /*who*/) + { + //react only if attacked + } + + void EnterCombat(Unit * /*who*/) { } + + void UpdateAI(const uint32 diff) + { + if (Repair_Timer <= diff) { - if (Unit* pMekgineer = Unit::GetUnit((*me), pInstance->GetData64(DATA_MEKGINEERSTEAMRIGGER))) + if (pInstance && pInstance->GetData64(DATA_MEKGINEERSTEAMRIGGER) && pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == IN_PROGRESS) { - if (me->IsWithinDistInMap(pMekgineer, MAX_REPAIR_RANGE)) + if (Unit* pMekgineer = Unit::GetUnit((*me), pInstance->GetData64(DATA_MEKGINEERSTEAMRIGGER))) { - //are we already channeling? Doesn't work very well, find better check? - if (!me->GetUInt32Value(UNIT_CHANNEL_SPELL)) + if (me->IsWithinDistInMap(pMekgineer, MAX_REPAIR_RANGE)) + { + //are we already channeling? Doesn't work very well, find better check? + if (!me->GetUInt32Value(UNIT_CHANNEL_SPELL)) + { + //me->GetMotionMaster()->MovementExpired(); + //me->GetMotionMaster()->MoveIdle(); + + DoCast(me, SPELL_REPAIR, true); + } + Repair_Timer = 5000; + } + else { //me->GetMotionMaster()->MovementExpired(); - //me->GetMotionMaster()->MoveIdle(); - - DoCast(me, SPELL_REPAIR, true); + //me->GetMotionMaster()->MoveFollow(pMekgineer,0,0); } - Repair_Timer = 5000; } - else - { - //me->GetMotionMaster()->MovementExpired(); - //me->GetMotionMaster()->MoveFollow(pMekgineer,0,0); - } - } - } else Repair_Timer = 5000; - } else Repair_Timer -= diff; + } else Repair_Timer = 5000; + } else Repair_Timer -= diff; - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_steamrigger_mechanic(Creature* pCreature) -{ - return new mob_steamrigger_mechanicAI (pCreature); -} void AddSC_boss_mekgineer_steamrigger() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_mekgineer_steamrigger"; - newscript->GetAI = &GetAI_boss_mekgineer_steamrigger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_steamrigger_mechanic"; - newscript->GetAI = &GetAI_mob_steamrigger_mechanic; - newscript->RegisterSelf(); + new boss_mekgineer_steamrigger(); + new mob_steamrigger_mechanic(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index b6a9d628f06..b2981432c41 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -41,166 +41,170 @@ EndScriptData */ #define SPELL_WARLORDS_RAGE_NAGA 31543 #define SPELL_WARLORDS_RAGE_PROC 36453 - -struct mob_naga_distillerAI : public ScriptedAI + class mob_naga_distiller : public CreatureScript { - mob_naga_distillerAI(Creature *c) : ScriptedAI(c) +public: + mob_naga_distiller() : CreatureScript("mob_naga_distiller") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new mob_naga_distillerAI (pCreature); } - ScriptedInstance *pInstance; - - void Reset() + struct mob_naga_distillerAI : public ScriptedAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - //hack, due to really weird spell behaviour :( - if (pInstance) + mob_naga_distillerAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(TYPE_DISTILLER) == IN_PROGRESS) + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + //hack, due to really weird spell behaviour :( + if (pInstance) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pInstance->GetData(TYPE_DISTILLER) == IN_PROGRESS) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } } } - } - void EnterCombat(Unit * /*who*/) { } + void EnterCombat(Unit * /*who*/) { } - void StartRageGen(Unit * /*caster*/) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - DoCast(me, SPELL_WARLORDS_RAGE_NAGA, true); - - if (pInstance) - pInstance->SetData(TYPE_DISTILLER,IN_PROGRESS); - } - - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - if (me->GetHealth() <= damage) - if (pInstance) - pInstance->SetData(TYPE_DISTILLER,DONE); - } -}; - -struct boss_warlord_kalithreshAI : public ScriptedAI -{ - boss_warlord_kalithreshAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 Reflection_Timer; - uint32 Impale_Timer; - uint32 Rage_Timer; - bool CanRage; - - void Reset() - { - Reflection_Timer = 10000; - Impale_Timer = 7000+rand()%7000; - Rage_Timer = 45000; - CanRage = false; - - if (pInstance) - pInstance->SetData(TYPE_WARLORD_KALITHRESH, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - - if (pInstance) - pInstance->SetData(TYPE_WARLORD_KALITHRESH, IN_PROGRESS); - } - - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - //hack :( - if (spell->Id == SPELL_WARLORDS_RAGE_PROC) - if (pInstance) - if (pInstance->GetData(TYPE_DISTILLER) == DONE) - me->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(TYPE_WARLORD_KALITHRESH, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Rage_Timer <= diff) + void StartRageGen(Unit * /*caster*/) { - if (Creature* distiller = me->FindNearestCreature(17954, 100.0f)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + DoCast(me, SPELL_WARLORDS_RAGE_NAGA, true); + + if (pInstance) + pInstance->SetData(TYPE_DISTILLER,IN_PROGRESS); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + if (me->GetHealth() <= damage) + if (pInstance) + pInstance->SetData(TYPE_DISTILLER,DONE); + } + }; + +}; + class boss_warlord_kalithresh : public CreatureScript +{ +public: + boss_warlord_kalithresh() : CreatureScript("boss_warlord_kalithresh") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_warlord_kalithreshAI (pCreature); + } + + struct boss_warlord_kalithreshAI : public ScriptedAI + { + boss_warlord_kalithreshAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + uint32 Reflection_Timer; + uint32 Impale_Timer; + uint32 Rage_Timer; + bool CanRage; + + void Reset() + { + Reflection_Timer = 10000; + Impale_Timer = 7000+rand()%7000; + Rage_Timer = 45000; + CanRage = false; + + if (pInstance) + pInstance->SetData(TYPE_WARLORD_KALITHRESH, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + + if (pInstance) + pInstance->SetData(TYPE_WARLORD_KALITHRESH, IN_PROGRESS); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + //hack :( + if (spell->Id == SPELL_WARLORDS_RAGE_PROC) + if (pInstance) + if (pInstance->GetData(TYPE_DISTILLER) == DONE) + me->RemoveAurasDueToSpell(SPELL_WARLORDS_RAGE_PROC); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(TYPE_WARLORD_KALITHRESH, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Rage_Timer <= diff) { - DoScriptText(SAY_REGEN, me); - DoCast(me, SPELL_WARLORDS_RAGE); - CAST_AI(mob_naga_distillerAI, distiller->AI())->StartRageGen(me); - } - Rage_Timer = 3000+rand()%15000; - } else Rage_Timer -= diff; + if (Creature* distiller = me->FindNearestCreature(17954, 100.0f)) + { + DoScriptText(SAY_REGEN, me); + DoCast(me, SPELL_WARLORDS_RAGE); + CAST_AI(mob_naga_distiller::mob_naga_distillerAI, distiller->AI())->StartRageGen(me); + } + Rage_Timer = 3000+rand()%15000; + } else Rage_Timer -= diff; - //Reflection_Timer - if (Reflection_Timer <= diff) - { - DoCast(me, SPELL_SPELL_REFLECTION); - Reflection_Timer = 15000+rand()%10000; - } else Reflection_Timer -= diff; + //Reflection_Timer + if (Reflection_Timer <= diff) + { + DoCast(me, SPELL_SPELL_REFLECTION); + Reflection_Timer = 15000+rand()%10000; + } else Reflection_Timer -= diff; - //Impale_Timer - if (Impale_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_IMPALE); + //Impale_Timer + if (Impale_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_IMPALE); - Impale_Timer = 7500+rand()%5000; - } else Impale_Timer -= diff; + Impale_Timer = 7500+rand()%5000; + } else Impale_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_naga_distiller(Creature* pCreature) -{ - return new mob_naga_distillerAI (pCreature); -} -CreatureAI* GetAI_boss_warlord_kalithresh(Creature* pCreature) -{ - return new boss_warlord_kalithreshAI (pCreature); -} void AddSC_boss_warlord_kalithresh() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_naga_distiller"; - newscript->GetAI = &GetAI_mob_naga_distiller; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_warlord_kalithresh"; - newscript->GetAI = &GetAI_boss_warlord_kalithresh; - newscript->RegisterSelf(); + new mob_naga_distiller(); + new boss_warlord_kalithresh(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index 3d089a3ecda..1bac450c981 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -37,197 +37,200 @@ EndScriptData */ 2 - Mekgineer Steamrigger Event 3 - Warlord Kalithresh Event */ - -bool GOHello_go_main_chambers_access_panel(Player* /*pPlayer*/, GameObject* pGo) + class go_main_chambers_access_panel : public GameObjectScript { - ScriptedInstance* pInstance = pGo->GetInstanceData(); +public: + go_main_chambers_access_panel() : GameObjectScript("go_main_chambers_access_panel") { } - if (!pInstance) - return false; + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) + { + InstanceScript* pInstance = pGo->GetInstanceScript(); - if (pGo->GetEntry() == ACCESS_PANEL_HYDRO && (pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE || pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)) - pInstance->SetData(TYPE_HYDROMANCER_THESPIA,SPECIAL); + if (!pInstance) + return false; - if (pGo->GetEntry() == ACCESS_PANEL_MEK && (pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE || pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)) - pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER,SPECIAL); + if (pGo->GetEntry() == ACCESS_PANEL_HYDRO && (pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == DONE || pInstance->GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL)) + pInstance->SetData(TYPE_HYDROMANCER_THESPIA,SPECIAL); - return true; -} + if (pGo->GetEntry() == ACCESS_PANEL_MEK && (pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == DONE || pInstance->GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL)) + pInstance->SetData(TYPE_MEKGINEER_STEAMRIGGER,SPECIAL); -struct instance_steam_vault : public ScriptedInstance + return true; + } + +}; + class instance_steam_vault : public InstanceMapScript { - instance_steam_vault(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_steam_vault() : InstanceMapScript("instance_steam_vault") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 ThespiaGUID; - uint64 MekgineerGUID; - uint64 KalithreshGUID; - - uint64 MainChambersDoor; - uint64 AccessPanelHydro; - uint64 AccessPanelMek; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - ThespiaGUID = 0; - MekgineerGUID = 0; - KalithreshGUID = 0; - MainChambersDoor = 0; - AccessPanelHydro = 0; - AccessPanelMek = 0; + return new instance_steam_vault_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_steam_vault_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + instance_steam_vault_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + uint64 ThespiaGUID; + uint64 MekgineerGUID; + uint64 KalithreshGUID; + + uint64 MainChambersDoor; + uint64 AccessPanelHydro; + uint64 AccessPanelMek; + + void Initialize() { - case 17797: ThespiaGUID = pCreature->GetGUID(); break; - case 17796: MekgineerGUID = pCreature->GetGUID(); break; - case 17798: KalithreshGUID = pCreature->GetGUID(); break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case MAIN_CHAMBERS_DOOR: MainChambersDoor = pGo->GetGUID(); break; - case ACCESS_PANEL_HYDRO: AccessPanelHydro = pGo->GetGUID(); break; - case ACCESS_PANEL_MEK: AccessPanelMek = pGo->GetGUID(); break; - } - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case TYPE_HYDROMANCER_THESPIA: - if (data == SPECIAL) - { - HandleGameObject(AccessPanelHydro, true); - - if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) - HandleGameObject(MainChambersDoor, true); - - sLog.outDebug("TSCR: Instance Steamvault: Access panel used."); - } - m_auiEncounter[0] = data; - break; - case TYPE_MEKGINEER_STEAMRIGGER: - if (data == SPECIAL) - { - HandleGameObject(AccessPanelMek, true); - - if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) - HandleGameObject(MainChambersDoor, true); - - sLog.outDebug("TSCR: Instance Steamvault: Access panel used."); - } - m_auiEncounter[1] = data; - break; - case TYPE_WARLORD_KALITHRESH: - m_auiEncounter[2] = data; - break; - case TYPE_DISTILLER: - m_auiEncounter[3] = data; - break; + ThespiaGUID = 0; + MekgineerGUID = 0; + KalithreshGUID = 0; + MainChambersDoor = 0; + AccessPanelHydro = 0; + AccessPanelMek = 0; } - if (data == DONE || data == SPECIAL) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + bool IsEncounterInProgress() const { - case TYPE_HYDROMANCER_THESPIA: - return m_auiEncounter[0]; - case TYPE_MEKGINEER_STEAMRIGGER: - return m_auiEncounter[1]; - case TYPE_WARLORD_KALITHRESH: - return m_auiEncounter[2]; - case TYPE_DISTILLER: - return m_auiEncounter[3]; - } - return 0; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + return true; - uint64 GetData64(uint32 data) - { - switch(data) - { - case DATA_THESPIA: - return ThespiaGUID; - case DATA_MEKGINEERSTEAMRIGGER: - return MekgineerGUID; - case DATA_KALITRESH: - return KalithreshGUID; + return false; } - return 0; - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - OUT_SAVE_INST_DATA_COMPLETE; - return out; + switch(pCreature->GetEntry()) + { + case 17797: ThespiaGUID = pCreature->GetGUID(); break; + case 17796: MekgineerGUID = pCreature->GetGUID(); break; + case 17798: KalithreshGUID = pCreature->GetGUID(); break; + } } - return NULL; - } - void Load(const char* in) - { - if (!in) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch(pGo->GetEntry()) + { + case MAIN_CHAMBERS_DOOR: MainChambersDoor = pGo->GetGUID(); break; + case ACCESS_PANEL_HYDRO: AccessPanelHydro = pGo->GetGUID(); break; + case ACCESS_PANEL_MEK: AccessPanelMek = pGo->GetGUID(); break; + } } - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_HYDROMANCER_THESPIA: + if (data == SPECIAL) + { + HandleGameObject(AccessPanelHydro, true); + + if (GetData(TYPE_MEKGINEER_STEAMRIGGER) == SPECIAL) + HandleGameObject(MainChambersDoor, true); + + sLog.outDebug("TSCR: Instance Steamvault: Access panel used."); + } + m_auiEncounter[0] = data; + break; + case TYPE_MEKGINEER_STEAMRIGGER: + if (data == SPECIAL) + { + HandleGameObject(AccessPanelMek, true); + + if (GetData(TYPE_HYDROMANCER_THESPIA) == SPECIAL) + HandleGameObject(MainChambersDoor, true); + + sLog.outDebug("TSCR: Instance Steamvault: Access panel used."); + } + m_auiEncounter[1] = data; + break; + case TYPE_WARLORD_KALITHRESH: + m_auiEncounter[2] = data; + break; + case TYPE_DISTILLER: + m_auiEncounter[3] = data; + break; + } + + if (data == DONE || data == SPECIAL) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_HYDROMANCER_THESPIA: + return m_auiEncounter[0]; + case TYPE_MEKGINEER_STEAMRIGGER: + return m_auiEncounter[1]; + case TYPE_WARLORD_KALITHRESH: + return m_auiEncounter[2]; + case TYPE_DISTILLER: + return m_auiEncounter[3]; + } + return 0; + } + + uint64 GetData64(uint32 data) + { + switch(data) + { + case DATA_THESPIA: + return ThespiaGUID; + case DATA_MEKGINEERSTEAMRIGGER: + return MekgineerGUID; + case DATA_KALITRESH: + return KalithreshGUID; + } + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3]; + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + return NULL; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + OUT_LOAD_INST_DATA(in); + std::istringstream stream(in); + stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3]; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; + }; -InstanceData* GetInstanceData_instance_steam_vault(Map* pMap) -{ - return new instance_steam_vault(pMap); -} void AddSC_instance_steam_vault() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_main_chambers_access_panel"; - newscript->pGOHello = &GOHello_go_main_chambers_access_panel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "instance_steam_vault"; - newscript->GetInstanceData = &GetInstanceData_instance_steam_vault; - newscript->RegisterSelf(); + new go_main_chambers_access_panel(); + new instance_steam_vault(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp index 2fd078bc5ba..f5227158b92 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_hungarfen.cpp @@ -27,130 +27,134 @@ EndScriptData */ #define SPELL_FOUL_SPORES 31673 #define SPELL_ACID_GEYSER 38739 - -struct boss_hungarfenAI : public ScriptedAI + class boss_hungarfen : public CreatureScript { - boss_hungarfenAI(Creature *c) : ScriptedAI(c) +public: + boss_hungarfen() : CreatureScript("boss_hungarfen") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_hungarfenAI (pCreature); } - bool Root; - uint32 Mushroom_Timer; - uint32 AcidGeyser_Timer; - - void Reset() + struct boss_hungarfenAI : public ScriptedAI { - Root = false; - Mushroom_Timer = 5000; // 1 mushroom after 5s, then one per 10s. This should be different in heroic mode - AcidGeyser_Timer = 10000; - } - - void EnterCombat(Unit * /*who*/) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if ((me->GetHealth()*100) / me->GetMaxHealth() <= 20) + boss_hungarfenAI(Creature *c) : ScriptedAI(c) { - if (!Root) - { - DoCast(me, SPELL_FOUL_SPORES); - Root = true; - } } - if (Mushroom_Timer <= diff) + bool Root; + uint32 Mushroom_Timer; + uint32 AcidGeyser_Timer; + + void Reset() { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - me->SummonCreature(17990, pTarget->GetPositionX()+(rand()%8), pTarget->GetPositionY()+(rand()%8), pTarget->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); - else - me->SummonCreature(17990, me->GetPositionX()+(rand()%8), me->GetPositionY()+(rand()%8), me->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); + Root = false; + Mushroom_Timer = 5000; // 1 mushroom after 5s, then one per 10s. This should be different in heroic mode + AcidGeyser_Timer = 10000; + } - Mushroom_Timer = 10000; - } else Mushroom_Timer -= diff; - - if (AcidGeyser_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_ACID_GEYSER); - AcidGeyser_Timer = 10000+rand()%7500; - } else AcidGeyser_Timer -= diff; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if ((me->GetHealth()*100) / me->GetMaxHealth() <= 20) + { + if (!Root) + { + DoCast(me, SPELL_FOUL_SPORES); + Root = true; + } + } + + if (Mushroom_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + me->SummonCreature(17990, pTarget->GetPositionX()+(rand()%8), pTarget->GetPositionY()+(rand()%8), pTarget->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); + else + me->SummonCreature(17990, me->GetPositionX()+(rand()%8), me->GetPositionY()+(rand()%8), me->GetPositionZ(), (rand()%5), TEMPSUMMON_TIMED_DESPAWN, 22000); + + Mushroom_Timer = 10000; + } else Mushroom_Timer -= diff; + + if (AcidGeyser_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_ACID_GEYSER); + AcidGeyser_Timer = 10000+rand()%7500; + } else AcidGeyser_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_hungarfen(Creature* pCreature) -{ - return new boss_hungarfenAI (pCreature); -} #define SPELL_SPORE_CLOUD 34168 #define SPELL_PUTRID_MUSHROOM 31690 #define SPELL_GROW 31698 - -struct mob_underbog_mushroomAI : public ScriptedAI + class mob_underbog_mushroom : public CreatureScript { - mob_underbog_mushroomAI(Creature *c) : ScriptedAI(c) {} +public: + mob_underbog_mushroom() : CreatureScript("mob_underbog_mushroom") { } - bool Stop; - uint32 Grow_Timer; - uint32 Shrink_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Stop = false; - Grow_Timer = 0; - Shrink_Timer = 20000; - - DoCast(me, SPELL_PUTRID_MUSHROOM, true); - DoCast(me, SPELL_SPORE_CLOUD, true); + return new mob_underbog_mushroomAI (pCreature); } - void MoveInLineOfSight(Unit * /*who*/) {} - - void AttackStart(Unit* /*who*/) {} - - void EnterCombat(Unit* /*who*/) {} - - void UpdateAI(const uint32 diff) + struct mob_underbog_mushroomAI : public ScriptedAI { - if (Stop) - return; + mob_underbog_mushroomAI(Creature *c) : ScriptedAI(c) {} - if (Grow_Timer <= diff) - { - DoCast(me, SPELL_GROW); - Grow_Timer = 3000; - } else Grow_Timer -= diff; + bool Stop; + uint32 Grow_Timer; + uint32 Shrink_Timer; - if (Shrink_Timer <= diff) + void Reset() { - me->RemoveAurasDueToSpell(SPELL_GROW); - Stop = true; - } else Shrink_Timer -= diff; - } + Stop = false; + Grow_Timer = 0; + Shrink_Timer = 20000; + + DoCast(me, SPELL_PUTRID_MUSHROOM, true); + DoCast(me, SPELL_SPORE_CLOUD, true); + } + + void MoveInLineOfSight(Unit * /*who*/) {} + + void AttackStart(Unit* /*who*/) {} + + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (Stop) + return; + + if (Grow_Timer <= diff) + { + DoCast(me, SPELL_GROW); + Grow_Timer = 3000; + } else Grow_Timer -= diff; + + if (Shrink_Timer <= diff) + { + me->RemoveAurasDueToSpell(SPELL_GROW); + Stop = true; + } else Shrink_Timer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_underbog_mushroom(Creature* pCreature) -{ - return new mob_underbog_mushroomAI (pCreature); -} void AddSC_boss_hungarfen() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_hungarfen"; - newscript->GetAI = &GetAI_boss_hungarfen; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_underbog_mushroom"; - newscript->GetAI = &GetAI_mob_underbog_mushroom; - newscript->RegisterSelf(); + new boss_hungarfen(); + new mob_underbog_mushroom(); } - diff --git a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp index a005d52cd84..cc300c639d1 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/underbog/boss_the_black_stalker.cpp @@ -34,154 +34,155 @@ EndScriptData */ #define SPELL_SUMMON_SPORE_STRIDER 38755 #define ENTRY_SPORE_STRIDER 22299 - -struct boss_the_black_stalkerAI : public ScriptedAI + class boss_the_black_stalker : public CreatureScript { - boss_the_black_stalkerAI(Creature *c) : ScriptedAI(c) +public: + boss_the_black_stalker() : CreatureScript("boss_the_black_stalker") { } + + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_the_black_stalkerAI (pCreature); } - uint32 SporeStriders_Timer; - uint32 Levitate_Timer; - uint32 ChainLightning_Timer; - uint32 StaticCharge_Timer; - uint64 LevitatedTarget; - uint32 LevitatedTarget_Timer; - bool InAir; - uint32 check_Timer; - std::list Striders; - - void Reset() + struct boss_the_black_stalkerAI : public ScriptedAI { - Levitate_Timer = 12000; - ChainLightning_Timer = 6000; - StaticCharge_Timer = 10000; - SporeStriders_Timer = 10000+rand()%5000; - check_Timer = 5000; - LevitatedTarget = 0; - LevitatedTarget_Timer = 0; - Striders.clear(); - } - - void EnterCombat(Unit * /*who*/) {} - - void JustSummoned(Creature *summon) - { - if (summon && summon->GetEntry() == ENTRY_SPORE_STRIDER) + boss_the_black_stalkerAI(Creature *c) : ScriptedAI(c) { - Striders.push_back(summon->GetGUID()); - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - summon->AI()->AttackStart(pTarget); - else - if (me->getVictim()) - summon->AI()->AttackStart(me->getVictim()); } - } - void JustDied(Unit * /*who*/) - { - for (std::list::const_iterator i = Striders.begin(); i != Striders.end(); ++i) - if (Creature *strider = Unit::GetCreature(*me, *i)) - strider->DisappearAndDie(); - } + uint32 SporeStriders_Timer; + uint32 Levitate_Timer; + uint32 ChainLightning_Timer; + uint32 StaticCharge_Timer; + uint64 LevitatedTarget; + uint32 LevitatedTarget_Timer; + bool InAir; + uint32 check_Timer; + std::list Striders; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - // Evade if too far - if (check_Timer <= diff) + void Reset() { - float x,y,z,o; - me->GetHomePosition(x,y,z,o); - if (!me->IsWithinDist3d(x,y,z, 60)) - { - EnterEvadeMode(); - return; - } - check_Timer = 1000; - } else check_Timer -= diff; - - // Spore Striders - if (IsHeroic() && SporeStriders_Timer <= diff) - { - DoCast(me, SPELL_SUMMON_SPORE_STRIDER); + Levitate_Timer = 12000; + ChainLightning_Timer = 6000; + StaticCharge_Timer = 10000; SporeStriders_Timer = 10000+rand()%5000; - } else SporeStriders_Timer -= diff; + check_Timer = 5000; + LevitatedTarget = 0; + LevitatedTarget_Timer = 0; + Striders.clear(); + } - // Levitate - if (LevitatedTarget) + void EnterCombat(Unit * /*who*/) {} + + void JustSummoned(Creature *summon) { - if (LevitatedTarget_Timer <= diff) + if (summon && summon->GetEntry() == ENTRY_SPORE_STRIDER) { - if (Unit *pTarget = Unit::GetUnit(*me, LevitatedTarget)) + Striders.push_back(summon->GetGUID()); + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + summon->AI()->AttackStart(pTarget); + else + if (me->getVictim()) + summon->AI()->AttackStart(me->getVictim()); + } + } + + void JustDied(Unit * /*who*/) + { + for (std::list::const_iterator i = Striders.begin(); i != Striders.end(); ++i) + if (Creature *strider = Unit::GetCreature(*me, *i)) + strider->DisappearAndDie(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + // Evade if too far + if (check_Timer <= diff) + { + float x,y,z,o; + me->GetHomePosition(x,y,z,o); + if (!me->IsWithinDist3d(x,y,z, 60)) { - if (!pTarget->HasAura(SPELL_LEVITATE)) + EnterEvadeMode(); + return; + } + check_Timer = 1000; + } else check_Timer -= diff; + + // Spore Striders + if (IsHeroic() && SporeStriders_Timer <= diff) + { + DoCast(me, SPELL_SUMMON_SPORE_STRIDER); + SporeStriders_Timer = 10000+rand()%5000; + } else SporeStriders_Timer -= diff; + + // Levitate + if (LevitatedTarget) + { + if (LevitatedTarget_Timer <= diff) + { + if (Unit *pTarget = Unit::GetUnit(*me, LevitatedTarget)) { - LevitatedTarget = 0; - return; - } - if (InAir) - { - pTarget->AddAura(SPELL_SUSPENSION, pTarget); - LevitatedTarget = 0; + if (!pTarget->HasAura(SPELL_LEVITATE)) + { + LevitatedTarget = 0; + return; + } + if (InAir) + { + pTarget->AddAura(SPELL_SUSPENSION, pTarget); + LevitatedTarget = 0; + } + else + { + pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true); + InAir = true; + LevitatedTarget_Timer = 1500; + } } else - { - pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true); - InAir = true; - LevitatedTarget_Timer = 1500; - } - } - else - LevitatedTarget = 0; - } else LevitatedTarget_Timer -= diff; - } - if (Levitate_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) - { - DoCast(pTarget, SPELL_LEVITATE); - LevitatedTarget = pTarget->GetGUID(); - LevitatedTarget_Timer = 2000; - InAir = false; + LevitatedTarget = 0; + } else LevitatedTarget_Timer -= diff; } - Levitate_Timer = 12000+rand()%3000; - } else Levitate_Timer -= diff; + if (Levitate_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,1)) + { + DoCast(pTarget, SPELL_LEVITATE); + LevitatedTarget = pTarget->GetGUID(); + LevitatedTarget_Timer = 2000; + InAir = false; + } + Levitate_Timer = 12000+rand()%3000; + } else Levitate_Timer -= diff; - // Chain Lightning - if (ChainLightning_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 7000; - } else ChainLightning_Timer -= diff; + // Chain Lightning + if (ChainLightning_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + ChainLightning_Timer = 7000; + } else ChainLightning_Timer -= diff; - // Static Charge - if (StaticCharge_Timer <= diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true)) - DoCast(pTarget, SPELL_STATIC_CHARGE); - StaticCharge_Timer = 10000; - } else StaticCharge_Timer -= diff; + // Static Charge + if (StaticCharge_Timer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true)) + DoCast(pTarget, SPELL_STATIC_CHARGE); + StaticCharge_Timer = 10000; + } else StaticCharge_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_the_black_stalker(Creature* pCreature) -{ - return new boss_the_black_stalkerAI (pCreature); -} void AddSC_boss_the_black_stalker() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_the_black_stalker"; - newscript->GetAI = &GetAI_boss_the_black_stalker; - newscript->RegisterSelf(); + new boss_the_black_stalker(); } - diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 8d25155f14a..aeaad60b885 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -53,205 +53,207 @@ enum eEnums SPELL_MAGNETIC_PULL = 28337, SPELL_KNOCK_BACK = 24199, //Knockback spell until correct implementation is made }; - -struct boss_gruulAI : public ScriptedAI + class boss_gruul : public CreatureScript { - boss_gruulAI(Creature *c) : ScriptedAI(c) +public: + boss_gruul() : CreatureScript("boss_gruul") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gruulAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 m_uiGrowth_Timer; - uint32 m_uiCaveIn_Timer; - uint32 m_uiCaveIn_StaticTimer; - uint32 m_uiGroundSlamTimer; - uint32 m_uiHurtfulStrike_Timer; - uint32 m_uiReverberation_Timer; - - bool m_bPerformingGroundSlam; - - void Reset() + struct boss_gruulAI : public ScriptedAI { - m_uiGrowth_Timer= 30000; - m_uiCaveIn_Timer= 27000; - m_uiCaveIn_StaticTimer = 30000; - m_uiGroundSlamTimer= 35000; - m_bPerformingGroundSlam= false; - m_uiHurtfulStrike_Timer= 8000; - m_uiReverberation_Timer= 60000+45000; - - if (pInstance) - pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - - if (pInstance) - pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS); - } - - void KilledUnit() - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (pInstance) + boss_gruulAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_GRUULEVENT, DONE); - pInstance->HandleGameObject(pInstance->GetData64(DATA_GRUULDOOR), true); // Open the encounter door + pInstance = c->GetInstanceScript(); } - } - void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) - { - //This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction - //It's initially wrong, since this will cause fall damage, which is by comments, not intended. - if (pSpell->Id == SPELL_GROUND_SLAM) + InstanceScript *pInstance; + + uint32 m_uiGrowth_Timer; + uint32 m_uiCaveIn_Timer; + uint32 m_uiCaveIn_StaticTimer; + uint32 m_uiGroundSlamTimer; + uint32 m_uiHurtfulStrike_Timer; + uint32 m_uiReverberation_Timer; + + bool m_bPerformingGroundSlam; + + void Reset() { - if (pTarget->GetTypeId() == TYPEID_PLAYER) + m_uiGrowth_Timer= 30000; + m_uiCaveIn_Timer= 27000; + m_uiCaveIn_StaticTimer = 30000; + m_uiGroundSlamTimer= 35000; + m_bPerformingGroundSlam= false; + m_uiHurtfulStrike_Timer= 8000; + m_uiReverberation_Timer= 60000+45000; + + if (pInstance) + pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS); + } + + void KilledUnit() + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } + + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + + if (pInstance) { - switch (urand(0,1)) + pInstance->SetData(DATA_GRUULEVENT, DONE); + pInstance->HandleGameObject(pInstance->GetData64(DATA_GRUULDOOR), true); // Open the encounter door + } + } + + void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell) + { + //This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction + //It's initially wrong, since this will cause fall damage, which is by comments, not intended. + if (pSpell->Id == SPELL_GROUND_SLAM) + { + if (pTarget->GetTypeId() == TYPEID_PLAYER) { - case 0: pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break; - case 1: pTarget->CastSpell(pTarget, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break; + switch (urand(0,1)) + { + case 0: pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break; + case 1: pTarget->CastSpell(pTarget, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break; + } + } + } + + //this part should be in the core + if (pSpell->Id == SPELL_SHATTER) + { + //this spell must have custom handling in the core, dealing damage based on distance + pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true); + + if (pTarget->HasAura(SPELL_STONED)) + pTarget->RemoveAurasDueToSpell(SPELL_STONED); + + //clear this, if we are still performing + if (m_bPerformingGroundSlam) + { + m_bPerformingGroundSlam = false; + + //and correct movement, if not already + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + { + if (me->getVictim()) + me->GetMotionMaster()->MoveChase(me->getVictim()); + } } } } - //this part should be in the core - if (pSpell->Id == SPELL_SHATTER) + void UpdateAI(const uint32 uiDiff) { - //this spell must have custom handling in the core, dealing damage based on distance - pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true); + //Return since we have no target + if (!UpdateVictim()) + return; - if (pTarget->HasAura(SPELL_STONED)) - pTarget->RemoveAurasDueToSpell(SPELL_STONED); + // Growth + // Gruul can cast this spell up to 30 times + if (m_uiGrowth_Timer <= uiDiff) + { + DoScriptText(EMOTE_GROW, me); + DoCast(me, SPELL_GROWTH); + m_uiGrowth_Timer = 30000; + } + else + m_uiGrowth_Timer -= uiDiff; - //clear this, if we are still performing if (m_bPerformingGroundSlam) { - m_bPerformingGroundSlam = false; - - //and correct movement, if not already - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE) + if (m_uiGroundSlamTimer <= uiDiff) { - if (me->getVictim()) - me->GetMotionMaster()->MoveChase(me->getVictim()); + m_uiGroundSlamTimer =120000; + m_uiHurtfulStrike_Timer= 8000; + + if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter + m_uiReverberation_Timer += 10000; + + DoCast(me, SPELL_SHATTER); } - } - } - } - - void UpdateAI(const uint32 uiDiff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - // Growth - // Gruul can cast this spell up to 30 times - if (m_uiGrowth_Timer <= uiDiff) - { - DoScriptText(EMOTE_GROW, me); - DoCast(me, SPELL_GROWTH); - m_uiGrowth_Timer = 30000; - } - else - m_uiGrowth_Timer -= uiDiff; - - if (m_bPerformingGroundSlam) - { - if (m_uiGroundSlamTimer <= uiDiff) - { - m_uiGroundSlamTimer =120000; - m_uiHurtfulStrike_Timer= 8000; - - if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter - m_uiReverberation_Timer += 10000; - - DoCast(me, SPELL_SHATTER); - } - else - m_uiGroundSlamTimer -= uiDiff; - } - else - { - // Hurtful Strike - if (m_uiHurtfulStrike_Timer <= uiDiff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); - - if (pTarget && me->IsWithinMeleeRange(me->getVictim())) - DoCast(pTarget, SPELL_HURTFUL_STRIKE); else - DoCast(me->getVictim(), SPELL_HURTFUL_STRIKE); - - m_uiHurtfulStrike_Timer= 8000; + m_uiGroundSlamTimer -= uiDiff; } else - m_uiHurtfulStrike_Timer -= uiDiff; - - // Reverberation - if (m_uiReverberation_Timer <= uiDiff) { - DoCast(me->getVictim(), SPELL_REVERBERATION, true); - m_uiReverberation_Timer = 15000 + rand()%10000; + // Hurtful Strike + if (m_uiHurtfulStrike_Timer <= uiDiff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1); + + if (pTarget && me->IsWithinMeleeRange(me->getVictim())) + DoCast(pTarget, SPELL_HURTFUL_STRIKE); + else + DoCast(me->getVictim(), SPELL_HURTFUL_STRIKE); + + m_uiHurtfulStrike_Timer= 8000; + } + else + m_uiHurtfulStrike_Timer -= uiDiff; + + // Reverberation + if (m_uiReverberation_Timer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_REVERBERATION, true); + m_uiReverberation_Timer = 15000 + rand()%10000; + } + else + m_uiReverberation_Timer -= uiDiff; + + // Cave In + if (m_uiCaveIn_Timer <= uiDiff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_CAVE_IN); + + if (m_uiCaveIn_StaticTimer >= 4000) + m_uiCaveIn_StaticTimer -= 2000; + + m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; + } + else + m_uiCaveIn_Timer -= uiDiff; + + // Ground Slam, Gronn Lord's Grasp, Stoned, Shatter + if (m_uiGroundSlamTimer <= uiDiff) + { + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MoveIdle(); + + m_bPerformingGroundSlam= true; + m_uiGroundSlamTimer = 10000; + + DoCast(me, SPELL_GROUND_SLAM); + } + else + m_uiGroundSlamTimer -= uiDiff; + + DoMeleeAttackIfReady(); } - else - m_uiReverberation_Timer -= uiDiff; - - // Cave In - if (m_uiCaveIn_Timer <= uiDiff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_CAVE_IN); - - if (m_uiCaveIn_StaticTimer >= 4000) - m_uiCaveIn_StaticTimer -= 2000; - - m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer; - } - else - m_uiCaveIn_Timer -= uiDiff; - - // Ground Slam, Gronn Lord's Grasp, Stoned, Shatter - if (m_uiGroundSlamTimer <= uiDiff) - { - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MoveIdle(); - - m_bPerformingGroundSlam= true; - m_uiGroundSlamTimer = 10000; - - DoCast(me, SPELL_GROUND_SLAM); - } - else - m_uiGroundSlamTimer -= uiDiff; - - DoMeleeAttackIfReady(); } - } + }; + }; -CreatureAI* GetAI_boss_gruul(Creature* pCreature) -{ - return new boss_gruulAI (pCreature); -} void AddSC_boss_gruul() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_gruul"; - newscript->GetAI = &GetAI_boss_gruul; - newscript->RegisterSelf(); + new boss_gruul(); } - diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index a2824a6fd16..a5a82e8cc86 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -67,7 +67,7 @@ EndScriptData */ #define SPELL_SPELLSHIELD 33054 #define SPELL_BLAST_WAVE 33061 -bool CheckAllBossDied(ScriptedInstance* pInstance, Creature* me) +bool CheckAllBossDied(InstanceScript* pInstance, Creature* me) { if (!pInstance || !me) return false; @@ -105,681 +105,688 @@ bool CheckAllBossDied(ScriptedInstance* pInstance, Creature* me) return false; } -//High King Maulgar AI -struct boss_high_king_maulgarAI : public ScriptedAI +//High King Maulgar AI class boss_high_king_maulgar : public CreatureScript { - boss_high_king_maulgarAI(Creature *c) : ScriptedAI(c) +public: + boss_high_king_maulgar() : CreatureScript("boss_high_king_maulgar") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - for (uint8 i = 0; i < 4; ++i) - Council[i] = 0; + return new boss_high_king_maulgarAI (pCreature); } - ScriptedInstance* pInstance; - - uint32 ArcingSmash_Timer; - uint32 MightyBlow_Timer; - uint32 Whirlwind_Timer; - uint32 Charging_Timer; - uint32 Roar_Timer; - - bool Phase2; - - uint64 Council[4]; - - void Reset() + struct boss_high_king_maulgarAI : public ScriptedAI { - ArcingSmash_Timer = 10000; - MightyBlow_Timer = 40000; - Whirlwind_Timer = 30000; - Charging_Timer = 0; - Roar_Timer = 0; - - DoCast(me, SPELL_DUAL_WIELD, false); - - Phase2 = false; - - Creature *pCreature = NULL; - for (uint8 i = 0; i < 4; ++i) + boss_high_king_maulgarAI(Creature *c) : ScriptedAI(c) { - if (Council[i]) + pInstance = c->GetInstanceScript(); + for (uint8 i = 0; i < 4; ++i) + Council[i] = 0; + } + + InstanceScript* pInstance; + + uint32 ArcingSmash_Timer; + uint32 MightyBlow_Timer; + uint32 Whirlwind_Timer; + uint32 Charging_Timer; + uint32 Roar_Timer; + + bool Phase2; + + uint64 Council[4]; + + void Reset() + { + ArcingSmash_Timer = 10000; + MightyBlow_Timer = 40000; + Whirlwind_Timer = 30000; + Charging_Timer = 0; + Roar_Timer = 0; + + DoCast(me, SPELL_DUAL_WIELD, false); + + Phase2 = false; + + Creature *pCreature = NULL; + for (uint8 i = 0; i < 4; ++i) { - pCreature = (Unit::GetCreature((*me), Council[i])); - if (pCreature && !pCreature->isAlive()) + if (Council[i]) { - pCreature->Respawn(); - pCreature->AI()->EnterEvadeMode(); + pCreature = (Unit::GetCreature((*me), Council[i])); + if (pCreature && !pCreature->isAlive()) + { + pCreature->Respawn(); + pCreature->AI()->EnterEvadeMode(); + } } } + + //reset encounter + if (pInstance) + pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - //reset encounter - if (pInstance) - pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); - } - - void KilledUnit() - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - - if (CheckAllBossDied(pInstance, me)) - pInstance->SetData(DATA_MAULGAREVENT, DONE); - } - - void AddDeath() - { - DoScriptText(RAND(SAY_OGRE_DEATH1,SAY_OGRE_DEATH2,SAY_OGRE_DEATH3,SAY_OGRE_DEATH4), me); - } - - void EnterCombat(Unit *who) - { - StartEvent(who); - } - - void GetCouncil() - { - if (pInstance) + void KilledUnit() { - //get council member's guid to respawn them if needed - Council[0] = pInstance->GetData64(DATA_KIGGLERTHECRAZED); - Council[1] = pInstance->GetData64(DATA_BLINDEYETHESEER); - Council[2] = pInstance->GetData64(DATA_OLMTHESUMMONER); - Council[3] = pInstance->GetData64(DATA_KROSHFIREHAND); + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); } - } - void StartEvent(Unit *who) - { - if (!pInstance) - return; - - GetCouncil(); - - DoScriptText(SAY_AGGRO, me); - - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); - pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); - - DoZoneInCombat(); - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + void JustDied(Unit* /*Killer*/) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); + DoScriptText(SAY_DEATH, me); - if (pTarget) + if (CheckAllBossDied(pInstance, me)) + pInstance->SetData(DATA_MAULGAREVENT, DONE); + } + + void AddDeath() + { + DoScriptText(RAND(SAY_OGRE_DEATH1,SAY_OGRE_DEATH2,SAY_OGRE_DEATH3,SAY_OGRE_DEATH4), me); + } + + void EnterCombat(Unit *who) + { + StartEvent(who); + } + + void GetCouncil() + { + if (pInstance) { - AttackStart(pTarget); - GetCouncil(); + //get council member's guid to respawn them if needed + Council[0] = pInstance->GetData64(DATA_KIGGLERTHECRAZED); + Council[1] = pInstance->GetData64(DATA_BLINDEYETHESEER); + Council[2] = pInstance->GetData64(DATA_OLMTHESUMMONER); + Council[3] = pInstance->GetData64(DATA_KROSHFIREHAND); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + void StartEvent(Unit *who) { - EnterEvadeMode(); - return; + if (!pInstance) + return; + + GetCouncil(); + + DoScriptText(SAY_AGGRO, me); + + pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); + pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); + + DoZoneInCombat(); } - //ArcingSmash_Timer - if (ArcingSmash_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_ARCING_SMASH); - ArcingSmash_Timer = 10000; - } else ArcingSmash_Timer -= diff; + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - //Whirlwind_Timer - if (Whirlwind_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_WHIRLWIND); - Whirlwind_Timer = 55000; - } else Whirlwind_Timer -= diff; + if (pTarget) + { + AttackStart(pTarget); + GetCouncil(); + } + } - //MightyBlow_Timer - if (MightyBlow_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + { + EnterEvadeMode(); + return; + } + + //ArcingSmash_Timer + if (ArcingSmash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCING_SMASH); + ArcingSmash_Timer = 10000; + } else ArcingSmash_Timer -= diff; + + //Whirlwind_Timer + if (Whirlwind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLWIND); + Whirlwind_Timer = 55000; + } else Whirlwind_Timer -= diff; + + //MightyBlow_Timer + if (MightyBlow_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MIGHTY_BLOW); + MightyBlow_Timer = 30000+rand()%10000; + } else MightyBlow_Timer -= diff; + + //Entering Phase 2 + if (!Phase2 && (me->GetHealth()*100 / me->GetMaxHealth()) < 50) + { + Phase2 = true; + DoScriptText(SAY_ENRAGE, me); + + DoCast(me, SPELL_DUAL_WIELD, true); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + } + + if (Phase2) + { + //Charging_Timer + if (Charging_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + { + AttackStart(pTarget); + DoCast(pTarget, SPELL_BERSERKER_C); + } + Charging_Timer = 20000; + } else Charging_Timer -= diff; + + //Intimidating Roar + if (Roar_Timer <= diff) + { + DoCast(me, SPELL_ROAR); + Roar_Timer = 40000+(rand()%10000); + } else Roar_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; + +//Olm The Summoner AI class boss_olm_the_summoner : public CreatureScript +{ +public: + boss_olm_the_summoner() : CreatureScript("boss_olm_the_summoner") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new boss_olm_the_summonerAI (pCreature); + } + + struct boss_olm_the_summonerAI : public ScriptedAI + { + boss_olm_the_summonerAI(Creature *c) : ScriptedAI(c) { - DoCast(me->getVictim(), SPELL_MIGHTY_BLOW); - MightyBlow_Timer = 30000+rand()%10000; - } else MightyBlow_Timer -= diff; - - //Entering Phase 2 - if (!Phase2 && (me->GetHealth()*100 / me->GetMaxHealth()) < 50) - { - Phase2 = true; - DoScriptText(SAY_ENRAGE, me); - - DoCast(me, SPELL_DUAL_WIELD, true); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + pInstance = c->GetInstanceScript(); } - if (Phase2) + uint32 DarkDecay_Timer; + uint32 Summon_Timer; + uint32 DeathCoil_Timer; + + InstanceScript* pInstance; + + void Reset() { - //Charging_Timer - if (Charging_Timer <= diff) + DarkDecay_Timer = 10000; + Summon_Timer = 15000; + DeathCoil_Timer = 20000; + + //reset encounter + if (pInstance) + pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); + } + + void AttackStart(Unit* pWho) + { + if (!pWho) + return; + + if (me->Attack(pWho, true)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); + + me->GetMotionMaster()->MoveChase(pWho, 30.0f); + } + } + + void EnterCombat(Unit *who) + { + if (pInstance) + { + pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); + pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); + } + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + { + Creature *Maulgar = NULL; + Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); + + if (Maulgar) + CAST_AI(boss_high_king_maulgar::boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); + + if (CheckAllBossDied(pInstance, me)) + pInstance->SetData(DATA_MAULGAREVENT, DONE); + } + } + + void UpdateAI(const uint32 diff) + { + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); + + if (pTarget) + { + AttackStart(pTarget); + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + { + EnterEvadeMode(); + return; + } + + //DarkDecay_Timer + if (DarkDecay_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DARK_DECAY); + DarkDecay_Timer = 20000; + } else DarkDecay_Timer -= diff; + + //Summon_Timer + if (Summon_Timer <= diff) + { + DoCast(me, SPELL_SUMMON_WFH); + Summon_Timer = 30000; + } else Summon_Timer -= diff; + + //DeathCoil Timer /need correct timer + if (DeathCoil_Timer <= diff) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_DEATH_COIL); + DeathCoil_Timer = 20000; + } else DeathCoil_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; + +//Kiggler The Crazed AI class boss_kiggler_the_crazed : public CreatureScript +{ +public: + boss_kiggler_the_crazed() : CreatureScript("boss_kiggler_the_crazed") { } + + CreatureAI *GetAI(Creature* pCreature) + { + return new boss_kiggler_the_crazedAI (pCreature); + } + + struct boss_kiggler_the_crazedAI : public ScriptedAI + { + boss_kiggler_the_crazedAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + uint32 GreaterPolymorph_Timer; + uint32 LightningBolt_Timer; + uint32 ArcaneShock_Timer; + uint32 ArcaneExplosion_Timer; + + InstanceScript* pInstance; + + void Reset() + { + GreaterPolymorph_Timer = 5000; + LightningBolt_Timer = 10000; + ArcaneShock_Timer = 20000; + ArcaneExplosion_Timer = 30000; + + //reset encounter + if (pInstance) + pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); + } + + void EnterCombat(Unit* who) + { + if (pInstance) + { + pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); + pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); + } + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) + { + Creature *Maulgar = NULL; + Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); + + if (Maulgar) + CAST_AI(boss_high_king_maulgar::boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); + + if (CheckAllBossDied(pInstance, me)) + pInstance->SetData(DATA_MAULGAREVENT, DONE); + } + } + + void UpdateAI(const uint32 diff) + { + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); + if (pTarget) { AttackStart(pTarget); - DoCast(pTarget, SPELL_BERSERKER_C); } - Charging_Timer = 20000; - } else Charging_Timer -= diff; + } - //Intimidating Roar - if (Roar_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) { - DoCast(me, SPELL_ROAR); - Roar_Timer = 40000+(rand()%10000); - } else Roar_Timer -= diff; - } + EnterEvadeMode(); + return; + } + + //GreaterPolymorph_Timer + if (GreaterPolymorph_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + DoCast(pTarget, SPELL_GREATER_POLYMORPH); + + GreaterPolymorph_Timer = 15000 + rand()%5000; + } else GreaterPolymorph_Timer -= diff; + + //LightningBolt_Timer + if (LightningBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_LIGHTNING_BOLT); + LightningBolt_Timer = 15000; + } else LightningBolt_Timer -= diff; + + //ArcaneShock_Timer + if (ArcaneShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_SHOCK); + ArcaneShock_Timer = 20000; + } else ArcaneShock_Timer -= diff; + + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); + ArcaneExplosion_Timer = 30000; + } else ArcaneExplosion_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -//Olm The Summoner AI -struct boss_olm_the_summonerAI : public ScriptedAI +//Blindeye The Seer AI class boss_blindeye_the_seer : public CreatureScript { - boss_olm_the_summonerAI(Creature *c) : ScriptedAI(c) +public: + boss_blindeye_the_seer() : CreatureScript("boss_blindeye_the_seer") { } + + CreatureAI *GetAI(Creature* pCreature) { - pInstance = c->GetInstanceData(); + return new boss_blindeye_the_seerAI (pCreature); } - uint32 DarkDecay_Timer; - uint32 Summon_Timer; - uint32 DeathCoil_Timer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_blindeye_the_seerAI : public ScriptedAI { - DarkDecay_Timer = 10000; - Summon_Timer = 15000; - DeathCoil_Timer = 20000; - - //reset encounter - if (pInstance) - pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); - } - - void AttackStart(Unit* pWho) - { - if (!pWho) - return; - - if (me->Attack(pWho, true)) + boss_blindeye_the_seerAI(Creature *c) : ScriptedAI(c) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); - - me->GetMotionMaster()->MoveChase(pWho, 30.0f); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit *who) - { - if (pInstance) + uint32 GreaterPowerWordShield_Timer; + uint32 Heal_Timer; + uint32 PrayerofHealing_Timer; + + InstanceScript* pInstance; + + void Reset() { - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); - pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); + GreaterPowerWordShield_Timer = 5000; + Heal_Timer = 25000 + rand()%15000; + PrayerofHealing_Timer = 45000 + rand()%10000; + + //reset encounter + if (pInstance) + pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) + void EnterCombat(Unit * who) { - Creature *Maulgar = NULL; - Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); - - if (Maulgar) - CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - - if (CheckAllBossDied(pInstance, me)) - pInstance->SetData(DATA_MAULGAREVENT, DONE); - } - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - - if (pTarget) + if (pInstance) { - AttackStart(pTarget); + pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); + pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + void JustDied(Unit* /*Killer*/) { - EnterEvadeMode(); - return; - } - - //DarkDecay_Timer - if (DarkDecay_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_DARK_DECAY); - DarkDecay_Timer = 20000; - } else DarkDecay_Timer -= diff; - - //Summon_Timer - if (Summon_Timer <= diff) - { - DoCast(me, SPELL_SUMMON_WFH); - Summon_Timer = 30000; - } else Summon_Timer -= diff; - - //DeathCoil Timer /need correct timer - if (DeathCoil_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_DEATH_COIL); - DeathCoil_Timer = 20000; - } else DeathCoil_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -//Kiggler The Crazed AI -struct boss_kiggler_the_crazedAI : public ScriptedAI -{ - boss_kiggler_the_crazedAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 GreaterPolymorph_Timer; - uint32 LightningBolt_Timer; - uint32 ArcaneShock_Timer; - uint32 ArcaneExplosion_Timer; - - ScriptedInstance* pInstance; - - void Reset() - { - GreaterPolymorph_Timer = 5000; - LightningBolt_Timer = 10000; - ArcaneShock_Timer = 20000; - ArcaneExplosion_Timer = 30000; - - //reset encounter - if (pInstance) - pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); - } - - void EnterCombat(Unit* who) - { - if (pInstance) - { - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); - pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); - } - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - { - Creature *Maulgar = NULL; - Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); - - if (Maulgar) - CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - - if (CheckAllBossDied(pInstance, me)) - pInstance->SetData(DATA_MAULGAREVENT, DONE); - } - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - - if (pTarget) + if (pInstance) { - AttackStart(pTarget); + Creature *Maulgar = NULL; + Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); + + if (Maulgar) + CAST_AI(boss_high_king_maulgar::boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); + + if (CheckAllBossDied(pInstance, me)) + pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + void UpdateAI(const uint32 diff) { - EnterEvadeMode(); - return; + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); + + if (pTarget) + { + AttackStart(pTarget); + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + { + EnterEvadeMode(); + return; + } + + //GreaterPowerWordShield_Timer + if (GreaterPowerWordShield_Timer <= diff) + { + DoCast(me, SPELL_GREATER_PW_SHIELD); + GreaterPowerWordShield_Timer = 40000; + } else GreaterPowerWordShield_Timer -= diff; + + //Heal_Timer + if (Heal_Timer <= diff) + { + DoCast(me, SPELL_HEAL); + Heal_Timer = 15000 + rand()%25000; + } else Heal_Timer -= diff; + + //PrayerofHealing_Timer + if (PrayerofHealing_Timer <= diff) + { + DoCast(me, SPELL_PRAYER_OH); + PrayerofHealing_Timer = 35000 + rand()%15000; + } else PrayerofHealing_Timer -= diff; + + DoMeleeAttackIfReady(); } + }; - //GreaterPolymorph_Timer - if (GreaterPolymorph_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - DoCast(pTarget, SPELL_GREATER_POLYMORPH); - - GreaterPolymorph_Timer = 15000 + rand()%5000; - } else GreaterPolymorph_Timer -= diff; - - //LightningBolt_Timer - if (LightningBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_LIGHTNING_BOLT); - LightningBolt_Timer = 15000; - } else LightningBolt_Timer -= diff; - - //ArcaneShock_Timer - if (ArcaneShock_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_SHOCK); - ArcaneShock_Timer = 20000; - } else ArcaneShock_Timer -= diff; - - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); - ArcaneExplosion_Timer = 30000; - } else ArcaneExplosion_Timer -= diff; - - DoMeleeAttackIfReady(); - } }; -//Blindeye The Seer AI -struct boss_blindeye_the_seerAI : public ScriptedAI +//Krosh Firehand AI class boss_krosh_firehand : public CreatureScript { - boss_blindeye_the_seerAI(Creature *c) : ScriptedAI(c) +public: + boss_krosh_firehand() : CreatureScript("boss_krosh_firehand") { } + + CreatureAI *GetAI(Creature* pCreature) { - pInstance = c->GetInstanceData(); + return new boss_krosh_firehandAI (pCreature); } - uint32 GreaterPowerWordShield_Timer; - uint32 Heal_Timer; - uint32 PrayerofHealing_Timer; - - ScriptedInstance* pInstance; - - void Reset() + struct boss_krosh_firehandAI : public ScriptedAI { - GreaterPowerWordShield_Timer = 5000; - Heal_Timer = 25000 + rand()%15000; - PrayerofHealing_Timer = 45000 + rand()%10000; - - //reset encounter - if (pInstance) - pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); - } - - void EnterCombat(Unit * who) - { - if (pInstance) + boss_krosh_firehandAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); - pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); + pInstance = c->GetInstanceScript(); } - } - void JustDied(Unit* /*Killer*/) - { - if (pInstance) + uint32 GreaterFireball_Timer; + uint32 SpellShield_Timer; + uint32 BlastWave_Timer; + + InstanceScript* pInstance; + + void Reset() { - Creature *Maulgar = NULL; - Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); + GreaterFireball_Timer = 1000; + SpellShield_Timer = 5000; + BlastWave_Timer = 20000; - if (Maulgar) - CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - - if (CheckAllBossDied(pInstance, me)) - pInstance->SetData(DATA_MAULGAREVENT, DONE); + //reset encounter + if (pInstance) + pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); } - } - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) + void EnterCombat(Unit * who) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - - if (pTarget) + if (pInstance) { - AttackStart(pTarget); + pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); + pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + void JustDied(Unit* /*Killer*/) { - EnterEvadeMode(); - return; - } - - //GreaterPowerWordShield_Timer - if (GreaterPowerWordShield_Timer <= diff) - { - DoCast(me, SPELL_GREATER_PW_SHIELD); - GreaterPowerWordShield_Timer = 40000; - } else GreaterPowerWordShield_Timer -= diff; - - //Heal_Timer - if (Heal_Timer <= diff) - { - DoCast(me, SPELL_HEAL); - Heal_Timer = 15000 + rand()%25000; - } else Heal_Timer -= diff; - - //PrayerofHealing_Timer - if (PrayerofHealing_Timer <= diff) - { - DoCast(me, SPELL_PRAYER_OH); - PrayerofHealing_Timer = 35000 + rand()%15000; - } else PrayerofHealing_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -//Krosh Firehand AI -struct boss_krosh_firehandAI : public ScriptedAI -{ - boss_krosh_firehandAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 GreaterFireball_Timer; - uint32 SpellShield_Timer; - uint32 BlastWave_Timer; - - ScriptedInstance* pInstance; - - void Reset() - { - GreaterFireball_Timer = 1000; - SpellShield_Timer = 5000; - BlastWave_Timer = 20000; - - //reset encounter - if (pInstance) - pInstance->SetData(DATA_MAULGAREVENT, NOT_STARTED); - } - - void EnterCombat(Unit * who) - { - if (pInstance) - { - pInstance->SetData64(DATA_MAULGAREVENT_TANK, who->GetGUID()); - pInstance->SetData(DATA_MAULGAREVENT, IN_PROGRESS); - } - } - - void JustDied(Unit* /*Killer*/) - { - if (pInstance) - { - Creature *Maulgar = NULL; - Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); - - if (Maulgar) - CAST_AI(boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); - - if (CheckAllBossDied(pInstance, me)) - pInstance->SetData(DATA_MAULGAREVENT, DONE); - } - } - - void UpdateAI(const uint32 diff) - { - //Only if not incombat check if the event is started - if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); - - if (pTarget) + if (pInstance) { - AttackStart(pTarget); + Creature *Maulgar = NULL; + Maulgar = (Unit::GetCreature((*me), pInstance->GetData64(DATA_MAULGAR))); + + if (Maulgar) + CAST_AI(boss_high_king_maulgar::boss_high_king_maulgarAI, Maulgar->AI())->AddDeath(); + + if (CheckAllBossDied(pInstance, me)) + pInstance->SetData(DATA_MAULGAREVENT, DONE); } } - //Return since we have no target - if (!UpdateVictim()) - return; - - //someone evaded! - if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + void UpdateAI(const uint32 diff) { - EnterEvadeMode(); - return; - } - - //GreaterFireball_Timer - if (GreaterFireball_Timer < diff || me->IsWithinDist(me->getVictim(), 30)) - { - DoCast(me->getVictim(), SPELL_GREATER_FIREBALL); - GreaterFireball_Timer = 2000; - } else GreaterFireball_Timer -= diff; - - //SpellShield_Timer - if (SpellShield_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - DoCast(me->getVictim(), SPELL_SPELLSHIELD); - SpellShield_Timer = 30000; - } else SpellShield_Timer -= diff; - - //BlastWave_Timer - if (BlastWave_Timer <= diff) - { - Unit *pTarget = NULL; - std::list t_list = me->getThreatManager().getThreatList(); - std::vector target_list; - for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + //Only if not incombat check if the event is started + if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT)) { - pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - //15 yard radius minimum - if (pTarget && pTarget->IsWithinDist(me, 15,false)) - target_list.push_back(pTarget); - pTarget = NULL; + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK)); + + if (pTarget) + { + AttackStart(pTarget); + } } - if (target_list.size()) - pTarget = *(target_list.begin()+rand()%target_list.size()); - me->InterruptNonMeleeSpells(false); - DoCast(pTarget, SPELL_BLAST_WAVE); - BlastWave_Timer = 60000; - } else BlastWave_Timer -= diff; - } + //Return since we have no target + if (!UpdateVictim()) + return; + + //someone evaded! + if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT)) + { + EnterEvadeMode(); + return; + } + + //GreaterFireball_Timer + if (GreaterFireball_Timer < diff || me->IsWithinDist(me->getVictim(), 30)) + { + DoCast(me->getVictim(), SPELL_GREATER_FIREBALL); + GreaterFireball_Timer = 2000; + } else GreaterFireball_Timer -= diff; + + //SpellShield_Timer + if (SpellShield_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me->getVictim(), SPELL_SPELLSHIELD); + SpellShield_Timer = 30000; + } else SpellShield_Timer -= diff; + + //BlastWave_Timer + if (BlastWave_Timer <= diff) + { + Unit *pTarget = NULL; + std::list t_list = me->getThreatManager().getThreatList(); + std::vector target_list; + for (std::list::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + //15 yard radius minimum + if (pTarget && pTarget->IsWithinDist(me, 15,false)) + target_list.push_back(pTarget); + pTarget = NULL; + } + if (target_list.size()) + pTarget = *(target_list.begin()+rand()%target_list.size()); + + me->InterruptNonMeleeSpells(false); + DoCast(pTarget, SPELL_BLAST_WAVE); + BlastWave_Timer = 60000; + } else BlastWave_Timer -= diff; + } + }; }; -CreatureAI* GetAI_boss_high_king_maulgar(Creature* pCreature) -{ - return new boss_high_king_maulgarAI (pCreature); -} - -CreatureAI* GetAI_boss_olm_the_summoner(Creature* pCreature) -{ - return new boss_olm_the_summonerAI (pCreature); -} - -CreatureAI *GetAI_boss_kiggler_the_crazed(Creature* pCreature) -{ - return new boss_kiggler_the_crazedAI (pCreature); -} - -CreatureAI *GetAI_boss_blindeye_the_seer(Creature* pCreature) -{ - return new boss_blindeye_the_seerAI (pCreature); -} - -CreatureAI *GetAI_boss_krosh_firehand(Creature* pCreature) -{ - return new boss_krosh_firehandAI (pCreature); -} - void AddSC_boss_high_king_maulgar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_high_king_maulgar"; - newscript->GetAI = &GetAI_boss_high_king_maulgar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_kiggler_the_crazed"; - newscript->GetAI = &GetAI_boss_kiggler_the_crazed; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_blindeye_the_seer"; - newscript->GetAI = &GetAI_boss_blindeye_the_seer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_olm_the_summoner"; - newscript->GetAI = &GetAI_boss_olm_the_summoner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_krosh_firehand"; - newscript->GetAI = &GetAI_boss_krosh_firehand; - newscript->RegisterSelf(); + new boss_high_king_maulgar(); + new boss_kiggler_the_crazed(); + new boss_blindeye_the_seer(); + new boss_olm_the_summoner(); + new boss_krosh_firehand(); } - diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index 2df6ad896da..92e76e45510 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -32,164 +32,166 @@ EndScriptData */ 1 - High King Maulgar event 2 - Gruul event */ - -struct instance_gruuls_lair : public ScriptedInstance + class instance_gruuls_lair : public InstanceMapScript { - instance_gruuls_lair(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_gruuls_lair() : InstanceMapScript("instance_gruuls_lair") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint64 MaulgarEvent_Tank; - uint64 KigglerTheCrazed; - uint64 BlindeyeTheSeer; - uint64 OlmTheSummoner; - uint64 KroshFirehand; - uint64 Maulgar; - - uint64 MaulgarDoor; - uint64 GruulDoor; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - MaulgarEvent_Tank = 0; - KigglerTheCrazed = 0; - BlindeyeTheSeer = 0; - OlmTheSummoner = 0; - KroshFirehand = 0; - Maulgar = 0; - - MaulgarDoor = 0; - GruulDoor = 0; + return new instance_gruuls_lair_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_gruuls_lair_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_gruuls_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + uint64 MaulgarEvent_Tank; + uint64 KigglerTheCrazed; + uint64 BlindeyeTheSeer; + uint64 OlmTheSummoner; + uint64 KroshFirehand; + uint64 Maulgar; + + uint64 MaulgarDoor; + uint64 GruulDoor; + + void Initialize() { - case 18835: KigglerTheCrazed = pCreature->GetGUID(); break; - case 18836: BlindeyeTheSeer = pCreature->GetGUID(); break; - case 18834: OlmTheSummoner = pCreature->GetGUID(); break; - case 18832: KroshFirehand = pCreature->GetGUID(); break; - case 18831: Maulgar = pCreature->GetGUID(); break; - } - } + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) - { - case 184468: - MaulgarDoor = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) HandleGameObject(NULL, true, pGo); - break; - case 184662: GruulDoor = pGo->GetGUID(); break; - } - } + MaulgarEvent_Tank = 0; + KigglerTheCrazed = 0; + BlindeyeTheSeer = 0; + OlmTheSummoner = 0; + KroshFirehand = 0; + Maulgar = 0; - void SetData64(uint32 type, uint64 data) - { - if (type == DATA_MAULGAREVENT_TANK) - MaulgarEvent_Tank = data; - } - - uint64 GetData64(uint32 identifier) - { - switch(identifier) - { - case DATA_MAULGAREVENT_TANK: return MaulgarEvent_Tank; - case DATA_KIGGLERTHECRAZED: return KigglerTheCrazed; - case DATA_BLINDEYETHESEER: return BlindeyeTheSeer; - case DATA_OLMTHESUMMONER: return OlmTheSummoner; - case DATA_KROSHFIREHAND: return KroshFirehand; - case DATA_MAULGARDOOR: return MaulgarDoor; - case DATA_GRUULDOOR: return GruulDoor; - case DATA_MAULGAR: return Maulgar; - } - return 0; - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_MAULGAREVENT: - if (data == DONE) HandleGameObject(MaulgarDoor, true); - m_auiEncounter[0] = data; break; - case DATA_GRUULEVENT: - if (data == IN_PROGRESS) HandleGameObject(GruulDoor, false); - else HandleGameObject(GruulDoor, true); - m_auiEncounter[1] = data; break; + MaulgarDoor = 0; + GruulDoor = 0; } - if (data == DONE) - SaveToDB(); - } - - uint32 GetData(uint32 type) - { - switch(type) + bool IsEncounterInProgress() const { - case DATA_MAULGAREVENT: return m_auiEncounter[0]; - case DATA_GRUULEVENT: return m_auiEncounter[1]; - } - return 0; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - std::ostringstream stream; - stream << m_auiEncounter[0] << " " << m_auiEncounter[1]; - char* out = new char[stream.str().length() + 1]; - strcpy(out, stream.str().c_str()); - if (out) - { - OUT_SAVE_INST_DATA_COMPLETE; - return out; + return false; } - return NULL; - } - - void Load(const char* in) - { - if (!in) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch(pCreature->GetEntry()) + { + case 18835: KigglerTheCrazed = pCreature->GetGUID(); break; + case 18836: BlindeyeTheSeer = pCreature->GetGUID(); break; + case 18834: OlmTheSummoner = pCreature->GetGUID(); break; + case 18832: KroshFirehand = pCreature->GetGUID(); break; + case 18831: Maulgar = pCreature->GetGUID(); break; + } } - OUT_LOAD_INST_DATA(in); - std::istringstream stream(in); - stream >> m_auiEncounter[0] >> m_auiEncounter[1]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) + { + switch(pGo->GetEntry()) + { + case 184468: + MaulgarDoor = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) HandleGameObject(NULL, true, pGo); + break; + case 184662: GruulDoor = pGo->GetGUID(); break; + } + } + + void SetData64(uint32 type, uint64 data) + { + if (type == DATA_MAULGAREVENT_TANK) + MaulgarEvent_Tank = data; + } + + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_MAULGAREVENT_TANK: return MaulgarEvent_Tank; + case DATA_KIGGLERTHECRAZED: return KigglerTheCrazed; + case DATA_BLINDEYETHESEER: return BlindeyeTheSeer; + case DATA_OLMTHESUMMONER: return OlmTheSummoner; + case DATA_KROSHFIREHAND: return KroshFirehand; + case DATA_MAULGARDOOR: return MaulgarDoor; + case DATA_GRUULDOOR: return GruulDoor; + case DATA_MAULGAR: return Maulgar; + } + return 0; + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_MAULGAREVENT: + if (data == DONE) HandleGameObject(MaulgarDoor, true); + m_auiEncounter[0] = data; break; + case DATA_GRUULEVENT: + if (data == IN_PROGRESS) HandleGameObject(GruulDoor, false); + else HandleGameObject(GruulDoor, true); + m_auiEncounter[1] = data; break; + } + + if (data == DONE) + SaveToDB(); + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case DATA_MAULGAREVENT: return m_auiEncounter[0]; + case DATA_GRUULEVENT: return m_auiEncounter[1]; + } + return 0; + } + + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; + std::ostringstream stream; + stream << m_auiEncounter[0] << " " << m_auiEncounter[1]; + char* out = new char[stream.str().length() + 1]; + strcpy(out, stream.str().c_str()); + if (out) + { + OUT_SAVE_INST_DATA_COMPLETE; + return out; + } + + return NULL; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + std::istringstream stream(in); + stream >> m_auiEncounter[0] >> m_auiEncounter[1]; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; + } + }; + }; -InstanceData* GetInstanceData_instance_gruuls_lair(Map* pMap) -{ - return new instance_gruuls_lair(pMap); -} void AddSC_instance_gruuls_lair() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_gruuls_lair"; - newscript->GetInstanceData = &GetInstanceData_instance_gruuls_lair; - newscript->RegisterSelf(); + new instance_gruuls_lair(); } - diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index e620ec08add..e97c9567f4d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -50,10 +50,10 @@ class boss_broggok : public CreatureScript { boss_broggokAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 AcidSpray_Timer; uint32 PoisonSpawn_Timer; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index e2674cfcb9d..13378233d61 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -80,12 +80,12 @@ class boss_kelidan_the_breaker : public CreatureScript { boss_kelidan_the_breakerAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); for (uint8 i=0; i<5; ++i) Channelers[i] = 0; } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 ShadowVolley_Timer; uint32 BurningNova_Timer; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp index 74b1fb993ad..0c8d2f48de9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_the_maker.cpp @@ -54,10 +54,10 @@ class boss_the_maker : public CreatureScript { boss_the_makerAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 AcidSpray_Timer; uint32 ExplodingBreaker_Timer; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 97ed35abde7..2c4a88128d3 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -38,9 +38,9 @@ class instance_blood_furnace : public InstanceMapScript { } - struct instance_blood_furnace_InstanceMapScript : public ScriptedInstance + struct instance_blood_furnace_InstanceMapScript : public InstanceScript { - instance_blood_furnace_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_blood_furnace_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 The_MakerGUID; uint64 BroggokGUID; @@ -226,7 +226,7 @@ class instance_blood_furnace : public InstanceMapScript } }; - InstanceData* GetInstanceData(Map* pMap) const + InstanceScript* GetInstanceScript(Map* pMap) const { return new instance_blood_furnace_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index ec81dcf62ff..b9d8c7683e1 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -34,9 +34,9 @@ class instance_ramparts : public InstanceMapScript { } - struct instance_ramparts_InstanceMapScript : public ScriptedInstance + struct instance_ramparts_InstanceMapScript : public InstanceScript { - instance_ramparts_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();} + instance_ramparts_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} uint32 m_auiEncounter[MAX_ENCOUNTER]; uint64 m_uiChestNGUID; @@ -83,7 +83,7 @@ class instance_ramparts : public InstanceMapScript } }; - InstanceData* GetInstanceData(Map* pMap) const + InstanceScript* GetInstanceScript(Map* pMap) const { return new instance_ramparts_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index a5fe18352aa..0a1e11324d9 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -217,7 +217,7 @@ class boss_magtheridon : public CreatureScript { boss_magtheridonAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 10); me->SetFloatValue(UNIT_FIELD_COMBATREACH, 10); @@ -238,7 +238,7 @@ class boss_magtheridon : public CreatureScript CubeMap Cube; - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 Berserk_Timer; uint32 Quake_Timer; @@ -497,10 +497,10 @@ class mob_hellfire_channeler : public CreatureScript { mob_hellfire_channelerAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 ShadowBoltVolley_Timer; uint32 DarkMending_Timer; @@ -613,7 +613,7 @@ public: bool OnGossipHello(Player *pPlayer, GameObject * pGO) { - ScriptedInstance* pInstance = pGO->GetInstanceData(); + InstanceScript* pInstance = pGO->GetInstanceScript(); if (!pInstance) return true; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 38b861539d8..5b73727bd78 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -48,9 +48,9 @@ class instance_magtheridons_lair : public InstanceMapScript { } - struct instance_magtheridons_lair_InstanceMapScript : public ScriptedInstance + struct instance_magtheridons_lair_InstanceMapScript : public InstanceScript { - instance_magtheridons_lair_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) + instance_magtheridons_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } @@ -251,7 +251,7 @@ class instance_magtheridons_lair : public InstanceMapScript } }; - InstanceData* GetInstanceData(Map* pMap) const + InstanceScript* GetInstanceScript(Map* pMap) const { return new instance_magtheridons_lair_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp index 6ca6cbea0d1..9d773f6da55 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_nethekurse.cpp @@ -91,10 +91,10 @@ class boss_grand_warlock_nethekurse : public CreatureScript { boss_grand_warlock_nethekurseAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool IntroOnce; bool IsIntroEvent; @@ -321,10 +321,10 @@ class mob_fel_orc_convert : public CreatureScript { mob_fel_orc_convertAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 Hemorrhage_Timer; void Reset() @@ -410,7 +410,7 @@ class mob_lesser_shadow_fissure : public CreatureScript void EnterCombat(Unit* /*who*/) {} }; - CreatureAI* GetAI_mob_lesser_shadow_fissure(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new mob_lesser_shadow_fissureAI (pCreature); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp index 9b2d8af3e6a..a4971acbc9d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp @@ -164,10 +164,10 @@ class boss_warbringer_omrogg : public CreatureScript { LeftHeadGUID = 0; RightHeadGUID = 0; - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 LeftHeadGUID; uint64 RightHeadGUID; @@ -414,7 +414,7 @@ class boss_warbringer_omrogg : public CreatureScript } }; - CreatureAI* GetAI_boss_warbringer_omrogg(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new boss_warbringer_omroggAI (pCreature); } diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 8f052f592e1..4754bea9315 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -37,9 +37,9 @@ class instance_shattered_halls : public InstanceMapScript : InstanceMapScript("instance_shattered_halls") { } - struct instance_shattered_halls_InstanceMapScript : public ScriptedInstance + struct instance_shattered_halls_InstanceMapScript : public InstanceScript { - instance_shattered_halls_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_shattered_halls_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint32 m_auiEncounter[MAX_ENCOUNTER]; uint64 nethekurseGUID; @@ -111,7 +111,7 @@ class instance_shattered_halls : public InstanceMapScript } }; - InstanceData* GetInstanceData(Map* pMap) const + InstanceScript* GetInstanceScript(Map* pMap) const { return new instance_shattered_halls_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index e529f41a7cf..ac5732d4927 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -82,11 +82,11 @@ class boss_alar : public CreatureScript { boss_alarAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); DefaultMoveSpeedRate = pCreature->GetSpeedRate(MOVE_RUN); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; WaitEventType WaitEvent; uint32 WaitTimer; @@ -469,12 +469,12 @@ class mob_ember_of_alar : public CreatureScript { mob_ember_of_alarAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); pCreature->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING); pCreature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; bool toDie; void Reset() diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index c3090b6219a..1326f11e187 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -84,13 +84,13 @@ class boss_high_astromancer_solarian : public CreatureScript { boss_high_astromancer_solarianAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); defaultarmor = pCreature->GetArmor(); defaultsize = pCreature->GetFloatValue(OBJECT_FIELD_SCALE_X); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; SummonList Summons; uint8 Phase; @@ -418,10 +418,10 @@ class mob_solarium_priest : public CreatureScript { mob_solarium_priestAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 healTimer; uint32 holysmiteTimer; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 86b6de83377..c59dca949ca 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -147,11 +147,11 @@ struct advisorbase_ai : public ScriptedAI { advisorbase_ai(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance = pCreature->GetInstanceData(); + m_pInstance = pCreature->GetInstanceScript(); m_bDoubled_Health = false; } - ScriptedInstance* m_pInstance; + InstanceScript* m_pInstance; bool FakeDeath; bool m_bDoubled_Health; uint32 DelayRes_Timer; @@ -281,11 +281,11 @@ class boss_kaelthas : public CreatureScript { boss_kaelthasAI(Creature* pCreature) : ScriptedAI(pCreature), summons(me) { - m_pInstance = pCreature->GetInstanceData(); + m_pInstance = pCreature->GetInstanceScript(); memset(&m_auiAdvisorGuid, 0, sizeof(m_auiAdvisorGuid)); } - ScriptedInstance* m_pInstance; + InstanceScript* m_pInstance; uint32 Fireball_Timer; uint32 ArcaneDisruption_Timer; @@ -1573,7 +1573,7 @@ class mob_phoenix_egg_tk : public CreatureScript } }; - CreatureAI* GetAI_mob_phoenix_egg_tk(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new mob_phoenix_egg_tkAI(pCreature); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index 0b2656496ad..0e9e81b3b24 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -55,10 +55,10 @@ class boss_void_reaver : public CreatureScript { boss_void_reaverAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 Pounding_Timer; uint32 ArcaneOrb_Timer; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 8fee87e39fd..7e717b204c5 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -43,9 +43,9 @@ class instance_mechanar : public InstanceMapScript { } - struct instance_the_eye_InstanceMapScript : public ScriptedInstance + struct instance_the_eye_InstanceMapScript : public InstanceScript { - instance_the_eye_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + instance_the_eye_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; uint64 ThaladredTheDarkener; uint64 LordSanguinar; @@ -194,7 +194,7 @@ class instance_mechanar : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_the_eye_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 0cee180e88e..083842fd638 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -63,10 +63,10 @@ class boss_nethermancer_sepethrea : public CreatureScript { boss_nethermancer_sepethreaAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 frost_attack_Timer; uint32 arcane_blast_Timer; @@ -186,10 +186,10 @@ class mob_ragin_flames : public CreatureScript { mob_ragin_flamesAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 inferno_Timer; uint32 flame_timer; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp index 2eaad3cd978..eae3b0ff1d9 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp @@ -192,7 +192,7 @@ class boss_pathaleon_the_calculator : public CreatureScript } }; - CreatureAI* GetAI_boss_pathaleon_the_calculator(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new boss_pathaleon_the_calculatorAI (pCreature); } @@ -267,7 +267,7 @@ class mob_nether_wraith : public CreatureScript } }; - CreatureAI* GetAI_mob_nether_wraith(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new mob_nether_wraithAI (pCreature); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 31d10313c7c..aa992098a67 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -36,9 +36,9 @@ class instance_mechanar : public InstanceMapScript { } - struct instance_mechanar_InstanceMapScript : public ScriptedInstance + struct instance_mechanar_InstanceMapScript : public InstanceScript { - instance_mechanar_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; + instance_mechanar_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -79,7 +79,7 @@ class instance_mechanar : public InstanceMapScript } } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_mechanar_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 18cd75b256e..2220526111c 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -78,10 +78,10 @@ class npc_millhouse_manastorm : public CreatureScript { npc_millhouse_manastormAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint32 EventProgress_Timer; uint32 Phase; @@ -282,10 +282,10 @@ class npc_warden_mellichar : public CreatureScript { npc_warden_mellicharAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); } - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool IsRunning; bool CanSpawn; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 63e522ad63d..076d1223f1a 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -70,11 +70,11 @@ class boss_harbinger_skyriss : public CreatureScript { boss_harbinger_skyrissAI(Creature* pCreature) : ScriptedAI(pCreature) { - pInstance = pCreature->GetInstanceData(); + pInstance = pCreature->GetInstanceScript(); Intro = false; } - ScriptedInstance *pInstance; + InstanceScript *pInstance; bool Intro; bool IsImage33; @@ -272,7 +272,7 @@ class boss_harbinger_skyriss : public CreatureScript } }; - CreatureAI* GetAI_boss_harbinger_skyriss(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new boss_harbinger_skyrissAI (pCreature); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index c06cb6a4d07..7a2d10db48d 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -58,9 +58,9 @@ class instance_arcatraz : public InstanceMapScript : InstanceMapScript("instance_arcatraz") { } - struct instance_arcatraz_InstanceMapScript : public ScriptedInstance + struct instance_arcatraz_InstanceMapScript : public InstanceScript { - instance_arcatraz_InstanceMapScript(Map* pMap) : ScriptedInstance(pMap) { Initialize(); }; + instance_arcatraz_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); }; uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -229,7 +229,7 @@ class instance_arcatraz : public InstanceMapScript } }; - InstanceData* GetInstanceData(InstanceMap* pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_arcatraz_InstanceMapScript(pMap); } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index b07c637d521..e760453f73c 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -47,25 +47,32 @@ bool obelisk_one, obelisk_two, obelisk_three, obelisk_four, obelisk_five; ## mobs_bladespire_ogre ######*/ -//TODO: add support for quest 10512 + Creature abilities -struct mobs_bladespire_ogreAI : public ScriptedAI +//TODO: add support for quest 10512 + Creature abilities class mobs_bladespire_ogre : public CreatureScript { - mobs_bladespire_ogreAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_bladespire_ogre() : CreatureScript("mobs_bladespire_ogre") { } - void Reset() { } - - void UpdateAI(const uint32 /*uiDiff*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (!UpdateVictim()) - return; - - DoMeleeAttackIfReady(); + return new mobs_bladespire_ogreAI (pCreature); } + + struct mobs_bladespire_ogreAI : public ScriptedAI + { + mobs_bladespire_ogreAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + + void UpdateAI(const uint32 /*uiDiff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mobs_bladespire_ogre(Creature* pCreature) -{ - return new mobs_bladespire_ogreAI (pCreature); -} /*###### ## mobs_nether_drake @@ -91,154 +98,161 @@ enum eNetherdrake SPELL_MANA_BURN = 38884, SPELL_INTANGIBLE_PRESENCE = 36513 }; - -struct mobs_nether_drakeAI : public ScriptedAI + class mobs_nether_drake : public CreatureScript { - mobs_nether_drakeAI(Creature *c) : ScriptedAI(c) {} +public: + mobs_nether_drake() : CreatureScript("mobs_nether_drake") { } - bool IsNihil; - uint32 NihilSpeech_Timer; - uint32 NihilSpeech_Phase; - - uint32 ArcaneBlast_Timer; - uint32 ManaBurn_Timer; - uint32 IntangiblePresence_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - IsNihil = false; - NihilSpeech_Timer = 3000; - NihilSpeech_Phase = 0; - - ArcaneBlast_Timer = 7500; - ManaBurn_Timer = 10000; - IntangiblePresence_Timer = 15000; + return new mobs_nether_drakeAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) + struct mobs_nether_drakeAI : public ScriptedAI { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return; + mobs_nether_drakeAI(Creature *c) : ScriptedAI(c) {} - ScriptedAI::MoveInLineOfSight(who); - } + bool IsNihil; + uint32 NihilSpeech_Timer; + uint32 NihilSpeech_Phase; - //in case Creature was not summoned (not expected) - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + uint32 ArcaneBlast_Timer; + uint32 ManaBurn_Timer; + uint32 IntangiblePresence_Timer; - if (id == 0) + void Reset() { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - me->SetHealth(0); + IsNihil = false; + NihilSpeech_Timer = 3000; + NihilSpeech_Phase = 0; + + ArcaneBlast_Timer = 7500; + ManaBurn_Timer = 10000; + IntangiblePresence_Timer = 15000; } - } - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) { - const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL}; - int cid = rand()%(4-1); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + return; - if (entry_list[cid] == me->GetEntry()) - ++cid; + ScriptedAI::MoveInLineOfSight(who); + } - //we are nihil, so say before transform - if (me->GetEntry() == ENTRY_NIHIL) + //in case Creature was not summoned (not expected) + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 0) { - DoScriptText(SAY_NIHIL_INTERRUPT, me); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - IsNihil = false; - } - - if (me->UpdateEntry(entry_list[cid])) - { - if (entry_list[cid] == ENTRY_NIHIL) - { - EnterEvadeMode(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - IsNihil = true; - }else - AttackStart(caster); + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + me->SetHealth(0); } } - } - void UpdateAI(const uint32 diff) - { - if (IsNihil) + void SpellHit(Unit *caster, const SpellEntry *spell) { - if (NihilSpeech_Timer <= diff) + if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) { - switch(NihilSpeech_Phase) + const uint32 entry_list[4] = {ENTRY_PROTO, ENTRY_ADOLE, ENTRY_MATUR, ENTRY_NIHIL}; + int cid = rand()%(4-1); + + if (entry_list[cid] == me->GetEntry()) + ++cid; + + //we are nihil, so say before transform + if (me->GetEntry() == ENTRY_NIHIL) { - case 0: - DoScriptText(SAY_NIHIL_1, me); - ++NihilSpeech_Phase; - break; - case 1: - DoScriptText(SAY_NIHIL_2, me); - ++NihilSpeech_Phase; - break; - case 2: - DoScriptText(SAY_NIHIL_3, me); - ++NihilSpeech_Phase; - break; - case 3: - DoScriptText(SAY_NIHIL_4, me); - ++NihilSpeech_Phase; - break; - case 4: - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //take off to location above - me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+50.0f, me->GetPositionY(), me->GetPositionZ()+50.0f); - ++NihilSpeech_Phase; - break; + DoScriptText(SAY_NIHIL_INTERRUPT, me); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + IsNihil = false; } - NihilSpeech_Timer = 5000; - } else NihilSpeech_Timer -=diff; - //anything below here is not interesting for Nihil, so skip it - return; + if (me->UpdateEntry(entry_list[cid])) + { + if (entry_list[cid] == ENTRY_NIHIL) + { + EnterEvadeMode(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + IsNihil = true; + }else + AttackStart(caster); + } + } } - if (!UpdateVictim()) - return; - - if (IntangiblePresence_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); - IntangiblePresence_Timer = 15000+rand()%15000; - } else IntangiblePresence_Timer -= diff; + if (IsNihil) + { + if (NihilSpeech_Timer <= diff) + { + switch(NihilSpeech_Phase) + { + case 0: + DoScriptText(SAY_NIHIL_1, me); + ++NihilSpeech_Phase; + break; + case 1: + DoScriptText(SAY_NIHIL_2, me); + ++NihilSpeech_Phase; + break; + case 2: + DoScriptText(SAY_NIHIL_3, me); + ++NihilSpeech_Phase; + break; + case 3: + DoScriptText(SAY_NIHIL_4, me); + ++NihilSpeech_Phase; + break; + case 4: + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //take off to location above + me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+50.0f, me->GetPositionY(), me->GetPositionZ()+50.0f); + ++NihilSpeech_Phase; + break; + } + NihilSpeech_Timer = 5000; + } else NihilSpeech_Timer -=diff; - if (ManaBurn_Timer <= diff) - { - Unit *pTarget = me->getVictim(); - if (pTarget && pTarget->getPowerType() == POWER_MANA) - DoCast(pTarget, SPELL_MANA_BURN); - ManaBurn_Timer = 8000+rand()%8000; - } else ManaBurn_Timer -= diff; + //anything below here is not interesting for Nihil, so skip it + return; + } - if (ArcaneBlast_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ARCANE_BLAST); - ArcaneBlast_Timer = 2500+rand()%5000; - } else ArcaneBlast_Timer -= diff; + if (!UpdateVictim()) + return; + + if (IntangiblePresence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + IntangiblePresence_Timer = 15000+rand()%15000; + } else IntangiblePresence_Timer -= diff; + + if (ManaBurn_Timer <= diff) + { + Unit *pTarget = me->getVictim(); + if (pTarget && pTarget->getPowerType() == POWER_MANA) + DoCast(pTarget, SPELL_MANA_BURN); + ManaBurn_Timer = 8000+rand()%8000; + } else ManaBurn_Timer -= diff; + + if (ArcaneBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BLAST); + ArcaneBlast_Timer = 2500+rand()%5000; + } else ArcaneBlast_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mobs_nether_drake(Creature* pCreature) -{ - return new mobs_nether_drakeAI (pCreature); -} /*###### ## npc_daranelle @@ -249,61 +263,75 @@ enum eDaranelle SAY_SPELL_INFLUENCE = -1000174, SPELL_LASHHAN_CHANNEL = 36904 }; - -struct npc_daranelleAI : public ScriptedAI + class npc_daranelle : public CreatureScript { - npc_daranelleAI(Creature *c) : ScriptedAI(c) {} +public: + npc_daranelle() : CreatureScript("npc_daranelle") { } - void Reset() { } - - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) + CreatureAI* GetAI(Creature* pCreature) const { - if (who->GetTypeId() == TYPEID_PLAYER) - { - if (who->HasAura(SPELL_LASHHAN_CHANNEL) && me->IsWithinDistInMap(who, 10.0f)) - { - DoScriptText(SAY_SPELL_INFLUENCE, me, who); - //TODO: Move the below to updateAI and run if this statement == true - DoCast(who, 37028, true); - } - } - - ScriptedAI::MoveInLineOfSight(who); + return new npc_daranelleAI (pCreature); } + + struct npc_daranelleAI : public ScriptedAI + { + npc_daranelleAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) + { + if (who->GetTypeId() == TYPEID_PLAYER) + { + if (who->HasAura(SPELL_LASHHAN_CHANNEL) && me->IsWithinDistInMap(who, 10.0f)) + { + DoScriptText(SAY_SPELL_INFLUENCE, me, who); + //TODO: Move the below to updateAI and run if this statement == true + DoCast(who, 37028, true); + } + } + + ScriptedAI::MoveInLineOfSight(who); + } + }; + }; -CreatureAI* GetAI_npc_daranelle(Creature* pCreature) -{ - return new npc_daranelleAI (pCreature); -} /*###### ## npc_overseer_nuaar ######*/ #define GOSSIP_HELLO_ON "Overseer, I am here to negotiate on behalf of the Cenarion Expedition." - -bool GossipHello_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature) + class npc_overseer_nuaar : public CreatureScript { - if (pPlayer->GetQuestStatus(10682) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_overseer_nuaar() : CreatureScript("npc_overseer_nuaar") { } - pPlayer->SEND_GOSSIP_MENU(10532, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->SEND_GOSSIP_MENU(10533, pCreature->GetGUID()); - pPlayer->AreaExploredOrEventHappens(10682); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->SEND_GOSSIP_MENU(10533, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(10682); + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(10682) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(10532, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_saikkal_the_elder @@ -311,74 +339,87 @@ bool GossipSelect_npc_overseer_nuaar(Player* pPlayer, Creature* pCreature, uint3 #define GOSSIP_HELLO_STE "Yes... yes, it's me." #define GOSSIP_SELECT_STE "Yes elder. Tell me more of the book." - -bool GossipHello_npc_saikkal_the_elder(Player* pPlayer, Creature* pCreature) + class npc_saikkal_the_elder : public CreatureScript { - if (pPlayer->GetQuestStatus(10980) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_saikkal_the_elder() : CreatureScript("npc_saikkal_the_elder") { } - pPlayer->SEND_GOSSIP_MENU(10794, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_saikkal_the_elder(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(10795, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(10796, pCreature->GetGUID()); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(10795, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(10796, pCreature->GetGUID()); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(10980) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_STE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(10794, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## go_legion_obelisk ######*/ - -bool GOHello_go_legion_obelisk(Player* pPlayer, GameObject* pGo) + class go_legion_obelisk : public GameObjectScript { - if (pPlayer->GetQuestStatus(10821) == QUEST_STATUS_INCOMPLETE) +public: + go_legion_obelisk() : GameObjectScript("go_legion_obelisk") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - switch(pGo->GetEntry()) + if (pPlayer->GetQuestStatus(10821) == QUEST_STATUS_INCOMPLETE) { - case LEGION_OBELISK_ONE: - obelisk_one = true; - break; - case LEGION_OBELISK_TWO: - obelisk_two = true; - break; - case LEGION_OBELISK_THREE: - obelisk_three = true; - break; - case LEGION_OBELISK_FOUR: - obelisk_four = true; - break; - case LEGION_OBELISK_FIVE: - obelisk_five = true; - break; + switch(pGo->GetEntry()) + { + case LEGION_OBELISK_ONE: + obelisk_one = true; + break; + case LEGION_OBELISK_TWO: + obelisk_two = true; + break; + case LEGION_OBELISK_THREE: + obelisk_three = true; + break; + case LEGION_OBELISK_FOUR: + obelisk_four = true; + break; + case LEGION_OBELISK_FIVE: + obelisk_five = true; + break; + } + + if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true) + { + pGo->SummonCreature(19963,2943.40f,4778.20f,284.49f,0.94f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); + //reset global var + obelisk_one = false; + obelisk_two = false; + obelisk_three = false; + obelisk_four = false; + obelisk_five = false; + } } - if (obelisk_one == true && obelisk_two == true && obelisk_three == true && obelisk_four == true && obelisk_five == true) - { - pGo->SummonCreature(19963,2943.40f,4778.20f,284.49f,0.94f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000); - //reset global var - obelisk_one = false; - obelisk_two = false; - obelisk_three = false; - obelisk_four = false; - obelisk_five = false; - } + return true; } - return true; -} +}; /*###### @@ -392,87 +433,101 @@ enum eBloodmaul NPC_QUEST_CREDIT = 21241, GO_KEG = 184315 }; - -struct npc_bloodmaul_brutebaneAI : public ScriptedAI + class npc_bloodmaul_brutebane : public CreatureScript { - npc_bloodmaul_brutebaneAI(Creature *c) : ScriptedAI(c) +public: + npc_bloodmaul_brutebane() : CreatureScript("npc_bloodmaul_brutebane") { } + + CreatureAI* GetAI(Creature* pCreature) const { - if(Creature* Ogre = me->FindNearestCreature(NPC_OGRE_BRUTE, 50, true)) - { - Ogre->SetReactState(REACT_DEFENSIVE); - Ogre->GetMotionMaster()->MovePoint(1, me->GetPositionX()-1, me->GetPositionY()+1, me->GetPositionZ()); - } + return new npc_bloodmaul_brutebaneAI (pCreature); } - uint64 OgreGUID; - - void Reset() + struct npc_bloodmaul_brutebaneAI : public ScriptedAI { - OgreGUID = 0; - } + npc_bloodmaul_brutebaneAI(Creature *c) : ScriptedAI(c) + { + if(Creature* Ogre = me->FindNearestCreature(NPC_OGRE_BRUTE, 50, true)) + { + Ogre->SetReactState(REACT_DEFENSIVE); + Ogre->GetMotionMaster()->MovePoint(1, me->GetPositionX()-1, me->GetPositionY()+1, me->GetPositionZ()); + } + } + + uint64 OgreGUID; + + void Reset() + { + OgreGUID = 0; + } + + void UpdateAI(const uint32 /*uiDiff*/) {} + }; - void UpdateAI(const uint32 /*uiDiff*/) {} }; -CreatureAI* GetAI_npc_bloodmaul_brutebane(Creature* pCreature) -{ - return new npc_bloodmaul_brutebaneAI (pCreature); -} /*###### ## npc_ogre_brute ######*/ - -struct npc_ogre_bruteAI : public ScriptedAI + class npc_ogre_brute : public CreatureScript { - npc_ogre_bruteAI(Creature *c) : ScriptedAI(c) {} +public: + npc_ogre_brute() : CreatureScript("npc_ogre_brute") { } - uint64 PlayerGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; + return new npc_ogre_bruteAI(pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_ogre_bruteAI : public ScriptedAI { - if (!who || (!who->isAlive())) return; + npc_ogre_bruteAI(Creature *c) : ScriptedAI(c) {} - if (me->IsWithinDistInMap(who, 50.0f) && (who->GetTypeId() == TYPEID_PLAYER) && who->ToPlayer()->GetQuestStatus(10512) == QUEST_STATUS_INCOMPLETE) + uint64 PlayerGUID; + + void Reset() { - PlayerGUID = who->GetGUID(); + PlayerGUID = 0; } - } - void MovementInform(uint32 /*type*/, uint32 id) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (id == 1) + void MoveInLineOfSight(Unit *who) { - GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); - if (Keg) - Keg->Delete(); - me->HandleEmoteCommand(7); - me->SetReactState(REACT_AGGRESSIVE); - me->GetMotionMaster()->MoveTargetedHome(); - Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); - if (pPlayer && Credit) - pPlayer->KilledMonster(Credit->GetCreatureInfo(), Credit->GetGUID()); - } - } + if (!who || (!who->isAlive())) return; + + if (me->IsWithinDistInMap(who, 50.0f) && (who->GetTypeId() == TYPEID_PLAYER) && who->ToPlayer()->GetQuestStatus(10512) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + } + } + + void MovementInform(uint32 /*type*/, uint32 id) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (id == 1) + { + GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); + if (Keg) + Keg->Delete(); + me->HandleEmoteCommand(7); + me->SetReactState(REACT_AGGRESSIVE); + me->GetMotionMaster()->MoveTargetedHome(); + Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); + if (pPlayer && Credit) + pPlayer->KilledMonster(Credit->GetCreatureInfo(), Credit->GetGUID()); + } + } + + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; - void UpdateAI(const uint32 /*diff*/) - { - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_ogre_brute(Creature* pCreature) -{ - return new npc_ogre_bruteAI(pCreature); -} /*###### ## AddSC @@ -480,48 +535,12 @@ CreatureAI* GetAI_npc_ogre_brute(Creature* pCreature) void AddSC_blades_edge_mountains() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_bladespire_ogre"; - newscript->GetAI = &GetAI_mobs_bladespire_ogre; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mobs_nether_drake"; - newscript->GetAI = &GetAI_mobs_nether_drake; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_daranelle"; - newscript->GetAI = &GetAI_npc_daranelle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_overseer_nuaar"; - newscript->pGossipHello = &GossipHello_npc_overseer_nuaar; - newscript->pGossipSelect = &GossipSelect_npc_overseer_nuaar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_saikkal_the_elder"; - newscript->pGossipHello = &GossipHello_npc_saikkal_the_elder; - newscript->pGossipSelect = &GossipSelect_npc_saikkal_the_elder; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_legion_obelisk"; - newscript->pGOHello = &GOHello_go_legion_obelisk; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bloodmaul_brutebane"; - newscript->GetAI = &GetAI_npc_bloodmaul_brutebane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ogre_brute"; - newscript->GetAI = &GetAI_npc_ogre_brute; - newscript->RegisterSelf(); + new mobs_bladespire_ogre(); + new mobs_nether_drake(); + new npc_daranelle(); + new npc_overseer_nuaar(); + new npc_saikkal_the_elder(); + new go_legion_obelisk(); + new npc_bloodmaul_brutebane(); + new npc_ogre_brute(); } - diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index b158a1a6fd1..7d09af3aaa9 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -46,131 +46,133 @@ EndScriptData */ #define SPELL_ENRAGE 32964 #define SPELL_CAPTURESOUL 32966 #define SPELL_TWISTEDREFLECTION 21063 - -struct boss_doomlordkazzakAI : public ScriptedAI + class boss_doomlord_kazzak : public CreatureScript { - boss_doomlordkazzakAI(Creature *c) : ScriptedAI(c) {} +public: + boss_doomlord_kazzak() : CreatureScript("boss_doomlord_kazzak") { } - uint32 ShadowVolley_Timer; - uint32 Cleave_Timer; - uint32 ThunderClap_Timer; - uint32 VoidBolt_Timer; - uint32 MarkOfKazzak_Timer; - uint32 Enrage_Timer; - uint32 Twisted_Reflection_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ShadowVolley_Timer = 6000 + rand()%4000; - Cleave_Timer = 7000; - ThunderClap_Timer = 14000 + rand()%4000; - VoidBolt_Timer = 30000; - MarkOfKazzak_Timer = 25000; - Enrage_Timer = 60000; - Twisted_Reflection_Timer = 33000; // Timer may be incorrect + return new boss_doomlordkazzakAI (pCreature); } - void JustRespawned() + struct boss_doomlordkazzakAI : public ScriptedAI { - DoScriptText(SAY_INTRO, me); - } + boss_doomlordkazzakAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); - } + uint32 ShadowVolley_Timer; + uint32 Cleave_Timer; + uint32 ThunderClap_Timer; + uint32 VoidBolt_Timer; + uint32 MarkOfKazzak_Timer; + uint32 Enrage_Timer; + uint32 Twisted_Reflection_Timer; - void KilledUnit(Unit* victim) - { - // When Kazzak kills a player (not pets/totems), he regens some health - if (victim->GetTypeId() != TYPEID_PLAYER) - return; - - DoCast(me, SPELL_CAPTURESOUL); - - DoScriptText(RAND(SAY_KILL1,SAY_KILL2,SAY_KILL3), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //ShadowVolley_Timer - if (ShadowVolley_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); - ShadowVolley_Timer = 4000 + rand()%2000; - } else ShadowVolley_Timer -= diff; + ShadowVolley_Timer = 6000 + rand()%4000; + Cleave_Timer = 7000; + ThunderClap_Timer = 14000 + rand()%4000; + VoidBolt_Timer = 30000; + MarkOfKazzak_Timer = 25000; + Enrage_Timer = 60000; + Twisted_Reflection_Timer = 33000; // Timer may be incorrect + } - //Cleave_Timer - if (Cleave_Timer <= diff) + void JustRespawned() { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 8000 + rand()%4000; - } else Cleave_Timer -= diff; + DoScriptText(SAY_INTRO, me); + } - //ThunderClap_Timer - if (ThunderClap_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); - ThunderClap_Timer = 10000 + rand()%4000; - } else ThunderClap_Timer -= diff; + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); + } - //VoidBolt_Timer - if (VoidBolt_Timer <= diff) + void KilledUnit(Unit* victim) { - DoCast(me->getVictim(), SPELL_VOIDBOLT); - VoidBolt_Timer = 15000 + rand()%3000; - } else VoidBolt_Timer -= diff; + // When Kazzak kills a player (not pets/totems), he regens some health + if (victim->GetTypeId() != TYPEID_PLAYER) + return; - //MarkOfKazzak_Timer - if (MarkOfKazzak_Timer <= diff) + DoCast(me, SPELL_CAPTURESOUL); + + DoScriptText(RAND(SAY_KILL1,SAY_KILL2,SAY_KILL3), me); + } + + void JustDied(Unit * /*victim*/) { - Unit* victim = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (victim->GetPower(POWER_MANA)) + DoScriptText(SAY_DEATH, me); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //ShadowVolley_Timer + if (ShadowVolley_Timer <= diff) { - DoCast(victim, SPELL_MARKOFKAZZAK); - MarkOfKazzak_Timer = 20000; - } - } else MarkOfKazzak_Timer -= diff; + DoCast(me->getVictim(), SPELL_SHADOWVOLLEY); + ShadowVolley_Timer = 4000 + rand()%2000; + } else ShadowVolley_Timer -= diff; - //Enrage_Timer - if (Enrage_Timer <= diff) - { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_ENRAGE); - Enrage_Timer = 30000; - } else Enrage_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 8000 + rand()%4000; + } else Cleave_Timer -= diff; - if (Twisted_Reflection_Timer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_TWISTEDREFLECTION); - Twisted_Reflection_Timer = 15000; - } else Twisted_Reflection_Timer -= diff; + //ThunderClap_Timer + if (ThunderClap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + ThunderClap_Timer = 10000 + rand()%4000; + } else ThunderClap_Timer -= diff; - DoMeleeAttackIfReady(); - } + //VoidBolt_Timer + if (VoidBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_VOIDBOLT); + VoidBolt_Timer = 15000 + rand()%3000; + } else VoidBolt_Timer -= diff; + + //MarkOfKazzak_Timer + if (MarkOfKazzak_Timer <= diff) + { + Unit* victim = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (victim->GetPower(POWER_MANA)) + { + DoCast(victim, SPELL_MARKOFKAZZAK); + MarkOfKazzak_Timer = 20000; + } + } else MarkOfKazzak_Timer -= diff; + + //Enrage_Timer + if (Enrage_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_ENRAGE); + Enrage_Timer = 30000; + } else Enrage_Timer -= diff; + + if (Twisted_Reflection_Timer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_TWISTEDREFLECTION); + Twisted_Reflection_Timer = 15000; + } else Twisted_Reflection_Timer -= diff; + + DoMeleeAttackIfReady(); + } + + }; }; -CreatureAI* GetAI_boss_doomlordkazzak(Creature* pCreature) -{ - return new boss_doomlordkazzakAI (pCreature); -} void AddSC_boss_doomlordkazzak() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_doomlord_kazzak"; - newscript->GetAI = &GetAI_boss_doomlordkazzak; - newscript->RegisterSelf(); + new boss_doomlord_kazzak(); } - diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index a51cab3426b..1b375ebfcd7 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -42,139 +42,141 @@ EndScriptData */ #define SPELL_ENRAGE 33653 #define SPELL_MARK_DEATH 37128 #define SPELL_AURA_DEATH 37131 - -struct boss_doomwalkerAI : public ScriptedAI + class boss_doomwalker : public CreatureScript { - boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {} +public: + boss_doomwalker() : CreatureScript("boss_doomwalker") { } - uint32 Chain_Timer; - uint32 Enrage_Timer; - uint32 Overrun_Timer; - uint32 Quake_Timer; - uint32 Armor_Timer; - - bool InEnrage; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Enrage_Timer = 0; - Armor_Timer = 5000 + rand()%8000; - Chain_Timer = 10000 + rand()%20000; - Quake_Timer = 25000 + rand()%10000; - Overrun_Timer = 30000 + rand()%15000; - - InEnrage = false; + return new boss_doomwalkerAI (pCreature); } - void KilledUnit(Unit* Victim) + struct boss_doomwalkerAI : public ScriptedAI { - Victim->CastSpell(Victim,SPELL_MARK_DEATH,0); + boss_doomwalkerAI(Creature *c) : ScriptedAI(c) {} - if (rand()%5) - return; + uint32 Chain_Timer; + uint32 Enrage_Timer; + uint32 Overrun_Timer; + uint32 Quake_Timer; + uint32 Armor_Timer; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } + bool InEnrage; - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } - - void MoveInLineOfSight(Unit *who) - { - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) + void Reset() { - if (who->HasAura(SPELL_MARK_DEATH,0)) - { - who->CastSpell(who,SPELL_AURA_DEATH,1); - } - } - } + Enrage_Timer = 0; + Armor_Timer = 5000 + rand()%8000; + Chain_Timer = 10000 + rand()%20000; + Quake_Timer = 25000 + rand()%10000; + Overrun_Timer = 30000 + rand()%15000; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //Spell Enrage, when hp <= 20% gain enrage - if (((me->GetHealth()*100)/ me->GetMaxHealth()) <= 20) - { - if (Enrage_Timer <= diff) - { - DoCast(me, SPELL_ENRAGE); - Enrage_Timer = 6000; - InEnrage = true; - } else Enrage_Timer -= diff; + InEnrage = false; } - //Spell Overrun - if (Overrun_Timer <= diff) + void KilledUnit(Unit* Victim) { - DoScriptText(RAND(SAY_OVERRUN_1,SAY_OVERRUN_2), me); + Victim->CastSpell(Victim,SPELL_MARK_DEATH,0); - DoCast(me->getVictim(), SPELL_OVERRUN); - Overrun_Timer = 25000 + rand()%15000; - } else Overrun_Timer -= diff; - - //Spell Earthquake - if (Quake_Timer <= diff) - { - if (rand()%2) + if (rand()%5) return; - DoScriptText(RAND(SAY_EARTHQUAKE_1,SAY_EARTHQUAKE_2), me); + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } - //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead - if (InEnrage) - me->RemoveAura(SPELL_ENRAGE); - - DoCast(me, SPELL_EARTHQUAKE); - Quake_Timer = 30000 + rand()%25000; - } else Quake_Timer -= diff; - - //Spell Chain Lightning - if (Chain_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + DoScriptText(SAY_DEATH, me); + } - if (!pTarget) - pTarget = me->getVictim(); - - if (pTarget) - DoCast(pTarget, SPELL_CHAIN_LIGHTNING); - - Chain_Timer = 7000 + rand()%20000; - } else Chain_Timer -= diff; - - //Spell Sunder Armor - if (Armor_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); - Armor_Timer = 10000 + rand()%15000; - } else Armor_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } + + void MoveInLineOfSight(Unit *who) + { + if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) + { + if (who->HasAura(SPELL_MARK_DEATH,0)) + { + who->CastSpell(who,SPELL_AURA_DEATH,1); + } + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + //Spell Enrage, when hp <= 20% gain enrage + if (((me->GetHealth()*100)/ me->GetMaxHealth()) <= 20) + { + if (Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enrage_Timer = 6000; + InEnrage = true; + } else Enrage_Timer -= diff; + } + + //Spell Overrun + if (Overrun_Timer <= diff) + { + DoScriptText(RAND(SAY_OVERRUN_1,SAY_OVERRUN_2), me); + + DoCast(me->getVictim(), SPELL_OVERRUN); + Overrun_Timer = 25000 + rand()%15000; + } else Overrun_Timer -= diff; + + //Spell Earthquake + if (Quake_Timer <= diff) + { + if (rand()%2) + return; + + DoScriptText(RAND(SAY_EARTHQUAKE_1,SAY_EARTHQUAKE_2), me); + + //remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead + if (InEnrage) + me->RemoveAura(SPELL_ENRAGE); + + DoCast(me, SPELL_EARTHQUAKE); + Quake_Timer = 30000 + rand()%25000; + } else Quake_Timer -= diff; + + //Spell Chain Lightning + if (Chain_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + + if (!pTarget) + pTarget = me->getVictim(); + + if (pTarget) + DoCast(pTarget, SPELL_CHAIN_LIGHTNING); + + Chain_Timer = 7000 + rand()%20000; + } else Chain_Timer -= diff; + + //Spell Sunder Armor + if (Armor_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUNDER_ARMOR); + Armor_Timer = 10000 + rand()%15000; + } else Armor_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_doomwalker(Creature* pCreature) -{ - return new boss_doomwalkerAI (pCreature); -} void AddSC_boss_doomwalker() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_doomwalker"; - newscript->GetAI = &GetAI_boss_doomwalker; - newscript->RegisterSelf(); + new boss_doomwalker(); } - diff --git a/src/server/scripts/Outland/hellfire_peninsula.cpp b/src/server/scripts/Outland/hellfire_peninsula.cpp index c3710739926..853da20e3e0 100644 --- a/src/server/scripts/Outland/hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/hellfire_peninsula.cpp @@ -53,72 +53,79 @@ enum eAeranas C_AERANAS = 17085 }; - -struct npc_aeranasAI : public ScriptedAI + class npc_aeranas : public CreatureScript { - npc_aeranasAI(Creature* c) : ScriptedAI(c) {} +public: + npc_aeranas() : CreatureScript("npc_aeranas") { } - uint32 Faction_Timer; - uint32 EnvelopingWinds_Timer; - uint32 Shock_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Faction_Timer = 8000; - EnvelopingWinds_Timer = 9000; - Shock_Timer = 5000; - - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->setFaction(FACTION_FRIENDLY); - - DoScriptText(SAY_SUMMON, me); + return new npc_aeranasAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_aeranasAI : public ScriptedAI { - if (Faction_Timer) - { - if (Faction_Timer <= diff) - { - me->setFaction(FACTION_HOSTILE); - Faction_Timer = 0; - } else Faction_Timer -= diff; - } + npc_aeranasAI(Creature* c) : ScriptedAI(c) {} - if (!UpdateVictim()) - return; + uint32 Faction_Timer; + uint32 EnvelopingWinds_Timer; + uint32 Shock_Timer; - if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + void Reset() { + Faction_Timer = 8000; + EnvelopingWinds_Timer = 9000; + Shock_Timer = 5000; + + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->setFaction(FACTION_FRIENDLY); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - DoScriptText(SAY_FREE, me); - return; + + DoScriptText(SAY_SUMMON, me); } - if (Shock_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 10000; - } else Shock_Timer -= diff; + if (Faction_Timer) + { + if (Faction_Timer <= diff) + { + me->setFaction(FACTION_HOSTILE); + Faction_Timer = 0; + } else Faction_Timer -= diff; + } - if (EnvelopingWinds_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_ENVELOPING_WINDS); - EnvelopingWinds_Timer = 25000; - } else EnvelopingWinds_Timer -= diff; + if (!UpdateVictim()) + return; + + if ((me->GetHealth()*100) / me->GetMaxHealth() < 30) + { + me->setFaction(FACTION_FRIENDLY); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + DoScriptText(SAY_FREE, me); + return; + } + + if (Shock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOCK); + Shock_Timer = 10000; + } else Shock_Timer -= diff; + + if (EnvelopingWinds_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ENVELOPING_WINDS); + EnvelopingWinds_Timer = 25000; + } else EnvelopingWinds_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_aeranas(Creature* pCreature) -{ - return new npc_aeranasAI (pCreature); -} /*###### ## npc_ancestral_wolf @@ -134,68 +141,81 @@ enum eAncestralWolf NPC_RYGA = 17123 }; - -struct npc_ancestral_wolfAI : public npc_escortAI + class npc_ancestral_wolf : public CreatureScript { - npc_ancestral_wolfAI(Creature* pCreature) : npc_escortAI(pCreature) - { - if (pCreature->GetOwner() && pCreature->GetOwner()->GetTypeId() == TYPEID_PLAYER) - Start(false, false, pCreature->GetOwner()->GetGUID()); - else - sLog.outError("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); +public: + npc_ancestral_wolf() : CreatureScript("npc_ancestral_wolf") { } - pCreature->SetSpeed(MOVE_WALK, 1.5f); - Reset(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_ancestral_wolfAI(pCreature); } - Unit* pRyga; - - void Reset() + struct npc_ancestral_wolfAI : public npc_escortAI { - pRyga = NULL; - DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true); - } - - void MoveInLineOfSight(Unit* pWho) - { - if (!pRyga && pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(pWho, 15.0f)) - pRyga = pWho; - - npc_escortAI::MoveInLineOfSight(pWho); - } - - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + npc_ancestral_wolfAI(Creature* pCreature) : npc_escortAI(pCreature) { - case 0: - DoScriptText(EMOTE_WOLF_LIFT_HEAD, me); - break; - case 2: - DoScriptText(EMOTE_WOLF_HOWL, me); - break; - case 50: - if (pRyga && pRyga->isAlive() && !pRyga->isInCombat()) - DoScriptText(SAY_WOLF_WELCOME, pRyga); - break; + if (pCreature->GetOwner() && pCreature->GetOwner()->GetTypeId() == TYPEID_PLAYER) + Start(false, false, pCreature->GetOwner()->GetGUID()); + else + sLog.outError("TRINITY: npc_ancestral_wolf can not obtain owner or owner is not a player."); + + pCreature->SetSpeed(MOVE_WALK, 1.5f); + Reset(); } - } + + Unit* pRyga; + + void Reset() + { + pRyga = NULL; + DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true); + } + + void MoveInLineOfSight(Unit* pWho) + { + if (!pRyga && pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(pWho, 15.0f)) + pRyga = pWho; + + npc_escortAI::MoveInLineOfSight(pWho); + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + DoScriptText(EMOTE_WOLF_LIFT_HEAD, me); + break; + case 2: + DoScriptText(EMOTE_WOLF_HOWL, me); + break; + case 50: + if (pRyga && pRyga->isAlive() && !pRyga->isInCombat()) + DoScriptText(SAY_WOLF_WELCOME, pRyga); + break; + } + } + }; + }; -CreatureAI* GetAI_npc_ancestral_wolf(Creature* pCreature) -{ - return new npc_ancestral_wolfAI(pCreature); -} /*###### ## go_haaleshi_altar ######*/ - -bool GOHello_go_haaleshi_altar(Player* /*pPlayer*/, GameObject* pGo) + class go_haaleshi_altar : public GameObjectScript { - pGo->SummonCreature(C_AERANAS,-1321.79, 4043.80, 116.24, 1.25, TEMPSUMMON_TIMED_DESPAWN, 180000); - return false; -} +public: + go_haaleshi_altar() : GameObjectScript("go_haaleshi_altar") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGo) + { + pGo->SummonCreature(C_AERANAS,-1321.79, 4043.80, 116.24, 1.25, TEMPSUMMON_TIMED_DESPAWN, 180000); + return false; + } + +}; /*###### ## npc_naladu @@ -207,24 +227,31 @@ enum eNaladu { GOSSIP_TEXTID_NALADU1 = 9788 }; - -bool GossipHello_npc_naladu(Player* pPlayer, Creature* pCreature) + class npc_naladu : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_naladu() : CreatureScript("npc_naladu") { } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NALADU_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, pCreature->GetGUID()); -bool GossipSelect_npc_naladu(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, pCreature->GetGUID()); + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_NALADU_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; - return true; -} /*###### ## npc_tracy_proudwell @@ -239,40 +266,47 @@ enum eTracy GOSSIP_TEXTID_TRACY_PROUDWELL1 = 10689, QUEST_DIGGING_FOR_PRAYER_BEADS = 10916 }; - -bool GossipHello_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature) + class npc_tracy_proudwell : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_tracy_proudwell() : CreatureScript("npc_tracy_proudwell") { } - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_REDEEM_MARKS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - - if (pPlayer->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_tracy_proudwell(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TRACY_PROUDWELL1, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TRACY_PROUDWELL1, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + } + + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_REDEEM_MARKS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (pPlayer->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TRACY_PROUDWELL_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_trollbane @@ -288,36 +322,43 @@ enum eTrollbane GOSSIP_TEXTID_TROLLBANE2 = 9933, GOSSIP_TEXTID_TROLLBANE3 = 8772 }; - -bool GossipHello_npc_trollbane(Player* pPlayer, Creature* pCreature) + class npc_trollbane : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_trollbane() : CreatureScript("npc_trollbane") { } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_trollbane(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE1, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE2, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE3, pCreature->GetGUID()); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE1, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE2, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE3, pCreature->GetGUID()); + break; + } + + return true; } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TROLLBANE_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_wounded_blood_elf @@ -334,78 +375,86 @@ enum eWoundedBloodElf QUEST_ROAD_TO_FALCON_WATCH = 9375 }; - -struct npc_wounded_blood_elfAI : public npc_escortAI + class npc_wounded_blood_elf : public CreatureScript { - npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {} +public: + npc_wounded_blood_elf() : CreatureScript("npc_wounded_blood_elf") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) { - case 0: - DoScriptText(SAY_ELF_START, me, pPlayer); - break; - case 9: - DoScriptText(SAY_ELF_SUMMON1, me, pPlayer); - // Spawn two Haal'eshi Talonguard - DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 13: - DoScriptText(SAY_ELF_RESTING, me, pPlayer); - break; - case 14: - DoScriptText(SAY_ELF_SUMMON2, me, pPlayer); - // Spawn two Haal'eshi Windwalker - DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - break; - case 27: - DoScriptText(SAY_ELF_COMPLETE, me, pPlayer); - // Award quest credit - pPlayer->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,me); - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_wounded_blood_elf::npc_wounded_blood_elfAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + + // Change faction so mobs attack + pCreature->setFaction(775); } + + return true; } - void Reset() { } - - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - DoScriptText(SAY_ELF_AGGRO, me); + return new npc_wounded_blood_elfAI(pCreature); } - void JustSummoned(Creature* summoned) + struct npc_wounded_blood_elfAI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_wounded_blood_elfAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 0: + DoScriptText(SAY_ELF_START, me, pPlayer); + break; + case 9: + DoScriptText(SAY_ELF_SUMMON1, me, pPlayer); + // Spawn two Haal'eshi Talonguard + DoSpawnCreature(16967, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16967, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 13: + DoScriptText(SAY_ELF_RESTING, me, pPlayer); + break; + case 14: + DoScriptText(SAY_ELF_SUMMON2, me, pPlayer); + // Spawn two Haal'eshi Windwalker + DoSpawnCreature(16966, -15, -15, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + DoSpawnCreature(16966, -17, -17, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + break; + case 27: + DoScriptText(SAY_ELF_COMPLETE, me, pPlayer); + // Award quest credit + pPlayer->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,me); + break; + } + } + + void Reset() { } + + void EnterCombat(Unit* /*who*/) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + DoScriptText(SAY_ELF_AGGRO, me); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + }; + }; -CreatureAI* GetAI_npc_wounded_blood_elf(Creature* pCreature) -{ - return new npc_wounded_blood_elfAI(pCreature); -} -bool QuestAccept_npc_wounded_blood_elf(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_wounded_blood_elfAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - - // Change faction so mobs attack - pCreature->setFaction(775); - } - - return true; -} /*###### ## npc_fel_guard_hound @@ -417,108 +466,77 @@ enum eFelGuard NPC_DERANGED_HELBOAR = 16863 }; - -struct npc_fel_guard_houndAI : public ScriptedAI + class npc_fel_guard_hound : public CreatureScript { - npc_fel_guard_houndAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_fel_guard_hound() : CreatureScript("npc_fel_guard_hound") { } - uint32 uiCheckTimer; - uint64 uiHelboarGUID; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiCheckTimer = 5000; //check for creature every 5 sec - uiHelboarGUID = 0; + return new npc_fel_guard_houndAI(pCreature); } - void MovementInform(uint32 uiType, uint32 uiId) + struct npc_fel_guard_houndAI : public ScriptedAI { - if (uiType != POINT_MOTION_TYPE || uiId != 1) - return; + npc_fel_guard_houndAI(Creature* pCreature) : ScriptedAI(pCreature) {} - if (Creature* pHelboar = me->GetCreature(*me,uiHelboarGUID)) + uint32 uiCheckTimer; + uint64 uiHelboarGUID; + + void Reset() { - pHelboar->RemoveCorpse(); - DoCast(SPELL_SUMMON_POO); - - if (Player* pOwner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) - me->GetMotionMaster()->MoveFollow(pOwner,0.0f,0.0f); + uiCheckTimer = 5000; //check for creature every 5 sec + uiHelboarGUID = 0; } - } - void UpdateAI(const uint32 uiDiff) - { - if (uiCheckTimer <= uiDiff) + void MovementInform(uint32 uiType, uint32 uiId) { - if (Creature* pHelboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false)) + if (uiType != POINT_MOTION_TYPE || uiId != 1) + return; + + if (Creature* pHelboar = me->GetCreature(*me,uiHelboarGUID)) { - if (pHelboar->GetGUID() != uiHelboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) - { - uiHelboarGUID = pHelboar->GetGUID(); - me->GetMotionMaster()->MovePoint(1,pHelboar->GetPositionX(),pHelboar->GetPositionY(),pHelboar->GetPositionZ()); - } + pHelboar->RemoveCorpse(); + DoCast(SPELL_SUMMON_POO); + + if (Player* pOwner = me->GetCharmerOrOwnerPlayerOrPlayerItself()) + me->GetMotionMaster()->MoveFollow(pOwner,0.0f,0.0f); } - uiCheckTimer = 5000; - }else uiCheckTimer -= uiDiff; + } - if (!UpdateVictim()) - return; + void UpdateAI(const uint32 uiDiff) + { + if (uiCheckTimer <= uiDiff) + { + if (Creature* pHelboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false)) + { + if (pHelboar->GetGUID() != uiHelboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO)) + { + uiHelboarGUID = pHelboar->GetGUID(); + me->GetMotionMaster()->MovePoint(1,pHelboar->GetPositionX(),pHelboar->GetPositionY(),pHelboar->GetPositionZ()); + } + } + uiCheckTimer = 5000; + }else uiCheckTimer -= uiDiff; + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_fel_guard_hound(Creature* pCreature) -{ - return new npc_fel_guard_houndAI(pCreature); -} void AddSC_hellfire_peninsula() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_aeranas"; - newscript->GetAI = &GetAI_npc_aeranas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ancestral_wolf"; - newscript->GetAI = &GetAI_npc_ancestral_wolf; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_haaleshi_altar"; - newscript->pGOHello = &GOHello_go_haaleshi_altar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_naladu"; - newscript->pGossipHello = &GossipHello_npc_naladu; - newscript->pGossipSelect = &GossipSelect_npc_naladu; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tracy_proudwell"; - newscript->pGossipHello = &GossipHello_npc_tracy_proudwell; - newscript->pGossipSelect = &GossipSelect_npc_tracy_proudwell; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_trollbane"; - newscript->pGossipHello = &GossipHello_npc_trollbane; - newscript->pGossipSelect = &GossipSelect_npc_trollbane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_wounded_blood_elf"; - newscript->GetAI = &GetAI_npc_wounded_blood_elf; - newscript->pQuestAccept = &QuestAccept_npc_wounded_blood_elf; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_fel_guard_hound"; - newscript->GetAI = &GetAI_npc_fel_guard_hound; - newscript->RegisterSelf(); + new npc_aeranas(); + new npc_ancestral_wolf(); + new go_haaleshi_altar(); + new npc_naladu(); + new npc_tracy_proudwell(); + new npc_trollbane(); + new npc_wounded_blood_elf(); + new npc_fel_guard_hound(); } - diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index b4c8b76c557..660ae4453cb 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -41,41 +41,48 @@ EndContentData */ /*###### ## mob_shattered_rumbler - this should be done with ACID ######*/ - -struct mob_shattered_rumblerAI : public ScriptedAI + class mob_shattered_rumbler : public CreatureScript { - bool Spawn; +public: + mob_shattered_rumbler() : CreatureScript("mob_shattered_rumbler") { } - mob_shattered_rumblerAI(Creature *c) : ScriptedAI(c) {} - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Spawn = false; + return new mob_shattered_rumblerAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + struct mob_shattered_rumblerAI : public ScriptedAI { - if (Spellkind->Id == 32001 && !Spawn) + bool Spawn; + + mob_shattered_rumblerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { - float x = me->GetPositionX(); - float y = me->GetPositionY(); - float z = me->GetPositionZ(); - - Hitter->SummonCreature(18181,x+(0.7 * (rand()%30)),y+(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - Hitter->SummonCreature(18181,x+(rand()%5),y-(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - Hitter->SummonCreature(18181,x-(rand()%5),y+(0.5 *(rand()%60)),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); - me->setDeathState(CORPSE); - Spawn = true; + Spawn = false; } - return; - } + + void EnterCombat(Unit* /*who*/) {} + + void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + { + if (Spellkind->Id == 32001 && !Spawn) + { + float x = me->GetPositionX(); + float y = me->GetPositionY(); + float z = me->GetPositionZ(); + + Hitter->SummonCreature(18181,x+(0.7 * (rand()%30)),y+(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + Hitter->SummonCreature(18181,x+(rand()%5),y-(rand()%5),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + Hitter->SummonCreature(18181,x-(rand()%5),y+(0.5 *(rand()%60)),z,0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,60000); + me->setDeathState(CORPSE); + Spawn = true; + } + return; + } + }; + }; -CreatureAI* GetAI_mob_shattered_rumbler(Creature* pCreature) -{ - return new mob_shattered_rumblerAI (pCreature); -} /*###### ## mob_lump @@ -93,169 +100,185 @@ CreatureAI* GetAI_mob_shattered_rumbler(Creature* pCreature) #define GOSSIP_SL1 "Why are Boulderfist out this far? You know that this is Kurenai territory." #define GOSSIP_SL2 "And you think you can just eat anything you want? You're obviously trying to eat the Broken of Telaar." #define GOSSIP_SL3 "This means war, Lump! War I say!" - -struct mob_lumpAI : public ScriptedAI + class mob_lump : public CreatureScript { - mob_lumpAI(Creature *c) : ScriptedAI(c) +public: + mob_lump() : CreatureScript("mob_lump") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - bReset = false; - } - - uint32 Reset_Timer; - uint32 Spear_Throw_Timer; - bool bReset; - - void Reset() - { - Reset_Timer = 60000; - Spear_Throw_Timer = 2000; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit *done_by, uint32 & damage) - { - if (done_by->GetTypeId() == TYPEID_PLAYER && (me->GetHealth() - damage)*100 / me->GetMaxHealth() < 30) + switch (uiAction) { - if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - { - //Take 0 damage - damage = 0; - - CAST_PLR(done_by)->AttackStop(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - me->setFaction(1080); //friendly - me->SetStandState(UNIT_STAND_STATE_SIT); - DoScriptText(LUMP_DEFEAT, me); - - bReset = true; - } + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(9353, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(9354, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(9355, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->SEND_GOSSIP_MENU(9356, pCreature->GetGUID()); + pPlayer->TalkedToCreature(18354, pCreature->GetGUID()); + break; } + return true; } - void EnterCombat(Unit * /*who*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (me->HasAura(SPELL_VISUAL_SLEEP)) - me->RemoveAura(SPELL_VISUAL_SLEEP); + if (pPlayer->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - if (!me->IsStandState()) - me->SetStandState(UNIT_STAND_STATE_STAND); + pPlayer->SEND_GOSSIP_MENU(9352, pCreature->GetGUID()); - DoScriptText(RAND(LUMP_SAY0,LUMP_SAY1), me); + return true; } - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - //check if we waiting for a reset - if (bReset) + return new mob_lumpAI(pCreature); + } + + struct mob_lumpAI : public ScriptedAI + { + mob_lumpAI(Creature *c) : ScriptedAI(c) { - if (Reset_Timer <= diff) - { - EnterEvadeMode(); - bReset = false; - me->setFaction(1711); //hostile + bReset = false; + } + + uint32 Reset_Timer; + uint32 Spear_Throw_Timer; + bool bReset; + + void Reset() + { + Reset_Timer = 60000; + Spear_Throw_Timer = 2000; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) return; - } - else Reset_Timer -= diff; + + if (me->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); } - //Return since we have no target - if (!UpdateVictim()) - return; - - //Spear_Throw_Timer - if (Spear_Throw_Timer <= diff) + void DamageTaken(Unit *done_by, uint32 & damage) { - DoCast(me->getVictim(), SPELL_SPEAR_THROW); - Spear_Throw_Timer = 20000; - } else Spear_Throw_Timer -= diff; + if (done_by->GetTypeId() == TYPEID_PLAYER && (me->GetHealth() - damage)*100 / me->GetMaxHealth() < 30) + { + if (!bReset && CAST_PLR(done_by)->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) + { + //Take 0 damage + damage = 0; + + CAST_PLR(done_by)->AttackStop(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + me->setFaction(1080); //friendly + me->SetStandState(UNIT_STAND_STATE_SIT); + DoScriptText(LUMP_DEFEAT, me); + + bReset = true; + } + } + } + + void EnterCombat(Unit * /*who*/) + { + if (me->HasAura(SPELL_VISUAL_SLEEP)) + me->RemoveAura(SPELL_VISUAL_SLEEP); + + if (!me->IsStandState()) + me->SetStandState(UNIT_STAND_STATE_STAND); + + DoScriptText(RAND(LUMP_SAY0,LUMP_SAY1), me); + } + + void UpdateAI(const uint32 diff) + { + //check if we waiting for a reset + if (bReset) + { + if (Reset_Timer <= diff) + { + EnterEvadeMode(); + bReset = false; + me->setFaction(1711); //hostile + return; + } + else Reset_Timer -= diff; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //Spear_Throw_Timer + if (Spear_Throw_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SPEAR_THROW); + Spear_Throw_Timer = 20000; + } else Spear_Throw_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_lump(Creature* pCreature) -{ - return new mob_lumpAI(pCreature); -} -bool GossipHello_mob_lump(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(9918) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9352, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_mob_lump(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(9353, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(9354, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(9355, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->SEND_GOSSIP_MENU(9356, pCreature->GetGUID()); - pPlayer->TalkedToCreature(18354, pCreature->GetGUID()); - break; - } - return true; -} /*#### # mob_sunspring_villager - should be done with ACID ####*/ - -struct mob_sunspring_villagerAI : public ScriptedAI + class mob_sunspring_villager : public CreatureScript { - mob_sunspring_villagerAI(Creature *c) : ScriptedAI(c) {} +public: + mob_sunspring_villager() : CreatureScript("mob_sunspring_villager") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - me->SetStandState(UNIT_STAND_STATE_DEAD); + return new mob_sunspring_villagerAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + struct mob_sunspring_villagerAI : public ScriptedAI { - if (spell->Id == 32146) + mob_sunspring_villagerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); + me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); + me->SetStandState(UNIT_STAND_STATE_DEAD); } - } + + void EnterCombat(Unit * /*who*/) {} + + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) + { + if (spell->Id == 32146) + { + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } + } + }; + }; -CreatureAI* GetAI_mob_sunspring_villager(Creature* pCreature) -{ - return new mob_sunspring_villagerAI (pCreature); -} /*###### ## npc_altruis_the_sufferer @@ -271,83 +294,91 @@ CreatureAI* GetAI_mob_sunspring_villager(Creature* pCreature) #define GOSSIP_SATS4 "Forge camps?" #define GOSSIP_SATS5 "Ok." #define GOSSIP_SATS6 "[PH] Story done" - -bool GossipHello_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature) + class npc_altruis_the_sufferer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_altruis_the_sufferer() : CreatureScript("npc_altruis_the_sufferer") { } - //gossip before obtaining Survey the Land - if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_NONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); - - //gossip when Survey the Land is incomplete (technically, after the flight) - if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - - //wowwiki.com/Varedis - if (pPlayer->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); - - pPlayer->SEND_GOSSIP_MENU(9419, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_altruis_the_sufferer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnQuestAccept(Player* pPlayer, Creature* /*pCreature*/, Quest const * /*quest*/) { - case GOSSIP_ACTION_INFO_DEF+10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(9420, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+11: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(9421, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+12: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - pPlayer->SEND_GOSSIP_MENU(9422, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+13: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - pPlayer->SEND_GOSSIP_MENU(9423, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+14: - pPlayer->SEND_GOSSIP_MENU(9424, pCreature->GetGUID()); - break; - - case GOSSIP_ACTION_INFO_DEF+20: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - pPlayer->SEND_GOSSIP_MENU(9427, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: + if (!pPlayer->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991 + { pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(9991); - break; - - case GOSSIP_ACTION_INFO_DEF+30: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); - pPlayer->SEND_GOSSIP_MENU(384, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+31: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(10646); - break; + pPlayer->ActivateTaxiPathTo(532); //TaxiPath 532 + } + return true; } - return true; -} -bool QuestAccept_npc_altruis_the_sufferer(Player* pPlayer, Creature* /*pCreature*/, Quest const * /*quest*/) -{ - if (!pPlayer->GetQuestRewardStatus(9991)) //Survey the Land, q-id 9991 + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->ActivateTaxiPathTo(532); //TaxiPath 532 + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(9420, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+11: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + pPlayer->SEND_GOSSIP_MENU(9421, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+12: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + pPlayer->SEND_GOSSIP_MENU(9422, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+13: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + pPlayer->SEND_GOSSIP_MENU(9423, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+14: + pPlayer->SEND_GOSSIP_MENU(9424, pCreature->GetGUID()); + break; + + case GOSSIP_ACTION_INFO_DEF+20: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + pPlayer->SEND_GOSSIP_MENU(9427, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+21: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(9991); + break; + + case GOSSIP_ACTION_INFO_DEF+30: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SATS6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); + pPlayer->SEND_GOSSIP_MENU(384, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+31: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(10646); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + //gossip before obtaining Survey the Land + if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_NONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+10); + + //gossip when Survey the Land is incomplete (technically, after the flight) + if (pPlayer->GetQuestStatus(9991) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); + + //wowwiki.com/Varedis + if (pPlayer->GetQuestStatus(10646) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HATS3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+30); + + pPlayer->SEND_GOSSIP_MENU(9419, pCreature->GetGUID()); + + return true; + } + +}; + + /*###### ## npc_greatmother_geyah @@ -368,89 +399,96 @@ bool QuestAccept_npc_altruis_the_sufferer(Player* pPlayer, Creature* /*pCreature #define GOSSIP_SGG10 "It is my Warchief, Greatmother. The leader of my people. From my world. He ... He is the son of Durotan. He is your grandchild." #define GOSSIP_SGG11 "I will return to Azeroth at once, Greatmother." -//all the textId's for the below is unknown, but i do believe the gossip item texts are proper. -bool GossipHello_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature) +//all the textId's for the below is unknown, but i do believe the gossip item texts are proper. class npc_greatmother_geyah : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_greatmother_geyah() : CreatureScript("npc_greatmother_geyah") { } - if (pPlayer->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 7: + pPlayer->AreaExploredOrEventHappens(10044); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + + case GOSSIP_ACTION_INFO_DEF + 10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 11: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 12: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 13: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 14: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 15: + pPlayer->AreaExploredOrEventHappens(10172); + pPlayer->CLOSE_GOSSIP_MENU(); + break; + } + return true; } - else if (pPlayer->GetQuestStatus(10172) == QUEST_STATUS_INCOMPLETE) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(10044) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + else if (pPlayer->GetQuestStatus(10172) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 10); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + else + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); +}; - return true; -} - -bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 7: - pPlayer->AreaExploredOrEventHappens(10044); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - - case GOSSIP_ACTION_INFO_DEF + 10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 11: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG8, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 12: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG9, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 13: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG10, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 14: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SGG11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 15); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 15: - pPlayer->AreaExploredOrEventHappens(10172); - pPlayer->CLOSE_GOSSIP_MENU(); - break; - } - return true; -} /*###### ## npc_lantresor_of_the_blade @@ -464,62 +502,69 @@ bool GossipSelect_npc_greatmother_geyah(Player* pPlayer, Creature* pCreature, ui #define GOSSIP_SLB5 "My people ask that you pull back your Boulderfist ogres and cease all attacks on our territories. In return, we will also pull back our forces." #define GOSSIP_SLB6 "We will fight you until the end, then, Lantresor. We will not stand idly by as you pillage our towns and kill our people." #define GOSSIP_SLB7 "What do I need to do?" - -bool GossipHello_npc_lantresor_of_the_blade(Player* pPlayer, Creature* pCreature) + class npc_lantresor_of_the_blade : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lantresor_of_the_blade() : CreatureScript("npc_lantresor_of_the_blade") { } - if (pPlayer->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(9361, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_lantresor_of_the_blade(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(9362, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(9363, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(9364, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(9365, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(9366, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(9367, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); - pPlayer->SEND_GOSSIP_MENU(9368, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->SEND_GOSSIP_MENU(9369, pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(10107); - if (pPlayer->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(10108); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(9362, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(9363, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(9364, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(9365, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(9366, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(9367, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SLB7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); + pPlayer->SEND_GOSSIP_MENU(9368, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->SEND_GOSSIP_MENU(9369, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(10107); + if (pPlayer->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(10108); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(10107) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10108) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HLB, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(9361, pCreature->GetGUID()); + + return true; + } + +}; + /*##### ## npc_maghar_captive @@ -550,178 +595,193 @@ enum eMagharCaptive static float m_afAmbushA[]= {-1568.805786, 8533.873047, 1.958}; static float m_afAmbushB[]= {-1491.554321, 8506.483398, 1.248}; - -struct npc_maghar_captiveAI : public npc_escortAI + class npc_maghar_captive : public CreatureScript { - npc_maghar_captiveAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); } +public: + npc_maghar_captive() : CreatureScript("npc_maghar_captive") { } - uint32 m_uiChainLightningTimer; - uint32 m_uiHealTimer; - uint32 m_uiFrostShockTimer; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_uiChainLightningTimer = 1000; - m_uiHealTimer = 0; - m_uiFrostShockTimer = 6000; - } - - void EnterCombat(Unit* /*pWho*/) - { - DoCast(me, SPELL_EARTHBIND_TOTEM, false); - } - - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_TOTEM_KARDASH_H) { - case 7: - DoScriptText(SAY_MAG_MORE, me); + if (npc_maghar_captiveAI* pEscortAI = dynamic_cast(pCreature->AI())) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + pCreature->setFaction(232); - if (Creature* pTemp = me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0], m_afAmbushB[1], m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) - DoScriptText(SAY_MAG_MORE_REPLY, pTemp); + pEscortAI->Start(true, false, pPlayer->GetGUID(), pQuest); - me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_MAG_START, pCreature); - me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 16: - DoScriptText(SAY_MAG_COMPLETE, me); - - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_TOTEM_KARDASH_H, me); - - SetRun(); - break; + pCreature->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0]+2.5f, m_afAmbushA[1]-2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + pCreature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0]-2.5f, m_afAmbushA[1]+2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + pCreature->SummonCreature(NPC_MURK_BRUTE, m_afAmbushA[0], m_afAmbushA[1], m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + } } + return true; } - void JustSummoned(Creature* pSummoned) + CreatureAI* GetAI(Creature* pCreature) const { - if (pSummoned->GetEntry() == NPC_MURK_BRUTE) - DoScriptText(SAY_MAG_NO_ESCAPE, pSummoned); - - if (pSummoned->isTotem()) - return; - - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - pSummoned->AI()->AttackStart(me); - + return new npc_maghar_captiveAI(pCreature); } - void SpellHitTarget(Unit* /*pTarget*/, const SpellEntry* pSpell) + struct npc_maghar_captiveAI : public npc_escortAI { - if (pSpell->Id == SPELL_CHAIN_LIGHTNING) + npc_maghar_captiveAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); } + + uint32 m_uiChainLightningTimer; + uint32 m_uiHealTimer; + uint32 m_uiFrostShockTimer; + + void Reset() { - if (rand()%10) + m_uiChainLightningTimer = 1000; + m_uiHealTimer = 0; + m_uiFrostShockTimer = 6000; + } + + void EnterCombat(Unit* /*pWho*/) + { + DoCast(me, SPELL_EARTHBIND_TOTEM, false); + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 7: + DoScriptText(SAY_MAG_MORE, me); + + if (Creature* pTemp = me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0], m_afAmbushB[1], m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000)) + DoScriptText(SAY_MAG_MORE_REPLY, pTemp); + + me->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushB[0]-2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + + me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]+2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_MURK_SCAVENGER, m_afAmbushB[0]+2.5f, m_afAmbushB[1]-2.5f, m_afAmbushB[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 16: + DoScriptText(SAY_MAG_COMPLETE, me); + + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_TOTEM_KARDASH_H, me); + + SetRun(); + break; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_MURK_BRUTE) + DoScriptText(SAY_MAG_NO_ESCAPE, pSummoned); + + if (pSummoned->isTotem()) return; - DoScriptText(SAY_MAG_LIGHTNING, me); + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + pSummoned->AI()->AttackStart(me); + } - } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - if (!me->getVictim()) - return; - - if (m_uiChainLightningTimer <= uiDiff) + void SpellHitTarget(Unit* /*pTarget*/, const SpellEntry* pSpell) { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - m_uiChainLightningTimer = urand(7000, 14000); - } - else - m_uiChainLightningTimer -= uiDiff; - - if (me->GetHealth()*100 < me->GetMaxHealth()*30) - { - if (m_uiHealTimer <= uiDiff) + if (pSpell->Id == SPELL_CHAIN_LIGHTNING) { - DoCast(me, SPELL_HEALING_WAVE); - m_uiHealTimer = 5000; + if (rand()%10) + return; + + DoScriptText(SAY_MAG_LIGHTNING, me); + } + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + if (!me->getVictim()) + return; + + if (m_uiChainLightningTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + m_uiChainLightningTimer = urand(7000, 14000); } else - m_uiHealTimer -= uiDiff; - } + m_uiChainLightningTimer -= uiDiff; - if (m_uiFrostShockTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - m_uiFrostShockTimer = urand(7500, 15000); - } - else - m_uiFrostShockTimer -= uiDiff; + if (me->GetHealth()*100 < me->GetMaxHealth()*30) + { + if (m_uiHealTimer <= uiDiff) + { + DoCast(me, SPELL_HEALING_WAVE); + m_uiHealTimer = 5000; + } + else + m_uiHealTimer -= uiDiff; + } + + if (m_uiFrostShockTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + m_uiFrostShockTimer = urand(7500, 15000); + } + else + m_uiFrostShockTimer -= uiDiff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool QuestAccept_npc_maghar_captive(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOTEM_KARDASH_H) - { - if (npc_maghar_captiveAI* pEscortAI = dynamic_cast(pCreature->AI())) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - pCreature->setFaction(232); - pEscortAI->Start(true, false, pPlayer->GetGUID(), pQuest); - - DoScriptText(SAY_MAG_START, pCreature); - - pCreature->SummonCreature(NPC_MURK_RAIDER, m_afAmbushA[0]+2.5f, m_afAmbushA[1]-2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - pCreature->SummonCreature(NPC_MURK_PUTRIFIER, m_afAmbushA[0]-2.5f, m_afAmbushA[1]+2.5f, m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - pCreature->SummonCreature(NPC_MURK_BRUTE, m_afAmbushA[0], m_afAmbushA[1], m_afAmbushA[2], 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - } - } - return true; -} - -CreatureAI* GetAI_npc_maghar_captive(Creature* pCreature) -{ - return new npc_maghar_captiveAI(pCreature); -} /*###### ## npc_creditmarker_visist_with_ancestors ######*/ - -struct npc_creditmarker_visit_with_ancestorsAI : public ScriptedAI + class npc_creditmarker_visit_with_ancestors : public CreatureScript { - npc_creditmarker_visit_with_ancestorsAI(Creature* c) : ScriptedAI(c) {} +public: + npc_creditmarker_visit_with_ancestors() : CreatureScript("npc_creditmarker_visit_with_ancestors") { } - void Reset() {} - - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) + CreatureAI* GetAI(Creature* pCreature) const { - if (!who) - return; + return new npc_creditmarker_visit_with_ancestorsAI (pCreature); + } - if (who->GetTypeId() == TYPEID_PLAYER) + struct npc_creditmarker_visit_with_ancestorsAI : public ScriptedAI + { + npc_creditmarker_visit_with_ancestorsAI(Creature* c) : ScriptedAI(c) {} + + void Reset() {} + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) { - if (CAST_PLR(who)->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE) + if (!who) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) { - uint32 creditMarkerId = me->GetEntry(); - if ((creditMarkerId >= 18840) && (creditMarkerId <= 18843)) + if (CAST_PLR(who)->GetQuestStatus(10085) == QUEST_STATUS_INCOMPLETE) { - // 18840: Sunspring, 18841: Laughing, 18842: Garadar, 18843: Bleeding - if (!CAST_PLR(who)->GetReqKillOrCastCurrentCount(10085, creditMarkerId)) - CAST_PLR(who)->KilledMonsterCredit(creditMarkerId, me->GetGUID()); + uint32 creditMarkerId = me->GetEntry(); + if ((creditMarkerId >= 18840) && (creditMarkerId <= 18843)) + { + // 18840: Sunspring, 18841: Laughing, 18842: Garadar, 18843: Bleeding + if (!CAST_PLR(who)->GetReqKillOrCastCurrentCount(10085, creditMarkerId)) + CAST_PLR(who)->KilledMonsterCredit(creditMarkerId, me->GetGUID()); + } } } } - } + }; + }; -CreatureAI* GetAI_npc_creditmarker_visit_with_ancestors(Creature* pCreature) -{ - return new npc_creditmarker_visit_with_ancestorsAI (pCreature); -} /*###### ## mob_sparrowhawk @@ -729,101 +789,108 @@ CreatureAI* GetAI_npc_creditmarker_visit_with_ancestors(Creature* pCreature) #define SPELL_SPARROWHAWK_NET 39810 #define SPELL_ITEM_CAPTIVE_SPARROWHAWK 39812 - -struct mob_sparrowhawkAI : public ScriptedAI + class mob_sparrowhawk : public CreatureScript { +public: + mob_sparrowhawk() : CreatureScript("mob_sparrowhawk") { } - mob_sparrowhawkAI(Creature *c) : ScriptedAI(c) {} - - uint32 Check_Timer; - uint64 PlayerGUID; - bool fleeing; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET); - Check_Timer = 1000; - PlayerGUID = 0; - fleeing = false; - } - void AttackStart(Unit *who) - { - if (PlayerGUID) - return; - - ScriptedAI::AttackStart(who); + return new mob_sparrowhawkAI (pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) + struct mob_sparrowhawkAI : public ScriptedAI { - if (!who || PlayerGUID) - return; - if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) + mob_sparrowhawkAI(Creature *c) : ScriptedAI(c) {} + + uint32 Check_Timer; + uint64 PlayerGUID; + bool fleeing; + + void Reset() { - PlayerGUID = who->GetGUID(); - return; + me->RemoveAurasDueToSpell(SPELL_SPARROWHAWK_NET); + Check_Timer = 1000; + PlayerGUID = 0; + fleeing = false; } - - ScriptedAI::MoveInLineOfSight(who); - } - - void UpdateAI(const uint32 diff) - { - if (Check_Timer <= diff) + void AttackStart(Unit *who) { if (PlayerGUID) - { - if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) - fleeing = false; + return; - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && me->IsWithinDistInMap(pPlayer, 30)) + ScriptedAI::AttackStart(who); + } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) + { + if (!who || PlayerGUID) + return; + + if (!PlayerGUID && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 30) && CAST_PLR(who)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + return; + } + + ScriptedAI::MoveInLineOfSight(who); + } + + void UpdateAI(const uint32 diff) + { + if (Check_Timer <= diff) + { + if (PlayerGUID) { - if (!fleeing) + if (fleeing && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != FLEEING_MOTION_TYPE) + fleeing = false; + + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && me->IsWithinDistInMap(pPlayer, 30)) { - me->DeleteThreatList(); - me->GetMotionMaster()->MoveFleeing(pPlayer); - fleeing = true; + if (!fleeing) + { + me->DeleteThreatList(); + me->GetMotionMaster()->MoveFleeing(pPlayer); + fleeing = true; + } + } + else if (fleeing) + { + me->GetMotionMaster()->MovementExpired(false); + PlayerGUID = 0; + fleeing = false; } } - else if (fleeing) + Check_Timer = 1000; + } else Check_Timer -= diff; + + if (PlayerGUID) + return; + + ScriptedAI::UpdateAI(diff); + } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (caster->GetTypeId() == TYPEID_PLAYER) + { + if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) { - me->GetMotionMaster()->MovementExpired(false); - PlayerGUID = 0; - fleeing = false; + DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true); + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); } } - Check_Timer = 1000; - } else Check_Timer -= diff; - - if (PlayerGUID) return; - - ScriptedAI::UpdateAI(diff); - } - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - if (spell->Id == SPELL_SPARROWHAWK_NET && CAST_PLR(caster)->GetQuestStatus(10987) == QUEST_STATUS_INCOMPLETE) - { - DoCast(caster, SPELL_ITEM_CAPTIVE_SPARROWHAWK, true); - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - } } - return; - } + }; + }; -CreatureAI* GetAI_mob_sparrowhawk(Creature* pCreature) -{ - return new mob_sparrowhawkAI (pCreature); -} /*#### # @@ -831,58 +898,13 @@ CreatureAI* GetAI_mob_sparrowhawk(Creature* pCreature) void AddSC_nagrand() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_shattered_rumbler"; - newscript->GetAI = &GetAI_mob_shattered_rumbler; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_lump"; - newscript->GetAI = &GetAI_mob_lump; - newscript->pGossipHello = &GossipHello_mob_lump; - newscript->pGossipSelect = &GossipSelect_mob_lump; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_sunspring_villager"; - newscript->GetAI = &GetAI_mob_sunspring_villager; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_altruis_the_sufferer"; - newscript->pGossipHello = &GossipHello_npc_altruis_the_sufferer; - newscript->pGossipSelect = &GossipSelect_npc_altruis_the_sufferer; - newscript->pQuestAccept = &QuestAccept_npc_altruis_the_sufferer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_greatmother_geyah"; - newscript->pGossipHello = &GossipHello_npc_greatmother_geyah; - newscript->pGossipSelect = &GossipSelect_npc_greatmother_geyah; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lantresor_of_the_blade"; - newscript->pGossipHello = &GossipHello_npc_lantresor_of_the_blade; - newscript->pGossipSelect = &GossipSelect_npc_lantresor_of_the_blade; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_maghar_captive"; - newscript->GetAI = &GetAI_npc_maghar_captive; - newscript->pQuestAccept = &QuestAccept_npc_maghar_captive; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_creditmarker_visit_with_ancestors"; - newscript->GetAI = &GetAI_npc_creditmarker_visit_with_ancestors; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_sparrowhawk"; - newscript->GetAI = &GetAI_mob_sparrowhawk; - newscript->RegisterSelf(); + new mob_shattered_rumbler(); + new mob_lump(); + new mob_sunspring_villager(); + new npc_altruis_the_sufferer(); + new npc_greatmother_geyah(); + new npc_lantresor_of_the_blade(); + new npc_maghar_captive(); + new npc_creditmarker_visit_with_ancestors(); + new mob_sparrowhawk(); } - diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 5a8f02186af..a4648614614 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -60,278 +60,291 @@ EndContentData */ #define SPELL_DISABLE_VISUAL 35031 #define SPELL_INTERRUPT_1 35016 //ACID mobs should cast this #define SPELL_INTERRUPT_2 35176 //ACID mobs should cast this (Manaforge Ara-version) - -struct npc_manaforge_control_consoleAI : public ScriptedAI + class npc_manaforge_control_console : public CreatureScript { - npc_manaforge_control_consoleAI(Creature *c) : ScriptedAI(c) {} +public: + npc_manaforge_control_console() : CreatureScript("npc_manaforge_control_console") { } - uint32 Event_Timer; - uint32 Wave_Timer; - uint32 Phase; - bool Wave; - uint64 someplayer; - uint64 goConsole; - Creature* add; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Event_Timer = 3000; - Wave_Timer = 0; - Phase = 1; - Wave = false; - someplayer = 0; - goConsole = 0; - add = NULL; + return new npc_manaforge_control_consoleAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - /*void SpellHit(Unit *caster, const SpellEntry *spell) + struct npc_manaforge_control_consoleAI : public ScriptedAI { - //we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds - //then no way for the mobs to actually stop the shutdown as intended. - if (spell->Id == SPELL_INTERRUPT_1) - DoSay("Silence! I kill you!",LANG_UNIVERSAL, NULL); - }*/ + npc_manaforge_control_consoleAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* /*killer*/) - { - DoScriptText(EMOTE_ABORT, me); + uint32 Event_Timer; + uint32 Wave_Timer; + uint32 Phase; + bool Wave; + uint64 someplayer; + uint64 goConsole; + Creature* add; - if (someplayer) + void Reset() { - Unit* p = Unit::GetUnit((*me),someplayer); - if (p && p->GetTypeId() == TYPEID_PLAYER) + Event_Timer = 3000; + Wave_Timer = 0; + Phase = 1; + Wave = false; + someplayer = 0; + goConsole = 0; + add = NULL; + } + + void EnterCombat(Unit * /*who*/) {} + + /*void SpellHit(Unit *caster, const SpellEntry *spell) + { + //we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds + //then no way for the mobs to actually stop the shutdown as intended. + if (spell->Id == SPELL_INTERRUPT_1) + DoSay("Silence! I kill you!",LANG_UNIVERSAL, NULL); + }*/ + + void JustDied(Unit* /*killer*/) + { + DoScriptText(EMOTE_ABORT, me); + + if (someplayer) { - switch(me->GetEntry()) + Unit* p = Unit::GetUnit((*me),someplayer); + if (p && p->GetTypeId() == TYPEID_PLAYER) { - case ENTRY_BNAAR_C_CONSOLE: - CAST_PLR(p)->FailQuest(10299); - CAST_PLR(p)->FailQuest(10329); - break; - case ENTRY_CORUU_C_CONSOLE: - CAST_PLR(p)->FailQuest(10321); - CAST_PLR(p)->FailQuest(10330); - break; - case ENTRY_DURO_C_CONSOLE: - CAST_PLR(p)->FailQuest(10322); - CAST_PLR(p)->FailQuest(10338); - break; - case ENTRY_ARA_C_CONSOLE: - CAST_PLR(p)->FailQuest(10323); - CAST_PLR(p)->FailQuest(10365); - break; + switch(me->GetEntry()) + { + case ENTRY_BNAAR_C_CONSOLE: + CAST_PLR(p)->FailQuest(10299); + CAST_PLR(p)->FailQuest(10329); + break; + case ENTRY_CORUU_C_CONSOLE: + CAST_PLR(p)->FailQuest(10321); + CAST_PLR(p)->FailQuest(10330); + break; + case ENTRY_DURO_C_CONSOLE: + CAST_PLR(p)->FailQuest(10322); + CAST_PLR(p)->FailQuest(10338); + break; + case ENTRY_ARA_C_CONSOLE: + CAST_PLR(p)->FailQuest(10323); + CAST_PLR(p)->FailQuest(10365); + break; + } } } + + if (goConsole) + { + if (GameObject* pGo = GameObject::GetGameObject((*me),goConsole)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } } - if (goConsole) + void DoWaveSpawnForCreature(Creature* pCreature) { - if (GameObject* pGo = GameObject::GetGameObject((*me),goConsole)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - } - } - - void DoWaveSpawnForCreature(Creature* pCreature) - { - switch(pCreature->GetEntry()) - { - case ENTRY_BNAAR_C_CONSOLE: - if (rand()%2) - { - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2933.68,4162.55,164.00,1.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2927.36,4212.97,164.00); - } - else - { - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2927.36,4212.97,164.00,4.94,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2933.68,4162.55,164.00); - } - Wave_Timer = 30000; - break; - case ENTRY_CORUU_C_CONSOLE: - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2445.21,2765.26,134.49,3.93,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2424.21,2740.15,133.81); - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2429.86,2731.85,134.53,1.31,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2435.37,2766.04,133.81); - Wave_Timer = 20000; - break; - case ENTRY_DURO_C_CONSOLE: - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2986.80,2205.36,165.37,3.74,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2985.15,2197.32,164.79); - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2952.91,2191.20,165.32,0.22,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2060.01,2185.27,164.67); - Wave_Timer = 15000; - break; - case ENTRY_ARA_C_CONSOLE: - if (rand()%2) - { - add = me->SummonCreature(ENTRY_ARA_TECH,4035.11,4038.97,194.27,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); - add = me->SummonCreature(ENTRY_ARA_TECH,4033.66,4036.79,194.28,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); - add = me->SummonCreature(ENTRY_ARA_TECH,4037.13,4037.30,194.23,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); - } - else - { - add = me->SummonCreature(ENTRY_ARA_TECH,3099.59,4049.30,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); - add = me->SummonCreature(ENTRY_ARA_TECH,3999.72,4046.75,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); - add = me->SummonCreature(ENTRY_ARA_TECH,3996.81,4048.26,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); - } - Wave_Timer = 15000; - break; - } - } - void DoFinalSpawnForCreature(Creature* pCreature) - { - switch(pCreature->GetEntry()) - { - case ENTRY_BNAAR_C_CONSOLE: - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2946.52,4201.42,163.47,3.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2927.49,4192.81,163.00); - break; - case ENTRY_CORUU_C_CONSOLE: - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2453.88,2737.85,133.27,2.59,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2441.62,2735.32,134.49,1.97,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2450.73,2754.50,134.49,3.29,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); - break; - case ENTRY_DURO_C_CONSOLE: - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2956.18,2202.85,165.32,5.45,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); - add = me->SummonCreature(ENTRY_SUNFURY_TECH,2975.30,2211.50,165.32,4.55,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); - add = me->SummonCreature(ENTRY_SUNFURY_PROT,2965.02,2217.45,164.16,4.96,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); - break; - case ENTRY_ARA_C_CONSOLE: - add = me->SummonCreature(ENTRY_ARA_ENGI,3994.51,4020.46,192.18,0.91,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4008.35,4035.04,192.70); - add = me->SummonCreature(ENTRY_ARA_GORKLONN,4021.56,4059.35,193.59,4.44,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (add) add->GetMotionMaster()->MovePoint(0,4016.62,4039.89,193.46); - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (Event_Timer <= diff) - { - switch(Phase) + switch(pCreature->GetEntry()) { - case 1: - if (someplayer) + case ENTRY_BNAAR_C_CONSOLE: + if (rand()%2) { - Unit* u = Unit::GetUnit((*me), someplayer); - if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2933.68,4162.55,164.00,1.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2927.36,4212.97,164.00); } - Event_Timer = 60000; - Wave = true; - ++Phase; - break; - case 2: - DoScriptText(EMOTE_60, me); - Event_Timer = 30000; - ++Phase; - break; - case 3: - DoScriptText(EMOTE_30, me); - Event_Timer = 20000; - DoFinalSpawnForCreature(me); - ++Phase; - break; - case 4: - DoScriptText(EMOTE_10, me); - Event_Timer = 10000; - Wave = false; - ++Phase; - break; - case 5: - DoScriptText(EMOTE_COMPLETE, me); - if (someplayer) + else { - Unit* u = Unit::GetUnit((*me),someplayer); - if (u && u->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); - DoCast(me, SPELL_DISABLE_VISUAL); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2927.36,4212.97,164.00,4.94,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2933.68,4162.55,164.00); } - if (goConsole) + Wave_Timer = 30000; + break; + case ENTRY_CORUU_C_CONSOLE: + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2445.21,2765.26,134.49,3.93,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2424.21,2740.15,133.81); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2429.86,2731.85,134.53,1.31,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2435.37,2766.04,133.81); + Wave_Timer = 20000; + break; + case ENTRY_DURO_C_CONSOLE: + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2986.80,2205.36,165.37,3.74,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2985.15,2197.32,164.79); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2952.91,2191.20,165.32,0.22,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2060.01,2185.27,164.67); + Wave_Timer = 15000; + break; + case ENTRY_ARA_C_CONSOLE: + if (rand()%2) { - if (GameObject* pGo = GameObject::GetGameObject((*me),goConsole)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + add = me->SummonCreature(ENTRY_ARA_TECH,4035.11,4038.97,194.27,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); + add = me->SummonCreature(ENTRY_ARA_TECH,4033.66,4036.79,194.28,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); + add = me->SummonCreature(ENTRY_ARA_TECH,4037.13,4037.30,194.23,2.57,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4003.42,4040.19,193.49); } - ++Phase; + else + { + add = me->SummonCreature(ENTRY_ARA_TECH,3099.59,4049.30,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); + add = me->SummonCreature(ENTRY_ARA_TECH,3999.72,4046.75,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); + add = me->SummonCreature(ENTRY_ARA_TECH,3996.81,4048.26,194.22,0.05,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4028.01,4035.17,193.59); + } + Wave_Timer = 15000; break; } - } else Event_Timer -= diff; - - if (Wave) - { - if (Wave_Timer <= diff) - { - DoWaveSpawnForCreature(me); - } else Wave_Timer -= diff; } - } + void DoFinalSpawnForCreature(Creature* pCreature) + { + switch(pCreature->GetEntry()) + { + case ENTRY_BNAAR_C_CONSOLE: + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2946.52,4201.42,163.47,3.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2927.49,4192.81,163.00); + break; + case ENTRY_CORUU_C_CONSOLE: + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2453.88,2737.85,133.27,2.59,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2441.62,2735.32,134.49,1.97,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2450.73,2754.50,134.49,3.29,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2433.96,2751.53,133.85); + break; + case ENTRY_DURO_C_CONSOLE: + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2956.18,2202.85,165.32,5.45,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); + add = me->SummonCreature(ENTRY_SUNFURY_TECH,2975.30,2211.50,165.32,4.55,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); + add = me->SummonCreature(ENTRY_SUNFURY_PROT,2965.02,2217.45,164.16,4.96,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,2972.27,2193.22,164.48); + break; + case ENTRY_ARA_C_CONSOLE: + add = me->SummonCreature(ENTRY_ARA_ENGI,3994.51,4020.46,192.18,0.91,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4008.35,4035.04,192.70); + add = me->SummonCreature(ENTRY_ARA_GORKLONN,4021.56,4059.35,193.59,4.44,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (add) add->GetMotionMaster()->MovePoint(0,4016.62,4039.89,193.46); + break; + } + } + + void UpdateAI(const uint32 diff) + { + if (Event_Timer <= diff) + { + switch(Phase) + { + case 1: + if (someplayer) + { + Unit* u = Unit::GetUnit((*me), someplayer); + if (u && u->GetTypeId() == TYPEID_PLAYER) DoScriptText(EMOTE_START, me, u); + } + Event_Timer = 60000; + Wave = true; + ++Phase; + break; + case 2: + DoScriptText(EMOTE_60, me); + Event_Timer = 30000; + ++Phase; + break; + case 3: + DoScriptText(EMOTE_30, me); + Event_Timer = 20000; + DoFinalSpawnForCreature(me); + ++Phase; + break; + case 4: + DoScriptText(EMOTE_10, me); + Event_Timer = 10000; + Wave = false; + ++Phase; + break; + case 5: + DoScriptText(EMOTE_COMPLETE, me); + if (someplayer) + { + Unit* u = Unit::GetUnit((*me),someplayer); + if (u && u->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(u)->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); + DoCast(me, SPELL_DISABLE_VISUAL); + } + if (goConsole) + { + if (GameObject* pGo = GameObject::GetGameObject((*me),goConsole)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } + ++Phase; + break; + } + } else Event_Timer -= diff; + + if (Wave) + { + if (Wave_Timer <= diff) + { + DoWaveSpawnForCreature(me); + } else Wave_Timer -= diff; + } + } + }; + }; -CreatureAI* GetAI_npc_manaforge_control_console(Creature* pCreature) -{ - return new npc_manaforge_control_consoleAI (pCreature); -} /*###### ## go_manaforge_control_console ######*/ -//TODO: clean up this workaround when Trinity adds support to do it properly (with gossip selections instead of instant summon) -bool GOHello_go_manaforge_control_console(Player* pPlayer, GameObject* pGo) +//TODO: clean up this workaround when Trinity adds support to do it properly (with gossip selections instead of instant summon) class go_manaforge_control_console : public GameObjectScript { - if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) +public: + go_manaforge_control_console() : GameObjectScript("go_manaforge_control_console") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - pPlayer->PrepareQuestMenu(pGo->GetGUID()); - pPlayer->SendPreparedQuest(pGo->GetGUID()); + if (pGo->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + { + pPlayer->PrepareQuestMenu(pGo->GetGUID()); + pPlayer->SendPreparedQuest(pGo->GetGUID()); + } + + Creature* manaforge = NULL; + + switch(pGo->GetAreaId()) + { + case 3726: //b'naar + if ((pPlayer->GetQuestStatus(10299) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10329) == QUEST_STATUS_INCOMPLETE) && + pPlayer->HasItemCount(29366,1)) + manaforge = pPlayer->SummonCreature(ENTRY_BNAAR_C_CONSOLE,2918.95,4189.98,161.88,0.34,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); + break; + case 3730: //coruu + if ((pPlayer->GetQuestStatus(10321) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10330) == QUEST_STATUS_INCOMPLETE) && + pPlayer->HasItemCount(29396,1)) + manaforge = pPlayer->SummonCreature(ENTRY_CORUU_C_CONSOLE,2426.77,2750.38,133.24,2.14,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); + break; + case 3734: //duro + if ((pPlayer->GetQuestStatus(10322) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10338) == QUEST_STATUS_INCOMPLETE) && + pPlayer->HasItemCount(29397,1)) + manaforge = pPlayer->SummonCreature(ENTRY_DURO_C_CONSOLE,2976.48,2183.29,163.20,1.85,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); + break; + case 3722: //ara + if ((pPlayer->GetQuestStatus(10323) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10365) == QUEST_STATUS_INCOMPLETE) && + pPlayer->HasItemCount(29411,1)) + manaforge = pPlayer->SummonCreature(ENTRY_ARA_C_CONSOLE,4013.71,4028.76,192.10,1.25,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); + break; + } + + if (manaforge) + { + CAST_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = pPlayer->GetGUID(); + CAST_AI(npc_manaforge_control_console::npc_manaforge_control_consoleAI, manaforge->AI())->goConsole = pGo->GetGUID(); + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); + } + return true; } - Creature* manaforge = NULL; - - switch(pGo->GetAreaId()) - { - case 3726: //b'naar - if ((pPlayer->GetQuestStatus(10299) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10329) == QUEST_STATUS_INCOMPLETE) && - pPlayer->HasItemCount(29366,1)) - manaforge = pPlayer->SummonCreature(ENTRY_BNAAR_C_CONSOLE,2918.95,4189.98,161.88,0.34,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); - break; - case 3730: //coruu - if ((pPlayer->GetQuestStatus(10321) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10330) == QUEST_STATUS_INCOMPLETE) && - pPlayer->HasItemCount(29396,1)) - manaforge = pPlayer->SummonCreature(ENTRY_CORUU_C_CONSOLE,2426.77,2750.38,133.24,2.14,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); - break; - case 3734: //duro - if ((pPlayer->GetQuestStatus(10322) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10338) == QUEST_STATUS_INCOMPLETE) && - pPlayer->HasItemCount(29397,1)) - manaforge = pPlayer->SummonCreature(ENTRY_DURO_C_CONSOLE,2976.48,2183.29,163.20,1.85,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); - break; - case 3722: //ara - if ((pPlayer->GetQuestStatus(10323) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(10365) == QUEST_STATUS_INCOMPLETE) && - pPlayer->HasItemCount(29411,1)) - manaforge = pPlayer->SummonCreature(ENTRY_ARA_C_CONSOLE,4013.71,4028.76,192.10,1.25,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,125000); - break; - } - - if (manaforge) - { - CAST_AI(npc_manaforge_control_consoleAI, manaforge->AI())->someplayer = pPlayer->GetGUID(); - CAST_AI(npc_manaforge_control_consoleAI, manaforge->AI())->goConsole = pGo->GetGUID(); - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); - } - return true; -} +}; /*###### ## npc_commander_dawnforge @@ -360,80 +373,64 @@ const uint32 CreatureEntry[3] = 19831, // Dawnforge 21504 // Pathaleon }; - -struct npc_commander_dawnforgeAI : public ScriptedAI + class npc_commander_dawnforge : public CreatureScript { - npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); } +public: + npc_commander_dawnforge() : CreatureScript("npc_commander_dawnforge") { } - uint64 PlayerGUID; - uint64 ardonisGUID; - uint64 pathaleonGUID; - - uint32 Phase; - uint32 PhaseSubphase; - uint32 Phase_Timer; - bool isEvent; - - float angle_dawnforge; - float angle_ardonis; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; - ardonisGUID = 0; - pathaleonGUID = 0; - - Phase = 1; - PhaseSubphase = 0; - Phase_Timer = 4000; - isEvent = false; + return new npc_commander_dawnforgeAI(pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void JustSummoned(Creature *summoned) + struct npc_commander_dawnforgeAI : public ScriptedAI { - pathaleonGUID = summoned->GetGUID(); - } + npc_commander_dawnforgeAI(Creature *c) : ScriptedAI(c) { Reset (); } - // Emote Ardonis and Pathaleon - void Turn_to_Pathaleons_Image() - { - Creature *ardonis = Unit::GetCreature(*me,ardonisGUID); - Creature *pathaleon = Unit::GetCreature(*me,pathaleonGUID); - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + uint64 PlayerGUID; + uint64 ardonisGUID; + uint64 pathaleonGUID; - if (!ardonis || !pathaleon || !pPlayer) - return; + uint32 Phase; + uint32 PhaseSubphase; + uint32 Phase_Timer; + bool isEvent; - //Calculate the angle to Pathaleon - angle_dawnforge = me->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); - angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + float angle_dawnforge; + float angle_ardonis; - //Turn Dawnforge and update - me->SetOrientation(angle_dawnforge); - me->SendUpdateToPlayer(pPlayer); - //Turn Ardonis and update - ardonis->SetOrientation(angle_ardonis); - ardonis->SendUpdateToPlayer(pPlayer); - - //Set them to kneel - me->SetStandState(UNIT_STAND_STATE_KNEEL); - ardonis->SetStandState(UNIT_STAND_STATE_KNEEL); - } - - //Set them back to each other - void Turn_to_eachother() - { - if (Unit *ardonis = Unit::GetUnit(*me,ardonisGUID)) + void Reset() { + PlayerGUID = 0; + ardonisGUID = 0; + pathaleonGUID = 0; + + Phase = 1; + PhaseSubphase = 0; + Phase_Timer = 4000; + isEvent = false; + } + + void EnterCombat(Unit * /*who*/) { } + + void JustSummoned(Creature *summoned) + { + pathaleonGUID = summoned->GetGUID(); + } + + // Emote Ardonis and Pathaleon + void Turn_to_Pathaleons_Image() + { + Creature *ardonis = Unit::GetCreature(*me,ardonisGUID); + Creature *pathaleon = Unit::GetCreature(*me,pathaleonGUID); Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer) + if (!ardonis || !pathaleon || !pPlayer) return; - angle_dawnforge = me->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); - angle_ardonis = ardonis->GetAngle(me->GetPositionX(), me->GetPositionY()); + //Calculate the angle to Pathaleon + angle_dawnforge = me->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); + angle_ardonis = ardonis->GetAngle(pathaleon->GetPositionX(), pathaleon->GetPositionY()); //Turn Dawnforge and update me->SetOrientation(angle_dawnforge); @@ -442,188 +439,217 @@ struct npc_commander_dawnforgeAI : public ScriptedAI ardonis->SetOrientation(angle_ardonis); ardonis->SendUpdateToPlayer(pPlayer); - //Set state - me->SetStandState(UNIT_STAND_STATE_STAND); - ardonis->SetStandState(UNIT_STAND_STATE_STAND); - } - } - - bool CanStartEvent(Player* pPlayer) - { - if (!isEvent) - { - Creature* ardonis = me->FindNearestCreature(CreatureEntry[0], 10.0f); - if (!ardonis) - return false; - - ardonisGUID = ardonis->GetGUID(); - PlayerGUID = pPlayer->GetGUID(); - - isEvent = true; - - Turn_to_eachother(); - return true; + //Set them to kneel + me->SetStandState(UNIT_STAND_STATE_KNEEL); + ardonis->SetStandState(UNIT_STAND_STATE_KNEEL); } - sLog.outDebug("TSCR: npc_commander_dawnforge event already in progress, need to wait."); - return false; - } - - void UpdateAI(const uint32 diff) - { - //Is event even running? - if (!isEvent) - return; - - //Phase timing - if (Phase_Timer >= diff) + //Set them back to each other + void Turn_to_eachother() { - Phase_Timer -= diff; - return; - } - - Unit *ardonis = Unit::GetUnit(*me,ardonisGUID); - Unit *pathaleon = Unit::GetUnit(*me,pathaleonGUID); - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - - if (!ardonis || !pPlayer) - { - Reset(); - return; - } - - if (Phase > 4 && !pathaleon) - { - Reset(); - return; - } - - //Phase 1 Dawnforge say - switch (Phase) - { - case 1: - DoScriptText(SAY_COMMANDER_DAWNFORGE_1, me); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 2 Ardonis say - case 2: - DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 3 Dawnforge say - case 3: - DoScriptText(SAY_COMMANDER_DAWNFORGE_2, me); - ++Phase; - Phase_Timer = 16000; - break; - //Phase 4 Pathaleon spawns up to phase 9 - case 4: - //spawn pathaleon's image - me->SummonCreature(CreatureEntry[2], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000); - ++Phase; - Phase_Timer = 500; - break; - //Phase 5 Pathaleon say - case 5: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon); - ++Phase; - Phase_Timer = 6000; - break; - //Phase 6 - case 6: - switch(PhaseSubphase) + if (Unit *ardonis = Unit::GetUnit(*me,ardonisGUID)) { - //Subphase 1: Turn Dawnforge and Ardonis - case 0: - Turn_to_Pathaleons_Image(); - ++PhaseSubphase; - Phase_Timer = 8000; - break; - //Subphase 2 Dawnforge say - case 1: - DoScriptText(SAY_COMMANDER_DAWNFORGE_3, me); - PhaseSubphase = 0; - ++Phase; - Phase_Timer = 8000; - break; + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + + if (!pPlayer) + return; + + angle_dawnforge = me->GetAngle(ardonis->GetPositionX(), ardonis->GetPositionY()); + angle_ardonis = ardonis->GetAngle(me->GetPositionX(), me->GetPositionY()); + + //Turn Dawnforge and update + me->SetOrientation(angle_dawnforge); + me->SendUpdateToPlayer(pPlayer); + //Turn Ardonis and update + ardonis->SetOrientation(angle_ardonis); + ardonis->SendUpdateToPlayer(pPlayer); + + //Set state + me->SetStandState(UNIT_STAND_STATE_STAND); + ardonis->SetStandState(UNIT_STAND_STATE_STAND); } - break; - //Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase - case 7: - switch(PhaseSubphase) + } + + bool CanStartEvent(Player* pPlayer) + { + if (!isEvent) + { + Creature* ardonis = me->FindNearestCreature(CreatureEntry[0], 10.0f); + if (!ardonis) + return false; + + ardonisGUID = ardonis->GetGUID(); + PlayerGUID = pPlayer->GetGUID(); + + isEvent = true; + + Turn_to_eachother(); + return true; + } + + sLog.outDebug("TSCR: npc_commander_dawnforge event already in progress, need to wait."); + return false; + } + + void UpdateAI(const uint32 diff) + { + //Is event even running? + if (!isEvent) + return; + + //Phase timing + if (Phase_Timer >= diff) + { + Phase_Timer -= diff; + return; + } + + Unit *ardonis = Unit::GetUnit(*me,ardonisGUID); + Unit *pathaleon = Unit::GetUnit(*me,pathaleonGUID); + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + + if (!ardonis || !pPlayer) + { + Reset(); + return; + } + + if (Phase > 4 && !pathaleon) + { + Reset(); + return; + } + + //Phase 1 Dawnforge say + switch (Phase) { - //Subphase 1 - case 0: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon); - ++PhaseSubphase; - Phase_Timer = 12000; - break; - //Subphase 2 case 1: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon); - ++PhaseSubphase; + DoScriptText(SAY_COMMANDER_DAWNFORGE_1, me); + ++Phase; Phase_Timer = 16000; break; - //Subphase 3 + //Phase 2 Ardonis say case 2: - DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon); + DoScriptText(SAY_ARCANIST_ARDONIS_1, ardonis); + ++Phase; + Phase_Timer = 16000; + break; + //Phase 3 Dawnforge say + case 3: + DoScriptText(SAY_COMMANDER_DAWNFORGE_2, me); + ++Phase; + Phase_Timer = 16000; + break; + //Phase 4 Pathaleon spawns up to phase 9 + case 4: + //spawn pathaleon's image + me->SummonCreature(CreatureEntry[2], 2325.851563, 2799.534668, 133.084229, 6.038996, TEMPSUMMON_TIMED_DESPAWN, 90000); + ++Phase; + Phase_Timer = 500; + break; + //Phase 5 Pathaleon say + case 5: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_1, pathaleon); + ++Phase; + Phase_Timer = 6000; + break; + //Phase 6 + case 6: + switch(PhaseSubphase) + { + //Subphase 1: Turn Dawnforge and Ardonis + case 0: + Turn_to_Pathaleons_Image(); + ++PhaseSubphase; + Phase_Timer = 8000; + break; + //Subphase 2 Dawnforge say + case 1: + DoScriptText(SAY_COMMANDER_DAWNFORGE_3, me); + PhaseSubphase = 0; + ++Phase; + Phase_Timer = 8000; + break; + } + break; + //Phase 7 Pathaleons say 3 Sentence, every sentence need a subphase + case 7: + switch(PhaseSubphase) + { + //Subphase 1 + case 0: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2, pathaleon); + ++PhaseSubphase; + Phase_Timer = 12000; + break; + //Subphase 2 + case 1: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_1, pathaleon); + ++PhaseSubphase; + Phase_Timer = 16000; + break; + //Subphase 3 + case 2: + DoScriptText(SAY_PATHALEON_CULATOR_IMAGE_2_2, pathaleon); + PhaseSubphase = 0; + ++Phase; + Phase_Timer = 10000; + break; + } + break; + //Phase 8 Dawnforge & Ardonis say + case 8: + DoScriptText(SAY_COMMANDER_DAWNFORGE_4, me); + DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis); + ++Phase; + Phase_Timer = 4000; + break; + //Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle + case 9: + Turn_to_eachother(); + //hide pathaleon, unit will despawn shortly + pathaleon->SetVisibility(VISIBILITY_OFF); PhaseSubphase = 0; ++Phase; - Phase_Timer = 10000; + Phase_Timer = 3000; + break; + //Phase 10 Dawnforge say + case 10: + DoScriptText(SAY_COMMANDER_DAWNFORGE_5, me); + pPlayer->AreaExploredOrEventHappens(QUEST_INFO_GATHERING); + Reset(); break; } - break; - //Phase 8 Dawnforge & Ardonis say - case 8: - DoScriptText(SAY_COMMANDER_DAWNFORGE_4, me); - DoScriptText(SAY_ARCANIST_ARDONIS_2, ardonis); - ++Phase; - Phase_Timer = 4000; - break; - //Phase 9 Pathaleons Despawn, Reset Dawnforge & Ardonis angle - case 9: - Turn_to_eachother(); - //hide pathaleon, unit will despawn shortly - pathaleon->SetVisibility(VISIBILITY_OFF); - PhaseSubphase = 0; - ++Phase; - Phase_Timer = 3000; - break; - //Phase 10 Dawnforge say - case 10: - DoScriptText(SAY_COMMANDER_DAWNFORGE_5, me); - pPlayer->AreaExploredOrEventHappens(QUEST_INFO_GATHERING); - Reset(); - break; - } - } + } + }; + }; -CreatureAI* GetAI_npc_commander_dawnforge(Creature* pCreature) + class at_commander_dawnforge : public AreaTriggerScript { - return new npc_commander_dawnforgeAI(pCreature); -} +public: + at_commander_dawnforge() : AreaTriggerScript("at_commander_dawnforge") { } -bool AreaTrigger_at_commander_dawnforge(Player* pPlayer, const AreaTriggerEntry * /*at*/) -{ - //if player lost aura or not have at all, we should not try start event. - if (!pPlayer->HasAura(SPELL_SUNFURY_DISGUISE)) - return false; - - if (pPlayer->isAlive() && pPlayer->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) + bool OnTrigger(Player* pPlayer, const AreaTriggerEntry * /*at*/) { - Creature* Dawnforge = pPlayer->FindNearestCreature(CreatureEntry[1], 30.0f); - - if (!Dawnforge) + //if player lost aura or not have at all, we should not try start event. + if (!pPlayer->HasAura(SPELL_SUNFURY_DISGUISE)) return false; - if (CAST_AI(npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(pPlayer)) - return true; + if (pPlayer->isAlive() && pPlayer->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE) + { + Creature* Dawnforge = pPlayer->FindNearestCreature(CreatureEntry[1], 30.0f); + + if (!Dawnforge) + return false; + + if (CAST_AI(npc_commander_dawnforge::npc_commander_dawnforgeAI, Dawnforge->AI())->CanStartEvent(pPlayer)) + return true; + } + return false; } - return false; -} + +}; /*###### ## npc_professor_dabiri @@ -635,38 +661,46 @@ bool AreaTrigger_at_commander_dawnforge(Player* pPlayer, const AreaTriggerEntry #define QUEST_DIMENSIUS 10439 #define QUEST_ON_NETHERY_WINGS 10438 - -bool GossipHello_npc_professor_dabiri(Player* pPlayer, Creature* pCreature) + class npc_professor_dabiri : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_professor_dabiri() : CreatureScript("npc_professor_dabiri") { } - if (pPlayer->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(29778, 1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { - pCreature->CastSpell(pPlayer, SPELL_PHASE_DISTRUPTOR, false); - pPlayer->CLOSE_GOSSIP_MENU(); + if (quest->GetQuestId() == QUEST_DIMENSIUS) + DoScriptText(WHISPER_DABIRI, pCreature, pPlayer); + + return true; } - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pCreature->CastSpell(pPlayer, SPELL_PHASE_DISTRUPTOR, false); + pPlayer->CLOSE_GOSSIP_MENU(); + } + + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_ON_NETHERY_WINGS) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(29778, 1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; -bool QuestAccept_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, Quest const *quest) -{ - if (quest->GetQuestId() == QUEST_DIMENSIUS) - DoScriptText(WHISPER_DABIRI, pCreature, pPlayer); - return true; -} /*###### ## mob_phase_hunter @@ -685,117 +719,124 @@ bool QuestAccept_npc_professor_dabiri(Player* pPlayer, Creature* pCreature, Ques #define SPELL_MANA_BURN 13321 #define SPELL_MATERIALIZE 34804 #define SPELL_DE_MATERIALIZE 34814 - -struct mob_phase_hunterAI : public ScriptedAI + class mob_phase_hunter : public CreatureScript { - mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {} +public: + mob_phase_hunter() : CreatureScript("mob_phase_hunter") { } - bool Weak; - bool Materialize; - bool Drained; - uint8 WeakPercent; - float HpPercent; - - Player *pPlayer; - uint64 PlayerGUID; - - uint32 ManaBurnTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Weak = false; - Materialize = false; - Drained = false; - WeakPercent = 25 + (rand() % 16); // 25-40 - HpPercent = 0.0f; - - PlayerGUID = 0; - - ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd - - if (me->GetEntry() == NPC_DRAINED_PHASE_HUNTER_ENTRY) - me->UpdateEntry(NPC_PHASE_HUNTER_ENTRY); + return new mob_phase_hunterAI (pCreature); } - void EnterCombat(Unit * who) + struct mob_phase_hunterAI : public ScriptedAI { - if (who->GetTypeId() == TYPEID_PLAYER) - PlayerGUID = who->GetGUID(); - } + mob_phase_hunterAI(Creature *c) : ScriptedAI(c) {} - void SpellHit(Unit * /*caster*/, const SpellEntry * /*spell*/) - { - DoCast(me, SPELL_DE_MATERIALIZE); - } + bool Weak; + bool Materialize; + bool Drained; + uint8 WeakPercent; + float HpPercent; - void UpdateAI(const uint32 diff) - { - if (!Materialize) + Player *pPlayer; + uint64 PlayerGUID; + + uint32 ManaBurnTimer; + + void Reset() { - DoCast(me, SPELL_MATERIALIZE); - Materialize = true; + Weak = false; + Materialize = false; + Drained = false; + WeakPercent = 25 + (rand() % 16); // 25-40 + HpPercent = 0.0f; + + PlayerGUID = 0; + + ManaBurnTimer = 5000 + (rand() % 3 * 1000); // 5-8 sec cd + + if (me->GetEntry() == NPC_DRAINED_PHASE_HUNTER_ENTRY) + me->UpdateEntry(NPC_PHASE_HUNTER_ENTRY); } - if (me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || me->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it - DoCast(me, SPELL_PHASE_SLIP); - - if (!UpdateVictim()) - return; - - // some code to cast spell Mana Burn on random target which has mana - if (ManaBurnTimer <= diff) + void EnterCombat(Unit * who) { - std::list AggroList = me->getThreatManager().getThreatList(); - std::list UnitsWithMana; + if (who->GetTypeId() == TYPEID_PLAYER) + PlayerGUID = who->GetGUID(); + } - for (std::list::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) + void SpellHit(Unit * /*caster*/, const SpellEntry * /*spell*/) + { + DoCast(me, SPELL_DE_MATERIALIZE); + } + + void UpdateAI(const uint32 diff) + { + if (!Materialize) { - if (Unit *pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + DoCast(me, SPELL_MATERIALIZE); + Materialize = true; + } + + if (me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || me->hasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it + DoCast(me, SPELL_PHASE_SLIP); + + if (!UpdateVictim()) + return; + + // some code to cast spell Mana Burn on random target which has mana + if (ManaBurnTimer <= diff) + { + std::list AggroList = me->getThreatManager().getThreatList(); + std::list UnitsWithMana; + + for (std::list::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) { - if (pUnit->GetCreateMana() > 0) - UnitsWithMana.push_back(pUnit); + if (Unit *pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + { + if (pUnit->GetCreateMana() > 0) + UnitsWithMana.push_back(pUnit); + } } - } - if (!UnitsWithMana.empty()) + if (!UnitsWithMana.empty()) + { + std::list::const_iterator it = UnitsWithMana.begin(); + std::advance(it, rand() % UnitsWithMana.size()); + DoCast(*it, SPELL_MANA_BURN); + ManaBurnTimer = 8000 + (rand() % 10 * 1000); // 8-18 sec cd + } + else + ManaBurnTimer = 3500; + } else ManaBurnTimer -= diff; + + if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190 { - std::list::const_iterator it = UnitsWithMana.begin(); - std::advance(it, rand() % UnitsWithMana.size()); - DoCast(*it, SPELL_MANA_BURN); - ManaBurnTimer = 8000 + (rand() % 10 * 1000); // 8-18 sec cd - } - else - ManaBurnTimer = 3500; - } else ManaBurnTimer -= diff; + if (!Weak && me->GetHealth() < (me->GetMaxHealth() / 100 * WeakPercent) + && pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE) + { + DoScriptText(EMOTE_WEAK, me); + Weak = true; + } + if (Weak && !Drained && me->HasAura(SPELL_RECHARGING_BATTERY)) + { + Drained = true; + HpPercent = float(me->GetHealth()) / float(me->GetMaxHealth()); - if (Player *pPlayer = Unit::GetPlayer(*me, PlayerGUID)) // start: support for quest 10190 - { - if (!Weak && me->GetHealth() < (me->GetMaxHealth() / 100 * WeakPercent) - && pPlayer->GetQuestStatus(QUEST_RECHARGING_THE_BATTERIES) == QUEST_STATUS_INCOMPLETE) - { - DoScriptText(EMOTE_WEAK, me); - Weak = true; - } - if (Weak && !Drained && me->HasAura(SPELL_RECHARGING_BATTERY)) - { - Drained = true; - HpPercent = float(me->GetHealth()) / float(me->GetMaxHealth()); + me->UpdateEntry(NPC_DRAINED_PHASE_HUNTER_ENTRY); - me->UpdateEntry(NPC_DRAINED_PHASE_HUNTER_ENTRY); + me->SetHealth(me->GetMaxHealth() * HpPercent); + me->LowerPlayerDamageReq(me->GetMaxHealth() - me->GetHealth()); + me->SetInCombatWith(pPlayer); + } + } // end: support for quest 10190 - me->SetHealth(me->GetMaxHealth() * HpPercent); - me->LowerPlayerDamageReq(me->GetMaxHealth() - me->GetHealth()); - me->SetInCombatWith(pPlayer); - } - } // end: support for quest 10190 + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_phase_hunter(Creature* pCreature) -{ - return new mob_phase_hunterAI (pCreature); -} /*###### ## npc_bessy @@ -807,121 +848,94 @@ CreatureAI* GetAI_mob_phase_hunter(Creature* pCreature) #define SPAWN_SECOND 19881 #define SAY_THADELL_1 -1000304 #define SAY_THADELL_2 -1000305 - -struct npc_bessyAI : public npc_escortAI + class npc_bessy : public CreatureScript { +public: + npc_bessy() : CreatureScript("npc_bessy") { } - npc_bessyAI(Creature *c) : npc_escortAI(c) {} - - void JustDied(Unit* /*killer*/) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->FailQuest(Q_ALMABTRIEB); - } - - void WaypointReached(uint32 i) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) + if (quest->GetQuestId() == Q_ALMABTRIEB) { - case 3: //first spawn - me->SummonCreature(SPAWN_FIRST, 2449.67, 2183.11, 96.85, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, 2449.53, 2184.43, 96.36, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, 2449.85, 2186.34, 97.57, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - - case 7: - me->SummonCreature(SPAWN_SECOND, 2309.64, 2186.24, 92.25, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND, 2309.25, 2183.46, 91.75, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - - case 12: - if (pPlayer) - pPlayer->GroupEventHappens(Q_ALMABTRIEB, me); - if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) - DoScriptText(SAY_THADELL_1, me); break; - case 13: - if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) - DoScriptText(SAY_THADELL_2, me, pPlayer); break; + pCreature->setFaction(113); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); } + return true; } - void JustSummoned(Creature* summoned) + CreatureAI* GetAI(Creature* pCreature) const { - summoned->AI()->AttackStart(me); + return new npc_bessyAI(pCreature); } - void Reset() + struct npc_bessyAI : public npc_escortAI { - me->RestoreFaction(); - } + + npc_bessyAI(Creature *c) : npc_escortAI(c) {} + + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(Q_ALMABTRIEB); + } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 3: //first spawn + me->SummonCreature(SPAWN_FIRST, 2449.67, 2183.11, 96.85, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, 2449.53, 2184.43, 96.36, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, 2449.85, 2186.34, 97.57, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + + case 7: + me->SummonCreature(SPAWN_SECOND, 2309.64, 2186.24, 92.25, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND, 2309.25, 2183.46, 91.75, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + + case 12: + if (pPlayer) + pPlayer->GroupEventHappens(Q_ALMABTRIEB, me); + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_1, me); break; + case 13: + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_2, me, pPlayer); break; + } + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void Reset() + { + me->RestoreFaction(); + } + + }; }; -bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == Q_ALMABTRIEB) - { - pCreature->setFaction(113); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - } - return true; -} - -CreatureAI* GetAI_npc_bessy(Creature* pCreature) -{ - return new npc_bessyAI(pCreature); -} - /*###### ## ######*/ void AddSC_netherstorm() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_manaforge_control_console"; - newscript->pGOHello = &GOHello_go_manaforge_control_console; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_manaforge_control_console"; - newscript->GetAI = &GetAI_npc_manaforge_control_console; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_commander_dawnforge"; - newscript->GetAI = &GetAI_npc_commander_dawnforge; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_commander_dawnforge"; - newscript->pAreaTrigger = &AreaTrigger_at_commander_dawnforge; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_professor_dabiri"; - newscript->pGossipHello = &GossipHello_npc_professor_dabiri; - newscript->pGossipSelect = &GossipSelect_npc_professor_dabiri; - newscript->pQuestAccept = &QuestAccept_npc_professor_dabiri; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_phase_hunter"; - newscript->GetAI = &GetAI_mob_phase_hunter; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_bessy"; - newscript->GetAI = &GetAI_npc_bessy; - newscript->pQuestAccept = &QuestAccept_npc_bessy; - newscript->RegisterSelf(); + new go_manaforge_control_console(); + new npc_manaforge_control_console(); + new npc_commander_dawnforge(); + new at_commander_dawnforge(); + new npc_professor_dabiri(); + new mob_phase_hunter(); + new npc_bessy(); } - diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index a9cc104a285..6726928834e 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -62,118 +62,125 @@ enum eMatureNetherwing QUEST_KINDNESS = 10804, NPC_EVENT_PINGER = 22131 }; - -struct mob_mature_netherwing_drakeAI : public ScriptedAI + class mob_mature_netherwing_drake : public CreatureScript { - mob_mature_netherwing_drakeAI(Creature* c) : ScriptedAI(c) { } +public: + mob_mature_netherwing_drake() : CreatureScript("mob_mature_netherwing_drake") { } - uint64 uiPlayerGUID; - - bool bCanEat; - bool bIsEating; - - uint32 EatTimer; - uint32 CastTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiPlayerGUID = 0; - - bCanEat = false; - bIsEating = false; - - EatTimer = 5000; - CastTimer = 5000; + return new mob_mature_netherwing_drakeAI(pCreature); } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + struct mob_mature_netherwing_drakeAI : public ScriptedAI { - if (bCanEat || bIsEating) - return; + mob_mature_netherwing_drakeAI(Creature* c) : ScriptedAI(c) { } - if (pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) + uint64 uiPlayerGUID; + + bool bCanEat; + bool bIsEating; + + uint32 EatTimer; + uint32 CastTimer; + + void Reset() { - uiPlayerGUID = pCaster->GetGUID(); - bCanEat = true; - } - } + uiPlayerGUID = 0; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + bCanEat = false; + bIsEating = false; - if (id == POINT_ID) - { - bIsEating = true; - EatTimer = 7000; - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); - } - } - - void UpdateAI(const uint32 diff) - { - if (bCanEat || bIsEating) - { - if (EatTimer <= diff) - { - if (bCanEat && !bIsEating) - { - if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID)) - { - if (GameObject* pGo = pUnit->FindNearestGameObject(GO_CARCASS, 10)) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - me->GetMotionMaster()->MovementExpired(); - - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - - me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); - } - } - bCanEat = false; - } - else if (bIsEating) - { - DoCast(me, SPELL_JUST_EATEN); - DoScriptText(SAY_JUST_EATEN, me); - - if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID)) - { - pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, me->GetGUID()); - - if (GameObject* pGo = pPlr->FindNearestGameObject(GO_CARCASS, 10)) - pGo->Delete(); - } - - Reset(); - me->GetMotionMaster()->Clear(); - } - } - else - EatTimer -= diff; - - return; - } - - if (!UpdateVictim()) - return; - - if (CastTimer <= diff) - { - DoCast(me->getVictim(), SPELL_NETHER_BREATH); + EatTimer = 5000; CastTimer = 5000; - } else CastTimer -= diff; + } + + void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + { + if (bCanEat || bIsEating) + return; + + if (pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_PLACE_CARCASS && !me->HasAura(SPELL_JUST_EATEN)) + { + uiPlayerGUID = pCaster->GetGUID(); + bCanEat = true; + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == POINT_ID) + { + bIsEating = true; + EatTimer = 7000; + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + } + } + + void UpdateAI(const uint32 diff) + { + if (bCanEat || bIsEating) + { + if (EatTimer <= diff) + { + if (bCanEat && !bIsEating) + { + if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID)) + { + if (GameObject* pGo = pUnit->FindNearestGameObject(GO_CARCASS, 10)) + { + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + + me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); + } + } + bCanEat = false; + } + else if (bIsEating) + { + DoCast(me, SPELL_JUST_EATEN); + DoScriptText(SAY_JUST_EATEN, me); + + if (Player* pPlr = Unit::GetPlayer(*me, uiPlayerGUID)) + { + pPlr->KilledMonsterCredit(NPC_EVENT_PINGER, me->GetGUID()); + + if (GameObject* pGo = pPlr->FindNearestGameObject(GO_CARCASS, 10)) + pGo->Delete(); + } + + Reset(); + me->GetMotionMaster()->Clear(); + } + } + else + EatTimer -= diff; + + return; + } + + if (!UpdateVictim()) + return; + + if (CastTimer <= diff) + { + DoCast(me->getVictim(), SPELL_NETHER_BREATH); + CastTimer = 5000; + } else CastTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_mature_netherwing_drake(Creature* pCreature) -{ - return new mob_mature_netherwing_drakeAI(pCreature); -} /*### # mob_enslaved_netherwing_drake @@ -187,219 +194,240 @@ CreatureAI* GetAI_mob_mature_netherwing_drake(Creature* pCreature) #define CREATURE_DRAGONMAW_SUBJUGATOR 21718 #define CREATURE_ESCAPE_DUMMY 22317 - -struct mob_enslaved_netherwing_drakeAI : public ScriptedAI + class mob_enslaved_netherwing_drake : public CreatureScript { - mob_enslaved_netherwing_drakeAI(Creature* c) : ScriptedAI(c) +public: + mob_enslaved_netherwing_drake() : CreatureScript("mob_enslaved_netherwing_drake") { } + + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; - Tapped = false; - Reset(); + return new mob_enslaved_netherwing_drakeAI(pCreature); } - uint64 PlayerGUID; - uint32 FlyTimer; - bool Tapped; - - void Reset() + struct mob_enslaved_netherwing_drakeAI : public ScriptedAI { - if (!Tapped) - me->setFaction(FACTION_DEFAULT); - - FlyTimer = 10000; - me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->SetVisibility(VISIBILITY_ON); - } - - void SpellHit(Unit* caster, const SpellEntry* spell) - { - if (!caster) - return; - - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_HIT_FORCE_OF_NELTHARAKU && !Tapped) + mob_enslaved_netherwing_drakeAI(Creature* c) : ScriptedAI(c) { - Tapped = true; - PlayerGUID = caster->GetGUID(); - - me->setFaction(FACTION_FRIENDLY); - DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); - - Unit* Dragonmaw = me->FindNearestCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50); - - if (Dragonmaw) - { - me->AddThreat(Dragonmaw, 100000.0f); - AttackStart(Dragonmaw); - } - - HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(caster); - if (ref) - ref->removeReference(); + PlayerGUID = 0; + Tapped = false; + Reset(); } - } - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + uint64 PlayerGUID; + uint32 FlyTimer; + bool Tapped; - if (id == 1) + void Reset() { - if (PlayerGUID) - { - Unit* plr = Unit::GetUnit((*me), PlayerGUID); - if (plr) - DoCast(plr, SPELL_FORCE_OF_NELTHARAKU, true); + if (!Tapped) + me->setFaction(FACTION_DEFAULT); - PlayerGUID = 0; - } - me->SetVisibility(VISIBILITY_OFF); + FlyTimer = 10000; me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); + me->SetVisibility(VISIBILITY_ON); } - } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) + void SpellHit(Unit* caster, const SpellEntry* spell) { - if (Tapped) - if (FlyTimer <= diff) + if (!caster) + return; + + if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_HIT_FORCE_OF_NELTHARAKU && !Tapped) + { + Tapped = true; + PlayerGUID = caster->GetGUID(); + + me->setFaction(FACTION_FRIENDLY); + DoCast(caster, SPELL_FORCE_OF_NELTHARAKU, true); + + Unit* Dragonmaw = me->FindNearestCreature(CREATURE_DRAGONMAW_SUBJUGATOR, 50); + + if (Dragonmaw) + { + me->AddThreat(Dragonmaw, 100000.0f); + AttackStart(Dragonmaw); + } + + HostileReference* ref = me->getThreatManager().getOnlineContainer().getReferenceByTarget(caster); + if (ref) + ref->removeReference(); + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id == 1) { - Tapped = false; if (PlayerGUID) { - Player* plr = Unit::GetPlayer(*me, PlayerGUID); - if (plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE) - { + Unit* plr = Unit::GetUnit((*me), PlayerGUID); + if (plr) DoCast(plr, SPELL_FORCE_OF_NELTHARAKU, true); - /* - float x,y,z; - me->GetPosition(x,y,z); - float dx,dy,dz; - me->GetRandomPoint(x, y, z, 20, dx, dy, dz); - dz += 20; // so it's in the air, not ground*/ - - Position pos; - if (Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30)) - EscapeDummy->GetPosition(&pos); - else - { - me->GetRandomNearPosition(pos, 20); - pos.m_positionZ += 25; - } - - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - me->GetMotionMaster()->MovePoint(1, pos); - } + PlayerGUID = 0; } - } else FlyTimer -= diff; - return; + me->SetVisibility(VISIBILITY_OFF); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + } } - DoMeleeAttackIfReady(); - } + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + { + if (Tapped) + if (FlyTimer <= diff) + { + Tapped = false; + if (PlayerGUID) + { + Player* plr = Unit::GetPlayer(*me, PlayerGUID); + if (plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE) + { + DoCast(plr, SPELL_FORCE_OF_NELTHARAKU, true); + /* + float x,y,z; + me->GetPosition(x,y,z); + + float dx,dy,dz; + me->GetRandomPoint(x, y, z, 20, dx, dy, dz); + dz += 20; // so it's in the air, not ground*/ + + Position pos; + if (Unit* EscapeDummy = me->FindNearestCreature(CREATURE_ESCAPE_DUMMY, 30)) + EscapeDummy->GetPosition(&pos); + else + { + me->GetRandomNearPosition(pos, 20); + pos.m_positionZ += 25; + } + + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->GetMotionMaster()->MovePoint(1, pos); + } + } + } else FlyTimer -= diff; + return; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_mob_enslaved_netherwing_drake(Creature* pCreature) -{ - return new mob_enslaved_netherwing_drakeAI(pCreature); -} /*##### # mob_dragonmaw_peon #####*/ - -struct mob_dragonmaw_peonAI : public ScriptedAI + class mob_dragonmaw_peon : public CreatureScript { - mob_dragonmaw_peonAI(Creature* c) : ScriptedAI(c) {} +public: + mob_dragonmaw_peon() : CreatureScript("mob_dragonmaw_peon") { } - uint64 PlayerGUID; - bool Tapped; - uint32 PoisonTimer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - PlayerGUID = 0; - Tapped = false; - PoisonTimer = 0; + return new mob_dragonmaw_peonAI(pCreature); } - void SpellHit(Unit* caster, const SpellEntry* spell) + struct mob_dragonmaw_peonAI : public ScriptedAI { - if (!caster) - return; + mob_dragonmaw_peonAI(Creature* c) : ScriptedAI(c) {} - if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == 40468 && !Tapped) + uint64 PlayerGUID; + bool Tapped; + uint32 PoisonTimer; + + void Reset() { - PlayerGUID = caster->GetGUID(); - - Tapped = true; - float x, y, z; - caster->GetClosePoint(x, y, z, me->GetObjectSize()); - - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->GetMotionMaster()->MovePoint(1, x, y, z); - } - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (id) - { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_EAT); - PoisonTimer = 15000; - } - } - - void UpdateAI(const uint32 diff) - { - if (PoisonTimer) - if (PoisonTimer <= diff) - { - if (PlayerGUID) - { - Player* plr = Unit::GetPlayer(*me, PlayerGUID); - if (plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE) - plr->KilledMonsterCredit(23209, me->GetGUID()); - } + PlayerGUID = 0; + Tapped = false; PoisonTimer = 0; - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } else PoisonTimer -= diff; - } + } + + void SpellHit(Unit* caster, const SpellEntry* spell) + { + if (!caster) + return; + + if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == 40468 && !Tapped) + { + PlayerGUID = caster->GetGUID(); + + Tapped = true; + float x, y, z; + caster->GetClosePoint(x, y, z, me->GetObjectSize()); + + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(1, x, y, z); + } + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + if (id) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_EAT); + PoisonTimer = 15000; + } + } + + void UpdateAI(const uint32 diff) + { + if (PoisonTimer) + if (PoisonTimer <= diff) + { + if (PlayerGUID) + { + Player* plr = Unit::GetPlayer(*me, PlayerGUID); + if (plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE) + plr->KilledMonsterCredit(23209, me->GetGUID()); + } + PoisonTimer = 0; + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } else PoisonTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_dragonmaw_peon(Creature* pCreature) -{ - return new mob_dragonmaw_peonAI(pCreature); -} /*###### ## npc_drake_dealer_hurlunk ######*/ - -bool GossipHello_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature) + class npc_drake_dealer_hurlunk : public CreatureScript { - if (pCreature->isVendor() && pPlayer->GetReputationRank(1015) == REP_EXALTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npc_drake_dealer_hurlunk() : CreatureScript("npc_drake_dealer_hurlunk") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} + return true; + } -bool GossipSelect_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isVendor() && pPlayer->GetReputationRank(1015) == REP_EXALTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_flanis_swiftwing_and_kagrosh @@ -407,43 +435,50 @@ bool GossipSelect_npc_drake_dealer_hurlunk(Player* pPlayer, Creature* pCreature, #define GOSSIP_HSK1 "Take Flanis's Pack" #define GOSSIP_HSK2 "Take Kagrosh's Pack" - -bool GossipHello_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* pCreature) + class npcs_flanis_swiftwing_and_kagrosh : public CreatureScript { - if (pPlayer->GetQuestStatus(10583) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30658,1,true)) - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (pPlayer->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30659,1,true)) - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); +public: + npcs_flanis_swiftwing_and_kagrosh() : CreatureScript("npcs_flanis_swiftwing_and_kagrosh") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, false); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, 30658, 1, true); - pPlayer->PlayerTalkClass->ClearMenus(); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30658, 1, false); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, 30658, 1, true); + pPlayer->PlayerTalkClass->ClearMenus(); + } } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, false); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, 30659, 1, true); + pPlayer->PlayerTalkClass->ClearMenus(); + } + } + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 30659, 1, false); - if (msg == EQUIP_ERR_OK) - { - pPlayer->StoreNewItem(dest, 30659, 1, true); - pPlayer->PlayerTalkClass->ClearMenus(); - } + if (pPlayer->GetQuestStatus(10583) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30658,1,true)) + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (pPlayer->GetQuestStatus(10601) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(30659,1,true)) + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HSK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_murkblood_overseer @@ -457,54 +492,61 @@ bool GossipSelect_npcs_flanis_swiftwing_and_kagrosh(Player* pPlayer, Creature* / #define GOSSIP_SMO3 "Continue please." #define GOSSIP_SMO4 "Who are these bidders?" #define GOSSIP_SMO5 "Well... yes." - -bool GossipHello_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature) + class npc_murkblood_overseer : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HMO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_murkblood_overseer() : CreatureScript("npc_murkblood_overseer") { } - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - //correct id not known - pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); - pCreature->CastSpell(pPlayer,41121,false); - pPlayer->AreaExploredOrEventHappens(QUEST_11082); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SMO5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + //correct id not known + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + pCreature->CastSpell(pPlayer,41121,false); + pPlayer->AreaExploredOrEventHappens(QUEST_11082); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_11082) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HMO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(10940, pCreature->GetGUID()); + return true; + } + +}; + /*###### ## npc_neltharaku @@ -514,43 +556,50 @@ bool GossipSelect_npc_murkblood_overseer(Player* pPlayer, Creature* pCreature, u #define GOSSIP_SN1 "But you are dragons! How could orcs do this to you?" #define GOSSIP_SN2 "Your mate?" #define GOSSIP_SN3 "I have battled many beasts, dragon. I will help you." - -bool GossipHello_npc_neltharaku(Player* pPlayer, Creature* pCreature) + class npc_neltharaku : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_neltharaku() : CreatureScript("npc_neltharaku") { } - if (pPlayer->GetQuestStatus(10814) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(10613, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(10614, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(10615, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(10616, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(10814); - break; + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(10614, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(10615, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_SN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(10616, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(10814); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(10814) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_HN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(10613, pCreature->GetGUID()); + + return true; + } + +}; + /*###### ## npc_oronok @@ -563,62 +612,69 @@ bool GossipSelect_npc_neltharaku(Player* pPlayer, Creature* pCreature, uint32 /* #define GOSSIP_ORONOK5 "Continue, please." #define GOSSIP_ORONOK6 "So what of the cipher now? And your boys?" #define GOSSIP_ORONOK7 "I will find your boys and the cipher, Oronok." - -bool GossipHello_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature) + class npc_oronok_tornheart : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pCreature->isVendor()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); +public: + npc_oronok_tornheart() : CreatureScript("npc_oronok_tornheart") { } - if (pPlayer->GetQuestStatus(10519) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(10312, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_oronok_tornheart(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_TRADE: - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10313, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(10314, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(10315, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(10316, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(10317, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(10318, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(10519); - break; + switch (uiAction) + { + case GOSSIP_ACTION_TRADE: + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(10313, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(10314, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(10315, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(10316, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(10317, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(10318, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(10519); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pCreature->isVendor()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (pPlayer->GetQuestStatus(10519) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ORONOK1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(10312, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; + /*#### # npc_karynaku @@ -630,14 +686,20 @@ enum eKarynaku TAXI_PATH_ID = 649 }; - -bool QuestAccept_npc_karynaku(Player* pPlayer, Creature* /*pCreature*/, Quest const* quest) + class npc_karynaku : public CreatureScript { - if (quest->GetQuestId() == QUEST_ALLY_OF_NETHER) - pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID); //pPlayer->ActivateTaxiPathTo(649); +public: + npc_karynaku() : CreatureScript("npc_karynaku") { } - return true; -} + bool OnQuestAccept(Player* pPlayer, Creature* /*pCreature*/, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_ALLY_OF_NETHER) + pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID); //pPlayer->ActivateTaxiPathTo(649); + + return true; + } + +}; /*#### # npc_overlord_morghor @@ -672,188 +734,196 @@ bool QuestAccept_npc_karynaku(Player* pPlayer, Creature* /*pCreature*/, Quest co #define LORD_ILLIDAN_SAY_7 -1100220 #define YARZILL_THE_MERC_SAY -1100221 - -struct npc_overlord_morghorAI : public ScriptedAI + class npc_overlord_morghor : public CreatureScript { - npc_overlord_morghorAI(Creature *c) : ScriptedAI(c) {} +public: + npc_overlord_morghor() : CreatureScript("npc_overlord_morghor") { } - uint64 PlayerGUID; - uint64 IllidanGUID; - - uint32 ConversationTimer; - uint32 Step; - - bool Event; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest *_Quest) { - PlayerGUID = 0; - IllidanGUID = 0; - - ConversationTimer = 0; - Step = 0; - - Event = false; - me->SetUInt32Value(UNIT_NPC_FLAGS, 2); + if (_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) + { + CAST_AI(npc_overlord_morghor::npc_overlord_morghorAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + CAST_AI(npc_overlord_morghor::npc_overlord_morghorAI, pCreature->AI())->StartEvent(); + return true; + } + return false; } - void StartEvent() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetUInt32Value(UNIT_NPC_FLAGS, 0); - me->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Unit* Illidan = me->SummonCreature(C_ILLIDAN, -5107.83, 602.584, 85.2393, 4.92598, TEMPSUMMON_CORPSE_DESPAWN, 0); - if (Illidan) - { - IllidanGUID = Illidan->GetGUID(); - Illidan->SetVisibility(VISIBILITY_OFF); - } - if (PlayerGUID) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - DoScriptText(OVERLORD_SAY_1, me, pPlayer); - } - ConversationTimer = 4200; - Step = 0; - Event = true; + return new npc_overlord_morghorAI(pCreature); } - uint32 NextStep(uint32 Step) + struct npc_overlord_morghorAI : public ScriptedAI { - Unit* plr = Unit::GetUnit((*me), PlayerGUID); + npc_overlord_morghorAI(Creature *c) : ScriptedAI(c) {} - Unit* Illi = Unit::GetUnit((*me), IllidanGUID); + uint64 PlayerGUID; + uint64 IllidanGUID; - if (!plr || !Illi) + uint32 ConversationTimer; + uint32 Step; + + bool Event; + + void Reset() { - EnterEvadeMode(); - return 0; + PlayerGUID = 0; + IllidanGUID = 0; + + ConversationTimer = 0; + Step = 0; + + Event = false; + me->SetUInt32Value(UNIT_NPC_FLAGS, 2); } - switch(Step) + void StartEvent() { - case 0: return 0; break; - case 1: me->GetMotionMaster()->MovePoint(0, -5104.41, 595.297, 85.6838); return 9000; break; - case 2: DoScriptText(OVERLORD_YELL_1, me, plr); return 4500; break; - case 3: me->SetInFront(plr); return 3200; break; - case 4: DoScriptText(OVERLORD_SAY_2, me, plr); return 2000; break; - case 5: Illi->SetVisibility(VISIBILITY_ON); - Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return 350; break; - case 6: - Illi->CastSpell(Illi, SPELL_ONE, true); - Illi->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); - return 2000; break; - case 7: DoScriptText(OVERLORD_YELL_2, me); return 4500; break; - case 8: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); return 2500; break; - case 9: DoScriptText(OVERLORD_SAY_3, me); return 6500; break; - case 10: DoScriptText(LORD_ILLIDAN_SAY_1, Illi); return 5000; break; - case 11: DoScriptText(OVERLORD_SAY_4, me, plr); return 6000; break; - case 12: DoScriptText(LORD_ILLIDAN_SAY_2, Illi); return 5500; break; - case 13: DoScriptText(LORD_ILLIDAN_SAY_3, Illi); return 4000; break; - case 14: Illi->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 1500; break; - case 15: DoScriptText(LORD_ILLIDAN_SAY_4, Illi); return 1500; break; - case 16: - if (plr) + me->SetUInt32Value(UNIT_NPC_FLAGS, 0); + me->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Unit* Illidan = me->SummonCreature(C_ILLIDAN, -5107.83, 602.584, 85.2393, 4.92598, TEMPSUMMON_CORPSE_DESPAWN, 0); + if (Illidan) { - Illi->CastSpell(plr, SPELL_TWO, true); - plr->RemoveAurasDueToSpell(SPELL_THREE); - plr->RemoveAurasDueToSpell(SPELL_FOUR); - return 5000; - }else{ - CAST_PLR(plr)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); Step = 30; return 100; + IllidanGUID = Illidan->GetGUID(); + Illidan->SetVisibility(VISIBILITY_OFF); } - break; - case 17: DoScriptText(LORD_ILLIDAN_SAY_5, Illi); return 5000; break; - case 18: DoScriptText(LORD_ILLIDAN_SAY_6, Illi); return 5000; break; - case 19: DoScriptText(LORD_ILLIDAN_SAY_7, Illi); return 5000; break; - case 20: - Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Illi->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - return 500; break; - case 21: DoScriptText(OVERLORD_SAY_5, me); return 500; break; - case 22: - Illi->SetVisibility(VISIBILITY_OFF); - Illi->setDeathState(JUST_DIED); - return 1000; break; - case 23: me->SetUInt32Value(UNIT_FIELD_BYTES_1,0); return 2000; break; - case 24: me->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 5000; break; - case 25: DoScriptText(OVERLORD_SAY_6, me); return 2000; break; - case 26: - if (plr) - CAST_PLR(plr)->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, me); - return 6000; break; - case 27: + if (PlayerGUID) { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); - return 500; } - break; - case 28: - plr->RemoveAurasDueToSpell(SPELL_TWO); - plr->RemoveAurasDueToSpell(41519); - plr->CastSpell(plr, SPELL_THREE, true); - plr->CastSpell(plr, SPELL_FOUR, true); - return 1000; break; - case 29: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, plr); - return 5000; } - break; - case 30: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); - return 5000; } - break; - case 31: - { - Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); - if (Yarzill) - Yarzill->CastSpell(plr, 41540, true); - return 1000;} -break; - case 32: me->GetMotionMaster()->MovePoint(0, -5085.77, 577.231, 86.6719); return 5000; break; - case 33: Reset(); return 100; break; - - default : return 0; - } - } - - void UpdateAI(const uint32 diff) - { - if (!ConversationTimer) - return; - - if (ConversationTimer <= diff) - { - if (Event && IllidanGUID && PlayerGUID) - { - ConversationTimer = NextStep(++Step); + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + DoScriptText(OVERLORD_SAY_1, me, pPlayer); } - } else ConversationTimer -= diff; - } + ConversationTimer = 4200; + Step = 0; + Event = true; + } + + uint32 NextStep(uint32 Step) + { + Unit* plr = Unit::GetUnit((*me), PlayerGUID); + + Unit* Illi = Unit::GetUnit((*me), IllidanGUID); + + if (!plr || !Illi) + { + EnterEvadeMode(); + return 0; + } + + switch(Step) + { + case 0: return 0; break; + case 1: me->GetMotionMaster()->MovePoint(0, -5104.41, 595.297, 85.6838); return 9000; break; + case 2: DoScriptText(OVERLORD_YELL_1, me, plr); return 4500; break; + case 3: me->SetInFront(plr); return 3200; break; + case 4: DoScriptText(OVERLORD_SAY_2, me, plr); return 2000; break; + case 5: Illi->SetVisibility(VISIBILITY_ON); + Illi->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); return 350; break; + case 6: + Illi->CastSpell(Illi, SPELL_ONE, true); + Illi->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetUInt64Value(UNIT_FIELD_TARGET, IllidanGUID); + return 2000; break; + case 7: DoScriptText(OVERLORD_YELL_2, me); return 4500; break; + case 8: me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); return 2500; break; + case 9: DoScriptText(OVERLORD_SAY_3, me); return 6500; break; + case 10: DoScriptText(LORD_ILLIDAN_SAY_1, Illi); return 5000; break; + case 11: DoScriptText(OVERLORD_SAY_4, me, plr); return 6000; break; + case 12: DoScriptText(LORD_ILLIDAN_SAY_2, Illi); return 5500; break; + case 13: DoScriptText(LORD_ILLIDAN_SAY_3, Illi); return 4000; break; + case 14: Illi->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 1500; break; + case 15: DoScriptText(LORD_ILLIDAN_SAY_4, Illi); return 1500; break; + case 16: + if (plr) + { + Illi->CastSpell(plr, SPELL_TWO, true); + plr->RemoveAurasDueToSpell(SPELL_THREE); + plr->RemoveAurasDueToSpell(SPELL_FOUR); + return 5000; + }else{ + CAST_PLR(plr)->FailQuest(QUEST_LORD_ILLIDAN_STORMRAGE); Step = 30; return 100; + } + break; + case 17: DoScriptText(LORD_ILLIDAN_SAY_5, Illi); return 5000; break; + case 18: DoScriptText(LORD_ILLIDAN_SAY_6, Illi); return 5000; break; + case 19: DoScriptText(LORD_ILLIDAN_SAY_7, Illi); return 5000; break; + case 20: + Illi->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Illi->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + return 500; break; + case 21: DoScriptText(OVERLORD_SAY_5, me); return 500; break; + case 22: + Illi->SetVisibility(VISIBILITY_OFF); + Illi->setDeathState(JUST_DIED); + return 1000; break; + case 23: me->SetUInt32Value(UNIT_FIELD_BYTES_1,0); return 2000; break; + case 24: me->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); return 5000; break; + case 25: DoScriptText(OVERLORD_SAY_6, me); return 2000; break; + case 26: + if (plr) + CAST_PLR(plr)->GroupEventHappens(QUEST_LORD_ILLIDAN_STORMRAGE, me); + return 6000; break; + case 27: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, PlayerGUID); + return 500; } + break; + case 28: + plr->RemoveAurasDueToSpell(SPELL_TWO); + plr->RemoveAurasDueToSpell(41519); + plr->CastSpell(plr, SPELL_THREE, true); + plr->CastSpell(plr, SPELL_FOUR, true); + return 1000; break; + case 29: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + DoScriptText(YARZILL_THE_MERC_SAY, Yarzill, plr); + return 5000; } + break; + case 30: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->SetUInt64Value(UNIT_FIELD_TARGET, 0); + return 5000; } + break; + case 31: + { + Unit* Yarzill = me->FindNearestCreature(C_YARZILL, 50); + if (Yarzill) + Yarzill->CastSpell(plr, 41540, true); + return 1000;} + break; + case 32: me->GetMotionMaster()->MovePoint(0, -5085.77, 577.231, 86.6719); return 5000; break; + case 33: Reset(); return 100; break; + + default : return 0; + } + } + + void UpdateAI(const uint32 diff) + { + if (!ConversationTimer) + return; + + if (ConversationTimer <= diff) + { + if (Event && IllidanGUID && PlayerGUID) + { + ConversationTimer = NextStep(++Step); + } + } else ConversationTimer -= diff; + } + }; + }; -CreatureAI* GetAI_npc_overlord_morghor(Creature* pCreature) -{ -return new npc_overlord_morghorAI(pCreature); -} -bool QuestAccept_npc_overlord_morghor(Player* pPlayer, Creature* pCreature, const Quest *_Quest) -{ - if (_Quest->GetQuestId() == QUEST_LORD_ILLIDAN_STORMRAGE) - { - CAST_AI(npc_overlord_morghorAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - CAST_AI(npc_overlord_morghorAI, pCreature->AI())->StartEvent(); - return true; - } - return false; -} /*#### # npc_earthmender_wilda @@ -881,150 +951,158 @@ enum eEarthmender NPC_COILSKAR_ASSASSIN = 21044, FACTION_EARTHEN = 1726 //guessed }; - -struct npc_earthmender_wildaAI : public npc_escortAI + class npc_earthmender_wilda : public CreatureScript { - npc_earthmender_wildaAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_earthmender_wilda() : CreatureScript("npc_earthmender_wilda") { } - uint32 m_uiHealingTimer; - - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_uiHealingTimer = 0; - } - - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_ESCAPE_COILSCAR) { - case 13: - DoScriptText(SAY_WIL_PROGRESS1, me, pPlayer); - DoSpawnAssassin(); - break; - case 14: - DoSpawnAssassin(); - break; - case 15: - DoScriptText(SAY_WIL_FIND_EXIT, me, pPlayer); - break; - case 19: - DoRandomSay(); - break; - case 20: - DoSpawnAssassin(); - break; - case 26: - DoRandomSay(); - break; - case 27: - DoSpawnAssassin(); - break; - case 33: - DoRandomSay(); - break; - case 34: - DoSpawnAssassin(); - break; - case 37: - DoRandomSay(); - break; - case 38: - DoSpawnAssassin(); - break; - case 39: - DoScriptText(SAY_WIL_JUST_AHEAD, me, pPlayer); - break; - case 43: - DoRandomSay(); - break; - case 44: - DoSpawnAssassin(); - break; - case 50: - DoScriptText(SAY_WIL_END, me, pPlayer); + DoScriptText(SAY_WIL_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_EARTHEN); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); - break; + if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wilda::npc_earthmender_wildaAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void JustSummoned(Creature* pSummoned) + CreatureAI* GetAI(Creature* pCreature) const { - if (pSummoned->GetEntry() == NPC_COILSKAR_ASSASSIN) - pSummoned->AI()->AttackStart(me); + return new npc_earthmender_wildaAI(pCreature); } - //this is very unclear, random say without no real relevance to script/event - void DoRandomSay() + struct npc_earthmender_wildaAI : public npc_escortAI { - DoScriptText(RAND(SAY_WIL_PROGRESS2,SAY_WIL_PROGRESS4,SAY_WIL_PROGRESS5), me); - } + npc_earthmender_wildaAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void DoSpawnAssassin() - { - //unknown where they actually appear - DoSummon(NPC_COILSKAR_ASSASSIN, me, 15.0f, 5000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); - } + uint32 m_uiHealingTimer; - void EnterCombat(Unit* pWho) - { - //don't always use - if (rand()%5) - return; - - //only aggro text if not player - if (pWho->GetTypeId() != TYPEID_PLAYER) + void Reset() { - //appears to be random - if (urand(0,1)) - DoScriptText(RAND(SAY_WIL_AGGRO1, SAY_WIL_AGGRO2), pWho); + m_uiHealingTimer = 0; } - } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - - if (!UpdateVictim()) - return; - - //TODO: add more abilities - if (me->GetHealth()*100 / me->GetMaxHealth() <= 30) + void WaypointReached(uint32 uiPointId) { - if (m_uiHealingTimer <= uiDiff) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) { - DoCast(me, SPELL_HEALING_WAVE); - m_uiHealingTimer = 15000; + case 13: + DoScriptText(SAY_WIL_PROGRESS1, me, pPlayer); + DoSpawnAssassin(); + break; + case 14: + DoSpawnAssassin(); + break; + case 15: + DoScriptText(SAY_WIL_FIND_EXIT, me, pPlayer); + break; + case 19: + DoRandomSay(); + break; + case 20: + DoSpawnAssassin(); + break; + case 26: + DoRandomSay(); + break; + case 27: + DoSpawnAssassin(); + break; + case 33: + DoRandomSay(); + break; + case 34: + DoSpawnAssassin(); + break; + case 37: + DoRandomSay(); + break; + case 38: + DoSpawnAssassin(); + break; + case 39: + DoScriptText(SAY_WIL_JUST_AHEAD, me, pPlayer); + break; + case 43: + DoRandomSay(); + break; + case 44: + DoSpawnAssassin(); + break; + case 50: + DoScriptText(SAY_WIL_END, me, pPlayer); + + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, me); + break; } - else - m_uiHealingTimer -= uiDiff; } - } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_COILSKAR_ASSASSIN) + pSummoned->AI()->AttackStart(me); + } + + //this is very unclear, random say without no real relevance to script/event + void DoRandomSay() + { + DoScriptText(RAND(SAY_WIL_PROGRESS2,SAY_WIL_PROGRESS4,SAY_WIL_PROGRESS5), me); + } + + void DoSpawnAssassin() + { + //unknown where they actually appear + DoSummon(NPC_COILSKAR_ASSASSIN, me, 15.0f, 5000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT); + } + + void EnterCombat(Unit* pWho) + { + //don't always use + if (rand()%5) + return; + + //only aggro text if not player + if (pWho->GetTypeId() != TYPEID_PLAYER) + { + //appears to be random + if (urand(0,1)) + DoScriptText(RAND(SAY_WIL_AGGRO1, SAY_WIL_AGGRO2), pWho); + } + } + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + + if (!UpdateVictim()) + return; + + //TODO: add more abilities + if (me->GetHealth()*100 / me->GetMaxHealth() <= 30) + { + if (m_uiHealingTimer <= uiDiff) + { + DoCast(me, SPELL_HEALING_WAVE); + m_uiHealingTimer = 15000; + } + else + m_uiHealingTimer -= uiDiff; + } + } + }; + }; -CreatureAI* GetAI_npc_earthmender_wilda(Creature* pCreature) -{ - return new npc_earthmender_wildaAI(pCreature); -} -bool QuestAccept_npc_earthmender_wilda(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_ESCAPE_COILSCAR) - { - DoScriptText(SAY_WIL_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_EARTHEN); - - if (npc_earthmender_wildaAI* pEscortAI = CAST_AI(npc_earthmender_wildaAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*##### # Quest: Battle of the crimson watch @@ -1122,501 +1200,528 @@ static SpawnSpells SpawnCast[]= {25000, 28000, 33961} // Torloth the Magnificent Cast - Spell Reflection }; -/*###### -# mob_illidari_spawn -######*/ - -struct mob_illidari_spawnAI : public ScriptedAI -{ - mob_illidari_spawnAI(Creature* c) : ScriptedAI(c) {} - - uint64 LordIllidanGUID; - uint32 SpellTimer1, SpellTimer2, SpellTimer3; - bool Timers; - - void Reset() - { - LordIllidanGUID = 0; - Timers = false; - } - - void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* slayer); - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!Timers) - { - if (me->GetEntry() == 22075)//Illidari Soldier - { - SpellTimer1 = SpawnCast[0].Timer1 + (rand()%4 * 1000); - } - if (me->GetEntry() == 22074)//Illidari Mind Breaker - { - SpellTimer1 = SpawnCast[1].Timer1 + (rand()%10 * 1000); - SpellTimer2 = SpawnCast[2].Timer1 + (rand()%4 * 1000); - SpellTimer3 = SpawnCast[3].Timer1 + (rand()%4 * 1000); - } - if (me->GetEntry() == 19797)// Illidari Highlord - { - SpellTimer1 = SpawnCast[4].Timer1 + (rand()%4 * 1000); - SpellTimer2 = SpawnCast[5].Timer1 + (rand()%4 * 1000); - } - Timers = true; - } - //Illidari Soldier - if (me->GetEntry() == 22075) - { - if (SpellTimer1 <= diff) - { - DoCast(me->getVictim(), SpawnCast[0].SpellId);//Spellbreaker - SpellTimer1 = SpawnCast[0].Timer2 + (rand()%5 * 1000); - } else SpellTimer1 -= diff; - } - //Illidari Mind Breaker - if (me->GetEntry() == 22074) - { - if (SpellTimer1 <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - if (pTarget->GetTypeId() == TYPEID_PLAYER) - { - DoCast(pTarget, SpawnCast[1].SpellId); //Focused Bursts - SpellTimer1 = SpawnCast[1].Timer2 + (rand()%5 * 1000); - } else SpellTimer1 = 2000; - } - } else SpellTimer1 -= diff; - - if (SpellTimer2 <= diff) - { - DoCast(me->getVictim(), SpawnCast[2].SpellId);//Psychic Scream - SpellTimer2 = SpawnCast[2].Timer2 + (rand()%13 * 1000); - } else SpellTimer2 -= diff; - - if (SpellTimer3 <= diff) - { - DoCast(me->getVictim(), SpawnCast[3].SpellId);//Mind Blast - SpellTimer3 = SpawnCast[3].Timer2 + (rand()%8 * 1000); - } else SpellTimer3 -= diff; - } - //Illidari Highlord - if (me->GetEntry() == 19797) - { - if (SpellTimer1 <= diff) - { - DoCast(me->getVictim(), SpawnCast[4].SpellId);//Curse Of Flames - SpellTimer1 = SpawnCast[4].Timer2 + (rand()%10 * 1000); - } else SpellTimer1 -= diff; - - if (SpellTimer2 <= diff) - { - DoCast(me->getVictim(), SpawnCast[5].SpellId);//Flamestrike - SpellTimer2 = SpawnCast[5].Timer2 + (rand()%7 * 13000); - } else SpellTimer2 -= diff; - } - - DoMeleeAttackIfReady(); - } -}; - /*###### # mob_torloth_the_magnificent #####*/ - -struct mob_torloth_the_magnificentAI : public ScriptedAI + class mob_torloth_the_magnificent : public CreatureScript { - mob_torloth_the_magnificentAI(Creature* c) : ScriptedAI(c) {} +public: + mob_torloth_the_magnificent() : CreatureScript("mob_torloth_the_magnificent") { } - uint32 AnimationTimer, SpellTimer1, SpellTimer2, SpellTimer3; - - uint8 AnimationCount; - - uint64 LordIllidanGUID; - uint64 AggroTargetGUID; - - bool Timers; - - void Reset() + CreatureAI* GetAI(Creature* c) { - AnimationTimer = 4000; - AnimationCount = 0; - LordIllidanGUID = 0; - AggroTargetGUID = 0; - Timers = false; - - me->addUnitState(UNIT_STAT_ROOT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + return new mob_torloth_the_magnificentAI(c); } - void EnterCombat(Unit* /*who*/){} - - void HandleAnimation() + struct mob_torloth_the_magnificentAI : public ScriptedAI { - Creature* pCreature = me; + mob_torloth_the_magnificentAI(Creature* c) : ScriptedAI(c) {} - if (TorlothAnim[AnimationCount].pCreature == 1) + uint32 AnimationTimer, SpellTimer1, SpellTimer2, SpellTimer3; + + uint8 AnimationCount; + + uint64 LordIllidanGUID; + uint64 AggroTargetGUID; + + bool Timers; + + void Reset() { - pCreature = (Unit::GetCreature(*me, LordIllidanGUID)); + AnimationTimer = 4000; + AnimationCount = 0; + LordIllidanGUID = 0; + AggroTargetGUID = 0; + Timers = false; - if (!pCreature) - return; + me->addUnitState(UNIT_STAT_ROOT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); } - if (TorlothAnim[AnimationCount].TextId) - DoScriptText(TorlothAnim[AnimationCount].TextId, pCreature); + void EnterCombat(Unit* /*who*/){} - AnimationTimer = TorlothAnim[AnimationCount].Timer; - - switch(AnimationCount) + void HandleAnimation() { - case 0: - me->SetUInt32Value(UNIT_FIELD_BYTES_1,8); - break; - case 3: - me->RemoveFlag(UNIT_FIELD_BYTES_1,8); - break; - case 5: - if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) + Creature* pCreature = me; + + if (TorlothAnim[AnimationCount].pCreature == 1) { - me->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID()); - me->AddThreat(AggroTarget, 1); - me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); + pCreature = (Unit::GetCreature(*me, LordIllidanGUID)); + + if (!pCreature) + return; } - break; - case 6: - if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) - { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->clearUnitState(UNIT_STAT_ROOT); - float x, y, z; - AggroTarget->GetPosition(x,y,z); - me->GetMotionMaster()->MovePoint(0,x,y,z); + if (TorlothAnim[AnimationCount].TextId) + DoScriptText(TorlothAnim[AnimationCount].TextId, pCreature); + + AnimationTimer = TorlothAnim[AnimationCount].Timer; + + switch(AnimationCount) + { + case 0: + me->SetUInt32Value(UNIT_FIELD_BYTES_1,8); + break; + case 3: + me->RemoveFlag(UNIT_FIELD_BYTES_1,8); + break; + case 5: + if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) + { + me->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID()); + me->AddThreat(AggroTarget, 1); + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); + } + break; + case 6: + if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->clearUnitState(UNIT_STAT_ROOT); + + float x, y, z; + AggroTarget->GetPosition(x,y,z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + } + break; } - break; + ++AnimationCount; } - ++AnimationCount; - } - void UpdateAI(const uint32 diff) - { - if (AnimationTimer) + void UpdateAI(const uint32 diff) { - if (AnimationTimer <= diff) + if (AnimationTimer) { - HandleAnimation(); - } else AnimationTimer -= diff; - } + if (AnimationTimer <= diff) + { + HandleAnimation(); + } else AnimationTimer -= diff; + } - if (AnimationCount < 6) - { - me->CombatStop(); - } else if (!Timers) - { - - SpellTimer1 = SpawnCast[6].Timer1; - SpellTimer2 = SpawnCast[7].Timer1; - SpellTimer3 = SpawnCast[8].Timer1; - Timers = true; - } - - if (Timers) - { - if (SpellTimer1 <= diff) + if (AnimationCount < 6) { - DoCast(me->getVictim(), SpawnCast[6].SpellId);//Cleave - SpellTimer1 = SpawnCast[6].Timer2 + (rand()%10 * 1000); - } else SpellTimer1 -= diff; - - if (SpellTimer2 <= diff) + me->CombatStop(); + } else if (!Timers) { - DoCast(me->getVictim(), SpawnCast[7].SpellId);//Shadowfury - SpellTimer2 = SpawnCast[7].Timer2 + (rand()%5 * 1000); - } else SpellTimer2 -= diff; - if (SpellTimer3 <= diff) + SpellTimer1 = SpawnCast[6].Timer1; + SpellTimer2 = SpawnCast[7].Timer1; + SpellTimer3 = SpawnCast[8].Timer1; + Timers = true; + } + + if (Timers) { - DoCast(me, SpawnCast[8].SpellId); - SpellTimer3 = SpawnCast[8].Timer2 + (rand()%7 * 1000);//Spell Reflection - } else SpellTimer3 -= diff; + if (SpellTimer1 <= diff) + { + DoCast(me->getVictim(), SpawnCast[6].SpellId);//Cleave + SpellTimer1 = SpawnCast[6].Timer2 + (rand()%10 * 1000); + } else SpellTimer1 -= diff; + + if (SpellTimer2 <= diff) + { + DoCast(me->getVictim(), SpawnCast[7].SpellId);//Shadowfury + SpellTimer2 = SpawnCast[7].Timer2 + (rand()%5 * 1000); + } else SpellTimer2 -= diff; + + if (SpellTimer3 <= diff) + { + DoCast(me, SpawnCast[8].SpellId); + SpellTimer3 = SpawnCast[8].Timer2 + (rand()%7 * 1000);//Spell Reflection + } else SpellTimer3 -= diff; + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* slayer) - { - if (slayer) - switch(slayer->GetTypeId()) + void JustDied(Unit* slayer) { - case TYPEID_UNIT: - if (Unit *owner = slayer->GetOwner()) - if (owner->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); - break; + if (slayer) + switch(slayer->GetTypeId()) + { + case TYPEID_UNIT: + if (Unit *owner = slayer->GetOwner()) + if (owner->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(owner)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); + break; - case TYPEID_PLAYER: - CAST_PLR(slayer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); - break; - } + case TYPEID_PLAYER: + CAST_PLR(slayer)->GroupEventHappens(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, me); + break; + } - if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) - { - DoScriptText(END_TEXT, LordIllidan, slayer); - LordIllidan->AI()->EnterEvadeMode(); + if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) + { + DoScriptText(END_TEXT, LordIllidan, slayer); + LordIllidan->AI()->EnterEvadeMode(); + } } - } + }; + }; /*##### # npc_lord_illidan_stormrage #####*/ - -struct npc_lord_illidan_stormrageAI : public ScriptedAI + class npc_lord_illidan_stormrage : public CreatureScript { - npc_lord_illidan_stormrageAI(Creature* c) : ScriptedAI(c) {} +public: + npc_lord_illidan_stormrage() : CreatureScript("npc_lord_illidan_stormrage") { } - uint64 PlayerGUID; - - uint32 WaveTimer; - uint32 AnnounceTimer; - - int8 LiveCount; - uint8 WaveCount; - - bool EventStarted; - bool Announced; - bool Failed; - - void Reset() + CreatureAI* GetAI(Creature* c) { - PlayerGUID = 0; - - WaveTimer = 10000; - AnnounceTimer = 7000; - LiveCount = 0; - WaveCount = 0; - - EventStarted = false; - Announced = false; - Failed = false; - - me->SetVisibility(VISIBILITY_OFF); + return new npc_lord_illidan_stormrageAI(c); } - void EnterCombat(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void AttackStart(Unit* /*who*/) {} - - void SummonNextWave() + struct npc_lord_illidan_stormrageAI : public ScriptedAI { - uint8 count = WavesInfo[WaveCount].SpawnCount; - uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; - srand(time(NULL));//initializing random seed - uint8 FelguardCount = 0; - uint8 DreadlordCount = 0; + npc_lord_illidan_stormrageAI(Creature* c) : ScriptedAI(c) {} - for (uint8 i = 0; i < count; ++i) + uint64 PlayerGUID; + + uint32 WaveTimer; + uint32 AnnounceTimer; + + int8 LiveCount; + uint8 WaveCount; + + bool EventStarted; + bool Announced; + bool Failed; + + void Reset() { - Creature* Spawn = NULL; - float X = SpawnLocation[locIndex + i].x; - float Y = SpawnLocation[locIndex + i].y; - float Z = SpawnLocation[locIndex + i].z; - float O = SpawnLocation[locIndex + i].o; - Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); - ++LiveCount; + PlayerGUID = 0; - if (Spawn) - { - Spawn->LoadCreaturesAddon(); + WaveTimer = 10000; + AnnounceTimer = 7000; + LiveCount = 0; + WaveCount = 0; - if (WaveCount == 0)//1 Wave - { - if (rand()%3 == 1 && FelguardCount<2) - { - Spawn->SetDisplayId(18654); - ++FelguardCount; - } - else if (DreadlordCount < 3) - { - Spawn->SetDisplayId(19991); - ++DreadlordCount; - } - else if (FelguardCount<2) - { - Spawn->SetDisplayId(18654); - ++FelguardCount; - } - } + EventStarted = false; + Announced = false; + Failed = false; - if (WaveCount < 3)//1-3 Wave - { - if (PlayerGUID) - { - if (Player* pTarget = Unit::GetPlayer(*me, PlayerGUID)) - { - float x, y, z; - pTarget->GetPosition(x,y,z); - Spawn->GetMotionMaster()->MovePoint(0,x, y, z); - } - } - CAST_AI(mob_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); - } - - if (WavesInfo[WaveCount].CreatureId == 22076) // Torloth - { - CAST_AI(mob_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); - if (PlayerGUID) - CAST_AI(mob_torloth_the_magnificentAI, Spawn->AI())->AggroTargetGUID = PlayerGUID; - } - } + me->SetVisibility(VISIBILITY_OFF); } - ++WaveCount; - WaveTimer = WavesInfo[WaveCount].SpawnTimer; - AnnounceTimer = WavesInfo[WaveCount].YellTimer; - } - void CheckEventFail() - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + void EnterCombat(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void AttackStart(Unit* /*who*/) {} - if (!pPlayer) - return; + void SummonNextWave(); - if (Group *EventGroup = pPlayer->GetGroup()) + void CheckEventFail() { - Player* GroupMember; + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - uint8 GroupMemberCount = 0; - uint8 DeadMemberCount = 0; - uint8 FailedMemberCount = 0; + if (!pPlayer) + return; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - - for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) + if (Group *EventGroup = pPlayer->GetGroup()) { - GroupMember = (Unit::GetPlayer(*me, itr->guid)); - if (!GroupMember) - continue; - if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) - { - GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); - GroupMember->SetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, QUEST_STATUS_NONE); - ++FailedMemberCount; - } - ++GroupMemberCount; + Player* GroupMember; - if (GroupMember->isDead()) - { - ++DeadMemberCount; - } - } + uint8 GroupMemberCount = 0; + uint8 DeadMemberCount = 0; + uint8 FailedMemberCount = 0; - if (GroupMemberCount == FailedMemberCount) - { - Failed = true; - } + const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - if (GroupMemberCount == DeadMemberCount) - { for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { - GroupMember = Unit::GetPlayer(*me, itr->guid); - - if (GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) + GroupMember = (Unit::GetPlayer(*me, itr->guid)); + if (!GroupMember) + continue; + if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) { GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); GroupMember->SetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, QUEST_STATUS_NONE); + ++FailedMemberCount; + } + ++GroupMemberCount; + + if (GroupMember->isDead()) + { + ++DeadMemberCount; } } + + if (GroupMemberCount == FailedMemberCount) + { + Failed = true; + } + + if (GroupMemberCount == DeadMemberCount) + { + for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) + { + GroupMember = Unit::GetPlayer(*me, itr->guid); + + if (GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE) + { + GroupMember->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); + GroupMember->SetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH, QUEST_STATUS_NONE); + } + } + Failed = true; + } + } else if (pPlayer->isDead() || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) + { + pPlayer->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); Failed = true; } - } else if (pPlayer->isDead() || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) - { - pPlayer->FailQuest(QUEST_BATTLE_OF_THE_CRIMSON_WATCH); - Failed = true; } - } - void LiveCounter() - { - --LiveCount; - if (!LiveCount) - Announced = false; - } - - void UpdateAI(const uint32 diff) - { - if (!PlayerGUID || !EventStarted) - return; - - if (!LiveCount && WaveCount < 4) + void LiveCounter() { - if (!Announced && AnnounceTimer <= diff) - { - DoScriptText(WavesInfo[WaveCount].WaveTextId, me); - Announced = true; - } else AnnounceTimer -= diff; - - if (WaveTimer <= diff) - { - SummonNextWave(); - } else WaveTimer -= diff; + --LiveCount; + if (!LiveCount) + Announced = false; } - CheckEventFail(); - if (Failed) - EnterEvadeMode(); - } + void UpdateAI(const uint32 diff) + { + if (!PlayerGUID || !EventStarted) + return; + + if (!LiveCount && WaveCount < 4) + { + if (!Announced && AnnounceTimer <= diff) + { + DoScriptText(WavesInfo[WaveCount].WaveTextId, me); + Announced = true; + } else AnnounceTimer -= diff; + + if (WaveTimer <= diff) + { + SummonNextWave(); + } else WaveTimer -= diff; + } + CheckEventFail(); + + if (Failed) + EnterEvadeMode(); + } + }; + }; -void mob_illidari_spawnAI::JustDied(Unit * /*slayer*/) +/*###### +# mob_illidari_spawn +######*/ + class mob_illidari_spawn : public CreatureScript { - me->RemoveCorpse(); - if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) - if (LordIllidan) - CAST_AI(npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); +public: + mob_illidari_spawn() : CreatureScript("mob_illidari_spawn") { } + + CreatureAI* GetAI(Creature* c) + { + return new mob_illidari_spawnAI(c); + } + + struct mob_illidari_spawnAI : public ScriptedAI + { + mob_illidari_spawnAI(Creature* c) : ScriptedAI(c) {} + + uint64 LordIllidanGUID; + uint32 SpellTimer1, SpellTimer2, SpellTimer3; + bool Timers; + + void Reset() + { + LordIllidanGUID = 0; + Timers = false; + } + + void EnterCombat(Unit* /*who*/) {} + void JustDied(Unit * /*slayer*/) + { + me->RemoveCorpse(); + if (Creature* LordIllidan = (Unit::GetCreature(*me, LordIllidanGUID))) + if (LordIllidan) + CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, LordIllidan->AI())->LiveCounter(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!Timers) + { + if (me->GetEntry() == 22075)//Illidari Soldier + { + SpellTimer1 = SpawnCast[0].Timer1 + (rand()%4 * 1000); + } + if (me->GetEntry() == 22074)//Illidari Mind Breaker + { + SpellTimer1 = SpawnCast[1].Timer1 + (rand()%10 * 1000); + SpellTimer2 = SpawnCast[2].Timer1 + (rand()%4 * 1000); + SpellTimer3 = SpawnCast[3].Timer1 + (rand()%4 * 1000); + } + if (me->GetEntry() == 19797)// Illidari Highlord + { + SpellTimer1 = SpawnCast[4].Timer1 + (rand()%4 * 1000); + SpellTimer2 = SpawnCast[5].Timer1 + (rand()%4 * 1000); + } + Timers = true; + } + //Illidari Soldier + if (me->GetEntry() == 22075) + { + if (SpellTimer1 <= diff) + { + DoCast(me->getVictim(), SpawnCast[0].SpellId);//Spellbreaker + SpellTimer1 = SpawnCast[0].Timer2 + (rand()%5 * 1000); + } else SpellTimer1 -= diff; + } + //Illidari Mind Breaker + if (me->GetEntry() == 22074) + { + if (SpellTimer1 <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget->GetTypeId() == TYPEID_PLAYER) + { + DoCast(pTarget, SpawnCast[1].SpellId); //Focused Bursts + SpellTimer1 = SpawnCast[1].Timer2 + (rand()%5 * 1000); + } else SpellTimer1 = 2000; + } + } else SpellTimer1 -= diff; + + if (SpellTimer2 <= diff) + { + DoCast(me->getVictim(), SpawnCast[2].SpellId);//Psychic Scream + SpellTimer2 = SpawnCast[2].Timer2 + (rand()%13 * 1000); + } else SpellTimer2 -= diff; + + if (SpellTimer3 <= diff) + { + DoCast(me->getVictim(), SpawnCast[3].SpellId);//Mind Blast + SpellTimer3 = SpawnCast[3].Timer2 + (rand()%8 * 1000); + } else SpellTimer3 -= diff; + } + //Illidari Highlord + if (me->GetEntry() == 19797) + { + if (SpellTimer1 <= diff) + { + DoCast(me->getVictim(), SpawnCast[4].SpellId);//Curse Of Flames + SpellTimer1 = SpawnCast[4].Timer2 + (rand()%10 * 1000); + } else SpellTimer1 -= diff; + + if (SpellTimer2 <= diff) + { + DoCast(me->getVictim(), SpawnCast[5].SpellId);//Flamestrike + SpellTimer2 = SpawnCast[5].Timer2 + (rand()%7 * 13000); + } else SpellTimer2 -= diff; + } + + DoMeleeAttackIfReady(); + } + }; + +}; + +void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() +{ + uint8 count = WavesInfo[WaveCount].SpawnCount; + uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; + srand(time(NULL));//initializing random seed + uint8 FelguardCount = 0; + uint8 DreadlordCount = 0; + + for (uint8 i = 0; i < count; ++i) + { + Creature* Spawn = NULL; + float X = SpawnLocation[locIndex + i].x; + float Y = SpawnLocation[locIndex + i].y; + float Z = SpawnLocation[locIndex + i].z; + float O = SpawnLocation[locIndex + i].o; + Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + ++LiveCount; + + if (Spawn) + { + Spawn->LoadCreaturesAddon(); + + if (WaveCount == 0)//1 Wave + { + if (rand()%3 == 1 && FelguardCount<2) + { + Spawn->SetDisplayId(18654); + ++FelguardCount; + } + else if (DreadlordCount < 3) + { + Spawn->SetDisplayId(19991); + ++DreadlordCount; + } + else if (FelguardCount<2) + { + Spawn->SetDisplayId(18654); + ++FelguardCount; + } + } + + if (WaveCount < 3)//1-3 Wave + { + if (PlayerGUID) + { + if (Player* pTarget = Unit::GetPlayer(*me, PlayerGUID)) + { + float x, y, z; + pTarget->GetPosition(x,y,z); + Spawn->GetMotionMaster()->MovePoint(0,x, y, z); + } + } + CAST_AI(mob_illidari_spawn::mob_illidari_spawnAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); + } + + if (WavesInfo[WaveCount].CreatureId == 22076) // Torloth + { + CAST_AI(mob_torloth_the_magnificent::mob_torloth_the_magnificentAI, Spawn->AI())->LordIllidanGUID = me->GetGUID(); + if (PlayerGUID) + CAST_AI(mob_torloth_the_magnificent::mob_torloth_the_magnificentAI, Spawn->AI())->AggroTargetGUID = PlayerGUID; + } + } + } + ++WaveCount; + WaveTimer = WavesInfo[WaveCount].SpawnTimer; + AnnounceTimer = WavesInfo[WaveCount].YellTimer; } /*##### # go_crystal_prison ######*/ - -bool GOQuestAccept_GO_crystal_prison(Player* plr, GameObject* /*go*/, Quest const* quest) + class go_crystal_prison : public GameObjectScript { - if (quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH) +public: + go_crystal_prison() : GameObjectScript("go_crystal_prison") { } + + bool OnQuestAccept(Player* plr, GameObject* /*go*/, Quest const* quest) { - Creature* Illidan = plr->FindNearestCreature(22083, 50); - - if (Illidan && !CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted) + if (quest->GetQuestId() == QUEST_BATTLE_OF_THE_CRIMSON_WATCH) { - CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = plr->GetGUID(); - CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0; - CAST_AI(npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted=true; + Creature* Illidan = plr->FindNearestCreature(22083, 50); + + if (Illidan && !CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted) + { + CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->PlayerGUID = plr->GetGUID(); + CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->LiveCount = 0; + CAST_AI(npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI, Illidan->AI())->EventStarted=true; + } } + return true; } - return true; -} -CreatureAI* GetAI_npc_lord_illidan_stormrage(Creature* c) -{ - return new npc_lord_illidan_stormrageAI(c); -} +}; + -CreatureAI* GetAI_mob_illidari_spawn(Creature* c) -{ - return new mob_illidari_spawnAI(c); -} -CreatureAI* GetAI_mob_torloth_the_magnificent(Creature* c) -{ - return new mob_torloth_the_magnificentAI(c); -} /*#### # npc_enraged_spirits @@ -1661,76 +1766,82 @@ CreatureAI* GetAI_mob_torloth_the_magnificent(Creature* c) /* Factions */ #define ENRAGED_SOUL_FRIENDLY 35 #define ENRAGED_SOUL_HOSTILE 14 - -struct npc_enraged_spiritAI : public ScriptedAI + class npc_enraged_spirit : public CreatureScript { - npc_enraged_spiritAI(Creature *c) : ScriptedAI(c) {} +public: + npc_enraged_spirit() : CreatureScript("npc_enraged_spirit") { } - void Reset() { } - - void EnterCombat(Unit * /*who*/){} - - void JustDied(Unit* /*killer*/) + CreatureAI* GetAI(Creature* pCreature) const { - // always spawn spirit on death - // if totem around - // move spirit to totem and cast kill count - uint32 entry = 0; - uint32 credit = 0; - - switch(me->GetEntry()) { - case ENTRY_ENRAGED_FIRE_SPIRIT: - entry = ENTRY_FIERY_SOUL; - //credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT; - credit = CREDIT_FIRE; - break; - case ENTRY_ENRAGED_EARTH_SPIRIT: - entry = ENTRY_EARTHEN_SOUL; - //credit = SPELL_EARTHEN_SOUL_CAPTURED_CREDIT; - credit = CREDIT_EARTH; - break; - case ENTRY_ENRAGED_AIR_SPIRIT: - entry = ENTRY_ENRAGED_AIRY_SOUL; - //credit = SPELL_AIRY_SOUL_CAPTURED_CREDIT; - credit = CREDIT_AIR; - break; - case ENTRY_ENRAGED_WATER_SPIRIT: - entry = ENTRY_ENRAGED_WATERY_SOUL; - //credit = SPELL_WATERY_SOUL_CAPTURED_CREDIT; - credit = CREDIT_WATER; - break; - } - - // Spawn Soul on Kill ALWAYS! - Creature* Summoned = NULL; - Unit* totemOspirits = NULL; - - if (entry != 0) - Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); - - // FIND TOTEM, PROCESS QUEST - if (Summoned) - { - totemOspirits = me->FindNearestCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS); - if (totemOspirits) - { - Summoned->setFaction(ENRAGED_SOUL_FRIENDLY); - Summoned->GetMotionMaster()->MovePoint(0,totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ()); - - Unit* Owner = totemOspirits->GetOwner(); - if (Owner && Owner->GetTypeId() == TYPEID_PLAYER) - // DoCast(Owner, credit); -- not working! - CAST_PLR(Owner)->KilledMonsterCredit(credit, Summoned->GetGUID()); - DoCast(totemOspirits, SPELL_SOUL_CAPTURED); - } - } + return new npc_enraged_spiritAI(pCreature); } -}; -CreatureAI* GetAI_npc_enraged_spirit(Creature* pCreature) -{ -return new npc_enraged_spiritAI(pCreature); -} + struct npc_enraged_spiritAI : public ScriptedAI + { + npc_enraged_spiritAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + + void EnterCombat(Unit * /*who*/){} + + void JustDied(Unit* /*killer*/) + { + // always spawn spirit on death + // if totem around + // move spirit to totem and cast kill count + uint32 entry = 0; + uint32 credit = 0; + + switch(me->GetEntry()) { + case ENTRY_ENRAGED_FIRE_SPIRIT: + entry = ENTRY_FIERY_SOUL; + //credit = SPELL_FIERY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_FIRE; + break; + case ENTRY_ENRAGED_EARTH_SPIRIT: + entry = ENTRY_EARTHEN_SOUL; + //credit = SPELL_EARTHEN_SOUL_CAPTURED_CREDIT; + credit = CREDIT_EARTH; + break; + case ENTRY_ENRAGED_AIR_SPIRIT: + entry = ENTRY_ENRAGED_AIRY_SOUL; + //credit = SPELL_AIRY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_AIR; + break; + case ENTRY_ENRAGED_WATER_SPIRIT: + entry = ENTRY_ENRAGED_WATERY_SOUL; + //credit = SPELL_WATERY_SOUL_CAPTURED_CREDIT; + credit = CREDIT_WATER; + break; + } + + // Spawn Soul on Kill ALWAYS! + Creature* Summoned = NULL; + Unit* totemOspirits = NULL; + + if (entry != 0) + Summoned = DoSpawnCreature(entry, 0, 0, 1, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000); + + // FIND TOTEM, PROCESS QUEST + if (Summoned) + { + totemOspirits = me->FindNearestCreature(ENTRY_TOTEM_OF_SPIRITS, RADIUS_TOTEM_OF_SPIRITS); + if (totemOspirits) + { + Summoned->setFaction(ENRAGED_SOUL_FRIENDLY); + Summoned->GetMotionMaster()->MovePoint(0,totemOspirits->GetPositionX(), totemOspirits->GetPositionY(), Summoned->GetPositionZ()); + + Unit* Owner = totemOspirits->GetOwner(); + if (Owner && Owner->GetTypeId() == TYPEID_PLAYER) + // DoCast(Owner, credit); -- not working! + CAST_PLR(Owner)->KilledMonsterCredit(credit, Summoned->GetGUID()); + DoCast(totemOspirits, SPELL_SOUL_CAPTURED); + } + } + } + }; + +}; /*##### # @@ -1738,93 +1849,20 @@ return new npc_enraged_spiritAI(pCreature); void AddSC_shadowmoon_valley() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_mature_netherwing_drake"; - newscript->GetAI = &GetAI_mob_mature_netherwing_drake; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_enslaved_netherwing_drake"; - newscript->GetAI = &GetAI_mob_enslaved_netherwing_drake; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_dragonmaw_peon"; - newscript->GetAI = &GetAI_mob_dragonmaw_peon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_drake_dealer_hurlunk"; - newscript->pGossipHello = &GossipHello_npc_drake_dealer_hurlunk; - newscript->pGossipSelect = &GossipSelect_npc_drake_dealer_hurlunk; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npcs_flanis_swiftwing_and_kagrosh"; - newscript->pGossipHello = &GossipHello_npcs_flanis_swiftwing_and_kagrosh; - newscript->pGossipSelect = &GossipSelect_npcs_flanis_swiftwing_and_kagrosh; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_murkblood_overseer"; - newscript->pGossipHello = &GossipHello_npc_murkblood_overseer; - newscript->pGossipSelect = &GossipSelect_npc_murkblood_overseer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_neltharaku"; - newscript->pGossipHello = &GossipHello_npc_neltharaku; - newscript->pGossipSelect = &GossipSelect_npc_neltharaku; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_karynaku"; - newscript->pQuestAccept = &QuestAccept_npc_karynaku; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_oronok_tornheart"; - newscript->pGossipHello = &GossipHello_npc_oronok_tornheart; - newscript->pGossipSelect = &GossipSelect_npc_oronok_tornheart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_overlord_morghor"; - newscript->GetAI = &GetAI_npc_overlord_morghor; - newscript->pQuestAccept = &QuestAccept_npc_overlord_morghor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_earthmender_wilda"; - newscript->GetAI = &GetAI_npc_earthmender_wilda; - newscript->pQuestAccept = &QuestAccept_npc_earthmender_wilda; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lord_illidan_stormrage"; - newscript->GetAI = &GetAI_npc_lord_illidan_stormrage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_crystal_prison"; - newscript->pGOQuestAccept = &GOQuestAccept_GO_crystal_prison; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_illidari_spawn"; - newscript->GetAI = &GetAI_mob_illidari_spawn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_torloth_the_magnificent"; - newscript->GetAI = &GetAI_mob_torloth_the_magnificent; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_enraged_spirit"; - newscript->GetAI = &GetAI_npc_enraged_spirit; - newscript->RegisterSelf(); + new mob_mature_netherwing_drake(); + new mob_enslaved_netherwing_drake(); + new mob_dragonmaw_peon(); + new npc_drake_dealer_hurlunk(); + new npcs_flanis_swiftwing_and_kagrosh(); + new npc_murkblood_overseer(); + new npc_neltharaku(); + new npc_karynaku(); + new npc_oronok_tornheart(); + new npc_overlord_morghor(); + new npc_earthmender_wilda(); + new npc_lord_illidan_stormrage(); + new go_crystal_prison(); + new mob_illidari_spawn(); + new mob_torloth_the_magnificent(); + new npc_enraged_spirit(); } - diff --git a/src/server/scripts/Outland/shattrath_city.cpp b/src/server/scripts/Outland/shattrath_city.cpp index 419cb387e8b..feb768cb345 100644 --- a/src/server/scripts/Outland/shattrath_city.cpp +++ b/src/server/scripts/Outland/shattrath_city.cpp @@ -49,62 +49,71 @@ enum eRaliq QUEST_CRACK_SKULLS = 10009, FACTION_HOSTILE_RD = 45 }; - -struct npc_raliq_the_drunkAI : public ScriptedAI + class npc_raliq_the_drunk : public CreatureScript { - npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) +public: + npc_raliq_the_drunk() : CreatureScript("npc_raliq_the_drunk") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_uiNormFaction = c->getFaction(); - } - - uint32 m_uiNormFaction; - uint32 Uppercut_Timer; - - void Reset() - { - Uppercut_Timer = 5000; - me->RestoreFaction(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Uppercut_Timer <= diff) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 15000; - } else Uppercut_Timer -= diff; - - DoMeleeAttackIfReady(); + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(FACTION_HOSTILE_RD); + pCreature->AI()->AttackStart(pPlayer); + } + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_RALIQ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(9440, pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_raliq_the_drunkAI (pCreature); + } + + struct npc_raliq_the_drunkAI : public ScriptedAI + { + npc_raliq_the_drunkAI(Creature* c) : ScriptedAI(c) + { + m_uiNormFaction = c->getFaction(); + } + + uint32 m_uiNormFaction; + uint32 Uppercut_Timer; + + void Reset() + { + Uppercut_Timer = 5000; + me->RestoreFaction(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 15000; + } else Uppercut_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_raliq_the_drunk(Creature* pCreature) -{ - return new npc_raliq_the_drunkAI (pCreature); -} -bool GossipHello_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_RALIQ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9440, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE_RD); - pCreature->AI()->AttackStart(pPlayer); - } - return true; -} /*###### # npc_salsalabim @@ -115,64 +124,72 @@ bool GossipSelect_npc_raliq_the_drunk(Player* pPlayer, Creature* pCreature, uint #define QUEST_10004 10004 #define SPELL_MAGNETIC_PULL 31705 - -struct npc_salsalabimAI : public ScriptedAI + class npc_salsalabim : public CreatureScript { - npc_salsalabimAI(Creature* c) : ScriptedAI(c) {} +public: + npc_salsalabim() : CreatureScript("npc_salsalabim") { } - uint32 MagneticPull_Timer; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - MagneticPull_Timer = 15000; - me->RestoreFaction(); - } - - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetTypeId() == TYPEID_PLAYER) - if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 20) + if (pPlayer->GetQuestStatus(QUEST_10004) == QUEST_STATUS_INCOMPLETE) { - CAST_PLR(done_by)->GroupEventHappens(QUEST_10004,me); - damage = 0; - EnterEvadeMode(); + pCreature->setFaction(FACTION_HOSTILE_SA); + pCreature->AI()->AttackStart(pPlayer); } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (MagneticPull_Timer <= diff) + else + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + } + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_salsalabimAI (pCreature); + } + + struct npc_salsalabimAI : public ScriptedAI + { + npc_salsalabimAI(Creature* c) : ScriptedAI(c) {} + + uint32 MagneticPull_Timer; + + void Reset() { - DoCast(me->getVictim(), SPELL_MAGNETIC_PULL); MagneticPull_Timer = 15000; - } else MagneticPull_Timer -= diff; + me->RestoreFaction(); + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetTypeId() == TYPEID_PLAYER) + if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 20) + { + CAST_PLR(done_by)->GroupEventHappens(QUEST_10004,me); + damage = 0; + EnterEvadeMode(); + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (MagneticPull_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MAGNETIC_PULL); + MagneticPull_Timer = 15000; + } else MagneticPull_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_salsalabim(Creature* pCreature) -{ - return new npc_salsalabimAI (pCreature); -} -bool GossipHello_npc_salsalabim(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_10004) == QUEST_STATUS_INCOMPLETE) - { - pCreature->setFaction(FACTION_HOSTILE_SA); - pCreature->AI()->AttackStart(pPlayer); - } - else - { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - } - return true; -} /* ################################################## @@ -184,71 +201,85 @@ purchasable for one Mark of Illidari each Purchase requires exalted reputation with Scryers/Aldor, Cenarion Expedition and The Sha'tar ################################################## */ - -bool GossipHello_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature) + class npc_shattrathflaskvendors : public CreatureScript { - if (pCreature->GetEntry() == 23484) +public: + npc_shattrathflaskvendors() : CreatureScript("npc_shattrathflaskvendors") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - // Aldor vendor - if (pCreature->isVendor() && (pPlayer->GetReputationRank(932) == REP_EXALTED) && (pPlayer->GetReputationRank(935) == REP_EXALTED) && (pPlayer->GetReputationRank(942) == REP_EXALTED)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(11085, pCreature->GetGUID()); - } - else - { - pPlayer->SEND_GOSSIP_MENU(11083, pCreature->GetGUID()); - } + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - if (pCreature->GetEntry() == 23483) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - // Scryers vendor - if (pCreature->isVendor() && (pPlayer->GetReputationRank(934) == REP_EXALTED) && (pPlayer->GetReputationRank(935) == REP_EXALTED) && (pPlayer->GetReputationRank(942) == REP_EXALTED)) + if (pCreature->GetEntry() == 23484) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(11085, pCreature->GetGUID()); + // Aldor vendor + if (pCreature->isVendor() && (pPlayer->GetReputationRank(932) == REP_EXALTED) && (pPlayer->GetReputationRank(935) == REP_EXALTED) && (pPlayer->GetReputationRank(942) == REP_EXALTED)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(11085, pCreature->GetGUID()); + } + else + { + pPlayer->SEND_GOSSIP_MENU(11083, pCreature->GetGUID()); + } } - else + + if (pCreature->GetEntry() == 23483) { - pPlayer->SEND_GOSSIP_MENU(11084, pCreature->GetGUID()); + // Scryers vendor + if (pCreature->isVendor() && (pPlayer->GetReputationRank(934) == REP_EXALTED) && (pPlayer->GetReputationRank(935) == REP_EXALTED) && (pPlayer->GetReputationRank(942) == REP_EXALTED)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(11085, pCreature->GetGUID()); + } + else + { + pPlayer->SEND_GOSSIP_MENU(11084, pCreature->GetGUID()); + } } + + return true; } - return true; -} +}; -bool GossipSelect_npc_shattrathflaskvendors(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - - return true; -} /*###### # npc_zephyr ######*/ #define GOSSIP_HZ "Take me to the Caverns of Time." - -bool GossipHello_npc_zephyr(Player* pPlayer, Creature* pCreature) + class npc_zephyr : public CreatureScript { - if (pPlayer->GetReputationRank(989) >= REP_REVERED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HZ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_zephyr() : CreatureScript("npc_zephyr") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + pPlayer->CastSpell(pPlayer,37778,false); - return true; -} + return true; + } -bool GossipSelect_npc_zephyr(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - pPlayer->CastSpell(pPlayer,37778,false); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetReputationRank(989) >= REP_REVERED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HZ, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### # npc_kservant @@ -276,73 +307,79 @@ bool GossipSelect_npc_zephyr(Player* pPlayer, Creature* /*pCreature*/, uint32 /* #define WHISP19 -1000253 #define WHISP20 -1000254 #define WHISP21 -1000255 - -struct npc_kservantAI : public npc_escortAI +class npc_kservant : public CreatureScript { public: - npc_kservantAI(Creature *c) : npc_escortAI(c) {} + npc_kservant() : CreatureScript("npc_kservant") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) - { - case 0: DoScriptText(SAY1, me, pPlayer); break; - case 4: DoScriptText(WHISP1, me, pPlayer); break; - case 6: DoScriptText(WHISP2, me, pPlayer); break; - case 7: DoScriptText(WHISP3, me, pPlayer); break; - case 8: DoScriptText(WHISP4, me, pPlayer); break; - case 17: DoScriptText(WHISP5, me, pPlayer); break; - case 18: DoScriptText(WHISP6, me, pPlayer); break; - case 19: DoScriptText(WHISP7, me, pPlayer); break; - case 33: DoScriptText(WHISP8, me, pPlayer); break; - case 34: DoScriptText(WHISP9, me, pPlayer); break; - case 35: DoScriptText(WHISP10, me, pPlayer); break; - case 36: DoScriptText(WHISP11, me, pPlayer); break; - case 43: DoScriptText(WHISP12, me, pPlayer); break; - case 44: DoScriptText(WHISP13, me, pPlayer); break; - case 49: DoScriptText(WHISP14, me, pPlayer); break; - case 50: DoScriptText(WHISP15, me, pPlayer); break; - case 51: DoScriptText(WHISP16, me, pPlayer); break; - case 52: DoScriptText(WHISP17, me, pPlayer); break; - case 53: DoScriptText(WHISP18, me, pPlayer); break; - case 54: DoScriptText(WHISP19, me, pPlayer); break; - case 55: DoScriptText(WHISP20, me, pPlayer); break; - case 56: DoScriptText(WHISP21, me, pPlayer); - if (pPlayer) - pPlayer->GroupEventHappens(10211,me); - break; - } + return new npc_kservantAI(pCreature); } - void MoveInLineOfSight(Unit* pWho) + struct npc_kservantAI : public npc_escortAI { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; + public: + npc_kservantAI(Creature *c) : npc_escortAI(c) {} - if (pWho->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { - float Radius = 10.0; - if (me->IsWithinDistInMap(pWho, Radius)) + case 0: DoScriptText(SAY1, me, pPlayer); break; + case 4: DoScriptText(WHISP1, me, pPlayer); break; + case 6: DoScriptText(WHISP2, me, pPlayer); break; + case 7: DoScriptText(WHISP3, me, pPlayer); break; + case 8: DoScriptText(WHISP4, me, pPlayer); break; + case 17: DoScriptText(WHISP5, me, pPlayer); break; + case 18: DoScriptText(WHISP6, me, pPlayer); break; + case 19: DoScriptText(WHISP7, me, pPlayer); break; + case 33: DoScriptText(WHISP8, me, pPlayer); break; + case 34: DoScriptText(WHISP9, me, pPlayer); break; + case 35: DoScriptText(WHISP10, me, pPlayer); break; + case 36: DoScriptText(WHISP11, me, pPlayer); break; + case 43: DoScriptText(WHISP12, me, pPlayer); break; + case 44: DoScriptText(WHISP13, me, pPlayer); break; + case 49: DoScriptText(WHISP14, me, pPlayer); break; + case 50: DoScriptText(WHISP15, me, pPlayer); break; + case 51: DoScriptText(WHISP16, me, pPlayer); break; + case 52: DoScriptText(WHISP17, me, pPlayer); break; + case 53: DoScriptText(WHISP18, me, pPlayer); break; + case 54: DoScriptText(WHISP19, me, pPlayer); break; + case 55: DoScriptText(WHISP20, me, pPlayer); break; + case 56: DoScriptText(WHISP21, me, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(10211,me); + break; + } + } + + void MoveInLineOfSight(Unit* pWho) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (pWho->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) { - Start(false, false, pWho->GetGUID()); + float Radius = 10.0; + if (me->IsWithinDistInMap(pWho, Radius)) + { + Start(false, false, pWho->GetGUID()); + } } } } - } - void Reset() {} + void Reset() {} + }; }; -CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) -{ - return new npc_kservantAI(pCreature); -} /*###### # npc_dirty_larry @@ -360,122 +397,41 @@ CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) #define QUEST_WBI 10231 #define NPC_CREEPJACK 19726 #define NPC_MALONE 19725 - -struct npc_dirty_larryAI : public ScriptedAI + class npc_dirty_larry : public CreatureScript { - npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {} +public: + npc_dirty_larry() : CreatureScript("npc_dirty_larry") { } - bool Event; - bool Attack; - bool Done; - - uint64 PlayerGUID; - - uint32 SayTimer; - uint32 Step; - - void Reset() + struct npc_dirty_larryAI : public ScriptedAI { - Event = false; - Attack = false; - Done = false; + npc_dirty_larryAI(Creature* c) : ScriptedAI(c) {} - PlayerGUID = 0; - SayTimer = 0; - Step = 0; + bool Event; + bool Attack; + bool Done; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(1194); - Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); - if (Creepjack) + uint64 PlayerGUID; + + uint32 SayTimer; + uint32 Step; + + void Reset() { - CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); - Creepjack->setFaction(1194); - Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); - if (Malone) - { - CAST_CRE(Malone)->AI()->EnterEvadeMode(); - Malone->setFaction(1194); - Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - } - - uint32 NextStep(uint32 Step) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - - switch(Step) - { - case 0:{ me->SetInFront(pPlayer); - Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); - if (Creepjack) - Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); - if (Malone) - Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; - case 1: DoScriptText(SAY_1, me, pPlayer); return 3000; - case 2: DoScriptText(SAY_2, me, pPlayer); return 5000; - case 3: DoScriptText(SAY_3, me, pPlayer); return 2000; - case 4: DoScriptText(SAY_4, me, pPlayer); return 2000; - case 5: DoScriptText(SAY_5, me, pPlayer); return 2000; - case 6: Attack = true; return 2000; - default: return 0; - } - } - - void EnterCombat(Unit* /*who*/){} - - void UpdateAI(const uint32 diff) - { - if (SayTimer <= diff) - { - if (Event) - SayTimer = NextStep(++Step); - } else SayTimer -= diff; - - if (Attack) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (pPlayer) - { - Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); - if (Creepjack) - { - Creepjack->Attack(pPlayer, true); - Creepjack->setFaction(14); - Creepjack->GetMotionMaster()->MoveChase(pPlayer); - Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); - if (Malone) - { - Malone->Attack(pPlayer, true); - Malone->setFaction(14); - Malone->GetMotionMaster()->MoveChase(pPlayer); - Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - DoStartMovement(pPlayer); - AttackStart(pPlayer); - } + Event = false; Attack = false; - } + Done = false; + + PlayerGUID = 0; + SayTimer = 0; + Step = 0; - if ((me->GetHealth()*100)/me->GetMaxHealth() < 5 && !Done) - { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - + me->setFaction(1194); Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); if (Creepjack) { CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); Creepjack->setFaction(1194); - Creepjack->GetMotionMaster()->MoveTargetedHome(); Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); @@ -483,51 +439,140 @@ struct npc_dirty_larryAI : public ScriptedAI { CAST_CRE(Malone)->AI()->EnterEvadeMode(); Malone->setFaction(1194); - Malone->GetMotionMaster()->MoveTargetedHome(); Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } - me->setFaction(1194); - Done = true; - DoScriptText(SAY_GIVEUP, me, NULL); - me->DeleteThreatList(); - me->CombatStop(); - me->GetMotionMaster()->MoveTargetedHome(); - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WBI, me); } - DoMeleeAttackIfReady(); + + uint32 NextStep(uint32 Step) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + + switch(Step) + { + case 0:{ me->SetInFront(pPlayer); + Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); + if (Creepjack) + Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); + if (Malone) + Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; + case 1: DoScriptText(SAY_1, me, pPlayer); return 3000; + case 2: DoScriptText(SAY_2, me, pPlayer); return 5000; + case 3: DoScriptText(SAY_3, me, pPlayer); return 2000; + case 4: DoScriptText(SAY_4, me, pPlayer); return 2000; + case 5: DoScriptText(SAY_5, me, pPlayer); return 2000; + case 6: Attack = true; return 2000; + default: return 0; + } + } + + void EnterCombat(Unit* /*who*/){} + + void UpdateAI(const uint32 diff) + { + if (SayTimer <= diff) + { + if (Event) + SayTimer = NextStep(++Step); + } else SayTimer -= diff; + + if (Attack) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + if (pPlayer) + { + Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); + if (Creepjack) + { + Creepjack->Attack(pPlayer, true); + Creepjack->setFaction(14); + Creepjack->GetMotionMaster()->MoveChase(pPlayer); + Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); + if (Malone) + { + Malone->Attack(pPlayer, true); + Malone->setFaction(14); + Malone->GetMotionMaster()->MoveChase(pPlayer); + Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + DoStartMovement(pPlayer); + AttackStart(pPlayer); + } + Attack = false; + } + + if ((me->GetHealth()*100)/me->GetMaxHealth() < 5 && !Done) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveAllAuras(); + + Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); + if (Creepjack) + { + CAST_CRE(Creepjack)->AI()->EnterEvadeMode(); + Creepjack->setFaction(1194); + Creepjack->GetMotionMaster()->MoveTargetedHome(); + Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); + if (Malone) + { + CAST_CRE(Malone)->AI()->EnterEvadeMode(); + Malone->setFaction(1194); + Malone->GetMotionMaster()->MoveTargetedHome(); + Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } + me->setFaction(1194); + Done = true; + DoScriptText(SAY_GIVEUP, me, NULL); + me->DeleteThreatList(); + me->CombatStop(); + me->GetMotionMaster()->MoveTargetedHome(); + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WBI, me); + } + DoMeleeAttackIfReady(); + } + }; + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + CAST_AI(npc_dirty_larry::npc_dirty_larryAI, pCreature->AI())->Event = true; + CAST_AI(npc_dirty_larry::npc_dirty_larryAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + pPlayer->CLOSE_GOSSIP_MENU(); + } + + return true; } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_dirty_larryAI (pCreature); + } + }; -bool GossipHello_npc_dirty_larry(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_dirty_larry(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - CAST_AI(npc_dirty_larryAI, pCreature->AI())->Event = true; - CAST_AI(npc_dirty_larryAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - pPlayer->CLOSE_GOSSIP_MENU(); - } - - return true; -} - -CreatureAI* GetAI_npc_dirty_larryAI(Creature* pCreature) -{ - return new npc_dirty_larryAI (pCreature); -} /*###### # npc_ishanah @@ -535,29 +580,36 @@ CreatureAI* GetAI_npc_dirty_larryAI(Creature* pCreature) #define ISANAH_GOSSIP_1 "Who are the Sha'tar?" #define ISANAH_GOSSIP_2 "Isn't Shattrath a draenei city? Why do you allow others here?" - -bool GossipHello_npc_ishanah(Player* pPlayer, Creature* pCreature) + class npc_ishanah : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_ishanah() : CreatureScript("npc_ishanah") { } - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + pPlayer->SEND_GOSSIP_MENU(9458, pCreature->GetGUID()); + else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + pPlayer->SEND_GOSSIP_MENU(9459, pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_ishanah(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - pPlayer->SEND_GOSSIP_MENU(9458, pCreature->GetGUID()); - else if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - pPlayer->SEND_GOSSIP_MENU(9459, pCreature->GetGUID()); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, ISANAH_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### # npc_khadgar @@ -569,107 +621,71 @@ bool GossipSelect_npc_ishanah(Player* pPlayer, Creature* pCreature, uint32 /*uiS #define KHADGAR_GOSSIP_4 "What did you do then?" #define KHADGAR_GOSSIP_5 "What happened next?" #define KHADGAR_GOSSIP_7 "There was something else I wanted to ask you." - -bool GossipHello_npc_khadgar(Player* pPlayer, Creature* pCreature) + class npc_khadgar : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_khadgar() : CreatureScript("npc_khadgar") { } - if (!pPlayer->hasQuest(10211)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(9243, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_khadgar(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(9876, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(9877, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(9878, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(9879, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(9880, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - pPlayer->SEND_GOSSIP_MENU(9881, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9243, pCreature->GetGUID()); - break; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(9876, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(9877, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(9878, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(9879, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(9880, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->SEND_GOSSIP_MENU(9881, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(9243, pCreature->GetGUID()); + break; + } + return true; } - return true; -} + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (!pPlayer->hasQuest(10211)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, KHADGAR_GOSSIP_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(9243, pCreature->GetGUID()); + + return true; + } + +}; + void AddSC_shattrath_city() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_raliq_the_drunk"; - newscript->GetAI = &GetAI_npc_raliq_the_drunk; - newscript->pGossipHello = &GossipHello_npc_raliq_the_drunk; - newscript->pGossipSelect = &GossipSelect_npc_raliq_the_drunk; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_salsalabim"; - newscript->GetAI = &GetAI_npc_salsalabim; - newscript->pGossipHello = &GossipHello_npc_salsalabim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shattrathflaskvendors"; - newscript->pGossipHello = &GossipHello_npc_shattrathflaskvendors; - newscript->pGossipSelect = &GossipSelect_npc_shattrathflaskvendors; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zephyr"; - newscript->pGossipHello = &GossipHello_npc_zephyr; - newscript->pGossipSelect = &GossipSelect_npc_zephyr; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kservant"; - newscript->GetAI = &GetAI_npc_kservantAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dirty_larry"; - newscript->GetAI = &GetAI_npc_dirty_larryAI; - newscript->pGossipHello = &GossipHello_npc_dirty_larry; - newscript->pGossipSelect = &GossipSelect_npc_dirty_larry; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ishanah"; - newscript->pGossipHello = &GossipHello_npc_ishanah; - newscript->pGossipSelect = &GossipSelect_npc_ishanah; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_khadgar"; - newscript->pGossipHello = &GossipHello_npc_khadgar; - newscript->pGossipSelect = &GossipSelect_npc_khadgar; - newscript->RegisterSelf(); + new npc_raliq_the_drunk(); + new npc_salsalabim(); + new npc_shattrathflaskvendors(); + new npc_zephyr(); + new npc_kservant(); + new npc_dirty_larry(); + new npc_ishanah(); + new npc_khadgar(); } - diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index 6281a957d43..71f336eddee 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -48,207 +48,235 @@ EndContentData */ #define SPELL_PULVERIZE 2676 //#define SPELL_QUID9889 32174 - -struct mob_unkor_the_ruthlessAI : public ScriptedAI + class mob_unkor_the_ruthless : public CreatureScript { - mob_unkor_the_ruthlessAI(Creature* c) : ScriptedAI(c) {} +public: + mob_unkor_the_ruthless() : CreatureScript("mob_unkor_the_ruthless") { } - bool CanDoQuest; - uint32 UnkorUnfriendly_Timer; - uint32 Pulverize_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CanDoQuest = false; - UnkorUnfriendly_Timer = 0; - Pulverize_Timer = 3000; - me->SetStandState(UNIT_STAND_STATE_STAND); - me->setFaction(FACTION_HOSTILE); + return new mob_unkor_the_ruthlessAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void DoNice() + struct mob_unkor_the_ruthlessAI : public ScriptedAI { - DoScriptText(SAY_SUBMIT, me); - me->setFaction(FACTION_FRIENDLY); - me->SetStandState(UNIT_STAND_STATE_SIT); - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); - UnkorUnfriendly_Timer = 60000; - } + mob_unkor_the_ruthlessAI(Creature* c) : ScriptedAI(c) {} - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (done_by->GetTypeId() == TYPEID_PLAYER) - if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 30) + bool CanDoQuest; + uint32 UnkorUnfriendly_Timer; + uint32 Pulverize_Timer; + + void Reset() { - if (Group* pGroup = CAST_PLR(done_by)->GetGroup()) + CanDoQuest = false; + UnkorUnfriendly_Timer = 0; + Pulverize_Timer = 3000; + me->SetStandState(UNIT_STAND_STATE_STAND); + me->setFaction(FACTION_HOSTILE); + } + + void EnterCombat(Unit * /*who*/) {} + + void DoNice() + { + DoScriptText(SAY_SUBMIT, me); + me->setFaction(FACTION_FRIENDLY); + me->SetStandState(UNIT_STAND_STATE_SIT); + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); + UnkorUnfriendly_Timer = 60000; + } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetTypeId() == TYPEID_PLAYER) + if ((me->GetHealth()-damage)*100 / me->GetMaxHealth() < 30) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + if (Group* pGroup = CAST_PLR(done_by)->GetGroup()) { - Player *pGroupie = itr->getSource(); - if (pGroupie && - pGroupie->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && - pGroupie->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) + for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - pGroupie->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); - if (!CanDoQuest) - CanDoQuest = true; + Player *pGroupie = itr->getSource(); + if (pGroupie && + pGroupie->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && + pGroupie->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) + { + pGroupie->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); + if (!CanDoQuest) + CanDoQuest = true; + } } - } - } else - if (CAST_PLR(done_by)->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && - CAST_PLR(done_by)->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) - { - CAST_PLR(done_by)->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); - CanDoQuest = true; - } - } - } - - void UpdateAI(const uint32 diff) - { - if (CanDoQuest) - { - if (!UnkorUnfriendly_Timer) - { - //DoCast(me, SPELL_QUID9889); //not using spell for now - DoNice(); - } - else - { - if (UnkorUnfriendly_Timer <= diff) + } else + if (CAST_PLR(done_by)->GetQuestStatus(QUEST_DONTKILLTHEFATONE) == QUEST_STATUS_INCOMPLETE && + CAST_PLR(done_by)->GetReqKillOrCastCurrentCount(QUEST_DONTKILLTHEFATONE, 18260) == 10) { - EnterEvadeMode(); - return; - } else UnkorUnfriendly_Timer -= diff; + CAST_PLR(done_by)->AreaExploredOrEventHappens(QUEST_DONTKILLTHEFATONE); + CanDoQuest = true; + } } } - if (!UpdateVictim()) - return; - - if (Pulverize_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_PULVERIZE); - Pulverize_Timer = 9000; - } else Pulverize_Timer -= diff; + if (CanDoQuest) + { + if (!UnkorUnfriendly_Timer) + { + //DoCast(me, SPELL_QUID9889); //not using spell for now + DoNice(); + } + else + { + if (UnkorUnfriendly_Timer <= diff) + { + EnterEvadeMode(); + return; + } else UnkorUnfriendly_Timer -= diff; + } + } + + if (!UpdateVictim()) + return; + + if (Pulverize_Timer <= diff) + { + DoCast(me, SPELL_PULVERIZE); + Pulverize_Timer = 9000; + } else Pulverize_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_unkor_the_ruthless(Creature* pCreature) -{ - return new mob_unkor_the_ruthlessAI (pCreature); -} /*###### ## mob_infested_root_walker ######*/ - -struct mob_infested_root_walkerAI : public ScriptedAI + class mob_infested_root_walker : public CreatureScript { - mob_infested_root_walkerAI(Creature *c) : ScriptedAI(c) {} +public: + mob_infested_root_walker() : CreatureScript("mob_infested_root_walker") { } - void Reset() { } - void EnterCombat(Unit * /*who*/) { } - - void DamageTaken(Unit *done_by, uint32 &damage) + CreatureAI* GetAI(Creature* pCreature) const { - if (done_by && done_by->GetTypeId() == TYPEID_PLAYER) - if (me->GetHealth() <= damage) - if (rand()%100 < 75) - //Summon Wood Mites - DoCast(me, 39130, true); + return new mob_infested_root_walkerAI (pCreature); } + + struct mob_infested_root_walkerAI : public ScriptedAI + { + mob_infested_root_walkerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + void EnterCombat(Unit * /*who*/) { } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by && done_by->GetTypeId() == TYPEID_PLAYER) + if (me->GetHealth() <= damage) + if (rand()%100 < 75) + //Summon Wood Mites + DoCast(me, 39130, true); + } + }; + }; -CreatureAI* GetAI_mob_infested_root_walker(Creature* pCreature) -{ - return new mob_infested_root_walkerAI (pCreature); -} /*###### ## mob_skywing ######*/ -struct npc_skywingAI : public npc_escortAI +class npc_skywing : public CreatureScript { public: - npc_skywingAI(Creature *c) : npc_escortAI(c) {} + npc_skywing() : CreatureScript("npc_skywing") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - - switch(i) - { - case 8: - pPlayer->AreaExploredOrEventHappens(10898); - break; - } + return new npc_skywingAI(pCreature); } - void EnterCombat(Unit* /*who*/) {} - - void MoveInLineOfSight(Unit *who) + struct npc_skywingAI : public npc_escortAI { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; + public: + npc_skywingAI(Creature *c) : npc_escortAI(c) {} - if (who->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (CAST_PLR(who)->GetQuestStatus(10898) == QUEST_STATUS_INCOMPLETE) + Player* pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + + switch(i) { - float Radius = 10.0; - if (me->IsWithinDistInMap(who, Radius)) + case 8: + pPlayer->AreaExploredOrEventHappens(10898); + break; + } + } + + void EnterCombat(Unit* /*who*/) {} + + void MoveInLineOfSight(Unit *who) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(who)->GetQuestStatus(10898) == QUEST_STATUS_INCOMPLETE) { - Start(false, false, who->GetGUID()); + float Radius = 10.0; + if (me->IsWithinDistInMap(who, Radius)) + { + Start(false, false, who->GetGUID()); + } } } } - } - void Reset() {} + void Reset() {} + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_skywingAI(Creature* pCreature) -{ - return new npc_skywingAI(pCreature); -} - /*###### ## mob_rotting_forest_rager ######*/ - -struct mob_rotting_forest_ragerAI : public ScriptedAI + class mob_rotting_forest_rager : public CreatureScript { - mob_rotting_forest_ragerAI(Creature *c) : ScriptedAI(c) {} +public: + mob_rotting_forest_rager() : CreatureScript("mob_rotting_forest_rager") { } - void Reset() { } - void EnterCombat(Unit * /*who*/) { } - - void DamageTaken(Unit *done_by, uint32 &damage) + CreatureAI* GetAI(Creature* pCreature) const { - if (done_by->GetTypeId() == TYPEID_PLAYER) - if (me->GetHealth() <= damage) - if (rand()%100 < 75) - //Summon Lots of Wood Mights - DoCast(me, 39134, true); + return new mob_rotting_forest_ragerAI (pCreature); } + + struct mob_rotting_forest_ragerAI : public ScriptedAI + { + mob_rotting_forest_ragerAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + void EnterCombat(Unit * /*who*/) { } + + void DamageTaken(Unit *done_by, uint32 &damage) + { + if (done_by->GetTypeId() == TYPEID_PLAYER) + if (me->GetHealth() <= damage) + if (rand()%100 < 75) + //Summon Lots of Wood Mights + DoCast(me, 39134, true); + } + }; + }; -CreatureAI* GetAI_mob_rotting_forest_rager(Creature* pCreature) -{ - return new mob_rotting_forest_ragerAI (pCreature); -} /*###### ## mob_netherweb_victim @@ -260,40 +288,47 @@ CreatureAI* GetAI_mob_rotting_forest_rager(Creature* pCreature) const uint32 netherwebVictims[6] = { 18470, 16805, 21242, 18452, 22482, 21285 -}; -struct mob_netherweb_victimAI : public ScriptedAI +}; class mob_netherweb_victim : public CreatureScript { - mob_netherweb_victimAI(Creature *c) : ScriptedAI(c) {} +public: + mob_netherweb_victim() : CreatureScript("mob_netherweb_victim") { } - void Reset() { } - void EnterCombat(Unit * /*who*/) { } - void MoveInLineOfSight(Unit * /*who*/) { } - - void JustDied(Unit* Killer) + CreatureAI* GetAI(Creature* pCreature) const { - if (Killer->GetTypeId() == TYPEID_PLAYER) - { - if (CAST_PLR(Killer)->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE) - { - if (rand()%100 < 25) - { - me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - CAST_PLR(Killer)->KilledMonsterCredit(QUEST_TARGET, me->GetGUID()); - } - else - me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + return new mob_netherweb_victimAI (pCreature); + } - if (rand()%100 < 75) - me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f,0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + struct mob_netherweb_victimAI : public ScriptedAI + { + mob_netherweb_victimAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { } + void EnterCombat(Unit * /*who*/) { } + void MoveInLineOfSight(Unit * /*who*/) { } + + void JustDied(Unit* Killer) + { + if (Killer->GetTypeId() == TYPEID_PLAYER) + { + if (CAST_PLR(Killer)->GetQuestStatus(10873) == QUEST_STATUS_INCOMPLETE) + { + if (rand()%100 < 25) + { + me->SummonCreature(QUEST_TARGET, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + CAST_PLR(Killer)->KilledMonsterCredit(QUEST_TARGET, me->GetGUID()); + } + else + me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + + if (rand()%100 < 75) + me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f,0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + me->SummonCreature(netherwebVictims[rand()%6], 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + } } } - } + }; + }; -CreatureAI* GetAI_mob_netherweb_victim(Creature* pCreature) -{ - return new mob_netherweb_victimAI (pCreature); -} /*###### ## npc_floon @@ -313,87 +348,96 @@ enum eFloon FACTION_HOSTILE_FL = 1738, QUEST_CRACK_SKULLS = 10009 }; - -struct npc_floonAI : public ScriptedAI + class npc_floon : public CreatureScript { - npc_floonAI(Creature* c) : ScriptedAI(c) +public: + npc_floon() : CreatureScript("npc_floon") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - m_uiNormFaction = c->getFaction(); + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(9443, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(FACTION_HOSTILE_FL); + DoScriptText(SAY_FLOON_ATTACK, pCreature, pPlayer); + pCreature->AI()->AttackStart(pPlayer); + } + return true; } - uint32 m_uiNormFaction; - uint32 Silence_Timer; - uint32 Frostbolt_Timer; - uint32 FrostNova_Timer; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - Silence_Timer = 2000; - Frostbolt_Timer = 4000; - FrostNova_Timer = 9000; - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); + if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(9442, pCreature->GetGUID()); + return true; } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (!UpdateVictim()) - return; - - if (Silence_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SILENCE); - Silence_Timer = 30000; - } else Silence_Timer -= diff; - - if (FrostNova_Timer <= diff) - { - DoCast(me, SPELL_FROST_NOVA); - FrostNova_Timer = 20000; - } else FrostNova_Timer -= diff; - - if (Frostbolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - Frostbolt_Timer = 5000; - } else Frostbolt_Timer -= diff; - - DoMeleeAttackIfReady(); + return new npc_floonAI (pCreature); } + + struct npc_floonAI : public ScriptedAI + { + npc_floonAI(Creature* c) : ScriptedAI(c) + { + m_uiNormFaction = c->getFaction(); + } + + uint32 m_uiNormFaction; + uint32 Silence_Timer; + uint32 Frostbolt_Timer; + uint32 FrostNova_Timer; + + void Reset() + { + Silence_Timer = 2000; + Frostbolt_Timer = 4000; + FrostNova_Timer = 9000; + if (me->getFaction() != m_uiNormFaction) + me->setFaction(m_uiNormFaction); + } + + void EnterCombat(Unit * /*who*/) {} + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Silence_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SILENCE); + Silence_Timer = 30000; + } else Silence_Timer -= diff; + + if (FrostNova_Timer <= diff) + { + DoCast(me, SPELL_FROST_NOVA); + FrostNova_Timer = 20000; + } else FrostNova_Timer -= diff; + + if (Frostbolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + Frostbolt_Timer = 5000; + } else Frostbolt_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_floon(Creature* pCreature) -{ - return new npc_floonAI (pCreature); -} -bool GossipHello_npc_floon(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(9442, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_floon(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FLOON2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9443, pCreature->GetGUID()); - } - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE_FL); - DoScriptText(SAY_FLOON_ATTACK, pCreature, pPlayer); - pCreature->AI()->AttackStart(pPlayer); - } - return true; -} /*###### ## npc_isla_starmane @@ -408,76 +452,83 @@ bool GossipSelect_npc_floon(Player* pPlayer, Creature* pCreature, uint32 /*uiSen #define QUEST_EFTW_A 10051 #define GO_CAGE 182794 #define SPELL_CAT 32447 - -struct npc_isla_starmaneAI : public npc_escortAI + class npc_isla_starmane : public CreatureScript { - npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} +public: + npc_isla_starmane() : CreatureScript("npc_isla_starmane") { } - void WaypointReached(uint32 i) + struct npc_isla_starmaneAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} - if (!pPlayer) - return; - - switch(i) + void WaypointReached(uint32 i) { - case 0: + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { - GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10); - if (Cage) - Cage->SetGoState(GO_STATE_ACTIVE); + case 0: + { + GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 10); + if (Cage) + Cage->SetGoState(GO_STATE_ACTIVE); + } + break; + case 2: DoScriptText(SAY_PROGRESS_1, me, pPlayer); break; + case 5: DoScriptText(SAY_PROGRESS_2, me, pPlayer); break; + case 6: DoScriptText(SAY_PROGRESS_3, me, pPlayer); break; + case 29:DoScriptText(SAY_PROGRESS_4, me, pPlayer); + if (pPlayer) + { + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->GroupEventHappens(QUEST_EFTW_A, me); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->GroupEventHappens(QUEST_EFTW_H, me); + } + me->SetInFront(pPlayer); break; + case 30: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case 31: DoCast(me, SPELL_CAT); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; } - break; - case 2: DoScriptText(SAY_PROGRESS_1, me, pPlayer); break; - case 5: DoScriptText(SAY_PROGRESS_2, me, pPlayer); break; - case 6: DoScriptText(SAY_PROGRESS_3, me, pPlayer); break; - case 29:DoScriptText(SAY_PROGRESS_4, me, pPlayer); - if (pPlayer) + } + + void Reset() + { + me->RestoreFaction(); + } + + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetTeam() == ALLIANCE) - pPlayer->GroupEventHappens(QUEST_EFTW_A, me); + pPlayer->FailQuest(QUEST_EFTW_A); else if (pPlayer->GetTeam() == HORDE) - pPlayer->GroupEventHappens(QUEST_EFTW_H, me); + pPlayer->FailQuest(QUEST_EFTW_H); } - me->SetInFront(pPlayer); break; - case 30: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case 31: DoCast(me, SPELL_CAT); - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); break; } - } + }; - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - me->RestoreFaction(); - } - - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) + if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) { - if (pPlayer->GetTeam() == ALLIANCE) - pPlayer->FailQuest(QUEST_EFTW_A); - else if (pPlayer->GetTeam() == HORDE) - pPlayer->FailQuest(QUEST_EFTW_H); + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + pCreature->setFaction(113); } + return true; } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_isla_starmaneAI(pCreature); + } + }; -bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_EFTW_H || quest->GetQuestId() == QUEST_EFTW_A) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - pCreature->setFaction(113); - } - return true; -} - -CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) -{ - return new npc_isla_starmaneAI(pCreature); -} /*###### ## go_skull_pile @@ -486,48 +537,53 @@ CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) #define GOSSIP_S_KARROG "Summon Karrog" #define GOSSIP_S_GEZZARAK_THE_HUNTRESS "Summon Gezzarak the Huntress" #define GOSSIP_S_VAKKIZ_THE_WINDRAGER "Summon Vakkiz the Windrager" - -bool GossipHello_go_skull_pile(Player* pPlayer, GameObject* pGo) + class go_skull_pile : public GameObjectScript { - if ((pPlayer->GetQuestStatus(11885) == QUEST_STATUS_INCOMPLETE) || pPlayer->GetQuestRewardStatus(11885)) +public: + go_skull_pile() : GameObjectScript("go_skull_pile") { } + + bool OnGossipSelect(Player* pPlayer, GameObject* pGo, uint32 uiSender, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_DARKSCREECHER_AKKARAI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_KARROG, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_GEZZARAK_THE_HUNTRESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_VAKKIZ_THE_WINDRAGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + switch(uiSender) + { + case GOSSIP_SENDER_MAIN: SendActionMenu(pPlayer, pGo, uiAction); break; + } + return true; } - pPlayer->SEND_GOSSIP_MENU(pGo->GetGOInfo()->questgiver.gossipID, pGo->GetGUID()); - return true; -} - -void SendActionMenu_go_skull_pile(Player* pPlayer, GameObject* /*pGo*/, uint32 uiAction) -{ - switch(uiAction) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CastSpell(pPlayer,40642,false); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->CastSpell(pPlayer,40640,false); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->CastSpell(pPlayer,40632,false); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - pPlayer->CastSpell(pPlayer,40644,false); - break; - } -} + if ((pPlayer->GetQuestStatus(11885) == QUEST_STATUS_INCOMPLETE) || pPlayer->GetQuestRewardStatus(11885)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_DARKSCREECHER_AKKARAI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_KARROG, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_GEZZARAK_THE_HUNTRESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_S_VAKKIZ_THE_WINDRAGER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + } -bool GossipSelect_go_skull_pile(Player* pPlayer, GameObject* pGo, uint32 uiSender, uint32 uiAction) -{ - switch(uiSender) - { - case GOSSIP_SENDER_MAIN: SendActionMenu_go_skull_pile(pPlayer, pGo, uiAction); break; + pPlayer->SEND_GOSSIP_MENU(pGo->GetGOInfo()->questgiver.gossipID, pGo->GetGUID()); + return true; } - return true; -} + + void SendActionMenu(Player* pPlayer, GameObject* /*pGo*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CastSpell(pPlayer,40642,false); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->CastSpell(pPlayer,40640,false); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->CastSpell(pPlayer,40632,false); + break; + case GOSSIP_ACTION_INFO_DEF + 4: + pPlayer->CastSpell(pPlayer,40644,false); + break; + } + } +}; /*###### ## npc_slim @@ -537,27 +593,34 @@ enum eSlim { FACTION_CONSORTIUM = 933 }; - -bool GossipHello_npc_slim(Player* pPlayer, Creature* pCreature) + class npc_slim : public CreatureScript { - if (pCreature->isVendor() && pPlayer->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY) +public: + npc_slim() : CreatureScript("npc_slim") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(9896, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - else - pPlayer->SEND_GOSSIP_MENU(9895, pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isVendor() && pPlayer->GetReputationRank(FACTION_CONSORTIUM) >= REP_FRIENDLY) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(9896, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(9895, pCreature->GetGUID()); -bool GossipSelect_npc_slim(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } + +}; - return true; -} /*######## ####npc_akuno @@ -568,115 +631,73 @@ enum eAkuno QUEST_ESCAPING_THE_TOMB = 10887, NPC_CABAL_SKRIMISHER = 21661 }; - -struct npc_akunoAI : public npc_escortAI + class npc_akuno : public CreatureScript { - npc_akunoAI(Creature *c) : npc_escortAI(c) {} +public: + npc_akuno() : CreatureScript("npc_akuno") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) + if (pQuest->GetQuestId() == QUEST_ESCAPING_THE_TOMB) { - case 3: - me->SummonCreature(NPC_CABAL_SKRIMISHER,-2795.99,5420.33,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(NPC_CABAL_SKRIMISHER,-2793.55,5412.79,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 11: - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - pPlayer->GroupEventHappens(QUEST_ESCAPING_THE_TOMB,me); - break; + if (npc_akunoAI* pEscortAI = CAST_AI(npc_akuno::npc_akunoAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + + if (pPlayer->GetTeamId() == TEAM_ALLIANCE) + pCreature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE); + else + pCreature->setFaction(FACTION_ESCORT_H_NEUTRAL_PASSIVE); } + return true; } - void JustSummoned(Creature* summon) + CreatureAI* GetAI(Creature* pCreature) const { - summon->AI()->AttackStart(me); + return new npc_akunoAI(pCreature); } + + struct npc_akunoAI : public npc_escortAI + { + npc_akunoAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 3: + me->SummonCreature(NPC_CABAL_SKRIMISHER,-2795.99,5420.33,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(NPC_CABAL_SKRIMISHER,-2793.55,5412.79,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 11: + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + pPlayer->GroupEventHappens(QUEST_ESCAPING_THE_TOMB,me); + break; + } + } + + void JustSummoned(Creature* summon) + { + summon->AI()->AttackStart(me); + } + }; + }; -bool QuestAccept_npc_akuno(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_ESCAPING_THE_TOMB) - { - if (npc_akunoAI* pEscortAI = CAST_AI(npc_akunoAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - - if (pPlayer->GetTeamId() == TEAM_ALLIANCE) - pCreature->setFaction(FACTION_ESCORT_A_NEUTRAL_PASSIVE); - else - pCreature->setFaction(FACTION_ESCORT_H_NEUTRAL_PASSIVE); - } - return true; -} - -CreatureAI* GetAI_npc_akuno(Creature* pCreature) -{ - return new npc_akunoAI(pCreature); -} - void AddSC_terokkar_forest() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_unkor_the_ruthless"; - newscript->GetAI = &GetAI_mob_unkor_the_ruthless; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_infested_root_walker"; - newscript->GetAI = &GetAI_mob_infested_root_walker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_rotting_forest_rager"; - newscript->GetAI = &GetAI_mob_rotting_forest_rager; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_netherweb_victim"; - newscript->GetAI = &GetAI_mob_netherweb_victim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_floon"; - newscript->GetAI = &GetAI_npc_floon; - newscript->pGossipHello = &GossipHello_npc_floon; - newscript->pGossipSelect = &GossipSelect_npc_floon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_isla_starmane"; - newscript->GetAI = &GetAI_npc_isla_starmaneAI; - newscript->pQuestAccept = &QuestAccept_npc_isla_starmane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_skull_pile"; - newscript->pGOHello = &GossipHello_go_skull_pile; - newscript->pGOSelect = &GossipSelect_go_skull_pile; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_skywing"; - newscript->GetAI = &GetAI_npc_skywingAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_slim"; - newscript->pGossipHello = &GossipHello_npc_slim; - newscript->pGossipSelect = &GossipSelect_npc_slim; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_akuno"; - newscript->GetAI = &GetAI_npc_akuno; - newscript->pQuestAccept = &QuestAccept_npc_akuno; - newscript->RegisterSelf(); + new mob_unkor_the_ruthless(); + new mob_infested_root_walker(); + new mob_rotting_forest_rager(); + new mob_netherweb_victim(); + new npc_floon(); + new npc_isla_starmane(); + new go_skull_pile(); + new npc_skywing(); + new npc_slim(); + new npc_akuno(); } - diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index 5bf0ef83047..17adb1029fb 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -176,12 +176,12 @@ public: } }; - CreatureAI* GetAI(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new npc_cooshcooshAI (pCreature); } - bool GossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_COOSH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -190,7 +190,7 @@ public: return true; } - bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_INFO_DEF) { @@ -215,7 +215,7 @@ class npc_elder_kuruti : public CreatureScript public: npc_elder_kuruti() : CreatureScript("npc_elder_kuruti") { } - bool GossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pPlayer->GetQuestStatus(9803) == QUEST_STATUS_INCOMPLETE) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_KUR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); @@ -225,7 +225,7 @@ public: return true; } - bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { switch (uiAction) { @@ -267,7 +267,7 @@ class npc_mortog_steamhead : public CreatureScript public: npc_mortog_steamhead() : CreatureScript("npc_mortog_steamhead") { } - bool GossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pCreature->isVendor() && pPlayer->GetReputationRank(942) == REP_EXALTED) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); @@ -277,7 +277,7 @@ public: return true; } - bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { if (uiAction == GOSSIP_ACTION_TRADE) { @@ -350,19 +350,19 @@ public: } }; - bool QuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_ESCAPE_FROM) { DoScriptText(SAY_START, pCreature, pPlayer); - if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmaneAI, pCreature->AI())) + if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmane::npc_kayra_longmaneAI, pCreature->AI())) pEscortAI->Start(false, false, pPlayer->GetGUID()); } return true; } - CreatureAI* GetAI(Creature* pCreature) + CreatureAI* GetAI(Creature* pCreature) const { return new npc_kayra_longmaneAI(pCreature); } @@ -385,7 +385,7 @@ class npc_timothy_daniels : public CreatureScript public: npc_timothy_daniels() : CreatureScript("npc_timothy_daniels") { } - bool GossipHello(Player* pPlayer, Creature* pCreature) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); @@ -398,7 +398,7 @@ public: return true; } - bool GossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { switch(uiAction) { diff --git a/src/server/scripts/PrecompiledHeaders/ScriptPCH.h b/src/server/scripts/PrecompiledHeaders/ScriptPCH.h index 227a5de15ae..2cba3171202 100644 --- a/src/server/scripts/PrecompiledHeaders/ScriptPCH.h +++ b/src/server/scripts/PrecompiledHeaders/ScriptPCH.h @@ -15,7 +15,7 @@ #include "GameObject.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "ScriptedInstance.h" +#include "InstanceScript.h" #include "CombatAI.h" #include "PassiveAI.h" #include "Chat.h" diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index ed1ad2d3987..53e85693526 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -99,13 +99,13 @@ class spell_pal_holy_shock : public SpellHandlerScript return false; // can't use other spell than holy shock due to spell_ranks dependency - if (spellmgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id)) + if (sSpellMgr.GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id)) return false; - uint8 rank = spellmgr.GetSpellRank(spellEntry->Id); - if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true)) + uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id); + if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true)) return false; - if (!spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) + if (!sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) return false; return true; @@ -117,12 +117,12 @@ class spell_pal_holy_shock : public SpellHandlerScript { Unit *caster = GetCaster(); - uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id); + uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); else - caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); } } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 6d3f605e31b..644585eee5d 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -71,13 +71,13 @@ class spell_pri_penance : public SpellHandlerScript if (!sSpellStore.LookupEntry(PRIEST_SPELL_PENANCE_R1)) return false; // can't use other spell than this penance due to spell_ranks dependency - if (spellmgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != spellmgr.GetFirstSpellInChain(spellEntry->Id)) + if (sSpellMgr.GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != sSpellMgr.GetFirstSpellInChain(spellEntry->Id)) return false; - uint8 rank = spellmgr.GetSpellRank(spellEntry->Id); - if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true)) + uint8 rank = sSpellMgr.GetSpellRank(spellEntry->Id); + if (!sSpellMgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true)) return false; - if (!spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true)) + if (!sSpellMgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true)) return false; return true; @@ -91,12 +91,12 @@ class spell_pri_penance : public SpellHandlerScript Unit *caster = GetCaster(); - uint8 rank = spellmgr.GetSpellRank(GetSpellInfo()->Id); + uint8 rank = sSpellMgr.GetSpellRank(GetSpellInfo()->Id); if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); else - caster->CastSpell(unitTarget, spellmgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); + caster->CastSpell(unitTarget, sSpellMgr.GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); } void Register() diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index d0b35a47050..7a4b97be9f3 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1003,7 +1003,7 @@ public: if (!pPrisoner || !pPrisoner->isAlive()) return true; - Quest const* qInfo = objmgr.GetQuestTemplate(QUEST_PRISONERS_OF_WYRMSKULL); + Quest const* qInfo = sObjectMgr.GetQuestTemplate(QUEST_PRISONERS_OF_WYRMSKULL); if (qInfo) { //TODO: prisoner should help player for a short period of time diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 98a7704518b..94de4b9e0b2 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -380,7 +380,7 @@ public: bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) { if (_Quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); + CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, pCreature->AI())->Reset(); return true; } @@ -388,7 +388,7 @@ public: bool OnQuestComplete(Player* /*pPlayer*/, Creature* pCreature, const Quest *_Quest) { if (_Quest->GetQuestId() == QUEST_CLUCK) - CAST_AI(npc_chicken_cluckAI, pCreature->AI())->Reset(); + CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, pCreature->AI())->Reset(); return true; } @@ -676,7 +676,7 @@ public: bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) - CAST_AI(npc_doctorAI, pCreature->AI())->BeginEvent(pPlayer); + CAST_AI(npc_doctor::npc_doctorAI, pCreature->AI())->BeginEvent(pPlayer); return true; }