aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/CMakeLists.txt96
-rw-r--r--src/bindings/scripts/Makefile.am1
-rw-r--r--src/bindings/scripts/ScriptMgr.cpp686
-rw-r--r--src/bindings/scripts/VC71/71ScriptDev2.vcproj444
-rw-r--r--src/bindings/scripts/VC80/80ScriptDev2.vcproj435
-rw-r--r--src/bindings/scripts/VC90/90ScriptDev2.vcproj388
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp57
-rw-r--r--src/bindings/scripts/include/sc_creature.h3
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp1524
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.h219
-rw-r--r--src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp39
-rw-r--r--src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp116
-rw-r--r--src/bindings/scripts/scripts/npc/npc_escortAI.cpp27
-rw-r--r--src/bindings/scripts/scripts/npc/npc_escortAI.h3
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp27
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp40
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp27
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp36
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp44
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp27
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp38
-rw-r--r--src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp38
-rw-r--r--src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp26
-rw-r--r--src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp61
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_amanitar.cpp79
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp117
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_herald_volazj.cpp111
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp109
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp109
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/def_ahnkahet.h (renamed from src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h)0
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/instance_ahnkahet.cpp (renamed from src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp)2
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_anubarak.cpp112
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_hadronox.cpp114
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp116
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/def_azjol_nerub.h (renamed from src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h)0
-rw-r--r--src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp (renamed from src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp)0
-rw-r--r--src/bindings/scripts/scripts/zone/azshara/azshara.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp44
-rw-r--r--src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/.boss_teron_gorefiend.cpp-woains536
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/.instance_black_temple.cpp-s8inyu347
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_epoch.cpp86
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp123
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_meathook.cpp138
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_salramm.cpp152
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h4
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp296
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp271
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp197
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp192
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h4
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp20
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp821
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h108
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp1516
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h40
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp117
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp13
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp12
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/boss_dred.cpp56
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/boss_novos.cpp75
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/boss_tharon_ja.cpp88
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/boss_trollgore.cpp75
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/def_drak_tharon_keep.h4
-rw-r--r--src/bindings/scripts/scripts/zone/draktharon_keep/instance_drak_tharon_keep.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp27
-rw-r--r--src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp101
-rw-r--r--src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp73
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/boss_drakkari_colossus.cpp55
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/boss_eck.cpp65
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/boss_gal_darah.cpp85
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/boss_moorabi.cpp88
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/boss_slad_ran.cpp95
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/def_gundrak.h4
-rw-r--r--src/bindings/scripts/scripts/zone/gundrak/instance_gundrak.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp41
-rw-r--r--src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp9
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp32
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h73
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp14
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/boss_malygos.cpp170
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/def_eye_of_eternity.h4
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/instance_eye_of_eternity.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp149
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp89
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp118
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp90
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/commander_kolurg.cpp57
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/commander_stoutbeard.cpp63
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h35
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp158
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/boss_drakos.cpp82
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/boss_eregos.cpp104
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/boss_urom.cpp87
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/boss_varos.cpp85
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/def_oculus.h4
-rw-r--r--src/bindings/scripts/scripts/zone/nexus/oculus/instance_oculus.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp300
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h4
-rw-r--r--src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/razorfen_downs/razorfen_downs.cpp85
-rw-r--r--src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp48
-rw-r--r--src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp47
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp34
-rw-r--r--src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp67
-rw-r--r--src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp39
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp16
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp26
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_bjarngrim.cpp94
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_ionar.cpp114
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_loken.cpp86
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_volkhan.cpp128
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/def_halls_of_lightning.h4
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_krystallus.cpp73
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_maiden_of_grief.cpp81
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_sjonnir.cpp83
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/def_halls_of_stone.h4
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/instance_halls_of_stone.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_dalronn.cpp97
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald.cpp96
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp78
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp89
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_svala.cpp83
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp85
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/def_pinnacle.h4
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/vault_of_archavon/boss_archavon.cpp93
-rw-r--r--src/bindings/scripts/scripts/zone/vault_of_archavon/def_vault_of_archavon.h4
-rw-r--r--src/bindings/scripts/scripts/zone/vault_of_archavon/instance_vault_of_archavon.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_cyanigosa.cpp82
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_erekem.cpp82
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_ichoron.cpp81
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_lavanthor.cpp52
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_moragg.cpp50
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_xevozz.cpp82
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/boss_zuramat.cpp82
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/def_violet_hold.h4
-rw-r--r--src/bindings/scripts/scripts/zone/violet_hold/instance_violet_hold.cpp21
-rw-r--r--src/bindings/scripts/scripts/zone/westfall/westfall.cpp58
-rw-r--r--src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp2
-rw-r--r--src/bindings/scripts/sql/WotLK/npc_taxi.sql10
-rw-r--r--src/bindings/scripts/sql/WotLK/script_texts_wotlk.sql530
-rw-r--r--src/bindings/scripts/sql/WotLK/wotlk_bosses.sql124
-rw-r--r--src/game/AchievementMgr.cpp366
-rw-r--r--src/game/AchievementMgr.h103
-rw-r--r--src/game/BattleGround.cpp286
-rw-r--r--src/game/BattleGround.h4
-rw-r--r--src/game/BattleGroundAB.cpp118
-rw-r--r--src/game/BattleGroundAV.cpp4
-rw-r--r--src/game/BattleGroundBE.cpp14
-rw-r--r--src/game/BattleGroundEY.cpp118
-rw-r--r--src/game/BattleGroundHandler.cpp208
-rw-r--r--src/game/BattleGroundMgr.cpp446
-rw-r--r--src/game/BattleGroundMgr.h23
-rw-r--r--src/game/BattleGroundNA.cpp14
-rw-r--r--src/game/BattleGroundRL.cpp14
-rw-r--r--src/game/BattleGroundSA.cpp2
-rw-r--r--src/game/BattleGroundWS.cpp128
-rw-r--r--src/game/CMakeLists.txt4
-rw-r--r--src/game/CharacterHandler.cpp11
-rw-r--r--src/game/Chat.cpp11
-rw-r--r--src/game/Chat.h7
-rw-r--r--src/game/Creature.cpp3
-rw-r--r--src/game/Creature.h28
-rw-r--r--src/game/CreatureAI.cpp32
-rw-r--r--src/game/CreatureAI.h2
-rw-r--r--src/game/CreatureAIRegistry.cpp2
-rw-r--r--src/game/CreatureAISelector.cpp35
-rw-r--r--src/game/CreatureEventAI.cpp1661
-rw-r--r--src/game/CreatureEventAI.h309
-rw-r--r--src/game/CreatureEventAIMgr.cpp560
-rw-r--r--src/game/CreatureEventAIMgr.h46
-rw-r--r--src/game/CreatureGroups.cpp70
-rw-r--r--src/game/CreatureGroups.h9
-rw-r--r--src/game/DBCEnums.h6
-rw-r--r--src/game/DBCStructure.h2
-rw-r--r--src/game/GameObject.cpp47
-rw-r--r--src/game/GameObject.h14
-rw-r--r--src/game/GridNotifiers.h113
-rw-r--r--src/game/HomeMovementGenerator.cpp2
-rw-r--r--src/game/InstanceData.h4
-rw-r--r--src/game/Language.h3
-rw-r--r--src/game/Level0.cpp1
-rw-r--r--src/game/Level3.cpp33
-rw-r--r--src/game/Makefile.am267
-rw-r--r--src/game/Map.cpp51
-rw-r--r--src/game/Map.h6
-rw-r--r--src/game/MiscHandler.cpp16
-rw-r--r--src/game/MotionMaster.cpp16
-rw-r--r--src/game/MotionMaster.h3
-rw-r--r--src/game/MovementHandler.cpp88
-rw-r--r--src/game/NPCHandler.cpp49
-rw-r--r--src/game/Object.cpp102
-rw-r--r--src/game/Object.h9
-rw-r--r--src/game/ObjectAccessor.h11
-rw-r--r--src/game/ObjectGridLoader.cpp6
-rw-r--r--src/game/ObjectMgr.cpp245
-rw-r--r--src/game/Pet.cpp252
-rw-r--r--src/game/Pet.h13
-rw-r--r--src/game/PetitionsHandler.cpp4
-rw-r--r--src/game/Player.cpp272
-rw-r--r--src/game/Player.h35
-rw-r--r--src/game/Spell.cpp55
-rw-r--r--src/game/Spell.h2
-rw-r--r--src/game/SpellAuras.cpp277
-rw-r--r--src/game/SpellAuras.h9
-rw-r--r--src/game/SpellEffects.cpp215
-rw-r--r--src/game/SpellHandler.cpp2
-rw-r--r--src/game/SpellMgr.cpp38
-rw-r--r--src/game/TemporarySummon.cpp26
-rw-r--r--src/game/Unit.cpp699
-rw-r--r--src/game/Unit.h42
-rw-r--r--src/game/World.cpp25
-rw-r--r--src/game/World.h2
-rw-r--r--src/game/WorldSession.cpp2
-rw-r--r--src/shared/Log.cpp2
-rw-r--r--src/trinitycore/CliRunnable.cpp14
-rw-r--r--src/trinitycore/Master.cpp3
263 files changed, 18052 insertions, 6028 deletions
diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt
index d24a45f6011..fd941cd8164 100644
--- a/src/bindings/scripts/CMakeLists.txt
+++ b/src/bindings/scripts/CMakeLists.txt
@@ -114,9 +114,15 @@ SET(trinityscript_LIB_SRCS
scripts/zone/caverns_of_time/dark_portal/boss_aeonus.cpp
scripts/zone/caverns_of_time/dark_portal/boss_chrono_lord_deja.cpp
scripts/zone/caverns_of_time/dark_portal/boss_temporus.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
+ scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
scripts/zone/caverns_of_time/hyjal/def_hyjal.h
scripts/zone/caverns_of_time/hyjal/hyjal.cpp
+ scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
+ scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
scripts/zone/caverns_of_time/hyjal/hyjalAI.h
scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
@@ -236,6 +242,7 @@ SET(trinityscript_LIB_SRCS
scripts/zone/onyxias_lair/boss_onyxia.cpp
scripts/zone/orgrimmar/orgrimmar.cpp
scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp
+ scripts/zone/razorfen_downs/razorfen_downs.cpp
scripts/zone/razorfen_kraul/razorfen_kraul.cpp
scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp
scripts/zone/ruins_of_ahnqiraj/boss_buru.cpp
@@ -346,10 +353,6 @@ SET(trinityscript_LIB_SRCS
scripts/zone/uldaman/uldaman.cpp
scripts/zone/undercity/undercity.cpp
scripts/zone/ungoro_crater/ungoro_crater.cpp
- scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp
- scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
- scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp
- scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
scripts/zone/wailing_caverns/instance_wailing_caverns.cpp
scripts/zone/western_plaguelands/western_plaguelands.cpp
scripts/zone/westfall/westfall.cpp
@@ -380,6 +383,91 @@ SET(trinityscript_LIB_SRCS
scripts/zone/zulgurub/boss_wushoolay.cpp
scripts/zone/zulgurub/def_zulgurub.h
scripts/zone/zulgurub/instance_zulgurub.cpp
+ scripts/zone/utgarde_keep/utgarde_keep/instance_utgarde_keep.cpp
+ scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
+ scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald_dalronn.cpp
+ scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
+ scripts/zone/utgarde_keep/utgarde_keep/def_utgarde_keep.h
+ scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp
+ scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
+ scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp
+ scripts/zone/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
+ scripts/zone/utgarde_keep/utgarde_pinnacle/boss_svala.cpp
+ scripts/zone/utgarde_keep/utgarde_pinnacle/def_pinnacle.h
+ scripts/zone/nexus/nexus/instance_nexus.cpp
+ scripts/zone/nexus/nexus/boss_magus_telestra.cpp
+ scripts/zone/nexus/nexus/boss_anomalus.cpp
+ scripts/zone/nexus/nexus/boss_ormorok.cpp
+ scripts/zone/nexus/nexus/boss_keristrasza.cpp
+ scripts/zone/nexus/nexus/commander_stoutbeard.cpp
+ scripts/zone/nexus/nexus/commander_kolurg.cpp
+ scripts/zone/nexus/nexus/def_nexus.h
+ scripts/zone/nexus/oculus/instance_oculus.cpp
+ scripts/zone/nexus/oculus/boss_drakos.cpp
+ scripts/zone/nexus/oculus/boss_urom.cpp
+ scripts/zone/nexus/oculus/boss_varos.cpp
+ scripts/zone/nexus/oculus/boss_eregos.cpp
+ scripts/zone/nexus/oculus/def_oculus.h
+ scripts/zone/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp
+ scripts/zone/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp
+ scripts/zone/azjol_nerub/azjol_nerub/boss_hadronox.cpp
+ scripts/zone/azjol_nerub/azjol_nerub/boss_anubarak.cpp
+ scripts/zone/azjol_nerub/azjol_nerub/def_azjol_nerub.h
+ scripts/zone/azjol_nerub/ahnkahet/instance_ahnkahet.cpp
+ scripts/zone/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
+ scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
+ scripts/zone/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp
+ scripts/zone/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
+ scripts/zone/azjol_nerub/ahnkahet/boss_amanitar.cpp
+ scripts/zone/azjol_nerub/ahnkahet/def_ahnkahet.h
+ scripts/zone/draktharon_keep/instance_drak_tharon_keep.cpp
+ scripts/zone/draktharon_keep/boss_trollgore.cpp
+ scripts/zone/draktharon_keep/boss_novos.cpp
+ scripts/zone/draktharon_keep/boss_dred.cpp
+ scripts/zone/draktharon_keep/boss_tharon_ja.cpp
+ scripts/zone/draktharon_keep/def_drak_tharon_keep.h
+ scripts/zone/violet_hold/instance_violet_hold.cpp
+ scripts/zone/violet_hold/boss_cyanigosa.cpp
+ scripts/zone/violet_hold/boss_erekem.cpp
+ scripts/zone/violet_hold/boss_ichoron.cpp
+ scripts/zone/violet_hold/boss_lavanthor.cpp
+ scripts/zone/violet_hold/boss_moragg.cpp
+ scripts/zone/violet_hold/boss_xevozz.cpp
+ scripts/zone/violet_hold/boss_zuramat.cpp
+ scripts/zone/violet_hold/def_violet_hold.h
+ scripts/zone/gundrak/instance_gundrak.cpp
+ scripts/zone/gundrak/boss_slad_ran.cpp
+ scripts/zone/gundrak/boss_moorabi.cpp
+ scripts/zone/gundrak/boss_drakkari_colossus.cpp
+ scripts/zone/gundrak/boss_gal_darah.cpp
+ scripts/zone/gundrak/boss_eck.cpp
+ scripts/zone/gundrak/def_gundrak.h
+ scripts/zone/ulduar/halls_of_stone/instance_halls_of_stone.cpp
+ scripts/zone/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
+ scripts/zone/ulduar/halls_of_stone/boss_krystallus.cpp
+ scripts/zone/ulduar/halls_of_stone/boss_sjonnir.cpp
+ scripts/zone/ulduar/halls_of_stone/def_halls_of_stone.h
+ scripts/zone/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp
+ scripts/zone/ulduar/halls_of_lightning/boss_bjarngrim.cpp
+ scripts/zone/ulduar/halls_of_lightning/boss_ionar.cpp
+ scripts/zone/ulduar/halls_of_lightning/boss_volkhan.cpp
+ scripts/zone/ulduar/halls_of_lightning/boss_loken.cpp
+ scripts/zone/ulduar/halls_of_lightning/def_halls_of_lightning.h
+ scripts/zone/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp
+ scripts/zone/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
+ scripts/zone/caverns_of_time/culling_of_stratholme/boss_epoch.cpp
+ scripts/zone/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp
+ scripts/zone/caverns_of_time/culling_of_stratholme/boss_salramm.cpp
+ scripts/zone/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h
+ scripts/zone/nexus/eye_of_eternity/instance_eye_of_eternity.cpp
+ scripts/zone/nexus/eye_of_eternity/boss_malygos.cpp
+ scripts/zone/nexus/eye_of_eternity/def_eye_of_eternity.h
+ scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
+ scripts/zone/obsidian_sanctum/boss_sartharion.cpp
+ scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
+ scripts/zone/vault_of_archavon/instance_vault_of_archavon.cpp
+ scripts/zone/vault_of_archavon/boss_archavon.cpp
+ scripts/zone/vault_of_archavon/def_vault_of_archavon.h
system.cpp
)
diff --git a/src/bindings/scripts/Makefile.am b/src/bindings/scripts/Makefile.am
index 6798b1785dc..764843f3714 100644
--- a/src/bindings/scripts/Makefile.am
+++ b/src/bindings/scripts/Makefile.am
@@ -269,6 +269,7 @@ scripts/zone/netherstorm/netherstorm.cpp \
scripts/zone/onyxias_lair/boss_onyxia.cpp \
scripts/zone/orgrimmar/orgrimmar.cpp \
scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp \
+scripts/zone/razorfen_downs/razorfen_downs.cpp \
scripts/zone/razorfen_kraul/razorfen_kraul.cpp \
scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp \
scripts/zone/ruins_of_ahnqiraj/boss_buru.cpp \
diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp
index 70974f9ea11..fa3b2466db9 100644
--- a/src/bindings/scripts/ScriptMgr.cpp
+++ b/src/bindings/scripts/ScriptMgr.cpp
@@ -8,7 +8,6 @@
#include "DBCStores.h"
#include "ObjectMgr.h"
#include "ProgressBar.h"
-#include "scripts/creature/mob_event_ai.h"
#define _FULLVERSION "TrinityScript"
@@ -31,33 +30,13 @@ struct StringTextData
uint32 Emote;
};
-// Enums used by StringTextData::Type
-enum ChatType
-{
- CHAT_TYPE_SAY = 0,
- CHAT_TYPE_YELL = 1,
- CHAT_TYPE_TEXT_EMOTE = 2,
- CHAT_TYPE_BOSS_EMOTE = 3,
- CHAT_TYPE_WHISPER = 4,
- CHAT_TYPE_BOSS_WHISPER = 5,
- CHAT_TYPE_ZONE_YELL = 6
-};
-
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
// Text Maps
UNORDERED_MAP<int32, StringTextData> TextMap;
-// Waypoint lists
-std::list<PointMovement> PointMovementList;
-
-//Event AI structure. Used exclusivly by mob_event_ai.cpp (60 bytes each)
-UNORDERED_MAP<uint32, std::vector<EventAI_Event> > EventAI_Event_Map;
-
-//Event AI summon structure. Used exclusivly by mob_event_ai.cpp.
-UNORDERED_MAP<uint32, EventAI_Summon> EventAI_Summon_Map;
-
-uint32 EAI_ErrorLevel;
+// Waypoint map (escorts)
+UNORDERED_MAP<uint32, std::vector<PointMovement> > PointMovementMap;
void FillSpellSummary();
void LoadOverridenSQLData();
@@ -74,7 +53,6 @@ extern void AddSC_boss_taerar();
extern void AddSC_boss_ysondre();
// -- Creature --
-extern void AddSC_mob_event();
extern void AddSC_generic_creature();
// -- Custom --
@@ -220,6 +198,11 @@ extern void AddSC_burning_steppes();
extern void AddSC_hyjal();
extern void AddSC_boss_archimonde();
extern void AddSC_instance_mount_hyjal();
+extern void AddSC_hyjal_trash();
+extern void AddSC_boss_rage_winterchill();
+extern void AddSC_boss_anetheron();
+extern void AddSC_boss_kazrogal();
+extern void AddSC_boss_azgalor();
//--Old Hillsbrad
extern void AddSC_boss_captain_skarloc();
@@ -411,6 +394,7 @@ extern void AddSC_orgrimmar();
//Ragefire Chasm
//Razorfen Downs
extern void AddSC_boss_amnennar_the_coldbringer();
+extern void AddSC_razorfen_downs();
//Razorfen Kraul
extern void AddSC_razorfen_kraul();
@@ -662,10 +646,10 @@ void LoadDatabase()
// Load EventAI Text
outstring_log("TSCR: Loading EventAI Texts...");
- LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE));
+ LoadTrinityStrings(TScriptDB,"creature_ai_texts",-1,1+(TEXT_SOURCE_RANGE));
// Gather Additional data from EventAI Texts
- result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts");
+ result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
outstring_log("TSCR: Loading EventAI Texts additional data...");
if (result)
@@ -687,27 +671,27 @@ void LoadDatabase()
if (i >= 0)
{
- error_db_log("TSCR: Entry %i in table `eventai_texts` is not a negative value.",i);
+ error_db_log("TSCR: Entry %i in table `creature_ai_texts` is not a negative value.",i);
continue;
}
if (i <= TEXT_SOURCE_RANGE)
{
- error_db_log("TSCR: Entry %i in table `eventai_texts` is out of accepted entry range for table.",i);
+ error_db_log("TSCR: Entry %i in table `creature_ai_texts` is out of accepted entry range for table.",i);
continue;
}
if (temp.SoundId)
{
if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId))
- error_db_log("TSCR: Entry %i in table `eventai_texts` has soundId %u but sound does not exist.",i,temp.SoundId);
+ error_db_log("TSCR: Entry %i in table `creature_ai_texts` has soundId %u but sound does not exist.",i,temp.SoundId);
}
if (!GetLanguageDescByID(temp.Language))
- error_db_log("TSCR: Entry %i in table `eventai_texts` using Language %u but Language does not exist.",i,temp.Language);
+ error_db_log("TSCR: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
- error_db_log("TSCR: Entry %i in table `eventai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
+ error_db_log("TSCR: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
TextMap[i] = temp;
++count;
@@ -722,7 +706,7 @@ void LoadDatabase()
barGoLink bar(1);
bar.step();
outstring_log("");
- outstring_log(">> Loaded 0 additional EventAI Texts data. DB table `eventai_texts` is empty.");
+ outstring_log(">> Loaded 0 additional EventAI Texts data. DB table `creature_ai_texts` is empty.");
}
// Load Script Text
@@ -856,7 +840,7 @@ void LoadDatabase()
}
// Drop Existing Waypoint list
- PointMovementList.clear();
+ PointMovementMap.clear();
uint64 uiCreatureCount = 0;
// Load Waypoints
@@ -883,6 +867,7 @@ void LoadDatabase()
PointMovement pTemp;
pTemp.m_uiCreatureEntry = pFields[0].GetUInt32();
+ uint32 uiCreatureEntry = pTemp.m_uiCreatureEntry;
pTemp.m_uiPointId = pFields[1].GetUInt32();
pTemp.m_fX = pFields[2].GetFloat();
pTemp.m_fY = pFields[3].GetFloat();
@@ -899,7 +884,7 @@ void LoadDatabase()
if (!pCInfo->ScriptID)
error_db_log("SD2: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.m_uiCreatureEntry);
- PointMovementList.push_back(pTemp);
+ PointMovementMap[uiCreatureEntry].push_back(pTemp);
++uiNodeCount;
} while (result->NextRow());
@@ -916,613 +901,6 @@ void LoadDatabase()
outstring_log(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
}
- //Gather additional data for EventAI
- result = TScriptDB.PQuery("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM eventai_summons");
-
- //Drop Existing EventSummon Map
- EventAI_Summon_Map.clear();
-
- outstring_log("TSCR: Loading EventAI Summons...");
- if (result)
- {
- barGoLink bar(result->GetRowCount());
- uint32 Count = 0;
-
- do
- {
- bar.step();
- Field *fields = result->Fetch();
-
- EventAI_Summon temp;
-
- uint32 i = fields[0].GetUInt32();
- temp.position_x = fields[1].GetFloat();
- temp.position_y = fields[2].GetFloat();
- temp.position_z = fields[3].GetFloat();
- temp.orientation = fields[4].GetFloat();
- temp.SpawnTimeSecs = fields[5].GetUInt32();
-
- //Add to map
- EventAI_Summon_Map[i] = temp;
- ++Count;
- }while (result->NextRow());
-
- delete result;
-
- outstring_log("");
- outstring_log(">> Loaded %u EventAI summon definitions", Count);
- }else
- {
- barGoLink bar(1);
- bar.step();
- outstring_log("");
- outstring_log(">> Loaded 0 EventAI Summon definitions. DB table `eventai_summons` is empty.");
- }
-
- //Drop Existing EventAI List
- EventAI_Event_Map.clear();
- uint64 uiEAICreatureCount = 0;
-
- result = TScriptDB.PQuery("SELECT COUNT(creature_id) FROM eventai_scripts GROUP BY creature_id");
- if (result)
- {
- uiEAICreatureCount = result->GetRowCount();
- delete result;
- }
-
- outstring_log("SD2: Loading EventAI scripts for %u creature(s)...", uiEAICreatureCount);
-
- //Gather event data
- result = TScriptDB.PQuery("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
- "event_param1, event_param2, event_param3, event_param4, "
- "action1_type, action1_param1, action1_param2, action1_param3, "
- "action2_type, action2_param1, action2_param2, action2_param3, "
- "action3_type, action3_param1, action3_param2, action3_param3 "
- "FROM eventai_scripts");
-
- outstring_log("SD2: Loading EventAI scripts for %u creature(s)...", uiEAICreatureCount);
- if (result)
- {
- barGoLink bar(result->GetRowCount());
- uint32 Count = 0;
-
- do
- {
- bar.step();
- Field *fields = result->Fetch();
-
- EventAI_Event temp;
-
- temp.event_id = fields[0].GetUInt32();
- uint32 i = temp.event_id;
- temp.creature_id = fields[1].GetUInt32();
- uint32 creature_id = temp.creature_id;
- temp.event_type = fields[2].GetUInt16();
- temp.event_inverse_phase_mask = fields[3].GetUInt32();
- temp.event_chance = fields[4].GetUInt8();
- temp.event_flags = fields[5].GetUInt8();
- temp.event_param1 = fields[6].GetUInt32();
- temp.event_param2 = fields[7].GetUInt32();
- temp.event_param3 = fields[8].GetUInt32();
- temp.event_param4 = fields[9].GetUInt32();
-
- //Creature does not exist in database
- if (!GetCreatureTemplateStore(temp.creature_id))
- {
- error_db_log("TSCR: Event %u has script for non-existing creature.", i);
- continue;
- }
-
- //Report any errors in event
- if (temp.event_type >= EVENT_T_END)
- {
- error_db_log("TSCR: Event %u has incorrect event type. Maybe DB requires updated version of SD2.", i);
- continue;
- }
-
- //No chance of this event occuring
- if (temp.event_chance == 0)
- error_db_log("TSCR: Event %u has 0 percent chance. Event will never trigger!", i);
-
- //Chance above 100, force it to be 100
- if (temp.event_chance > 100)
- {
- error_db_log("TSCR: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
- temp.event_chance = 100;
- }
-
- //Individual event checks
- switch (temp.event_type)
- {
- case EVENT_T_HP:
- case EVENT_T_MANA:
- case EVENT_T_TARGET_HP:
- {
- if (temp.event_param2 > 100)
- error_db_log("TSCR: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
-
- if (temp.event_param1 <= temp.event_param2)
- error_db_log("TSCR: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
-
- if (temp.event_flags & EFLAG_REPEATABLE && !temp.event_param3 && !temp.event_param4)
- {
- error_db_log("TSCR: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
- temp.event_flags &= ~EFLAG_REPEATABLE;
- }
- }
- break;
-
- case EVENT_T_SPELLHIT:
- {
- if (temp.event_param1)
- {
- SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.event_param1);
- if (!pSpell)
- {
- error_db_log("TSCR: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i);
- continue;
- }
-
- if (temp.event_param2_s != -1 && temp.event_param2 != pSpell->SchoolMask)
- error_db_log("TSCR: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.event_param1, i);
- }
-
- //TODO: fix this system with SPELL_SCHOOL_MASK. Current complicate things, using int32(-1) instead of just 0
- //SPELL_SCHOOL_MASK_NONE = 0 and does not exist, thus it can not ever trigger or be used in SpellHit()
- if (temp.event_param2_s != -1 && temp.event_param2_s > SPELL_SCHOOL_MASK_ALL)
- error_db_log("TSCR: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.event_param2, i);
-
- if (temp.event_param4 < temp.event_param3)
- error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_OOC_LOS:
- {
- if (temp.event_param2 > VISIBLE_RANGE || temp.event_param2 <= 0)
- {
- error_db_log("SD2: Creature %u are using event(%u), but param2 (MaxAllowedRange=%u) are not within allowed range.", temp.creature_id, i, temp.event_param2);
- temp.event_param2 = VISIBLE_RANGE;
- }
-
- if (temp.event_param3 == 0 && temp.event_param4 == 0 && temp.event_flags & EFLAG_REPEATABLE)
- {
- error_db_log("SD2: Creature %u are using event(%u) with EFLAG_REPEATABLE, but param3(RepeatMin) and param4(RepeatMax) are 0. Repeatable disabled.", temp.creature_id, i);
- temp.event_flags &= ~EFLAG_REPEATABLE;
- }
-
- if (temp.event_param4 < temp.event_param3)
- error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_RANGE:
- case EVENT_T_FRIENDLY_HP:
- case EVENT_T_FRIENDLY_IS_CC:
- {
- if (temp.event_param4 < temp.event_param3)
- error_db_log("SD2: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_FRIENDLY_MISSING_BUFF:
- {
- if (!GetSpellStore()->LookupEntry(temp.event_param1))
- {
- error_db_log("SD2: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i);
- continue;
- }
-
- if (temp.event_param4 < temp.event_param3)
- error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_TIMER:
- case EVENT_T_TIMER_OOC:
- {
- if (temp.event_param2 < temp.event_param1)
- error_db_log("TSCR: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
-
- if (temp.event_param4 < temp.event_param3)
- error_db_log("TSCR: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_KILL:
- case EVENT_T_TARGET_CASTING:
- {
- if (temp.event_param2 < temp.event_param1)
- error_db_log("TSCR: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
- }
- break;
-
- case EVENT_T_SUMMONED_UNIT:
- {
- if (!GetCreatureTemplateStore(temp.event_param1))
- {
- error_db_log("SD2: Creature %u has non-existant creature entry (%u) defined in event %u.", temp.creature_id, temp.event_param1, i);
- continue;
- }
- }
- break;
-
- case EVENT_T_AGGRO:
- case EVENT_T_DEATH:
- case EVENT_T_EVADE:
- case EVENT_T_SPAWNED:
- case EVENT_T_REACHED_HOME:
- {
- if (temp.event_flags & EFLAG_REPEATABLE)
- {
- error_db_log("TSCR: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
- temp.event_flags &= ~EFLAG_REPEATABLE;
- }
- }
- break;
-
- case EVENT_T_RECEIVE_EMOTE:
- {
- //no good way to check for valid textEmote (enum TextEmotes)
-
- switch(temp.event_param2)
- {
- case CONDITION_AURA:
- if (!GetSpellStore()->LookupEntry(temp.event_param3))
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are not valid.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- break;
- case CONDITION_TEAM:
- if (temp.event_param3 != HORDE || temp.event_param3 != ALLIANCE)
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are not valid.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- break;
- case CONDITION_QUESTREWARDED:
- case CONDITION_QUESTTAKEN:
- if (!GetQuestTemplateStore(temp.event_param3))
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are not valid.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- break;
- case CONDITION_ACTIVE_EVENT:
- if (temp.event_param3 !=
- (HOLIDAY_FIREWORKS_SPECTACULAR | HOLIDAY_FEAST_OF_WINTER_VEIL | HOLIDAY_NOBLEGARDEN |
- HOLIDAY_CHILDRENS_WEEK | HOLIDAY_CALL_TO_ARMS_AV | HOLIDAY_CALL_TO_ARMS_WG |
- HOLIDAY_CALL_TO_ARMS_AB | HOLIDAY_FISHING_EXTRAVAGANZA | HOLIDAY_HARVEST_FESTIVAL |
- HOLIDAY_HALLOWS_END | HOLIDAY_LUNAR_FESTIVAL | HOLIDAY_LOVE_IS_IN_THE_AIR |
- HOLIDAY_FIRE_FESTIVAL | HOLIDAY_CALL_TO_ARMS_ES | HOLIDAY_BREWFEST |
- HOLIDAY_DARKMOON_FAIRE_ELWYNN | HOLIDAY_DARKMOON_FAIRE_THUNDER | HOLIDAY_DARKMOON_FAIRE_SHATTRATH |
- HOLIDAY_CALL_TO_ARMS_SA | HOLIDAY_WOTLK_LAUNCH))
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are not valid.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- break;
- case CONDITION_REPUTATION_RANK:
- if (!temp.event_param3)
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are missing.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- if (temp.event_param4 > REP_EXALTED)
- {
- error_db_log("SD2: Creature %u using event %u: param4 (CondValue2: %u) are not valid.",temp.creature_id, i, temp.event_param4);
- continue;
- }
- break;
- case CONDITION_ITEM:
- case CONDITION_ITEM_EQUIPPED:
- case CONDITION_SKILL:
- if (!temp.event_param3)
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are missing.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- if (!temp.event_param4)
- {
- error_db_log("SD2: Creature %u using event %u: param4 (CondValue2: %u) are missing.",temp.creature_id, i, temp.event_param4);
- continue;
- }
- break;
- case CONDITION_ZONEID:
- if (!temp.event_param3)
- {
- error_db_log("SD2: Creature %u using event %u: param3 (CondValue1: %u) are missing.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- break;
- case CONDITION_NONE:
- break;
- default:
- {
- error_db_log("SD2: Creature %u using event %u: param2 (Condition: %u) are not valid/not implemented for script.",temp.creature_id, i, temp.event_param3);
- continue;
- }
- }
-
- if (!(temp.event_flags & EFLAG_REPEATABLE))
- {
- error_db_log("SD2: Creature %u using event %u: EFLAG_REPEATABLE not set. Event must always be repeatable. Flag applied.", temp.creature_id, i);
- temp.event_flags |= EFLAG_REPEATABLE;
- }
-
- }
- break;
-
- case EVENT_T_QUEST_ACCEPT:
- case EVENT_T_QUEST_COMPLETE:
- {
- error_db_log("SD2: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
- continue;
- }
- break;
- }
-
- for (uint32 j = 0; j < MAX_ACTIONS; j++)
- {
- temp.action[j].type = fields[10+(j*4)].GetUInt16();
- temp.action[j].param1 = fields[11+(j*4)].GetUInt32();
- temp.action[j].param2 = fields[12+(j*4)].GetUInt32();
- temp.action[j].param3 = fields[13+(j*4)].GetUInt32();
-
- //Report any errors in actions
- switch (temp.action[j].type)
- {
- case ACTION_T_TEXT:
- {
- if (temp.action[j].param1_s < 0)
- {
- if (TextMap.find(temp.action[j].param1_s) == TextMap.end())
- error_db_log("TSCR: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
- }
- if (temp.action[j].param2_s < 0)
- {
- if (TextMap.find(temp.action[j].param2_s) == TextMap.end())
- error_db_log("TSCR: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
-
- if (!temp.action[j].param1_s)
- error_db_log("TSCR: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
- }
- if (temp.action[j].param3_s < 0)
- {
- if (TextMap.find(temp.action[j].param3_s) == TextMap.end())
- error_db_log("TSCR: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
-
- if (!temp.action[j].param1_s || !temp.action[j].param2_s)
- error_db_log("TSCR: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
- }
- }
- break;
- case ACTION_T_SET_FACTION:
- if (temp.action[j].param1 !=0 && !GetFactionStore()->LookupEntry(temp.action[j].param1))
- {
- error_db_log("TSCR: Event %u Action %u uses non-existant FactionId %u.", i, j+1, temp.action[j].param1);
- temp.action[j].param1 = 0;
- }
- break;
- case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
- if (temp.action[j].param1 !=0 || temp.action[j].param2 !=0)
- {
- if (temp.action[j].param1 && !GetCreatureTemplateStore(temp.action[j].param1))
- {
- error_db_log("TSCR: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, temp.action[j].param1);
- temp.action[j].param1 = 0;
- }
-
- if (temp.action[j].param2 && !GetCreatureDisplayStore()->LookupEntry(temp.action[j].param2))
- {
- error_db_log("TSCR: Event %u Action %u uses non-existant ModelId %u.", i, j+1, temp.action[j].param2);
- temp.action[j].param2 = 0;
- }
- }
- break;
- case ACTION_T_SOUND:
- if (!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant SoundID %u.", i, j+1, temp.action[j].param1);
- break;
-
- /*case ACTION_T_RANDOM_SOUND:
- {
- if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, temp.action[j].param1);
- if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param2))
- error_db_log("TSCR: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, temp.action[j].param2);
- if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param3))
- error_db_log("TSCR: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3);
- }
- break;*/
-
- case ACTION_T_CAST:
- {
- const SpellEntry *spell = GetSpellStore()->LookupEntry(temp.action[j].param1);
- if (!spell)
- error_db_log("SD2: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param1);
- else
- {
- if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE)
- {
- //output as debug for now, also because there's no general rule all spells have RecoveryTime
- if (temp.event_param3 < spell->RecoveryTime)
- debug_log("TSCR: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,temp.action[j].param1, spell->RecoveryTime, temp.event_param3);
- }
- }
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_REMOVEAURASFROMSPELL:
- {
- if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
- error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
-
- if (temp.action[j].param1 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_QUEST_EVENT:
- {
- if (Quest const* qid = GetQuestTemplateStore(temp.action[j].param1))
- {
- if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- error_db_log("TSCR: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, temp.action[j].param1);
- }
- else
- error_db_log("TSCR: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_QUEST_EVENT_ALL:
- {
- if (Quest const* qid = GetQuestTemplateStore(temp.action[j].param1))
- {
- if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
- error_db_log("TSCR: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, temp.action[j].param1);
- }
- else
- error_db_log("TSCR: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
- }
- break;
- case ACTION_T_CASTCREATUREGO:
- {
- if (!GetCreatureTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
-
- if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
- error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
-
- if (temp.action[j].param3 >= TARGET_T_END)
- error_db_log("SD2: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_CASTCREATUREGO_ALL:
- {
- if (!GetQuestTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
-
- if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
- error_db_log("TSCR: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
- }
- break;
-
- //2nd param target
- case ACTION_T_SUMMON_ID:
- {
- if (!GetCreatureTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
-
- if (EventAI_Summon_Map.find(temp.action[j].param3) == EventAI_Summon_Map.end())
- error_db_log("TSCR: Event %u Action %u summons missing EventAI_Summon %u", i, j+1, temp.action[j].param3);
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_KILLED_MONSTER:
- {
- if (!GetCreatureTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_SUMMON:
- {
- if (!GetCreatureTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_THREAT_SINGLE_PCT:
- case ACTION_T_SET_UNIT_FLAG:
- case ACTION_T_REMOVE_UNIT_FLAG:
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
-
- //3rd param target
- case ACTION_T_SET_UNIT_FIELD:
- if (temp.action[j].param1 < OBJECT_END || temp.action[j].param1 >= UNIT_END)
- error_db_log("TSCR: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
- if (temp.action[j].param3 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- break;
-
- case ACTION_T_SET_PHASE:
- if (temp.action[j].param1 > 31)
- error_db_log("TSCR: Event %u Action %u attempts to set phase > 31. Phase mask cannot be used past phase 31.", i, j+1);
- break;
-
- case ACTION_T_INC_PHASE:
- if (!temp.action[j].param1)
- error_db_log("SD2: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
- break;
-
- case ACTION_T_SET_INST_DATA:
- {
- if (!(temp.event_flags & EFLAG_NORMAL) && !(temp.event_flags & EFLAG_HEROIC))
- error_db_log("TSCR: Event %u Action %u. Cannot set instance data without event flags (normal/heroic).", i, j+1);
-
- if (temp.action[j].param2 > SPECIAL)
- error_db_log("TSCR: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
- }
- break;
- case ACTION_T_SET_INST_DATA64:
- {
- if (!(temp.event_flags & EFLAG_NORMAL) && !(temp.event_flags & EFLAG_HEROIC))
- error_db_log("TSCR: Event %u Action %u. Cannot set instance data without event flags (normal/heroic).", i, j+1);
-
- if (temp.action[j].param2 >= TARGET_T_END)
- error_db_log("TSCR: Event %u Action %u uses incorrect Target type", i, j+1);
- }
- break;
- case ACTION_T_UPDATE_TEMPLATE:
- {
- if (!GetCreatureTemplateStore(temp.action[j].param1))
- error_db_log("TSCR: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
- }
- break;
- case ACTION_T_RANDOM_SAY:
- case ACTION_T_RANDOM_YELL:
- case ACTION_T_RANDOM_TEXTEMOTE:
- error_db_log("TSCR: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
- break;
-
- default:
- if (temp.action[j].type >= ACTION_T_END)
- error_db_log("TSCR: Event %u Action %u has incorrect action type. Maybe DB requires updated version of SD2.", i, j+1);
- break;
- }
- }
-
- //Add to list
- EventAI_Event_Map[creature_id].push_back(temp);
-
- ++Count;
- } while (result->NextRow());
-
- delete result;
-
- outstring_log("");
- outstring_log(">> Loaded %u EventAI scripts", Count);
- }else
- {
- barGoLink bar(1);
- bar.step();
- outstring_log("");
- outstring_log(">> Loaded 0 EventAI scripts. DB table `eventai_scripts` is empty.");
- }
-
//Free database thread and resources
TScriptDB.HaltDelayThread();
@@ -1569,25 +947,6 @@ void ScriptsInit()
}
else outstring_log("TSCR: Using configuration file %s",_TRINITY_SCRIPT_CONFIG);
- EAI_ErrorLevel = TScriptConfig.GetIntDefault("EAIErrorLevel", 1);
-
- switch (EAI_ErrorLevel)
- {
- case 0:
- outstring_log("TSCR: EventAI Error Reporting level set to 0 (Startup Errors only)");
- break;
- case 1:
- outstring_log("TSCR: EventAI Error Reporting level set to 1 (Startup errors and Runtime event errors)");
- break;
- case 2:
- outstring_log("TSCR: EventAI Error Reporting level set to 2 (Startup errors, Runtime event errors, and Creation errors)");
- break;
- default:
- outstring_log("TSCR: Unknown EventAI Error Reporting level. Defaulting to 1 (Startup errors and Runtime event errors)");
- EAI_ErrorLevel = 1;
- break;
- }
-
outstring_log("");
//Load database (must be called after TScriptConfig.SetSource). In case it failed, no need to even try load.
@@ -1615,7 +974,6 @@ void ScriptsInit()
AddSC_boss_ysondre();
// -- Creature --
- AddSC_mob_event();
AddSC_generic_creature();
// -- Custom --
@@ -1761,6 +1119,11 @@ void ScriptsInit()
AddSC_hyjal();
AddSC_boss_archimonde();
AddSC_instance_mount_hyjal();
+ AddSC_hyjal_trash();
+ AddSC_boss_rage_winterchill();
+ AddSC_boss_anetheron();
+ AddSC_boss_kazrogal();
+ AddSC_boss_azgalor();
//--Old Hillsbrad
AddSC_boss_captain_skarloc();
@@ -1951,6 +1314,7 @@ void ScriptsInit()
//Ragefire Chasm
//Razorfen Downs
AddSC_boss_amnennar_the_coldbringer();
+ AddSC_razorfen_downs();
//Razorfen Kraul
AddSC_razorfen_kraul();
diff --git a/src/bindings/scripts/VC71/71ScriptDev2.vcproj b/src/bindings/scripts/VC71/71ScriptDev2.vcproj
index 701d2db3673..ef03a6069ec 100644
--- a/src/bindings/scripts/VC71/71ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC71/71ScriptDev2.vcproj
@@ -43,7 +43,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ PreprocessorDefinitions="WIN32;_DEBUG;TRINITY_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -51,7 +51,7 @@
PrecompiledHeaderThrough="precompiled.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
+ DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -69,7 +69,7 @@
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\win\VC71\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC71\trinitycore__$(PlatformName)_$(ConfigurationName)"
GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/MaNGOSScript.pdb"
+ ProgramDatabaseFile="$(OutDir)/TrinityScript.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -234,16 +234,20 @@
Name="examples"
>
<File
- RelativePath="..\scripts\examples\example_creature.cpp">
+ RelativePath="..\scripts\examples\example_creature.cpp"
+ >
</File>
<File
- RelativePath="..\scripts\examples\example_escort.cpp">
+ RelativePath="..\scripts\examples\example_escort.cpp"
+ >
</File>
<File
- RelativePath="..\scripts\examples\example_gossip_codebox.cpp">
+ RelativePath="..\scripts\examples\example_gossip_codebox.cpp"
+ >
</File>
<File
- RelativePath="..\scripts\examples\example_misc.cpp">
+ RelativePath="..\scripts\examples\example_misc.cpp"
+ >
</File>
</Filter>
<Filter
@@ -578,6 +582,190 @@
>
</Filter>
<Filter
+ Name="Borean Tundra"
+ >
+ <File
+ RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Howling Fjord"
+ >
+ </Filter>
+ <Filter
+ Name="Crystalsong Forest"
+ >
+ </Filter>
+ <Filter
+ Name="Dalaran"
+ >
+ </Filter>
+ <Filter
+ Name="Dragonblight"
+ >
+ </Filter>
+ <Filter
+ Name="Grizzly Hills"
+ >
+ </Filter>
+ <Filter
+ Name="Icecrown"
+ >
+ </Filter>
+ <Filter
+ Name="Sholazar Basin"
+ >
+ </Filter>
+ <Filter
+ Name="The Storm Peaks"
+ >
+ </Filter>
+ <Filter
+ Name="Zul&apos;Drak"
+ >
+ </Filter>
+ <Filter
+ Name="Azjol-Nerub"
+ >
+ <Filter
+ Name="Ahn&apos;kahet"
+ >
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_amanitar.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_elder_nadox.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_herald_volazj.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_jedoga_shadowseeker.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_prince_taldaram.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\def_ahnkahet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\instance_ahnkahet.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Azjol-Nerub"
+ >
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_anubarak.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_hadronox.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_krikthir_the_gatewatcher.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\def_azjol_nerub.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\instance_azjol_nerub.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Drak&apos;Tharon Keep"
+ >
+ </Filter>
+ <Filter
+ Name="Gundrak"
+ >
+ </Filter>
+ <Filter
+ Name="Nexus"
+ >
+ <Filter
+ Name="Nexus"
+ >
+ </Filter>
+ <Filter
+ Name="Oculus"
+ >
+ </Filter>
+ <Filter
+ Name="Eye of Eternity"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Violet Hold"
+ >
+ </Filter>
+ <Filter
+ Name="Ulduar"
+ >
+ <Filter
+ Name="Halls of Stone"
+ >
+ </Filter>
+ <Filter
+ Name="Halls of Lightning"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Utgarde Keep"
+ >
+ <Filter
+ Name="Utgarde Keep"
+ >
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_ingvar_the_plunderer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_skarvald_dalronn.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_utgarde_keep.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Utgarde Pinnacle"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Obsidian Sanctum"
+ >
+ </Filter>
+ <Filter
+ Name="Vault of Archavon"
+ >
+ </Filter>
+ <Filter
Name="Scarlet Monastery"
>
<File
@@ -904,6 +1092,10 @@
RelativePath="..\scripts\zone\razorfen_downs\boss_amnennar_the_coldbringer.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\razorfen_downs\razorfen_downs.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Shadowfang Keep"
@@ -1069,9 +1261,9 @@
Name="Thousand Needles"
>
<File
- RelativePath="..\scripts\zone\thousand_needles\thousand_needles.cpp"
- >
- </File>
+ RelativePath="..\scripts\zone\thousand_needles\thousand_needles.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Silithus"
@@ -1233,9 +1425,9 @@
Name="Un&apos;Goro Crater"
>
<File
- RelativePath="..\scripts\zone\ungoro_crater\ungoro_crater.cpp"
- >
- </File>
+ RelativePath="..\scripts\zone\ungoro_crater\ungoro_crater.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Aunchindoun"
@@ -1460,11 +1652,11 @@
>
</File>
<File
- RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp"
+ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp"
+ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp"
>
</File>
</Filter>
@@ -1880,10 +2072,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -1892,6 +2100,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -1904,8 +2120,10 @@
>
</File>
</Filter>
+
<Filter
- Name="Culling of Stratholme">
+ Name="Culling of Stratholme"
+ >
</Filter>
<Filter
Name="Old Hillsbrad"
@@ -1968,166 +2186,6 @@
>
</File>
</Filter>
- <Filter
- Name="Borean Tundra">
- <File
- RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Howling Fjord">
- </Filter>
- <Filter
- Name="Crystalsong Forest">
- </Filter>
- <Filter
- Name="Dalaran">
- </Filter>
- <Filter
- Name="Dragonblight">
- </Filter>
- <Filter
- Name="Grizzly Hills">
- </Filter>
- <Filter
- Name="Icecrown">
- </Filter>
- <Filter
- Name="Sholazar Basin">
- </Filter>
- <Filter
- Name="The Storm Peaks">
- </Filter>
- <Filter
- Name="Zul&apos;Drak">
- </Filter>
- <Filter
- Name="Azjol-Nerub">
- <Filter
- Name="Ahn&apos;kahet"
- >
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_amanitar.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_elder_nadox.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_herald_volazj.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_jedoga_shadowseeker.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_prince_taldaram.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\def_ahnkahet.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\instance_ahnkahet.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Azjol-Nerub"
- >
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp"
- >
- </File>
- </Filter>
-
- </Filter>
- <Filter
- Name="Drak&apos;Tharon Keep">
- </Filter>
- <Filter
- Name="Gundrak">
- </Filter>
- <Filter
- Name="Nexus">
- <Filter
- Name="Nexus">
- </Filter>
- <Filter
- Name="Oculus">
- </Filter>
- <Filter
- Name="Eye of Eternity">
- </Filter>
- </Filter>
- <Filter
- Name="Violet Hold">
- </Filter>
- <Filter
- Name="Ulduar"
- >
- <Filter
- Name="Halls of Stone">
- </Filter>
- <Filter
- Name="Halls of Lightning">
- </Filter>
- </Filter>
- <Filter
- Name="Utgarde Keep">
- <Filter
- Name="Utgarde Keep">
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_skarvald_dalronn.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_ingvar_the_plunderer.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_utgarde_keep.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Utgarde Pinnacle">
- </Filter>
- </Filter>
- <Filter
- Name="Obsidian Sanctum">
- </Filter>
- <Filter
- Name="Vault of Archavon">
- </Filter>
<Filter
Name="Shattrath City"
>
@@ -2264,21 +2322,13 @@
>
</File>
<File
- RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp"
- >
- </File>
- <File
RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_anubshiah.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_emperor_dagran_thaurissan.cpp"
>
@@ -2286,7 +2336,7 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_general_angerforge.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_gorosh_the_dervish.cpp"
>
@@ -2294,7 +2344,7 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_grizzle.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_high_interrogator_gerstahn.cpp"
>
@@ -2306,11 +2356,19 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_moira_bronzebeard.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_tomb_of_seven.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Loch Modan"
@@ -2371,10 +2429,6 @@
</File>
</Filter>
<File
- RelativePath="..\config.h"
- >
- </File>
- <File
RelativePath="..\ScriptMgr.cpp"
>
</File>
@@ -2383,10 +2437,6 @@
>
</File>
<File
- RelativePath="..\svn_revision.h"
- >
- </File>
- <File
RelativePath="..\system.cpp"
>
</File>
diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
index b7311a6debb..8fd97430dbc 100644
--- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj
@@ -47,15 +47,15 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ PreprocessorDefinitions="WIN32;_DEBUG;TRINITY_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="precompiled.h"
WarningLevel="3"
- Detect64BitPortabilityProblems="true"
- DebugInformationFormat="4"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -73,7 +73,7 @@
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\win\VC80\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC80\trinitycore__$(PlatformName)_$(ConfigurationName)"
GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/MaNGOSScript.pdb"
+ ProgramDatabaseFile="$(OutDir)/TrinityScript.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -215,7 +215,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ PreprocessorDefinitions="WIN32;_DEBUG;TRINITY_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -241,7 +241,7 @@
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\win\VC80\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC80\trinitycore__$(PlatformName)_$(ConfigurationName)"
GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/MaNGOSScript.pdb"
+ ProgramDatabaseFile="$(OutDir)/TrinityScript.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/TrinityScript.lib"
TargetMachine="17"
@@ -759,6 +759,190 @@
>
</Filter>
<Filter
+ Name="Borean Tundra"
+ >
+ <File
+ RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Howling Fjord"
+ >
+ </Filter>
+ <Filter
+ Name="Crystalsong Forest"
+ >
+ </Filter>
+ <Filter
+ Name="Dalaran"
+ >
+ </Filter>
+ <Filter
+ Name="Dragonblight"
+ >
+ </Filter>
+ <Filter
+ Name="Grizzly Hills"
+ >
+ </Filter>
+ <Filter
+ Name="Icecrown"
+ >
+ </Filter>
+ <Filter
+ Name="Sholazar Basin"
+ >
+ </Filter>
+ <Filter
+ Name="The Storm Peaks"
+ >
+ </Filter>
+ <Filter
+ Name="Zul&apos;Drak"
+ >
+ </Filter>
+ <Filter
+ Name="Azjol-Nerub"
+ >
+ <Filter
+ Name="Ahn&apos;kahet"
+ >
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_amanitar.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_elder_nadox.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_herald_volazj.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_jedoga_shadowseeker.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_prince_taldaram.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\def_ahnkahet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\instance_ahnkahet.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Azjol-Nerub"
+ >
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_anubarak.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_hadronox.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_krikthir_the_gatewatcher.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\def_azjol_nerub.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\instance_azjol_nerub.cpp"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Drak&apos;Tharon Keep"
+ >
+ </Filter>
+ <Filter
+ Name="Gundrak"
+ >
+ </Filter>
+ <Filter
+ Name="Nexus"
+ >
+ <Filter
+ Name="Nexus"
+ >
+ </Filter>
+ <Filter
+ Name="Oculus"
+ >
+ </Filter>
+ <Filter
+ Name="Eye of Eternity"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Violet Hold"
+ >
+ </Filter>
+ <Filter
+ Name="Ulduar"
+ >
+ <Filter
+ Name="Halls of Stone"
+ >
+ </Filter>
+ <Filter
+ Name="Halls of Lightning"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Utgarde Keep"
+ >
+ <Filter
+ Name="Utgarde Keep"
+ >
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_ingvar_the_plunderer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_skarvald_dalronn.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_utgarde_keep.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Utgarde Pinnacle"
+ >
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Obsidian Sanctum"
+ >
+ </Filter>
+ <Filter
+ Name="Vault of Archavon"
+ >
+ </Filter>
+ <Filter
Name="Scarlet Monastery"
>
<File
@@ -1078,166 +1262,6 @@
Name="Ragefire Chasm"
>
</Filter>
- <Filter
- Name="Borean Tundra">
- <File
- RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Howling Fjord">
- </Filter>
- <Filter
- Name="Crystalsong Forest">
- </Filter>
- <Filter
- Name="Dalaran">
- </Filter>
- <Filter
- Name="Dragonblight">
- </Filter>
- <Filter
- Name="Grizzly Hills">
- </Filter>
- <Filter
- Name="Icecrown">
- </Filter>
- <Filter
- Name="Sholazar Basin">
- </Filter>
- <Filter
- Name="The Storm Peaks">
- </Filter>
- <Filter
- Name="Zul&apos;Drak">
- </Filter>
- <Filter
- Name="Azjol-Nerub">
- <Filter
- Name="Ahn&apos;kahet"
- >
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_amanitar.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_elder_nadox.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_herald_volazj.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_jedoga_shadowseeker.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_prince_taldaram.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\def_ahnkahet.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\instance_ahnkahet.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Azjol-Nerub"
- >
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp"
- >
- </File>
- </Filter>
-
- </Filter>
- <Filter
- Name="Drak&apos;Tharon Keep">
- </Filter>
- <Filter
- Name="Gundrak">
- </Filter>
- <Filter
- Name="Nexus">
- <Filter
- Name="Nexus">
- </Filter>
- <Filter
- Name="Oculus">
- </Filter>
- <Filter
- Name="Eye of Eternity">
- </Filter>
- </Filter>
- <Filter
- Name="Violet Hold">
- </Filter>
- <Filter
- Name="Ulduar"
- >
- <Filter
- Name="Halls of Stone">
- </Filter>
- <Filter
- Name="Halls of Lightning">
- </Filter>
- </Filter>
- <Filter
- Name="Utgarde Keep">
- <Filter
- Name="Utgarde Keep">
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_keleseth.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_skarvald_dalronn.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\boss_ingvar_the_plunderer.cpp"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\def_utgarde_keep.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\utgarde_keep\utgarde_keep\instance_utgarde_keep.cpp"
- >
- </File>
- </Filter>
- <Filter
- Name="Utgarde Pinnacle">
- </Filter>
- </Filter>
- <Filter
- Name="Obsidian Sanctum">
- </Filter>
- <Filter
- Name="Vault of Archavon">
- </Filter>
<Filter
Name="Razorfen Downs"
>
@@ -1245,6 +1269,10 @@
RelativePath="..\scripts\zone\razorfen_downs\boss_amnennar_the_coldbringer.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\razorfen_downs\razorfen_downs.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Shadowfang Keep"
@@ -1410,9 +1438,9 @@
Name="Thousand Needles"
>
<File
- RelativePath="..\scripts\zone\thousand_needles\thousand_needles.cpp"
- >
- </File>
+ RelativePath="..\scripts\zone\thousand_needles\thousand_needles.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Silithus"
@@ -1574,9 +1602,9 @@
Name="Un&apos;Goro Crater"
>
<File
- RelativePath="..\scripts\zone\ungoro_crater\ungoro_crater.cpp"
- >
- </File>
+ RelativePath="..\scripts\zone\ungoro_crater\ungoro_crater.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Aunchindoun"
@@ -1801,11 +1829,11 @@
>
</File>
<File
- RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp"
+ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_vazruden_the_herald.cpp"
+ RelativePath="..\scripts\zone\hellfire_citadel\hellfire_ramparts\boss_watchkeeper_gargolmar.cpp"
>
</File>
</Filter>
@@ -2221,10 +2249,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -2233,6 +2277,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -2245,6 +2297,7 @@
>
</File>
</Filter>
+
<Filter
Name="Culling of Stratholme"
>
@@ -2446,21 +2499,13 @@
>
</File>
<File
- RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h"
- >
- </File>
- <File
- RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp"
- >
- </File>
- <File
RelativePath="..\scripts\zone\blackrock_depths\boss_ambassador_flamelash.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_anubshiah.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_emperor_dagran_thaurissan.cpp"
>
@@ -2468,7 +2513,7 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_general_angerforge.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_gorosh_the_dervish.cpp"
>
@@ -2476,7 +2521,7 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_grizzle.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_high_interrogator_gerstahn.cpp"
>
@@ -2488,11 +2533,19 @@
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_moira_bronzebeard.cpp"
>
- </File>
+ </File>
<File
RelativePath="..\scripts\zone\blackrock_depths\boss_tomb_of_seven.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\blackrock_depths\def_blackrock_depths.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\blackrock_depths\instance_blackrock_depths.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Loch Modan"
@@ -2569,10 +2622,6 @@
</File>
</Filter>
<File
- RelativePath="..\config.h"
- >
- </File>
- <File
RelativePath="..\ScriptMgr.cpp"
>
</File>
@@ -2581,10 +2630,6 @@
>
</File>
<File
- RelativePath="..\svn_revision.h"
- >
- </File>
- <File
RelativePath="..\system.cpp"
>
</File>
diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
index 92db238591f..57b7db8f253 100644
--- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj
+++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1250"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9,00"
+ Version="9.00"
Name="TrinityScript"
ProjectGUID="{4295C8A9-79B7-4354-8064-F05FB9CA0C96}"
RootNamespace="ScriptDev2"
@@ -47,7 +47,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ PreprocessorDefinitions="WIN32;_DEBUG;TRINITY_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -73,7 +73,7 @@
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\win\VC90\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC90\trinitycore__$(PlatformName)_$(ConfigurationName)"
GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/MaNGOSScript.pdb"
+ ProgramDatabaseFile="$(OutDir)/TrinityScript.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -103,7 +103,7 @@
/>
</Configuration>
<Configuration
- Name="Debug|x64"
+ Name="Release|Win32"
OutputDirectory="..\..\..\..\bin\$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\ScriptDev2__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="2"
@@ -125,16 +125,16 @@
/>
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="0"
+ AdditionalOptions="/MP"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ MinimalRebuild="false"
+ RuntimeLibrary="2"
+ EnableEnhancedInstructionSet="1"
+ FloatingPointModel="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="precompiled.h"
WarningLevel="3"
@@ -154,15 +154,16 @@
Name="VCLinkerTool"
AdditionalDependencies="trinitycore.lib zthread.lib"
OutputFile="$(OutDir)/TrinityScript.dll"
- LinkIncremental="2"
+ LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\win\VC90\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC90\trinitycore__$(PlatformName)_$(ConfigurationName)"
- GenerateDebugInformation="true"
- ProgramDatabaseFile="$(OutDir)/MaNGOSScript.pdb"
+ GenerateDebugInformation="false"
SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/TrinityScript.lib"
- TargetMachine="17"
+ TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
@@ -187,7 +188,7 @@
/>
</Configuration>
<Configuration
- Name="Release|Win32"
+ Name="Debug|x64"
OutputDirectory="..\..\..\..\bin\$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\ScriptDev2__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="2"
@@ -209,16 +210,16 @@
/>
<Tool
Name="VCMIDLTool"
+ TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/MP"
+ Optimization="0"
AdditionalIncludeDirectories="..\..\..\..\dep\include\;..\..\..\shared\;..\..\..\framework\;..\..\..\game\;..\include\;..\..\..\..\dep\ACE_wrappers"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SCRIPT"
- MinimalRebuild="false"
- RuntimeLibrary="2"
- EnableEnhancedInstructionSet="1"
- FloatingPointModel="2"
+ PreprocessorDefinitions="WIN32;_DEBUG;TRINITY_DEBUG;_WINDOWS;_USRDLL;SCRIPT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="precompiled.h"
WarningLevel="3"
@@ -238,16 +239,15 @@
Name="VCLinkerTool"
AdditionalDependencies="trinitycore.lib zthread.lib"
OutputFile="$(OutDir)/TrinityScript.dll"
- LinkIncremental="1"
+ LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\win\VC90\zthread__$(PlatformName)_$(ConfigurationName);..\..\..\..\win\VC90\trinitycore__$(PlatformName)_$(ConfigurationName)"
- GenerateDebugInformation="false"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)/TrinityScript.pdb"
SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(OutDir)/TrinityScript.lib"
- TargetMachine="1"
+ TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
@@ -477,6 +477,14 @@
<Filter
Name="custom"
>
+ <File
+ RelativePath="..\scripts\custom\npc_acherus_taxi.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\custom\npc_wyrmresttempel_taxi.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="areatrigger"
@@ -808,31 +816,31 @@
Name="Ahn&apos;kahet"
>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_amanitar.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_amanitar.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_elder_nadox.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_elder_nadox.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_herald_volazj.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_herald_volazj.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_jedoga_shadowseeker.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_jedoga_shadowseeker.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\boss_prince_taldaram.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\boss_prince_taldaram.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\def_ahnkahet.h"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\def_ahnkahet.h"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Ahn&apos;kahet\instance_ahnkahet.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\ahnkahet\instance_ahnkahet.cpp"
>
</File>
</Filter>
@@ -840,23 +848,23 @@
Name="Azjol-Nerub"
>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_anubarak.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_anubarak.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_hadronox.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_hadronox.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\boss_krikthir_the_gatewatcher.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\boss_krikthir_the_gatewatcher.cpp"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\def_azjol_nerub.h"
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\def_azjol_nerub.h"
>
</File>
<File
- RelativePath="..\scripts\zone\Azjol-Nerub\Azjol-Nerub\instance_azjol_nerub.cpp"
+ RelativePath="..\scripts\zone\azjol_nerub\azjol_nerub\instance_azjol_nerub.cpp"
>
</File>
</Filter>
@@ -864,10 +872,62 @@
<Filter
Name="Drak&apos;Tharon Keep"
>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\boss_dred.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\boss_novos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\boss_tharon_ja.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\boss_trollgore.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\def_drak_tharon_keep.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\draktharon_keep\instance_drak_tharon_keep.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Gundrak"
>
+ <File
+ RelativePath="..\scripts\zone\gundrak\boss_drakkari_colossus.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\boss_eck.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\boss_gal_darah.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\boss_moorabi.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\boss_slad_ran.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\def_gundrak.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\gundrak\instance_gundrak.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Nexus"
@@ -875,19 +935,123 @@
<Filter
Name="Nexus"
>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\boss_anomalus.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\boss_keristrasza.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\boss_magus_telestra.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\boss_ormorok.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\commander_kolurg.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\commander_stoutbeard.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\def_nexus.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\nexus\instance_nexus.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Oculus"
>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\boss_drakos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\boss_eregos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\boss_urom.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\boss_varos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\def_oculus.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\oculus\instance_oculus.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Eye of Eternity"
>
+ <File
+ RelativePath="..\scripts\zone\nexus\eye_of_eternity\boss_malygos.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\eye_of_eternity\def_eye_of_eternity.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\nexus\eye_of_eternity\instance_eye_of_eternity.cpp"
+ >
+ </File>
</Filter>
</Filter>
<Filter
Name="Violet Hold"
>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_cyanigosa.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_erekem.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_ichoron.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_lavanthor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_moragg.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_xevozz.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\boss_zuramat.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\def_violet_hold.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\violet_hold\instance_violet_hold.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Ulduar"
@@ -895,10 +1059,54 @@
<Filter
Name="Halls of Stone"
>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_stone\boss_krystallus.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_stone\boss_maiden_of_grief.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_stone\boss_sjonnir.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_stone\def_halls_of_stone.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_stone\instance_halls_of_stone.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Halls of Lightning"
>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\boss_bjarngrim.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\boss_ionar.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\boss_loken.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\boss_volkhan.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\def_halls_of_lightning.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\ulduar\halls_of_lightning\instance_halls_of_lightning.cpp"
+ >
+ </File>
</Filter>
</Filter>
<Filter
@@ -931,15 +1139,63 @@
<Filter
Name="Utgarde Pinnacle"
>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\boss_palehoof.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\boss_skadi.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\boss_svala.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\boss_ymiron.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\def_pinnacle.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\utgarde_keep\utgarde_pinnacle\instance_pinnacle.cpp"
+ >
+ </File>
</Filter>
</Filter>
<Filter
Name="Obsidian Sanctum"
>
+ <File
+ RelativePath="..\scripts\zone\obsidian_sanctum\boss_sartharion.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\obsidian_sanctum\def_obsidian_sanctum.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\obsidian_sanctum\instance_obsidian_sanctum.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Vault of Archavon"
>
+ <File
+ RelativePath="..\scripts\zone\vault_of_archavon\boss_archavon.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\vault_of_archavon\def_vault_of_archavon.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\vault_of_archavon\instance_vault_of_archavon.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Scarlet Monastery"
@@ -1268,6 +1524,10 @@
RelativePath="..\scripts\zone\razorfen_downs\boss_amnennar_the_coldbringer.cpp"
>
</File>
+ <File
+ RelativePath="..\scripts\zone\razorfen_downs\razorfen_downs.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Shadowfang Keep"
@@ -2244,10 +2504,26 @@
Name="Battle for Mt. Hyjal"
>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_anetheron.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_archimonde.cpp"
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_azgalor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_kazrogal.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\boss_rage_winterchill.cpp"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\def_hyjal.h"
>
</File>
@@ -2256,6 +2532,14 @@
>
</File>
<File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjal_trash.h"
+ >
+ </File>
+ <File
RelativePath="..\scripts\zone\caverns_of_time\hyjal\hyjalAI.cpp"
>
</File>
@@ -2271,6 +2555,30 @@
<Filter
Name="Culling of Stratholme"
>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\boss_epoch.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\boss_mal_ganis.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\boss_meathook.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\boss_salramm.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\def_culling_of_stratholme.h"
+ >
+ </File>
+ <File
+ RelativePath="..\scripts\zone\caverns_of_time\culling_of_stratholme\instance_culling_of_stratholme.cpp"
+ >
+ </File>
</Filter>
<Filter
Name="Old Hillsbrad"
@@ -2542,7 +2850,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Debug|x64"
+ Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
@@ -2550,7 +2858,7 @@
/>
</FileConfiguration>
<FileConfiguration
- Name="Release|Win32"
+ Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 59019348043..fcd44d94842 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -33,7 +33,7 @@ void SummonList::DespawnEntry(uint32 entry)
{
for(iterator i = begin(); i != end(); ++i)
{
- if(Creature *summon = (Creature*)Unit::GetUnit(*m_creature, *i))
+ if(Creature *summon = Unit::GetCreature(*m_creature, *i))
{
if(summon->GetEntry() == entry)
{
@@ -55,7 +55,7 @@ void SummonList::DespawnAll()
{
for(iterator i = begin(); i != end(); ++i)
{
- if(Creature *summon = (Creature*)Unit::GetUnit(*m_creature, *i))
+ if(Creature *summon = Unit::GetCreature(*m_creature, *i))
{
summon->setDeathState(JUST_DIED);
summon->RemoveCorpse();
@@ -233,21 +233,18 @@ void ScriptedAI::DoWhisper(const char* text, Unit* reciever, bool IsBossWhisper)
m_creature->MonsterWhisper(text, reciever->GetGUID(), IsBossWhisper);
}
-void ScriptedAI::DoPlaySoundToSet(Unit* unit, uint32 sound)
+void ScriptedAI::DoPlaySoundToSet(Unit* pSource, uint32 uiSoundId)
{
- if (!unit)
+ if (!pSource)
return;
- if (!GetSoundEntriesStore()->LookupEntry(sound))
+ if (!GetSoundEntriesStore()->LookupEntry(uiSoundId))
{
- error_log("SD2: Invalid soundId %u used in DoPlaySoundToSet (by unit TypeId %u, guid %u)", sound, unit->GetTypeId(), unit->GetGUID());
+ error_log("SD2: Invalid soundId %u used in DoPlaySoundToSet (by unit TypeId %u, guid %u)", uiSoundId, pSource->GetTypeId(), pSource->GetGUID());
return;
}
- WorldPacket data(4);
- data.SetOpcode(SMSG_PLAY_SOUND);
- data << uint32(sound);
- unit->SendMessageToSet(&data,false);
+ pSource->PlayDirectSound(uiSoundId);
}
Creature* ScriptedAI::DoSpawnCreature(uint32 id, float x, float y, float z, float angle, uint32 type, uint32 despawntime)
@@ -519,11 +516,11 @@ bool ScriptedAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
return false;
//Silenced so we can't cast
- if (!Triggered && m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ if (!Triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
return false;
//Check for power
- if (!Triggered && m_creature->GetPower((Powers)Spell->powerType) < Spell->manaCost)
+ if (!Triggered && me->GetPower((Powers)Spell->powerType) < Spell->manaCost)
return false;
SpellRangeEntry const *TempRange = NULL;
@@ -535,7 +532,8 @@ bool ScriptedAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
return false;
//Unit is out of range of this spell
- if (m_creature->GetDistance(Target) > m_creature->GetSpellMaxRangeForTarget(Target, TempRange) || m_creature->GetDistance(Target) < m_creature->GetSpellMinRangeForTarget(Target, TempRange))
+ if (me->GetDistance(Target) > me->GetSpellMaxRangeForTarget(Target, TempRange)
+ || me->GetDistance(Target) < me->GetSpellMinRangeForTarget(Target, TempRange))
return false;
return true;
@@ -636,39 +634,6 @@ void FillSpellSummary()
}
}
-void ScriptedAI::DoZoneInCombat(Unit* pUnit)
-{
- if (!pUnit)
- pUnit = m_creature;
-
- Map *map = pUnit->GetMap();
-
- if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
- {
- error_log("SD2: DoZoneInCombat call for map that isn't an instance (pUnit entry = %d)", pUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)pUnit)->GetEntry() : 0);
- return;
- }
-
- if (!pUnit->CanHaveThreatList() || pUnit->getThreatManager().isThreatListEmpty())
- {
- error_log("SD2: DoZoneInCombat called for creature that either cannot have threat list or has empty threat list (pUnit entry = %d)", pUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)pUnit)->GetEntry() : 0);
-
- return;
- }
-
- Map::PlayerList const &PlayerList = map->GetPlayers();
- for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
- {
- if (Player* i_pl = i->getSource())
- if (i_pl->isAlive())
- {
- pUnit->SetInCombatWith(i_pl);
- i_pl->SetInCombatWith(pUnit);
- pUnit->AddThreat(i_pl, 0.0f);
- }
- }
-}
-
void ScriptedAI::DoResetThreat()
{
if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty())
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 5cb9b2c9f81..61a82bb6dd5 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -148,9 +148,6 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
//Plays a sound to all nearby players
void DoPlaySoundToSet(Unit* unit, uint32 sound);
- //Places the entire map into combat with creature
- void DoZoneInCombat(Unit* pUnit = 0);
-
//Drops all threat to 0%. Does not remove players from the threat list
void DoResetThreat();
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index ed0e8d2a0a7..5f656a45da8 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -1,1525 +1 @@
-/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: Mob_Event_AI
-SD%Complete: 90
-SDComment: Database Event AI
-SDCategory: Creatures
-EndScriptData */
-
#include "precompiled.h"
-#include "mob_event_ai.h"
-#include "ObjectMgr.h"
-#include "GameEventMgr.h"
-
-#define EVENT_UPDATE_TIME 500
-#define SPELL_RUN_AWAY 8225
-
-struct EventHolder
-{
- EventHolder(EventAI_Event p) : Event(p), Time(0), Enabled(true){}
-
- EventAI_Event Event;
- uint32 Time;
- bool Enabled;
-};
-
-struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
-{
- Mob_EventAI(Creature *c, std::list<EventHolder> pEventList) : ScriptedAI(c)
- {
- EventList = pEventList;
- bEmptyList = pEventList.empty();
- Phase = 0;
- CombatMovementEnabled = true;
- MeleeEnabled = true;
- AttackDistance = 0;
- AttackAngle = 0.0f;
-
- //Handle Spawned Events
- if (!bEmptyList)
- {
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_SPAWNED)
- ProcessEvent(*i);
- }
- }
- }
-
- ~Mob_EventAI()
- {
- EventList.clear();
- }
-
- //Variables used by EventAI for handling events
- std::list<EventHolder> EventList; //Holder for events (stores enabled, time, and eventid)
- uint32 EventUpdateTime; //Time between event updates
- uint32 EventDiff; //Time between the last event call
- bool bEmptyList;
-
- //Variables used by Events themselves
- uint8 Phase; //Current phase, max 32 phases
- bool CombatMovementEnabled; //If we allow targeted movment gen (movement twoards top threat)
- bool MeleeEnabled; //If we allow melee auto attack
- uint32 AttackDistance; //Distance to attack from
- float AttackAngle; //Angle of attack
- uint32 TimetoFleeLeft; //For fleeing
-
- bool ProcessEvent(EventHolder& pHolder, Unit* pActionInvoker = NULL)
- {
- if (!pHolder.Enabled || pHolder.Time)
- return false;
-
- //Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask)
- if (pHolder.Event.event_inverse_phase_mask & (1 << Phase))
- return false;
-
- //Store random here so that all random actions match up
- uint32 rnd = rand();
-
- //Return if chance for event is not met
- if (pHolder.Event.event_chance <= rnd % 100)
- return false;
-
- union
- {
- uint32 param1;
- int32 param1_s;
- };
-
- union
- {
- uint32 param2;
- int32 param2_s;
- };
-
- union
- {
- uint32 param3;
- int32 param3_s;
- };
-
- union
- {
- uint32 param4;
- int32 param4_s;
- };
-
- param1 = pHolder.Event.event_param1;
- param2 = pHolder.Event.event_param2;
- param3 = pHolder.Event.event_param3;
- param4 = pHolder.Event.event_param4;
-
- //Check event conditions based on the event type, also reset events
- switch (pHolder.Event.event_type)
- {
- case EVENT_T_TIMER:
- {
- if (!InCombat)
- return false;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_TIMER_OOC:
- {
- if (InCombat)
- return false;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_HP:
- {
- if (!InCombat || !m_creature->GetMaxHealth())
- return false;
-
- uint32 perc = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth();
-
- if (perc > param1 || perc < param2)
- return false;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_MANA:
- {
- if (!InCombat || !m_creature->GetMaxPower(POWER_MANA))
- return false;
-
- uint32 perc = (m_creature->GetPower(POWER_MANA)*100) / m_creature->GetMaxPower(POWER_MANA);
-
- if (perc > param1 || perc < param2)
- return false;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_AGGRO:
- {
- }
- break;
- case EVENT_T_KILL:
- {
- //Repeat Timers
- if (param1 == param2)
- {
- pHolder.Time = param1;
-
- }else if (param2 > param1)
- pHolder.Time = urand(param1, param2);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- case EVENT_T_DEATH:
- {
- }
- break;
- case EVENT_T_EVADE:
- {
- }
- break;
- case EVENT_T_SPELLHIT:
- {
- //Spell hit is special case, param1 and param2 handled within EventAI::SpellHit
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_RANGE:
- {
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_OOC_LOS:
- {
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_SPAWNED:
- {
- }
- break;
- case EVENT_T_TARGET_HP:
- {
- if (!InCombat || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth())
- return false;
-
- uint32 perc = (m_creature->getVictim()->GetHealth()*100) / m_creature->getVictim()->GetMaxHealth();
-
- if (perc > param1 || perc < param2)
- return false;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_TARGET_CASTING:
- {
- if (!InCombat || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true))
- return false;
-
- //Repeat Timers
- if (param1 == param2)
- {
- pHolder.Time = param1;
-
- }else if (param2 > param1)
- pHolder.Time = urand(param1, param2);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_FRIENDLY_HP:
- {
- if (!InCombat)
- return false;
-
- Unit* pUnit = DoSelectLowestHpFriendly(param2, param1);
-
- if (!pUnit)
- return false;
-
- pActionInvoker = pUnit;
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_FRIENDLY_IS_CC:
- {
- if (!InCombat)
- return false;
-
- std::list<Creature*> pList = DoFindFriendlyCC(param2);
-
- //List is empty
- if (pList.empty())
- return false;
-
- //We don't really care about the whole list, just return first available
- pActionInvoker = *(pList.begin());
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_FRIENDLY_MISSING_BUFF:
- {
- std::list<Creature*> pList = DoFindFriendlyMissingBuff(param2, param1);
-
- //List is empty
- if (pList.empty())
- return false;
-
- //We don't really care about the whole list, just return first available
- pActionInvoker = *(pList.begin());
-
- //Repeat Timers
- if (param3 == param4)
- {
- pHolder.Time = param3;
-
- }else if (param4 > param3)
- pHolder.Time = urand(param3, param4);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_SUMMONED_UNIT:
- {
- //Prevent event from occuring on no unit or non creatures
- if (!pActionInvoker || pActionInvoker->GetTypeId()!=TYPEID_UNIT)
- return false;
-
- //Creature id doesn't match up
- if (param1 && ((Creature*)pActionInvoker)->GetEntry() != param1)
- return false;
-
- //Repeat Timers
- if (param2 == param3)
- {
- pHolder.Time = param2;
-
- }else if (param3 > param2)
- pHolder.Time = urand(param2, param3);
- else
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- pHolder.Enabled = false;
- }
- }
- break;
- case EVENT_T_REACHED_HOME:
- {
- }
- break;
- case EVENT_T_RECEIVE_EMOTE:
- {
- }
- break;
- default:
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
- break;
- }
-
- //Disable non-repeatable events
- if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE))
- pHolder.Enabled = false;
-
- //Process actions
- for (uint32 j = 0; j < MAX_ACTIONS; j++)
- ProcessAction(pHolder.Event.action[j].type, pHolder.Event.action[j].param1, pHolder.Event.action[j].param2, pHolder.Event.action[j].param3, rnd, pHolder.Event.event_id, pActionInvoker);
-
- return true;
- }
-
- inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3)
- {
- switch (rnd % 3)
- {
- case 0:
- return param1;
- break;
- case 1:
- return param2;
- break;
- case 2:
- return param3;
- break;
- }
- return 0;
- }
-
- inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker)
- {
- switch (Target)
- {
- case TARGET_T_SELF:
- return m_creature;
- break;
- case TARGET_T_HOSTILE:
- return m_creature->getVictim();
- break;
- case TARGET_T_HOSTILE_SECOND_AGGRO:
- return SelectUnit(SELECT_TARGET_TOPAGGRO,1);
- break;
- case TARGET_T_HOSTILE_LAST_AGGRO:
- return SelectUnit(SELECT_TARGET_BOTTOMAGGRO,0);
- break;
- case TARGET_T_HOSTILE_RANDOM:
- return SelectUnit(SELECT_TARGET_RANDOM,0);
- break;
- case TARGET_T_HOSTILE_RANDOM_NOT_TOP:
- return SelectUnit(SELECT_TARGET_RANDOM,1);
- break;
- case TARGET_T_ACTION_INVOKER:
- return pActionInvoker;
- break;
- default:
- return NULL;
- break;
- };
- }
-
- void ProcessAction(uint16 type, uint32 param1, uint32 param2, uint32 param3, uint32 rnd, uint32 EventId, Unit* pActionInvoker)
- {
- switch (type)
- {
- case ACTION_T_TEXT:
- {
- if (!param1)
- return;
-
- uint32 temp = 0;
-
- if (param2 && param3)
- {
- switch( rand()%3 )
- {
- case 0: temp = param1; break;
- case 2: temp = param2; break;
- case 3: temp = param3; break;
- }
- }else if ( param2 && urand(0,1) )
- {
- temp = param2;
- }else
- {
- temp = param1;
- }
-
- if (temp)
- {
- Unit* target = NULL;
- Unit* owner = NULL;
-
- if (pActionInvoker)
- {
- if (pActionInvoker->GetTypeId() == TYPEID_PLAYER)
- target = pActionInvoker;
- else if (owner = pActionInvoker->GetOwner())
- {
- if (owner->GetTypeId() == TYPEID_PLAYER)
- target = owner;
- }
- }
- else if (target = m_creature->getVictim())
- {
- if (target->GetTypeId() != TYPEID_PLAYER)
- {
- if (owner = target->GetOwner())
- {
- if (owner->GetTypeId() == TYPEID_PLAYER)
- target = owner;
- }
- }
- }
-
- DoScriptText(temp, m_creature, target);
- }
- }
- break;
- case ACTION_T_SET_FACTION:
- {
- if (param1)
- m_creature->setFaction(param1);
- else
- {
- if (CreatureInfo const* ci = GetCreatureTemplateStore(m_creature->GetEntry()))
- {
- //if no id provided, assume reset and then use default
- if (m_creature->getFaction() != ci->faction_A)
- m_creature->setFaction(ci->faction_A);
- }
- }
- }
- break;
- case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
- {
- if (param1 || param2)
- {
- //set model based on entry from creature_template
- if (param1)
- {
- if (CreatureInfo const* ci = GetCreatureTemplateStore(param1))
- {
- //use default display
- if (ci->Modelid1)
- m_creature->SetDisplayId(ci->Modelid1);
- }
- }
- //if no param1, then use value from param2 (modelId)
- else
- m_creature->SetDisplayId(param2);
- }
- else
- m_creature->DeMorph();
- }
- break;
- case ACTION_T_SOUND:
- DoPlaySoundToSet(m_creature, param1);
- break;
- case ACTION_T_EMOTE:
- m_creature->HandleEmoteCommand(param1);
- break;
- case ACTION_T_RANDOM_SOUND:
- {
- uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
-
- if (temp != 0xffffffff)
- DoPlaySoundToSet(m_creature, temp);
- }
- break;
- case ACTION_T_RANDOM_EMOTE:
- {
- uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
-
- if (temp != 0xffffffff)
- m_creature->HandleEmoteCommand(temp);
- }
- break;
- case ACTION_T_CAST:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
- Unit* caster = m_creature;
-
- if (!target)
- return;
-
- //Cast is always triggered if target is forced to cast on self
- if (param3 & CAST_FORCE_TARGET_SELF)
- {
- param3 |= CAST_TRIGGERED;
- caster = target;
- }
-
- //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
- bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
-
- // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
- if(param3 & CAST_AURA_NOT_PRESENT)
- {
- if(target->HasAura(param1))
- return;
- }
-
- if (canCast)
- {
- const SpellEntry* tSpell = GetSpellStore()->LookupEntry(param1);
-
- //Verify that spell exists
- if (tSpell)
- {
- //Check if cannot cast spell
- if (!(param3 & (CAST_FORCE_TARGET_SELF | CAST_FORCE_CAST)) &&
- !CanCast(target, tSpell, (param3 & CAST_TRIGGERED)))
- {
- //Melee current victim if flag not set
- if (!(param3 & CAST_NO_MELEE_IF_OOM))
- {
- if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
- {
- AttackDistance = 0;
- AttackAngle = 0;
-
- m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle);
- }
- }
-
- }
- else
- {
- //Interrupt any previous spell
- if (caster->IsNonMeleeSpellCasted(false) && param3 & CAST_INTURRUPT_PREVIOUS)
- caster->InterruptNonMeleeSpells(false);
-
- caster->CastSpell(target, param1, (param3 & CAST_TRIGGERED));
- }
-
- }else if (EAI_ErrorLevel > 0)
- error_db_log("SD2: EventAI event %d creature %d attempt to cast spell that doesn't exist %d", EventId, m_creature->GetEntry(), param1);
- }
- }
- break;
- case ACTION_T_SUMMON:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- Creature* pCreature = NULL;
-
- if (param3)
- pCreature = DoSpawnCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3);
- else pCreature = pCreature = DoSpawnCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
-
- if (!pCreature)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log( "SD2: EventAI failed to spawn creature %u. Spawn event %d is on creature %d", param1, EventId, m_creature->GetEntry());
- }
- else if (param2 != TARGET_T_SELF && target)
- pCreature->AI()->AttackStart(target);
- }
- break;
- case ACTION_T_THREAT_SINGLE_PCT:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- if (target)
- DoModifyThreatPercent(target, param1);
- }
- break;
- case ACTION_T_THREAT_ALL_PCT:
- {
- Unit* Temp = NULL;
-
- std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
- for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
- {
- Temp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid());
- if (Temp)
- DoModifyThreatPercent(Temp, param1);
- }
- }
- break;
- case ACTION_T_QUEST_EVENT:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- ((Player*)target)->AreaExploredOrEventHappens(param1);
- }
- break;
- case ACTION_T_CASTCREATUREGO:
- {
- Unit* target = GetTargetByType(param3, pActionInvoker);
-
- if (target && target->GetTypeId() == TYPEID_PLAYER)
- ((Player*)target)->CastedCreatureOrGO(param1, m_creature->GetGUID(), param2);
- }
- break;
- case ACTION_T_SET_UNIT_FIELD:
- {
- Unit* target = GetTargetByType(param3, pActionInvoker);
-
- if (param1 < OBJECT_END || param1 >= UNIT_END)
- return;
-
- if (target)
- target->SetUInt32Value(param1, param2);
- }
- break;
- case ACTION_T_SET_UNIT_FLAG:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- if (target)
- target->SetFlag(UNIT_FIELD_FLAGS, param1);
- }
- break;
- case ACTION_T_REMOVE_UNIT_FLAG:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- if (target)
- target->RemoveFlag(UNIT_FIELD_FLAGS, param1);
- }
- break;
- case ACTION_T_AUTO_ATTACK:
- {
- if (param1)
- MeleeEnabled = true;
- else MeleeEnabled = false;
- }
- break;
- case ACTION_T_COMBAT_MOVEMENT:
- {
- CombatMovementEnabled = param1;
-
- //Allow movement (create new targeted movement gen only if idle)
- if (CombatMovementEnabled)
- {
- m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle);
- }
- else
- {
- m_creature->GetMotionMaster()->MoveIdle();
- }
- }
- break;
- case ACTION_T_SET_PHASE:
- {
- Phase = param1;
- }
- break;
- case ACTION_T_INC_PHASE:
- {
- Phase += param1;
-
- if (Phase > 31)
- if (EAI_ErrorLevel > 0)
- error_db_log( "SD2: Event %d incremented Phase above 31. Phase mask cannot be used with phases past 31. CreatureEntry = %d", EventId, m_creature->GetEntry());
- }
- break;
- case ACTION_T_EVADE:
- {
- EnterEvadeMode();
- }
- break;
- case ACTION_T_FLEE:
- {
- if(m_creature->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
- break;
- TimetoFleeLeft = 8000;
- m_creature->DoFleeToGetAssistance();
- IsFleeing = true;
- }
- break;
- case ACTION_T_QUEST_EVENT_ALL:
- {
- Unit* Temp = NULL;
- if( pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER )
- {
- Temp = Unit::GetUnit((*m_creature),pActionInvoker->GetGUID());
- if( Temp )
- ((Player*)Temp)->GroupEventHappens(param1,m_creature);
- }
- }
- break;
- case ACTION_T_CASTCREATUREGO_ALL:
- {
- Unit* Temp = NULL;
-
- std::list<HostilReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
- for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
- {
- Temp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid());
- if (Temp && Temp->GetTypeId() == TYPEID_PLAYER)
- ((Player*)Temp)->CastedCreatureOrGO(param1, m_creature->GetGUID(), param2);
- }
- }
- break;
- case ACTION_T_REMOVEAURASFROMSPELL:
- {
- Unit* target = GetTargetByType(param1, pActionInvoker);
-
- if (target)
- target->RemoveAurasDueToSpell(param2);
- }
- break;
- case ACTION_T_RANGED_MOVEMENT:
- {
- AttackDistance = param1;
- AttackAngle = ((float)param2/180)*M_PI;
-
- if (CombatMovementEnabled)
- {
- m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle);
- }
- }
- break;
- case ACTION_T_RANDOM_PHASE:
- {
- uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
-
- Phase = temp;
- }
- break;
- case ACTION_T_RANDOM_PHASE_RANGE:
- {
- if (param2 > param1)
- {
- Phase = param1 + (rnd % (param2 - param1));
- }
- else if (EAI_ErrorLevel > 0)
- error_db_log( "SD2: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
- }
- break;
- case ACTION_T_SUMMON_ID:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- //Duration
- Creature* pCreature = NULL;
-
- UNORDERED_MAP<uint32, EventAI_Summon>::iterator i = EventAI_Summon_Map.find(param3);
-
- if (i == EventAI_Summon_Map.end())
- {
- if (EAI_ErrorLevel > 0)
- error_db_log( "SD2: EventAI failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", param1, param3, EventId, m_creature->GetEntry());
- return;
- }
-
- if ((*i).second.SpawnTimeSecs)
- pCreature = m_creature->SummonCreature(param1, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
- else pCreature = m_creature->SummonCreature(param1, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
-
- if (!pCreature)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log( "SD2: EventAI failed to spawn creature %u. EventId %d.Creature %d", param1, EventId, m_creature->GetEntry());
- }
- else if (param2 != TARGET_T_SELF && target)
- pCreature->AI()->AttackStart(target);
- }
- break;
- case ACTION_T_KILLED_MONSTER:
- {
- //first attempt player who tapped creature
- if (Player* pPlayer = m_creature->GetLootRecipient())
- pPlayer->RewardPlayerAndGroupAtEvent(param1,m_creature);
- else
- {
- //if not available, use pActionInvoker
- Unit* pTarget = GetTargetByType(param2, pActionInvoker);
-
- if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
- pPlayer->RewardPlayerAndGroupAtEvent(param1,m_creature);
- }
- }
- break;
- case ACTION_T_SET_INST_DATA:
- {
- ScriptedInstance* pInst = (ScriptedInstance*)m_creature->GetInstanceData();
- if (!pInst)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d attempt to set instance data without instance script. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
-
- pInst->SetData(param1, param2);
- }
- break;
- case ACTION_T_SET_INST_DATA64:
- {
- Unit* target = GetTargetByType(param2, pActionInvoker);
-
- if (!target)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
-
- ScriptedInstance* pInst = (ScriptedInstance*)m_creature->GetInstanceData();
-
- if (!pInst)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
-
- pInst->SetData64(param1, target->GetGUID());
- }
- break;
- case ACTION_T_UPDATE_TEMPLATE:
- {
- if (m_creature->GetEntry() == param1)
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
-
- m_creature->UpdateEntry(param1, param2 ? HORDE : ALLIANCE);
- }
- break;
- case ACTION_T_DIE:
- {
- if (m_creature->isDead())
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
- m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
- }
- break;
- case ACTION_T_ZONE_COMBAT_PULSE:
- {
- if (!m_creature->isInCombat() || !m_creature->GetMap()->IsDungeon())
- {
- if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Event %d ACTION_T_ZONE_COMBAT_PULSE on creature out of combat or in non-dungeon map. Creature %d", EventId, m_creature->GetEntry());
- return;
- }
-
- DoZoneInCombat();
- }
- break;
-
- // TRINITY ONLY
- case ACTION_T_SET_ACTIVE:
- m_creature->setActive(param1 ? true : false);
- break;
- case ACTION_T_SET_AGGRESSIVE:
- m_creature->SetReactState(ReactStates(param1));
- break;
- case ACTION_T_ATTACK_START_PULSE:
- AttackStart(m_creature->SelectNearestTarget((float)param1));
- break;
- }
- }
-
- void JustRespawned()
- {
- InCombat = false;
- IsFleeing = false;
- Reset();
-
- if (bEmptyList)
- return;
-
- //Handle Spawned Events
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_SPAWNED)
- ProcessEvent(*i);
- }
- }
-
- void Reset()
- {
- EventUpdateTime = EVENT_UPDATE_TIME;
- EventDiff = 0;
-
- if (bEmptyList)
- return;
-
- //Reset all events to enabled
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- switch ((*i).Event.event_type)
- {
- //Reset all out of combat timers
- case EVENT_T_TIMER_OOC:
- {
- if ((*i).Event.event_param2 == (*i).Event.event_param1)
- {
- (*i).Time = (*i).Event.event_param1;
- (*i).Enabled = true;
- }
- else if ((*i).Event.event_param2 > (*i).Event.event_param1)
- {
- (*i).Time = urand((*i).Event.event_param1, (*i).Event.event_param2);
- (*i).Enabled = true;
- }
- else if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has InitialMax < InitialMin. Event disabled.", m_creature->GetEntry(), (*i).Event.event_id, (*i).Event.event_type);
- }
- break;
- //default:
- //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro()
- //(*i).Enabled = true;
- //(*i).Time = 0;
- //break;
- }
- }
- }
-
- //when creature reach home after EnterEvadeMode
- void JustReachedHome()
- {
- m_creature->LoadCreaturesAddon();
-
- if (!bEmptyList)
- {
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_REACHED_HOME)
- ProcessEvent(*i);
- }
- }
-
- Reset();
- }
-
- void EnterEvadeMode()
- {
- m_creature->InterruptNonMeleeSpells(true);
- m_creature->RemoveAllAuras();
- m_creature->DeleteThreatList();
- m_creature->CombatStop();
-
- if (m_creature->isAlive())
- m_creature->GetMotionMaster()->MoveTargetedHome();
-
- m_creature->SetLootRecipient(NULL);
-
- InCombat = false;
-
- if (bEmptyList)
- return;
-
- //Handle Evade events
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_EVADE)
- ProcessEvent(*i);
- }
- }
-
- void JustDied(Unit* killer)
- {
- InCombat = false;
- IsFleeing = false;
- Reset();
-
- if (bEmptyList)
- return;
-
- //Handle Evade events
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_DEATH)
- ProcessEvent(*i, killer);
- }
- }
-
- void KilledUnit(Unit* victim)
- {
- if (bEmptyList || victim->GetTypeId() != TYPEID_PLAYER)
- return;
-
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_KILL)
- ProcessEvent(*i, victim);
- }
- }
-
- void JustSummoned(Creature* pUnit)
- {
- if (bEmptyList || !pUnit)
- return;
-
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_SUMMONED_UNIT)
- ProcessEvent(*i, pUnit);
- }
- }
-
- void Aggro(Unit *who)
- {
- //Check for on combat start events
- if (!bEmptyList)
- {
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- switch ((*i).Event.event_type)
- {
- case EVENT_T_AGGRO:
- (*i).Enabled = true;
- ProcessEvent(*i, who);
- break;
- //Reset all in combat timers
- case EVENT_T_TIMER:
- if ((*i).Event.event_param2 == (*i).Event.event_param1)
- {
- (*i).Time = (*i).Event.event_param1;
- (*i).Enabled = true;
- }
- else if ((*i).Event.event_param2 > (*i).Event.event_param1)
- {
- (*i).Time = urand((*i).Event.event_param1, (*i).Event.event_param2);
- (*i).Enabled = true;
- }
- else if (EAI_ErrorLevel > 0)
- error_db_log("SD2: Creature %u using Event %u (Type = %u) has InitialMax < InitialMin. Event disabled.", m_creature->GetEntry(), (*i).Event.event_id, (*i).Event.event_type);
- break;
- //All normal events need to be re-enabled and their time set to 0
- default:
- (*i).Enabled = true;
- (*i).Time = 0;
- break;
- }
- }
- }
-
- EventUpdateTime = EVENT_UPDATE_TIME;
- EventDiff = 0;
- }
-
- void AttackStart(Unit *who)
- {
- if (!who)
- return;
-
- if (m_creature->Attack(who, MeleeEnabled))
- {
- //Begin melee attack if we are within range
-
- if (!InCombat)
- {
- InCombat = true;
- Aggro(who);
- }
-
- if (CombatMovementEnabled)
- {
- m_creature->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
- }
- else
- {
- m_creature->GetMotionMaster()->MoveIdle();
- }
- }
- }
-
- void MoveInLineOfSight(Unit *who)
- {
- if (!who || InCombat)
- return;
-
- //Check for OOC LOS Event
- if (!bEmptyList && !m_creature->getVictim())
- {
- for (std::list<EventHolder>::iterator itr = EventList.begin(); itr != EventList.end(); ++itr)
- {
- if ((*itr).Event.event_type == EVENT_T_OOC_LOS)
- {
- //can trigger if closer than fMaxAllowedRange
- float fMaxAllowedRange = (*itr).Event.event_param2;
-
- //if range is ok and we are actually in LOS
- if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
- {
- //if friendly event&&who is not hostile OR hostile event&&who is hostile
- if (((*itr).Event.event_param1 && !m_creature->IsHostileTo(who)) ||
- ((!(*itr).Event.event_param1) && m_creature->IsHostileTo(who)))
- ProcessEvent(*itr, who);
- }
- }
- }
- }
-
- // do we need this?
- //if (m_creature->isCivilian() && m_creature->IsNeutralToAll())
- // return;
-
- if(m_creature->canStartAttack(who))
- AttackStart(who);
- }
-
- void SpellHit(Unit* pUnit, const SpellEntry* pSpell)
- {
- if (bEmptyList)
- return;
-
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- if ((*i).Event.event_type == EVENT_T_SPELLHIT)
- {
- //If spell id matches (or no spell id) & if spell school matches (or no spell school)
- if (!(*i).Event.event_param1 || pSpell->Id == (*i).Event.event_param1)
- {
- if ((*i).Event.event_param2_s == -1 || pSpell->SchoolMask == (*i).Event.event_param2)
- ProcessEvent(*i, pUnit);
- }
- }
- }
- }
-
- void UpdateAI(const uint32 diff)
- {
- //Check if we are in combat (also updates calls threat update code)
- bool Combat = InCombat ? UpdateVictim() : false;
-
- //Must return if creature isn't alive. Normally select hostil target and get victim prevent this
- if (!m_creature->isAlive())
- return;
-
- if (IsFleeing)
- {
- if(TimetoFleeLeft < diff)
- {
- m_creature->SetControlled(false, UNIT_STAT_FLEEING);
- m_creature->SetNoCallAssistance(false);
- m_creature->CallAssistance();
- if(m_creature->getVictim())
- m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
- IsFleeing = false;
- }
- else
- TimetoFleeLeft -= diff;
-
- return;
- }
-
- //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
- if (!bEmptyList)
- {
- if (EventUpdateTime < diff)
- {
- EventDiff += diff;
-
- //Check for time based events
- for (std::list<EventHolder>::iterator i = EventList.begin(); i != EventList.end(); ++i)
- {
- //Decrement Timers
- if ((*i).Time)
- {
- if ((*i).Time > EventDiff)
- {
- //Do not decrement timers if event cannot trigger in this phase
- if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
- (*i).Time -= EventDiff;
-
- //Skip processing of events that have time remaining
- continue;
- }
- else (*i).Time = 0;
- }
-
- //Events that are updated every EVENT_UPDATE_TIME
- switch ((*i).Event.event_type)
- {
- case EVENT_T_TIMER_OOC:
- ProcessEvent(*i);
- break;
- case EVENT_T_TIMER:
- case EVENT_T_MANA:
- case EVENT_T_HP:
- case EVENT_T_TARGET_HP:
- case EVENT_T_TARGET_CASTING:
- case EVENT_T_FRIENDLY_HP:
- if (Combat)
- ProcessEvent(*i);
- break;
- case EVENT_T_RANGE:
- if (Combat)
- {
- if (m_creature->IsWithinDistInMap(m_creature->getVictim(),(float)(*i).Event.event_param2))
- {
- if (m_creature->GetDistance(m_creature->getVictim()) >= (float)(*i).Event.event_param1)
- ProcessEvent(*i);
- }
- }
- break;
- }
- }
-
- EventDiff = 0;
- EventUpdateTime = EVENT_UPDATE_TIME;
- }
- else
- {
- EventDiff += diff;
- EventUpdateTime -= diff;
- }
- }
-
- //Melee Auto-Attack
- if (Combat && MeleeEnabled)
- DoMeleeAttackIfReady();
-
- }
-};
-
-CreatureAI* GetAI_mob_eventai(Creature* pCreature)
-{
- //Select events by creature id
- std::list<EventHolder> EventList;
-
- //Find creature id in the Event map
- UNORDERED_MAP<uint32, std::vector<EventAI_Event> >::iterator CreatureEvents = EventAI_Event_Map.find(pCreature->GetEntry());
-
- if (CreatureEvents != EventAI_Event_Map.end())
- {
- std::vector<EventAI_Event>::iterator i;
-
- for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
- {
- //Debug check
-#ifndef _DEBUG
- if ((*i).event_flags & EFLAG_DEBUG_ONLY)
- continue;
-#endif
- if (pCreature->GetMap()->IsDungeon())
- {
- if ((pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_HEROIC) ||
- (!pCreature->GetMap()->IsHeroic() && (*i).event_flags & EFLAG_NORMAL))
- {
- //event flagged for instance mode
- EventList.push_back(EventHolder(*i));
- }
- continue;
- }
-
- EventList.push_back(EventHolder(*i));
- }
-
- //EventMap had events but they were not added because they must be for instance
- if (EventList.empty())
- {
- if (EAI_ErrorLevel > 1)
- error_db_log("SD2: CreatureId has events but no events added to list because of instance flags.", pCreature->GetEntry());
- }
- }
- else
- {
- if (EAI_ErrorLevel > 1)
- error_db_log("SD2: EventMap for Creature %u is empty but creature is using Mob_EventAI.", pCreature->GetEntry());
- }
-
- return new Mob_EventAI(pCreature, EventList);
-}
-
-bool ReceiveEmote_mob_eventai(Player* pPlayer, Creature* pCreature, uint32 uiEmote)
-{
- if(pCreature->isCharmed())
- return true;
-
- Mob_EventAI* pTmpCreature = (Mob_EventAI*)(pCreature->AI());
-
- if (pTmpCreature->bEmptyList)
- return true;
-
- for (std::list<EventHolder>::iterator itr = pTmpCreature->EventList.begin(); itr != pTmpCreature->EventList.end(); ++itr)
- {
- if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE)
- {
- if ((*itr).Event.event_param1 != uiEmote)
- return true;
-
- bool bProcess = false;
-
- switch((*itr).Event.event_param2)
- {
- //enum ConditionType
- case CONDITION_NONE: // 0 0
- bProcess = true;
- break;
- case CONDITION_AURA: // spell_id effindex
- if (pPlayer->HasAura((*itr).Event.event_param3,(*itr).Event.event_param4))
- bProcess = true;
- break;
- case CONDITION_ITEM: // item_id count
- if (pPlayer->HasItemCount((*itr).Event.event_param3,(*itr).Event.event_param4))
- bProcess = true;
- break;
- case CONDITION_ITEM_EQUIPPED: // item_id count
- if (pPlayer->HasItemOrGemWithIdEquipped((*itr).Event.event_param3,(*itr).Event.event_param4))
- bProcess = true;
- break;
- case CONDITION_ZONEID: // zone_id 0
- if (pPlayer->GetZoneId() == (*itr).Event.event_param3)
- bProcess = true;
- break;
- case CONDITION_REPUTATION_RANK: // faction_id min_rank
- if (pPlayer->GetReputationRank((*itr).Event.event_param3) >= (*itr).Event.event_param4)
- bProcess = true;
- break;
- case CONDITION_TEAM: // player_team 0, (469 - Alliance 67 - Horde)
- if (pPlayer->GetTeam() == (*itr).Event.event_param3)
- bProcess = true;
- break;
- case CONDITION_SKILL: // skill_id min skill_value
- if (pPlayer->HasSkill((*itr).Event.event_param3) && pPlayer->GetSkillValue((*itr).Event.event_param3) >= (*itr).Event.event_param4)
- bProcess = true;
- break;
- case CONDITION_QUESTREWARDED: // quest_id 0
- if (pPlayer->GetQuestRewardStatus((*itr).Event.event_param3))
- bProcess = true;
- break;
- case CONDITION_QUESTTAKEN: // quest_id 0, for condition true while quest active.
- if (pPlayer->GetQuestStatus((*itr).Event.event_param3) == QUEST_STATUS_INCOMPLETE)
- bProcess = true;
- break;
- case CONDITION_ACTIVE_EVENT: // event_id 0
- if (IsHolidayActive(HolidayIds((*itr).Event.event_param3)))
- bProcess = true;
- break;
- }
-
- if (bProcess)
- {
- debug_log("SD2: ReceiveEmote EventAI: Condition ok, processing");
- pTmpCreature->ProcessEvent(*itr, pPlayer);
- }
- }
- }
-
- return true;
-}
-
-void AddSC_mob_event()
-{
- Script *newscript;
- newscript = new Script;
- newscript->Name = "mob_eventai";
- newscript->GetAI = &GetAI_mob_eventai;
- newscript->pReceiveEmote = &ReceiveEmote_mob_eventai;
- newscript->RegisterSelf();
-}
-
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.h b/src/bindings/scripts/scripts/creature/mob_event_ai.h
index 7c56b7932dc..f6c9b663ce0 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.h
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.h
@@ -1,223 +1,4 @@
-/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
- * This program is free software licensed under GPL version 2
- * Please see the included DOCS/LICENSE.TXT for more information */
-
#ifndef SC_EVENTAI_H
#define SC_EVENTAI_H
-
-#define MAX_ACTIONS 3
-
-enum Event_Types
-{
- EVENT_T_TIMER = 0, //InitialMin, InitialMax, RepeatMin, RepeatMax
- EVENT_T_TIMER_OOC = 1, //InitialMin, InitialMax, RepeatMin, RepeatMax
- EVENT_T_HP = 2, //HPMax%, HPMin%, RepeatMin, RepeatMax
- EVENT_T_MANA = 3, //ManaMax%,ManaMin% RepeatMin, RepeatMax
- EVENT_T_AGGRO = 4, //NONE
- EVENT_T_KILL = 5, //RepeatMin, RepeatMax
- EVENT_T_DEATH = 6, //NONE
- EVENT_T_EVADE = 7, //NONE
- EVENT_T_SPELLHIT = 8, //SpellID, School, RepeatMin, RepeatMax
- EVENT_T_RANGE = 9, //MinDist, MaxDist, RepeatMin, RepeatMax
- EVENT_T_OOC_LOS = 10, //NoHostile, NoFriendly, RepeatMin, RepeatMax
- EVENT_T_SPAWNED = 11, //NONE
- EVENT_T_TARGET_HP = 12, //HPMax%, HPMin%, RepeatMin, RepeatMax
- EVENT_T_TARGET_CASTING = 13, //RepeatMin, RepeatMax
- EVENT_T_FRIENDLY_HP = 14, //HPDeficit, Radius, RepeatMin, RepeatMax
- EVENT_T_FRIENDLY_IS_CC = 15, //DispelType, Radius, RepeatMin, RepeatMax
- EVENT_T_FRIENDLY_MISSING_BUFF = 16, //SpellId, Radius, RepeatMin, RepeatMax
- EVENT_T_SUMMONED_UNIT = 17, //CreatureId, RepeatMin, RepeatMax
- EVENT_T_TARGET_MANA = 18, //ManaMax%, ManaMin%, RepeatMin, RepeatMax
- EVENT_T_QUEST_ACCEPT = 19, //QuestID
- EVENT_T_QUEST_COMPLETE = 20, //
- EVENT_T_REACHED_HOME = 21, //NONE
- EVENT_T_RECEIVE_EMOTE = 22, //EmoteId, Condition, CondValue1, CondValue2
-
- EVENT_T_END,
-};
-
-enum Action_Types
-{
- ACTION_T_NONE = 0, //No action
- ACTION_T_TEXT = 1, //-TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values.
- ACTION_T_SET_FACTION = 2, //FactionId (or 0 for default)
- ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, //Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph)
- ACTION_T_SOUND = 4, //SoundId
- ACTION_T_EMOTE = 5, //EmoteId
- ACTION_T_RANDOM_SAY = 6, //UNUSED
- ACTION_T_RANDOM_YELL = 7, //UNUSED
- ACTION_T_RANDOM_TEXTEMOTE = 8, //UNUSED
- ACTION_T_RANDOM_SOUND = 9, //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field)
- ACTION_T_RANDOM_EMOTE = 10, //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field)
- ACTION_T_CAST = 11, //SpellId, Target, CastFlags
- ACTION_T_SUMMON = 12, //CreatureID, Target, Duration in ms
- ACTION_T_THREAT_SINGLE_PCT = 13, //Threat%, Target
- ACTION_T_THREAT_ALL_PCT = 14, //Threat%
- ACTION_T_QUEST_EVENT = 15, //QuestID, Target
- ACTION_T_CASTCREATUREGO = 16, //QuestID, SpellId, Target
- ACTION_T_SET_UNIT_FIELD = 17, //Field_Number, Value, Target
- ACTION_T_SET_UNIT_FLAG = 18, //Flags (may be more than one field OR'd together), Target
- ACTION_T_REMOVE_UNIT_FLAG = 19, //Flags (may be more than one field OR'd together), Target
- ACTION_T_AUTO_ATTACK = 20, //AllowAttackState (0 = stop attack, anything else means continue attacking)
- ACTION_T_COMBAT_MOVEMENT = 21, //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
- ACTION_T_SET_PHASE = 22, //Phase
- ACTION_T_INC_PHASE = 23, //Value (may be negative to decrement phase, should not be 0)
- ACTION_T_EVADE = 24, //No Params
- ACTION_T_FLEE = 25, //No Params
- ACTION_T_QUEST_EVENT_ALL = 26, //QuestID
- ACTION_T_CASTCREATUREGO_ALL = 27, //QuestId, SpellId
- ACTION_T_REMOVEAURASFROMSPELL = 28, //Target, Spellid
- ACTION_T_RANGED_MOVEMENT = 29, //Distance, Angle
- ACTION_T_RANDOM_PHASE = 30, //PhaseId1, PhaseId2, PhaseId3
- ACTION_T_RANDOM_PHASE_RANGE = 31, //PhaseMin, PhaseMax
- ACTION_T_SUMMON_ID = 32, //CreatureId, Target, SpawnId
- ACTION_T_KILLED_MONSTER = 33, //CreatureId, Target
- ACTION_T_SET_INST_DATA = 34, //Field, Data
- ACTION_T_SET_INST_DATA64 = 35, //Field, Target
- ACTION_T_UPDATE_TEMPLATE = 36, //Entry, Team
- ACTION_T_DIE = 37, //No Params
- ACTION_T_ZONE_COMBAT_PULSE = 38, //No Params
-
- ACTION_T_SET_ACTIVE = 101, //Apply
- ACTION_T_SET_AGGRESSIVE = 102, //Apply
- ACTION_T_ATTACK_START_PULSE = 103, //Distance
-
- ACTION_T_END,
-};
-
-enum Target
-{
- //Self (m_creature)
- TARGET_T_SELF = 0, //Self cast
-
- //Hostile targets (if pet then returns pet owner)
- TARGET_T_HOSTILE, //Our current target (ie: highest aggro)
- TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
- TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
- TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list
- TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat
-
- //Invoker targets (if pet then returns pet owner)
- TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF)
-
- //Hostile targets (including pets)
- TARGET_T_HOSTILE_WPET, //Current target (can be a pet)
- TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
- TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
- TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list
- TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat
-
- TARGET_T_ACTION_INVOKER_WPET,
-
- TARGET_T_END
-};
-
-enum CastFlags
-{
- CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
- CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
- CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
- CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
- CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
- CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
-};
-
-enum EventFlags
-{
- EFLAG_REPEATABLE = 0x01, //Event repeats
- EFLAG_NORMAL = 0x02, //Event only occurs in Normal instance difficulty
- EFLAG_HEROIC = 0x04, //Event only occurs in Heroic instance difficulty
- EFLAG_RESERVED_3 = 0x08,
- EFLAG_RESERVED_4 = 0x10,
- EFLAG_RESERVED_5 = 0x20,
- EFLAG_RESERVED_6 = 0x40,
- EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build of SD2 only
-};
-
-struct EventAI_Event
-{
- uint32 event_id;
-
- uint32 creature_id;
-
- uint16 event_type;
- uint32 event_inverse_phase_mask;
- uint8 event_chance;
- uint8 event_flags;
- union
- {
- uint32 event_param1;
- int32 event_param1_s;
- };
- union
- {
- uint32 event_param2;
- int32 event_param2_s;
- };
- union
- {
- uint32 event_param3;
- int32 event_param3_s;
- };
- union
- {
- uint32 event_param4;
- int32 event_param4_s;
- };
-
- struct _action
- {
- uint16 type;
- union
- {
- uint32 param1;
- int32 param1_s;
- };
- union
- {
- uint32 param2;
- int32 param2_s;
- };
- union
- {
- uint32 param3;
- int32 param3_s;
- };
- }action[MAX_ACTIONS];
-};
-
-//Event_Map
-extern UNORDERED_MAP<uint32, std::vector<EventAI_Event> > EventAI_Event_Map;
-
-struct EventAI_Summon
-{
- uint32 id;
-
- float position_x;
- float position_y;
- float position_z;
- float orientation;
- uint32 SpawnTimeSecs;
-};
-
-//EventSummon_Map
-extern UNORDERED_MAP<uint32, EventAI_Summon> EventAI_Summon_Map;
-
-//EventAI Error handling
-extern uint32 EAI_ErrorLevel;
-/*
-
-struct EventAI_CreatureError
-{
- bool ListEmpty;
- bool NoInstance;
-};
-
-//Error prevention list
-extern UNORDERED_MAP<uint32, EventAI_CreatureError> EventAI_CreatureErrorPreventionList;
-
-//Defines
-#define EVENTAI_EMPTY_EVENTLIST "SD2: Eventlist for Creature %i is empty but creature is using Mob_EventAI. Preventing EventAI on this creature."
-*/
#endif
diff --git a/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp b/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp
new file mode 100644
index 00000000000..3e58efa345b
--- /dev/null
+++ b/src/bindings/scripts/scripts/custom/npc_acherus_taxi.cpp
@@ -0,0 +1,39 @@
+#include "precompiled.h"
+#include "WorldPacket.h"
+
+#define GOSSIP_FLIGHT "I need a ride"
+
+bool GossipHello_npc_acherus_taxi(Player *player, Creature *_Creature)
+{
+player->SetTaxiCheater(true);
+
+player->ADD_GOSSIP_ITEM(0, GOSSIP_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+ player->SEND_GOSSIP_MENU(9978,_Creature->GetGUID());
+ return true;
+}
+
+bool GossipSelect_npc_acherus_taxi(Player *player, Creature *_Creature, uint32 sender, uint32 action )
+{
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ if (player->GetPositionZ() >=316)
+ {
+ player->GetSession()->SendDoFlight(24446, 1053);
+ }else{
+ player->GetSession()->SendDoFlight(24446, 1054);
+ }
+
+ }
+ return true;
+}
+
+void AddSC_npc_acherus_taxi()
+{
+ Script *newscript;
+
+newscript = new Script;
+newscript->Name="npc_acherus_taxi";
+newscript->pGossipHello = &GossipHello_npc_acherus_taxi;
+newscript->pGossipSelect = &GossipSelect_npc_acherus_taxi;
+newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp b/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp
new file mode 100644
index 00000000000..2e9ab3f412d
--- /dev/null
+++ b/src/bindings/scripts/scripts/custom/npc_wyrmresttempel_taxi.cpp
@@ -0,0 +1,116 @@
+#include "precompiled.h"
+#include "WorldPacket.h"
+
+#define GOSSIP_UP "My Lord, I must go to the upper floor of the temple."
+#define GOSSIP_DOWN "I would like to take a flight to the ground, Lord Afrasastrasz."
+#define GOSSIP_MIDDLE "Can you spare a drake to travel to Lord Afrasastrasz, in the middle of the temple?"
+#define GOSSIP_TOP "Please, Let me take one of these dragons to the top floor of the temple."
+#define GOSSIP_BOTTOM "Yes, Please. I would like to return to the ground floor of the temple."
+#define GOSSIP_ONEDOWN "I would like to see Lord Afrasastrasz, in the middle of the temple."
+
+bool GossipHello_npc_wyrmresttempel_middle_taxi(Player *player, Creature *_Creature)
+{
+player->SetTaxiCheater(true);
+
+player->ADD_GOSSIP_ITEM(0, GOSSIP_UP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
+player->ADD_GOSSIP_ITEM(0, GOSSIP_DOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+ player->SEND_GOSSIP_MENU(12887,_Creature->GetGUID());
+
+ return true;
+}
+
+bool GossipSelect_npc_wyrmresttempel_middle_taxi(Player *player, Creature *_Creature, uint32 sender, uint32 action )
+{
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ player->GetSession()->SendDoFlight(6376, 881);
+ }
+
+
+ if (action == GOSSIP_ACTION_INFO_DEF + 2)
+ {
+ player->GetSession()->SendDoFlight(6376, 882);
+
+ }
+return true;
+}
+
+bool GossipHello_npc_wyrmresttempel_bottom_taxi(Player *player, Creature *_Creature)
+{
+player->SetTaxiCheater(true);
+
+player->ADD_GOSSIP_ITEM(0, GOSSIP_TOP, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4);
+player->ADD_GOSSIP_ITEM(0, GOSSIP_MIDDLE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
+ player->SEND_GOSSIP_MENU(12713,_Creature->GetGUID());
+
+ return true;
+}
+
+
+
+bool GossipSelect_npc_wyrmresttempel_bottom_taxi(Player *player, Creature *_Creature, uint32 sender, uint32 action )
+{
+ if (action == GOSSIP_ACTION_INFO_DEF + 4)
+ {
+ player->GetSession()->SendDoFlight(6376, 878);
+ }
+
+
+ if (action == GOSSIP_ACTION_INFO_DEF + 3)
+ {
+ player->GetSession()->SendDoFlight(6376, 883);
+
+ }
+return true;
+}
+
+bool GossipHello_npc_wyrmresttempel_top_taxi(Player *player, Creature *_Creature)
+{
+player->SetTaxiCheater(true);
+
+player->ADD_GOSSIP_ITEM(0, GOSSIP_BOTTOM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5);
+player->ADD_GOSSIP_ITEM(0, GOSSIP_ONEDOWN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6);
+ player->SEND_GOSSIP_MENU(12714,_Creature->GetGUID());
+
+ return true;
+}
+
+bool GossipSelect_npc_wyrmresttempel_top_taxi(Player *player, Creature *_Creature, uint32 sender, uint32 action )
+{
+ if (action == GOSSIP_ACTION_INFO_DEF + 5)
+ {
+ player->GetSession()->SendDoFlight(6376, 879);
+ }
+
+ if (action == GOSSIP_ACTION_INFO_DEF + 6)
+
+ {
+ player->GetSession()->SendDoFlight(6376, 880);
+
+ }
+return true;
+}
+
+void AddSC_npc_wyrmresttempel_taxi()
+{
+ Script *newscript;
+
+newscript = new Script;
+newscript->Name="npc_wyrmresttempelmiddle_taxi";
+newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_middle_taxi;
+newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_middle_taxi;
+newscript->RegisterSelf();
+
+newscript = new Script;
+newscript->Name="npc_wyrmresttempelbottom_taxi";
+newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_bottom_taxi;
+newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_bottom_taxi;
+newscript->RegisterSelf();
+
+newscript = new Script;
+newscript->Name="npc_wyrmresttempeltop_taxi";
+newscript->pGossipHello = &GossipHello_npc_wyrmresttempel_top_taxi;
+newscript->pGossipSelect = &GossipSelect_npc_wyrmresttempel_top_taxi;
+newscript->RegisterSelf();
+
+}
diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
index 34179378b06..1b047c624cd 100644
--- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
+++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
@@ -116,16 +116,23 @@ void npc_escortAI::UpdateAI(const uint32 diff)
//Correct movement speed
if (Run)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- else m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ else
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
//Continue with waypoints
if( !IsOnHold )
{
- m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z );
- debug_log("SD2: EscortAI Reconnect WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- WaitTimer = 0;
- ReconnectWP = false;
- return;
+ if (CurrentWP != WaypointList.end())
+ {
+ m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z );
+ debug_log("TSCR: EscortAI Reconnect WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+
+ WaitTimer = 0;
+ ReconnectWP = false;
+ return;
+ }
+ else
+ debug_log("TSCR: EscortAI Reconnected to end of WP list");
}
}
@@ -274,11 +281,13 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait
void npc_escortAI::FillPointMovementListForCreature()
{
- std::list<PointMovement>::iterator itr;
+ UNORDERED_MAP<uint32, std::vector<PointMovement> >::iterator pPointsEntries = PointMovementMap.find(m_creature->GetEntry());
- for (itr = PointMovementList.begin(); itr != PointMovementList.end(); ++itr)
+ if (pPointsEntries != PointMovementMap.end())
{
- if (itr->m_uiCreatureEntry == m_creature->GetEntry())
+ std::vector<PointMovement>::iterator itr;
+
+ for (itr = pPointsEntries->second.begin(); itr != pPointsEntries->second.end(); ++itr)
{
Escort_Waypoint pPoint(itr->m_uiPointId,itr->m_fX,itr->m_fY,itr->m_fZ,itr->m_uiWaitTime);
WaypointList.push_back(pPoint);
diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.h b/src/bindings/scripts/scripts/npc/npc_escortAI.h
index 8e88f61b37b..503ff614171 100644
--- a/src/bindings/scripts/scripts/npc/npc_escortAI.h
+++ b/src/bindings/scripts/scripts/npc/npc_escortAI.h
@@ -7,6 +7,8 @@
#define DEFAULT_MAX_PLAYER_DISTANCE 50
+extern UNORDERED_MAP<uint32, std::vector<PointMovement> > PointMovementMap;
+
struct Escort_Waypoint
{
Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w)
@@ -68,6 +70,7 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
void SetCanMelee(bool usemelee) { CanMelee = usemelee; }
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
+ bool GetAttack() { return Attack; }//used in EnterEvadeMode override
// EscortAI variables
protected:
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index a9f20422223..49bc64e9021 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -365,7 +365,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
{
if (Doctorguid)
{
- if (Creature* Doctor = ((Creature*)Unit::GetUnit((*m_creature), Doctorguid)))
+ if(Creature* Doctor = Unit::GetCreature(*m_creature, Doctorguid))
((npc_doctorAI*)Doctor->AI())->PatientSaved(m_creature, ((Player*)caster), Coord);
}
}
@@ -423,7 +423,7 @@ struct TRINITY_DLL_DECL npc_injured_patientAI : public ScriptedAI
if (Doctorguid)
{
- if (Creature* Doctor = ((Creature*)Unit::GetUnit((*m_creature), Doctorguid)))
+ if(Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid))
((npc_doctorAI*)Doctor->AI())->PatientDied(Coord);
}
}
@@ -466,7 +466,7 @@ void npc_doctorAI::BeginEvent(Player* player)
void npc_doctorAI::PatientDied(Location* Point)
{
- Player* player = ((Player*)Unit::GetUnit((*m_creature), Playerguid));
+ Player* player = Unit::GetPlayer(Playerguid);
if(player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)))
{
PatientDiedCount++;
@@ -500,7 +500,7 @@ void npc_doctorAI::PatientSaved(Creature* soldier, Player* player, Location* Poi
std::list<uint64>::iterator itr;
for(itr = Patients.begin(); itr != Patients.end(); ++itr)
{
- if (Creature* Patient = ((Creature*)Unit::GetUnit((*m_creature), *itr)))
+ if(Creature* Patient = Unit::GetCreature((*m_creature), *itr))
Patient->setDeathState(JUST_DIED);
}
}
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp
deleted file mode 100644
index 14480a8b725..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_amanitar.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_amanitar
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Ahn'kahet
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_ahnkahet.h"
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp
deleted file mode 100644
index 6ae0e551b6f..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_elder_nadox.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_elder_nadox
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Ahn'kahet
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_ahnkahet.h"
-
-#define SPELL_BROOD_PLAGUE 56130
-#define H_SPELL_BROOD_PLAGUE 59467
-#define SPELL_BROOD_RAGE 59465
-
-#define MOB_AHNKAHAR_SWARMER 30178
-#define SPELL_SUMMON_SWARMERS 56119//2x 30178
-
-#define MOB_AHNKAHAR_SWARMER 30178
-#define SPELL_SUMMON_SWARM_GUARD 56120//1x 30176
-#define SPELL_DEADLY_POISON 56145// Proc trigger
-#define H_SPELL_DEADLY_POISON 59479// Proc trigger
-#define SPELL_GUARDIAN_AURA 56151
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp
deleted file mode 100644
index 389e828c881..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_herald_volazj.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_herald_volazj
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Ahn'kahet
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_ahnkahet.h"
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp
deleted file mode 100644
index efcd811641f..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_jedoga_shadowseeker.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_jedoga_shadowseeker
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Ahn'kahet
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_ahnkahet.h"
-
-#define SPELL_CYCLONE_STRIKE 56855
-#define H_SPELL_CYCLONE_STRIKE 60030//kein unterschied zu 56855 außer das 60030 1,5sec cast ist
-#define SPELL_LIGHTNING_BOLT 56891
-#define H_SPELL_LIGHTNING_BOLT 60032
-#define SPELL_THUNDERSHOCK 56926//AOE works
-#define H_SPELL_THUNDERSHOCK 60029//AOE works
-
-#define SPELL_GIFT_OF_THE_HERALD 56219//triggert if sucessfull sacreficed
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp
deleted file mode 100644
index c03fe85a7f1..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/boss_prince_taldaram.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_prince_taldaram
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Ahn'kahet
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_ahnkahet.h"
-
-#define SPELL_BLOODTHIRST 55968 //Trigger Spell + add aura
-#define SPELL_CONJURE_FLAME_SPHERE 55931
-
-#define SPELL_FLAME_SPHERE_SUMMON_1 55895// 1x 30106
-#define H_SPELL_FLAME_SPHERE_SUMMON_1 59511// 1x 31686
-#define H_SPELL_FLAME_SPHERE_SUMMON_2 59512// 1x 31687
-#define SPELL_FLAME_SPHERE_SPAWN_EFFEKT 55891
-#define SPELL_FLAME_SPHERE_VISUAL 55928
-#define SPELL_FLAME_SPHERE_PERIODIC 55926
-#define H_SPELL_FLAME_SPHERE_PERIODIC 59508
-#define SPELL_FLAME_SPHERE_DEATH_EFFEKT 55947
-
-#define SPELL_EMBRACE_OF_THE_VAMPYR 55959
-#define H_SPELL_EMBRACE_OF_THE_VAMPYR 59513
-
-#define SPELL_VANISH 55964
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp
deleted file mode 100644
index f9922581733..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_anubarak.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_anubarak
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Azjol Nerub
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_azjol_nerub.h"
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp
deleted file mode 100644
index 72bcb708429..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_hadronox.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_hadronox
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Azjol Nerub
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_azjol_nerub.h"
-
-#define SPELL_WEB_FRONT_DOORS 53177//dummy
-
-#define SPELL_ACID_CLOUD 53400
-#define H_SPELL_ACID_CLOUD 59419
-#define SPELL_LEECH_POISON 53030
-#define H_SPELL_LEECH_POISON 59417
-#define SPELL_LEECH_POISON_DEADTRIGGER 53800//heal 10% heroic und normal
-#define SPELL_PIECE_ARMOR 53418
-#define SPELL_WEB_GRAB 53406
-#define H_SPELL_WEB_GRAB 59420 \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp b/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp
deleted file mode 100644
index 27f4d3070fc..00000000000
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/boss_krikthir_the_gatewatcher.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/* ScriptData
-SDName: boss_krikthir_the_gatewatcher
-SD%Complete: 0
-SDComment: Placeholder
-SDCategory: Azjol Nerub
-EndScriptData */
-
-#include "precompiled.h"
-#include "def_azjol_nerub.h"
-
-#define SPELL_MIND_FLAY 52586
-#define H_SPELL_MIND_FLAY 59367
-#define SPELL_CURSE_OF_FATIGUE 52592
-#define H_SPELL_CURSE_OF_FATIGUE 59368
-#define SPELL_FRENZY 28747
-
-#define MOB_SKITTERING_SWARMER 28735
-#define MOB_SKITTERING_SWARMER_CONTROLLER 32593
-#define SPELL_SUMMON_SKITTERING_SWARMER 52438//AOE Effekt 140
-#define SPELL_SUMMON_SKITTERING_SWARMER 52439//Summon 3x 28735 \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
index 48232d8e9fe..084e958a92a 100644
--- a/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
+++ b/src/bindings/scripts/scripts/zone/arathi_highlands/arathi_highlands.cpp
@@ -54,7 +54,7 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
switch(i)
{
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI
{
if (PlayerGUID && !Completed )
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_SUNKEN_TREASURE);
}
@@ -127,27 +127,7 @@ CreatureAI* GetAI_npc_professor_phizzlethorpeAI(Creature *_Creature)
{
npc_professor_phizzlethorpeAI* professor_phizzlethorpeAI = new npc_professor_phizzlethorpeAI(_Creature);
- professor_phizzlethorpeAI->AddWaypoint(0, -2066.45, -2085.96, 9.08);
- professor_phizzlethorpeAI->AddWaypoint(1, -2077.99, -2105.33, 13.24);
- professor_phizzlethorpeAI->AddWaypoint(2, -2074.60, -2109.67, 14.24);
- professor_phizzlethorpeAI->AddWaypoint(3, -2076.60, -2117.46, 16.67);
- professor_phizzlethorpeAI->AddWaypoint(4, -2073.51, -2123.46, 18.42, 2000);
- professor_phizzlethorpeAI->AddWaypoint(5, -2073.51, -2123.46, 18.42, 4000);
- professor_phizzlethorpeAI->AddWaypoint(6, -2066.60, -2131.85, 21.56);
- professor_phizzlethorpeAI->AddWaypoint(7, -2053.85, -2143.19, 20.31);
- professor_phizzlethorpeAI->AddWaypoint(8, -2043.49, -2153.73, 20.20, 12000);
- professor_phizzlethorpeAI->AddWaypoint(9, -2043.49, -2153.73, 20.20, 14000);
- professor_phizzlethorpeAI->AddWaypoint(10, -2043.49, -2153.73, 20.20, 10000);
- professor_phizzlethorpeAI->AddWaypoint(11, -2043.49, -2153.73, 20.20, 2000);
- professor_phizzlethorpeAI->AddWaypoint(12, -2053.85, -2143.19, 20.31);
- professor_phizzlethorpeAI->AddWaypoint(13, -2066.60, -2131.85, 21.56);
- professor_phizzlethorpeAI->AddWaypoint(14, -2073.51, -2123.46, 18.42);
- professor_phizzlethorpeAI->AddWaypoint(15, -2076.60, -2117.46, 16.67);
- professor_phizzlethorpeAI->AddWaypoint(16, -2074.60, -2109.67, 14.24);
- professor_phizzlethorpeAI->AddWaypoint(17, -2077.99, -2105.33, 13.24);
- professor_phizzlethorpeAI->AddWaypoint(18, -2066.45, -2085.96, 9.08);
- professor_phizzlethorpeAI->AddWaypoint(19, -2066.41, -2086.21, 8.97, 6000);
- professor_phizzlethorpeAI->AddWaypoint(20, -2066.41, -2086.21, 8.97, 2000);
+ professor_phizzlethorpeAI->FillPointMovementListForCreature();
return (CreatureAI*)professor_phizzlethorpeAI;
}
diff --git a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
index 42d219aabcb..fb7b5c30545 100644
--- a/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
+++ b/src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
@@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -113,7 +113,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI
if (PlayerGUID && !Completed)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_TOREK_ASSULT);
}
}
@@ -152,34 +152,12 @@ bool QuestAccept_npc_torek(Player* player, Creature* creature, Quest const* ques
return true;
}
-CreatureAI* GetAI_npc_torek(Creature *_Creature)
+CreatureAI* GetAI_npc_torek(Creature* pCreature)
{
- npc_torekAI* thisAI = new npc_torekAI(_Creature);
-
- thisAI->AddWaypoint(0, 1782.63, -2241.11, 109.73, 5000);
- thisAI->AddWaypoint(1, 1788.88, -2240.17, 111.71);
- thisAI->AddWaypoint(2, 1797.49, -2238.11, 112.31);
- thisAI->AddWaypoint(3, 1803.83, -2232.77, 111.22);
- thisAI->AddWaypoint(4, 1806.65, -2217.83, 107.36);
- thisAI->AddWaypoint(5, 1811.81, -2208.01, 107.45);
- thisAI->AddWaypoint(6, 1820.85, -2190.82, 100.49);
- thisAI->AddWaypoint(7, 1829.60, -2177.49, 96.44);
- thisAI->AddWaypoint(8, 1837.98, -2164.19, 96.71); //prepare
- thisAI->AddWaypoint(9, 1839.99, -2149.29, 96.78);
- thisAI->AddWaypoint(10, 1835.14, -2134.98, 96.80);
- thisAI->AddWaypoint(11, 1823.57, -2118.27, 97.43);
- thisAI->AddWaypoint(12, 1814.99, -2110.35, 98.38);
- thisAI->AddWaypoint(13, 1806.60, -2103.09, 99.19);
- thisAI->AddWaypoint(14, 1798.27, -2095.77, 100.04);
- thisAI->AddWaypoint(15, 1783.59, -2079.92, 100.81);
- thisAI->AddWaypoint(16, 1776.79, -2069.48, 101.77);
- thisAI->AddWaypoint(17, 1776.82, -2054.59, 109.82);
- thisAI->AddWaypoint(18, 1776.88, -2047.56, 109.83);
- thisAI->AddWaypoint(19, 1776.86, -2036.55, 109.83);
- thisAI->AddWaypoint(20, 1776.90, -2024.56, 109.83); //win
- thisAI->AddWaypoint(21, 1776.87, -2028.31, 109.83,60000);//stay
- thisAI->AddWaypoint(22, 1776.90, -2028.30, 109.83);
+ npc_torekAI* thisAI = new npc_torekAI(pCreature);
+ thisAI->FillPointMovementListForCreature();
+
return (CreatureAI*)thisAI;
}
@@ -196,7 +174,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -249,7 +227,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_FREEDOM_TO_RUUL);
}
@@ -275,28 +253,7 @@ CreatureAI* GetAI_npc_ruul_snowhoofAI(Creature *_Creature)
{
npc_ruul_snowhoofAI* ruul_snowhoofAI = new npc_ruul_snowhoofAI(_Creature);
- ruul_snowhoofAI->AddWaypoint(0, 3347.250089, -694.700989, 159.925995);
- ruul_snowhoofAI->AddWaypoint(1, 3341.527039, -694.725891, 161.124542, 4000);
- ruul_snowhoofAI->AddWaypoint(2, 3338.351074, -686.088138, 163.444000);
- ruul_snowhoofAI->AddWaypoint(3, 3352.744873, -677.721741, 162.316269);
- ruul_snowhoofAI->AddWaypoint(4, 3370.291016, -669.366943, 160.751358);
- ruul_snowhoofAI->AddWaypoint(5, 3381.479492, -659.449097, 162.545303);
- ruul_snowhoofAI->AddWaypoint(6, 3389.554199, -648.500000, 163.651825);
- ruul_snowhoofAI->AddWaypoint(7, 3396.645020, -641.508911, 164.216019);
- ruul_snowhoofAI->AddWaypoint(8, 3410.498535, -634.299622, 165.773453);
- ruul_snowhoofAI->AddWaypoint(9, 3418.461426, -631.791992, 166.477615);
- ruul_snowhoofAI->AddWaypoint(10, 3429.500000, -631.588745, 166.921265);
- ruul_snowhoofAI->AddWaypoint(11,3434.950195, -629.245483, 168.333969);
- ruul_snowhoofAI->AddWaypoint(12,3438.927979, -618.503235, 171.503143);
- ruul_snowhoofAI->AddWaypoint(13,3444.217529, -609.293640, 173.077972, 1000); // Ambush 1
- ruul_snowhoofAI->AddWaypoint(14,3460.505127, -593.794189, 174.342255);
- ruul_snowhoofAI->AddWaypoint(15,3480.283203, -578.210327, 176.652313);
- ruul_snowhoofAI->AddWaypoint(16,3492.912842, -562.335449, 181.396301);
- ruul_snowhoofAI->AddWaypoint(17,3495.230957, -550.977600, 184.652267);
- ruul_snowhoofAI->AddWaypoint(18,3496.247070, -529.194214, 188.172028);
- ruul_snowhoofAI->AddWaypoint(19,3497.619385, -510.411499, 188.345322, 1000); // Ambush 2
- ruul_snowhoofAI->AddWaypoint(20,3498.498047, -497.787506, 185.806274);
- ruul_snowhoofAI->AddWaypoint(21,3484.218750, -489.717529, 182.389862, 4000); // End
+ ruul_snowhoofAI->FillPointMovementListForCreature();
return (CreatureAI*)ruul_snowhoofAI;
}
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
index 6b030f53d9a..8e2d4cea736 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp
@@ -255,7 +255,7 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
m_creature->InterruptNonMeleeSpells(true);
m_creature->CastSpell(m_creature,SPELL_ETHEREAL_APPRENTICE,true);
- if( m_creature->GetOwner() )
+ if( m_creature->isPet() )
((Pet*)m_creature)->SetDuration(0);
CanEvade = true;
}else Apprentice_Timer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
index 03605ab4eb7..33a0ec3320f 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
@@ -58,13 +58,13 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance
FelOverseerCount = 0;
for(uint8 i = 0; i < ENCOUNTERS; i++)
- Encounter[i] = false;
+ Encounter[i] = NOT_STARTED;
}
bool IsEncounterInProgress() const
{
for(uint8 i = 0; i < ENCOUNTERS; i++)
- if(Encounter[i]) return true;
+ if(Encounter[i] == IN_PROGRESS) return true;
return false;
}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_amanitar.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_amanitar.cpp
new file mode 100644
index 00000000000..9431880921c
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_amanitar.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Script Data Start
+SDName: boss_amanitar
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment: Only appears in heroic mode
+SDCategory: Ahn'kahet
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_amanitar' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_ahnkahet.h"
+
+#define SPELL_BASH 57094
+#define SPELL_ENTANGLING_ROOTS 57095
+#define SPELL_MINI 57055
+#define SPELL_VENOM_BOLT_VOLLEY 57088
+
+struct TRINITY_DLL_DECL boss_amanitarAI : public ScriptedAI
+{
+ boss_amanitarAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+
+ void Aggro(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) {}
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+ }
+};
+
+CreatureAI* GetAI_boss_amanitar(Creature *_Creature)
+{
+ return new boss_amanitarAI (_Creature);
+}
+
+void AddSC_boss_amanitar()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_amanitar";
+ newscript->GetAI = GetAI_boss_amanitar;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
new file mode 100644
index 00000000000..468aa8e10a7
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_elder_nadox.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_elder_nadox
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment:
+SDCategory: Ahn'kahet
+EndScriptData */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_nadox' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_ahnkahet.h"
+
+#define SPELL_BROOD_PLAGUE 56130
+#define H_SPELL_BROOD_PLAGUE 59467
+#define SPELL_BROOD_RAGE 59465 //--> Heroic -- Enrages a Swarmer, increasing size and damage done.
+
+#define MOB_AHNKAHAR_SWARMER 30178
+#define SPELL_SUMMON_SWARMERS 56119//2x 30178
+
+#define MOB_AHNKAHAR_SWARMER 30178
+#define SPELL_SUMMON_SWARM_GUARD 56120//1x 30176
+#define SPELL_DEADLY_POISON 56145// Proc trigger
+#define H_SPELL_DEADLY_POISON 59479// Proc trigger
+#define SPELL_GUARDIAN_AURA 56151
+
+//randomly summons NPC 30178 and 30176 they can cast Sprint (56354)
+
+//Yell
+#define SAY_AGGRO -1619014
+#define SAY_SLAY_1 -1619015
+#define SAY_SLAY_2 -1619016
+#define SAY_SLAY_3 -1619017
+#define SAY_DEATH -1619018
+#define SAY_EGG_SAC_1 -1619019
+#define SAY_EGG_SAC_2 -1619020
+
+struct TRINITY_DLL_DECL boss_nadoxAI : public ScriptedAI
+{
+ boss_nadoxAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 plague,
+ summon;
+
+ void Reset() {}
+
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+
+ void summon_swarmer(){}
+ void summon_guardian(){}
+};
+
+CreatureAI* GetAI_boss_nadox(Creature *_Creature)
+{
+ return new boss_nadoxAI (_Creature);
+}
+
+void AddSC_boss_nadox()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_nadox";
+ newscript->GetAI = GetAI_boss_nadox;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_herald_volazj.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
new file mode 100644
index 00000000000..8e0b1a4744d
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_herald_volazj.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_herald_volazj
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment:
+SDCategory: Ahn'kahet
+EndScriptData */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_volazj' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_ahnkahet.h"
+
+//Spells
+#define SPELL_INSANITY 57496 //Dummy
+#define INSANITY_VISUAL 57561
+#define SPELL_MIND_FLAY_N 57941
+#define SPELL_MIND_FLAY_H 59974
+#define SPELL_SHADOW_BOLT_VOLLEY_1 57942
+#define SPELL_SHADOW_BOLT_VOLLEY_2 59975
+#define SPELL_SHIVER_N 57949
+#define SPELL_SHIVER_H 59978
+
+//Yell
+#define SAY_AGGRO -1619030
+#define SAY_SLAY_1 -1619031
+#define SAY_SLAY_2 -1619032
+#define SAY_SLAY_3 -1619033
+#define SAY_DEATH_1 -1619034
+#define SAY_DEATH_2 -1619035
+#define SAY_PHASE -1619036
+
+struct TRINITY_DLL_DECL boss_volazjAI : public ScriptedAI
+{
+ boss_volazjAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase =1;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ if(phase == 1)
+ DoScriptText(SAY_DEATH_1, m_creature);
+ else
+ DoScriptText(SAY_DEATH_2, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_volazj(Creature *_Creature)
+{
+ return new boss_volazjAI (_Creature);
+}
+
+void AddSC_boss_volazj()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_volazj";
+ newscript->GetAI = GetAI_boss_volazj;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp
new file mode 100644
index 00000000000..145c017679e
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_jedoga_shadowseeker.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_jedoga_shadowseeker
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment:
+SDCategory: Ahn'kahet
+EndScriptData */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_jedoga' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_ahnkahet.h"
+
+#define SPELL_CYCLONE_STRIKE 56855
+#define H_SPELL_CYCLONE_STRIKE 60030//kein unterschied zu 56855 außer das 60030 1,5sec cast ist
+#define SPELL_LIGHTNING_BOLT 56891
+#define H_SPELL_LIGHTNING_BOLT 60032
+#define SPELL_THUNDERSHOCK 56926//AOE works
+#define H_SPELL_THUNDERSHOCK 60029//AOE works
+#define SPELL_GIFT_OF_THE_HERALD 56219//triggert if sucessfull sacreficed
+
+#define SAY_AGGRO -1619000
+#define SAY_C_SACRIFICE_1 -1619001
+#define SAY_C_SACRIFICE_2 -1619002
+#define SAY_SACRIFICE_1 -1619003
+#define SAY_SACRIFICE_2 -1619004
+#define SAY_SLAY_1 -1619005
+#define SAY_SLAY_2 -1619006
+#define SAY_SLAY_3 -1619007
+#define SAY_DEATH -1619008
+#define SAY_PREACHING_1 -1619009
+#define SAY_PREACHING_2 -1619010
+#define SAY_PREACHING_3 -1619011
+#define SAY_PREACHING_4 -1619012
+#define SAY_PREACHING_5 -1619013
+
+struct TRINITY_DLL_DECL boss_jedogaAI : public ScriptedAI
+{
+ boss_jedogaAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_jedoga(Creature *_Creature)
+{
+ return new boss_jedogaAI (_Creature);
+}
+
+void AddSC_boss_jedoga()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_jedoga";
+ newscript->GetAI = GetAI_boss_jedoga;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
new file mode 100644
index 00000000000..36e68862f0c
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_prince_taldaram
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment:
+SDCategory: Ahn'kahet
+EndScriptData */
+
+#include "precompiled.h"
+#include "def_ahnkahet.h"
+
+#define SPELL_BLOODTHIRST 55968 //Trigger Spell + add aura
+#define SPELL_CONJURE_FLAME_SPHERE 55931
+
+#define SPELL_FLAME_SPHERE_SUMMON_1 55895// 1x 30106
+#define H_SPELL_FLAME_SPHERE_SUMMON_1 59511// 1x 31686
+#define H_SPELL_FLAME_SPHERE_SUMMON_2 59512// 1x 31687
+#define SPELL_FLAME_SPHERE_SPAWN_EFFEKT 55891
+#define SPELL_FLAME_SPHERE_VISUAL 55928
+#define SPELL_FLAME_SPHERE_PERIODIC 55926
+#define H_SPELL_FLAME_SPHERE_PERIODIC 59508
+#define SPELL_FLAME_SPHERE_DEATH_EFFEKT 55947
+
+#define SPELL_EMBRACE_OF_THE_VAMPYR 55959
+#define H_SPELL_EMBRACE_OF_THE_VAMPYR 59513
+
+#define SPELL_VANISH 55964
+
+//Yell
+#define SAY_AGGRO -1619021
+#define SAY_SLAY_1 -1619022
+#define SAY_SLAY_2 -1619023
+#define SAY_SLAY_3 -1619024
+#define SAY_DEATH -1619025
+#define SAY_FEED_1 -1619026
+#define SAY_FEED_2 -1619027
+#define SAY_VANISH_1 -1619028
+#define SAY_VANISH_2 -1619029
+
+struct TRINITY_DLL_DECL boss_taldaramAI : public ScriptedAI
+{
+ boss_taldaramAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_taldaram(Creature *_Creature)
+{
+ return new boss_taldaramAI (_Creature);
+}
+
+void AddSC_boss_taldaram()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_taldaram";
+ newscript->GetAI = GetAI_boss_taldaram;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/def_ahnkahet.h
index 97c0db55d72..97c0db55d72 100644
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/def_ahnkahet.h
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/def_ahnkahet.h
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/instance_ahnkahet.cpp
index 544d504c5ae..41cb91f86b7 100644
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Ahn'kahet/instance_ahnkahet.cpp
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/ahnkahet/instance_ahnkahet.cpp
@@ -19,7 +19,7 @@
/* ScriptData
SDName: Instance_Azjol_Nerub
SD%Complete: 0
-SDComment: Placeholder
+SDComment:
SDCategory: Azjol Nerub
EndScriptData */
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_anubarak.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_anubarak.cpp
new file mode 100644
index 00000000000..c479e17d162
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_anubarak.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_anubarak
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment:
+SDCategory: Azjol Nerub
+EndScriptData */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_anub_arak' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_azjol_nerub.h"
+
+//Spells
+#define SPELL_CARRION_BEETLES 53520
+#define SPELL_LOCUST_SWARM 53467
+#define SPELL_IMPALE 53454
+#define SPELL_POUND 53472
+
+//Yell
+#define SAY_INTRO -1601010
+#define SAY_AGGRO -1601000
+#define SAY_SLAY_1 -1601001
+#define SAY_SLAY_2 -1601002
+#define SAY_SLAY_3 -1601003
+#define SAY_LOCUST_1 -1601005
+#define SAY_LOCUST_2 -1601006
+#define SAY_LOCUST_3 -1601007
+#define SAY_SUBMERGE_1 -1601008
+#define SAY_SUBMERGE_2 -1601009
+#define SAY_DEATH -1601004
+
+struct TRINITY_DLL_DECL boss_anub_arakAI : public ScriptedAI
+{
+ boss_anub_arakAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase =1;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 33)
+ phase = 2;
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 15)
+ phase = 3;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_anub_arak(Creature *_Creature)
+{
+ return new boss_anub_arakAI (_Creature);
+}
+
+void AddSC_boss_anub_arak()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_anub_arak";
+ newscript->GetAI = GetAI_boss_anub_arak;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_hadronox.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_hadronox.cpp
new file mode 100644
index 00000000000..e72ccd6436f
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_hadronox.cpp
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_hadronox
+SD%Complete: 0
+SDComment: Placeholder
+SDCategory: Azjol Nerub
+EndScriptData */
+
+#include "precompiled.h"
+#include "def_azjol_nerub.h"
+
+#define SPELL_WEB_FRONT_DOORS 53177//dummy
+
+#define SPELL_ACID_CLOUD 53400
+#define H_SPELL_ACID_CLOUD 59419
+#define SPELL_LEECH_POISON 53030
+#define H_SPELL_LEECH_POISON 59417
+#define SPELL_LEECH_POISON_DEADTRIGGER 53800//heal 10% heroic und normal
+#define SPELL_PIECE_ARMOR 53418
+#define SPELL_WEB_GRAB 53406
+#define H_SPELL_WEB_GRAB 59420
+
+/* Script Data Start
+SDName: Boss hadronox
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_hadronox' where entry = '';
+*** SQL END ***/
+
+//Spells
+#define SPELL_LEECH_POISON 53030
+#define SPELL_ACID_CLOUD 53400
+#define SPELL_PIERCE_ARMOR 53418 //Source SUN++
+#define SPELL_WEB_GRAB 53406
+
+//Phase 0 => Gauntlet Event described below
+//Phase 1 => Boss Encounter
+
+/*When your group enters the main room (the one after the bridge), you will notice a group of 3 Nerubians.
+When you engage them, 2 more groups like this one spawn behind the first one - it is important to pull the first group back,
+so you don't aggro all 3. Hadronox will be under you, fighting Nerubians.
+
+This is the timed gauntlet - waves of non-elite spiders
+ will spawn from the 3 doors located a little above the main room, and will then head down to fight Hadronox. After clearing the
+ main room, it is recommended to just stay in it, kill the occasional non-elites that will attack you instead of the boss, and wait for
+ Hadronox to make his way to you. When Hadronox enters the main room, she will web the doors, and no more non-elites will spawn.*/
+
+struct TRINITY_DLL_DECL boss_hadronoxAI : public ScriptedAI
+{
+ boss_hadronoxAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase =1;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ //when Hadronox kills any enemy (that includes a party member) she will regain 10% of her HP if the target had Leech Poison on
+ }
+};
+
+CreatureAI* GetAI_boss_hadronox(Creature *_Creature)
+{
+ return new boss_hadronoxAI (_Creature);
+}
+
+void AddSC_boss_hadronox()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_hadronox";
+ newscript->GetAI = GetAI_boss_hadronox;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp
new file mode 100644
index 00000000000..43ae13d0b9d
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/boss_krikthir_the_gatewatcher.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: boss_krikthir_the_gatewatcher
+SDAuthor: LordVanMartin
+SD%Complete: 0
+SDComment: Placeholder
+SDCategory: Azjol Nerub
+EndScriptData */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_krik_thir' where entry = '';
+*** SQL END ***/
+
+#include "precompiled.h"
+#include "def_azjol_nerub.h"
+
+#define SPELL_MIND_FLAY 52586
+#define H_SPELL_MIND_FLAY 59367
+#define SPELL_CURSE_OF_FATIGUE 52592
+#define H_SPELL_CURSE_OF_FATIGUE 59368
+#define SPELL_FRENZY 28747 // maybe 53361
+
+#define MOB_SKITTERING_SWARMER 28735
+#define MOB_SKITTERING_SWARMER_CONTROLLER 32593
+
+#define SPELL_SUMMON_SKITTERING_SWARMER 52438//AOE Effekt 140, maybe 52439
+#define SPELL_SUMMON_SKITTERING_SWARMER 52439//Summon 3x 28735
+
+//Yell
+#define SAY_AGGRO -1601011
+#define SAY_SLAY_1 -1601012
+#define SAY_SLAY_2 -1601013
+#define SAY_SLAY_3 -1601014
+#define SAY_DEATH -1601015
+#define SAY_SEND_GROUP_1 -1601018
+#define SAY_SEND_GROUP_2 -1601019
+#define SAY_SEND_GROUP_3 -1601020
+#define SAY_SWARM_1 -1601016
+#define SAY_SWARM_2 -1601017
+#define SAY_PREFIGHT_1 -1601021
+#define SAY_PREFIGHT_2 -1601022
+#define SAY_PREFIGHT_3 -1601023
+
+struct TRINITY_DLL_DECL boss_krik_thirAI : public ScriptedAI
+{
+ boss_krik_thirAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) >= 10)
+ {
+ //Frenzy
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_krik_thir(Creature *_Creature)
+{
+ return new boss_krik_thirAI (_Creature);
+}
+
+void AddSC_boss_krik_thir()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_krik_thir";
+ newscript->GetAI = GetAI_boss_krik_thir;
+ newscript->RegisterSelf();
+
+}
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/def_azjol_nerub.h
index 9e319e8fde0..9e319e8fde0 100644
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/def_azjol_nerub.h
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/def_azjol_nerub.h
diff --git a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp
index bd3fccd98d9..bd3fccd98d9 100644
--- a/src/bindings/scripts/scripts/zone/Azjol-Nerub/Azjol-Nerub/instance_azjol_nerub.cpp
+++ b/src/bindings/scripts/scripts/zone/azjol_nerub/azjol_nerub/instance_azjol_nerub.cpp
diff --git a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
index 845625a2ac0..d94579361de 100644
--- a/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
+++ b/src/bindings/scripts/scripts/zone/azshara/azshara.cpp
@@ -306,7 +306,7 @@ struct TRINITY_DLL_DECL mob_rizzle_sprysprocketAI : public ScriptedAI
m_creature->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0);
}
//begin swimming and summon depth charges
- Player* player = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Player* player = Unit::GetPlayer(PlayerGUID);
SendText(MSG_ESCAPE_NOTICE, player);
DoCast(m_creature, SPELL_PERIODIC_DEPTH_CHARGE);
m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLYING2 | MOVEMENTFLAG_SWIMMING);
diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
index cd5dffd164c..febf52effd1 100644
--- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
+++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
@@ -125,7 +125,7 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI
{
m_creature->RemoveAurasDueToSpell(SPELL_IRRIDATION);
- if (Player *pPlayer = (Player*)Unit::GetUnit(*m_creature,pCaster))
+ if (Player *pPlayer = Unit::GetPlayer(pCaster))
{
if (pPlayer->GetTypeId() != TYPEID_PLAYER)
return;
@@ -316,7 +316,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -356,7 +356,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_A_CRY_FOR_SAY_HELP);
}
@@ -378,41 +378,11 @@ bool QuestAccept_npc_magwin(Player* player, Creature* creature, Quest const* que
return true;
}
-CreatureAI* GetAI_npc_magwinAI(Creature *_Creature)
+CreatureAI* GetAI_npc_magwinAI(Creature* pCreature)
{
- npc_magwinAI* magwinAI = new npc_magwinAI(_Creature);
-
- magwinAI->AddWaypoint(0, -4784.532227, -11051.060547, 3.484263);
- magwinAI->AddWaypoint(1, -4805.509277, -11037.293945, 3.043942);
- magwinAI->AddWaypoint(2, -4827.826172, -11034.398438, 1.741959);
- magwinAI->AddWaypoint(3, -4852.630859, -11033.695313, 2.208656);
- magwinAI->AddWaypoint(4, -4876.791992, -11034.517578, 3.175228);
- magwinAI->AddWaypoint(5, -4895.486816, -11038.306641, 9.390890);
- magwinAI->AddWaypoint(6, -4915.464844, -11048.402344, 12.369793);
- magwinAI->AddWaypoint(7, -4937.288086, -11067.041992, 13.857983);
- magwinAI->AddWaypoint(8, -4966.577637, -11067.507813, 15.754786);
- magwinAI->AddWaypoint(9, -4993.799805, -11056.544922, 19.175295);
- magwinAI->AddWaypoint(10, -5017.836426, -11052.569336, 22.476587);
- magwinAI->AddWaypoint(11, -5039.706543, -11058.459961, 25.831593);
- magwinAI->AddWaypoint(12, -5057.289063, -11045.474609, 26.972496);
- magwinAI->AddWaypoint(13, -5078.828125, -11037.601563, 29.053417);
- magwinAI->AddWaypoint(14, -5104.158691, -11039.195313, 29.440195);
- magwinAI->AddWaypoint(15, -5120.780273, -11039.518555, 30.142139);
- magwinAI->AddWaypoint(16, -5140.833008, -11039.810547, 28.788074);
- magwinAI->AddWaypoint(17, -5161.201660, -11040.050781, 27.879545, 4000);
- magwinAI->AddWaypoint(18, -5171.842285, -11046.803711, 27.183821);
- magwinAI->AddWaypoint(19, -5185.995117, -11056.359375, 20.234867);
- magwinAI->AddWaypoint(20, -5198.485840, -11065.065430, 18.872593);
- magwinAI->AddWaypoint(21, -5214.062500, -11074.653320, 19.215731);
- magwinAI->AddWaypoint(22, -5220.157227, -11088.377930, 19.818476);
- magwinAI->AddWaypoint(23, -5233.652832, -11098.846680, 18.349432);
- magwinAI->AddWaypoint(24, -5250.163086, -11111.653320, 16.438959);
- magwinAI->AddWaypoint(25, -5268.194336, -11125.639648, 12.668313);
- magwinAI->AddWaypoint(26, -5286.270508, -11130.669922, 6.912246);
- magwinAI->AddWaypoint(27, -5317.449707, -11137.392578, 4.963446);
- magwinAI->AddWaypoint(28, -5334.854492, -11154.384766, 6.742664);
- magwinAI->AddWaypoint(29, -5353.874512, -11171.595703, 6.903912, 20000);
- magwinAI->AddWaypoint(30, -5354.240000, -11171.940000, 6.890000);
+ npc_magwinAI* magwinAI = new npc_magwinAI(pCreature);
+
+ magwinAI->FillPointMovementListForCreature();
return (CreatureAI*)magwinAI;
}
diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
index 878865fec2c..4d8d3b6411b 100644
--- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
+++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
@@ -254,7 +254,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
Player* pWarrior = NULL;
if(PlayerGUID)
- pWarrior = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ pWarrior = Unit::GetPlayer(PlayerGUID);
if(!pWarrior)
return;
@@ -268,7 +268,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
{
if (AffrayChallenger[i])
{
- Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]);
+ Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
if(pCreature) {
if(pCreature->isAlive())
{
@@ -284,7 +284,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
if (BigWill)
{
- Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill);
+ Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
if(pCreature) {
if(pCreature->isAlive()) {
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT);
@@ -329,7 +329,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
{
if (AffrayChallenger[i])
{
- Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[i]);
+ Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[i]);
if((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i])
{
DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, m_creature);
@@ -345,7 +345,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill)
{
DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, m_creature);
- Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), AffrayChallenger[Wave]);
+ Creature* pCreature = Unit::GetCreature((*m_creature), AffrayChallenger[Wave]);
if(pCreature && (pCreature->isAlive()))
{
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -371,7 +371,7 @@ struct TRINITY_DLL_DECL npc_twiggy_flatheadAI : public ScriptedAI
}
else if (Wave >= 6 && EventBigWill && BigWill)
{
- Creature* pCreature = (Creature*)Unit::GetUnit((*m_creature), BigWill);
+ Creature* pCreature = Unit::GetCreature((*m_creature), BigWill);
if (!pCreature || !pCreature->isAlive())
{
DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, m_creature);
@@ -420,7 +420,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(!player)
return;
@@ -468,7 +468,7 @@ struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI
{
if (PlayerGUID && !Completed)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE);
}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/.boss_teron_gorefiend.cpp-woains b/src/bindings/scripts/scripts/zone/black_temple/.boss_teron_gorefiend.cpp-woains
new file mode 100644
index 00000000000..327b670c6d3
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/black_temple/.boss_teron_gorefiend.cpp-woains
@@ -0,0 +1,536 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Boss_Teron_Gorefiend
+SD%Complete: 60
+SDComment: Requires Mind Control support for Ghosts.
+SDCategory: Black Temple
+EndScriptData */
+
+#include "precompiled.h"
+#include "def_black_temple.h"
+
+ //Speech'n'sound
+#define SAY_INTRO -1564037
+#define SAY_AGGRO -1564038
+#define SAY_SLAY1 -1564039
+#define SAY_SLAY2 -1564040
+#define SAY_SPELL1 -1564041
+#define SAY_SPELL2 -1564042
+#define SAY_SPECIAL1 -1564043
+#define SAY_SPECIAL2 -1564044
+#define SAY_ENRAGE -1564045
+#define SAY_DEATH -1564046
+
+//Spells
+#define SPELL_INCINERATE 40239
+#define SPELL_CRUSHING_SHADOWS 40243
+#define SPELL_SHADOWBOLT 40185
+#define SPELL_PASSIVE_SHADOWFORM 40326
+#define SPELL_SHADOW_OF_DEATH 40251
+#define SPELL_BERSERK 45078
+
+#define SPELL_ATROPHY 40327 // Shadowy Constructs use this when they get within melee range of a player
+
+#define CREATURE_DOOM_BLOSSOM 23123
+#define CREATURE_SHADOWY_CONSTRUCT 23111
+
+struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI
+{
+ mob_doom_blossomAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 CheckTeronTimer;
+ uint32 ShadowBoltTimer;
+ uint64 TeronGUID;
+
+ void Reset()
+ {
+ CheckTeronTimer = 5000;
+ ShadowBoltTimer = 12000;
+ TeronGUID = 0;
+ }
+
+ void Aggro(Unit *who) { }
+ void AttackStart(Unit* who) { }
+ void MoveInLineOfSight(Unit* who) { }
+
+ void Despawn()
+ {
+ m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ m_creature->RemoveCorpse();
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(CheckTeronTimer < diff)
+ {
+ if(TeronGUID)
+ {
+ DoZoneInCombat();
+
+ Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID));
+ if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode()))
+ Despawn();
+ }
+ else
+ Despawn();
+
+ CheckTeronTimer = 5000;
+ }else CheckTeronTimer -= diff;
+
+ if(ShadowBoltTimer < diff && InCombat)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_SHADOWBOLT);
+ ShadowBoltTimer = 10000;
+ }else ShadowBoltTimer -= diff;
+ return;
+ }
+
+ void SetTeronGUID(uint64 guid){ TeronGUID = guid; }
+};
+
+//This is used to sort the players by distance for Constructs to see who to cast Atrophy on
+struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit, bool>
+{
+ const Unit* MainTarget;
+ TargetDistanceOrder(const Unit* Target) : MainTarget(Target) {};
+ // functor for operator "<"
+ bool operator()(const Unit* _Left, const Unit* _Right) const
+ {
+ return (MainTarget->GetDistance(_Left) < MainTarget->GetDistance(_Right));
+ }
+};
+
+struct TRINITY_DLL_DECL 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 Aggro(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<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
+ if(m_threatlist.empty())
+ return; // No threat list. Don't continue.
+ std::list<HostilReference*>::iterator itr = m_threatlist.begin();
+ std::list<Unit*> targets;
+ for( ; itr != m_threatlist.end(); ++itr)
+ {
+ Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
+ if(pUnit && pUnit->isAlive())
+ targets.push_back(pUnit);
+ }
+ targets.sort(TargetDistanceOrder(m_creature));
+ Unit* target = targets.front();
+ if(target && m_creature->IsWithinDistInMap(target, m_creature->GetAttackDistance(target)))
+ {
+ DoCast(target, SPELL_ATROPHY);
+ m_creature->AI()->AttackStart(target);
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(CheckPlayerTimer < diff)
+ {
+ CheckPlayers();
+ CheckPlayerTimer = 3000;
+ }else CheckPlayerTimer -= diff;
+
+ if(CheckTeronTimer < diff)
+ {
+ Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID));
+ if(!Teron || !Teron->isAlive() || Teron->IsInEvadeMode())
+ m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+
+ CheckTeronTimer = 5000;
+ }else CheckTeronTimer -= diff;
+ }
+};
+
+struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
+{
+ boss_teron_gorefiendAI(Creature *c) : ScriptedAI(c)
+ {
+ pInstance = ((ScriptedInstance*)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;
+
+ void Reset()
+ {
+ if(pInstance)
+ pInstance->SetData(DATA_TERONGOREFIENDEVENT, NOT_STARTED);
+
+ IncinerateTimer = 20000 + rand()%11000;
+ SummonDoomBlossomTimer = 12000;
+ EnrageTimer = 600000;
+ CrushingShadowsTimer = 22000;
+ SummonShadowsTimer = 60000;
+ RandomYellTimer = 50000;
+
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ // Start off unattackable so that the intro is done properly
+ m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+
+ AggroTimer = 20000;
+ AggroTargetGUID = 0;
+ Intro = false;
+ }
+
+ void Aggro(Unit *who) {}
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if(!who || (!who->isAlive())) return;
+
+ if(who->isTargetableForAttack() && who->isInAccessiblePlaceFor(m_creature) && m_creature->IsHostileTo(who))
+ {
+ float attackRadius = m_creature->GetAttackDistance(who);
+
+ if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && m_creature->IsWithinLOSInMap(who))
+ {
+ //if(who->HasStealthAura())
+ // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
+
+ m_creature->AddThreat(who, 1.0f);
+ }
+
+ if(!InCombat && !Intro && m_creature->IsWithinDistInMap(who, 60.0f) && (who->GetTypeId() == TYPEID_PLAYER))
+ {
+ if(pInstance)
+ pInstance->SetData(DATA_TERONGOREFIENDEVENT, IN_PROGRESS);
+
+ m_creature->GetMotionMaster()->Clear(false);
+ m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ DoScriptText(SAY_INTRO, m_creature);
+ m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_TALK);
+ AggroTargetGUID = who->GetGUID();
+ Intro = true;
+ }
+ }
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_SLAY1, m_creature); break;
+ case 1: DoScriptText(SAY_SLAY2, m_creature); break;
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance)
+ pInstance->SetData(DATA_TERONGOREFIENDEVENT, DONE);
+
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+
+ float CalculateRandomLocation(float Loc, uint32 radius)
+ {
+ float coord = Loc;
+ switch(rand()%2)
+ {
+ case 0:
+ coord += rand()%radius;
+ break;
+ case 1:
+ coord -= rand()%radius;
+ break;
+ }
+ return coord;
+ }
+
+ void SetThreatList(Creature* Blossom)
+ {
+ if(!Blossom) return;
+
+ std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
+ std::list<HostilReference*>::iterator i = m_threatlist.begin();
+ for(i = m_threatlist.begin(); i != m_threatlist.end(); i++)
+ {
+ Unit* pUnit = Unit::GetUnit((*m_creature), (*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((*m_creature), GhostGUID);
+ if(Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH, 0))
+ {
+ /*float x,y,z;
+ Ghost->GetPosition(x,y,z);
+ Creature* control = m_creature->SummonCreature(CREATURE_GHOST, x, y, z, 0, TEMPSUMMON_TIMED_DESAWN, 30000);
+ if(control)
+ {
+ ((Player*)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 = m_creature->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.
+ ((mob_shadowy_constructAI*)Construct->AI())->GhostGUID = GhostGUID;
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
+ if(!target) // someone's trying to solo.
+ target = m_creature->getVictim();
+
+ if(target)
+ Construct->GetMotionMaster()->MoveChase(target);
+ }
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(Intro)
+ {
+ if(AggroTimer < diff)
+ {
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ DoScriptText(SAY_AGGRO, m_creature);
+ m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
+ Intro = false;
+ if(AggroTargetGUID)
+ {
+ Unit* pUnit = Unit::GetUnit((*m_creature), AggroTargetGUID);
+ if(pUnit)
+ AttackStart(pUnit);
+
+ DoZoneInCombat();
+ }else EnterEvadeMode();
+
+ }else AggroTimer -= diff;
+ }
+
+ if(!UpdateVictim() || Intro)
+ return;
+
+ if(SummonShadowsTimer < diff)
+ {
+ //MindControlGhost();
+
+ for(uint8 i = 0; i < 2; ++i)
+ {
+ Creature* Shadow = NULL;
+ float X = CalculateRandomLocation(m_creature->GetPositionX(), 10);
+ Shadow = m_creature->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
+ if(Shadow)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
+ if(!target)
+ target = m_creature->getVictim();
+
+ if(target)
+ Shadow->AI()->AttackStart(target);
+ }
+ }
+ SummonShadowsTimer = 60000;
+ }else SummonShadowsTimer -= diff;
+
+ if(SummonDoomBlossomTimer < diff)
+ {
+ if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
+ {
+ float X = CalculateRandomLocation(target->GetPositionX(), 20);
+ float Y = CalculateRandomLocation(target->GetPositionY(), 20);
+ float Z = target->GetPositionZ();
+ Z = m_creature->GetMap()->GetVmapHeight(X, Y, Z, true);
+ Creature* DoomBlossom = m_creature->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(m_creature->getFaction());
+ DoomBlossom->AddThreat(target, 1.0f);
+ ((mob_doom_blossomAI*)DoomBlossom->AI())->SetTeronGUID(m_creature->GetGUID());
+ ((mob_doom_blossomAI*)DoomBlossom->AI())->InCombat = true;
+ SetThreatList(DoomBlossom);
+ SummonDoomBlossomTimer = 35000;
+ }
+ }
+ }else SummonDoomBlossomTimer -= diff;
+
+ if(IncinerateTimer < diff)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
+ if(!target)
+ target = m_creature->getVictim();
+
+ if(target)
+ {
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_SPECIAL1, m_creature); break;
+ case 1: DoScriptText(SAY_SPECIAL2, m_creature); break;
+ }
+ DoCast(target, SPELL_INCINERATE);
+ IncinerateTimer = 20000 + rand()%31 * 1000;
+ }
+ }else IncinerateTimer -= diff;
+
+ if(CrushingShadowsTimer < diff)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
+ if(target && target->isAlive())
+ DoCast(target, 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* target = SelectUnit(SELECT_TARGET_RANDOM, 1);
+
+ if(!target)
+ target = m_creature->getVictim();
+
+ if(target && target->isAlive() && target->GetTypeId() == TYPEID_PLAYER)
+ {
+ DoCast(target, SPELL_SHADOW_OF_DEATH);
+ GhostGUID = target->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)
+ {
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_SPELL1, m_creature); break;
+ case 1: DoScriptText(SAY_SPELL2, m_creature); break;
+ }
+ RandomYellTimer = 50000 + rand()%51 * 1000;
+ }else RandomYellTimer -= diff;
+
+ if(!m_creature->HasAura(SPELL_BERSERK, 0))
+ {
+ if(EnrageTimer < diff)
+ {
+ DoCast(m_creature, SPELL_BERSERK);
+ DoScriptText(SAY_ENRAGE, m_creature);
+ }else EnrageTimer -= diff;
+ }
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_doom_blossom(Creature *_Creature)
+{
+ return new mob_doom_blossomAI(_Creature);
+}
+
+CreatureAI* GetAI_mob_shadowy_construct(Creature *_Creature)
+{
+ return new mob_shadowy_constructAI(_Creature);
+}
+
+CreatureAI* GetAI_boss_teron_gorefiend(Creature *_Creature)
+{
+ return new boss_teron_gorefiendAI (_Creature);
+}
+
+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();
+}
+
diff --git a/src/bindings/scripts/scripts/zone/black_temple/.instance_black_temple.cpp-s8inyu b/src/bindings/scripts/scripts/zone/black_temple/.instance_black_temple.cpp-s8inyu
new file mode 100644
index 00000000000..43646746505
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/black_temple/.instance_black_temple.cpp-s8inyu
@@ -0,0 +1,347 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+/* ScriptData
+SDName: Instance_Black_Temple
+SD%Complete: 100
+SDComment: Instance Data Scripts and functions to acquire mobs and set encounter status for use in various Black Temple Scripts
+SDCategory: Black Temple
+EndScriptData */
+
+#include "precompiled.h"
+#include "def_black_temple.h"
+
+#define ENCOUNTERS 9
+
+/* Black Temple encounters:
+0 - High Warlord Naj'entus event
+1 - Supremus Event
+2 - Shade of Akama Event
+3 - Teron Gorefiend Event
+4 - Gurtogg Bloodboil Event
+5 - Reliquary Of Souls Event
+6 - Mother Shahraz Event
+7 - Illidari Council Event
+8 - Illidan Stormrage Event
+*/
+
+struct TRINITY_DLL_DECL instance_black_temple : public ScriptedInstance
+{
+ instance_black_temple(Map *map) : ScriptedInstance(map) {Initialize();};
+
+ uint32 Encounters[ENCOUNTERS];
+ 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()
+ {
+ 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;
+
+ for(uint8 i = 0; i < ENCOUNTERS; ++i)
+ Encounters[i] = NOT_STARTED;
+ }
+
+ bool IsEncounterInProgress() const
+ {
+ for(uint8 i = 0; i < ENCOUNTERS; ++i)
+ if(Encounters[i] == IN_PROGRESS) return true;
+
+ return false;
+ }
+
+ Player* GetPlayerInMap()
+ {
+ Map::PlayerList const& players = instance->GetPlayers();
+
+ if (!players.isEmpty())
+ {
+ for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ {
+ if (Player* plr = itr->getSource())
+ return plr;
+ }
+ }
+
+ debug_log("TSCR: Instance Black Temple: GetPlayerInMap, but PlayerList is empty!");
+ return NULL;
+ }
+
+ void OnCreatureCreate(Creature *creature, uint32 creature_entry)
+ {
+ switch(creature->GetEntry())
+ {
+ case 22887: Najentus = creature->GetGUID(); break;
+ case 23089: Akama = creature->GetGUID(); break;
+ case 22990: Akama_Shade = creature->GetGUID(); break;
+ case 22841: ShadeOfAkama = creature->GetGUID(); break;
+ case 22898: Supremus = creature->GetGUID(); break;
+ case 22917: IllidanStormrage = creature->GetGUID(); break;
+ case 22949: GathiosTheShatterer = creature->GetGUID(); break;
+ case 22950: HighNethermancerZerevor = creature->GetGUID(); break;
+ case 22951: LadyMalande = creature->GetGUID(); break;
+ case 22952: VerasDarkshadow = creature->GetGUID(); break;
+ case 23426: IllidariCouncil = creature->GetGUID(); break;
+ case 23499: BloodElfCouncilVoice = creature->GetGUID(); break;
+ }
+ }
+
+ void OnObjectCreate(GameObject* go)
+ {
+ switch(go->GetEntry())
+ {
+ case 185483: NajentusGate = go->GetGUID();// Gate past Naj'entus (at the entrance to Supermoose's courtyards)
+ if(Encounters[0] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185882: MainTempleDoors = go->GetGUID();// Main Temple Doors - right past Supermoose (Supremus)
+ if(Encounters[1] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185478: ShadeOfAkamaDoor = go->GetGUID();break;
+ case 185480: CommonDoor = go->GetGUID();
+ if(Encounters[3] == DONE)HandleGameObject(NULL,true,go);;break;
+ case 186153: TeronDoor = go->GetGUID();
+ if(Encounters[3] == DONE)HandleGameObject(NULL,true,go);;break;
+ case 185892: GuurtogDoor = go->GetGUID();
+ if(Encounters[4] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185479: TempleDoor = go->GetGUID();
+ if(Encounters[5] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185482: MotherDoor = go->GetGUID();
+ if(Encounters[6] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185481: CouncilDoor = go->GetGUID();
+ if(Encounters[7] == DONE)HandleGameObject(NULL,true,go);break;
+ case 186152: SimpleDoor = go->GetGUID();
+ if(Encounters[7] == DONE)HandleGameObject(NULL,true,go);break;
+ case 185905: IllidanGate = go->GetGUID(); break; // Gate leading to Temple Summit
+ case 186261: IllidanDoor[0] = go->GetGUID(); break; // Right door at Temple Summit
+ case 186262: IllidanDoor[1] = go->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;
+ }
+
+ return 0;
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ switch(type)
+ {
+ case DATA_HIGHWARLORDNAJENTUSEVENT:
+ if(data == DONE)
+ {
+ HandleGameObject(NajentusGate, true);
+ }
+ Encounters[0] = data;break;
+ case DATA_SUPREMUSEVENT:
+ if(data == DONE)
+ {
+ HandleGameObject(NajentusGate, true);
+ }
+ Encounters[1] = data; break;
+ case DATA_SHADEOFAKAMAEVENT:
+ if(data == IN_PROGRESS)
+ {
+ HandleGameObject(ShadeOfAkamaDoor, false);
+ }else HandleGameObject(ShadeOfAkamaDoor, true);
+ Encounters[2] = data; break;
+ case DATA_TERONGOREFIENDEVENT:
+ if(data == IN_PROGRESS)
+ {
+ HandleGameObject(TeronDoor, false);
+ HandleGameObject(CommonDoor, false);
+ }else
+ {
+ HandleGameObject(TeronDoor, true);
+ HandleGameObject(CommonDoor, true);
+ }
+ Encounters[3] = data; break;
+ case DATA_GURTOGGBLOODBOILEVENT:
+ if(data == DONE)
+ {
+ HandleGameObject(GuurtogDoor, true);
+ }
+ Encounters[4] = data; break;
+ case DATA_RELIQUARYOFSOULSEVENT:
+ if(data == DONE)
+ {
+ HandleGameObject(TempleDoor, true);
+ }
+ Encounters[5] = data; break;
+ case DATA_MOTHERSHAHRAZEVENT:
+ if(data == DONE)
+ {
+ HandleGameObject(MotherDoor, true);
+ }
+ Encounters[6] = data; break;
+ case DATA_ILLIDARICOUNCILEVENT:
+ if(data == IN_PROGRESS)
+ {
+ HandleGameObject(CouncilDoor, false);
+ HandleGameObject(SimpleDoor, false);
+ }else
+ {
+ HandleGameObject(CouncilDoor, true);
+ HandleGameObject(SimpleDoor, true);
+ }
+ Encounters[7] = data; break;
+ case DATA_ILLIDANSTORMRAGEEVENT: Encounters[8] = data; break;
+ }
+
+ if (data == DONE)
+ {
+ OUT_SAVE_INST_DATA;
+
+ std::ostringstream saveStream;
+ saveStream << Encounters[0] << " " << Encounters[1] << " "
+ << Encounters[2] << " " << Encounters[3] << " " << Encounters[4]
+ << " " << Encounters[5] << " " << Encounters[6] << " " << Encounters[7]
+ << " " << Encounters[8];
+
+ str_data = saveStream.str();
+
+ SaveToDB();
+ OUT_SAVE_INST_DATA_COMPLETE;
+ }
+ }
+
+ uint32 GetData(uint32 type)
+ {
+ switch(type)
+ {
+ case DATA_HIGHWARLORDNAJENTUSEVENT: return Encounters[0];
+ case DATA_SUPREMUSEVENT: return Encounters[1];
+ case DATA_SHADEOFAKAMAEVENT: return Encounters[2];
+ case DATA_TERONGOREFIENDEVENT: return Encounters[3];
+ case DATA_GURTOGGBLOODBOILEVENT: return Encounters[4];
+ case DATA_RELIQUARYOFSOULSEVENT: return Encounters[5];
+ case DATA_MOTHERSHAHRAZEVENT: return Encounters[6];
+ case DATA_ILLIDARICOUNCILEVENT: return Encounters[7];
+ case DATA_ILLIDANSTORMRAGEEVENT: return Encounters[8];
+ }
+
+ return 0;
+ }
+
+ const char* Save()
+ {
+ return str_data.c_str();
+ }
+
+ void Load(const char* in)
+ {
+ if (!in)
+ {
+ OUT_LOAD_INST_DATA_FAIL;
+ return;
+ }
+
+ OUT_LOAD_INST_DATA(in);
+
+ std::istringstream loadStream(in);
+ loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2]
+ >> Encounters[3] >> Encounters[4] >> Encounters[5] >> Encounters[6]
+ >> Encounters[7] >> Encounters[8];
+
+ for(uint8 i = 0; i < ENCOUNTERS; ++i)
+ if (Encounters[i] == IN_PROGRESS)
+ Encounters[i] = NOT_STARTED;
+
+ OUT_LOAD_INST_DATA_COMPLETE;
+ }
+};
+
+InstanceData* GetInstanceData_instance_black_temple(Map* map)
+{
+ return new instance_black_temple(map);
+}
+
+void AddSC_instance_black_temple()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_black_temple";
+ newscript->GetInstanceData = &GetInstanceData_instance_black_temple;
+ newscript->RegisterSelf();
+}
+
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 7e656bccee0..6d36e208a70 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -26,7 +26,7 @@ EndScriptData */
#define GETGO(obj, guid) GameObject* obj = GameObject::GetGameObject(*m_creature, guid)
#define GETUNIT(unit, guid) Unit* unit = Unit::GetUnit(*m_creature, guid)
-#define GETCRE(cre, guid) Creature* cre = (Creature*)Unit::GetUnit(*m_creature, guid)
+#define GETCRE(cre, guid) Creature* cre = Unit::GetCreature(*m_creature, guid)
#define HPPCT(unit) unit->GetHealth()*100 / unit->GetMaxHealth()
/************* Quotes and Sounds ***********************/
@@ -522,9 +522,9 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(Conversation[count].creature == ILLIDAN_STORMRAGE)
creature = m_creature;
else if(Conversation[count].creature == AKAMA)
- creature = ((Creature*)Unit::GetUnit((*m_creature), AkamaGUID));
+ creature = (Unit::GetCreature((*m_creature), AkamaGUID));
else if(Conversation[count].creature == MAIEV_SHADOWSONG)
- creature = ((Creature*)Unit::GetUnit((*m_creature), MaievGUID));
+ creature = (Unit::GetCreature((*m_creature), MaievGUID));
if(creature)
{
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
index 37ebaca0b78..851c5f4c243 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_reliquary_of_souls.cpp
@@ -213,7 +213,7 @@ struct TRINITY_DLL_DECL boss_reliquary_of_soulsAI : public ScriptedAI
Creature* Essence;
if(EssenceGUID)
{
- Essence = (Creature*)Unit::GetUnit(*m_creature, EssenceGUID);
+ Essence = Unit::GetCreature(*m_creature, EssenceGUID);
if(!Essence)
{
EnterEvadeMode();
@@ -624,7 +624,7 @@ void npc_enslaved_soulAI::JustDied(Unit *killer)
{
if(ReliquaryGUID)
{
- Creature* Reliquary = ((Creature*)Unit::GetUnit((*m_creature), ReliquaryGUID));
+ Creature* Reliquary = (Unit::GetCreature((*m_creature), ReliquaryGUID));
if(Reliquary)
((boss_reliquary_of_soulsAI*)Reliquary->AI())->SoulDeathCount++;
}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
index f8f742d3a3c..0e4cc9129db 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
@@ -200,7 +200,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
{
for(std::list<uint64>::iterator itr = Sorcerers.begin(); itr != Sorcerers.end(); ++itr)
{
- if(Creature* Sorcerer = ((Creature*)Unit::GetUnit(*m_creature, *itr)))
+ if(Creature* Sorcerer = (Unit::GetCreature(*m_creature, *itr)))
if(Sorcerer->isAlive())
{
Sorcerer->SetVisibility(VISIBILITY_OFF);
@@ -248,7 +248,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
{
Creature* Channeler = NULL;
- Channeler = ((Creature*)Unit::GetUnit(*m_creature, *itr));
+ Channeler = (Unit::GetCreature(*m_creature, *itr));
if (Channeler)
{
@@ -372,7 +372,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
}
for(std::list<uint64>::iterator itr = Channelers.begin(); itr != Channelers.end(); ++itr)
- if(Creature* Channeler = ((Creature*)Unit::GetUnit(*m_creature, *itr)))
+ if(Creature* Channeler = (Unit::GetCreature(*m_creature, *itr)))
Channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
@@ -484,7 +484,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
void mob_ashtongue_channelerAI::JustDied(Unit* killer)
{
- Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID));
+ Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount();
else error_log("SD2 ERROR: Channeler dead but unable to increment DeathCount for Shade of Akama.");
@@ -492,7 +492,7 @@ void mob_ashtongue_channelerAI::JustDied(Unit* killer)
void mob_ashtongue_sorcererAI::JustDied(Unit* killer)
{
- Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID));
+ Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
((boss_shade_of_akamaAI*)Shade->AI())->IncrementDeathCount(m_creature->GetGUID());
else error_log("SD2 ERROR: Sorcerer dead but unable to increment DeathCount for Shade of Akama.");
@@ -561,7 +561,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
if(!ShadeGUID)
return;
- Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID));
+ Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade)
{
pInstance->SetData(DATA_SHADEOFAKAMAEVENT, IN_PROGRESS);
@@ -618,7 +618,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
if(ShadeGUID && !StartCombat)
{
- Creature* Shade = ((Creature*)Unit::GetUnit((*m_creature), ShadeGUID));
+ Creature* Shade = (Unit::GetCreature((*m_creature), ShadeGUID));
if(Shade && Shade->isAlive())
{
if(((boss_shade_of_akamaAI*)Shade->AI())->IsBanished)
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
index 44122355311..0985e7b61e3 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
@@ -268,7 +268,7 @@ struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI
if(CheckTimer < diff)
{
uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS);
- Creature* Supremus = ((Creature*)Unit::GetUnit((*m_creature), SupremusGUID));
+ Creature* Supremus = (Unit::GetCreature((*m_creature), SupremusGUID));
if(!Eruption && !((boss_supremusAI*)Supremus->AI())->Phase1)
{
Eruption = true;
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
index 5e362d29eb8..33a0f20a23e 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
@@ -82,7 +82,7 @@ struct TRINITY_DLL_DECL mob_doom_blossomAI : public ScriptedAI
{
DoZoneInCombat();
- Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID));
+ Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
if((Teron) && (!Teron->isAlive() || Teron->IsInEvadeMode()))
Despawn();
}
@@ -184,7 +184,7 @@ struct TRINITY_DLL_DECL mob_shadowy_constructAI : public ScriptedAI
if(CheckTeronTimer < diff)
{
- Creature* Teron = ((Creature*)Unit::GetUnit((*m_creature), TeronGUID));
+ Creature* Teron = (Unit::GetCreature((*m_creature), TeronGUID));
if(!Teron || !Teron->isAlive() || Teron->IsInEvadeMode())
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
index b605c16394b..9233cc53fca 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
@@ -194,7 +194,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI
bool GOHello_go_najentus_spine(Player *player, GameObject* _GO)
{
if(ScriptedInstance* pInstance = (ScriptedInstance*)_GO->GetInstanceData())
- if(Creature* Najentus = (Creature*)Unit::GetUnit(*_GO, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS)))
+ if(Creature* Najentus = Unit::GetCreature(*_GO, pInstance->GetData64(DATA_HIGHWARLORDNAJENTUS)))
if(((boss_najentusAI*)Najentus->AI())->RemoveImpalingSpine())
{
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
diff --git a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
index ca3a6658f45..3c063ff30c5 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/illidari_council.cpp
@@ -218,7 +218,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
Creature* pMember = NULL;
for(uint8 i = 0; i < 4; ++i)
{
- if(pMember = ((Creature*)Unit::GetUnit((*m_creature), Council[i])))
+ if(pMember = (Unit::GetCreature((*m_creature), Council[i])))
{
if(!pMember->isAlive())
{
@@ -232,7 +232,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
if(pInstance)
{
pInstance->SetData(DATA_ILLIDARICOUNCILEVENT, NOT_STARTED);
- if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
+ if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
VoiceTrigger->AI()->EnterEvadeMode();
}
@@ -259,7 +259,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
Council[3] = pInstance->GetData64(DATA_VERASDARKSHADOW);
// Start the event for the Voice Trigger
- if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
+ if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
{
((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->LoadCouncilGUIDs();
((mob_blood_elf_council_voice_triggerAI*)VoiceTrigger->AI())->EventStarted = true;
@@ -294,7 +294,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
{
if(pInstance)
{
- if(Creature* VoiceTrigger = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_BLOOD_ELF_COUNCIL_VOICE))))
+ if(Creature* VoiceTrigger = (Unit::GetCreature(*m_creature, 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);
}
@@ -302,7 +302,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
return;
}
- Creature* pMember = ((Creature*)Unit::GetUnit(*m_creature, Council[DeathCount]));
+ Creature* pMember = (Unit::GetCreature(*m_creature, Council[DeathCount]));
if(pMember && pMember->isAlive())
pMember->DealDamage(pMember, pMember->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
++DeathCount;
@@ -319,7 +319,7 @@ struct TRINITY_DLL_DECL mob_illidari_councilAI : public ScriptedAI
{
if(Council[i])
{
- if(Creature* Member = ((Creature*)Unit::GetUnit((*m_creature), Council[i])))
+ if(Creature* Member = (Unit::GetCreature((*m_creature), Council[i])))
{
// This is the evade/death check.
if(Member->isAlive() && !Member->getVictim())
@@ -364,7 +364,7 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI
{
if(pInstance)
{
- Creature* Controller = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_ILLIDARICOUNCIL)));
+ Creature* Controller = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ILLIDARICOUNCIL)));
if(Controller)
((mob_illidari_councilAI*)Controller->AI())->StartEvent(who);
}
diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
index 253912ef288..fa1b86da5c8 100644
--- a/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
+++ b/src/bindings/scripts/scripts/zone/blackrock_depths/blackrock_depths.cpp
@@ -216,7 +216,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
if (RingBossGUID)
{
- Creature *boss = (Creature*)Unit::GetUnit(*m_creature,RingBossGUID);
+ Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID);
if (boss && !boss->isAlive() && boss->isDead())
{
RingBossGUID = 0;
@@ -229,7 +229,7 @@ struct TRINITY_DLL_DECL npc_grimstoneAI : public npc_escortAI
for(uint8 i = 0; i < MOB_AMOUNT; i++)
{
- Creature *mob = (Creature*)Unit::GetUnit(*m_creature,RingMobGUID[i]);
+ Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]);
if (mob && !mob->isAlive() && mob->isDead())
{
RingMobGUID[i] = 0;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_epoch.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_epoch.cpp
new file mode 100644
index 00000000000..de2ff9b93fd
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_epoch.cpp
@@ -0,0 +1,86 @@
+/* Script Data Start
+SDName: Boss epoch
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CURSE_OF_EXERTION 52772
+#define SPELL_TIME_WARP 52766 //Time slows down, reducing attack, casting and movement speed by 70% for 6 sec.
+#define SPELL_TIME_STOP 58848 //Stops time in a 50 yard sphere for 2 sec.
+#define SPELL_WOUNDING_STRIKE_N 52771 //Used only on the tank
+#define SPELL_WOUNDING_STRIKE_H 58830
+
+//Say
+#define SAY_INTRO -1595000 //"Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own."
+#define SAY_AGGRO -1595001 //"We'll see about that, young prince."
+#define SAY_TIME_WARP_1 -1595002 //"Tick tock, tick tock..."
+#define SAY_TIME_WARP_2 -1595003 //"Not quick enough!"
+#define SAY_TIME_WARP_3 -1595004 //"Let's get this over with. "
+#define SAY_SLAY_1 -1595005 //"There is no future for you."
+#define SAY_SLAY_2 -1595006 //"This is the hour of our greatest triumph!"
+#define SAY_SLAY_3 -1595007 //"You were destined to fail. "
+#define SAY_DEATH -1595008 //"*gurgles*"
+
+struct TRINITY_DLL_DECL boss_epochAI : public ScriptedAI
+{
+ boss_epochAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+
+ 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, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0:DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1:DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2:DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_epoch(Creature *_Creature)
+{
+ return new boss_epochAI (_Creature);
+}
+
+void AddSC_boss_epoch()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_epoch";
+ newscript->GetAI = GetAI_boss_epoch;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp
new file mode 100644
index 00000000000..12cbb5f27a3
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_mal_ganis.cpp
@@ -0,0 +1,123 @@
+/* Script Data Start
+SDName: Boss mal_ganis
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_mal_ganis' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CARRION_SWARM_N 52720 //A cresting wave of chaotic magic splashes over enemies in front of the caster, dealing 3230 to 3570 Shadow damage and 380 to 420 Shadow damage every 3 sec. for 15 sec.
+#define SPELL_CARRION_SWARM_H 58852
+#define SPELL_MIND_BLAST_N 52722 //Inflicts 4163 to 4837 Shadow damage to an enemy.
+#define SPELL_MIND_BLAST_H 58850
+#define SPELL_SLEEP 52721 //Puts an enemy to sleep for up to 10 sec. Any damage caused will awaken the target.
+#define SPELL_VAMPIRIC_TOUCH 52723 //Heals the caster for half the damage dealt by a melee attack.
+
+//Yell Mal'ganis
+#define SAY_INTRO_1 -1595009
+#define SAY_INTRO_2 -1595010
+#define SAY_OUTRO -1595011
+#define SAY_AGGRO -1595012
+#define SAY_KILL_1 -1595013
+#define SAY_KILL_2 -1595014
+#define SAY_KILL_3 -1595015
+#define SAY_SLAY_1 -1595016
+#define SAY_SLAY_2 -1595017
+#define SAY_SLAY_3 -1595018
+#define SAY_SLAY_4 -1595019
+#define SAY_SLEEP_1 -1595020
+#define SAY_SLEEP_2 -1595021
+#define SAY_30HEALTH -1595022
+#define SAY_15HEALTH -1595023
+#define SAY_ESCAPE_SPEECH_1 -1595024
+#define SAY_ESCAPE_SPEECH_2 -1595025
+
+struct TRINITY_DLL_DECL boss_mal_ganisAI : public ScriptedAI
+{
+ boss_mal_ganisAI(Creature *c) : ScriptedAI(c) {}
+
+ bool yelled,
+ yelled2,
+ yelled3;
+
+ void Reset()
+ {
+ yelled = false;
+ yelled2 = false;
+ yelled3 = false;
+ }
+
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if(!yelled)
+ {
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30)
+ {
+ DoScriptText(SAY_30HEALTH, m_creature);
+ yelled = true;
+ }
+ }
+
+ if(!yelled2)
+ {
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 15)
+ {
+ DoScriptText(SAY_15HEALTH, m_creature);
+ yelled2 = true;
+ }
+ }
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 1)
+ {
+ //Handle Escape Event
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%4)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ case 3: DoScriptText(SAY_SLAY_4, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_mal_ganis(Creature *_Creature)
+{
+ return new boss_mal_ganisAI (_Creature);
+}
+
+void AddSC_boss_mal_ganis()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_mal_ganis";
+ newscript->GetAI = GetAI_boss_mal_ganis;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_meathook.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
new file mode 100644
index 00000000000..187889cb053
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
@@ -0,0 +1,138 @@
+/* Script Data Start
+SDName: Boss meathook
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_meathook' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spell
+#define SPELL_CONSTRICTING_CHAINS_N 52696 //Encases the targets in chains, dealing 1800 Physical damage every 1 sec. and stunning the target for 5 sec.
+#define SPELL_CONSTRICTING_CHAINS_H 58823
+#define SPELL_DISEASE_EXPULSION_N 52666 //Meathook belches out a cloud of disease, dealing 1710 to 1890 Nature damage and interrupting the spell casting of nearby enemy targets for 4 sec.
+#define SPELL_DISEASE_EXPULSION_H 58824
+#define SPELL_FRENZY 58841 //Increases the caster's Physical damage by 10% for 30 sec.
+
+//Yell
+#define SAY_AGGRO -1595026
+#define SAY_SLAY_1 -1595027
+#define SAY_SLAY_2 -1595028
+#define SAY_SLAY_3 -1595029
+#define SAY_SPAWN -1595030
+#define SAY_DEATH -1595031
+
+struct TRINITY_DLL_DECL boss_meathookAI : public ScriptedAI
+{
+ boss_meathookAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 Chain_Timer,
+ Disease_Timer,
+ Frenzy_Timer;
+
+ void Reset()
+ {
+ Chain_Timer = 12000 + rand()%5000; //seen on video 13, 17, 15, 12, 16
+ Disease_Timer = 2000 + rand()%1000; //approx 3s
+ Frenzy_Timer = 20000 + rand()%10000; //made it up
+ }
+
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+
+ void AttackStart(Unit* who) {}
+
+ std::list <Unit*>pList;
+ void MoveInLineOfSight(Unit* who, const uint32 diff)
+ {
+ /*if (m_creature->isHostileTo(who))
+ {
+ pList.append(who);
+ }*/
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if(Disease_Timer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_DISEASE_EXPULSION_N);
+ Disease_Timer = 1500 + rand()%2500;
+ }else Disease_Timer -= diff;
+
+ if(Frenzy_Timer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_FRENZY);
+ Frenzy_Timer = 20000 + rand()%10000;
+ }else Frenzy_Timer -= diff;
+
+ if(Chain_Timer < diff)
+ {
+
+ /*
+ std::list<HostilReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
+ std::list<HostilReference*>::iterator itr;
+
+ int st=0;
+ for(itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr)
+ {
+ //st++;
+ m_creature->getThreatManager().
+ }
+ Unit* targets[st];
+ int st2=0;
+ for(int i=1; i<=st; i++){
+ if(!IsWithinLOSInMap(targets[i])
+ st2++;
+ }
+ Unit* targets_out_of_LOS[st2];*/
+
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_CONSTRICTING_CHAINS_N); //anyone but the tank
+ Chain_Timer = 2000 + rand()%1000;
+ }else Chain_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_meathook(Creature *_Creature)
+{
+ return new boss_meathookAI (_Creature);
+}
+
+void AddSC_boss_meathook()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_meathook";
+ newscript->GetAI = GetAI_boss_meathook;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_salramm.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_salramm.cpp
new file mode 100644
index 00000000000..7226a1304dc
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/boss_salramm.cpp
@@ -0,0 +1,152 @@
+/* Script Data Start
+SDName: Boss salramm
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_salramm' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CURSE_OF_TWISTED_FLESH 58845
+#define SPELL_EXPLODE_GHOUL_N 52480
+#define SPELL_EXPLODE_GHOUL_H 58825
+#define SPELL_SHADOW_BOLT_N 57725
+#define SPELL_SHADOW_BOLT_H 58828
+#define SPELL_STEAL_FLESH 52708
+#define SPELL_SUMMON_GHOULS 52451
+
+//Yell
+#define SAY_AGGRO -1595032
+#define SAY_SPAWN -1595033
+#define SAY_SLAY_1 -1595034
+#define SAY_SLAY_2 -1595035
+#define SAY_SLAY_3 -1595036
+#define SAY_DEATH -1595037
+#define SAY_EXPLODE_GHOUL_1 -1595038
+#define SAY_EXPLODE_GHOUL_2 -1595039
+#define SAY_STEAL_FLESH_1 -1595040
+#define SAY_STEAL_FLESH_2 -1595041
+#define SAY_STEAL_FLESH_3 -1595042
+#define SAY_SUMMON_GHOULS_1 -1595043
+#define SAY_SUMMON_GHOULS_2 -1595044
+
+struct TRINITY_DLL_DECL boss_salrammAI : public ScriptedAI
+{
+ boss_salrammAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 Curse_flesh_Timer,
+ Explode_ghoul_Timer,
+ Shadow_bolt_Timer,
+ Steal_flesh_Timer,
+ Summon_ghouls_Timer;
+
+ void Reset()
+ {
+ Curse_flesh_Timer = 30000; //30s DBM
+ Explode_ghoul_Timer = 25000 + rand()%3000; //approx 6 sec after summon ghouls
+ Shadow_bolt_Timer = 8000 + rand()%4000; // approx 10s
+ Steal_flesh_Timer = 12345;
+ Summon_ghouls_Timer = 19000 + rand()%5000; //on a video approx 24s after aggro
+ }
+
+ void Aggro(Unit* who)
+ {DoScriptText(SAY_AGGRO, m_creature);}
+
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ Unit* random_target = SelectUnit(SELECT_TARGET_RANDOM, 0);
+
+ //Curse of twisted flesh timer
+ if (Curse_flesh_Timer < diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_CURSE_OF_TWISTED_FLESH);
+ Curse_flesh_Timer = 37000;
+ }else Curse_flesh_Timer -= diff;
+
+ //Shadow bolt timer
+ if (Shadow_bolt_Timer < diff)
+ {
+ DoCast(random_target,SPELL_SHADOW_BOLT_N);
+ Shadow_bolt_Timer = 8000 + rand()%4000;
+ }else Shadow_bolt_Timer -= diff;
+
+ //Steal Flesh timer
+ if (Steal_flesh_Timer < diff)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoScriptText(SAY_STEAL_FLESH_1, m_creature);
+ break;
+ case 1:
+ DoScriptText(SAY_STEAL_FLESH_2, m_creature);
+ break;
+ case 2:
+ DoScriptText(SAY_STEAL_FLESH_3, m_creature);
+ break;
+ }
+ DoCast(random_target,SPELL_STEAL_FLESH);
+ Steal_flesh_Timer = 10000;
+ }else Steal_flesh_Timer -= diff;
+
+ //Summon ghouls timer
+ if (Summon_ghouls_Timer < diff)
+ {
+ switch(rand()%2)
+ {
+ case 0:
+ DoScriptText(SAY_SUMMON_GHOULS_1, m_creature);
+ break;
+ case 1:
+ DoScriptText(SAY_SUMMON_GHOULS_2, m_creature);
+ break;
+ }
+ DoCast(random_target,SPELL_SUMMON_GHOULS);
+ Summon_ghouls_Timer = 10000;
+ }else Summon_ghouls_Timer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+
+ void JustDied(Unit* killer)
+ {DoScriptText(SAY_DEATH, m_creature);}
+
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_salramm(Creature *_Creature)
+{
+ return new boss_salrammAI (_Creature);
+}
+
+void AddSC_boss_salramm()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_salramm";
+ newscript->GetAI = GetAI_boss_salramm;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h
new file mode 100644
index 00000000000..849549e8f99
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/def_culling_of_stratholme.h
@@ -0,0 +1,4 @@
+#ifndef DEF_CULLING_OF_STRATHOLME_H
+#define DEF_CULLING_OF_STRATHOLME_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp
new file mode 100644
index 00000000000..936f8365a35
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/culling_of_stratholme/instance_culling_of_stratholme.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_culling_of_stratholme.h"
+
+struct TRINITY_DLL_DECL instance_culling_of_stratholme : public ScriptedInstance
+{
+ instance_culling_of_stratholme(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_culling_of_stratholme(Map* map)
+{
+ return new instance_culling_of_stratholme(map);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
new file mode 100644
index 00000000000..25e22f8f391
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_anetheron.cpp
@@ -0,0 +1,296 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_CARRION_SWARM 31306
+#define SPELL_SLEEP 31298
+#define SPELL_VAMPIRIC_AURA 38196
+#define SPELL_INFERNO 31299
+
+#define SAY_ONDEATH "The clock... is still... ticking."
+#define SOUND_ONDEATH 10982
+
+#define SAY_ONSLAY1 "Your hopes are lost!"
+#define SAY_ONSLAY2 "Scream for me!"
+#define SAY_ONSLAY3 "Pity, no time for a slow death!"
+#define SOUND_ONSLAY1 10981
+#define SOUND_ONSLAY2 11038
+#define SOUND_ONSLAY3 11039
+
+#define SAY_SWARM1 "The swarm is eager to feed!"
+#define SAY_SWARM2 "Pestilence upon you!"
+#define SOUND_SWARM1 10979
+#define SOUND_SWARM2 11037
+
+#define SAY_SLEEP1 "You look tired..."
+#define SAY_SLEEP2 "Sweet dreams..."
+#define SOUND_SLEEP1 10978
+#define SOUND_SLEEP2 11545
+
+#define SAY_INFERNO1 "Let fire rain from above!"
+#define SAY_INFERNO2 "Earth and sky shall burn!"
+#define SOUND_INFERNO1 10980
+#define SOUND_INFERNO2 11036
+
+#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 TRINITY_DLL_DECL boss_anetheronAI : public hyjal_trashAI
+{
+ boss_anetheronAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SLEEP);
+ if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
+ {
+ TempSpell->EffectImplicitTargetA[0] = 1;
+ TempSpell->EffectImplicitTargetB[0] = 0;
+ }
+ }
+
+ uint32 SwarmTimer;
+ uint32 SleepTimer;
+ uint32 AuraTimer;
+ uint32 InfernoTimer;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ SwarmTimer = 45000;
+ SleepTimer = 60000;
+ AuraTimer = 5000;
+ InfernoTimer = 45000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ hyjal_trashAI::JustDied(victim);
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_ANETHERONEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ DoYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 4896.08, -1576.35, 1333.65);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 4898.68, -1615.02, 1329.48);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 4907.12, -1667.08, 1321.00);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 4963.18, -1699.35, 1340.51);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 4989.16, -1716.67, 1335.74);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5026.27, -1736.89, 1323.02);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5037.77, -1770.56, 1324.36);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5067.23, -1789.95, 1321.17);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(SwarmTimer < diff)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,100,true);
+ if(target)
+ DoCast(target,SPELL_CARRION_SWARM);
+
+ SwarmTimer = 45000+rand()%15000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_SWARM1);
+ DoYell(SAY_SWARM1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_SWARM2);
+ DoYell(SAY_SWARM2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else SwarmTimer -= diff;
+
+ if(SleepTimer < diff)
+ {
+ for(uint8 i=0;i<3;++i)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,100,true);
+ if(target)
+ target->CastSpell(target,SPELL_SLEEP,true);
+ }
+ SleepTimer = 60000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_SLEEP1);
+ DoYell(SAY_SLEEP1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_SLEEP2);
+ DoYell(SAY_SLEEP2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else SleepTimer -= diff;
+ if(AuraTimer < diff)
+ {
+ DoCast(m_creature, SPELL_VAMPIRIC_AURA,true);
+ AuraTimer = 10000+rand()%10000;
+ }else AuraTimer -= diff;
+ if(InfernoTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,100,true), SPELL_INFERNO);
+ InfernoTimer = 45000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_INFERNO1);
+ DoYell(SAY_INFERNO1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_INFERNO2);
+ DoYell(SAY_INFERNO2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else InfernoTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_anetheron(Creature *_Creature)
+{
+ return new boss_anetheronAI (_Creature);
+}
+
+#define SPELL_IMMOLATION 31303
+#define SPELL_INFERNO_EFFECT 31302
+
+struct TRINITY_DLL_DECL mob_towering_infernalAI : public ScriptedAI
+{
+ mob_towering_infernalAI(Creature *c) : ScriptedAI(c)
+ {
+ Reset();
+ }
+
+ uint32 ImmolationTimer;
+
+ void Reset()
+ {
+ DoCast(m_creature, SPELL_INFERNO_EFFECT);
+ ImmolationTimer = 5000;
+ }
+
+ void Aggro(Unit *who)
+ {
+
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+
+ }
+
+ void JustDied(Unit *victim)
+ {
+
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (m_creature->GetDistance(who) <= 50 && !InCombat && m_creature->IsHostileTo(who))
+ {
+ m_creature->AddThreat(who,0.0);
+ m_creature->Attack(who,false);
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if (!UpdateVictim())
+ return;
+
+ if(ImmolationTimer < diff)
+ {
+ DoCast(m_creature, SPELL_IMMOLATION);
+ ImmolationTimer = 5000;
+ }else ImmolationTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_towering_infernal(Creature *_Creature)
+{
+ return new mob_towering_infernalAI (_Creature);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
index 5b8617cdf01..b89a614389e 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
@@ -24,6 +24,7 @@ EndScriptData */
#include "precompiled.h"
#include "def_hyjal.h"
#include "SpellAuras.h"
+#include "hyjal_trash.h"
//text id -1534018 are the text used when previous events complete. Not part of this script.
#define SAY_AGGRO -1534019
@@ -201,9 +202,9 @@ struct TargetDistanceOrder : public std::binary_function<const Unit, const Unit,
}
};
-struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
+struct TRINITY_DLL_DECL boss_archimondeAI : public hyjal_trashAI
{
- boss_archimondeAI(Creature *c) : ScriptedAI(c)
+ boss_archimondeAI(Creature *c) : hyjal_trashAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
}
@@ -252,6 +253,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
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;
@@ -309,6 +311,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
void JustDied(Unit *victim)
{
+ hyjal_trashAI::JustDied(victim);
DoScriptText(SAY_DEATH, m_creature);
if (pInstance)
@@ -566,7 +569,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
else
DoScriptText(SAY_AIR_BURST2, m_creature);
- DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_AIR_BURST);
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank
AirBurstTimer = 25000 + rand()%15000;
}else AirBurstTimer -= diff;
@@ -607,6 +610,7 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
DoMeleeAttackIfReady();
}
+ void WaypointReached(uint32 i){}
};
CreatureAI* GetAI_boss_archimonde(Creature *_Creature)
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
new file mode 100644
index 00000000000..85948706145
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_azgalor.cpp
@@ -0,0 +1,271 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_RAIN_OF_FIRE 31340
+#define SPELL_DOOM 31347
+#define SPELL_HOWL_OF_AZGALOR 31344
+#define SPELL_CLEAVE 31345
+#define SPELL_BERSERK 26662
+
+#define SAY_ONDEATH "Your time is almost... up"
+#define SOUND_ONDEATH 11002
+
+#define SAY_ONSLAY1 "Reesh, hokta!"
+#define SAY_ONSLAY2 "Don't fight it"
+#define SAY_ONSLAY3 "No one is going to save you"
+#define SOUND_ONSLAY1 11001
+#define SOUND_ONSLAY2 11048
+#define SOUND_ONSLAY3 11047
+
+#define SAY_DOOM1 "Just a taste... of what awaits you"
+#define SAY_DOOM2 "Suffer you despicable insect!"
+#define SOUND_DOOM1 11046
+#define SOUND_DOOM2 11000
+
+#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 TRINITY_DLL_DECL boss_azgalorAI : public hyjal_trashAI
+{
+ boss_azgalorAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_HOWL_OF_AZGALOR);
+ if(TempSpell)
+ TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?!
+ }
+
+ uint32 RainTimer;
+ uint32 DoomTimer;
+ uint32 HowlTimer;
+ uint32 CleaveTimer;
+ uint32 EnrageTimer;
+ bool enraged;
+
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ RainTimer = 20000;
+ DoomTimer = 50000;
+ HowlTimer = 30000;
+ CleaveTimer = 10000;
+ EnrageTimer = 600000;
+ enraged = false;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ hyjal_trashAI::JustDied(victim);
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_AZGALOREVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91, -2404.61, 1462.63);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76, -2460.87, 1469.55);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58, -2514.66, 1476.12);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16, -2567.23, 1479.90);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67, -2625.99, 1480.89);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16, -2659.2, 1480.15);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62, -2704.05, 1482.18);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04, -2726.26, 1485.10);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(RainTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE);
+ RainTimer = 20000+rand()%15000;
+ }else RainTimer -= diff;
+
+ if(DoomTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank
+ DoomTimer = 45000+rand()%5000;
+ }else DoomTimer -= diff;
+
+ if(HowlTimer < diff)
+ {
+ DoCast(m_creature, SPELL_HOWL_OF_AZGALOR);
+ HowlTimer = 30000;
+ }else HowlTimer -= diff;
+
+ if(CleaveTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_CLEAVE);
+ CleaveTimer = 10000+rand()%5000;
+ }else CleaveTimer -= diff;
+
+ if(EnrageTimer < diff && !enraged)
+ {
+ m_creature->InterruptNonMeleeSpells(false);
+ DoCast(m_creature, SPELL_BERSERK, true);
+ enraged = true;
+ EnrageTimer = 600000;
+ }else EnrageTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_azgalor(Creature *_Creature)
+{
+ return new boss_azgalorAI (_Creature);
+}
+
+#define SPELL_THRASH 12787
+#define SPELL_CRIPPLE 31406
+#define SPELL_WARSTOMP 31408
+
+struct TRINITY_DLL_DECL mob_lesser_doomguardAI : public hyjal_trashAI
+{
+ mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ Reset();
+ }
+
+ uint32 CrippleTimer;
+ uint32 WarstompTimer;
+
+ void Reset()
+ {
+ CrippleTimer = 50000;
+ WarstompTimer = 10000;
+ DoCast(m_creature, SPELL_THRASH);
+ }
+
+ void Aggro(Unit *who)
+ {
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+
+ }
+
+ void WaypointReached(uint32 i)
+ {
+
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (m_creature->GetDistance(who) <= 50 && !InCombat && m_creature->IsHostileTo(who))
+ {
+ m_creature->AddThreat(who,0.0);
+ m_creature->Attack(who,false);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(WarstompTimer < diff)
+ {
+ DoCast(m_creature, SPELL_WARSTOMP);
+ WarstompTimer = 10000+rand()%5000;
+ }else WarstompTimer -= diff;
+
+ if(CrippleTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,100,true), SPELL_CRIPPLE);
+ CrippleTimer = 25000+rand()%5000;
+ }else CrippleTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_lesser_doomguard(Creature *_Creature)
+{
+ return new mob_lesser_doomguardAI (_Creature);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
new file mode 100644
index 00000000000..6bd24fca7a4
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_kazrogal.cpp
@@ -0,0 +1,197 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_CLEAVE 31436
+#define SPELL_WARSTOMP 31480
+#define SPELL_MARK 31447
+
+#define SOUND_ONDEATH 11018
+
+#define SAY_ONSLAY1 "Shaza-Kiel!"
+#define SAY_ONSLAY2 "You... are nothing!"
+#define SAY_ONSLAY3 "Miserable nuisance!"
+#define SOUND_ONSLAY1 11017
+#define SOUND_ONSLAY2 11053
+#define SOUND_ONSLAY3 11054
+
+#define SAY_MARK1 "Your death will be a painful one."
+#define SAY_MARK2 "You... are marked."
+#define SOUND_MARK1 11016
+#define SOUND_MARK2 11052
+
+#define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit."
+#define SOUND_ONAGGRO 11015
+
+struct TRINITY_DLL_DECL boss_kazrogalAI : public hyjal_trashAI
+{
+ boss_kazrogalAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_MARK);
+ if(TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
+ {
+ TempSpell->EffectImplicitTargetA[0] = 1;
+ TempSpell->EffectImplicitTargetB[0] = 0;
+ }
+ }
+
+ uint32 CleaveTimer;
+ uint32 WarStompTimer;
+ uint32 MarkTimer;
+ uint32 MarkTimerBase;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ CleaveTimer = 5000;
+ WarStompTimer = 15000;
+ MarkTimer = 45000;
+ MarkTimerBase = 45000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ case 2:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY3);
+ DoYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ hyjal_trashAI::JustDied(victim);
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_KAZROGALEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91, -2404.61, 1462.63);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76, -2460.87, 1469.55);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58, -2514.66, 1476.12);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16, -2567.23, 1479.90);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67, -2625.99, 1480.89);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16, -2659.2, 1480.15);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62, -2704.05, 1482.18);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04, -2726.26, 1485.10);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(CleaveTimer < diff)
+ {
+ DoCast(m_creature, SPELL_CLEAVE);
+ CleaveTimer = 6000+rand()%15000;
+ }else CleaveTimer -= diff;
+
+ if(WarStompTimer < diff)
+ {
+ DoCast(m_creature, SPELL_WARSTOMP);
+ WarStompTimer = 60000;
+ }else WarStompTimer -= diff;
+
+ if(m_creature->HasAura(SPELL_MARK,0))
+ m_creature->RemoveAurasDueToSpell(SPELL_MARK);
+ if(MarkTimer < diff)
+ {
+ //cast dummy, useful for bos addons
+ m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID());
+
+ std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
+ for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ {
+ Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
+ if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA)
+ {
+ target->CastSpell(target, SPELL_MARK,true);//only cast on mana users
+ }
+ }
+ MarkTimerBase -= 5000;
+ if(MarkTimerBase < 5500)
+ MarkTimerBase = 5500;
+ MarkTimer = MarkTimerBase;
+ switch(rand()%3)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_MARK1);
+ DoYell(SAY_MARK1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_MARK2);
+ DoYell(SAY_MARK2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else MarkTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_kazrogal(Creature *_Creature)
+{
+ return new boss_kazrogalAI (_Creature);
+}
+
+void AddSC_boss_kazrogal()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_kazrogal";
+ newscript->GetAI = &GetAI_boss_kazrogal;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
new file mode 100644
index 00000000000..b125668947c
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_rage_winterchill.cpp
@@ -0,0 +1,192 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+
+#define SPELL_FROST_ARMOR 31256
+#define SPELL_DEATH_AND_DECAY 31258
+
+#define SPELL_FROST_NOVA 31250
+#define SPELL_ICEBOLT 31249
+
+#define SAY_ONDEATH "You have won this battle, but not... the... war"
+#define SOUND_ONDEATH 11026
+
+#define SAY_ONSLAY1 "All life must perish!"
+#define SAY_ONSLAY2 "Victory to the Legion!"
+#define SOUND_ONSLAY1 11025
+#define SOUND_ONSLAY2 11057
+
+#define SAY_DECAY1 "Crumble and rot!"
+#define SAY_DECAY2 "Ashes to ashes, dust to dust"
+#define SOUND_DECAY1 11023
+#define SOUND_DECAY2 11055
+
+#define SAY_NOVA1 "Succumb to the icy chill... of death!"
+#define SAY_NOVA2 "It will be much colder in your grave"
+#define SOUND_NOVA1 11024
+#define SOUND_NOVA2 11058
+
+#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 TRINITY_DLL_DECL boss_rage_winterchillAI : public hyjal_trashAI
+{
+ boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ uint32 FrostArmorTimer;
+ uint32 DecayTimer;
+ uint32 NovaTimer;
+ uint32 IceboltTimer;
+ bool go;
+ uint32 pos;
+
+ void Reset()
+ {
+ FrostArmorTimer = 37000;
+ DecayTimer = 45000;
+ NovaTimer = 15000;
+ IceboltTimer = 10000;
+
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED);
+ }
+
+ void Aggro(Unit *who)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS);
+ DoPlaySoundToSet(m_creature, SOUND_ONAGGRO);
+ DoYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL);
+ }
+
+ void KilledUnit(Unit *victim)
+ {
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY1);
+ DoYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_ONSLAY2);
+ DoYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ hyjal_trashAI::JustDied(victim);
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE);
+ DoPlaySoundToSet(m_creature, SOUND_ONDEATH);
+ DoYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (IsEvent)
+ {
+ //Must update npc_escortAI
+ npc_escortAI::UpdateAI(diff);
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 4896.08, -1576.35, 1333.65);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 4898.68, -1615.02, 1329.48);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 4907.12, -1667.08, 1321.00);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 4963.18, -1699.35, 1340.51);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 4989.16, -1716.67, 1335.74);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5026.27, -1736.89, 1323.02);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5037.77, -1770.56, 1324.36);
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5067.23, -1789.95, 1321.17);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ //Return since we have no target
+ if (!UpdateVictim() )
+ return;
+
+ if(FrostArmorTimer < diff)
+ {
+ DoCast(m_creature, SPELL_FROST_ARMOR);
+ FrostArmorTimer = 40000+rand()%20000;
+ }else FrostArmorTimer -= diff;
+ if(DecayTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_DEATH_AND_DECAY);
+ DecayTimer = 60000+rand()%20000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_DECAY1);
+ DoYell(SAY_DECAY1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_DECAY2);
+ DoYell(SAY_DECAY2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else DecayTimer -= diff;
+ if(NovaTimer < diff)
+ {
+ DoCast(m_creature->getVictim(), SPELL_FROST_NOVA);
+ NovaTimer = 30000+rand()%15000;
+ switch(rand()%2)
+ {
+ case 0:
+ DoPlaySoundToSet(m_creature, SOUND_NOVA1);
+ DoYell(SAY_NOVA1, LANG_UNIVERSAL, NULL);
+ break;
+ case 1:
+ DoPlaySoundToSet(m_creature, SOUND_NOVA2);
+ DoYell(SAY_NOVA2, LANG_UNIVERSAL, NULL);
+ break;
+ }
+ }else NovaTimer -= diff;
+ if(IceboltTimer < diff)
+ {
+ DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT);
+ IceboltTimer = 11000+rand()%20000;
+ }else IceboltTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_rage_winterchill(Creature *_Creature)
+{
+ return new boss_rage_winterchillAI (_Creature);
+}
+
+void AddSC_boss_rage_winterchill()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_rage_winterchill";
+ newscript->GetAI = &GetAI_boss_rage_winterchill;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
index f33f9a95da3..7d81dbe4993 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/def_hyjal.h
@@ -24,6 +24,10 @@
#define DATA_TYRANDEWHISPERWIND 13
#define DATA_TRASH 14
#define DATA_RESET_TRASH_COUNT 15
+#define DATA_ALLIANCE_RETREAT 16
+#define DATA_HORDE_RETREAT 17
+#define DATA_RAIDDAMAGE 18
+#define DATA_RESET_RAIDDAMAGE 19
#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy"
#endif
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
index 6e301d339c8..faa7f9eaad7 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal.cpp
@@ -83,7 +83,6 @@ bool GossipHello_npc_jaina_proudmoore(Player *player, Creature *_Creature)
player->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
-
return true;
}
@@ -108,7 +107,6 @@ bool GossipSelect_npc_jaina_proudmoore(Player *player, Creature *_Creature, uint
debug_log("SD2: HyjalAI - Debug mode has been toggled");
break;
}
-
return true;
}
@@ -120,7 +118,7 @@ CreatureAI* GetAI_npc_thrall(Creature *_Creature)
ai->EnterEvadeMode();
ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING;
- ai->Spell[0].Cooldown = 2000 + rand()%5000;
+ ai->Spell[0].Cooldown = 3000 + rand()%5000;
ai->Spell[0].TargetType = TARGETTYPE_VICTIM;
ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
@@ -133,14 +131,12 @@ CreatureAI* GetAI_npc_thrall(Creature *_Creature)
bool GossipHello_npc_thrall(Player *player, Creature *_Creature)
{
hyjalAI* ai = ((hyjalAI*)_Creature->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)
+ if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT))
{
uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT);
uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
@@ -156,13 +152,13 @@ bool GossipHello_npc_thrall(Player *player, Creature *_Creature)
player->ADD_GOSSIP_ITEM(2, "[GM] Toggle Debug Timers", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
-
return true;
}
bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender, uint32 action)
{
hyjalAI* ai = ((hyjalAI*)_Creature->AI());
+ ai->DeSpawnVeins();//despawn the alliance veins
switch(action)
{
case GOSSIP_ACTION_INFO_DEF + 1:
@@ -181,7 +177,6 @@ bool GossipSelect_npc_thrall(Player *player, Creature *_Creature, uint32 sender,
debug_log("SD2: HyjalAI - Debug mode has been toggled");
break;
}
-
return true;
}
@@ -190,7 +185,6 @@ CreatureAI* GetAI_npc_tyrande_whisperwind(Creature *_Creature)
hyjalAI* ai = new hyjalAI(_Creature);
ai->Reset();
ai->EnterEvadeMode();
-
return ai;
}
@@ -208,17 +202,19 @@ bool GossipHello_npc_tyrande_whisperwind(Player* player, Creature* _Creature)
bool GossipSelect_npc_tyrande_whisperwind(Player *player, Creature *_Creature, uint32 sender, uint32 action)
{
- if (action == GOSSIP_ACTION_INFO_DEF)
+ if (action == GOSSIP_ACTION_INFO_DEF)
{
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
{
- player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
+ Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
+ if(item && player)
+ player->SendNewItem(item,1,true,false,true);
}
player->SEND_GOSSIP_MENU(907, _Creature->GetGUID());
+ hyjalAI* ai = ((hyjalAI*)_Creature->AI());
}
-
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
index b6c039c49fa..74d283340b1 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
@@ -23,39 +23,300 @@ EndScriptData */
#include "precompiled.h"
#include "hyjalAI.h"
+#include "hyjal_trash.h"
+#include "MapManager.h"
+#include "Language.h"
+#include "Chat.h"
+#include "Object.h"
+
+#define SPAWN_GARG_GATE 0
+#define SPAWN_WYRM_GATE 1
+#define SPAWN_NEAR_TOWER 2
+// Locations for summoning gargoyls and frost wyrms in special cases
+float SpawnPointSpecial[3][3]=
+{
+ {5497.08, -2493.23, 1535.72}, //spawn point for the gargoyles near the horde gate
+ {5624.53, -2548.12, 1551.54}, //spawn point for the frost wyrm near the horde gate
+ {5604.41, -2811.98, 1547.77} //spawn point for the gargoyles and wyrms near the horde tower
+};
// Locations for summoning waves in Alliance base
float AllianceBase[4][3]=
{
- {4979.010, -1709.134, 1339.674},
- {4969.123, -1705.904, 1341.363},
- {4970.260, -1698.546, 1341.200},
- {4975.262, -1698.239, 1341.427}
+ {4928.48, -1526.38, 1326.83},
+ {4923.54, -1514.29, 1327.98},
+ {4928.41, -1510.35, 1327.99},
+ {4938.35, -1521.00, 1326.69}
+};
+
+float JainaDummySpawn[2][4]=
+{
+ {5497.01, -2719.03, 1483.08, 2.90426},
+ {5484.98, -2721.69, 1483.39, 6.00656}
};
+
// Locations for summoning waves in Horde base
-float HordeBase[4][3]=
+float HordeBase[4][3]=
+{
+ {5458.01, -2340.27, 1459.60},
+ {5466.01, -2334.69, 1460.06},
+ {5468.45, -2355.13, 1459.99},
+ {5479.06, -2344.16, 1461.74}
+};
+
+// Lady Jaina's waypoints when retreathing
+float JainaWPs[2][3]=
+{
+ {5078.56, -1789.79, 1320.73},//next to the small stairs
+ {5037.38, -1778.39, 1322.61},//center of alliance base
+};
+
+float InfernalPos[8][3]=//spawn points for the infernals in the horde base
{
- {5554.399, -2581.419, 1480.820},
- {5538.996, -2577.742, 1479.790},
- {5565.642, -2565.666, 1481.635},
- {5547.218, -2574.589, 1479.194}
+ {5453.59, -2764.52, 1493.50},
+ {5478.4, -2781.77, 1497.52},
+ {5506.09, -2780.53, 1496.32},
+ {5532.1, -2763.42, 1492.37},
+ {5544.16, -2733.99, 1487.14},
+ {5536.19, -2708.18, 1480.01},
+ {5510.16, -2691.75, 1479.66},
+ {5482.39, -2689.19, 1481.09}
};
-// used to inform the wave where to move and attack to
-float AttackArea[2][3]=
+float InfernalSPWP[10][3]=//spawn points for the infernals in the horde base used in the cleaning wave
{
- {5042.9189, -1776.2562, 1323.0621}, // Alliance
- {5510.4815, -2676.7112, 1480.4314} // Horde
+ {5528.5, -2771.23, 1494.08},
+ {5471.41, -2711.17, 1483.97},
+ {5464.08, -2653.9, 1482.67},
+ {5550.84, -2633.8, 1484.08},
+ {5579.86, -2704.86, 1489.33},
+ {5589.67, -2655.5, 1490.15},
+ {5432.36, -2744.81, 1486.25},
+ {5463.14, -2857.41, 1512.45},
+ {5534.31, -2774.58, 1494.89},
+ {5524.36, -2735.52, 1484.16}
};
-hyjalAI::hyjalAI(Creature *c) : ScriptedAI(c)
+float VeinPos[14][8]=//spawn points of the ancient gem veins
+{
+ {5184.84, -1982.59, 1382.66, 2.58079, 0, 0, 0.960944, 0.276742}, //alliance
+ {5107.66, -2071.16, 1368.37, 2.65148, 0, 0, 0.970124, 0.242611}, //alliance
+ {5040.53, -2227.65, 1403.17, 3.35049, 0, 0, 0.99455, -0.104257}, //alliance
+ {5187.59, -2453.12, 1455.51, 5.87943, 0, 0, 0.20051, -0.979692}, //alliance
+ {5429.43, -2340.65, 1465.38, 4.7681, 0, 0, 0.687138, -0.726527}, //alliance
+ {5463.99, -2315.95, 1470.29, 1.52045, 0, 0, 0.689084, 0.724682}, //alliance
+ {5624.65, -2495.09, 1510.11, 0.0124869, 0, 0, 0.00624342, 0.999981}, //alliance
+ {5285.41, -3348.32, 1663.01, 1.57152, 0, 0, 0.707362, 0.706852}, //horde
+ {5417.69, -3372.52, 1656.31, 0.361993, 0, 0, 0.18001, 0.983665}, //horde
+ {5315.34, -3238.32, 1622.88, 3.03627, 0, 0, 0.998614, 0.0526347}, //horde
+ {5303.4, -3096.44, 1596.41, 1.72073, 0, 0, 0.758081, 0.65216}, //horde
+ {5265.13, -3177.27, 1616.22, 0.813604, 0, 0, 0.395674, 0.918391}, //horde
+ {5374.3, -3420.59, 1653.43, 1.45762, 0, 0, 0.665981, 0.745969}, //horde
+ {5441.54, -3321.59, 1651.55, 0.258306, 0, 0, 0.128794, 0.991671} //horde
+};
+
+float AllianceFirePos[92][8]=//spawn points for the fire visuals (GO) in the alliance base
+{
+ {5039.9, -1796.84, 1323.88, 2.59222, 0, 0, 0.962511, 0.271243},
+ {5087.2, -1795.2, 1320.68, 1.03946, 0, 0, 0.496644, 0.867954},
+ {5112.68, -1806.66, 1359.93, 1.37799, 0, 0, 0.63576, 0.771887},
+ {5095.61, -1793.27, 1359.78, 0.580806, 0, 0, 0.286338, 0.958129},
+ {5090.43, -1784.45, 1360.44, 0.796784, 0, 0, 0.387937, 0.921686},
+ {5139.25, -1783.11, 1359.39, 3.30849, 0, 0, 0.99652, -0.0833509},
+ {5112.16, -1763.72, 1361.35, 5.10312, 0, 0, 0.556388, -0.830922},
+ {4981.18, -1793.98, 1335.7, 3.23072, 0, 0, 0.999007, -0.0445498},
+ {4996.57, -1766.75, 1341.62, 3.5331, 0, 0, 0.980902, -0.194505},
+ {4983.74, -1769.25, 1345.75, 3.79228, 0, 0, 0.947541, -0.319635},
+ {4996.01, -1774.43, 1330.71, 3.07364, 0, 0, 0.999423, 0.0339693},
+ {5094.2, -1726.13, 1330.55, 1.56175, 0, 0, 0.703901, 0.710298},
+ {5079.82, -1721.24, 1336.26, 1.18868, 0, 0, 0.559964, 0.828517},
+ {5077.68, -1717.15, 1327.78, 0.0145145, 0, 0, 0.00725717, 0.999974},
+ {5122.27, -1738.22, 1341.67, 0.835256, 0, 0, 0.405593, 0.914054},
+ {5131.88, -1741.15, 1335.25, 2.15472, 0, 0, 0.880712, 0.473653},
+ {5196.93, -1772.99, 1345.2, 0.128397, 0, 0, 0.0641544, 0.99794},
+ {5225.33, -1756.06, 1344.17, 3.04223, 0, 0, 0.998766, 0.0496599},
+ {5224.84, -1767.05, 1360.06, 3.19538, 0, 0, 0.999638, -0.0268922},
+ {5202.05, -1763.47, 1361.68, 2.59455, 0, 0, 0.962826, 0.270122},
+ {5194.74, -1766.66, 1356.94, 0.0734191, 0, 0, 0.0367013, 0.999326},
+ {5159.67, -1832.97, 1344.5, 5.17457, 0, 0, 0.526356, -0.850264},
+ {5096.17, -1858.73, 1332.46, 5.30021, 0, 0, 0.471939, -0.881631},
+ {5110.7, -1856.59, 1342.84, 5.97564, 0, 0, 0.153167, -0.9882},
+ {5109.76, -1855.3, 1332.38, 4.89572, 0, 0, 0.639411, -0.768865},
+ {5068.95, -1837.37, 1328.81, 2.61569, 0, 0, 0.965628, 0.25993},
+ {5064.4, -1824.77, 1329.02, 2.16409, 0, 0, 0.88292, 0.469524},
+ {5059.89, -1848.79, 1329.59, 0.0709955, 0, 0, 0.0354903, 0.99937},
+ {5014.37, -1851.39, 1322.56, 4.66949, 0, 0, 0.722111, -0.691777},
+ {5025.1, -1848.27, 1323.39, 4.44565, 0, 0, 0.794854, -0.606801},
+ {4942.63, -1890.13, 1326.59, 3.28719, 0, 0, 0.997351, -0.0727343},
+ {4937.95, -1888.71, 1352.41, 3.41678, 0, 0, 0.990549, -0.13716},
+ {4922.48, -1881.92, 1352.41, 5.03077, 0, 0, 0.586075, -0.810257},
+ {4915.35, -1894.32, 1351.24, 6.22457, 0, 0, 0.0293048, -0.999571},
+ {4922.71, -1904.84, 1352.56, 1.37866, 0, 0, 0.63602, 0.771672},
+ {4932.89, -1905.49, 1352.56, 1.89702, 0, 0, 0.812549, 0.582893},
+ {5011.83, -1861.05, 1345.86, 4.43777, 0, 0, 0.797239, -0.603664},
+ {5011.83, -1861.05, 1363.26, 4.748, 0, 0, 0.694406, -0.719583},
+ {5021.46, -1858.35, 1342.17, 4.86188, 0, 0, 0.652329, -0.757936},
+ {4995.02, -1698.3, 1370.38, 6.15779, 0, 0, 0.0626579, -0.998035},
+ {5119.85, -1728.9, 1336.04, 5.87112, 0, 0, 0.204579, -0.97885},
+ {5214.75, -1751.02, 1342.5, 5.08965, 0, 0, 0.561972, -0.827156},
+ {5075.04, -1822.43, 1328.87, 3.99951, 0, 0, 0.9094, -0.415924},
+ {5057.09, -1823.32, 1350.35, 3.88169, 0, 0, 0.93231, -0.361659},
+ {4984.6, -1816.99, 1329.21, 3.05308, 0, 0, 0.999021, 0.0442417},
+ {4983.35, -1811.55, 1356.82, 3.33975, 0, 0, 0.995096, -0.098917},
+ {4984.11, -1825.73, 1350.76, 2.26375, 0, 0, 0.905211, 0.424962},
+ {4968.47, -1786.46, 1354.09, 3.07663, 0, 0, 0.999473, 0.0324733},
+ {5061.82, -1751.16, 1339.07, 5.94727, 0, 0, 0.167171, -0.985928},
+ {5063.75, -1763, 1351.91, 0.759707, 0, 0, 0.370784, 0.928719},
+ {5078.65, -1708.26, 1353.9, 1.27022, 0, 0, 0.593264, 0.805008},
+ {4983.19, -1755.96, 1331.13, 4.28221, 0, 0, 0.841733, -0.539894},
+ {4972.76, -1755.3, 1332.5, 4.21938, 0, 0, 0.858276, -0.513188},
+ {4961.65, -1760.82, 1351.69, 3.56515, 0, 0, 0.977659, -0.210198},
+ {5086.45, -1779.83, 1321.62, 6.23157, 0, 0, 0.0258051, -0.999667},
+ {5063.15, -1756.74, 1328.56, 0.886926, 0, 0, 0.42907, 0.903271},
+ {5042.45, -1800.61, 1323.88, 2.50093, 0, 0, 0.949131, 0.31488},
+ {5084.74, -1725.35, 1327.89, 1.65034, 0, 0, 0.734663, 0.678432},
+ {4993.25, -1758.1, 1331.07, 3.49995, 0, 0, 0.98399, -0.178223},
+ {5078.53, -1867.85, 1348.91, 5.85612, 0, 0, 0.211913, -0.977288},
+ {5080.74, -1869.73, 1333.18, 6.18206, 0, 0, 0.0505424, -0.998722},
+ {5089.55, -1894.13, 1356.08, 1.52072, 0, 0, 0.689181, 0.724589},
+ {5113.24, -1899.49, 1363.77, 1.50108, 0, 0, 0.682034, 0.731321},
+ {4984.18, -1907.69, 1325.62, 3.82193, 0, 0, 0.942698, -0.333646},
+ {5094.14, -2432.08, 1429.38, 4.70083, 0, 0, 0.711182, -0.703007},
+ {5329.89, -2113.30, 1281.06, 5.60560, 0, 0, 0.332347, -0.943157},
+ {5170.87, -2148.13, 1278.32, 1.63540, 0, 0, 0.729573, 0.683903 },
+ {5132.94, -1960.25, 1367.8, 3.69787, 0, 0, 0.961568, -0.274566},
+ {5280.82, -2351.55, 1431.57, 4.46913, 0, 0, 0.787677, -0.616088},
+ {5176.78, -2121.43, 1295.27, 3.24153, 0, 0, 0.998752, -0.04995},
+ {5332.75, -2101.41, 1296.37, 5.50350, 0, 0, 0.380043, -0.924969},
+ {5265.70, -2050.27, 1287.57, 0.50051, 0, 0, 0.247655, 0.968848 },
+ {5194.21, -2129.89, 1274.04, 3.08053, 0, 0, 0.999534, 0.0305272},
+ {5225.81, -1985.50, 1364.15, 0.37247, 0, 0, 0.185163, 0.982708 },
+ {5339.46, -2204.47, 1280.45, 0.99921, 0, 0, 0.479081, 0.877771 },
+ {5269.63, -2020.57, 1299.62, 3.00201, 0, 0, 0.997566, 0.0697332},
+ {5111.54, -2445.70, 1435.31, 2.70983, 0, 0, 0.976788, 0.214207 },
+ {5111.24, -1901.14, 1355.33, 1.61028, 0, 0, 0.720929, 0.693009 },
+ {5310.42, -2207.82, 1277.46, 0.50441, 0, 0, 0.249544, 0.968363 },
+ {5150.81, -2042.13, 1394.3, 2.21031, 0, 0, 0.893534, 0.448995 },
+ {5224.84, -2376.61, 1366.33, 5.0621, 0, 0, 0.573311, -0.819338},
+ {5105.41, -2454.86, 1446.16, 4.64584, 0, 0, 0.730239, -0.683191},
+ {5309.65, -2188.28, 1266.84, 5.56631, 0, 0, 0.350811, -0.936446},
+ {5281.46, -2047.82, 1287.67, 2.44909, 0, 0, 0.940652, 0.339373 },
+ {5325.45, -2189.41, 1309.6, 6.23783, 0, 0, 0.0226771, -0.999743},
+ {5190.96, -2142.54, 1293.03, 6.25668, 0, 0, 0.0132544, -0.999912},
+ {5089.99, -2467.49, 1441.8, 0.77381, 0, 0, 0.377326, 0.92608 },
+ {5195.08, -2129.01, 1285.36, 3.55727, 0, 0, 0.978480, -0.206344},
+ {5353.76, -2116.28, 1299.27, 6.17894, 0, 0, 0.0521006, -0.998642},
+ {5271.14, -2037.38, 1299.24, 4.07879, 0, 0, 0.892201, -0.451638},
+ {5332.5 , -2181.28, 1279.95, 4.6906, 0, 0, 0.714768, -0.699362},
+ {5108.2 , -2429.84, 1427.73, 4.5194, 0, 0, 0.771943, -0.635691}
+};
+
+float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde base
+{
+ {5524.11, -2612.73, 1483.38, 1.96198, 0, 0, 0.831047, 0.556202},
+ {5514.42, -2617.19, 1505.77, 1.82453, 0, 0, 0.790892, 0.611956},
+ {5510.21, -2624.77, 1485.34, 1.71065, 0, 0, 0.754783, 0.655974},
+ {5570.72, -2619.04, 1487.62, 0.728898, 0, 0, 0.356435, 0.93432},
+ {5570.29, -2639.37, 1487.31, 1.49308, 0, 0, 0.679104, 0.734042},
+ {5583.56, -2637.2, 1503.78, 1.46559, 0, 0, 0.668951, 0.743307},
+ {5571.53, -2626.81, 1510.99, 0.362107, 0, 0, 0.180066, 0.983654},
+ {5545.97, -2659.62, 1489.64, 5.07055, 0, 0, 0.569845, -0.821752},
+ {5557.44, -2675.91, 1482.58, 1.70118, 0, 0, 0.751671, 0.659539},
+ {5594.98, -2742.31, 1495.51, 4.5993, 0, 0, 0.74594, -0.666013},
+ {5599.65, -2755.6, 1505.05, 1.66896, 0, 0, 0.740947, 0.671564},
+ {5565.95, -2774.75, 1499.48, 6.22425, 0, 0, 0.0294611, -0.999566},
+ {5567.1, -2769.7, 1511.17, 5.99257, 0, 0, 0.144799, -0.989461},
+ {5572.84, -2774.16, 1527.06, 0.836428, 0, 0, 0.406129, 0.913816},
+ {5538.32, -2805.94, 1498.87, 4.30082, 0, 0, 0.836674, -0.547701},
+ {5515.66, -2801.74, 1503.53, 5.57316, 0, 0, 0.347602, -0.937642},
+ {5516.76, -2827.14, 1501.15, 0.35026, 0, 0, 0.174236, 0.984704},
+ {5536.13, -2813.51, 1537.21, 4.51681, 0, 0, 0.772765, -0.634692},
+ {5525.05, -2825.16, 1538.53, 0.489275, 0, 0, 0.242205, 0.970225},
+ {5534.42, -2815.45, 1562.84, 4.62834, 0, 0, 0.736191, -0.676774},
+ {5519.64, -2831.12, 1526.46, 0.611008, 0, 0, 0.300774, 0.953696},
+ {5551.04, -2827.55, 1523.5, 3.35206, 0, 0, 0.994468, -0.10504},
+ {5469.22, -2802.87, 1503.5, 4.99509, 0, 0, 0.600436, -0.799673},
+ {5427.8, -2737.26, 1487.12, 1.78673, 0, 0, 0.779186, 0.626793},
+ {5454.1, -2709.1, 1485.92, 3.03552, 0, 0, 0.998594, 0.0530137},
+ {5436.3, -2718.2, 1506.02, 2.7567, 0, 0, 0.981539, 0.191261},
+ {5412.6, -2740.55, 1510.79, 2.98446, 0, 0, 0.996915, 0.0784832},
+ {5406.12, -2752.48, 1521.01, 2.05769, 0, 0, 0.856705, 0.515807},
+ {5445.24, -2676.35, 1521.89, 2.91378, 0, 0, 0.99352, 0.113661},
+ {5481.4, -2665.08, 1482.23, 4.30001, 0, 0, 0.836895, -0.547363},
+ {5443.51, -2675.44, 1487.12, 2.90986, 0, 0, 0.993295, 0.115606},
+ {5391.72, -2647.3, 1528.9, 3.76987, 0, 0, 0.951063, -0.308997},
+ {5421.09, -2734.12, 1521.01, 2.70567, 0, 0, 0.97634, 0.216242},
+ {5405.39, -2710.33, 1533.77, 2.51324, 0, 0, 0.951052, 0.309032},
+ {5423.96, -2703.76, 1516.34, 2.79206, 0, 0, 0.984767, 0.173879},
+ {5444.75, -2735.23, 1486.37, 2.22657, 0, 0, 0.897155, 0.441715},
+ {5570.98, -2747.91, 1495.7, 5.14433, 0, 0, 0.53915, -0.84221},
+ {5567.79, -2673.9, 1484.66, 2.72529, 0, 0, 0.978415, 0.20665},
+ {5600.71, -2696.8, 1500.42, 0.443704, 0, 0, 0.220036, 0.975492},
+ {5600.7, -2693.04, 1515.2, 5.16003, 0, 0, 0.532522, -0.846416},
+ {5627.56, -2839.66, 1510.53, 5.41527, 0, 0, 0.420463, -0.907309},
+ {5622.02, -2868.71, 1516.22, 2.25482, 0, 0, 0.903303, 0.429002},
+ {5586.61, -2878.97, 1510.34, 4.55604, 0, 0, 0.76017, -0.649724},
+ {5583.78, -2843.71, 1509.54, 5.35715, 0, 0, 0.44665, -0.894709},
+ {5580.95, -2811.3, 1513.3, 3.57587, 0, 0, 0.976518, -0.215434},
+ {5542.52, -2869.31, 1523.13, 5.23304, 0, 0, 0.501275, -0.865288},
+ {5557.35, -2866.36, 1518.76, 4.48299, 0, 0, 0.783388, -0.621533},
+ {5380.91, -2849.36, 1512.81, 3.90962, 0, 0, 0.927168, -0.374646},
+ {5395.76, -2881.41, 1521.11, 4.28426, 0, 0, 0.84118, -0.540755},
+ {5374.87, -2859.63, 1528.98, 3.30252, 0, 0, 0.996765, -0.0803745},
+ {5356.07, -2854.66, 1520.34, 5.83933, 0, 0, 0.220108, -0.975475},
+ {5363.01, -2975.72, 1539.02, 4.13738, 0, 0, 0.87859, -0.477576},
+ {5336.85, -2980.74, 1561.24, 5.11126, 0, 0, 0.553001, -0.83318},
+ {5335.23, -2974.62, 1540.05, 5.04451, 0, 0, 0.580496, -0.814263},
+ {5422.37, -2998.87, 1549.98, 4.51831, 0, 0, 0.772288, -0.635272},
+ {5405.54, -3014.6, 1562.16, 5.86761, 0, 0, 0.206298, -0.978489},
+ {5427.96, -3019.4, 1561.58, 3.53498, 0, 0, 0.980718, -0.19543},
+ {5348.12, -2977.84, 1582.47, 3.94025, 0, 0, 0.921323, -0.388799},
+ {5331.12, -2993.71, 1576.14, 0.0642734, 0, 0, 0.0321311, 0.999484},
+ {5321.63, -2986.55, 1552.2, 5.29503, 0, 0, 0.474219, -0.880407},
+ {5292.1, -2914.36, 1529.52, 2.9742, 0, 0, 0.996499, 0.083601},
+ {5281.77, -2926.5, 1530.62, 1.67829, 0, 0, 0.744071, 0.6681},
+ {5287.19, -2909.94, 1543.49, 3.31192, 0, 0, 0.996376, -0.0850591},
+ {5534.15, -2679.35, 1483.61, 0.428685, 0, 0, 0.212705, 0.977116},
+ {5545.43, -2647.82, 1483.05, 5.38848, 0, 0, 0.432578, -0.901596}
+};
+
+hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(m_creature)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ VeinsSpawned[0] = false;
+ VeinsSpawned[1] = false;
+ for(uint8 i=0;i<14;i++)
+ VeinGUID[i] = 0;
+ InfernalCount = 0;
+ TeleportTimer = 1000;
+ Overrun = false;
+ Teleported = false;
+ WaitForTeleport = false;
+ OverrunCounter = 0;
+ OverrunCounter2 = 0;
+ InfernalPoint = 0;
+ RespawnTimer = 10000;
+ DoRespawn = false;
+ DoHide = false;
+ MassTeleportTimer = 0;
+ DoMassTeleport = false;
+}
+
+void hyjalAI::JustSummoned(Creature *summoned)
+{
+ Summons.Summon(summoned);
+}
+
+void hyjalAI::SummonedCreatureDespawn(Creature* summoned)
+{
+ Summons.Despawn(summoned);
}
void hyjalAI::Reset()
{
+ IsDummy = false;
+ m_creature->setActive(true);
// GUIDs
PlayerGUID = 0;
BossGUID[0] = 0;
@@ -73,23 +334,28 @@ void hyjalAI::Reset()
// Set faction properly based on creature entry
switch(m_creature->GetEntry())
{
- case 17772:
+ case JAINA:
Faction = 0;
DoCast(m_creature, SPELL_BRILLIANCE_AURA, true);
break;
- case 17852:
+ case THRALL:
Faction = 1;
break;
+
+ case TYRANDE:
+ Faction = 2;
+ break;
}
- //Bools
+ //Bools
EventBegun = false;
FirstBossDead = false;
SecondBossDead = false;
Summon = false;
bRetreat = false;
Debug = false;
+
//Flags
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -108,40 +374,32 @@ void hyjalAI::Reset()
else error_log(ERROR_INST_DATA);
//Visibility
- switch(m_creature->GetEntry())
- {
- case 17772: if(pInstance->GetData(DATA_ANETHERONEVENT) == DONE)
- m_creature->SetVisibility(VISIBILITY_OFF);
- else m_creature->SetVisibility(VISIBILITY_ON);
- break;
- case 17852: if(pInstance->GetData(DATA_AZGALOREVENT) == DONE)
- m_creature->SetVisibility(VISIBILITY_OFF);
- else m_creature->SetVisibility(VISIBILITY_ON);
- break;
- }
-
+ DoHide = true;
+
+ //CreatureList.clear();
//If Jaina evades, reset the visibility of all other creatures in the grid.
- if(CreatureList.empty())
+ /*if(CreatureList.empty())
return;
for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr)
- if(Creature* cr = ((Creature*)Unit::GetUnit(*m_creature, *itr)))
+ if(Creature* cr = (Unit::GetCreature(*m_creature, *itr)))
cr->SetVisibility(VISIBILITY_ON);
- CreatureList.clear();
+ CreatureList.clear();*/
}
void hyjalAI::EnterEvadeMode()
{
m_creature->InterruptNonMeleeSpells(true);
- m_creature->RemoveAllAuras();
+ if(m_creature->GetEntry() != JAINA)
+ m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop();
m_creature->LoadCreaturesAddon();
if(m_creature->isAlive())
m_creature->GetMotionMaster()->MoveTargetedHome();
-
+
m_creature->SetLootRecipient(NULL);
InCombat = false;
@@ -149,6 +407,7 @@ void hyjalAI::EnterEvadeMode()
void hyjalAI::Aggro(Unit *who)
{
+ if(IsDummy)return;
for(uint8 i = 0; i < 3; ++i)
if(Spell[i].Cooldown)
SpellTimer[i] = Spell[i].Cooldown;
@@ -156,30 +415,95 @@ void hyjalAI::Aggro(Unit *who)
Talk(ATTACKED);
}
+void hyjalAI::MoveInLineOfSight(Unit *who)
+{
+ if(IsDummy)return;
+ if (IsBeingEscorted && !GetAttack())
+ return;
+
+ if(m_creature->getVictim() || !m_creature->canStartAttack(who))
+ return;
+
+ AttackStart(who);
+}
+
void hyjalAI::SummonCreature(uint32 entry, float Base[4][3])
{
uint32 random = rand()%4;
float SpawnLoc[3];
- float AttackLoc[3];
for(uint8 i = 0; i < 3; ++i)
{
SpawnLoc[i] = Base[random][i];
- AttackLoc[i] = AttackArea[Faction][i];
}
-
- Creature* pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 120000);
+ Creature* pCreature = NULL;
+ switch(entry)
+ {
+ case 17906: //GARGOYLE
+
+ if(!FirstBossDead && (WaveCount == 1 || WaveCount == 3))
+ {//summon at tower
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][1]+irand(-20,20), SpawnPointSpecial[SPAWN_NEAR_TOWER][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ if(pCreature)
+ ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ }else{//summon at gate
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_GARG_GATE][0]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][1]+irand(-10,10), SpawnPointSpecial[SPAWN_GARG_GATE][2]+irand(-10,10), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ }
+ break;
+ case 17907: //FROST_WYRM ,
+ if(FirstBossDead && WaveCount == 1)
+ {//summon at gate
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_WYRM_GATE][0],SpawnPointSpecial[SPAWN_WYRM_GATE][1],SpawnPointSpecial[SPAWN_WYRM_GATE][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ }else{
+ pCreature = m_creature->SummonCreature(entry, SpawnPointSpecial[SPAWN_NEAR_TOWER][0], SpawnPointSpecial[SPAWN_NEAR_TOWER][1],SpawnPointSpecial[SPAWN_NEAR_TOWER][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ if(pCreature)
+ ((hyjal_trashAI*)pCreature->AI())->useFlyPath = true;
+ }
+ break;
+ case 17908: //GIANT_INFERNAL
+ InfernalCount++;
+ if(InfernalCount > 7)InfernalCount = 0;
+ pCreature = m_creature->SummonCreature(entry, InfernalPos[InfernalCount][0], InfernalPos[InfernalCount][1], InfernalPos[InfernalCount][2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ break;
+ default:
+ pCreature = m_creature->SummonCreature(entry, SpawnLoc[0], SpawnLoc[1], SpawnLoc[2], 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 120000);
+ break;
+
+ }
+
if(pCreature)
{
// Increment Enemy Count to be used in World States and instance script
++EnemyCount;
pCreature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
- pCreature->GetMotionMaster()->MovePoint(0, AttackLoc[0],AttackLoc[1],AttackLoc[2]);
- pCreature->AddThreat(m_creature, 0.0f);
+ //pCreature->GetMotionMaster()->MovePoint(0, AttackLoc[0],AttackLoc[1],AttackLoc[2]);
+ //pCreature->AddThreat(m_creature, 0.0f);
+ //DoZoneInCombat(pCreature);
pCreature->setActive(true);
- DoZoneInCombat(pCreature);
-
+ switch(entry)
+ {
+ case NECROMANCER:
+ case ABOMINATION:
+ case GHOUL:
+ case BANSHEE:
+ case CRYPT_FIEND:
+ case GARGOYLE:
+ case FROST_WYRM:
+ case GIANT_INFERNAL:
+ case FEL_STALKER:
+ case RAGE_WINTERCHILL:
+ case ANETHERON:
+ case KAZROGAL:
+ case AZGALOR:
+ ((hyjal_trashAI*)pCreature->AI())->IsEvent = true;
+ break;
+ }
+ if(pInstance)
+ {
+ if(pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE)
+ pCreature->SetDisableReputationGain(true);//no repu for solo farming
+ }
// Check if creature is a boss.
if (pCreature->isWorldBoss())
{
@@ -201,6 +525,7 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
error_log(ERROR_INST_DATA);
return;
}
+ InfernalCount = 0;//reset infernal count every new wave
EnemyCount = pInstance->GetData(DATA_TRASH);
for(uint8 i = 0; i < 18; ++i)
@@ -239,7 +564,7 @@ void hyjalAI::SummonNextWave(Wave wave[18], uint32 Count, float Base[4][3])
void hyjalAI::StartEvent(Player* player)
{
- if(!player)
+ if(!player || IsDummy)
return;
Talk(BEGIN);
@@ -256,6 +581,8 @@ void hyjalAI::StartEvent(Player* player)
UpdateWorldState(WORLD_STATE_WAVES, 0);
UpdateWorldState(WORLD_STATE_ENEMY, 0);
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, 0);
+
+ DeSpawnVeins();
}
uint32 hyjalAI::GetInstanceData(uint32 Event)
@@ -306,12 +633,12 @@ void hyjalAI::Talk(uint32 id)
void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
{
Map * map = m_creature->GetMap();
-
- if(!map->IsDungeon())
+
+ if(!map->IsDungeon())
return;
Map::PlayerList const& players = map->GetPlayers();
-
+
if (!players.isEmpty())
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -327,7 +654,7 @@ void hyjalAI::UpdateWorldState(uint32 id, uint32 state)
void hyjalAI::Retreat()
{
- CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ /*CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
@@ -340,18 +667,9 @@ void hyjalAI::Retreat()
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
- // Then get all Ancient Gem Veins. NOTE: Grid Search will only be able to find those in the grid.
- std::list<GameObject*> goList;
- Trinity::AllGameObjectsWithEntryInGrid go_check(185557);
- Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid> go_search(m_creature, goList, go_check);
- TypeContainerVisitor
- <Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInGrid>, GridTypeMapContainer> go_visit(go_search);
-
CellLock<GridReadGuard> cell_lock(cell, pair);
// Get Creatures
cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
- // Get GOs
- cell_lock->Visit(cell_lock, go_visit, *(m_creature->GetMap()));
CreatureList.clear();
if(!creatures.empty())
@@ -359,36 +677,199 @@ void hyjalAI::Retreat()
for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
{
(*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
CreatureList.push_back((*itr)->GetGUID());
}
DoCast(m_creature, SPELL_TELEPORT_VISUAL);
bRetreat = true;
RetreatTimer = 1000;
+ }*/
+ if(pInstance)
+ {
+ if(Faction == 0)
+ {
+ pInstance->SetData(DATA_ALLIANCE_RETREAT, 1);
+ AddWaypoint(0,JainaWPs[0][0],JainaWPs[0][1],JainaWPs[0][2]);
+ AddWaypoint(1,JainaWPs[1][0],JainaWPs[1][1],JainaWPs[1][2]);
+ Start(false, false, false);
+ SetDespawnAtEnd(false);//move to center of alliance base
+ }
+ if(Faction == 1)
+ {
+ pInstance->SetData(DATA_HORDE_RETREAT, 1);
+ Creature* JainaDummy = m_creature->SummonCreature(JAINA,JainaDummySpawn[0][0],JainaDummySpawn[0][1],JainaDummySpawn[0][2],JainaDummySpawn[0][3],TEMPSUMMON_TIMED_DESPAWN,60000);
+ if(JainaDummy)
+ {
+ JainaDummy->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
+ ((hyjalAI*)JainaDummy->AI())->IsDummy = true;
+ DummyGuid = JainaDummy->GetGUID();
+ //((hyjalAI*)JainaDummy->AI())->MassTeleportTimer = 20000;
+ //((hyjalAI*)JainaDummy->AI())->DoMassTeleport = true;
+ }
+ AddWaypoint(0,JainaDummySpawn[1][0],JainaDummySpawn[1][1],JainaDummySpawn[1][2]);
+ Start(false, false, false);
+ SetDespawnAtEnd(false);//move to center of alliance base
+ }
+ }
+ SpawnVeins();
+ Overrun = true;
+ m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);//cant talk after overrun event started
+}
+
+void hyjalAI::SpawnVeins()
+{
+ if(Faction == 0)
+ {
+ if (VeinsSpawned[0])//prevent any buggers
+ return;
+ for (uint8 i = 0; i<7; i++)
+ {
+ GameObject* gem = m_creature->SummonGameObject(ANCIENT_VEIN,VeinPos[i][0],VeinPos[i][1],VeinPos[i][2],VeinPos[i][3],VeinPos[i][4],VeinPos[i][5],VeinPos[i][6],VeinPos[i][7],0);
+ if(gem)
+ VeinGUID[i]=gem->GetGUID();
+ }
+ VeinsSpawned[0] = true;
+ }else{
+ if (VeinsSpawned[1])
+ return;
+ for (uint8 i = 7; i<14; i++)
+ {
+ GameObject* gem = m_creature->SummonGameObject(ANCIENT_VEIN,VeinPos[i][0],VeinPos[i][1],VeinPos[i][2],VeinPos[i][3],VeinPos[i][4],VeinPos[i][5],VeinPos[i][6],VeinPos[i][7],0);
+ if(gem)
+ VeinGUID[i]=gem->GetGUID();
+ }
+ VeinsSpawned[1] = true;
}
+}
- if(!goList.empty())
+void hyjalAI::DeSpawnVeins()
+{
+ if(!pInstance)return;
+ if(Faction == 1)
+ {
+ Creature* pUnit=Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (!pUnit)return;
+ hyjalAI* ai = ((hyjalAI*)pUnit->AI());
+ if(!ai)return;
+ for (uint8 i = 0; i<7; i++)
+ {
+ GameObject* gem = GameObject::GetGameObject((*m_creature), ai->VeinGUID[i]);
+ if(gem)
+ gem->RemoveFromWorld();
+ }
+ }else if (Faction)
{
- for(std::list<GameObject*>::iterator itr = goList.begin(); itr != goList.end(); ++itr)
- (*itr)->SetRespawnTime(5000);
+ Creature* pUnit=Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_THRALL));
+ if (!pUnit)return;
+ hyjalAI* ai = ((hyjalAI*)pUnit->AI());
+ if(!ai)return;
+ for (uint8 i = 7; i<14; i++)
+ {
+ GameObject* gem = GameObject::GetGameObject((*m_creature), ai->VeinGUID[i]);
+ if(gem)
+ gem->RemoveFromWorld();
+ }
}
}
void hyjalAI::UpdateAI(const uint32 diff)
{
+ if(IsDummy)
+ {
+ if(MassTeleportTimer < diff && DoMassTeleport)
+ {
+ m_creature->CastSpell(m_creature,SPELL_MASS_TELEPORT,false);
+ DoMassTeleport = false;
+ }else MassTeleportTimer -= diff;
+ return;
+ }
+ if(DoHide)
+ {
+ DoHide = false;
+ switch(m_creature->GetEntry())
+ {
+ case JAINA:
+ if(pInstance->GetData(DATA_ALLIANCE_RETREAT))
+ {
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ HideNearPos(5037.76, -1889.71);
+ for(uint8 i = 0; i < 92; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0);
+
+ }
+ else m_creature->SetVisibility(VISIBILITY_ON);
+ break;
+ case THRALL: //thrall
+ if(pInstance->GetData(DATA_HORDE_RETREAT))
+ {
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ HideNearPos(5563, -2763.19);
+ HideNearPos(5542.2, -2629.36);
+ for(uint8 i = 0; i < 65; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0);
+
+ }
+ else m_creature->SetVisibility(VISIBILITY_ON);
+ break;
+ }
+ }
+ if(DoRespawn)
+ {
+ if(RespawnTimer < diff)
+ {
+ DoRespawn = false;
+ RespawnNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ if(Faction == 0)
+ {
+ RespawnNearPos(5037.76, -1889.71);
+ }else if (Faction == 1)
+ {
+ RespawnNearPos(5563, -2763.19);
+ RespawnNearPos(5542.2, -2629.36);
+ }
+ m_creature->SetVisibility(VISIBILITY_ON);
+ }else{
+ RespawnTimer -= diff;
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ }
+ return;
+ }
+ if(Overrun)
+ DoOverrun(Faction, diff);
+ /* if(m_creature->GetEntry() == 17772)
+ {
+ if(!m_creature->HasAura(SPELL_BRILLIANCE_AURA,0))
+ DoCast(m_creature, SPELL_BRILLIANCE_AURA, true);
+ }*/
if(bRetreat)
{
if(RetreatTimer < diff)
{
+ IsDummy = true;
bRetreat = false;
- if(CreatureList.empty())
+ HideNearPos(m_creature->GetPositionX(), m_creature->GetPositionY());
+ switch(m_creature->GetEntry())
+ {
+ case JAINA://jaina
+ HideNearPos(5037.76, -1889.71);
+ break;
+ case THRALL://thrall
+ HideNearPos(5563, -2763.19);
+ HideNearPos(5542.2, -2629.36);
+ HideNearPos(5603.75, -2853.12);
+ break;
+ }
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ /*if(CreatureList.empty())
return;
for(std::list<uint64>::iterator itr = CreatureList.begin(); itr != CreatureList.end(); ++itr)
if(Unit* pUnit = Unit::GetUnit(*m_creature, *itr))
pUnit->SetVisibility(VISIBILITY_OFF);
-
- m_creature->SetVisibility(VISIBILITY_OFF);
+ CreatureList.clear();*/
}else RetreatTimer -= diff;
}
@@ -476,4 +957,220 @@ void hyjalAI::UpdateAI(const uint32 diff)
DoMeleeAttackIfReady();
}
+void hyjalAI::JustDied(Unit* killer)
+{
+ if(IsDummy)return;
+ m_creature->Respawn();
+ m_creature->SetVisibility(VISIBILITY_OFF);
+ DoRespawn = true;
+ RespawnTimer = 120000;
+ Talk(DEATH);
+ Summons.DespawnAll();//despawn all wave's summons
+ if(pInstance)
+ {//reset encounter if boss is despawned (ex: thrall is killed, boss despawns, event stucks at inprogress)
+ if(pInstance->GetData(DATA_RAGEWINTERCHILLEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_ANETHERONEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_KAZROGALEVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED);
+ if(pInstance->GetData(DATA_AZGALOREVENT) == IN_PROGRESS)
+ pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED);
+ pInstance->SetData(DATA_RESET_RAIDDAMAGE, NULL);//reset damage on die
+ }
+}
+void hyjalAI::HideNearPos(float x, float y)
+{
+ CellPair pair(Trinity::ComputeCellPair(x, y));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ // First get all creatures.
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(m_creature, creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ // Get Creatures
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ //CreatureList.clear();
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ (*itr)->SetVisibility(VISIBILITY_OFF);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
+ //CreatureList.push_back((*itr)->GetGUID());
+ }
+ }
+}
+void hyjalAI::RespawnNearPos(float x, float y)
+{
+ CellPair p(Trinity::ComputeCellPair(x, y));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::RespawnDo u_do;
+ Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(m_creature, u_do);
+ TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, obj_worker, *m_creature->GetMap());
+}
+void hyjalAI::WaypointReached(uint32 i)
+{
+ if(i == 1 || (i == 0 && m_creature->GetEntry() == THRALL))
+ {
+ m_creature->MonsterYell("Hurry, we don't have much time",0,0);
+ WaitForTeleport = true;
+ TeleportTimer = 20000;
+ if(m_creature->GetEntry() == JAINA)
+ m_creature->CastSpell(m_creature,SPELL_MASS_TELEPORT,false);
+ if(m_creature->GetEntry() == THRALL && DummyGuid)
+ {
+ Unit* Dummy = Unit::GetUnit((*m_creature),DummyGuid);
+ if(Dummy)
+ {
+ ((hyjalAI*)((Creature*)Dummy)->AI())->DoMassTeleport = true;
+ ((hyjalAI*)((Creature*)Dummy)->AI())->MassTeleportTimer = 20000;
+ Dummy->CastSpell(m_creature,SPELL_MASS_TELEPORT,false);
+ }
+ }
+ //do some talking
+ //all alive guards walk near here
+ CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ // First get all creatures.
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(m_creature, creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ if((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA)
+ {
+ if((*itr)->GetDistance(m_creature) >= 60)
+ (*itr)->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ float x, y, z;
+ (*itr)->SetDefaultMovementType(IDLE_MOTION_TYPE);
+ (*itr)->GetMotionMaster()->Initialize();
+ float range = 10;
+ if(m_creature->GetEntry() == THRALL)range = 20;
+ m_creature->GetNearPoint(m_creature, x, y, z, range, 0, m_creature->GetAngle((*itr)));
+ (*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5,5), y+irand(-5,5), m_creature->GetPositionZ());
+ }
+ }
+ }
+ }
+}
+void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
+{
+ npc_escortAI::UpdateAI(diff);
+ if(WaitForTeleport)
+ {
+ if(TeleportTimer < diff)
+ {
+ CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
+ Cell cell(pair);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ std::list<Creature*> creatures;
+ Trinity::AllFriendlyCreaturesInGrid creature_check(m_creature);
+ Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid> creature_searcher(m_creature, creatures, creature_check);
+ TypeContainerVisitor
+ <Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
+ GridTypeMapContainer> creature_visitor(creature_searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, pair);
+ cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+
+ if(!creatures.empty())
+ {
+ for(std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
+ {
+ if((*itr) && (*itr)->isAlive())
+ {
+ (*itr)->CastSpell(*itr, SPELL_TELEPORT_VISUAL, true);
+ (*itr)->setFaction(35);//make them friendly so mobs won't attack them
+ (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ }
+ }
+ DoCast(m_creature, SPELL_TELEPORT_VISUAL);
+ bRetreat = true;
+ RetreatTimer = 1000;
+ }
+ WaitForTeleport = false;
+ Teleported = true;
+ }TeleportTimer -= diff;
+ }
+ if(!Teleported)
+ return;
+ Overrun = false;//execute once
+ switch(faction)
+ {
+ case 0://alliance
+ for(uint8 i = 0; i < 92; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,AllianceFirePos[i][0],AllianceFirePos[i][1],AllianceFirePos[i][2],AllianceFirePos[i][3],AllianceFirePos[i][4],AllianceFirePos[i][5],AllianceFirePos[i][6],AllianceFirePos[i][7],0);
+
+ for(uint8 i = 0; i < 25; i++)//summon 25 ghouls
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ for(uint8 i = 0; i < 5; i++)//summon 5 abominations
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ for(uint8 i = 0; i < 5; i++)//summon 5 gargoyles
+ {
+ uint8 r = rand()%4;
+ Creature* pUnit = m_creature->SummonCreature(GARGOYLE, AllianceBase[r][0]+irand(-15,15), AllianceBase[r][1]+irand(-15,15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = Faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = i;
+ pUnit->setActive(true);
+ }
+ }
+ break;
+ case 1://horde
+ for(uint8 i = 0; i < 65; i++)//summon fires
+ m_creature->SummonGameObject(FLAMEOBJECT,HordeFirePos[i][0],HordeFirePos[i][1],HordeFirePos[i][2],HordeFirePos[i][3],HordeFirePos[i][4],HordeFirePos[i][5],HordeFirePos[i][6],HordeFirePos[i][7],0);
+
+ break;
+ }
+} \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
index 135afede0b7..ba75eaa36f2 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.h
@@ -6,17 +6,25 @@
#define SC_HYJALAI_H
#include "def_hyjal.h"
+#include "../../../npc/npc_escortAI.h"
// Trash Mobs summoned in waves
-#define NECROMANCER 17899
-#define ABOMINATION 17898
-#define GHOUL 17895
-#define BANSHEE 17905
-#define CRYPT_FIEND 17897
-#define GARGOYLE 17906
-#define FROST_WYRM 17907
-#define GIANT_INFERNAL 17908
-#define FEL_STALKER 17916
+#define NECROMANCER 17899//done
+#define ABOMINATION 17898//done
+#define GHOUL 17895//done
+#define BANSHEE 17905//done
+#define CRYPT_FIEND 17897//done
+#define GARGOYLE 17906//done
+#define FROST_WYRM 17907//done
+#define GIANT_INFERNAL 17908//done
+#define FEL_STALKER 17916//done
+
+#define JAINA 17772
+#define THRALL 17852
+#define TYRANDE 17948
+
+#define ANCIENT_VEIN 185557
+#define FLAMEOBJECT 182592
// Bosses summoned after every 8 waves
#define RAGE_WINTERCHILL 17767
@@ -25,10 +33,11 @@
#define AZGALOR 17842
#define ARCHIMONDE 17968
-#define SPELL_TELEPORT_VISUAL 41232
+#define SPELL_TELEPORT_VISUAL 41232
+#define SPELL_MASS_TELEPORT 16807
//Spells for Jaina
-#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon
+#define SPELL_BRILLIANCE_AURA 31260 // The database must handle this spell via creature_addon(it should, but is removed in evade..)
#define SPELL_BLIZZARD 31266
#define SPELL_PYROBLAST 31263
#define SPELL_SUMMON_ELEMENTALS 31264
@@ -51,7 +60,7 @@ static Wave AllianceWaves[]= // Waves that will b
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 120000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
// All 8 Waves are summoned, summon Rage Winterchill, next few waves are for Anetheron
@@ -60,10 +69,10 @@ static Wave AllianceWaves[]= // Waves that will b
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, 0, 0, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
+ {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, 0, 0, 0, 0, 0, 0, 120000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, BANSHEE, BANSHEE, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, GHOUL, GHOUL, 0, 0, 0, 0, 120000, false},
{GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
// All 8 Waves are summoned, summon Anatheron
{ANETHERON, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}
@@ -71,25 +80,25 @@ static Wave AllianceWaves[]= // Waves that will b
static Wave HordeWaves[]= // Waves that are summoned in the Horde base
{ // Kaz'Rogal Wave 1-8
- {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, FROST_WYRM, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, FROST_WYRM, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, FROST_WYRM, 0, 0, 0, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, FROST_WYRM, 0, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 240000, false},
// All 8 Waves are summoned, summon Kaz'Rogal, next few waves are for Azgalor
{KAZROGAL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true},
// Azgalor Wave 1-8
- {ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, FROST_WYRM, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 120000, false},
- {GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, 0, 0, 0, 0, 120000, false},
- {FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 120000, false},
- {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 120000, false},
- {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 0, 0, 120000, false},
- {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 180000, false},
+ {ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, FROST_WYRM, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, GARGOYLE, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GHOUL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 180000, false},
+ {GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, 0, 0, 0, 0, 180000, false},
+ {FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, 0, 0, 0, 0, 180000, false},
+ {NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, NECROMANCER, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, BANSHEE, 0, 0, 0, 0, 0, 0, 180000, false},
+ {GHOUL, GHOUL, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, GIANT_INFERNAL, 0, 0, 0, 0, 180000, false},
+ {CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, CRYPT_FIEND, FEL_STALKER, FEL_STALKER, ABOMINATION, ABOMINATION, ABOMINATION, ABOMINATION, BANSHEE, BANSHEE, BANSHEE, BANSHEE, NECROMANCER, NECROMANCER, 0, 0, 240000, false},
// All 8 Waves are summoned, summon Azgalor
{AZGALOR, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, true}
};
@@ -144,7 +153,7 @@ static Yells ThrallQuotes[]=
{DEATH, -1534017},
};
-struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
+struct TRINITY_DLL_DECL hyjalAI : public npc_escortAI
{
hyjalAI(Creature *c);
@@ -156,10 +165,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
void UpdateAI(const uint32 diff); // Called to summon waves, check for boss deaths and to cast our spells.
- void JustDied(Unit* killer) // Called on death, informs the raid that they have failed.
- {
- Talk(DEATH);
- }
+ void JustDied(Unit* killer); // Called on death, informs the raid that they have failed.
void SetFaction(uint32 _faction) // Set the faction to either Alliance or Horde in Hyjal
{
@@ -168,6 +174,16 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
void Retreat(); // "Teleport" (teleport visual + set invisible) all friendly creatures away from the base.
+ void SpawnVeins();
+ void DeSpawnVeins();
+ void JustSummoned(Creature *summoned);
+ void SummonedCreatureDespawn(Creature* summoned);
+ void HideNearPos(float x, float y);
+ void RespawnNearPos(float x, float y);
+ void WaypointReached(uint32 i);
+ void DoOverrun(uint32 faction, const uint32 diff);
+ void MoveInLineOfSight(Unit *who);
+
void SummonCreature(uint32 entry, float Base[4][3]); // Summons a creature for that wave in that base
// Summons the next wave, calls SummonCreature
@@ -185,6 +201,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
uint64 PlayerGUID;
uint64 BossGUID[2];
+ uint64 VeinGUID[14];
uint32 NextWaveTimer;
uint32 WaveCount;
@@ -199,6 +216,23 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
bool Summon;
bool bRetreat;
bool Debug;
+ bool VeinsSpawned[2];
+ uint8 InfernalCount;
+ SummonList Summons;
+ bool Overrun;
+ bool Teleported;
+ bool WaitForTeleport;
+ uint32 TeleportTimer;
+ uint32 OverrunCounter;
+ uint32 OverrunCounter2;
+ uint32 InfernalPoint;
+ uint32 RespawnTimer;
+ bool DoRespawn;
+ bool DoHide;
+ bool IsDummy;
+ uint32 MassTeleportTimer;
+ bool DoMassTeleport;
+ uint64 DummyGuid;
struct Spell
{
@@ -209,7 +243,7 @@ struct TRINITY_DLL_DECL hyjalAI : public ScriptedAI
private:
uint32 SpellTimer[3];
- std::list<uint64> CreatureList;
+ //std::list<uint64> CreatureList;
};
#endif
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
new file mode 100644
index 00000000000..3f6fd1044ff
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.cpp
@@ -0,0 +1,1516 @@
+
+#include "precompiled.h"
+#include "def_hyjal.h"
+#include "hyjal_trash.h"
+#include "hyjalAI.h"
+
+#define SPELL_METEOR 33814 //infernal visual
+#define SPELL_IMMOLATION 37059
+#define SPELL_FLAME_BUFFET 31724
+#define NPC_TRIGGER 21987 //World Trigger (Tiny)
+#define MODEL_INVIS 11686 //invisible model
+
+float HordeWPs[8][3]=//basic waypoints from spawn to leader
+{
+ {5492.91, -2404.61, 1462.63},
+ {5531.76, -2460.87, 1469.55},
+ {5554.58, -2514.66, 1476.12},
+ {5554.16, -2567.23, 1479.90},
+ {5540.67, -2625.99, 1480.89},
+ {5508.16, -2659.2, 1480.15},
+ {5489.62, -2704.05, 1482.18},
+ {5457.04, -2726.26, 1485.10}
+};
+float AllianceWPs[8][3]=//basic waypoints from spawn to leader
+{
+ {4896.08, -1576.35, 1333.65},
+ {4898.68, -1615.02, 1329.48},
+ {4907.12, -1667.08, 1321.00},
+ {4963.18, -1699.35, 1340.51},
+ {4989.16, -1716.67, 1335.74},//first WP in the base, after the gate
+ {5026.27, -1736.89, 1323.02},
+ {5037.77, -1770.56, 1324.36},
+ {5067.23, -1789.95, 1321.17}
+};
+
+float FrostWyrmWPs[3][3]=//waypoints for the frost wyrms in horde base
+{
+ {5580.82, -2628.83, 1528.28},
+ {5550.9, -2667.16, 1505.45},
+ {5459.64, -2725.91, 1484.83}
+};
+
+float GargoyleWPs[3][3]=//waypoints for the gargoyles in horde base
+{
+ {5533.66, -2634.32, 1495.33},
+ {5517.88, -2712.05, 1490.54},
+ {5459.64, -2725.91, 1484.83}
+};
+
+float FlyPathWPs[3][3]=//waypoints for the gargoyls and frost wyrms in horde base in wave 1/3
+{
+ {5531.96, -2772.83, 1516.68},
+ {5498.32, -2734.84, 1497.01},
+ {5456.67, -2725.48, 1493.08}
+};
+
+float AllianceOverrunWP[36][3]=//waypoints in the alliance base used in the end in the cleaning wave
+{
+ {4976.37,-1708.02,1339.43},//0spawn
+ {4994.83,-1725.52,1333.25},//1 start
+ {4982.92,-1753.7,1330.69},//2 end
+ {4996.75,-1721.47,1332.95},//3 start
+ {5015.74,-1755.05,1322.49},//4
+ {4998.68,-1773.44,1329.59},//5
+ {4994.83,-1725.52,1333.25},//6 start
+ {5022.8,-1735.46,1323.53},//7
+ {5052.15,-1729.02,1320.88},//8
+ {5082.43,-1726.29,1327.87},//9
+ {4994.83,-1725.52,1333.25},//10 start
+ {5018.92,-1751.14,1322.19},//11
+ {5040.09,-1792.09,1322.1},//12
+ {4994.83,-1725.52,1333.25},//13 start
+ {5023.47,-1748.1,1322.51},//14
+ {5013.43,-1842.39,1322.07},//15
+ {4994.83,-1725.52,1333.25},//16 start
+ {5020.8,-1756.86,1322.2},//17
+ {5019.53,-1824.6,1321.96},//18
+ {5043.42,-1853.75,1324.52},//19
+ {5053.02,-1864.13,1330.36},//20
+ {5062.49,-1852.47,1330.49},//21
+ {5049.32, -1726.31, 1320.64},//22 start
+ {5065.81, -1729.43, 1325.66},//23
+ {5096.63, -1742.22, 1329.61},//24
+ {5138.97, -1755.88, 1334.57},//25
+ {5163.27, -1789.08, 1337.04},//26
+ {5127.90, -1825.14, 1335.58},//27
+ {5089.68, -1846.88, 1328.99},//28
+ {5049.32, -1886.54, 1331.69},//29
+ {5002.33, -1893.98, 1325.88},//30
+ {4981.51, -1883.7, 1322.34},//31
+ {4983.25, -1857.4, 1320.48},//32
+ {5015.94, -1821.24, 1321.86},//33
+ {5027.97, -1775.25, 1321.87},//34
+ {5015.27, -1738.77, 1324.83}//35
+
+};
+
+float HordeOverrunWP[33][3]=//waypoints in the horde base used in the end in the cleaning wave
+{
+ {5510.4815, -2676.7112, 1480.4314},// 0 spawn
+ {5528.5, -2771.23, 1494.08},// 1 infernal 1
+ {5471.41, -2711.17, 1483.97},// 2 infernal 2
+ {5464.08, -2653.9, 1482.67},// 3 infernal 3
+ {5550.84, -2633.8, 1484.08},// 4 infernal 4
+ {5579.86, -2704.86, 1489.33},// 5 infernal 5
+ {5531.17, -2634.41, 1481.11},// 6 start
+ {5484.56, -2662.32, 1481.11},// 7 end
+ {5528.79, -2636.19, 1481.33},// 8 start
+ {5511.87, -2626.16, 1484.76},// 9 end
+ {5537.93, -2637.54, 1480.69},// 10 start
+ {5504.26, -2710.44, 1482.14},// 11
+ {5449.92, -2724.51, 1485.69},// 12
+ {5431.08, -2713.96, 1493.37},// 13 end
+ {5546.89, -2620.74, 1481.06},// 14 start
+ {5579.75, -2658.66, 1488.61},// 15
+ {5598.45, -2692.56, 1493.59},// 16 end
+ {5550.96, -2624.63, 1482.94},// 17 start
+ {5578.7, -2656.13, 1488.69},// 18
+ {5574.56, -2722.74, 1488.5},// 19
+ {5590.46, -2746.81, 1495},// 20
+ {5571.33, -2761.14, 1494.93},// 21
+ {5546.45, -2770.83, 1495.33},// 22
+ {5532.51, -2804.72, 1498.49},// 23
+ {5492.97, -2760.9, 1489.16},// 24
+ {5451.35, -2724.44, 1485.58},// 25
+ {5430.23, -2714.38, 1493.51},// 26 end
+ {5535.67, -2627.69, 1480.87},// 27 start
+ {5485.75, -2667.97, 1480.64},// 28
+ {5510.78, -2740.5, 1486.27},// 29
+ {5559.93, -2710.97, 1483.59},// 30
+ {5561.09, -2688.13, 1484.65},// 31
+ {5556.73, -2676.17, 1482.58}// 32 end
+};
+
+void hyjal_trashAI::Reset(){}
+
+hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c)
+{
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ IsEvent = false;
+ Delay = 0;
+ LastOverronPos = 0;
+ IsOverrun = false;
+ OverrunType = 0;
+ SetupOverrun = false;
+ faction = 0;
+ useFlyPath = false;
+ damageTaken = 0;
+ Reset();
+}
+
+void hyjal_trashAI::DamageTaken(Unit *done_by, uint32 &damage)
+{
+ if(done_by->GetTypeId() == TYPEID_PLAYER)
+ {
+ damageTaken += damage;
+ if(pInstance)
+ pInstance->SetData(DATA_RAIDDAMAGE,damage);//store raid's damage
+ }
+}
+
+void hyjal_trashAI::Aggro(Unit *who){}
+
+void hyjal_trashAI::UpdateAI(const uint32 diff)
+{
+ if(IsOverrun && !SetupOverrun)
+ {
+ SetupOverrun = true;
+ if(faction == 0)
+ {
+ for(uint8 i = 0; i < 4; i++)
+ AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ if(m_creature->GetEntry() == GHOUL)
+ {
+ switch(OverrunType)//0-19 ghouls, 20-24 abominations, 25-29 gargoyles
+ {
+ case 0:
+ AddWaypoint(4, AllianceOverrunWP[1][0]+irand(-3,3), AllianceOverrunWP[1][1]+irand(-3,3), AllianceOverrunWP[1][2]);
+ AddWaypoint(5, AllianceOverrunWP[2][0]+irand(-3,3), AllianceOverrunWP[2][1]+irand(-3,3), AllianceOverrunWP[2][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[2][0]+irand(-3,3), AllianceOverrunWP[2][1]+irand(-3,3), AllianceOverrunWP[2][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 5;
+ Start(true, true, true);
+ break;
+ case 1:
+ AddWaypoint(4, AllianceOverrunWP[3][0]+irand(-3,3), AllianceOverrunWP[3][1]+irand(-3,3), AllianceOverrunWP[3][2]);
+ AddWaypoint(5, AllianceOverrunWP[4][0]+irand(-3,3), AllianceOverrunWP[4][1]+irand(-3,3), AllianceOverrunWP[4][2]);
+ AddWaypoint(6, AllianceOverrunWP[5][0]+irand(-3,3), AllianceOverrunWP[5][1]+irand(-3,3), AllianceOverrunWP[5][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[5][0]+irand(-3,3), AllianceOverrunWP[5][1]+irand(-3,3), AllianceOverrunWP[5][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 2:
+ AddWaypoint(4, AllianceOverrunWP[6][0]+irand(-3,3), AllianceOverrunWP[6][1]+irand(-3,3), AllianceOverrunWP[6][2]);
+ AddWaypoint(5, AllianceOverrunWP[7][0]+irand(-3,3), AllianceOverrunWP[7][1]+irand(-3,3), AllianceOverrunWP[7][2]);
+ AddWaypoint(6, AllianceOverrunWP[8][0]+irand(-3,3), AllianceOverrunWP[8][1]+irand(-3,3), AllianceOverrunWP[8][2]);
+ AddWaypoint(7, AllianceOverrunWP[9][0]+irand(-3,3), AllianceOverrunWP[9][1]+irand(-3,3), AllianceOverrunWP[9][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[9][0]+irand(-3,3), AllianceOverrunWP[9][1]+irand(-3,3), AllianceOverrunWP[9][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 7;
+ Start(true, true, true);
+ break;
+ case 3:
+ AddWaypoint(4, AllianceOverrunWP[10][0]+irand(-3,3), AllianceOverrunWP[10][1]+irand(-3,3), AllianceOverrunWP[10][2]);
+ AddWaypoint(5, AllianceOverrunWP[11][0]+irand(-3,3), AllianceOverrunWP[11][1]+irand(-3,3), AllianceOverrunWP[11][2]);
+ AddWaypoint(6, AllianceOverrunWP[12][0]+irand(-3,3), AllianceOverrunWP[12][1]+irand(-3,3), AllianceOverrunWP[12][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[12][0]+irand(-3,3), AllianceOverrunWP[12][1]+irand(-3,3), AllianceOverrunWP[12][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 4:
+ AddWaypoint(4, AllianceOverrunWP[13][0]+irand(-3,3), AllianceOverrunWP[13][1]+irand(-3,3), AllianceOverrunWP[13][2]);
+ AddWaypoint(5, AllianceOverrunWP[14][0]+irand(-3,3), AllianceOverrunWP[14][1]+irand(-3,3), AllianceOverrunWP[14][2]);
+ AddWaypoint(6, AllianceOverrunWP[15][0]+irand(-3,3), AllianceOverrunWP[15][1]+irand(-3,3), AllianceOverrunWP[15][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[15][0]+irand(-3,3), AllianceOverrunWP[15][1]+irand(-3,3), AllianceOverrunWP[15][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 6;
+ Start(true, true, true);
+ break;
+ case 5:
+ AddWaypoint(4, AllianceOverrunWP[16][0]+irand(-3,3), AllianceOverrunWP[16][1]+irand(-3,3), AllianceOverrunWP[16][2]);
+ AddWaypoint(5, AllianceOverrunWP[17][0]+irand(-3,3), AllianceOverrunWP[17][1]+irand(-3,3), AllianceOverrunWP[17][2]);
+ AddWaypoint(6, AllianceOverrunWP[18][0]+irand(-3,3), AllianceOverrunWP[18][1]+irand(-3,3), AllianceOverrunWP[18][2]);
+ AddWaypoint(7, AllianceOverrunWP[19][0]+irand(-3,3), AllianceOverrunWP[19][1]+irand(-3,3), AllianceOverrunWP[19][2]);
+ AddWaypoint(8, AllianceOverrunWP[20][0]+irand(-3,3), AllianceOverrunWP[20][1]+irand(-3,3), AllianceOverrunWP[20][2]);
+ AddWaypoint(9, AllianceOverrunWP[21][0]+irand(-3,3), AllianceOverrunWP[21][1]+irand(-3,3), AllianceOverrunWP[21][2]);
+ m_creature->SetHomePosition(AllianceOverrunWP[21][0]+irand(-3,3), AllianceOverrunWP[21][1]+irand(-3,3), AllianceOverrunWP[21][2],0);
+ SetDespawnAtEnd(false);
+ LastOverronPos = 9;
+ Start(true, true, true);
+ break;
+ default:
+ AddWaypoint( 4, AllianceOverrunWP[35][0]+irand(-3,3), AllianceOverrunWP[35][1]+irand(-3,3), AllianceOverrunWP[35][2]);
+ AddWaypoint( 5, AllianceOverrunWP[34][0]+irand(-3,3), AllianceOverrunWP[34][1]+irand(-3,3), AllianceOverrunWP[34][2]);
+ AddWaypoint( 6, AllianceOverrunWP[33][0]+irand(-3,3), AllianceOverrunWP[33][1]+irand(-3,3), AllianceOverrunWP[33][2]);
+ AddWaypoint( 7, AllianceOverrunWP[32][0]+irand(-3,3), AllianceOverrunWP[32][1]+irand(-3,3), AllianceOverrunWP[32][2]);
+ AddWaypoint( 8, AllianceOverrunWP[31][0]+irand(-3,3), AllianceOverrunWP[31][1]+irand(-3,3), AllianceOverrunWP[31][2]);
+ AddWaypoint( 9, AllianceOverrunWP[30][0]+irand(-3,3), AllianceOverrunWP[30][1]+irand(-3,3), AllianceOverrunWP[30][2]);
+ AddWaypoint(10, AllianceOverrunWP[29][0]+irand(-3,3), AllianceOverrunWP[29][1]+irand(-3,3), AllianceOverrunWP[29][2]);
+ AddWaypoint(11, AllianceOverrunWP[28][0]+irand(-3,3), AllianceOverrunWP[28][1]+irand(-3,3), AllianceOverrunWP[28][2]);
+ AddWaypoint(12, AllianceOverrunWP[27][0]+irand(-3,3), AllianceOverrunWP[27][1]+irand(-3,3), AllianceOverrunWP[27][2]);
+ AddWaypoint(13, AllianceOverrunWP[26][0]+irand(-3,3), AllianceOverrunWP[26][1]+irand(-3,3), AllianceOverrunWP[26][2]);
+ AddWaypoint(14, AllianceOverrunWP[25][0]+irand(-3,3), AllianceOverrunWP[25][1]+irand(-3,3), AllianceOverrunWP[25][2]);
+ AddWaypoint(15, AllianceOverrunWP[24][0]+irand(-3,3), AllianceOverrunWP[24][1]+irand(-3,3), AllianceOverrunWP[24][2]);
+ AddWaypoint(16, AllianceOverrunWP[23][0]+irand(-3,3), AllianceOverrunWP[23][1]+irand(-3,3), AllianceOverrunWP[23][2]);
+ AddWaypoint(17, AllianceOverrunWP[22][0]+irand(-3,3), AllianceOverrunWP[22][1]+irand(-3,3), AllianceOverrunWP[22][2]);
+ //m_creature->SetHomePosition(AllianceOverrunWP[0][0]+irand(-3,3), AllianceOverrunWP[0][1]+irand(-3,3), AllianceOverrunWP[0][2],0);
+ SetDespawnAtEnd(true);
+ LastOverronPos = 17;
+ Start(true, true, true);
+ break;
+ }
+ }
+ //}else if(faction == 1 && m_creature->GetEntry() != GARGOYLE){
+ // switch(OverrunType)
+ // {
+ // case 0:break;//infernal
+ // case 1:
+ // AddWaypoint(0, HordeOverrunWP[6][0], HordeOverrunWP[6][1], HordeOverrunWP[6][2]);
+ // AddWaypoint(1, HordeOverrunWP[7][0]+irand(-3,3), HordeOverrunWP[7][1]+irand(-3,3), HordeOverrunWP[7][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 2:
+ // AddWaypoint(0, HordeOverrunWP[6][0], HordeOverrunWP[6][1], HordeOverrunWP[6][2]);
+ // AddWaypoint(1, HordeOverrunWP[7][0]+irand(-3,3), HordeOverrunWP[7][1]+irand(-3,3), HordeOverrunWP[7][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 3:
+ // AddWaypoint(0, HordeOverrunWP[8][0], HordeOverrunWP[8][1], HordeOverrunWP[8][2]);
+ // AddWaypoint(1, HordeOverrunWP[9][0]+irand(-3,3), HordeOverrunWP[9][1]+irand(-3,3), HordeOverrunWP[9][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 1;
+ // Start(true, true, true);
+ // break;
+ // case 4:
+ // AddWaypoint(0, HordeOverrunWP[10][0], HordeOverrunWP[10][1], HordeOverrunWP[10][2]);
+ // AddWaypoint(1, HordeOverrunWP[11][0], HordeOverrunWP[11][1], HordeOverrunWP[11][2]);
+ // AddWaypoint(2, HordeOverrunWP[12][0], HordeOverrunWP[12][1], HordeOverrunWP[12][2]);
+ // AddWaypoint(3, HordeOverrunWP[13][0]+irand(-3,3), HordeOverrunWP[13][1]+irand(-3,3), HordeOverrunWP[13][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 3;
+ // Start(true, true, true);
+ // break;
+ // case 5:
+ // AddWaypoint(0, HordeOverrunWP[14][0], HordeOverrunWP[14][1], HordeOverrunWP[14][2]);
+ // AddWaypoint(1, HordeOverrunWP[15][0], HordeOverrunWP[15][1], HordeOverrunWP[15][2]);
+ // AddWaypoint(2, HordeOverrunWP[16][0]+irand(-3,3), HordeOverrunWP[16][1]+irand(-3,3), HordeOverrunWP[16][2]);
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 2;
+ // Start(true, true, true);
+ // break;
+ // case 6:
+ // AddWaypoint(0, HordeOverrunWP[17][0], HordeOverrunWP[17][1], HordeOverrunWP[17][2]);
+ // AddWaypoint(1, HordeOverrunWP[18][0], HordeOverrunWP[18][1], HordeOverrunWP[18][2]);
+ // AddWaypoint(2, HordeOverrunWP[19][0], HordeOverrunWP[19][1], HordeOverrunWP[19][2]);
+ // AddWaypoint(3, HordeOverrunWP[20][0], HordeOverrunWP[20][1], HordeOverrunWP[20][2]);
+ // AddWaypoint(4, HordeOverrunWP[21][0], HordeOverrunWP[21][1], HordeOverrunWP[21][2]);
+ // AddWaypoint(5, HordeOverrunWP[22][0], HordeOverrunWP[22][1], HordeOverrunWP[22][2]);
+ // AddWaypoint(6, HordeOverrunWP[23][0], HordeOverrunWP[23][1], HordeOverrunWP[23][2]);
+ // AddWaypoint(7, HordeOverrunWP[24][0], HordeOverrunWP[24][1], HordeOverrunWP[24][2]);
+ // AddWaypoint(8, HordeOverrunWP[25][0], HordeOverrunWP[25][1], HordeOverrunWP[25][2]);
+ // AddWaypoint(9, HordeOverrunWP[26][0]+irand(-3,3), HordeOverrunWP[26][1]+irand(-3,3), HordeOverrunWP[26][2]);
+ // SetDespawnAtEnd(true);
+ // LastOverronPos = 9;
+ // Start(true, true, true);
+ // break;
+ // case 7:
+ // AddWaypoint(0, HordeOverrunWP[27][0], HordeOverrunWP[27][1], HordeOverrunWP[27][2]);
+ // AddWaypoint(1, HordeOverrunWP[28][0], HordeOverrunWP[28][1], HordeOverrunWP[28][2]);
+ // AddWaypoint(2, HordeOverrunWP[29][0], HordeOverrunWP[29][1], HordeOverrunWP[29][2]);
+ // AddWaypoint(3, HordeOverrunWP[30][0], HordeOverrunWP[30][1], HordeOverrunWP[30][2]);
+ // AddWaypoint(4, HordeOverrunWP[31][0], HordeOverrunWP[31][1], HordeOverrunWP[31][2]);
+ // AddWaypoint(5, HordeOverrunWP[32][0]+irand(-3,3), HordeOverrunWP[32][1]+irand(-3,3), HordeOverrunWP[32][2]);
+ // SetDespawnAtEnd(true);
+ // LastOverronPos = 5;
+ // Start(true, true, true);
+ // break;
+ // }
+ //}else if(faction == 1 && m_creature->GetEntry() == GARGOYLE){
+ // AddWaypoint(0, 5536.65+irand(-80,+80), -2710.66+irand(-80,+80), 1504.45+irand(-5,+5));
+ // SetDespawnAtEnd(false);
+ // LastOverronPos = 0;
+ // Start(false, true, true);
+ }
+ }
+}
+
+void hyjal_trashAI::JustDied(Unit *victim)
+{
+ if(!pInstance)return;
+ if(IsEvent && !m_creature->isWorldBoss())
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ if((pInstance->GetData(DATA_RAIDDAMAGE) < MINRAIDDAMAGE && !m_creature->isWorldBoss()) || (damageTaken < m_creature->GetMaxHealth()/2 && m_creature->isWorldBoss()))
+ m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);//no loot
+
+ if(IsOverrun)
+ {
+ float x,y,z,o;
+ m_creature->GetHomePosition(x,y,z,o);
+ Creature* pUnit = m_creature->SummonCreature(m_creature->GetEntry(),x,y,z,o, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = OverrunType;
+ ((hyjal_trashAI*)pUnit->AI())->SetupOverrun = true;
+ pUnit->setActive(true);
+ pUnit->AI()->EnterEvadeMode();
+ }
+ }
+}
+
+struct mob_giant_infernalAI : public hyjal_trashAI
+{
+ mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ meteor = false;//call once!
+ CanMove = false;
+ Delay = rand()%10000;
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_INVIS);
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool meteor;
+ bool CanMove;
+ bool WpEnabled;
+ bool go;
+ uint32 pos;
+ uint32 spawnTimer;
+ uint32 FlameBuffetTimer;
+ bool imol;
+
+ void Reset()
+ {
+ spawnTimer = 2000;
+ FlameBuffetTimer= 2000;
+ imol = false;
+ }
+
+ void Aggro(Unit* who) {}
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 0 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(Delay<diff)
+ {
+ Delay=0;
+ }else{
+ Delay-=diff;
+ return;
+ }
+ if (!meteor)
+ {
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ Creature* trigger = m_creature->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,m_creature->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000);
+ if(trigger)
+ {
+ trigger->SetVisibility(VISIBILITY_OFF);
+ trigger->setFaction(m_creature->getFaction());
+ trigger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ trigger->CastSpell(m_creature,SPELL_METEOR,true);
+ }
+ m_creature->GetMotionMaster()->Clear();
+ meteor = true;
+ }else if (!CanMove){
+ if(spawnTimer<diff)
+ {
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, m_creature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
+ CanMove = true;
+ /*if (m_creature->getVictim())
+ m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());*/
+ if (pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT))
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,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(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+
+ if (!UpdateVictim())
+ return;
+ if(!imol)
+ {
+ DoCast(m_creature,SPELL_IMMOLATION);
+ imol=true;
+ }
+ if(FlameBuffetTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_FLAME_BUFFET,true);
+ FlameBuffetTimer = 7000;
+ }else FlameBuffetTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_giant_infernal(Creature* _Creature)
+{
+ return new mob_giant_infernalAI(_Creature);
+}
+
+#define SPELL_DISEASE_CLOUD 31607
+#define SPELL_KNOCKDOWN 31610
+
+struct mob_abominationAI : public hyjal_trashAI
+{
+ mob_abominationAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 KnockDownTimer;
+ uint32 pos;
+ void Reset()
+ {
+ KnockDownTimer = 10000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if(!m_creature->HasAura(SPELL_DISEASE_CLOUD,0))
+ DoCast(m_creature,SPELL_DISEASE_CLOUD);
+ if (!UpdateVictim())
+ return;
+ if(KnockDownTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_KNOCKDOWN);
+ KnockDownTimer = 30000+rand()%25000;
+ }else KnockDownTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_abomination(Creature* _Creature)
+{
+ return new mob_abominationAI(_Creature);
+}
+
+#define SPELL_FRENZY 31540
+
+struct mob_ghoulAI : public hyjal_trashAI
+{
+ mob_ghoulAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 FrenzyTimer;
+ uint32 pos;
+ void Reset()
+ {
+ FrenzyTimer = 5000+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* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if(faction == 0)//alliance round
+ {
+
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED);
+ //m_creature->SetHomePosition(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation());
+ if(faction == 0 && LastOverronPos == 17)//alliance round
+ {
+ Creature* pUnit = m_creature->SummonCreature(m_creature->GetEntry(),4928.48+irand(-10,10), -1526.38+irand(-10,10), 1326.83+irand(-10,10),0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ ((hyjal_trashAI*)pUnit->AI())->faction = faction;
+ ((hyjal_trashAI*)pUnit->AI())->IsOverrun = true;
+ ((hyjal_trashAI*)pUnit->AI())->OverrunType = 6;//default
+ ((hyjal_trashAI*)pUnit->AI())->SetupOverrun = false;
+ pUnit->setActive(true);
+ }
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if(FrenzyTimer<diff)
+ {
+ DoCast(m_creature,SPELL_FRENZY);
+ FrenzyTimer = 15000+rand()%15000;
+ }else FrenzyTimer -= diff;
+ if (!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_ghoul(Creature* _Creature)
+{
+ return new mob_ghoulAI(_Creature);
+}
+
+#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
+{
+ mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(m_creature)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+ SummonList summons;
+ bool go;
+ uint32 ShadowBoltTimer;
+ uint32 pos;
+ void Reset()
+ {
+ ShadowBoltTimer = 1000+rand()%5000;
+ summons.DespawnAll();
+ }
+
+ void JustSummoned(Creature* summon)
+ {
+ Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0,30,true);
+ if(target && summon)
+ summon->Attack(target,false);
+ summons.Summon(summon);
+ }
+ void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);}
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void KilledUnit(Unit* victim)
+ {
+ switch (rand()%3)
+ {
+ 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:
+ if(rand()%2)
+ DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ else
+ DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000);
+ break;
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(true, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(ShadowBoltTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_SHADOW_BOLT);
+ ShadowBoltTimer = 20000+rand()%10000;
+ }else ShadowBoltTimer -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_necromancer(Creature* _Creature)
+{
+ return new mob_necromancerAI(_Creature);
+}
+
+#define SPELL_BANSHEE_CURSE 31651
+#define SPELL_BANSHEE_WAIL 38183
+#define SPELL_ANTI_MAGIC_SHELL 31662
+
+struct mob_bansheeAI : public hyjal_trashAI
+{
+ mob_bansheeAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 CourseTimer;
+ uint32 WailTimer;
+ uint32 ShellTimer;
+ uint32 pos;
+ void Reset()
+ {
+ CourseTimer = 20000+rand()%5000;
+ WailTimer = 15000+rand()%5000;
+ ShellTimer = 50000+rand()%10000;
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 7 && pInstance && !IsOverrun)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(CourseTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_BANSHEE_CURSE);
+ CourseTimer = 20000+rand()%5000;
+ }else CourseTimer -= diff;
+ if(WailTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_BANSHEE_WAIL);
+ WailTimer = 15000+rand()%5000;
+ }else WailTimer -= diff;
+ if(ShellTimer<diff)
+ {
+ DoCast(m_creature,SPELL_ANTI_MAGIC_SHELL);
+ ShellTimer = 50000+rand()%10000;
+ }else ShellTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_banshee(Creature* _Creature)
+{
+ return new mob_bansheeAI(_Creature);
+}
+
+#define SPELL_WEB 28991
+
+struct mob_crypt_fiendAI : public hyjal_trashAI
+{
+ mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 WebTimer;
+ uint32 pos;
+ void Reset()
+ {
+ 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* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(WebTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_WEB);
+ WebTimer = 20000+rand()%5000;
+ }else WebTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_crypt_fiend(Creature* _Creature)
+{
+ return new mob_crypt_fiendAI(_Creature);
+}
+
+#define SPELL_MANA_BURN 31729
+
+struct mob_fel_stalkerAI : public hyjal_trashAI
+{
+ mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ 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* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }else{
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_JAINAPROUDMOORE));
+ if (target && target->isAlive())
+ m_creature->AddThreat(target,0.0);
+ }
+ }
+ if (i == LastOverronPos && IsOverrun)
+ {
+ Creature* pUnit = m_creature->SummonCreature(17931, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 2*60*1000);
+ if(pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ pUnit->SetMaxHealth(10000000);
+ pUnit->SetHealth(10000000);
+ pUnit->setFaction(17772);
+ pUnit->Attack(m_creature, true);
+ m_creature->AddThreat(pUnit,0);
+ }
+ }
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ npc_escortAI::UpdateAI(diff);
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else//use alliance WPs
+ {
+ for (uint8 i = 0; i < 8; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(ManaBurnTimer<diff)
+ {
+ DoCast(m_creature->getVictim(),SPELL_MANA_BURN);
+ ManaBurnTimer = 9000+rand()%5000;
+ }else ManaBurnTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+CreatureAI* GetAI_mob_fel_stalker(Creature* _Creature)
+{
+ return new mob_fel_stalkerAI(_Creature);
+}
+
+#define SPELL_FROST_BREATH 31688
+
+struct mob_frost_wyrmAI : public hyjal_trashAI
+{
+ mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 FrostBreathTimer;
+ uint32 pos;
+ uint32 MoveTimer;
+
+ void Reset()
+ {
+ FrostBreathTimer = 5000;
+ MoveTimer = 0;
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 2 && pInstance && !IsOverrun)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ {
+ m_creature->AddThreat(target,0.0);
+ DoCast(target,SPELL_FROST_BREATH,true);
+ }
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ z = m_creature->GetMap()->GetVmapHeight(x, y, z, true);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z);
+ m_creature->Relocate(x,y,z,0);
+ }
+
+ void Aggro(Unit* who) {}
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ {
+ ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ npc_escortAI::UpdateAI(diff);
+ }
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if(!useFlyPath)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else{//fly path FlyPathWPs
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(m_creature->GetDistance(m_creature->getVictim()) >= 25){
+ if(MoveTimer<diff)
+ {
+ m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
+ MoveTimer = 2000;
+ }else MoveTimer-=diff;
+ }
+
+ if(FrostBreathTimer<diff)
+ {
+ if(m_creature->GetDistance(m_creature->getVictim()) < 25)
+ {
+ DoCast(m_creature->getVictim(),SPELL_FROST_BREATH);
+ m_creature->StopMoving();
+ m_creature->GetMotionMaster()->Clear();
+ FrostBreathTimer = 4000;
+ }
+ }else FrostBreathTimer -= diff;
+ }
+};
+
+
+CreatureAI* GetAI_mob_frost_wyrm(Creature* _Creature)
+{
+ return new mob_frost_wyrmAI(_Creature);
+}
+
+#define SPELL_GARGOYLE_STRIKE 31664
+
+struct mob_gargoyleAI : public hyjal_trashAI
+{
+ mob_gargoyleAI(Creature* c) : hyjal_trashAI(c)
+ {
+ pInstance = ((ScriptedInstance*)c->GetInstanceData());
+ go = false;
+ pos = 0;
+ Reset();
+ }
+
+ bool go;
+ uint32 StrikeTimer;
+ uint32 pos;
+ uint32 MoveTimer;
+ float Zpos;
+ bool forcemove;
+
+ void Reset()
+ {
+ forcemove = true;
+ Zpos = 10.0;
+ StrikeTimer = 2000+rand()%5000;
+ MoveTimer = 0;
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
+ }
+
+ void WaypointReached(uint32 i)
+ {
+ pos = i;
+ if (i == 2 && pInstance && !IsOverrun)
+ {
+ Unit* target = Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_THRALL));
+ if (target && target->isAlive())
+ {
+ m_creature->AddThreat(target,0.0);
+ DoCast(target,SPELL_GARGOYLE_STRIKE,true);
+ }
+ }
+ if (IsOverrun && i == LastOverronPos)
+ {
+ AddWaypoint(0, 5536.65+irand(-80,80), -2710.66+irand(-80,80), 1504.45+irand(-10,10));
+ AddWaypoint(1, 5536.65+irand(-80,80), -2710.66+irand(-80,80), 1504.45+irand(-10,10));
+ SetDespawnAtEnd(false);
+ LastOverronPos = 1;
+ Start(false, true, true);
+ }
+ }
+
+ void JustDied(Unit *victim)
+ {
+ if(pInstance && IsEvent)
+ pInstance->SetData(DATA_TRASH, 0);//signal trash is dead
+
+ float x,y,z;
+ m_creature->GetPosition(x,y,z);
+ z = m_creature->GetMap()->GetVmapHeight(x, y, z, true);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z);
+ m_creature->Relocate(x,y,z,0);
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ hyjal_trashAI::UpdateAI(diff);
+ if(IsEvent || IsOverrun)
+ {
+ ((hyjal_trashAI*)m_creature->AI())->SetCanMelee(false);
+ npc_escortAI::UpdateAI(diff);
+ }
+ if (IsEvent)
+ {
+ if(!go)
+ {
+ go = true;
+ if(pInstance)
+ {
+ if(!useFlyPath)
+ {
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }else{//fly path FlyPathWPs
+ for (uint8 i = 0; i < 3; ++i)
+ ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]);
+ ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
+ ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
+ }
+ }
+ }
+ }
+ if (!UpdateVictim())
+ return;
+ if(m_creature->GetDistance(m_creature->getVictim()) >= 20 || forcemove)
+ {
+ forcemove = false;
+ if(forcemove)
+ {
+ Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
+ if(target)
+ m_creature->Attack(target,false);
+ }
+ if(MoveTimer<diff)
+ {
+ float x,y,z;
+ m_creature->getVictim()->GetPosition(x,y,z);
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z+Zpos);
+ Zpos-=1.0;
+ if(Zpos<=0)Zpos=0;
+ MoveTimer = 2000;
+ }else MoveTimer-=diff;
+ }
+ if(StrikeTimer<diff)
+ {
+ if(m_creature->GetDistance(m_creature->getVictim()) < 20)
+ {
+ DoCast(m_creature->getVictim(),SPELL_GARGOYLE_STRIKE);
+ m_creature->StopMoving();
+ m_creature->GetMotionMaster()->Clear();
+ StrikeTimer = 2000+rand()%1000;
+ }else StrikeTimer=0;
+ }else StrikeTimer -= diff;
+ }
+};
+
+
+CreatureAI* GetAI_mob_gargoyle(Creature* _Creature)
+{
+ return new mob_gargoyleAI(_Creature);
+}
+
+#define SPELL_EXPLODING_SHOT 7896
+
+struct TRINITY_DLL_DECL alliance_riflemanAI : public Scripted_NoMovementAI
+{
+ alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c)
+ {
+ Reset();
+ }
+
+ uint32 ExplodeTimer;
+
+ void JustDied(Unit*)
+ {
+ }
+
+ void Reset()
+ {
+ ExplodeTimer = 5000+rand()%5000;
+ }
+
+ void MoveInLineOfSight(Unit *who)
+ {
+ if (!who || m_creature->getVictim())
+ return;
+
+ if (who->isTargetableForAttack() && m_creature->IsHostileTo(who))
+ {
+ float attackRadius = m_creature->GetAttackDistance(who);
+ if (m_creature->IsWithinDistInMap(who, 30))
+ {
+ AttackStart(who);
+ }
+ }
+ }
+
+ void Aggro(Unit *who)
+ {
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ //Check if we have a target
+ if (!UpdateVictim())
+ return;
+ if(ExplodeTimer < diff)
+ {
+ if (!m_creature->IsWithinDistInMap(m_creature->getVictim(), 30))
+ {
+ EnterEvadeMode();
+ return;
+ }
+ int dmg = 500+rand()%700;
+ m_creature->CastCustomSpell(m_creature->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false);
+ ExplodeTimer = 5000+rand()%5000;
+ }else ExplodeTimer -= diff;
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_alliance_rifleman(Creature* _Creature)
+{
+ return new alliance_riflemanAI(_Creature);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
new file mode 100644
index 00000000000..3ea12038436
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjal_trash.h
@@ -0,0 +1,40 @@
+
+#ifndef SC_HYJAL_TRASH_AI_H
+#define SC_HYJAL_TRASH_AI_H
+
+#include "def_hyjal.h"
+#include "../../../npc/npc_escortAI.h"
+
+#define MINRAIDDAMAGE 1000000//minimal damage before trash can drop loot and reputation
+
+struct TRINITY_DLL_DECL hyjal_trashAI : public npc_escortAI
+{
+ hyjal_trashAI(Creature *c);
+
+ void Reset();
+
+ //void EnterEvadeMode();
+
+ void Aggro(Unit *who);
+
+ void UpdateAI(const uint32 diff);
+
+ void JustDied(Unit* killer);
+
+ void DamageTaken(Unit *done_by, uint32 &damage);
+
+ public:
+ ScriptedInstance* pInstance;
+ bool IsEvent;
+ uint32 Delay;
+ uint32 LastOverronPos;
+ bool IsOverrun;
+ bool SetupOverrun;
+ uint32 OverrunType;
+ uint8 faction;
+ bool useFlyPath;
+ uint32 damageTaken;
+
+ //private:
+};
+#endif \ No newline at end of file
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
index 63256988e27..13844079b84 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/instance_hyjal.cpp
@@ -23,6 +23,7 @@ EndScriptData */
#include "precompiled.h"
#include "def_hyjal.h"
+#include "hyjal_trash.h"
#define ENCOUNTERS 5
@@ -49,9 +50,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
uint64 JainaProudmoore;
uint64 Thrall;
uint64 TyrandeWhisperwind;
+ uint64 HordeGate;
+ uint64 ElfGate;
uint32 Trash;
+
+ uint32 hordeRetreat;
+ uint32 allianceRetreat;
+ bool ArchiYell;
+
+ uint32 RaidDamage;
+
void Initialize()
{
RageWinterchill = 0;
@@ -62,10 +72,18 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
JainaProudmoore = 0;
Thrall = 0;
TyrandeWhisperwind = 0;
+ HordeGate = 0;
+ ElfGate = 0;
+ ArchiYell = false;
+ RaidDamage = 0;
Trash = 0;
for(uint8 i = 0; i < ENCOUNTERS; ++i)
Encounters[i] = NOT_STARTED;
+
+ hordeRetreat = 0;
+ allianceRetreat = 0;
+
}
bool IsEncounterInProgress() const
@@ -76,6 +94,32 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
return false;
}
+ void OnObjectCreate(GameObject *go)
+ {
+ switch(go->GetEntry())
+ {
+ case 182060:
+ HordeGate = go->GetGUID();
+ if(allianceRetreat)
+ go->SetGoState(0);
+ else
+ go->SetGoState(1);
+ break;
+ case 182061:
+ ElfGate = go->GetGUID();
+ if(hordeRetreat)
+ go->SetGoState(0);
+ else
+ go->SetGoState(1);
+ break;
+ }
+ }
+
+ void OpenDoor(uint64 DoorGUID, bool open)
+ {
+ HandleGameObject(DoorGUID, open, NULL);
+ }
+
void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{
switch(creature->GetEntry())
@@ -113,9 +157,49 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
switch(type)
{
case DATA_RAGEWINTERCHILLEVENT: Encounters[0] = data; break;
- case DATA_ANETHERONEVENT: Encounters[1] = data; break;
+ case DATA_ANETHERONEVENT:
+ Encounters[1] = data;
+ break;
case DATA_KAZROGALEVENT: Encounters[2] = data; break;
- case DATA_AZGALOREVENT: Encounters[3] = data; break;
+ case DATA_AZGALOREVENT:
+ {
+ Encounters[3] = data;
+ if(data==DONE)
+ {
+ if(ArchiYell)break;
+ ArchiYell = true;
+
+ Creature* pCreature = instance->GetCreatureInMap(Azgalor);
+ if(pCreature)
+ {
+ Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);
+
+ Map *map = pCreature->GetMap();
+ if (map->IsDungeon() && pUnit)
+ {
+ pUnit->SetVisibility(VISIBILITY_OFF);
+ 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())
+ {
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+ pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,"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.",0,"Archimonde",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: Encounters[4] = data; break;
case DATA_RESET_TRASH_COUNT: Trash = 0; break;
@@ -124,6 +208,24 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
else Trash--;
UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
break;
+ case DATA_ALLIANCE_RETREAT:
+ allianceRetreat = data;
+ OpenDoor(HordeGate,true);
+ SaveToDB();
+ break;
+ case DATA_HORDE_RETREAT:
+ hordeRetreat = data;
+ OpenDoor(ElfGate,true);
+ SaveToDB();
+ break;
+ case DATA_RAIDDAMAGE:
+ RaidDamage += data;
+ if(RaidDamage >= MINRAIDDAMAGE)
+ RaidDamage = MINRAIDDAMAGE;
+ break;
+ case DATA_RESET_RAIDDAMAGE:
+ RaidDamage = 0;
+ break;
}
debug_log("SD2: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data);
@@ -134,7 +236,9 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
std::ostringstream saveStream;
saveStream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " "
- << Encounters[3] << " " << Encounters[4];
+ << Encounters[3] << " " << Encounters[4]
+ << " " << allianceRetreat << " " << hordeRetreat
+ << " " << RaidDamage;
str_data = saveStream.str();
@@ -154,6 +258,9 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
case DATA_AZGALOREVENT: return Encounters[3];
case DATA_ARCHIMONDEEVENT: return Encounters[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;
}
@@ -161,7 +268,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
void UpdateWorldState(uint32 id, uint32 state)
{
Map::PlayerList const& players = instance->GetPlayers();
-
+
if (!players.isEmpty())
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -187,7 +294,7 @@ struct TRINITY_DLL_DECL instance_mount_hyjal : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
std::istringstream loadStream(in);
- loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4];
+ loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> allianceRetreat >> hordeRetreat >> RaidDamage;
for(uint8 i = 0; i < ENCOUNTERS; ++i)
if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead.
Encounters[i] = NOT_STARTED;
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
index 96a903a0795..6ed4609e3b9 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp
@@ -364,7 +364,7 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI
//trigger taretha to run down outside
if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
{
- if (Creature* Taretha = ((Creature*)Unit::GetUnit(*m_creature, TarethaGUID)))
+ if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID)))
((npc_escortAI*)(Taretha->AI()))->Start(false, false, true, PlayerGUID);
}
@@ -826,7 +826,7 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender
if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL))
{
- Creature* Thrall = ((Creature*)Unit::GetUnit((*_Creature), ThrallGUID));
+ Creature* Thrall = (Unit::GetCreature((*_Creature), ThrallGUID));
if(Thrall)
((npc_thrall_old_hillsbradAI*)Thrall->AI())->StartWP();
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
index e9b5841d005..ac646413cb0 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
@@ -134,7 +134,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
if(RAdvisors[i])
{
- pAdvisor = ((Creature*)Unit::GetUnit((*m_creature), RAdvisors[i]));
+ pAdvisor = (Unit::GetCreature((*m_creature), RAdvisors[i]));
if(pAdvisor && !pAdvisor->isAlive())
{
pAdvisor->Respawn();
@@ -205,7 +205,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
DoScriptText(SAY_DEATH, m_creature);
if (pInstance)
- pInstance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, NOT_STARTED);
+ pInstance->SetData(DATA_FATHOMLORDKARATHRESSEVENT, DONE);
//support for quest 10944
m_creature->SummonCreature(SEER_OLUM, OLUM_X, OLUM_Y, OLUM_Z, OLUM_O, TEMPSUMMON_TIMED_DESPAWN, 3600000);
@@ -280,7 +280,7 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
for(uint8 i = 0; i < 4; ++i)
if(Advisors[i])
{
- Advisor = ((Creature*)Unit::GetUnit(*m_creature, Advisors[i]));
+ Advisor = (Unit::GetCreature(*m_creature, Advisors[i]));
if(Advisor)
{
if(Advisor->isAlive())
@@ -331,7 +331,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI
pet = false;
- Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet);
+ Creature *Pet = Unit::GetCreature(*m_creature, SummonedPet);
if( Pet && Pet->isAlive() )
{
Pet->DealDamage( Pet, Pet->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false );
@@ -348,7 +348,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI
if (pInstance)
{
Creature *Karathress = NULL;
- Karathress = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
+ Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
if (Karathress)
((boss_fathomlord_karathressAI*)Karathress->AI())->EventSharkkisDeath();
@@ -407,7 +407,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_sharkkisAI : public ScriptedAI
if(TheBeastWithin_Timer < diff)
{
DoCast(m_creature, SPELL_THE_BEAST_WITHIN);
- Creature *Pet = (Creature*) Unit::GetUnit(*m_creature, SummonedPet);
+ Creature *Pet = Unit::GetCreature(*m_creature, SummonedPet);
if( Pet && Pet->isAlive() )
{
Pet->CastSpell( Pet, SPELL_PET_ENRAGE, true );
@@ -477,7 +477,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI
if (pInstance)
{
Creature *Karathress = NULL;
- Karathress = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
+ Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
if (Karathress)
if(!m_creature->isAlive() && Karathress)
@@ -592,7 +592,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_caribdisAI : public ScriptedAI
if (pInstance)
{
Creature *Karathress = NULL;
- Karathress = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
+ Karathress = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KARATHRESS)));
if (Karathress)
if(!m_creature->isAlive() && Karathress)
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp
index d4263ec4747..14012be1d1f 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_hydross_the_unstable.cpp
@@ -145,7 +145,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI
{
for(uint8 i=0;i<2;i++)
{
- Creature* mob = (Creature*)Unit::GetUnit(*m_creature,beams[i]);
+ Creature* mob = Unit::GetCreature(*m_creature,beams[i]);
if(mob)
{
mob->setDeathState(DEAD);
@@ -210,7 +210,7 @@ struct TRINITY_DLL_DECL boss_hydross_the_unstableAI : public ScriptedAI
DoScriptText(SAY_CLEAN_DEATH, m_creature);
if (pInstance)
- pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, NOT_STARTED);
+ pInstance->SetData(DATA_HYDROSSTHEUNSTABLEEVENT, DONE);
Summons.DespawnAll();
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
index aefd6062427..87bb245c382 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
@@ -134,7 +134,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
Intro = false;
- CanAttack = false;//must be after reset()
+ JustCreated = true;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on creature create (no need do intro if wiped)
}
@@ -161,6 +161,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
bool InCombat;
bool Intro;
bool CanAttack;
+ bool JustCreated;
void Reset()
{
@@ -181,7 +182,11 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
Entangle = false;
InCombat = false;
- CanAttack = true;
+ if(JustCreated)
+ {
+ CanAttack = false;
+ JustCreated = false;
+ }else CanAttack = true;
Unit *remo;
for(uint8 i = 0; i < 4; i++)
@@ -702,7 +707,7 @@ struct TRINITY_DLL_DECL mob_tainted_elementalAI : public ScriptedAI
if(pInstance)
{
Creature *Vashj = NULL;
- Vashj = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)));
+ Vashj = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_LADYVASHJ)));
if(Vashj)
((boss_lady_vashjAI*)Vashj->AI())->EventTaintedElementalDeath();
@@ -936,7 +941,7 @@ bool ItemUse_item_tainted_core(Player *player, Item* _Item, SpellCastTargets con
}
Creature *Vashj = NULL;
- Vashj = (Creature*)(Unit::GetUnit((*player), pInstance->GetData64(DATA_LADYVASHJ)));
+ Vashj = (Unit::GetCreature((*player), pInstance->GetData64(DATA_LADYVASHJ)));
if(Vashj && ((boss_lady_vashjAI*)Vashj->AI())->Phase == 2)
{
if(targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT)
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
index c21c2cf7921..073649db5ee 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
@@ -200,7 +200,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
{
for(uint8 i = 0; i < 3; i++)
{
- Creature *add = (Creature*)Unit::GetUnit(*m_creature,SpellBinderGUID[i]);
+ Creature *add = Unit::GetCreature(*m_creature,SpellBinderGUID[i]);
if (add && add->isAlive())
{
add->setDeathState(DEAD);
@@ -212,9 +212,9 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
float nx = x;
float ny = y;
float o = 2.4f;
- if (i == 0) {nx += 20;o=3.0f;}
- if (i == 1) ny -= 20;
- if (i == 2) {nx += 18;ny -= 18;o=2.0f;}
+ 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 = m_creature->SummonCreature(MOB_SPELLBINDER,nx,ny,z,o,TEMPSUMMON_DEAD_DESPAWN,0);
if (binder)
SpellBinderGUID[i] = binder->GetGUID();
@@ -267,7 +267,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
m_creature->RemoveAurasDueToSpell(AURA_BANISH);
// Leotheras is getting immune again
- m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, 1<<MECHANIC_BANISH, true);
+ m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, true);
// changing model to bloodelf
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_NIGHTELF);
@@ -288,7 +288,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
{
// channelers != 0 apply banish aura
// removing Leotheras banish immune to apply AURA_BANISH
- m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, 1<<MECHANIC_BANISH, false);
+ m_creature->ApplySpellImmune(AURA_BANISH, IMMUNITY_MECHANIC, MECHANIC_BANISH, false);
DoCast(m_creature, AURA_BANISH);
// changing model
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp
index 224f22f804e..35f3f5b9b13 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_morogrim_tidewalker.cpp
@@ -158,7 +158,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI
DoScriptText(SAY_DEATH, m_creature);
if (pInstance)
- pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, NOT_STARTED);
+ pInstance->SetData(DATA_MOROGRIMTIDEWALKEREVENT, DONE);
}
void Aggro(Unit *who)
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
index ef69ab220bf..adf2eda7c39 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/instance_serpent_shrine.cpp
@@ -67,7 +67,7 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance
uint64 StrangePool;
bool ShieldGeneratorDeactivated[4];
- bool Encounters[ENCOUNTERS];
+ uint32 Encounters[ENCOUNTERS];
void Initialize()
{
@@ -93,13 +93,13 @@ struct TRINITY_DLL_DECL instance_serpentshrine_cavern : public ScriptedInstance
ShieldGeneratorDeactivated[3] = false;
for(uint8 i = 0; i < ENCOUNTERS; i++)
- Encounters[i] = false;
+ Encounters[i] = NOT_STARTED;
}
bool IsEncounterInProgress() const
{
for(uint8 i = 0; i < ENCOUNTERS; i++)
- if(Encounters[i]) return true;
+ if(Encounters[i] == IN_PROGRESS) return true;
return false;
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
index 43342a276aa..d7c9791cf51 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
@@ -81,7 +81,7 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI
void JustDied(Unit *who)
{
for(std::list<uint64>::iterator i = Striders.begin(); i != Striders.end(); ++i)
- if(Creature *strider = (Creature*)Unit::GetUnit(*m_creature, *i))
+ if(Creature *strider = Unit::GetCreature(*m_creature, *i))
{
strider->SetLootRecipient(NULL);
strider->DealDamage(strider,strider->GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/boss_dred.cpp b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_dred.cpp
new file mode 100644
index 00000000000..a1980b7506b
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_dred.cpp
@@ -0,0 +1,56 @@
+/* Script Data Start
+SDName: Boss dred
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_BELLOWING_ROAR 44863 // fears the group, can be resisted/dispelled
+#define SPELL_GRIEVOUS_BITE 48920
+#define SPELL_MANGLING_SLASH 48873 //casted on the current tank, adds debuf
+#define SPELL_FEARSOME_ROAR_N 48849
+#define SPELL_FEARSOME_ROAR_H 48849 //Not stacking, debuff
+#define SPELL_PIERCING_SLASH 48878 //debuff -->Armor reduced by 75%
+#define SPELL_RAPTOR_CALL 59416 //dummy
+
+
+struct TRINITY_DLL_DECL boss_dredAI : public ScriptedAI
+{
+ boss_dredAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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_dred(Creature *_Creature)
+{
+ return new boss_dredAI (_Creature);
+}
+
+void AddSC_boss_dred()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_dred";
+ newscript->GetAI = GetAI_boss_dred;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/boss_novos.cpp b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_novos.cpp
new file mode 100644
index 00000000000..54392bc3b1f
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_novos.cpp
@@ -0,0 +1,75 @@
+/* Script Data Start
+SDName: Boss novos
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_novos' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCANE_BLAST_N 49198
+#define SPELL_ARCANE_BLAST_H 59909
+#define SPELL_ARCANE_FIELD 47346
+#define SPELL_BLIZZARD_N 49034
+#define SPELL_BLIZZARD_H 59854
+#define SPELL_FROSTBOLT_N 49037
+#define SPELL_FROSTBOLT_H 59855
+#define SPELL_WRATH_OF_MISERY_N 50089
+#define SPELL_WRATH_OF_MISERY_H 59856
+#define SPELL_SUMMON_MINIONS 59910 //Summons an army of Fetid Troll Corpses to assist the caster.
+
+//Yell
+#define SAY_AGGRO -1600000
+#define SAY_KILL -1600001
+#define SAY_DEATH -1600002
+#define SAY_NECRO_ADD -1600003
+#define SAY_REUBBLE_1 -1600004
+#define SAY_REUBBLE_2 -1600005
+
+struct TRINITY_DLL_DECL boss_novosAI : public ScriptedAI
+{
+ boss_novosAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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) {}
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_novos(Creature *_Creature)
+{
+ return new boss_novosAI (_Creature);
+}
+
+void AddSC_boss_novos()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_novos";
+ newscript->GetAI = GetAI_boss_novos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/boss_tharon_ja.cpp b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_tharon_ja.cpp
new file mode 100644
index 00000000000..1454a9de8f5
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_tharon_ja.cpp
@@ -0,0 +1,88 @@
+/* Script Data Start
+SDName: Boss tharon_ja
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_tharon_ja' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_COURSE_OF_LIFE 49527
+#define SPELL_DECAY_FLESH 49356 //casted at end of pahase 1, starts phase 2
+#define SPELL_EYE_BEAM_N 49544
+#define SPELL_LIGHTNING_BREATH_N 49537
+#define SPELL_POISON_CLOUD_N 49548
+#define SPELL_RAIN_OF_FIRE_N 49518
+#define SPELL_RETURN_FLESH 53463 //Channeled spell ending phase two and returning to phase 1. This ability will stun the party for 6 seconds.
+#define SPELL_SHADOW_VOLLEY_N 49528
+
+//Spells Heroic
+#define SPELL_COURSE_OF_LIFE_H 59972
+#define SPELL_EYE_BEAM_H 59965
+#define SPELL_LIGHTNING_BREATH_H 59963
+#define SPELL_POISON_CLOUD_H 59969
+#define SPELL_RAIN_OF_FIRE_H 59971
+#define SPELL_SHADOW_VOLLEY_H 59973
+
+//Players skills durring Phase2
+#define PLAYER_PHASE2_SLAYING_STRIKE 50799
+#define PLAYER_PHASE2_TAUNT 49613
+#define PLAYER_PHASE2_BONE_ARMOR 49609
+#define PLAYER_PHASE2_TOUCH_OF_LIFE 49617
+//Phase 1 all abilities except Eye beam
+//Phase 2 turns players to skeletons with new abilities, boss grows skin
+
+//Yell
+#define SAY_AGGRO 1600011
+#define SAY_KILL_1 1600012
+#define SAY_KILL_2 1600013
+#define SAY_FLESH_1 1600014
+#define SAY_FLESH_2 1600015
+#define SAY_SKELETON_1 1600016
+#define SAY_SKELETON_2 1600017
+#define SAY_DEATH 1600018
+
+struct TRINITY_DLL_DECL boss_tharon_jaAI : public ScriptedAI
+{
+ boss_tharon_jaAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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,m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_tharon_ja(Creature *_Creature)
+{
+ return new boss_tharon_jaAI (_Creature);
+}
+
+void AddSC_boss_tharon_ja()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_tharon_ja";
+ newscript->GetAI = GetAI_boss_tharon_ja;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/boss_trollgore.cpp b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_trollgore.cpp
new file mode 100644
index 00000000000..bfc123edb4d
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/boss_trollgore.cpp
@@ -0,0 +1,75 @@
+/* Script Data Start
+SDName: Boss trollgore
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_trollgore' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spell
+#define SPELL_INFECTED_WOUND 49637
+#define SPELL_CRUSH 49639
+#define SPELL_CORPSE_EXPLODE_N 49555
+#define SPELL_CONSUME_N 49380
+
+//Spell Heroic
+#define SPELL_CORPSE_EXPLODE_H 59807
+#define SPELL_CONSUME_H 59803
+
+//Yell
+#define SAY_AGGRO -1600006
+#define SAY_KILL -1600007
+#define SAY_CONSUME -1600008
+#define SAY_EXPLODE -1600009
+#define SAY_DEATH -1600010
+
+struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI
+{
+ boss_trollgoreAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_trollgore(Creature *_Creature)
+{
+ return new boss_trollgoreAI (_Creature);
+}
+
+void AddSC_boss_trollgore()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_trollgore";
+ newscript->GetAI = GetAI_boss_trollgore;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/def_drak_tharon_keep.h b/src/bindings/scripts/scripts/zone/draktharon_keep/def_drak_tharon_keep.h
new file mode 100644
index 00000000000..321d77a9c27
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/def_drak_tharon_keep.h
@@ -0,0 +1,4 @@
+#ifndef DEF_DRAK_THARON_H
+#define DEF_DRAK_THARON_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/draktharon_keep/instance_drak_tharon_keep.cpp b/src/bindings/scripts/scripts/zone/draktharon_keep/instance_drak_tharon_keep.cpp
new file mode 100644
index 00000000000..3f3cd32e764
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/draktharon_keep/instance_drak_tharon_keep.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_drak_tharon_keep.h"
+
+struct TRINITY_DLL_DECL instance_drak_tharon : public ScriptedInstance
+{
+ instance_drak_tharon(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_drak_tharon(Map* map)
+{
+ return new instance_drak_tharon(map);
+}
+
+void AddSC_instance_drak_tharon()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_drak_tharon";
+ newscript->GetInstanceData = GetInstanceData_instance_drak_tharon;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
index f6a5c5bd4a2..e420446abe8 100644
--- a/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
+++ b/src/bindings/scripts/scripts/zone/eversong_woods/eversong_woods.cpp
@@ -50,7 +50,7 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI
// Pure Virtual Functions
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(!player)
return;
@@ -81,18 +81,11 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI
}
};
-CreatureAI* GetAI_npc_prospector_anvilward(Creature *_Creature)
+CreatureAI* GetAI_npc_prospector_anvilward(Creature* pCreature)
{
- npc_prospector_anvilwardAI* thisAI = new npc_prospector_anvilwardAI(_Creature);
+ npc_prospector_anvilwardAI* thisAI = new npc_prospector_anvilwardAI(pCreature);
- thisAI->AddWaypoint(0, 9294.78, -6682.51, 22.42);
- thisAI->AddWaypoint(1, 9298.27, -6667.99, 22.42);
- thisAI->AddWaypoint(2, 9309.63, -6658.84, 22.43);
- thisAI->AddWaypoint(3, 9304.43, -6649.31, 26.46);
- thisAI->AddWaypoint(4, 9298.83, -6648.00, 28.61);
- thisAI->AddWaypoint(5, 9291.06, -6653.46, 31.83, 2500);
- thisAI->AddWaypoint(6, 9289.08, -6660.17, 31.85, 5000);
- thisAI->AddWaypoint(7, 9291.06, -6653.46, 31.83);
+ thisAI->FillPointMovementListForCreature();
return (CreatureAI*)thisAI;
}
@@ -346,7 +339,7 @@ struct TRINITY_DLL_DECL master_kelerun_bloodmournAI : public ScriptedAI
if ( timer < diff ) {
Creature* paladinSpawn;
- paladinSpawn = ((Creature*)Unit::GetUnit((*m_creature), paladinGuid[paladinPhase]));
+ paladinSpawn = (Unit::GetCreature((*m_creature), paladinGuid[paladinPhase]));
if ( paladinSpawn ) {
((npc_secondTrialAI*)paladinSpawn->AI())->Activate(m_creature->GetGUID());
@@ -446,7 +439,7 @@ void npc_secondTrialAI::JustDied(Unit* Killer) {
if (Killer->GetTypeId() == TYPEID_PLAYER)
{
Creature* Summoner;
- Summoner = ((Creature*)Unit::GetUnit((*m_creature), summonerGuid));
+ Summoner = (Unit::GetCreature((*m_creature), summonerGuid));
if ( Summoner )
((master_kelerun_bloodmournAI*)Summoner->AI())->SecondTrialKill();
@@ -567,7 +560,7 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_UNEXPECTED_RESULT);
}
@@ -579,7 +572,7 @@ struct TRINITY_DLL_DECL npc_apprentice_mirvedaAI : public ScriptedAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(player)
((Player*)player)->CompleteQuest(QUEST_UNEXPECTED_RESULT);
}
@@ -683,7 +676,7 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI
{
if (PlayerGUID && !Completed)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_POWERING_OUR_DEFENSES);
}
@@ -697,7 +690,7 @@ struct TRINITY_DLL_DECL npc_infused_crystalAI : public Scripted_NoMovementAI
Completed = true;
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(player)
((Player*)player)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
}
diff --git a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
index 54e4e3e4739..00e00b2ac90 100644
--- a/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
+++ b/src/bindings/scripts/scripts/zone/ghostlands/ghostlands.cpp
@@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -227,7 +227,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_THE_CATACOMBS);
}
diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
index 96986367077..e4fdbf90656 100644
--- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
+++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_gruul.cpp
@@ -79,12 +79,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI
Reverberation_Timer= 60000+45000;
if (pInstance)
- {
pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED);
- GameObject* EncounterDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GRUULDOOR));
- if (EncounterDoor)
- EncounterDoor->SetGoState(0); // Open the encounter door
- }else error_log(ERROR_INST_DATA);
m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);
@@ -95,12 +90,7 @@ struct TRINITY_DLL_DECL boss_gruulAI : public ScriptedAI
DoScriptText(SAY_AGGRO, m_creature);
if (pInstance)
- {
pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS);
- GameObject* EncounterDoor = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DATA_GRUULDOOR));
- if (EncounterDoor)
- EncounterDoor->SetGoState(1); //Close the encounter door, open it in JustDied/Reset
- }
}
void KilledUnit()
diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
index 4437938a47a..5bf36cc1d1e 100644
--- a/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
+++ b/src/bindings/scripts/scripts/zone/gruuls_lair/boss_high_king_maulgar.cpp
@@ -65,6 +65,44 @@ EndScriptData */
#define SPELL_SPELLSHIELD 33054
#define SPELL_BLAST_WAVE 33061
+bool CheckAllBossDied(ScriptedInstance* pInstance, Creature* m_creature)
+{
+ if(!pInstance || !m_creature)
+ return false;
+
+ uint64 MaulgarGUID = 0;
+ uint64 KigglerGUID = 0;
+ uint64 BlindeyeGUID = 0;
+ uint64 OlmGUID = 0;
+ uint64 KroshGUID = 0;
+
+ Creature* Maulgar = NULL;
+ Creature* Kiggler = NULL;
+ Creature* Blindeye = NULL;
+ Creature* Olm = NULL;
+ Creature* Krosh = NULL;
+
+ MaulgarGUID = pInstance->GetData64(DATA_MAULGAR);
+ KigglerGUID = pInstance->GetData64(DATA_KIGGLERTHECRAZED);
+ BlindeyeGUID = pInstance->GetData64(DATA_BLINDEYETHESEER);
+ OlmGUID = pInstance->GetData64(DATA_OLMTHESUMMONER);
+ KroshGUID = pInstance->GetData64(DATA_KROSHFIREHAND);
+
+ Maulgar = (Unit::GetCreature((*m_creature), MaulgarGUID));
+ Kiggler = (Unit::GetCreature((*m_creature), KigglerGUID));
+ Blindeye = (Unit::GetCreature((*m_creature), BlindeyeGUID));
+ Olm = (Unit::GetCreature((*m_creature), OlmGUID));
+ Krosh = (Unit::GetCreature((*m_creature), KroshGUID));
+
+ if(!Maulgar || !Kiggler || !Blindeye || !Olm || !Krosh)
+ return false;
+
+ if(!Maulgar->isAlive() && !Kiggler->isAlive() && !Blindeye->isAlive() && !Olm->isAlive() && !Krosh->isAlive())
+ return true;
+
+ return false;
+}
+
//High King Maulgar AI
struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI
{
@@ -104,7 +142,7 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI
{
if(Council[i])
{
- pCreature = (Creature*)(Unit::GetUnit((*m_creature), Council[i]));
+ pCreature = (Unit::GetCreature((*m_creature), Council[i]));
if(pCreature && !pCreature->isAlive())
{
pCreature->Respawn();
@@ -132,15 +170,8 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI
{
DoScriptText(SAY_DEATH, m_creature);
- if (pInstance)
- {
+ if(CheckAllBossDied(pInstance, m_creature))
pInstance->SetData(DATA_MAULGAREVENT, DONE);
-
- GameObject* Door = NULL;
- Door = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_MAULGARDOOR));
- if(Door)
- Door->SetGoState(0);
- }
}
void AddDeath()
@@ -301,17 +332,20 @@ struct TRINITY_DLL_DECL boss_olm_the_summonerAI : public ScriptedAI
}
}
- void JustDied(Unit* Killer)
- {
- if(pInstance)
+ void JustDied(Unit* Killer)
+ {
+ if(pInstance)
{
Creature *Maulgar = NULL;
- Maulgar = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
+ Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+
+ if(CheckAllBossDied(pInstance, m_creature))
+ pInstance->SetData(DATA_MAULGAREVENT, DONE);
}
- }
+ }
void UpdateAI(const uint32 diff)
{
@@ -402,17 +436,20 @@ struct TRINITY_DLL_DECL boss_kiggler_the_crazedAI : public ScriptedAI
}
}
- void JustDied(Unit* Killer)
- {
- if(pInstance)
+ void JustDied(Unit* Killer)
+ {
+ if(pInstance)
{
Creature *Maulgar = NULL;
- Maulgar = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
+ Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+
+ if(CheckAllBossDied(pInstance, m_creature))
+ pInstance->SetData(DATA_MAULGAREVENT, DONE);
}
- }
+ }
void UpdateAI(const uint32 diff)
{
@@ -507,17 +544,20 @@ struct TRINITY_DLL_DECL boss_blindeye_the_seerAI : public ScriptedAI
}
}
- void JustDied(Unit* Killer)
- {
- if(pInstance)
+ void JustDied(Unit* Killer)
+ {
+ if(pInstance)
{
Creature *Maulgar = NULL;
- Maulgar = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
+ Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+
+ if(CheckAllBossDied(pInstance, m_creature))
+ pInstance->SetData(DATA_MAULGAREVENT, DONE);
}
- }
+ }
void UpdateAI(const uint32 diff)
{
@@ -602,17 +642,20 @@ struct TRINITY_DLL_DECL boss_krosh_firehandAI : public ScriptedAI
}
}
- void JustDied(Unit* Killer)
- {
- if(pInstance)
+ void JustDied(Unit* Killer)
+ {
+ if(pInstance)
{
Creature *Maulgar = NULL;
- Maulgar = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
+ Maulgar = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_MAULGAR)));
if(Maulgar)
((boss_high_king_maulgarAI*)Maulgar->AI())->AddDeath();
+
+ if(CheckAllBossDied(pInstance, m_creature))
+ pInstance->SetData(DATA_MAULGAREVENT, DONE);
}
- }
+ }
void UpdateAI(const uint32 diff)
{
diff --git a/src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp b/src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp
index 9ecd95176f0..3951a2ba247 100644
--- a/src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp
+++ b/src/bindings/scripts/scripts/zone/gruuls_lair/instance_gruuls_lair.cpp
@@ -35,17 +35,17 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
{
instance_gruuls_lair(Map *map) : ScriptedInstance(map) {Initialize();};
- bool Encounters[ENCOUNTERS];
+ uint32 Encounters[ENCOUNTERS];
uint64 MaulgarEvent_Tank;
uint64 KigglerTheCrazed;
uint64 BlindeyeTheSeer;
uint64 OlmTheSummoner;
uint64 KroshFirehand;
- uint64 Maulgar;
+ uint64 Maulgar;
- uint64 MaulgarDoor;
- uint64 GruulDoor;
+ uint64 MaulgarDoor;
+ uint64 GruulDoor;
void Initialize()
{
@@ -54,20 +54,19 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
BlindeyeTheSeer = 0;
OlmTheSummoner = 0;
KroshFirehand = 0;
- Maulgar = 0;
-
- MaulgarDoor = 0;
- GruulDoor = 0;
+ Maulgar = 0;
+ MaulgarDoor = 0;
+ GruulDoor = 0;
for(uint8 i = 0; i < ENCOUNTERS; i++)
- Encounters[i] = false;
+ Encounters[i] = NOT_STARTED;
}
bool IsEncounterInProgress() const
{
for(uint8 i = 0; i < ENCOUNTERS; i++)
- if(Encounters[i]) return true;
+ if(Encounters[i] == IN_PROGRESS) return true;
return false;
}
@@ -77,21 +76,24 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
switch(creature->GetEntry())
{
case 18835: KigglerTheCrazed = creature->GetGUID(); break;
- case 18836: BlindeyeTheSeer = creature->GetGUID(); break;
- case 18834: OlmTheSummoner = creature->GetGUID(); break;
- case 18832: KroshFirehand = creature->GetGUID(); break;
- case 18831: Maulgar = creature->GetGUID();break;
+ case 18836: BlindeyeTheSeer = creature->GetGUID(); break;
+ case 18834: OlmTheSummoner = creature->GetGUID(); break;
+ case 18832: KroshFirehand = creature->GetGUID(); break;
+ case 18831: Maulgar = creature->GetGUID(); break;
}
}
- void OnObjectCreate(GameObject* go)
+ void OnObjectCreate(GameObject* go)
{
- switch(go->GetEntry())
- {
- case 184468: MaulgarDoor = go->GetGUID();break;
- case 184662: GruulDoor = go->GetGUID();break;
- }
- }
+ switch(go->GetEntry())
+ {
+ case 184468:
+ MaulgarDoor = go->GetGUID();
+ if(Encounters[0] == DONE) HandleGameObject(NULL, true, go);
+ break;
+ case 184662: GruulDoor = go->GetGUID(); break;
+ }
+ }
void SetData64(uint32 type, uint64 data)
{
@@ -103,14 +105,14 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
{
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;
+ 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;
}
@@ -120,13 +122,16 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
switch(type)
{
case DATA_MAULGAREVENT:
+ if(data == DONE) HandleGameObject(MaulgarDoor, true);
Encounters[0] = data; break;
case DATA_GRUULEVENT:
+ if(data == IN_PROGRESS) HandleGameObject(GruulDoor, true);
+ else HandleGameObject(GruulDoor, false);
Encounters[1] = data; break;
}
- if(data == DONE)
- SaveToDB();
+ if(data == DONE)
+ SaveToDB();
}
uint32 GetData(uint32 type)
@@ -134,13 +139,12 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
switch(type)
{
case DATA_MAULGAREVENT: return Encounters[0];
- case DATA_GRUULEVENT: return Encounters[1];
+ case DATA_GRUULEVENT: return Encounters[1];
}
return 0;
}
-
- const char* Save()
+ const char* Save()
{
OUT_SAVE_INST_DATA;
std::ostringstream stream;
@@ -173,6 +177,7 @@ struct TRINITY_DLL_DECL instance_gruuls_lair : public ScriptedInstance
OUT_LOAD_INST_DATA_COMPLETE;
}
};
+
InstanceData* GetInstanceData_instance_gruuls_lair(Map* map)
{
return new instance_gruuls_lair(map);
diff --git a/src/bindings/scripts/scripts/zone/gundrak/boss_drakkari_colossus.cpp b/src/bindings/scripts/scripts/zone/gundrak/boss_drakkari_colossus.cpp
new file mode 100644
index 00000000000..0b2fc89dd97
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/boss_drakkari_colossus.cpp
@@ -0,0 +1,55 @@
+/* Script Data Start
+SDName: Boss Drakkari Colossus
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_EMERGE 54850 //to phase2, Colossus unatackable, Elemental emerges
+#define SPELL_EMERGE_2 54851
+#define SPELL_MIGHTY_BLOW 54719
+
+struct TRINITY_DLL_DECL boss_drakkari_colossusAI : public ScriptedAI
+{
+ boss_drakkari_colossusAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase =1;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+CreatureAI* GetAI_boss_drakkari_colossus(Creature *_Creature)
+{
+ return new boss_drakkari_colossusAI (_Creature);
+}
+
+void AddSC_boss_drakkari_colossus()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_drakkari_colossus";
+ newscript->GetAI = GetAI_boss_drakkari_colossus;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/gundrak/boss_eck.cpp b/src/bindings/scripts/scripts/zone/gundrak/boss_eck.cpp
new file mode 100644
index 00000000000..9c518bee397
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/boss_eck.cpp
@@ -0,0 +1,65 @@
+/* Script Data Start
+SDName: Boss Eck the Ferocious
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment: Only appears in Heroic mode
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+#define SPELL_ECK_BERSERK 55816 //Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%.
+#define SPELL_ECK_BITE 55813 //Eck bites down hard, inflicting 150% of his normal damage to an enemy.
+#define SPELL_ECK_SPIT 55814 //Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec.
+#define SPELL_ECK_SPRING_1 55815 //Eck leaps at a distant target. --> Drops aggro and charges a random player. Tank can simply taunt him back.
+#define SPELL_ECK_SPRING_2 55837 //Eck leaps at a distant target.
+
+struct TRINITY_DLL_DECL boss_eckAI : public ScriptedAI
+{
+ boss_eckAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 berserk;
+
+ void Reset()
+ {
+ //Source Deadly Boss Mod
+ berserk = 120000; //2min
+ }
+
+ void Aggro(Unit* who) {}
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if(berserk < diff)
+ {
+ DoCast(m_creature,SPELL_ECK_BERSERK);
+ berserk = 120000;
+ }else berserk -= diff;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+CreatureAI* GetAI_boss_eck(Creature *_Creature)
+{
+ return new boss_eckAI (_Creature);
+}
+
+void AddSC_boss_eck()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_eck";
+ newscript->GetAI = GetAI_boss_eck;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/gundrak/boss_gal_darah.cpp b/src/bindings/scripts/scripts/zone/gundrak/boss_gal_darah.cpp
new file mode 100644
index 00000000000..71654de9852
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/boss_gal_darah.cpp
@@ -0,0 +1,85 @@
+/* Script Data Start
+SDName: Boss gal_darah
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ENRAGE 55285
+#define SPELL_IMPALING_CHARGE 54956
+#define SPELL_STOMP 55292
+
+#define SPELL_PUNCTURE 55276
+#define SPELL_STAMPEDE 55218
+#define SPELL_WHIRLING_SLASH 55285
+
+//Yells
+#define SAY_AGGRO -1604000
+#define SAY_SLAY_1 -1604001
+#define SAY_SLAY_2 -1604002
+#define SAY_SLAY_3 -1604003
+#define SAY_DEATH -1604004
+#define SAY_SUMMON_RHINO_1 -1604005
+#define SAY_SUMMON_RHINO_2 -1604006
+#define SAY_SUMMON_RHINO_3 -1604007
+#define SAY_TRANSFORM_1 -1604008 //Phase change
+#define SAY_TRANSFORM_2 -1604009
+
+struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI
+{
+ boss_gal_darahAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_gal_darah(Creature *_Creature)
+{
+ return new boss_gal_darahAI (_Creature);
+}
+
+void AddSC_boss_gal_darah()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_gal_darah";
+ newscript->GetAI = GetAI_boss_gal_darah;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/gundrak/boss_moorabi.cpp b/src/bindings/scripts/scripts/zone/gundrak/boss_moorabi.cpp
new file mode 100644
index 00000000000..49afd7b8126
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/boss_moorabi.cpp
@@ -0,0 +1,88 @@
+/* Script Data Start
+SDName: Boss moorabi
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_moorabi' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_DETERMINED_GORE 55102
+#define SPELL_DETERMINED_STAB_2 59444
+#define SPELL_DETERMINED_STAB_3 55104
+
+#define SPELL_GROUND_TREMOR 55142
+#define SPELL_MOJO_FRENZY 55163
+#define SPELL_NUMBING_ROAR_1 55100
+#define SPELL_NUMBING_ROAR_2 55106
+#define SPELL_TRANSFORMATION 55098 //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
+#define SPELL_QUAKE 55101
+
+//Yell
+#define SAY_AGGRO -1604010
+#define SAY_SLAY_1 -1604011
+#define SAY_SLAY_2 -1604012
+#define SAY_SLAY_3 -1604013
+#define SAY_DEATH -1604014
+#define SAY_TRANSFORM -1604015
+#define SAY_QUAKE -1604016
+
+struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI
+{
+ boss_moorabiAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ phase =1;
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_moorabi(Creature *_Creature)
+{
+ return new boss_moorabiAI (_Creature);
+}
+
+void AddSC_boss_moorabi()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_moorabi";
+ newscript->GetAI = GetAI_boss_moorabi;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/gundrak/boss_slad_ran.cpp b/src/bindings/scripts/scripts/zone/gundrak/boss_slad_ran.cpp
new file mode 100644
index 00000000000..7efd16fc375
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/boss_slad_ran.cpp
@@ -0,0 +1,95 @@
+/* Script Data Start
+SDName: Boss slad_ran
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_slad_ran' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_POISON_NOVA 55081
+#define SPELL_POISON_NOVA_2 59842
+//--
+#define SPELL_POWERFUL_BITE 48287
+#define SPELL_POWERFUL_BITE_2 59840
+//--
+#define SPELL_VENOM_BOLT 54970
+#define SPELL_VENOM_BOLT_2 59839
+//At 30% HPStart summoning small serpents
+
+//Yell
+#define SAY_AGGRO -1604017
+#define SAY_SLAY_1 -1604018
+#define SAY_SLAY_2 -1604019
+#define SAY_SLAY_3 -1604020
+#define SAY_DEATH -1604021
+#define SAY_SUMMON_SNAKES -1604022 //npc 29680
+#define SAY_SUMMON_CONSTRICTORS -1604023 //npc 29713, can cast Grip of Slad'ran (spell 55093)
+
+struct TRINITY_DLL_DECL boss_slad_ranAI : public ScriptedAI
+{
+ boss_slad_ranAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30)
+ {
+ //Summon 3 snakes --> npc 29680
+ DoScriptText(SAY_SUMMON_SNAKES,m_creature);
+ }
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)
+ {
+ //Summon 3 constrictors --> npc 29713
+ DoScriptText(SAY_SUMMON_CONSTRICTORS,m_creature);
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%3)
+ {
+ case 0:DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1:DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2:DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_slad_ran(Creature *_Creature)
+{
+ return new boss_slad_ranAI (_Creature);
+}
+
+void AddSC_boss_slad_ran()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_slad_ran";
+ newscript->GetAI = GetAI_boss_slad_ran;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/gundrak/def_gundrak.h b/src/bindings/scripts/scripts/zone/gundrak/def_gundrak.h
new file mode 100644
index 00000000000..5f015610312
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/def_gundrak.h
@@ -0,0 +1,4 @@
+#ifndef DEF_GUNDRAK_H
+#define DEF_GUNDRAK_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/gundrak/instance_gundrak.cpp b/src/bindings/scripts/scripts/zone/gundrak/instance_gundrak.cpp
new file mode 100644
index 00000000000..88df9e1b73c
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/gundrak/instance_gundrak.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_gundrak.h"
+
+struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance
+{
+ instance_gundrak(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_gundrak(Map* map)
+{
+ return new instance_gundrak(map);
+}
+
+void AddSC_instance_gundrak()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_gundrak";
+ newscript->GetInstanceData = GetInstanceData_instance_gundrak;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
index de74db2a251..8c118a022ea 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
@@ -128,7 +128,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
}
for(int i=0; i<5; ++i)
{
- Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
+ Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(who && channeler && !channeler->isInCombat())
channeler->AI()->AttackStart(who);
}
@@ -138,7 +138,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
for(int i=0; i<5; ++i)
{
- Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
+ Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(channeler && channeler->isAlive())
return;
}
@@ -154,7 +154,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
int i;
for(i=0; i<5; ++i)
{
- Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
+ Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(channeler && channeler->GetGUID()==channeler1->GetGUID())
break;
}
@@ -165,7 +165,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
for(int i=0; i<5; ++i)
{
- Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
+ Creature *channeler = Unit::GetCreature(*m_creature, Channelers[i]);
if(!channeler || channeler->isDead())
channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000);
if(channeler)
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
index 447a59c314c..86d76952b45 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/boss_vazruden_the_herald.cpp
@@ -127,7 +127,7 @@ struct TRINITY_DLL_DECL boss_nazanAI : public ScriptedAI
if(flight) // phase 1 - the flight
{
- Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature,VazrudenGUID);
+ Creature *Vazruden = Unit::GetCreature(*m_creature,VazrudenGUID);
if(Fly_Timer < diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth())))
{
flight = false;
@@ -279,8 +279,8 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
{
if(summoned)
{
- Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID);
- Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID);
+ Creature *Nazan = Unit::GetCreature(*m_creature, NazanGUID);
+ Creature *Vazruden = Unit::GetCreature(*m_creature, VazrudenGUID);
if(Nazan || (Nazan = (Creature *)FindCreature(ENTRY_NAZAN, 5000, m_creature)))
{
Nazan->SetLootRecipient(NULL);
@@ -381,8 +381,8 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
default: // adds do the job now
if(check < diff)
{
- Creature *Nazan = (Creature*)Unit::GetUnit(*m_creature, NazanGUID);
- Creature *Vazruden = (Creature*)Unit::GetUnit(*m_creature, VazrudenGUID);
+ Creature *Nazan = Unit::GetCreature(*m_creature, NazanGUID);
+ Creature *Vazruden = Unit::GetCreature(*m_creature, VazrudenGUID);
if(Nazan && Nazan->isAlive() || Vazruden && Vazruden->isAlive())
{
if(Nazan && Nazan->getVictim() || Vazruden && Vazruden->getVictim())
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
index 16d4b07ba15..50db6680e94 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
@@ -506,7 +506,7 @@ bool GOHello_go_Manticron_Cube(Player *player, GameObject* _GO)
ScriptedInstance* pInstance =(ScriptedInstance*)_GO->GetInstanceData();
if(!pInstance) return true;
if(pInstance->GetData(DATA_MAGTHERIDON_EVENT) != IN_PROGRESS) return true;
- Creature *Magtheridon =(Creature*)Unit::GetUnit(*_GO, pInstance->GetData64(DATA_MAGTHERIDON));
+ Creature *Magtheridon =Unit::GetCreature(*_GO, pInstance->GetData64(DATA_MAGTHERIDON));
if(!Magtheridon || !Magtheridon->isAlive()) return true;
// if exhausted or already channeling return
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
index 91246b0c5b2..a18579ccfa9 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/shattered_halls/boss_nethekurse.cpp
@@ -335,7 +335,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
{
if (pInstance->GetData64(DATA_NETHEKURSE))
{
- Creature *pKurse = (Creature*)Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
+ Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse && m_creature->GetDistance(pKurse) < 45.0f)
{
((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonAggro();
@@ -356,7 +356,7 @@ struct TRINITY_DLL_DECL mob_fel_orc_convertAI : public ScriptedAI
return;
if (pInstance->GetData64(DATA_NETHEKURSE))
{
- Creature *pKurse = (Creature*)Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
+ Creature *pKurse = Unit::GetCreature(*m_creature,pInstance->GetData64(DATA_NETHEKURSE));
if (pKurse)
((boss_grand_warlock_nethekurseAI*)pKurse->AI())->DoYellForPeonDeath();
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
index 61c31fb0fba..2adbc632155 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
@@ -275,7 +275,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -303,7 +303,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
case 27:
DoScriptText(SAY_ELF_COMPLETE, m_creature, player);
// Award quest credit
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player && player->GetTypeId() == TYPEID_PLAYER)
((Player*)player)->GroupEventHappens(QUEST_ROAD_TO_FALCON_WATCH,m_creature);
break;
@@ -335,7 +335,7 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
if (PlayerGUID)
{
// If NPC dies, player fails the quest
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player && player->GetTypeId() == TYPEID_PLAYER)
((Player*)player)->FailQuest(QUEST_ROAD_TO_FALCON_WATCH);
}
@@ -347,38 +347,11 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI
}
};
-CreatureAI* GetAI_npc_wounded_blood_elf(Creature *_Creature)
+CreatureAI* GetAI_npc_wounded_blood_elf(Creature* pCreature)
{
- npc_wounded_blood_elfAI* welfAI = new npc_wounded_blood_elfAI(_Creature);
-
- welfAI->AddWaypoint(0, -1137.72, 4272.10, 14.04, 5000);
- welfAI->AddWaypoint(1, -1141.34, 4232.42, 14.63);
- welfAI->AddWaypoint(2, -1133.47, 4220.88, 11.78);
- welfAI->AddWaypoint(3, -1126.18, 4213.26, 13.51);
- welfAI->AddWaypoint(4, -1100.12, 4204.32, 16.41);
- welfAI->AddWaypoint(5, -1063.68, 4197.92, 15.51);
- welfAI->AddWaypoint(6, -1027.28, 4194.36, 15.52);
- welfAI->AddWaypoint(7, -995.68, 4189.59, 19.84);
- welfAI->AddWaypoint(8, -970.90, 4188.60, 24.61);
- welfAI->AddWaypoint(9, -961.93, 4193.34, 26.11, 15000); // Summon 1
- welfAI->AddWaypoint(10, -935.52, 4210.99, 31.98);
- welfAI->AddWaypoint(11, -913.42, 4218.27, 37.29);
- welfAI->AddWaypoint(12, -896.53, 4207.73, 43.23);
- welfAI->AddWaypoint(13, -868.49, 4194.77, 46.75, 30000);// Kneel and Rest Here
- welfAI->AddWaypoint(14, -852.83, 4198.29, 47.28, 15000);// Summon 2
- welfAI->AddWaypoint(15, -819.85, 4200.50, 46.37);
- welfAI->AddWaypoint(16, -791.92, 4201.96, 44.19);
- welfAI->AddWaypoint(17, -774.42, 4202.46, 47.41);
- welfAI->AddWaypoint(18, -762.90, 4202.17, 48.81);
- welfAI->AddWaypoint(19, -728.25, 4195.35, 50.68);
- welfAI->AddWaypoint(20, -713.58, 4192.07, 53.98);
- welfAI->AddWaypoint(21, -703.09, 4189.74, 56.96);
- welfAI->AddWaypoint(22, -693.70, 4185.43, 57.06);
- welfAI->AddWaypoint(23, -686.38, 4159.81, 60.26);
- welfAI->AddWaypoint(24, -679.88, 4147.04, 64.20);
- welfAI->AddWaypoint(25, -656.74, 4147.72, 64.11);
- welfAI->AddWaypoint(26, -652.22, 4137.50, 64.58);
- welfAI->AddWaypoint(27, -649.99, 4136.38, 64.63, 30000);// Award Quest Credit
+ npc_wounded_blood_elfAI* welfAI = new npc_wounded_blood_elfAI(pCreature);
+
+ welfAI->FillPointMovementListForCreature();
return (CreatureAI*)welfAI;
}
diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
index 75d78fde331..70a77302823 100644
--- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
+++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
@@ -101,7 +101,8 @@ struct TRINITY_DLL_DECL npc_converted_sentryAI : public ScriptedAI
else DoScriptText(SAY_CONVERTED_2, m_creature);
DoCast(m_creature, SPELL_CONVERT_CREDIT);
- ((Pet*)m_creature)->SetDuration(7500);
+ if(m_creature->isPet())
+ ((Pet*)m_creature)->SetDuration(7500);
Credit = true;
}else Timer -= diff;
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
index 0f6d13c2198..e488ea26810 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_midnight.cpp
@@ -281,7 +281,7 @@ struct TRINITY_DLL_DECL boss_attumenAI : public ScriptedAI
{
if( (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
{
- Creature *pMidnight = (Creature*)Unit::GetUnit(*m_creature, Midnight);
+ Creature *pMidnight = Unit::GetCreature(*m_creature, Midnight);
if(pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{
((boss_midnightAI*)(pMidnight->AI()))->Mount(m_creature);
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
index cf235b99880..b0457b49359 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
@@ -211,7 +211,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
AddGUID[i] = pCreature->GetGUID();
break;
case 1:
- pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i]));
+ pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if (pCreature)
{
pCreature->Respawn();
@@ -219,7 +219,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
}
break;
case 2:
- pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i]));
+ pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if (!pCreature->IsInEvadeMode())
pCreature->AI()->EnterEvadeMode();
break;
@@ -281,7 +281,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
Creature* Temp = NULL;
if (AddGUID[i])
{
- Temp = (Creature*)Unit::GetUnit((*m_creature),AddGUID[i]);
+ Temp = Unit::GetCreature((*m_creature),AddGUID[i]);
if (Temp && Temp->isAlive())
if (!Temp->getVictim() )
Temp->AI()->AttackStart(m_creature->getVictim());
@@ -392,7 +392,7 @@ struct TRINITY_DLL_DECL boss_moroes_guestAI : public ScriptedAI
return;
GuestGUID[0] = pInstance->GetData64(DATA_MOROES);
- Creature* Moroes = ((Creature*)Unit::GetUnit((*m_creature), GuestGUID[0]));
+ Creature* Moroes = (Unit::GetCreature((*m_creature), GuestGUID[0]));
if(Moroes)
{
for(uint8 i = 0; i < 3; ++i)
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
index bf8d539026e..13dd8feab34 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_terestian_illhoof.cpp
@@ -89,7 +89,7 @@ struct TRINITY_DLL_DECL mob_kilrekAI : public ScriptedAI
return;
}
- Creature* Terestian = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_TERESTIAN)));
+ Creature* Terestian = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_TERESTIAN)));
if(Terestian && !Terestian->getVictim())
Terestian->AddThreat(who, 1.0f);
}
@@ -211,10 +211,9 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI
if(pInstance)
{
- Creature* Kilrek = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILREK)));
-
+ Creature* Kilrek = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_KILREK)));
// Respawn Kil'rek on aggro if Kil'rek is dead.
- if (!Kilrek || !Kilrek->isAlive())
+ if (Kilrek && !Kilrek->isAlive())
{
Kilrek->Respawn();
}
@@ -270,7 +269,7 @@ struct TRINITY_DLL_DECL boss_terestianAI : public ScriptedAI
uint64 KilrekGUID = pInstance->GetData64(DATA_KILREK);
else ERROR_INST_DATA(m_creature);
- Creature* Kilrek = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_KILREK)));
+ Creature* Kilrek = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_KILREK)));
if(SummonKilrek && Kilrek)
{
Kilrek->Respawn();
diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
index 33899c4cd83..2fa0184bd42 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
@@ -217,7 +217,7 @@ struct TRINITY_DLL_DECL mob_titoAI : public ScriptedAI
{
if(DorotheeGUID)
{
- Creature* Dorothee = ((Creature*)Unit::GetUnit((*m_creature), DorotheeGUID));
+ Creature* Dorothee = (Unit::GetCreature((*m_creature), DorotheeGUID));
if(Dorothee && Dorothee->isAlive())
{
((boss_dorotheeAI*)Dorothee->AI())->TitoDied = true;
@@ -577,6 +577,8 @@ struct TRINITY_DLL_DECL boss_croneAI : public ScriptedAI
lDoor->SetGoState(0);
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
rDoor->SetGoState(0);
+ if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
}
@@ -770,6 +772,8 @@ struct TRINITY_DLL_DECL boss_bigbadwolfAI : public ScriptedAI
lDoor->SetGoState(0);
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
rDoor->SetGoState(0);
+ if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
}
@@ -1015,6 +1019,8 @@ struct TRINITY_DLL_DECL boss_julianneAI : public ScriptedAI
lDoor->SetGoState(0);
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
rDoor->SetGoState(0);
+ if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
}
@@ -1073,7 +1079,7 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI
DoScriptText(SAY_ROMULO_AGGRO, m_creature);
if(JulianneGUID)
{
- Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID));
+ Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne && Julianne->getVictim())
{
m_creature->AddThreat(Julianne->getVictim(), 1.0f);
@@ -1098,10 +1104,12 @@ struct TRINITY_DLL_DECL boss_romuloAI : public ScriptedAI
{
pInstance->SetData(DATA_OPERA_EVENT, DONE);
- if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
+ if (GameObject* lDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORLEFT)))
lDoor->SetGoState(0);
if (GameObject* rDoor = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GAMEOBJECT_STAGEDOORRIGHT)))
rDoor->SetGoState(0);
+ if (GameObject* pSideEntrance = GameObject::GetGameObject((*m_creature), pInstance->GetData64(DATA_GO_SIDE_ENTRANCE_DOOR)))
+ pSideEntrance->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
}
}
@@ -1132,7 +1140,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
DoCast(m_creature, SPELL_DRINK_POISON);
IsFakingDeath = true;
- //IS THIS USEFULL? Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID));
+ //IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
return;
}
@@ -1148,7 +1156,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
//if this is true then we have to kill romulo too
if (RomuloDead)
{
- if (Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)))
+ if (Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID)))
{
Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Romulo->GetMotionMaster()->Clear();
@@ -1162,7 +1170,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
}
//if not already returned, then romulo is alive and we can pretend die
- if (Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID)))
+ if (Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID)))
{
PretendToDie(m_creature);
IsFakingDeath = true;
@@ -1189,7 +1197,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
IsFakingDeath = true;
Phase = PHASE_BOTH;
- if (Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)))
+ if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
{
((boss_julianneAI*)Julianne->AI())->RomuloDead = true;
((boss_julianneAI*)Julianne->AI())->ResurrectSelfTimer = 10000;
@@ -1203,7 +1211,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
{
if (JulianneDead)
{
- if (Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)))
+ if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
{
Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Julianne->GetMotionMaster()->Clear();
@@ -1215,7 +1223,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
return;
}
- if (Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID)))
+ if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
{
PretendToDie(m_creature);
IsFakingDeath = true;
@@ -1308,7 +1316,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if(ResurrectTimer < diff)
{
- Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID));
+ Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
if(Romulo && ((boss_romuloAI*)Romulo->AI())->IsFakingDeath)
{
DoScriptText(SAY_JULIANNE_RESURRECT, m_creature);
@@ -1342,7 +1350,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if(rand()%2 == 1 && SummonedRomulo)
{
- Creature* Romulo = ((Creature*)Unit::GetUnit((*m_creature), RomuloGUID));
+ Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
if (Romulo && Romulo->isAlive() && !RomuloDead)
DoCast(Romulo, SPELL_ETERNAL_AFFECTION);
}else DoCast(m_creature, SPELL_ETERNAL_AFFECTION);
@@ -1362,7 +1370,7 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
{
if(ResurrectTimer < diff)
{
- Creature* Julianne = ((Creature*)Unit::GetUnit((*m_creature), JulianneGUID));
+ Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
if(Julianne && ((boss_julianneAI*)Julianne->AI())->IsFakingDeath)
{
DoScriptText(SAY_ROMULO_RESURRECT, m_creature);
diff --git a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h
index 4304477de2a..47162ec2599 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h
+++ b/src/bindings/scripts/scripts/zone/karazhan/def_karazhan.h
@@ -2,43 +2,50 @@
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
+
#ifndef DEF_KARAZHAN_H
#define DEF_KARAZHAN_H
-#define DATA_ATTUMEN_EVENT 1
-#define DATA_MOROES_EVENT 2
-#define DATA_MAIDENOFVIRTUE_EVENT 3
-#define DATA_OPTIONAL_BOSS_EVENT 4
-#define DATA_OPERA_EVENT 5
-#define DATA_CURATOR_EVENT 6
-#define DATA_SHADEOFARAN_EVENT 7
-#define DATA_TERESTIAN_EVENT 8
-#define DATA_NETHERSPITE_EVENT 9
-#define DATA_CHESS_EVENT 10
-#define DATA_MALCHEZZAR_EVENT 11
-#define DATA_NIGHTBANE_EVENT 12
-#define DATA_OPERA_PERFORMANCE 13
-#define DATA_OPERA_OZ_DEATHCOUNT 14
-#define DATA_KILREK 15
-#define DATA_TERESTIAN 16
-#define DATA_MOROES 17
-#define DATA_GAMEOBJECT_CURTAINS 18
-#define DATA_GAMEOBJECT_STAGEDOORLEFT 19
-#define DATA_GAMEOBJECT_STAGEDOORRIGHT 20
-#define DATA_GAMEOBJECT_LIBRARY_DOOR 21
-#define DATA_GAMEOBJECT_MASSIVE_DOOR 22
-#define DATA_GAMEOBJECT_NETHER_DOOR 23
-#define DATA_GAMEOBJECT_GAME_DOOR 24
-#define DATA_GAMEOBJECT_GAME_EXIT_DOOR 25
-#define DATA_IMAGE_OF_MEDIVH 26
-#define DATA_MASTERS_TERRACE_DOOR_1 27
-#define DATA_MASTERS_TERRACE_DOOR_2 28
+enum
+{
+ DATA_ATTUMEN_EVENT = 1,
+ DATA_MOROES_EVENT = 2,
+ DATA_MAIDENOFVIRTUE_EVENT = 3,
+ DATA_OPTIONAL_BOSS_EVENT = 4,
+ DATA_OPERA_EVENT = 5,
+ DATA_CURATOR_EVENT = 6,
+ DATA_SHADEOFARAN_EVENT = 7,
+ DATA_TERESTIAN_EVENT = 8,
+ DATA_NETHERSPITE_EVENT = 9,
+ DATA_CHESS_EVENT = 10,
+ DATA_MALCHEZZAR_EVENT = 11,
+ DATA_NIGHTBANE_EVENT = 12,
+ DATA_OPERA_PERFORMANCE = 13,
+ DATA_OPERA_OZ_DEATHCOUNT = 14,
+ DATA_KILREK = 15,
+ DATA_TERESTIAN = 16,
+ DATA_MOROES = 17,
+ DATA_GAMEOBJECT_CURTAINS = 18,
+ DATA_GAMEOBJECT_STAGEDOORLEFT = 19,
+ DATA_GAMEOBJECT_STAGEDOORRIGHT = 20,
+ DATA_GAMEOBJECT_LIBRARY_DOOR = 21,
+ DATA_GAMEOBJECT_MASSIVE_DOOR = 22,
+ DATA_GAMEOBJECT_NETHER_DOOR = 23,
+ DATA_GAMEOBJECT_GAME_DOOR = 24,
+ DATA_GAMEOBJECT_GAME_EXIT_DOOR = 25,
+ DATA_IMAGE_OF_MEDIVH = 26,
+ DATA_MASTERS_TERRACE_DOOR_1 = 27,
+ DATA_MASTERS_TERRACE_DOOR_2 = 28,
+ DATA_GO_SIDE_ENTRANCE_DOOR = 29
+};
-// Opera Performances
-#define EVENT_OZ 1
-#define EVENT_HOOD 2
-#define EVENT_RAJ 3
+enum OperaEvents
+{
+ EVENT_OZ = 1,
+ EVENT_HOOD = 2,
+ EVENT_RAJ = 3
+};
-#define ERROR_INST_DATA(a) error_log("SD2: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
+#define ERROR_INST_DATA(a) error_log("TSCR: Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
#endif
diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp
index 185c44c6cdc..e8dccdd62a4 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp
@@ -59,6 +59,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
uint64 MoroesGUID;
uint64 LibraryDoor; // Door at Shade of Aran
uint64 MassiveDoor; // Door at Netherspite
+ uint64 SideEntranceDoor; // Side Entrance
uint64 GamesmansDoor; // Door before Chess
uint64 GamesmansExitDoor; // Door after Chess
uint64 NetherspaceDoor; // Door at Malchezaar
@@ -83,6 +84,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
LibraryDoor = 0;
MassiveDoor = 0;
+ SideEntranceDoor = 0;
GamesmansDoor = 0;
GamesmansExitDoor = 0;
NetherspaceDoor = 0;
@@ -146,6 +148,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
case DATA_GAMEOBJECT_CURTAINS: return CurtainGUID;
case DATA_GAMEOBJECT_LIBRARY_DOOR: return LibraryDoor;
case DATA_GAMEOBJECT_MASSIVE_DOOR: return MassiveDoor;
+ case DATA_GO_SIDE_ENTRANCE_DOOR: return SideEntranceDoor;
case DATA_GAMEOBJECT_GAME_DOOR: return GamesmansDoor;
case DATA_GAMEOBJECT_GAME_EXIT_DOOR: return GamesmansExitDoor;
case DATA_GAMEOBJECT_NETHER_DOOR: return NetherspaceDoor;
@@ -221,6 +224,13 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance
case 185134: NetherspaceDoor = go->GetGUID(); break;
case 184274: MastersTerraceDoor[0] = go->GetGUID(); break;
case 184280: MastersTerraceDoor[1] = go->GetGUID(); break;
+ case 184275:
+ SideEntranceDoor = go->GetGUID();
+ if (GetData(DATA_OPERA_EVENT) != DONE)
+ go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
+ else
+ go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
+ break;
}
switch(OperaEvent)
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
index 236533b2489..28edd163ac2 100644
--- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
@@ -97,7 +97,6 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
boss_priestess_delrissaAI(Creature* c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
- //SummonAdds();
Heroic = c->GetMap()->IsHeroic();
}
@@ -131,6 +130,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
CombatPulseTimer = 5000;
+ SummonAdds();
CheckAdds();
if (pInstance)
@@ -151,6 +151,9 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
void SummonAdds()
{
+ if(!Adds.empty())
+ return;
+
std::vector<uint32> AddList;
for(uint8 i = 0; i < 8; ++i)
AddList.push_back(AddEntry[i]);
@@ -177,7 +180,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
uint32 n = 0;
for(std::vector<Add*>::iterator i = Adds.begin(); i != Adds.end(); ++i, ++n)
{
- Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, (*i)->guid));
+ Creature* pAdd = (Unit::GetCreature(*m_creature, (*i)->guid));
if(pAdd && pAdd->isAlive())
{
pAdd->AI()->EnterEvadeMode(); // Force them out of combat and reset if they are in combat.
@@ -370,7 +373,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return;
}
- Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
+ Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if (Delrissa)
{
pInstance->SetData(DATA_DELRISSA_DEATH_COUNT, 1);
@@ -390,7 +393,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return;
}
- Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
+ Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if (Delrissa)
Delrissa->AI()->KilledUnit(victim);
}
@@ -403,7 +406,7 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
return;
}
- Creature* Delrissa = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
+ Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)));
if (Delrissa)
{
Group = ((boss_priestess_delrissaAI*)Delrissa->AI())->Adds;
@@ -631,13 +634,13 @@ struct TRINITY_DLL_DECL boss_ellris_duskhallowAI : public boss_priestess_guestAI
/*void mob_fizzleAI::JustDied(Unit* killer)
{
- if(Creature* Ellris = ((Creature*)Unit::GetUnit(*m_creature, EllrisGUID)))
+ if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
((boss_ellris_duskhallowAI*)Ellris->AI())->ImpGUID = 0;
}
void mob_fizzleAI::KilledUnit(Unit* victim)
{
- if(Creature* Ellris = ((Creature*)Unit::GetUnit(*m_creature, EllrisGUID)))
+ if(Creature* Ellris = (Unit::GetCreature(*m_creature, EllrisGUID)))
((boss_ellris_duskhallowAI*)Ellris->AI())->KilledUnit(victim);
}*/
@@ -1025,13 +1028,13 @@ struct TRINITY_DLL_DECL boss_garaxxasAI : public boss_priestess_guestAI
/*void mob_sliverAI::JustDied(Unit* killer)
{
- if(Creature* Garaxxas = ((Creature*)Unit::GetUnit(*m_creature, GaraxxasGUID)))
+ if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
((boss_garaxxasAI*)Garaxxas->AI())->SliverGUID = 0;
}
void mob_sliverAI::KilledUnit(Unit* victim)
{
- if(Creature* Garaxxas = ((Creature*)Unit::GetUnit(*m_creature, GaraxxasGUID)))
+ if(Creature* Garaxxas = (Unit::GetCreature(*m_creature, GaraxxasGUID)))
((boss_garaxxasAI*)Garaxxas->AI())->KilledUnit(victim);
}*/
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
index 2dc2d893c5a..c18128bbe1a 100644
--- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_selin_fireheart.cpp
@@ -174,8 +174,8 @@ struct TRINITY_DLL_DECL boss_selin_fireheartAI : public ScriptedAI
//for(uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for(std::list<uint64>::iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
- //Creature* pCrystal = ((Creature*)Unit::GetUnit(*m_creature, FelCrystals[i]));
- Creature* pCrystal = ((Creature*)Unit::GetUnit(*m_creature, *itr));
+ //Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i]));
+ Creature* pCrystal = (Unit::GetCreature(*m_creature, *itr));
if (pCrystal && pCrystal->isAlive())
pCrystal->DealDamage(pCrystal, pCrystal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
@@ -342,7 +342,7 @@ struct TRINITY_DLL_DECL mob_fel_crystalAI : public ScriptedAI
{
if (ScriptedInstance* pInstance = ((ScriptedInstance*)m_creature->GetInstanceData()))
{
- Creature* Selin = ((Creature*)Unit::GetUnit(*m_creature, pInstance->GetData64(DATA_SELIN)));
+ Creature* Selin = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SELIN)));
if (Selin && Selin->isAlive())
{
if (((boss_selin_fireheartAI*)Selin->AI())->CrystalGUID == m_creature->GetGUID())
diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
index e8f6cae5e40..7704247cf90 100644
--- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
+++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
@@ -422,9 +422,9 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
// Emote Ardonis and Pathaleon
void Turn_to_Pathaleons_Image()
{
- Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID);
- Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID);
- Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
+ Creature *ardonis = Unit::GetCreature(*m_creature,ardonisGUID);
+ Creature *pathaleon = Unit::GetCreature(*m_creature,pathaleonGUID);
+ Player *player = Unit::GetPlayer(playerGUID);
if (!ardonis || !pathaleon || !player)
return;
@@ -450,7 +450,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
{
if (Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID))
{
- Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
+ Player *player = Unit::GetPlayer(playerGUID);
if (!player)
return;
@@ -507,7 +507,7 @@ struct TRINITY_DLL_DECL npc_commander_dawnforgeAI : public ScriptedAI
Unit *ardonis = Unit::GetUnit(*m_creature,ardonisGUID);
Unit *pathaleon = Unit::GetUnit(*m_creature,pathaleonGUID);
- Player *player = (Player*)Unit::GetUnit(*m_creature,playerGUID);
+ Player *player = Unit::GetPlayer(playerGUID);
if (!ardonis || !player)
{
@@ -915,14 +915,14 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(Q_ALMABTRIEB);
}
}
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
diff --git a/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/boss_malygos.cpp b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/boss_malygos.cpp
new file mode 100644
index 00000000000..25a156b1bc4
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/boss_malygos.cpp
@@ -0,0 +1,170 @@
+/* Script Data Start
+SDName: Boss malygos
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCANE_BREATH_N 56272
+#define SPELL_ARCANE_BREATH_H 60072
+#define SPELL_ARCANE_PULSE 57432
+#define SPELL_ARCANE_STORM_1 57459
+#define SPELL_ARCANE_STORM_2 61693
+#define SPELL_ARCANE_STORM_3 61694
+#define SPELL_STATIC_FIELD 57430
+#define SPELL_SURGE_OF_POWER_1 56505
+#define SPELL_SURGE_OF_POWER_2 57407
+#define SPELL_SURGE_OF_POWER_3 60936
+#define SPELL_VORTEX 56105
+
+//Dragon "mounts" spells in Phase3
+//they use Rugelike energy
+#define SPELL_DMOUNT_FLAME_SPIKE 56091 //maybe not accurate
+#define SPELL_DMOUNT_ENGULF_IN_FLAMES 61621
+#define SPELL_DMOUNT_REVIVIFY 57090
+#define SPELL_DMOUNT_LIFE_BURST 57143
+#define SPELL_DMOUNT_FLAME_SHIELD 57108
+//#define SPELL_DMOUNT_UNKNOWN XYZ //Increases your drake's flight speed by 500%.
+
+
+//Yell
+//-->Other
+#define SAY_ANTI_MAGIC_SHELL -1616000
+#define SAY_BREATH_ATTACK -1616001
+#define SAY_HIGH_DAMAGE_MODE -1616002
+#define SAY_MAGIC_BLAST -1616003
+//--> Generic Spells
+#define SAY_GENERIC_SPELL_1 -1616004
+#define SAY_GENERIC_SPELL_2 -1616005
+#define SAY_GENERIC_SPELL_3 -1616006
+#define SAY_DEATH -1616007
+//--> Prefight
+#define SAY_PREFIGHT_1 -1616008
+#define SAY_PREFIGHT_2 -1616009
+#define SAY_PREFIGHT_3 -1616010
+#define SAY_PREFIGHT_4 -1616011
+#define SAY_PREFIGHT_5 -1616012
+//--> Phase1
+#define SAY_PHASE1_AGGRO -1616013
+#define SAY_PHASE1_END -1616014
+#define SAY_PHASE1_SLAY_1 -1616015
+#define SAY_PHASE1_SLAY_2 -1616016
+#define SAY_PHASE1_SLAY_3 -1616017
+
+//--> Phase2 at 50% HP,
+
+/*Malygos himself is not targetable during this phase, it will end when the adds he spawns are all killed. However, he does continue to play a part in the encounter.
+During this phase he drops anti-magic zones onto the ground the raid MUST stand inside of, it reduces magical damage taken by 50%. They shrink over time, so it's important that your raid moves to each new one he drops.
+Throughout the phase, he will deep breath doing ~4k damage per second, unless you are standing inside of the anti-magic zone.
+The way the fight works during this phase is there are NPCs riding around on disks in the room. There are two types of mobs, Lords and Scions.
+The Lords will move down onto the group, and need to be tanked (They will one-shot a non-tank). After they die, they drop a disk that a raid member can mount onto, which allows them to fly, to attack the Scions that do not come down to the ground.
+It is recommended to let melee take the first disks, then ranged. As those mobs die, they also drop disks, which allows the rest of your dps to get onto them.
+The Scions will continually cast Arcane Blast on random targets on the floor, which is mitigated by the anti-magic zones. While mounted on a disk, you will not take damage.
+After all of the NPCs riding on the disks die, the players on the disks need to dismount as Phase 3 is about to begin.*/
+
+#define SAY_PHASE2_AGGRO -1616018
+#define SAY_PHASE2_END -1616019
+#define SAY_PHASE2_SLAY_1 -1616020
+#define SAY_PHASE2_SLAY_2 -1616021
+#define SAY_PHASE2_SLAY_3 -1616022
+//--> Phase3 Malygos destroys the floor, encounter continues on dragon "mounts"
+#define SAY_PHASE3_INTRO -1616023
+#define SAY_PHASE3_AGGRO -1616024
+#define SAY_PHASE3_SLAY_1 -1616025
+#define SAY_PHASE3_SLAY_2 -1616026
+#define SAY_PHASE3_SLAY_3 -1616027
+#define SAY_PHASE3_BIG_ATTACK -1616028
+
+struct TRINITY_DLL_DECL boss_malygosAI : public ScriptedAI
+{
+ boss_malygosAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase,
+ enrage;
+
+ void Reset()
+ {
+ //Source Deadly Boss Mod
+ enrage = 615000; //10 min
+ }
+ void Aggro(Unit* who)
+ {
+ if(phase == 1)
+ DoScriptText(SAY_PHASE1_AGGRO, m_creature);
+ if(phase == 2)
+ DoScriptText(SAY_PHASE1_AGGRO, m_creature);
+ if(phase == 3)
+ DoScriptText(SAY_PHASE1_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ phase =1;
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50){
+ phase = 2;
+ //spawn adds
+ //set malygos unatackable untill all adds spawned dead
+ //start phase3
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ if(phase ==1)
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_PHASE1_SLAY_1, m_creature); break;
+ case 1: DoScriptText(SAY_PHASE1_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_PHASE1_SLAY_3, m_creature);break;
+ }
+ if(phase ==2)
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_PHASE2_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_PHASE2_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_PHASE2_SLAY_3, m_creature);break;
+ }
+ if(phase ==3)
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_PHASE3_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_PHASE3_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_PHASE3_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_malygos(Creature *_Creature)
+{
+ return new boss_malygosAI (_Creature);
+}
+
+void AddSC_boss_malygos()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_malygos";
+ newscript->GetAI = GetAI_boss_malygos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/def_eye_of_eternity.h b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/def_eye_of_eternity.h
new file mode 100644
index 00000000000..caa82a92e95
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/def_eye_of_eternity.h
@@ -0,0 +1,4 @@
+#ifndef DEF_EYE_OF_ETERNITY_H
+#define DEF_EYE_OF_ETERNITY_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/instance_eye_of_eternity.cpp b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/instance_eye_of_eternity.cpp
new file mode 100644
index 00000000000..48d26f2bcd9
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/eye_of_eternity/instance_eye_of_eternity.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_eye_of_eternity.h"
+
+struct TRINITY_DLL_DECL instance_eye_of_eternity : public ScriptedInstance
+{
+ instance_eye_of_eternity(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_eye_of_eternity(Map* map)
+{
+ return new instance_eye_of_eternity(map);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp
new file mode 100644
index 00000000000..559a9081226
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_anomalus.cpp
@@ -0,0 +1,149 @@
+/* Script Data Start
+SDName: Boss anomalus
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_SPARK_1 47751
+#define SPELL_SPARK_2 57062
+#define SPELL_RIFT_SHIELD 47748
+#define SPELL_CHARGE_RIFT 47747
+#define SPELL_ARCANE_ATTRACTION 57063
+#define SPELL_CREATE_RIFT 47743 //Dummy ---> summons (npc 26918) "Chaotic Rift", which spawns "Crazed Mana Wraith"s (npc 26746)
+
+#define MOB_CRAZED_MANA_WRAITH 26746
+#define NPC_CHAOTIC_RIFT 26918
+
+//Yell
+#define SAY_AGGRO -1576000
+#define SAY_KILL -1576001
+#define SAY_DEATH -1576002
+#define SAY_RIFT -1576003
+#define SAY_SHIELD -1576004
+
+struct TRINITY_DLL_DECL boss_anomalusAI : public ScriptedAI
+{
+ boss_anomalusAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ //Source DBM
+ if((((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 80) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 77))
+ || (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 55) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 52))
+ || (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30) && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) > 27)))
+ {
+ //Summon rift at a random location
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+/*######
+## Crazed Mana Wraiths
+######*/
+#define SPELL_ARCANE_MISSILES 33833
+
+struct TRINITY_DLL_DECL mob_crazed_mana_wraithAI : public ScriptedAI
+{
+ mob_crazed_mana_wraithAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+/*######
+## Chaotic Rift
+######*/
+#define SPELL_CHAOTIC_ENERGY_BURST 47688
+#define SPELL_CHARGED_CHAOTIC_ENERGY_BURST 47737
+
+struct TRINITY_DLL_DECL npc_chaotic_riftAI : public ScriptedAI
+{
+ npc_chaotic_riftAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+CreatureAI* GetAI_npc_chaotic_rift(Creature *_Creature)
+{
+ return new npc_chaotic_riftAI (_Creature);
+}
+
+CreatureAI* GetAI_boss_anomalus(Creature *_Creature)
+{
+ return new boss_anomalusAI (_Creature);
+}
+
+CreatureAI* GetAI_mob_crazed_mana_wraith(Creature *_Creature)
+{
+ return new boss_anomalusAI (_Creature);
+}
+
+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_crazed_mana_wraith";
+ newscript->GetAI = GetAI_mob_crazed_mana_wraith;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_chaotic_rift";
+ newscript->GetAI = GetAI_npc_chaotic_rift;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp
new file mode 100644
index 00000000000..7c764c3ec1a
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_keristrasza.cpp
@@ -0,0 +1,89 @@
+/* Script Data Start
+SDName: Boss keristrasza
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_maiden_of_grief' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_TAIL_SWEEP 50155
+#define SPELL_CRYSTAL_CHAINS 50997
+#define SPELL_ENRAGE 8599
+#define SPELL_CRYSTALFIRE_BREATH_1 48096
+#define SPELL_CRYSTALFIRE_BREATH_2 57091
+#define SPELL_CRYSTALIZE 48179
+#define SPELL_INTENSE_COLD 48095 //stackable debuff
+
+//Yell
+#define SAY_AGGRO -1576005
+#define SAY_SLAY -1576006
+#define SAY_ENRAGE -1576007
+#define SAY_DEATH -1576008
+#define SAY_CRYSTAL_NOVA -1576009
+
+struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI
+{
+ boss_keristraszaAI(Creature *c) : ScriptedAI(c) {}
+
+ bool enraged;
+
+ void Reset()
+ {
+ enraged = false;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 10)
+ {
+ if(!enraged)
+ {
+ DoScriptText(SAY_ENRAGE, m_creature);
+ DoCast(m_creature, SPELL_ENRAGE);
+ enraged = true;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_SLAY, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_keristrasza(Creature *_Creature)
+{
+ return new boss_keristraszaAI (_Creature);
+}
+
+void AddSC_boss_keristrasza()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_keristrasza";
+ newscript->GetAI = GetAI_boss_keristrasza;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp
new file mode 100644
index 00000000000..0d97b530376
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_magus_telestra.cpp
@@ -0,0 +1,118 @@
+/* Script Data Start
+SDName: Boss magus_telestra
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+#include "def_nexus.h"
+
+
+//Spells
+
+//phase 1
+#define SPELL_ICE_NOVA 47772
+#define SPELL_ICE_NOVA 56935
+#define SPELL_FIREBOMB 47773
+#define SPELL_FIREBOMB 56934
+#define SPELL_GAVITY_WELL 47756
+
+//Phase 2 -->50% HP (3 clones, Frost, Fire, Arcane)
+//Frost Magus (npc 26930)
+#define FROST_MAGUS_VISUAL 47706 //Dummy
+#define SPELL_BLIZZARD_N 47727
+#define SPELL_ICE_BARB_N 47729
+//heroic
+#define SPELL_BLIZZARD_H 56936
+#define SPELL_ICE_BARB_H 56937
+
+//Fire Magus (npc 26928)
+#define FIRE_MAGUS_VISUAL 47705 //Dummy
+#define SPELL_FIRE_BLAST 47721
+#define SPELL_SCORCH 47723
+//heroic
+#define SPELL_FIRE_BLAST_H 56939
+#define SPELL_SCORCH_H 56938
+
+//Arcane Magus (npc 26929)
+#define ARCANE_MAGUS_VISUAL 47704 //Dummy
+#define SPELL_CRITTER 47731
+#define SPELL_TIME_STOP 47736
+
+//Yell
+#define SAY_AGGRO -1576010
+#define SAY_KILL -1576011
+#define SAY_DEATH -1576012
+#define SAY_MERGE -1576013
+#define SAY_SPLIT_1 -1576014
+#define SAY_SPLIT_2 -1576015
+
+
+struct TRINITY_DLL_DECL boss_magus_telestraAI : public ScriptedAI
+{
+ boss_magus_telestraAI(Creature *c) : ScriptedAI(c) {}
+
+ bool splited;
+ uint64 Magus_frost,
+ Magus_fire,
+ Magus_arcane;
+
+ void Reset()
+ {
+ splited = false;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if(!splited)
+ {
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 50)
+ {
+ DoScriptText(SAY_SPLIT_1, m_creature);
+ //HandleSplit
+ splited = true;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_magus_telestra(Creature *_Creature)
+{
+ return new boss_magus_telestraAI (_Creature);
+}
+
+void AddSC_boss_magus_telestra()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_magus_telestra";
+ newscript->GetAI = GetAI_boss_magus_telestra;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp
new file mode 100644
index 00000000000..d4dcbae6616
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/boss_ormorok.cpp
@@ -0,0 +1,90 @@
+/* Script Data Start
+SDName: Boss ormorok
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CRYSTAL_SPIKES_1 47958
+#define SPELL_CRYSTAL_SPIKES_2 57082
+#define SPELL_CRYSTAL_SPIKES_3 57083
+#define SPELL_SPELL_REFLECTION 47981
+#define SPELL_TRAMPLE_N 48016
+#define SPELL_TRAMPLE_H 57066
+#define SPELL_FRENZY_N 48017
+#define SPELL_FRENZY_H 57086
+#define SPELL_SUMMON_CRYSTALLINE_TANGLER 61564 //summons npc 32665
+
+//Yell
+#define SAY_AGGRO -1576016
+#define SAY_KILL -1576017
+#define SAY_DEATH -1576018
+#define SAY_REFLECT -1576019
+#define SAY_ICE_SPIKES -1576020
+
+struct TRINITY_DLL_DECL boss_ormorokAI : public ScriptedAI
+{
+ boss_ormorokAI(Creature *c) : ScriptedAI(c) {}
+
+ bool frenzy;
+
+ void Reset()
+ {
+ frenzy = false;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) == 25)
+ {
+ if(!frenzy)
+ {
+ DoCast(m_creature, SPELL_FRENZY_N);
+ frenzy = true;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_ormorok(Creature *_Creature)
+{
+ return new boss_ormorokAI (_Creature);
+}
+
+void AddSC_boss_ormorok()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_ormorok";
+ newscript->GetAI = GetAI_boss_ormorok;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/commander_kolurg.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/commander_kolurg.cpp
new file mode 100644
index 00000000000..b8715fb6d7d
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/commander_kolurg.cpp
@@ -0,0 +1,57 @@
+/* Script Data Start
+SDName: Boss Commander Kolurg
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment: Only Alliance Heroic
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_commander_kolurg' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+#define SPELL_BATTLE_SHOUT 31403
+#define SPELL_CHARGE 60067
+#define SPELL_FRIGHTENING_SHOUT 19134
+#define SPELL_WHIRLWIND_1 38619
+#define SPELL_WHIRLWIND_2 38618
+
+//Yell
+#define SAY_AGGRO 1576024
+#define SAY_KILL 1576025
+#define SAY_DEATH 1576026
+
+struct TRINITY_DLL_DECL boss_commander_kolurgAI : public ScriptedAI
+{
+ boss_commander_kolurgAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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 *_Creature)
+{
+ return new boss_commander_kolurgAI (_Creature);
+}
+
+void AddSC_boss_commander_kolurg()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_commander_kolurg";
+ newscript->GetAI = GetAI_boss_commander_kolurg;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/commander_stoutbeard.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/commander_stoutbeard.cpp
new file mode 100644
index 00000000000..26ef1fc5f97
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/commander_stoutbeard.cpp
@@ -0,0 +1,63 @@
+/* Script Data Start
+SDName: Boss Commander Stoutbeard
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment: Only Horde Heroic
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_commander_stoutbeard' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+#define SPELL_BATTLE_SHOUT 31403
+#define SPELL_CHARGE 60067
+#define SPELL_FRIGHTENING_SHOUT 19134
+#define SPELL_WHIRLWIND_1 38619
+#define SPELL_WHIRLWIND_2 38618
+
+//Yell
+#define SAY_AGGRO 1576021
+#define SAY_KILL 1576022
+#define SAY_DEATH 1576023
+
+struct TRINITY_DLL_DECL boss_commander_stoutbeardAI : public ScriptedAI
+{
+ boss_commander_stoutbeardAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_commander_stoutbeard(Creature *_Creature)
+{
+ return new boss_commander_stoutbeardAI (_Creature);
+}
+
+void AddSC_boss_commander_stoutbeard()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_commander_stoutbeard";
+ newscript->GetAI = GetAI_boss_commander_stoutbeard;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h b/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h
new file mode 100644
index 00000000000..d868c72adf6
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/def_nexus.h
@@ -0,0 +1,35 @@
+#ifndef DEF_NEXUS_H
+#define DEF_NEXUS_H
+
+#define DATA_ANOMALUSDEAD 1
+#define DATA_ANOMALUS_DEATH 2
+#define DATA_ORMOROKDDEAD 3
+#define DATA_ORMOROK_DEATH 4
+
+#define DATA_MAGUSTELESTRADEAD 5
+#define DATA_MAGUSTELESTRA_DEATH 6
+#define DATA_MAGUSTELESTRA_A_DEAD 7
+#define DATA_MAGUSTELESTRA_A_DEATH 8
+#define DATA_MAGUSTELESTRA_F_DEAD 9
+#define DATA_MAGUSTELESTRA_F_DEATH 10
+#define DATA_MAGUSTELESTRA_FI_DEAD 11
+#define DATA_MAGUSTELESTRA_FI_DEATH 12
+
+#define DATA_KERISTRASZADEAD 13
+#define DATA_KERISTRASZA_DEATH 14
+#define DATA_COMMANDER_KOLURGDEAD 15
+#define DATA_COMMANDER_KOLURG_DEATH 16
+#define DATA_COMMANDER_STOUTBEARDDEAD 17
+#define DATA_COMMANDER_STOUTBEARD_DEATH 18
+#define DATA_ANOMALUS 19
+#define DATA_ORMOROK 20
+
+#define DATA_MAGUSTELESTRA 21
+#define DATA_MAGUSTELESTRA_A 22
+#define DATA_MAGUSTELESTRA_F 23
+#define DATA_MAGUSTELESTRA_FI 24
+
+#define DATA_KERISTRASZA 25
+#define DATA_COMMANDER_KOLURG 26
+#define DATA_COMMANDER_STOUTBEARD 27
+#endif
diff --git a/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp b/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp
new file mode 100644
index 00000000000..7f07b372be9
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/nexus/instance_nexus.cpp
@@ -0,0 +1,158 @@
+#include "precompiled.h"
+#include "def_nexus.h"
+
+struct TRINITY_DLL_DECL instance_nexus : public ScriptedInstance
+{
+ instance_nexus(Map *Map) : ScriptedInstance(Map) {Initialize();};
+
+ uint64 Anomalus,
+ Ormorok,
+ Magus_telestra,
+ Magus_frost,
+ Magus_fire,
+ Magus_arcane,
+ keristrasza,
+ Commander_kolurg,
+ Commander_stoutbeard;
+ bool IsBossDied[9];
+
+ void Initialize()
+ {
+ Anomalus = 0;
+ Ormorok = 0;
+ Magus_telestra =0;
+ Magus_frost =0;
+ Magus_fire =0;
+ Magus_arcane =0;
+ keristrasza =0;
+ Commander_kolurg = 0;
+ Commander_stoutbeard = 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
+ {
+ //not active
+ return false;
+ }
+ void OnCreatureCreate(Creature *creature, uint32 creature_entry)
+ {
+ switch(creature->GetEntry())
+ {
+ case 26763: Anomalus = creature->GetGUID(); break;
+ case 26794: Ormorok = creature->GetGUID(); break;
+ case 26731: Magus_telestra = creature->GetGUID(); break;
+ case 26930: Magus_frost = creature->GetGUID(); break;
+ case 26928: Magus_fire = creature->GetGUID(); break;
+ case 26926: Magus_arcane = creature->GetGUID(); break;
+ case 26723: keristrasza = creature->GetGUID(); break;
+ case 26798: Commander_kolurg = creature->GetGUID(); break;
+ case 26796: Commander_stoutbeard = creature->GetGUID(); break;
+ }
+ }
+ uint32 GetData(uint32 type)
+ {
+ switch(type)
+ {
+ case DATA_ANOMALUSDEAD:
+ if(IsBossDied[0])
+ return 1;
+ break;
+ case DATA_ORMOROKDDEAD:
+ if(IsBossDied[1])
+ return 1;
+ break;
+ case DATA_MAGUSTELESTRADEAD:
+ if(IsBossDied[2])
+ return 1;
+ break;
+ case DATA_MAGUSTELESTRA_A_DEAD:
+ if(IsBossDied[3])
+ return 1;
+ break;
+ case DATA_MAGUSTELESTRA_F_DEAD:
+ if(IsBossDied[4])
+ return 1;
+ break;
+ case DATA_MAGUSTELESTRA_FI_DEAD:
+ if(IsBossDied[5])
+ return 1;
+ break;
+ case DATA_KERISTRASZADEAD:
+ if(IsBossDied[6])
+ return 1;
+ break;
+ case DATA_COMMANDER_KOLURGDEAD:
+ if(IsBossDied[7])
+ return 1;
+ break;
+ case DATA_COMMANDER_STOUTBEARDDEAD:
+ if(IsBossDied[8])
+ return 1;
+ break;
+ }
+
+ return 0;
+ }
+
+ uint64 GetData64 (uint32 identifier)
+ {
+ return 0;
+ }
+
+ void SetData(uint32 type, uint32 data)
+ {
+ switch(type)
+ {
+ case DATA_ANOMALUS_DEATH:
+ IsBossDied[0] = true;
+ break;
+ case DATA_ORMOROK_DEATH:
+ IsBossDied[1] = true;
+ break;
+ case DATA_MAGUSTELESTRA_DEATH:
+ IsBossDied[2] = true;
+ break;
+ case DATA_MAGUSTELESTRA_A_DEATH:
+ IsBossDied[3] = true;
+ break;
+ case DATA_MAGUSTELESTRA_F_DEATH:
+ IsBossDied[4] = true;
+ break;
+ case DATA_MAGUSTELESTRA_FI_DEAD:
+ IsBossDied[5] = true;
+ break;
+ case DATA_KERISTRASZA_DEATH:
+ IsBossDied[6] = true;
+ break;
+ case DATA_COMMANDER_KOLURG_DEATH:
+ IsBossDied[7] = true;
+ break;
+ case DATA_COMMANDER_STOUTBEARD_DEATH:
+ IsBossDied[8] = true;
+ break;
+ }
+ }
+};
+
+InstanceData* GetInstanceData_instance_nexus(Map* map)
+{
+ return new instance_nexus(map);
+}
+
+void AddSC_instance_nexus()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_nexus";
+ newscript->GetInstanceData = GetInstanceData_instance_nexus;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/boss_drakos.cpp b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_drakos.cpp
new file mode 100644
index 00000000000..eca9760262c
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_drakos.cpp
@@ -0,0 +1,82 @@
+/* Script Data Start
+SDName: Boss drakos
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_MAGIC_PULL 51336
+#define SPELL_THUNDERING_STOMP 50774
+#define SPELL_THUNDERING_STOMP_2 59370
+
+//Yell
+#define SAY_AGGRO -1578000
+#define SAY_KILL_1 -1578001
+#define SAY_KILL_2 -1578002
+#define SAY_KILL_3 -1578003
+#define SAY_DEATH -1578004
+#define SAY_PULL_1 -1578005
+#define SAY_PULL_2 -1578006
+#define SAY_PULL_3 -1578007
+#define SAY_PULL_4 -1578008
+#define SAY_STOMP_1 -1578009
+#define SAY_STOMP_2 -1578010
+#define SAY_STOMP_3 -1578011
+
+struct TRINITY_DLL_DECL boss_drakosAI : public ScriptedAI
+{
+ boss_drakosAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_KILL_1, m_creature);break;
+ case 1: DoScriptText(SAY_KILL_2, m_creature);break;
+ case 2: DoScriptText(SAY_KILL_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_drakos(Creature *_Creature)
+{
+ return new boss_drakosAI (_Creature);
+}
+
+void AddSC_boss_drakos()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_drakos";
+ newscript->GetAI = GetAI_boss_drakos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/boss_eregos.cpp b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_eregos.cpp
new file mode 100644
index 00000000000..abfa904beb6
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_eregos.cpp
@@ -0,0 +1,104 @@
+/* Script Data Start
+SDName: Boss eregos
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment: Encounter is done entirely on drake vehicles
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer)
+//Two Repeating phases
+
+//Spells
+#define SPELL_ARCANE_BARRAGE 50804
+#define SPELL_ARCANE_VOLLEY 51153
+#define SPELL_ENRAGED_ASSAULT 51170
+#define SPELL_PLANAR_ANOMALIES 57959
+#define SPELL_PLANAR_SHIFT 51162
+
+//Heroic
+#define SPELL_ARCANE_BARRAGE_H 59381
+#define SPELL_ARCANE_VOLLEY_H 59382
+
+/*Ruby Drake ,
+(npc 27756) (item 37860)
+(summoned by spell Ruby Essence = 37860 ---> Call Amber Drake == 49462 ---> Summon 27756)
+*/
+#define NPC_RUBY_DRAKE_VEHICLE 27756
+#define SPELL_RIDE_RUBY_DRAKE_QUE 49463 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49464
+#define SPELL_RUBY_DRAKE_SADDLE 49464 //Allows you to ride on the back of an Amber Drake. ---> Dummy
+
+#define SPELL_RUBY_SEARING_WRATH 50232 //(60 yds) - Instant - Breathes a stream of fire at an enemy dragon, dealing 6800 to 9200 Fire damage and then jumping to additional dragons within 30 yards. Each jump increases the damage by 50%. Affects up to 5 total targets
+#define SPELL_RUBY_EVASIVE_AURA 50248 //Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells.
+#define SPELL_RUBY_EVASIVE_MANEUVERS 50240 //Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted.
+//you do not have acces to until you kill Mage-Lord Urom
+#define SPELL_RUBY_MARTYR 50253 //Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec.
+
+/*Amber Drake,
+(npc 27755) (item 37859)
+(summoned by spell Amber Essence = 37859 ---> Call Amber Drake == 49461 ---> Summon 27755)
+*/
+#define NPC_AMBER_DRAKE_VEHICLE 27755
+#define SPELL_RIDE_AMBER_DRAKE_QUE 49459 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49460
+#define SPELL_AMBER_DRAKE_SADDLE 49460 //Allows you to ride on the back of an Amber Drake. ---> Dummy
+
+#define SPELL_AMBER_SHOCK_LANCE 49840 //(60 yds) - Instant - Deals 4822 to 5602 Arcane damage and detonates all Shock Charges on an enemy dragon. Damage is increased by 6525 for each detonated.
+#define SPELL_AMBER_STOP_TIME //Instant - 1 min cooldown - Halts the passage of time, freezing all enemy dragons in place for 10 sec. This attack applies 5 Shock Charges to each affected target.
+//you do not have access to until you kill the Mage-Lord Urom.
+#define SPELL_AMBER_TEMPORAL_RIFT 49592 //(60 yds) - Channeled - Channels a temporal rift on an enemy dragon for 10 sec. While trapped in the rift, all damage done to the target is increased by 100%. In addition, for every 15,000 damage done to a target affected by Temporal Rift, 1 Shock Charge is generated.
+
+/*Emerald Drake,
+(npc 27692) (item 37815),
+ (summoned by spell Emerald Essence = 37815 ---> Call Emerald Drake == 49345 ---> Summon 27692)
+*/
+#define NPC_EMERALD_DRAKE_VEHICLE 27692
+#define SPELL_RIDE_EMERALD_DRAKE_QUE 49427 //Apply Aura: Periodic Trigger, Interval: 3 seconds ---> 49346
+#define SPELL_EMERALD_DRAKE_SADDLE 49346 //Allows you to ride on the back of an Amber Drake. ---> Dummy
+
+#define SPELL_EMERALD_LEECHING_POISON 50328 //(60 yds) - Instant - Poisons the enemy dragon, leeching 1300 to the caster every 2 sec. for 12 sec. Stacks up to 3 times.
+#define SPELL_EMERALD_TOUCH_THE_NIGHTMARE 50341 //(60 yds) - Instant - Consumes 30% of the caster's max health to inflict 25,000 nature damage to an enemy dragon and reduce the damage it deals by 25% for 30 sec.
+// you do not have access to until you kill the Mage-Lord Urom
+#define 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 TRINITY_DLL_DECL boss_eregosAI : public ScriptedAI
+{
+ boss_eregosAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase =1;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+CreatureAI* GetAI_boss_eregos(Creature *_Creature)
+{
+ return new boss_eregosAI (_Creature);
+}
+
+void AddSC_boss_eregos()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_eregos";
+ newscript->GetAI = GetAI_boss_eregos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/boss_urom.cpp b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_urom.cpp
new file mode 100644
index 00000000000..f7d35d014dd
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_urom.cpp
@@ -0,0 +1,87 @@
+/* Script Data Start
+SDName: Boss urom
+SDAuthor: LordVanMartin
+SD%Complete: 1%
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCANE_SHIELD 53813 //Dummy --> Channeled, shields the caster from damage.
+#define SPELL_EMPOWERED_ARCANE_EXPLOSION 51110
+#define SPELL_EMPOWERED_ARCANE_EXPLOSION_2 59377
+#define SPELL_FROSTBOMB 51103 //Urom throws a bomb, hitting its target with the highest aggro which inflict directly 650 frost damage and drops a frost zone on the ground. This zone deals 650 frost damage per second and reduce the movement speed by 35%. Lasts 1 minute.
+#define SPELL_SUMMON_MENAGERIE 50476 //Summons an assortment of creatures and teleports the caster to safety.
+#define SPELL_SUMMON_MENAGERIE_2 50495
+#define SPELL_SUMMON_MENAGERIE_3 50496
+#define SPELL_TELEPORT 51112 //Teleports to the center of Oculus
+#define SPELL_TIME_BOMB 51121 //Deals arcane damage to a random player, and after 6 seconds, deals zone damage to nearby equal to the health missing of the target afflicted by the debuff.
+#define SPELL_TIME_BOMB_2 59376
+
+//Yell
+#define SAY_AGGRO -1578012
+#define SAY_KILL_1 -1578013
+#define SAY_KILL_2 -1578014
+#define SAY_KILL_3 -1578015
+#define SAY_DEATH -1578016
+#define SAY_EXPLOSION_1 -1578017
+#define SAY_EXPLOSION_2 -1578018
+#define SAY_SUMMON_1 -1578019
+#define SAY_SUMMON_2 -1578020
+#define SAY_SUMMON_3 -1578021
+
+struct TRINITY_DLL_DECL boss_uromAI : public ScriptedAI
+{
+ boss_uromAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_KILL_1, m_creature);break;
+ case 1: DoScriptText(SAY_KILL_2, m_creature);break;
+ case 2: DoScriptText(SAY_KILL_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_urom(Creature *_Creature)
+{
+ return new boss_uromAI (_Creature);
+}
+
+void AddSC_boss_urom()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_urom";
+ newscript->GetAI = GetAI_boss_urom;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/boss_varos.cpp b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_varos.cpp
new file mode 100644
index 00000000000..272196008f2
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/boss_varos.cpp
@@ -0,0 +1,85 @@
+/* Script Data Start
+SDName: Boss varos
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ENERGIZE_CORES 50785 //Damage 5938 to 6562, effec2 Triggers 54069, effect3 Triggers 56251
+#define SPELL_ENERGIZE_CORES_TRIGGER_1 54069
+#define SPELL_ENERGIZE_CORES_TRIGGER_2 56251
+#define SPELL_ENERGIZE_CORES_2 59372 //Damage 9025 to 9975, effect2 Triggers 54069, effect 56251
+#define SPELL_CALL_AZURE_RING_CAPTAIN 51002 //Effect Send Event (12229)
+#define SPELL_CALL_AZURE_RING_CAPTAIN_2 51006 //Effect Send Event (10665)
+#define SPELL_CALL_AZURE_RING_CAPTAIN_3 51007 //Effect Send Event (18454)
+#define SPELL_CALL_AZURE_RING_CAPTAIN_4 51008 //Effect Send Event (18455)
+#define SPELL_CALL_AMPLIFY_MAGIC 51054
+#define SPELL_CALL_AMPLIFY_MAGIC_2 59371
+
+//Yell
+#define SAY_AGGRO -1578022
+#define SAY_KILL_1 -1578023
+#define SAY_KILL_2 -1578024
+#define SAY_DEATH -1578025
+#define SAY_STRIKE_1 -1578026
+#define SAY_STRIKE_2 -1578027
+#define SAY_STRIKE_3 -1578028
+#define SAY_SPAWN -1578029
+
+
+struct TRINITY_DLL_DECL boss_varosAI : public ScriptedAI
+{
+ boss_varosAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%2)
+ {
+ case 0: DoScriptText(SAY_KILL_1, m_creature);break;
+ case 1: DoScriptText(SAY_KILL_2, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_varos(Creature *_Creature)
+{
+ return new boss_varosAI (_Creature);
+}
+
+void AddSC_boss_varos()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_varos";
+ newscript->GetAI = GetAI_boss_varos;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/def_oculus.h b/src/bindings/scripts/scripts/zone/nexus/oculus/def_oculus.h
new file mode 100644
index 00000000000..0b63a52d866
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/def_oculus.h
@@ -0,0 +1,4 @@
+#ifndef DEF_OCULUS_H
+#define DEF_OCULUS_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/nexus/oculus/instance_oculus.cpp b/src/bindings/scripts/scripts/zone/nexus/oculus/instance_oculus.cpp
new file mode 100644
index 00000000000..ecf6bcfae89
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/nexus/oculus/instance_oculus.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_oculus.h"
+
+struct TRINITY_DLL_DECL instance_oculus : public ScriptedInstance
+{
+ instance_oculus(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_oculus(Map* map)
+{
+ return new instance_oculus(map);
+}
+
+void AddSC_instance_oculus()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_oculus";
+ newscript->GetInstanceData = GetInstanceData_instance_oculus;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp b/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp
new file mode 100644
index 00000000000..73e6157c600
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/boss_sartharion.cpp
@@ -0,0 +1,300 @@
+/* Script Data Start
+SDName: Boss sartharion
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Sartharion Spells
+#define SPELL_BERSERK 61632 // Increases the caster's attack speed by 150% and all damage it deals by 500% for 5 min.
+#define SPELL_CLEAVE 56909 // Inflicts 35% weapon damage to an enemy and its nearest allies, affecting up to 10 targets.
+#define SPELL_FLAME_BREATH_N 56908 // Inflicts 8750 to 11250 Fire damage to enemies in a cone in front of the caster.
+#define SPELL_FLAME_BREATH_H 58956 // Inflicts 10938 to 14062 Fire damage to enemies in a cone in front of the caster.
+#define SPELL_TAIL_LASH_N 56910 // A sweeping tail strike hits all enemies behind the caster, inflicting 3063 to 3937 damage and stunning them for 2 sec.
+#define SPELL_TAIL_LASH_H 58957 // A sweeping tail strike hits all enemies behind the caster, inflicting 4375 to 5625 damage and stunning them for 2 sec.
+#define SPELL_WILL_OF_SARTHARION 61254 // Sartharion's presence bolsters the resolve of the Twilight Drakes, increasing their total health by 25%. This effect also increases Sartharion's health by 25%.
+#define SPELL_POWER_OF_SARTHARION 61254 //Shadron's presence increases Fire damage taken by all enemies by 100%.
+
+//Sartharion Yell
+#define SAY_SARTHARION_AGGRO -1615016
+#define SAY_SARTHARION_BERSERK -1615017
+#define SAY_SARTHARION_BREATH -1615018
+#define SAY_SARTHARION_CALL_SHADRON -1615019
+#define SAY_SARTHARION_CALL_TENEBRON -1615020
+#define SAY_SARTHARION_CALL_VESPERON -1615021
+#define SAY_SARTHARION_DEATH -1615022
+#define SAY_SARTHARION_SPECIAL_1 -1615023
+#define SAY_SARTHARION_SPECIAL_2 -1615024
+#define SAY_SARTHARION_SPECIAL_3 -1615025
+#define SAY_SARTHARION_SPECIAL_4 -1615026
+#define SAY_SARTHARION_SLAY_1 -1615027
+#define SAY_SARTHARION_SLAY_2 -1615028
+#define SAY_SARTHARION_SLAY_3 -1615029
+
+//Miniboses (Vesperon, Shadron, Tenebron)
+#define SPELL_SHADOW_BREATH_H 59126 //Inflicts 8788 to 10212 Fire damage to enemies in a cone in front of the caster.
+#define SPELL_SHADOW_BREATH_N 57570 //Inflicts 6938 to 8062 Fire damage to enemies in a cone in front of the caster.
+//TAIL LASH the same as Sartharion's
+#define SPELL_SHADOW_FISSURE_H 59127 //Deals 9488 to 13512 Shadow damage to any enemy within the Shadow fissure after 5 sec.
+#define SPELL_SHADOW_FISSURE_N 57579 //Deals 6188 to 8812 Shadow damage to any enemy within the Shadow fissure after 5 sec.
+
+//Vesperon
+#define MINIBOSS_VESPERON 30449 //npc 30449 //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal spawns multiple times
+#define BUFF_POWER_OF_VESPERON 61251 //Vesperon's presence decreases the maximum health of all enemies by 25%.
+
+//Shadron
+#define MINIBOSS_SHADRON 30451 //npc 30451 //In portal is a disciple, when disciple killed remove Power_of_vesperon, portal spawns multiple times
+#define BUFF_POWER_OF_SHADRON 58105 //Shadron's presence increases Fire damage taken by all enemies by 100%.
+
+//Tenebron
+#define MINIBOSS_TENEBRON 30452 //npc 30452 //in the portal spawns 6 eggs, if not killed in time (approx. 20s) they will hatch, whelps can cast 60708
+#define BUFF_POWER_OF_TENEBRON 61248 //Tenebron's presence increases Shadow damage taken by all enemies by 100%.
+
+//Minibosses common spells
+#define SPELL_SHADOW_BREATH_N 57570
+#define SPELL_SHADOW_BREATH_H 59126
+#define SPELL_SHADOW_FISSURE_N 57579
+#define SPELL_SHADOW_FISSURE_H 59127
+#define SPELL_TWILIGHT_REVENGE 60639
+
+//Tenebron, dummy spell
+#define SPELL_HATCH_EGGS 58793
+
+//Whelps
+#define TWILIGHT_WHELP 30890 //npc 30890
+#define SHARTHARION_TWILIGHT_WHELP 31214 //npc 31214
+#define SPELL_FADE_ARMOR 60708 //Reduces the armor of an enemy by 1500 for 15s
+
+/*Summons a portal, which all DPS and one healer should go through and proceed to kill all eggs. After about 20 seconds these eggs will hatch into whelplings with 60k health. Whelplings that hatched should be picked up by a tank and killed.
+Hatch Eggs Tenebron summons a portal in which eggs are spawned. After about 20s the eggs hatches into Whelps (156,396 hp - amount of whelps determined by Normal or Heroic mode) that do Fade Armor. */
+
+struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI
+{
+ boss_sartharionAI(Creature *c) : ScriptedAI(c) {}
+
+ bool berserk;
+
+ void Reset()
+ {
+ berserk = false;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_SARTHARION_DEATH,m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= 10)
+ {
+ if(!berserk){
+ DoCast(m_creature,SPELL_BERSERK);
+ berserk = true;
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_SARTHARION_DEATH,m_creature);
+ }
+};
+
+/*######
+## Mob Vesperon
+######*/
+
+//Vesperon Yell
+#define SAY_VESPERON_AGGRO -1615030
+#define SAY_VESPERON_SLAY_1 -1615031
+#define SAY_VESPERON_SLAY_2 -1615032
+#define SAY_VESPERON_DEATH -1615033
+#define SAY_VESPERON_BREATH -1615034
+#define SAY_VESPERON_RESPOND -1615035
+#define SAY_VESPERON_SPECIAL_1 -1615036
+#define SAY_VESPERON_SPECIAL_2 -1615037
+
+struct TRINITY_DLL_DECL mob_vesperonAI : public ScriptedAI
+{
+ mob_vesperonAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_VESPERON_AGGRO,m_creature);
+ }
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_VESPERON_DEATH,m_creature);
+ }
+};
+
+/*######
+## Mob Shadron
+######*/
+
+//Shadron Yell
+#define SAY_SHADRON_AGGRO -1615000
+#define SAY_SHADRON_SLAY_1 -1615001
+#define SAY_SHADRON_SLAY_2 -1615002
+#define SAY_SHADRON_DEATH -1615003
+#define SAY_SHADRON_BREATH -1615004
+#define SAY_SHADRON_RESPOND -1615005
+#define SAY_SHADRON_SPECIAL_1 -1615006
+#define SAY_SHADRON_SPECIAL_2 -1615007
+
+struct TRINITY_DLL_DECL mob_shadronAI : public ScriptedAI
+{
+ mob_shadronAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset(){}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_SHADRON_AGGRO,m_creature);
+ }
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_SHADRON_DEATH,m_creature);
+ }
+};
+/*######
+## Mob Tenebron
+######*/
+
+//Yell
+#define SAY_TENEBRON_AGGRO -1615008
+#define SAY_TENEBRON_SLAY_1 -1615009
+#define SAY_TENEBRON_SLAY_2 -1615010
+#define SAY_TENEBRON_DEATH -1615011
+#define SAY_TENEBRON_BREATH -1615012
+#define SAY_TENEBRON_RESPOND -1615013
+#define SAY_TENEBRON_SPECIAL_1 -1615014
+#define SAY_TENEBRON_SPECIAL_2 -1615015
+
+struct TRINITY_DLL_DECL mob_tenebronAI : public ScriptedAI
+{
+ mob_tenebronAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_TENEBRON_AGGRO,m_creature);
+ }
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_TENEBRON_DEATH,m_creature);
+ }
+};
+
+/*######
+## Mob Whelps
+######*/
+struct TRINITY_DLL_DECL mob_whelpAI : public ScriptedAI
+{
+ mob_whelpAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 Fade_armor_Timer;
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer) {}
+};
+
+CreatureAI* GetAI_mob_whelp(Creature *_Creature)
+{
+ return new mob_whelpAI (_Creature);
+}
+
+CreatureAI* GetAI_mob_tenebron(Creature *_Creature)
+{
+ return new mob_tenebronAI (_Creature);
+}
+
+CreatureAI* GetAI_mob_shadron(Creature *_Creature)
+{
+ return new mob_shadronAI (_Creature);
+}
+
+CreatureAI* GetAI_mob_vesperon(Creature *_Creature)
+{
+ return new mob_vesperonAI (_Creature);
+}
+
+CreatureAI* GetAI_boss_sartharion(Creature *_Creature)
+{
+ return new boss_sartharionAI (_Creature);
+}
+
+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_whelp";
+ newscript->GetAI = GetAI_mob_whelp;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h b/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
new file mode 100644
index 00000000000..59d76502af3
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/def_obsidian_sanctum.h
@@ -0,0 +1,4 @@
+#ifndef DEF_OBSIDIAN_SANCTUM_H
+#define DEF_OBSIDIAN_SANCTUM_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp b/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
new file mode 100644
index 00000000000..2e24a1ae415
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/obsidian_sanctum/instance_obsidian_sanctum.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_obsidian_sanctum.h"
+
+struct TRINITY_DLL_DECL instance_obsidian_sanctum : public ScriptedInstance
+{
+ instance_obsidian_sanctum(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_obsidian_sanctum(Map* map)
+{
+ return new instance_obsidian_sanctum(map);
+}
+
+void AddSC_instance_obsidian_sanctum()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_obsidian_sanctum";
+ newscript->GetInstanceData = GetInstanceData_instance_obsidian_sanctum;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/razorfen_downs/razorfen_downs.cpp b/src/bindings/scripts/scripts/zone/razorfen_downs/razorfen_downs.cpp
new file mode 100644
index 00000000000..d5c09e504a8
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/razorfen_downs/razorfen_downs.cpp
@@ -0,0 +1,85 @@
+/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* ScriptData
+SDName: Razorfen_Downs
+SD%Complete: 100
+SDComment: Support for Henry Stern(2 recipes)
+SDCategory: Razorfen Downs
+EndScriptData */
+
+/* ContentData
+npc_henry_stern
+EndContentData */
+
+#include "precompiled.h"
+
+/*###
+# npc_henry_stern
+####*/
+
+enum
+{
+ SPELL_GOLDTHORN_TEA = 13028,
+ SPELL_TEACHING_GOLDTHORN_TEA = 13029,
+ SPELL_MIGHT_TROLLS_BLOOD_POTION = 3451,
+ SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION = 13030,
+ GOSSIP_TEXT_TEA_ANSWER = 2114,
+ GOSSIP_TEXT_POTION_ANSWER = 2115,
+};
+
+#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)
+{
+ if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA))
+ pPlayer->ADD_GOSSIP_ITEM(0, 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(0, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
+
+ pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID());
+ return true;
+}
+
+bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
+{
+ if (action == GOSSIP_ACTION_INFO_DEF + 1)
+ {
+ pCreature->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true);
+ pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID());
+ }
+
+ if (action == GOSSIP_ACTION_INFO_DEF + 2)
+ {
+ pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID());
+ pCreature->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true);
+ }
+
+ return true;
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
index 2edb4afcf16..8a65b493c5a 100644
--- a/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
+++ b/src/bindings/scripts/scripts/zone/razorfen_kraul/razorfen_kraul.cpp
@@ -49,7 +49,7 @@ npc_willixAI(Creature *c) : npc_escortAI(c) {}
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -114,7 +114,7 @@ npc_willixAI(Creature *c) : npc_escortAI(c) {}
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_WILLIX_THE_IMPORTER);
}
}
diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
index 6b14a4c9e45..9d1b447e746 100644
--- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
+++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
@@ -464,7 +464,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
if (withhead)
SaySound(SAY_PLAYER_DEATH);
else { //maybe possible when player dies from conflagration
- Creature *Head = (Creature*)Unit::GetUnit((*m_creature), headGUID);
+ Creature *Head = Unit::GetCreature((*m_creature), headGUID);
if (Head)
((mob_headAI*)Head->AI())->SaySound(SAY_PLAYER_DEATH);
}
@@ -666,7 +666,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
{
if (Phase > 1) --Phase;
else Phase = 1;
- Creature* Head = (Creature*)Unit::GetUnit((*m_creature), headGUID);
+ Creature* Head = Unit::GetCreature((*m_creature), headGUID);
if (Head && Head->isAlive())
{
((mob_headAI*)Head->AI())->Phase = Phase;
@@ -697,7 +697,7 @@ void mob_headAI::Disappear()
return;
if (bodyGUID)
{
- Creature *body = (Creature*)Unit::GetUnit((*m_creature), bodyGUID);
+ Creature *body = Unit::GetCreature((*m_creature), bodyGUID);
if(body && body->isAlive())
{
withbody = true;
diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp
index bccbcb62c33..956fa26bdac 100644
--- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp
+++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_herod.cpp
@@ -105,45 +105,22 @@ struct TRINITY_DLL_DECL boss_herodAI : public ScriptedAI
}
};
-CreatureAI* GetAI_boss_herod(Creature *_Creature)
+CreatureAI* GetAI_boss_herod(Creature* pCreature)
{
- return new boss_herodAI (_Creature);
+ return new boss_herodAI(pCreature);
}
-float Location[12][3]=
-{
- {1945.81, -431.54, 16.36},
- {1946.21, -436.41, 16.36},
- {1950.01, -444.11, 14.63},
- {1956.08, -449.34, 13.12},
- {1966.59, -450.55, 11.27},
- {1976.09, -447.51, 11.27},
- {1983.42, -435.85, 11.27},
- {1978.17, -428.81, 11.27},
- {1973.97, -422.08, 9.04},
- {1963.84, -418.90, 6.17},
- {1961.22, -422.74, 6.17},
- {1964.80, -431.26, 6.17}
-};
-
-uint32 Wait[12][1]=
-{
- {0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{600000}
-};
-
struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI
{
- mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c) {}
-
- uint32 Start_Timer;
-
- void WaypointReached(uint32 i) { }
-
- void Reset()
+ mob_scarlet_traineeAI(Creature *c) : npc_escortAI(c)
{
- Start_Timer = urand(1500,4500);
+ Start_Timer = urand(1000,6000);
}
+ uint32 Start_Timer;
+
+ void Reset() { }
+ void WaypointReached(uint32 uiPoint) { }
void Aggro(Unit* who) { }
void UpdateAI(const uint32 diff)
@@ -161,14 +138,13 @@ struct TRINITY_DLL_DECL mob_scarlet_traineeAI : public npc_escortAI
}
};
-CreatureAI* GetAI_mob_scarlet_trainee(Creature* _Creature)
+CreatureAI* GetAI_mob_scarlet_trainee(Creature* pCreature)
{
- mob_scarlet_traineeAI* thisAI = new mob_scarlet_traineeAI(_Creature);
+ mob_scarlet_traineeAI* thisAI = new mob_scarlet_traineeAI(pCreature);
- for(uint32 i = 0; i < 12; ++i)
- thisAI->AddWaypoint(i, Location[i][0], Location[i][1], Location[i][2], Wait[i][0]);
+ thisAI->FillPointMovementListForCreature();
- return ((CreatureAI*)thisAI);
+ return (CreatureAI*)thisAI;
}
void AddSC_boss_herod()
diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
index 717849bc07f..6c8f0939b5c 100644
--- a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp
@@ -33,7 +33,11 @@ EndContentData */
## npc_shadowfang_prisoner
######*/
-#define SAY_FREE -1033000
+enum
+{
+ SAY_FREE = -1033000
+};
+
#define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door."
struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI
@@ -58,48 +62,33 @@ struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI
void Aggro(Unit* who) {}
};
-CreatureAI* GetAI_npc_shadowfang_prisoner(Creature *_Creature)
+CreatureAI* GetAI_npc_shadowfang_prisoner(Creature* pCreature)
{
- npc_shadowfang_prisonerAI* prisonerAI = new npc_shadowfang_prisonerAI(_Creature);
-
- uint32 eCreature = _Creature->GetEntry();
+ npc_shadowfang_prisonerAI* prisonerAI = new npc_shadowfang_prisonerAI(pCreature);
- if( eCreature==3849) //adamant
- prisonerAI->AddWaypoint(0, -254.47, 2117.48, 81.17);
- if( eCreature==3850) //ashcrombe
- prisonerAI->AddWaypoint(0, -252.35, 2126.71, 81.17);
-
- prisonerAI->AddWaypoint(1, -253.63, 2131.27, 81.28);
- prisonerAI->AddWaypoint(2, -249.66, 2142.45, 87.01);
- prisonerAI->AddWaypoint(3, -248.08, 2143.68, 87.01);
- prisonerAI->AddWaypoint(4, -238.87, 2139.93, 87.01);
- prisonerAI->AddWaypoint(5, -235.47, 2149.18, 90.59);
- prisonerAI->AddWaypoint(6, -239.89, 2156.06, 90.62, 20000);
+ prisonerAI->FillPointMovementListForCreature();
return (CreatureAI*)prisonerAI;
}
-bool GossipHello_npc_shadowfang_prisoner(Player *player, Creature *_Creature)
+bool GossipHello_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature)
{
- ScriptedInstance* pInstance = ((ScriptedInstance*)_Creature->GetInstanceData());
-
- if (!pInstance)
- return false;
-
- if (pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE)
- player->ADD_GOSSIP_ITEM( 0, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+ ScriptedInstance* pInstance = ((ScriptedInstance*)pCreature->GetInstanceData());
- player->SEND_GOSSIP_MENU(_Creature->GetNpcTextId(), _Creature->GetGUID());
+ if (pInstance && pInstance->GetData(TYPE_FREE_NPC) != DONE && pInstance->GetData(TYPE_RETHILGORE) == DONE)
+ pPlayer->ADD_GOSSIP_ITEM(0, GOSSIP_ITEM_DOOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
+
+ pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(), pCreature->GetGUID());
return true;
}
-bool GossipSelect_npc_shadowfang_prisoner(Player *player, Creature *_Creature, uint32 sender, uint32 action)
+bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
{
- if (action == GOSSIP_ACTION_INFO_DEF+1)
+ if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
{
- player->CLOSE_GOSSIP_MENU();
- ((npc_escortAI*)(_Creature->AI()))->Start(false, false, false);
+ pPlayer->CLOSE_GOSSIP_MENU();
+ ((npc_escortAI*)(pCreature->AI()))->Start(false, true, false);
}
return true;
}
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index 516ef7c5b09..0a84d13349e 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -129,7 +129,7 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI
DoScriptText(SAY_JUST_EATEN, m_creature);
if(PlayerGUID)
{
- Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(10804) == QUEST_STATUS_INCOMPLETE)
{
plr->KilledMonster(22131, m_creature->GetGUID());
@@ -259,7 +259,7 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI
Tapped = false;
if(PlayerGUID)
{
- Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(10854) == QUEST_STATUS_INCOMPLETE)
{
plr->KilledMonster(22316, m_creature->GetGUID());
@@ -357,7 +357,7 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI
{
if(PlayerGUID)
{
- Player* plr = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Player* plr = Unit::GetPlayer(PlayerGUID);
if(plr && plr->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
plr->KilledMonster(23209, m_creature->GetGUID());
}
@@ -701,7 +701,7 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI
Illidan->SetVisibility(VISIBILITY_OFF);
if(PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
DoScriptText(OVERLORD_SAY_1, m_creature, player);
}
ConversationTimer = 4200;
@@ -869,7 +869,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void Aggro(Unit *who)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_COILSKAR_ASSASSIN)
DoScriptText(SAY_AGGRO2, m_creature, player);
@@ -884,7 +884,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -953,7 +953,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
void SummonAssassin()
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
Unit* CoilskarAssassin = m_creature->SummonCreature(NPC_COILSKAR_ASSASSIN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), m_creature->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 0);
if( CoilskarAssassin )
@@ -972,7 +972,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI
{
if (PlayerGUID && !Completed)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_ESCAPE_FROM_COILSKAR_CISTERN);
}
@@ -1289,7 +1289,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
if(TorlothAnim[AnimationCount].Creature == 1)
{
- pCreature = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID));
+ pCreature = (Unit::GetCreature(*m_creature, LordIllidanGUID));
if(!pCreature)
return;
@@ -1309,7 +1309,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_BYTES_1,8);
break;
case 5:
- if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID)))
+ if(Player* AggroTarget = (Unit::GetPlayer(AggroTargetGUID)))
{
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, AggroTarget->GetGUID());
m_creature->AddThreat(AggroTarget, 1);
@@ -1317,7 +1317,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
}
break;
case 6:
- if(Player* AggroTarget = ((Player*)Unit::GetUnit((*m_creature), AggroTargetGUID)))
+ if(Player* AggroTarget = (Unit::GetPlayer(AggroTargetGUID)))
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->clearUnitState(UNIT_STAT_ROOT);
@@ -1392,7 +1392,7 @@ struct TRINITY_DLL_DECL mob_torloth_the_magnificentAI : public ScriptedAI
break;
}
- if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID)))
+ if(Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID)))
{
DoScriptText(END_TEXT, LordIllidan, slayer);
LordIllidan->AI()->EnterEvadeMode();
@@ -1485,7 +1485,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
{
if(PlayerGUID)
{
- if(Player* pTarget = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID)))
+ if(Player* pTarget = Unit::GetPlayer(PlayerGUID))
{
float x, y, z;
pTarget->GetPosition(x,y,z);
@@ -1510,7 +1510,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
void CheckEventFail()
{
- Player* pPlayer = ((Player*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Player* pPlayer = Unit::GetPlayer(PlayerGUID);
if(!pPlayer)
return;
@@ -1527,7 +1527,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++)
{
- GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid));
+ GroupMember = (Unit::GetPlayer(itr->guid));
if(!GroupMember)
continue;
if(!GroupMember->IsWithinDistInMap(m_creature, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
@@ -1553,7 +1553,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
{
for(Group::member_citerator itr = members.begin(); itr!= members.end(); itr++)
{
- GroupMember = ((Player*)Unit::GetUnit((*m_creature), itr->guid));
+ GroupMember = Unit::GetPlayer(itr->guid);
if(GroupMember && GroupMember->GetQuestStatus(QUEST_BATTLE_OF_THE_CRIMSON_WATCH) == QUEST_STATUS_INCOMPLETE)
{
@@ -1605,7 +1605,7 @@ struct TRINITY_DLL_DECL npc_lord_illidan_stormrageAI : public ScriptedAI
void mob_illidari_spawnAI::JustDied(Unit *slayer)
{
m_creature->RemoveCorpse();
- if(Creature* LordIllidan = ((Creature*)Unit::GetUnit(*m_creature, LordIllidanGUID)))
+ if(Creature* LordIllidan = (Unit::GetCreature(*m_creature, LordIllidanGUID)))
if(LordIllidan)
((npc_lord_illidan_stormrageAI*)LordIllidan->AI())->LiveCounter();
}
diff --git a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
index bbd5cdf2235..583a6324a00 100644
--- a/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
+++ b/src/bindings/scripts/scripts/zone/shattrath/shattrath_city.cpp
@@ -311,7 +311,7 @@ public:
case 56: DoScriptText(WHISP21, m_creature, pTemp);
if( PlayerGUID )
{
- Unit* player = ((Creature*)Unit::GetUnit((*m_creature), PlayerGUID));
+ Unit* player = (Unit::GetCreature((*m_creature), PlayerGUID));
if( player && player->GetTypeId() == TYPEID_PLAYER )
((Player*)player)->GroupEventHappens(10211,m_creature);
}
@@ -350,64 +350,7 @@ CreatureAI* GetAI_npc_kservantAI(Creature *_Creature)
{
npc_kservantAI* kservantAI = new npc_kservantAI(_Creature);
- kservantAI->AddWaypoint(0, -1863.369019, 5419.517090, -10.463668, 4000);
- kservantAI->AddWaypoint(1, -1861.749023, 5416.465332, -10.508068);
- kservantAI->AddWaypoint(2, -1857.036133, 5410.966309, -12.428039);
- kservantAI->AddWaypoint(3, -1831.539185, 5365.472168, -12.428039);
- kservantAI->AddWaypoint(4, -1813.416504, 5333.776855, -12.428039);
- kservantAI->AddWaypoint(5, -1800.354370, 5313.290039, -12.428039);
- kservantAI->AddWaypoint(6, -1775.624878, 5268.786133, -38.809181);
- kservantAI->AddWaypoint(7, -1770.147339, 5259.268066, -38.829231);
- kservantAI->AddWaypoint(8, -1762.814209, 5261.098145, -38.848995);
- kservantAI->AddWaypoint(9, -1740.110474, 5268.858398, -40.208965);
- kservantAI->AddWaypoint(10, -1725.837402, 5270.936035, -40.208965);
- kservantAI->AddWaypoint(11, -1701.580322, 5290.323242, -40.209187);
- kservantAI->AddWaypoint(12, -1682.877808, 5291.406738, -34.429646);
- kservantAI->AddWaypoint(13, -1670.101685, 5291.201172, -32.786007);
- kservantAI->AddWaypoint(14, -1656.666870, 5294.333496, -37.862648);
- kservantAI->AddWaypoint(15, -1652.035767, 5295.413086, -40.245499);
- kservantAI->AddWaypoint(16, -1620.860596, 5300.133301, -40.208992);
- kservantAI->AddWaypoint(17, -1607.630981, 5293.983398, -38.577045, 5000);
- kservantAI->AddWaypoint(18, -1607.630981, 5293.983398, -38.577045, 5000);
- kservantAI->AddWaypoint(19, -1607.630981, 5293.983398, -38.577045, 5000);
- kservantAI->AddWaypoint(20, -1622.140869, 5301.955566, -40.208897);
- kservantAI->AddWaypoint(21, -1621.131836, 5333.112793, -40.208897);
- kservantAI->AddWaypoint(22, -1637.598999, 5342.134277, -40.208790);
- kservantAI->AddWaypoint(23, -1648.521606, 5352.309570, -47.496170);
- kservantAI->AddWaypoint(24, -1654.606934, 5357.419434, -45.870892);
- kservantAI->AddWaypoint(25, -1633.670044, 5422.067871, -42.835541);
- kservantAI->AddWaypoint(25, -1656.567505, 5426.236328, -40.405815);
- kservantAI->AddWaypoint(26, -1664.932373, 5425.686523, -38.846405);
- kservantAI->AddWaypoint(27, -1681.406006, 5425.871094, -38.810928);
- kservantAI->AddWaypoint(28, -1730.875977, 5427.413574, -12.427910);
- kservantAI->AddWaypoint(29, -1743.509521, 5369.599121, -12.427910);
- kservantAI->AddWaypoint(30, -1877.217041, 5303.710449, -12.427989);
- kservantAI->AddWaypoint(31, -1890.371216, 5289.273438, -12.428268);
- kservantAI->AddWaypoint(32, -1905.505737, 5266.534668, 2.630672);
- kservantAI->AddWaypoint(33, -1909.381348, 5273.008301, 1.663714, 10000);
- kservantAI->AddWaypoint(34, -1909.381348, 5273.008301, 1.663714, 12000);
- kservantAI->AddWaypoint(35, -1909.381348, 5273.008301, 1.663714, 8000);
- kservantAI->AddWaypoint(36, -1909.381348, 5273.008301, 1.663714, 15000);
- kservantAI->AddWaypoint(37, -1927.561401, 5275.324707, 1.984987);
- kservantAI->AddWaypoint(38, -1927.385498, 5300.879883, -12.427236);
- kservantAI->AddWaypoint(39, -1921.063965, 5314.318359, -12.427236);
- kservantAI->AddWaypoint(40, -1965.425415, 5379.298828, -12.427236);
- kservantAI->AddWaypoint(41, -1981.233154, 5450.743652, -12.427236);
- kservantAI->AddWaypoint(42, -1958.022461, 5455.904297, 0.487659);
- kservantAI->AddWaypoint(43, -1951.991455, 5463.580566, 0.874490, 10000);
- kservantAI->AddWaypoint(44, -1951.991455, 5463.580566, 0.874490, 12000);
- kservantAI->AddWaypoint(45, -1968.730225, 5481.752930, -12.427846);
- kservantAI->AddWaypoint(46, -1881.839844, 5554.040039, -12.427846);
- kservantAI->AddWaypoint(47, -1841.566650, 5545.965332, -12.427846);
- kservantAI->AddWaypoint(48, -1837.658325, 5523.780273, 0.558756);
- kservantAI->AddWaypoint(49, -1831.321777, 5534.821777, 1.221819, 6000);
- kservantAI->AddWaypoint(50, -1831.321777, 5534.821777, 1.221819, 8000);
- kservantAI->AddWaypoint(51, -1831.321777, 5534.821777, 1.221819, 5000);
- kservantAI->AddWaypoint(52, -1850.060669, 5472.610840, 0.857320, 6000);
- kservantAI->AddWaypoint(53, -1850.060669, 5472.610840, 0.857320, 8000);
- kservantAI->AddWaypoint(54, -1850.060669, 5472.610840, 0.857320, 9000);
- kservantAI->AddWaypoint(55, -1850.060669, 5472.610840, 0.857320, 9000);
- kservantAI->AddWaypoint(56, -1850.060669, 5472.610840, 0.857320, 4000);
+ kservantAI->FillPointMovementListForCreature();
return (CreatureAI*)kservantAI;
}
@@ -472,7 +415,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
uint32 NextStep(uint32 Step)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
switch(Step)
{
@@ -506,7 +449,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
if(Attack)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
m_creature->setFaction(14);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if(player)
@@ -558,7 +501,7 @@ struct TRINITY_DLL_DECL npc_dirty_larryAI : public ScriptedAI
m_creature->DeleteThreatList();
m_creature->CombatStop();
m_creature->GetMotionMaster()->MoveTargetedHome();
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(player)
((Player*)player)->GroupEventHappens(QUEST_WBI, m_creature);
}
diff --git a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
index 16e372f7261..c975dea89cf 100644
--- a/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/silverpine_forest/silverpine_forest.cpp
@@ -116,7 +116,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
diff --git a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
index a438c14294d..fcb44c764f3 100644
--- a/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
+++ b/src/bindings/scripts/scripts/zone/stonetalon_mountains/stonetalon_mountains.cpp
@@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(!player)
return;
@@ -129,7 +129,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player)
((Player*)player)->FailQuest(QUEST_PK);
}
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
index bf2b11c3b9b..34f0f98fef4 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
@@ -537,7 +537,7 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI
uint32 IntroStep(uint32 step)
{
- Creature* Sacrolash = (Creature*)Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SACROLASH));
+ Creature* Sacrolash = Unit::GetCreature((*m_creature),pInstance->GetData64(DATA_SACROLASH));
switch (step)
{
case 0: DoPlaySoundToSet(m_creature,SOUND_INTRO); return 0;
diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
index ab83d78e266..0278d40a7cb 100644
--- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
+++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
@@ -211,38 +211,11 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI
}
};
-CreatureAI* GetAI_npc_custodian_of_time(Creature *_Creature)
+CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature)
{
- npc_custodian_of_timeAI* custodian_of_timeAI = new npc_custodian_of_timeAI(_Creature);
-
- custodian_of_timeAI->AddWaypoint(0, -8535.57,-4212.61, -212.04);
- custodian_of_timeAI->AddWaypoint(1, -8456.48,-4211.77, -213.30);
- custodian_of_timeAI->AddWaypoint(2, -8374.93,-4250.21, -205.05,5000);
- custodian_of_timeAI->AddWaypoint(3, -8374.93,-4250.21, -204.38,16000);
- custodian_of_timeAI->AddWaypoint(4, -8374.93,-4250.21, -204.38,10000);
- custodian_of_timeAI->AddWaypoint(5, -8374.93,-4250.21, -204.38,2000);
- custodian_of_timeAI->AddWaypoint(6, -8439.40,-4180.05, -209.25);
- custodian_of_timeAI->AddWaypoint(7, -8437.82,-4120.84, -208.59,10000);
- custodian_of_timeAI->AddWaypoint(8, -8437.82,-4120.84, -208.59,16000);
- custodian_of_timeAI->AddWaypoint(9, -8437.82,-4120.84, -208.59,13000);
- custodian_of_timeAI->AddWaypoint(10, -8437.82,-4120.84, -208.59,18000);
- custodian_of_timeAI->AddWaypoint(11, -8437.82,-4120.84, -208.59,15000);
- custodian_of_timeAI->AddWaypoint(12, -8437.82,-4120.84, -208.59,2000);
- custodian_of_timeAI->AddWaypoint(13, -8467.26,-4198.63, -214.21);
- custodian_of_timeAI->AddWaypoint(14, -8667.76,-4252.13, -209.56);
- custodian_of_timeAI->AddWaypoint(15, -8703.71,-4234.58, -209.5,14000);
- custodian_of_timeAI->AddWaypoint(16, -8703.71,-4234.58, -209.5,2000);
- custodian_of_timeAI->AddWaypoint(17, -8642.81,-4304.37, -209.57);
- custodian_of_timeAI->AddWaypoint(18, -8649.06,-4394.36, -208.46,6000);
- custodian_of_timeAI->AddWaypoint(19, -8649.06,-4394.36, -208.46,18000);
- custodian_of_timeAI->AddWaypoint(20, -8649.06,-4394.36, -208.46,2000);
- custodian_of_timeAI->AddWaypoint(21, -8468.72,-4437.67, -215.45);
- custodian_of_timeAI->AddWaypoint(22, -8427.54,-4426, -211.13);
- custodian_of_timeAI->AddWaypoint(23, -8364.83,-4393.32, -205.91);
- custodian_of_timeAI->AddWaypoint(24, -8304.54,-4357.2, -208.2,18000);
- custodian_of_timeAI->AddWaypoint(25, -8304.54,-4357.2, -208.2,2000);
- custodian_of_timeAI->AddWaypoint(26, -8375.42,-4250.41, -205.14,5000);
- custodian_of_timeAI->AddWaypoint(27, -8375.42,-4250.41, -205.14,5000);
+ npc_custodian_of_timeAI* custodian_of_timeAI = new npc_custodian_of_timeAI(pCreature);
+
+ custodian_of_timeAI->FillPointMovementListForCreature();
return (CreatureAI*)custodian_of_timeAI;
}
@@ -387,7 +360,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -440,7 +413,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(Q_OOX17);
}
}
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp
index 36ff863abe7..a0d21e302b5 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/instance_arcatraz.cpp
@@ -85,7 +85,7 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance
bool IsEncounterInProgress() const
{
for(uint8 i = 0; i < ENCOUNTERS; i++)
- if(Encounter[i])
+ if(Encounter[i] == IN_PROGRESS)
return true;
return false;
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
index a0c331ebbf5..3e5bbbf66da 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_alar.cpp
@@ -90,6 +90,8 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
float DefaultMoveSpeedRate;
bool Phase1;
+ bool ForceMove;
+ uint32 ForceTimer;
int8 cur_wp;
@@ -105,6 +107,8 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
WaitEvent = WE_NONE;
WaitTimer = 0;
AfterMoving = false;
+ ForceMove = false;
+ ForceTimer = 5000;
cur_wp = 4;
@@ -189,6 +193,7 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
{
WaitTimer = 1;
AfterMoving = true;
+ ForceMove = false;
}
}
@@ -203,6 +208,15 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
Berserk_Timer = 60000;
}else Berserk_Timer -= diff;
+ if(ForceMove)
+ {
+ if(ForceTimer < diff)
+ {
+ m_creature->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]);
+ ForceTimer = 5000;
+ }else ForceTimer -= diff;
+
+ }
if(WaitEvent)
{
if(WaitTimer)
@@ -320,6 +334,8 @@ struct TRINITY_DLL_DECL boss_alarAI : public ScriptedAI
WaitEvent = WE_QUILL;
}
}
+ ForceMove = true;
+ ForceTimer = 5000;
m_creature->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]);
WaitTimer = 0;
return;
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
index c1f64b23fc7..a4c430ae7f7 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/boss_kaelthas.cpp
@@ -191,7 +191,7 @@ struct TRINITY_DLL_DECL advisorbase_ai : public ScriptedAI
if(pInstance && (pInstance->GetData(DATA_KAELTHASEVENT) == 1 || pInstance->GetData(DATA_KAELTHASEVENT) == 3))
{
Creature *Kaelthas = NULL;
- Kaelthas = (Creature*)(Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_KAELTHAS)));
+ Kaelthas = (Unit::GetCreature((*m_creature), pInstance->GetData64(DATA_KAELTHAS)));
if(Kaelthas)
Kaelthas->AI()->EnterEvadeMode();
@@ -325,7 +325,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
}
if(pInstance) {
for(uint32 i = 0; i < 7; i++) {
- Creature* weapon = (Creature*)(Unit::GetUnit((*m_creature), WeaponGuid[i]));;
+ Creature* weapon = (Unit::GetCreature((*m_creature), WeaponGuid[i]));;
delete weapon;
}
}
@@ -393,7 +393,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
Creature *pCreature;
for(uint8 i = 0; i < 4; ++i)
{
- pCreature = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i]));
+ pCreature = (Unit::GetCreature((*m_creature), AdvisorGuid[i]));
if(pCreature)
{
pCreature->Respawn();
@@ -483,7 +483,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
Creature *pCreature;
for(uint8 i = 0; i < 4; ++i)
{
- pCreature = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i]));
+ pCreature = (Unit::GetCreature((*m_creature), AdvisorGuid[i]));
if(pCreature)
{
pCreature->DealDamage(pCreature, pCreature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -550,7 +550,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
case 1:
if(Phase_Timer < diff)
{
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[0]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[0]));
if(Advisor)
{
@@ -568,7 +568,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
//Subphase 2 - Start
case 2:
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[0]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[0]));
if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == UNIT_STAND_STATE_DEAD))
{
DoScriptText(SAY_INTRO_SANGUINAR, m_creature);
@@ -584,7 +584,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
case 3:
if(Phase_Timer < diff)
{
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[1]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[1]));
if(Advisor)
{
@@ -602,7 +602,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
//Subphase 3 - Start
case 4:
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[1]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[1]));
if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == UNIT_STAND_STATE_DEAD))
{
DoScriptText(SAY_INTRO_CAPERNIAN, m_creature);
@@ -618,7 +618,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
case 5:
if(Phase_Timer < diff)
{
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[2]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[2]));
if(Advisor)
{
@@ -636,7 +636,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
//Subphase 4 - Start
case 6:
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[2]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[2]));
if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == UNIT_STAND_STATE_DEAD))
{
DoScriptText(SAY_INTRO_TELONICUS, m_creature);
@@ -652,7 +652,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
case 7:
if(Phase_Timer < diff)
{
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[3]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[3]));
if(Advisor)
{
@@ -672,7 +672,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
//End of phase 1
case 8:
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[3]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[3]));
if(Advisor && (Advisor->GetUInt32Value(UNIT_FIELD_BYTES_1) == UNIT_STAND_STATE_DEAD))
{
Phase = 2;
@@ -742,7 +742,7 @@ struct TRINITY_DLL_DECL boss_kaelthasAI : public ScriptedAI
Creature* Advisor;
for (uint32 i = 0; i < 4; ++i)
{
- Advisor = (Creature*)(Unit::GetUnit((*m_creature), AdvisorGuid[i]));
+ Advisor = (Unit::GetCreature((*m_creature), AdvisorGuid[i]));
if (!Advisor)
error_log("TSCR: Kael'Thas Advisor %u does not exist. Possibly despawned? Incorrectly Killed?", i);
else ((advisorbase_ai*)Advisor->AI())->Revive(Target);
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp
index bc407a3de99..66e595ab729 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_eye/instance_the_eye.cpp
@@ -48,7 +48,7 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance
uint8 KaelthasEventPhase;
uint8 AlarEventPhase;
- bool Encounters[ENCOUNTERS];
+ uint32 Encounters[ENCOUNTERS];
void Initialize()
{
@@ -64,13 +64,13 @@ struct TRINITY_DLL_DECL instance_the_eye : public ScriptedInstance
AlarEventPhase = 0;
for(uint8 i = 0; i < ENCOUNTERS; i++)
- Encounters[i] = false;
+ Encounters[i] = NOT_STARTED;
}
bool IsEncounterInProgress() const
{
for(uint8 i = 0; i < ENCOUNTERS; i++)
- if(Encounters[i]) return true;
+ if(Encounters[i] == IN_PROGRESS) return true;
return false;
}
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
index d6ffe70dc69..ca0711f1222 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
@@ -1255,7 +1255,7 @@ void flesh_tentacleAI::JustDied(Unit* killer)
return;
}
- Creature* Cthun = (Creature*)Unit::GetUnit(*m_creature, Parent);
+ Creature* Cthun = Unit::GetCreature(*m_creature, Parent);
if (Cthun)
((cthunAI*)(Cthun->AI()))->FleshTentcleKilled();
diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
index 710268c0cff..6deaa769ae5 100644
--- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
@@ -378,7 +378,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(!player)
return;
@@ -421,7 +421,7 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI
{
if (PlayerGUID)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player && !Completed)
{
if(((Player*)player)->GetTeam() == ALLIANCE)
diff --git a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
index cdd7cfd924d..922687b0723 100644
--- a/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
+++ b/src/bindings/scripts/scripts/zone/thousand_needles/thousand_needles.cpp
@@ -46,7 +46,7 @@ npc_swiftmountainAI(Creature *c) : npc_escortAI(c) {}
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -86,7 +86,7 @@ npc_swiftmountainAI(Creature *c) : npc_escortAI(c) {}
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_HOMEWARD_BOUND);
}
}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_bjarngrim.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_bjarngrim.cpp
new file mode 100644
index 00000000000..48ecfdbbcbf
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_bjarngrim.cpp
@@ -0,0 +1,94 @@
+/* Script Data Start
+SDName: Boss bjarngrim
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//AURAS AND STANCES
+#define BUFF_BATTLE_AURA 41106
+#define SPELL_BATTLE_STANCE 53792
+#define BUFF_BERSEKER_AURA 41107
+#define SPELL_BERSEKER_STANCE 53791
+#define BUFF_DEFENSIVE_AURA 41105
+#define SPELL_DEFENSIVE_STANCE 53790
+
+//OTHER SPELLS
+#define SPELL_CHARGE_UP 52098
+#define SPELL_CLEAVE 15284
+#define SPELL_INTERCEPT 58769
+#define SPELL_IRONFORM 52022
+#define SPELL_KNOCK_AWAY 52029
+#define SPELL_MORTAL_STRIKE 15708
+#define SPELL_SLAM 52026
+#define SPELL_SPELL_REFLECTION 36096
+#define SPELL_WHIRLWIND 52027
+
+//Yell
+#define SAY_AGGRO -1602000
+#define SAY_SLAY_1 -1602001
+#define SAY_SLAY_2 -1602002
+#define SAY_SLAY_3 -1602003
+#define SAY_DEATH -1602004
+#define SAY_BATTLE_STANCE -1602005
+#define SAY_BERSEKER_STANCE -1602006
+#define SAY_DEFENSIVE_STANCE -1602007
+
+struct TRINITY_DLL_DECL boss_bjarngrimAI : public ScriptedAI
+{
+ boss_bjarngrimAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 whirlwind;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_bjarngrim(Creature *_Creature)
+{
+ return new boss_bjarngrimAI (_Creature);
+}
+
+void AddSC_boss_bjarngrim()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_bjarngrim";
+ newscript->GetAI = GetAI_boss_bjarngrim;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_ionar.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_ionar.cpp
new file mode 100644
index 00000000000..1760c8d0032
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_ionar.cpp
@@ -0,0 +1,114 @@
+/* Script Data Start
+SDName: Boss ionar
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_ionar' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_BALL_LIGHTNING 52780
+#define SPELL_BALL_LIGHTNING_2 59800
+#define SPELL_DISPERSE 52770 //Disperse into Sparks of Ionar.
+#define SPELL_STATIC_OVERLOAD 52658 //Effect Apply Aura: Periodic Trigger Interval: 2 seconds Spell 52659
+#define SPELL_STATIC_OVERLOAD_2 52658 //Effect Apply Aura: Periodic Trigger Interval: 2 seconds Spell 59796
+
+//Spark of Ionar spells
+#define NPC_SPARK_OF_IONAR 28962 //invulnerable
+#define SPELL_ARCING_BURN 52617
+#define SPELL_ARCING_BURN_2 59834
+
+//Yell
+#define SAY_AGGRO -1602008
+#define SAY_SLAY_1 -1602009
+#define SAY_SLAY_2 -1602010
+#define SAY_SLAY_3 -1602011
+#define SAY_DEATH -1602012
+#define SAY_SPLIT_1 -1602013
+#define SAY_SPLIT_2 -1602014
+
+//he does "morph" every about 25% into 4 sparks of ionar that chase people around, they r slow and easily avoidable.
+
+struct TRINITY_DLL_DECL boss_ionarAI : public ScriptedAI
+{
+ boss_ionarAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+struct TRINITY_DLL_DECL npc_spark_of_ionarAI : public ScriptedAI
+{
+ npc_spark_of_ionarAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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_npc_spark_of_ionar(Creature *_Creature)
+{
+ return new npc_spark_of_ionarAI (_Creature);
+}
+CreatureAI* GetAI_boss_ionar(Creature *_Creature)
+{
+ return new boss_ionarAI (_Creature);
+}
+
+void AddSC_boss_ionar()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_ionar";
+ newscript->GetAI = GetAI_boss_ionar;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="spark_of_ionar";
+ newscript->GetAI = GetAI_npc_spark_of_ionar;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_loken.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_loken.cpp
new file mode 100644
index 00000000000..e8b991a5172
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_loken.cpp
@@ -0,0 +1,86 @@
+/* Script Data Start
+SDName: Boss loken
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_loken' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARC_NOVA 52921
+//Effect #1 School Damage (Nature), Value: 3238 to 3762
+//Effect #2 Apply Aura: Dummy, Value: 3238 to 3762, Server-side script
+
+#define SPELL_LIGHTNING_NOVA 52960
+#define SPELL_LIGHTNING_NOVA_2 59835
+
+//Yell
+#define SAY_AGGRO -1602015
+#define SAY_INTRO_1 -1602016
+#define SAY_INTRO_2 -1602017
+#define SAY_SLAY_1 -1602018
+#define SAY_SLAY_2 -1602019
+#define SAY_SLAY_3 -1602020
+#define SAY_DEATH -1602021
+#define SAY_NOVA_1 -1602022
+#define SAY_NOVA_2 -1602023
+#define SAY_NOVA_3 -1602024
+#define SAY_75HEALTH -1602025
+#define SAY_50HEALTH -1602026
+#define SAY_25HEALTH -1602027
+
+struct TRINITY_DLL_DECL boss_lokenAI : public ScriptedAI
+{
+ boss_lokenAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_loken(Creature *_Creature)
+{
+ return new boss_lokenAI (_Creature);
+}
+
+void AddSC_boss_loken()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_loken";
+ newscript->GetAI = GetAI_boss_loken;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_volkhan.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_volkhan.cpp
new file mode 100644
index 00000000000..a613a084f02
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/boss_volkhan.cpp
@@ -0,0 +1,128 @@
+/* Script Data Start
+SDName: Boss volkhan
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_volkhan' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_HEAT 52387
+#define SPELL_HEAT_2 59528
+#define SPELL_SHATTERING_STOMP 52237
+#define SPELL_SHATTERING_STOMP_2 59529
+#define SPELL_TEMPER 52238 //Dummy ---> Strikes Volkhan's Anvil, creating a number of Molten Golems.
+
+#define NPC_VOLKHANS_ANVIL 28823
+#define MOB_MOLTEN_GOLEM 28695
+
+//Yells
+#define SAY_AGGRO -1602028
+#define SAY_SLAY_1 -1602029
+#define SAY_SLAY_2 -1602030
+#define SAY_SLAY_3 -1602031
+#define SAY_DEATH -1602032
+#define SAY_STOMP_1 -1602033
+#define SAY_STOMP_2 -1602034
+#define SAY_FORGE_1 -1602035
+#define SAY_FORGE_2 -1602036
+
+struct TRINITY_DLL_DECL boss_volkhanAI : public ScriptedAI
+{
+ boss_volkhanAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+/*######
+## Mob Molten Golem
+######*/
+//Molten Golem Spells
+#define SPELL_BLAST_WAVE 23113
+#define SPELL_IMMOLATION_STRIKE 52433
+#define SPELL_IMMOLATION_STRIKE_2 59530
+//Effect #1 Apply Aura: Periodic Damage, value: 900 every 3 seconds
+//Effect #2 School Damage (Fire), value: 900
+//Effect #3 Script Effect
+#define SPELL_SHATTER 52429
+//Effect #1 School Damage (Physical), value: 9250 to 10750, radius: 10 yards
+//Effect #2 Dummy, Server-side script
+#define SPELL_SHATTER_2
+
+struct TRINITY_DLL_DECL mob_molten_golemAI : public ScriptedAI
+{
+ mob_molten_golemAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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_mob_molten_golem(Creature *_Creature)
+{
+ return new mob_molten_golemAI (_Creature);
+}
+
+CreatureAI* GetAI_boss_volkhan(Creature *_Creature)
+{
+ return new boss_volkhanAI (_Creature);
+}
+
+void AddSC_boss_volkhan()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_volkhan";
+ newscript->GetAI = GetAI_boss_volkhan;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="mob_molten_golem";
+ newscript->GetAI = GetAI_mob_molten_golem;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/def_halls_of_lightning.h b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/def_halls_of_lightning.h
new file mode 100644
index 00000000000..134e32850ae
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/def_halls_of_lightning.h
@@ -0,0 +1,4 @@
+#ifndef DEF_HALLS_OF_LIGHTNING_H
+#define DEF_HALLS_OF_LIGHTNING_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp
new file mode 100644
index 00000000000..4e694df73a5
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_lightning/instance_halls_of_lightning.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_halls_of_lightning.h"
+
+struct TRINITY_DLL_DECL instance_halls_of_lightning : public ScriptedInstance
+{
+ instance_halls_of_lightning(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_halls_of_lightning(Map* map)
+{
+ return new instance_halls_of_lightning(map);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_krystallus.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_krystallus.cpp
new file mode 100644
index 00000000000..e58c2f8a2ac
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_krystallus.cpp
@@ -0,0 +1,73 @@
+/* Script Data Start
+SDName: Boss krystallus
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_krystallus' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_BOULDER_TOSS 50843
+#define SPELL_BOULDER_TOSS_2 59742
+#define SPELL_GROUND_SPIKE 59750
+#define SPELL_SHATTER 50810
+#define SPELL_SHATTER_2 61546
+#define SPELL_STOMP 48131
+#define SPELL_STOMP_2 59744
+
+//Yell
+#define SAY_AGGRO -1599000
+#define SAY_KILL -1599001
+#define SAY_DEATH -1599002
+#define SAY_SHATTER -1599003
+
+struct TRINITY_DLL_DECL boss_krystallusAI : public ScriptedAI
+{
+ boss_krystallusAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_krystallus(Creature *_Creature)
+{
+ return new boss_krystallusAI (_Creature);
+}
+
+void AddSC_boss_krystallus()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_krystallus";
+ newscript->GetAI = GetAI_boss_krystallus;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_maiden_of_grief.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
new file mode 100644
index 00000000000..f179e8d7a73
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_maiden_of_grief.cpp
@@ -0,0 +1,81 @@
+/* Script Data Start
+SDName: Boss maiden_of_grief
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_maiden_of_grief' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spell
+#define SPELL_PARTING_SORROW 59723
+#define SPELL_STORM_OF_GRIEF 50752
+#define SPELL_STORM_OF_GRIEF_2 59772
+#define SPELL_SHOCK_OF_SORROW 50760
+#define SPELL_SHOCK_OF_SORROW_2 59726
+#define SPELL_PILLAR_OF_WOE 50761
+#define SPELL_PILLAR_OF_WOE_2 59727
+
+//Yell
+#define SAY_AGGRO -1599004
+#define SAY_SLAY_1 -1599005
+#define SAY_SLAY_2 -1599006
+#define SAY_SLAY_3 -1599007
+#define SAY_SLAY_4 -1599008
+#define SAY_DEATH -1599009
+#define SAY_STUN -1599010
+
+struct TRINITY_DLL_DECL boss_maiden_of_griefAI : public ScriptedAI
+{
+ boss_maiden_of_griefAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_maiden_of_grief(Creature *_Creature)
+{
+ return new boss_maiden_of_griefAI (_Creature);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_sjonnir.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_sjonnir.cpp
new file mode 100644
index 00000000000..ddb048ee241
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/boss_sjonnir.cpp
@@ -0,0 +1,83 @@
+/* Script Data Start
+SDName: Boss sjonnir
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_sjonnir' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_LIGHTING_RING_1 50840 //Periodic Trigger (interval 2s) spell = 50841
+#define SPELL_LIGHTING_RING_2 51849 //Periodic Trigger (interval 2s) spell = 50841
+#define SPELL_LIGHTING_RING_2 59848 //Periodic Trigger (interval 2s) spell = 59849
+#define SPELL_LIGHTING_RING_3 59861 //Periodic Trigger (interval 2s) spell = 59849
+#define SPELL_STATIC_CHARGE_1 50834 //Periodic Trigger 2s interval, spell =50835
+#define SPELL_STATIC_CHARGE_2 59846 //Periodic Trigger 2s interval, spell =50847
+#define SPELL_CHAIN_LIGHTING_1 50830
+#define SPELL_CHAIN_LIGHTING_2 59844
+#define SPELL_LIGHTING_SHIELD_1 50831
+#define SPELL_LIGHTING_SHIELD_2 59845
+#define SPELL_FRENZY 28747
+
+//Yell
+#define SAY_AGGRO -1599011
+#define SAY_SLAY_1 -1599012
+#define SAY_SLAY_2 -1599013
+#define SAY_SLAY_3 -1599014
+#define SAY_DEATH -1599015
+
+struct TRINITY_DLL_DECL boss_sjonnirAI : public ScriptedAI
+{
+ boss_sjonnirAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_sjonnir(Creature *_Creature)
+{
+ return new boss_sjonnirAI (_Creature);
+}
+
+void AddSC_boss_sjonnir()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_sjonnir";
+ newscript->GetAI = GetAI_boss_sjonnir;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/def_halls_of_stone.h b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/def_halls_of_stone.h
new file mode 100644
index 00000000000..ade934ad921
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/def_halls_of_stone.h
@@ -0,0 +1,4 @@
+#ifndef DEF_HALLS_OF_STONE_H
+#define DEF_HALLS_OF_STONE_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/instance_halls_of_stone.cpp b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/instance_halls_of_stone.cpp
new file mode 100644
index 00000000000..3c7d3970b47
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/ulduar/halls_of_stone/instance_halls_of_stone.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_halls_of_stone.h"
+
+struct TRINITY_DLL_DECL instance_halls_of_stone : public ScriptedInstance
+{
+ instance_halls_of_stone(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_halls_of_stone(Map* map)
+{
+ return new instance_halls_of_stone(map);
+}
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
index 619d9d7802f..9bb13dd7718 100644
--- a/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
+++ b/src/bindings/scripts/scripts/zone/ungoro_crater/ungoro_crater.cpp
@@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -100,7 +100,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
((Player*)player)->FailQuest(QUEST_CHASING_AME);
}
}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_dalronn.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_dalronn.cpp
new file mode 100644
index 00000000000..9512444458b
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_dalronn.cpp
@@ -0,0 +1,97 @@
+/* Script Data Start
+SDName: Boss dalronn
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_dalronn' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_DEBILITATE 43650
+#define SPELL_SHADOWBOLT 43649
+#define SPELL_SHADOWBOLT_2 59575
+#define SPELL_SUMMON_SKELETONS 52611 //Trigger Spell: 52612, summons NPC (28878)
+#define SPELL_SKARVALD_GHOST 48613 //When Skarvald dies
+
+//Yell
+#define SAY_AGGRO -1574005
+#define SAY_KILL -1574006
+#define SAY_DEATH_1 -1574007
+#define SAY_DEATH_2 -1574008
+#define SAY_RAISES -1574009
+
+struct TRINITY_DLL_DECL boss_dalronnAI : public ScriptedAI
+{
+ boss_dalronnAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 killed;
+ uint64 Skarvald;
+
+ void Reset()
+ {
+ Skarvald = 0;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if (Skarvald)
+ {
+ Creature* Skravald_m = (Unit::GetCreature((*m_creature), Skarvald));
+ if (Skravald_m)
+ {
+ if (!Skravald_m->isAlive())
+ {
+ DoCast(Skravald_m,SPELL_SKARVALD_GHOST);
+ DoScriptText(SAY_RAISES, m_creature);
+ }
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ killed++;
+ //On first death resurected instatly by Skarvald as a ghost, having the same abilities as when alive and is unatackable
+ //If Skarvald dies first, Dalron resurects him and says "SAY_RAISES"
+ if(killed ==2)
+ DoScriptText(SAY_DEATH_2,m_creature);
+ else
+ DoScriptText(SAY_DEATH_1,m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_dalronn(Creature *_Creature)
+{
+ return new boss_dalronnAI (_Creature);
+}
+
+void AddSC_boss_dalronn()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_dalronn";
+ newscript->GetAI = GetAI_boss_dalronn;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald.cpp
new file mode 100644
index 00000000000..1fc9bc1c995
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_skarvald.cpp
@@ -0,0 +1,96 @@
+/* Script Data Start
+SDName: Boss skarvald
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_skarvald' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CHARGE 43651 //randomly charges anyone but tank WoWradio video 14s afer aggro, and then every 5s change target
+#define SPELL_ENRAGE 48193
+#define SPELL_STONE_STRIKE 48583
+#define SPELL_DALRON_GHOST 48612 //When Dalron dies
+
+//Yells
+#define SAY_AGGRO -1574010
+#define SAY_KILL -1574011
+#define SAY_DEATH_1 -1574012
+#define SAY_DEATH_2 -1574013
+#define SAY_RAISES -1574014
+
+struct TRINITY_DLL_DECL boss_skarvaldAI : public ScriptedAI
+{
+ boss_skarvaldAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 kiled;
+ uint64 Dalronn;
+
+ void Reset()
+ {
+ Dalronn = 0;
+ }
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ if (Dalronn)
+ {
+ Creature* Dalronn_m = (Unit::GetCreature((*m_creature), Dalronn));
+ if (Dalronn_m)
+ {
+ if (!Dalronn_m->isAlive())
+ {
+ DoCast(Dalronn_m,SPELL_DALRON_GHOST);
+ DoScriptText(SAY_RAISES, m_creature);
+ }
+ }
+ }
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ kiled++;
+ //On first death resurected instatly by Dalron as a ghost, having the same abilities as when alive and is unatackable
+ //If Dalron dies first, Skarvald resurects him and says "SAY_RAISES"
+ if(kiled ==2)
+ DoScriptText(SAY_DEATH_2,m_creature);
+ else
+ DoScriptText(SAY_DEATH_1,m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ DoScriptText(SAY_KILL, m_creature);
+ }
+};
+
+CreatureAI* GetAI_boss_skarvald(Creature *_Creature)
+{
+ return new boss_skarvaldAI (_Creature);
+}
+
+void AddSC_boss_skarvald()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_skarvald";
+ newscript->GetAI = GetAI_boss_skarvald;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
new file mode 100644
index 00000000000..d2351f1f458
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_palehoof.cpp
@@ -0,0 +1,78 @@
+/* Script Data Start
+SDName: Boss palehoof
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_palehoof' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCING_SMASH 48260
+#define SPELL_IMPALE 48261
+#define SPELL_WITHERING_ROAR 48256
+
+//Yell
+#define SAY_AGGRO -1575000
+#define SAY_SLAY_1 -1575001
+#define SAY_SLAY_2 -1575002
+#define SAY_DEATH -1575003
+
+struct TRINITY_DLL_DECL boss_palehoofAI : public ScriptedAI
+{
+ boss_palehoofAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if (victim == m_creature)
+ return;
+
+ switch(rand()%2)
+ {
+ case 0:
+ DoScriptText(SAY_SLAY_1, m_creature);
+ break;
+ case 1:
+ DoScriptText(SAY_SLAY_2, m_creature);
+ break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_palehoof(Creature *_Creature)
+{
+ return new boss_palehoofAI (_Creature);
+}
+
+void AddSC_boss_palehoof()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_palehoof";
+ newscript->GetAI = GetAI_boss_palehoof;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
new file mode 100644
index 00000000000..e08f249b036
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_skadi.cpp
@@ -0,0 +1,89 @@
+/* Script Data Start
+SDName: Boss skadi
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_skadi' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Phase 0 "gauntlet even" Skadi on a flying mount, waves of adds charging to the group periodicaly carrying harpoons
+//Phase 1 Kill the Skadi drake mount with harppons launcher
+//Phase 2 Kill the Skadi
+
+//Skadi Spells
+#define SPELL_CRUSH 50234
+#define SPELL_POISONED_SPEAR 50225
+#define SPELL_WHIRLWIND 50228 //random target, but not the tank approx. every 20s
+
+//Yell
+#define SAY_AGGRO -1575004
+#define SAY_KILL_1 -1575005
+#define SAY_KILL_2 -1575006
+#define SAY_KILL_3 -1575007
+#define SAY_DEATH -1575008
+#define SAY_DRAKE_DEATH -1575009
+#define SAY_DRAKE_HIT_1 -1575010
+#define SAY_DRAKE_HIT_2 -1575011
+#define SAY_DRAKE_BREATH_1 -1575012
+#define SAY_DRAKE_BREATH_2 -1575013
+#define SAY_DRAKE_BREATH_3 -1575014
+
+struct TRINITY_DLL_DECL boss_skadiAI : public ScriptedAI
+{
+ boss_skadiAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 phase;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ void AttackStart(Unit* who) {}
+ void MoveInLineOfSight(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ phase = 0;
+
+ DoMeleeAttackIfReady();
+ }
+ void JustDied(Unit* killer)
+ {
+ DoScriptText(SAY_DEATH, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_KILL_1, m_creature);break;
+ case 1: DoScriptText(SAY_KILL_2, m_creature);break;
+ case 2: DoScriptText(SAY_KILL_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_skadi(Creature *_Creature)
+{
+ return new boss_skadiAI (_Creature);
+}
+
+void AddSC_boss_skadi()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_skadi";
+ newscript->GetAI = GetAI_boss_skadi;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_svala.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_svala.cpp
new file mode 100644
index 00000000000..30064208cc3
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_svala.cpp
@@ -0,0 +1,83 @@
+/* Script Data Start
+SDName: Boss svala
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_svala' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CALL_FLAMES 48258
+#define SPELL_RITUAL_OF_THE_SWORD 48276 //Effect #1 Teleport, Effect #2 Dummy
+#define SPELL_SINSTER_STRIKE 15667
+
+//Yells
+#define SAY_DIALOG_WITH_ARTHAS_1 -1575015
+#define SAY_DIALOG_WITH_ARTHAS_2 -1575016
+#define SAY_DIALOG_WITH_ARTHAS_3 -1575017
+#define SAY_AGGRO -1575018
+#define SAY_SLAY_1 -1575019
+#define SAY_SLAY_2 -1575020
+#define SAY_SLAY_3 -1575021
+#define SAY_DEATH -1575022
+#define SAY_SACRIFICE_PLAYER_1 -1575023
+#define SAY_SACRIFICE_PLAYER_2 -1575024
+#define SAY_SACRIFICE_PLAYER_3 -1575025
+#define SAY_SACRIFICE_PLAYER_4 -1575026
+#define SAY_SACRIFICE_PLAYER_5 -1575027
+
+struct TRINITY_DLL_DECL boss_svalaAI : public ScriptedAI
+{
+ boss_svalaAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_svala(Creature *_Creature)
+{
+ return new boss_svalaAI (_Creature);
+}
+
+void AddSC_boss_svala()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_svala";
+ newscript->GetAI = GetAI_boss_svala;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp
new file mode 100644
index 00000000000..527a18d9af4
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/boss_ymiron.cpp
@@ -0,0 +1,85 @@
+/* Script Data Start
+SDName: Boss ymiron
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = 'boss_ymiron' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_BANE 48294
+#define SPELL_DARK_SLASH 48292
+#define SPELL_FETID_ROT 48291
+#define SPELL_SCREAMS_OF_THE_DEAD 51750
+#define SPELL_SPIRIT_BURST 48529
+#define SPELL_SPIRIT_STRIKE 48423
+//every 20% stuns the party and runs to a boat
+
+//Yell
+#define SAY_AGGRO -1575028
+#define SAY_SLAY_1 -1575029
+#define SAY_SLAY_2 -1575030
+#define SAY_SLAY_3 -1575031
+#define SAY_SLAY_4 -1575032
+#define SAY_DEATH -1575033
+#define SAY_SUMMON_BJORN -1575034
+#define SAY_SUMMON_HALDOR -1575035
+#define SAY_SUMMON_RANULF -1575036
+#define SAY_SUMMON_TORGYN -1575037
+
+struct TRINITY_DLL_DECL boss_ymironAI : public ScriptedAI
+{
+ boss_ymironAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%4)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ case 3: DoScriptText(SAY_SLAY_4, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_ymiron(Creature *_Creature)
+{
+ return new boss_ymironAI (_Creature);
+}
+
+void AddSC_boss_ymiron()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_ymiron";
+ newscript->GetAI = GetAI_boss_ymiron;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/def_pinnacle.h b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/def_pinnacle.h
new file mode 100644
index 00000000000..82e2173fab5
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/def_pinnacle.h
@@ -0,0 +1,4 @@
+#ifndef DEF_PINNACLE_H
+#define DEF_PINNACLE_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp
new file mode 100644
index 00000000000..0772aee0647
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_pinnacle/instance_pinnacle.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_pinnacle.h"
+
+struct TRINITY_DLL_DECL instance_pinnacle : public ScriptedInstance
+{
+ instance_pinnacle(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_pinnacle(Map* map)
+{
+ return new instance_pinnacle(map);
+}
+
+void AddSC_instance_pinnacle()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_pinnacle";
+ newscript->GetInstanceData = GetInstanceData_instance_pinnacle;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/vault_of_archavon/boss_archavon.cpp b/src/bindings/scripts/scripts/zone/vault_of_archavon/boss_archavon.cpp
new file mode 100644
index 00000000000..9eb629f2f5f
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/vault_of_archavon/boss_archavon.cpp
@@ -0,0 +1,93 @@
+/* Script Data Start
+SDName: Boss archavon
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells Archavon
+#define SPELL_ROCK_SHARDS 60883 //Instant -- Hurls a jagged rock shard, inflicting 707 to 793 Physical damage to any enemies within 5 of the target.
+#define SPELL_CRUSHING_LEAP 60895 //Instant (10-80yr range) -- Leaps at an enemy, inflicting 8000 Physical damage, knocking all nearby enemies away, and creating a cloud of choking debris.
+#define SPELL_CHOKING_CLOUD 61672 //Leaving behind CRUSHING_LEAP --> Slams into the ground, kicking up an asphyxiating cloud of debris, inflicting 2828 to 3172 Nature damage per second to all enemies caught within and reducing their chance to hit by 50%.
+//#define SPELL_STOMP //48131 or 55292 or 60880
+#define SPELL_IMPALE 60882 //Lifts an enemy off the ground with a spiked fist, inflicting 47125 to 52875 Physical damage and 9425 to 10575 additional damage each second for 8 sec.
+
+//Spells Archavon Warders
+#define SPELL_ROCK_SHOWER_N 60919
+#define SPELL_ROCK_SHOWER_H 60923
+#define SPELL_SHIELD_CRUSH_N 60897
+#define SPELL_SHIELD_CRUSH_H 60899
+#define SPELL_WHIRL_N 60902
+#define SPELL_WHIRL_H 60916
+
+//4 Warders spawned
+#define ARCHAVON_WARDER 32353 //npc 32353
+
+//Yell
+#define SAY_LEAP "Archavon the Stone Watcher lunges for $N!" //$N should be the target
+
+struct TRINITY_DLL_DECL boss_archavonAI : public ScriptedAI
+{
+ boss_archavonAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+/*######
+## Mob Archavon Warder
+######*/
+struct TRINITY_DLL_DECL mob_warderAI : public ScriptedAI //npc 32353
+{
+ mob_warderAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who) {}
+ void UpdateAI(const uint32 diff)
+ {
+ //Return since we have no target
+ if(!UpdateVictim())
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_mob_warder(Creature *_Creature)
+{
+ return new mob_warderAI (_Creature);
+}
+
+CreatureAI* GetAI_boss_archavon(Creature *_Creature)
+{
+ return new boss_archavonAI (_Creature);
+}
+
+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_warder;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/vault_of_archavon/def_vault_of_archavon.h b/src/bindings/scripts/scripts/zone/vault_of_archavon/def_vault_of_archavon.h
new file mode 100644
index 00000000000..f46ba447945
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/vault_of_archavon/def_vault_of_archavon.h
@@ -0,0 +1,4 @@
+#ifndef DEF_ARCHAVON_H
+#define DEF_ARCHAVON_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/vault_of_archavon/instance_vault_of_archavon.cpp b/src/bindings/scripts/scripts/zone/vault_of_archavon/instance_vault_of_archavon.cpp
new file mode 100644
index 00000000000..94ee36212ec
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/vault_of_archavon/instance_vault_of_archavon.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_vault_of_archavon.h"
+
+struct TRINITY_DLL_DECL instance_archavon : public ScriptedInstance
+{
+ instance_archavon(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+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();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_cyanigosa.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_cyanigosa.cpp
new file mode 100644
index 00000000000..cf6833d94bb
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_cyanigosa.cpp
@@ -0,0 +1,82 @@
+/* Script Data Start
+SDName: Boss cyanigosa
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCANE_VACUM 58694
+#define SPELL_BLIZZARD 58693
+#define SPELL_MANA_DESTRUCTION 59374
+#define SPELL_TAIL_SWEEP 58690
+#define SPELL_UNCONTROLLABLE_ENERGY 58688
+
+//Yells
+#define SAY_AGGRO -1608000
+#define SAY_SLAY_1 -1608001
+#define SAY_SLAY_2 -1608002
+#define SAY_SLAY_3 -1608003
+#define SAY_DEATH -1608004
+#define SAY_SPAWN -1608005
+#define SAY_DISRUPTION -1608006
+#define SAY_BREATH_ATTACK -1608007
+#define SAY_SPECIAL_ATTACK_1 -1608008
+#define SAY_SPECIAL_ATTACK_2 -1608009
+
+struct TRINITY_DLL_DECL boss_cyanigosaAI : public ScriptedAI
+{
+ boss_cyanigosaAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_cyanigosa(Creature *_Creature)
+{
+ return new boss_cyanigosaAI (_Creature);
+}
+
+void AddSC_boss_cyanigosa()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_cyanigosa";
+ newscript->GetAI = GetAI_boss_cyanigosa;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_erekem.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_erekem.cpp
new file mode 100644
index 00000000000..c74b3e28b6f
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_erekem.cpp
@@ -0,0 +1,82 @@
+/* Script Data Start
+SDName: Boss erekem
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_BLOODLUST 54516
+#define SPELL_BREAK_BONDS 59463
+#define SPELL_CHAIN_HEAL 54481
+#define SPELL_EARTH_SHIELD 54479
+#define SPELL_EARTH_SHOCK 54511
+#define SPELL_LIGHTNING_BOLT 53044
+#define SPELL_STORMSTRIKE 51876
+
+//Yells
+#define SAY_AGGRO -1608010
+#define SAY_SLAY_1 -1608011
+#define SAY_SLAY_2 -1608012
+#define SAY_SLAY_3 -1608013
+#define SAY_DEATH -1608014
+#define SAY_SPAWN -1608015
+#define SAY_ADD_KILED -1608016
+#define SAY_BOTH_ADDS_KILED -1608017
+
+struct TRINITY_DLL_DECL boss_erekemAI : public ScriptedAI
+{
+ boss_erekemAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_erekem(Creature *_Creature)
+{
+ return new boss_erekemAI (_Creature);
+}
+
+void AddSC_boss_erekem()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_erekem";
+ newscript->GetAI = GetAI_boss_erekem;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_ichoron.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_ichoron.cpp
new file mode 100644
index 00000000000..871eba33c32
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_ichoron.cpp
@@ -0,0 +1,81 @@
+/* Script Data Start
+SDName: Boss ichoron
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_DRAINED 59820
+#define SPELL_FRENZY 54312
+#define SPELL_PROTECTIVE_BUBBLE 54306
+#define SPELL_WATER_BLAST 54237
+#define SPELL_WATER_BOLT_VOLLEY 54241
+
+//Yells
+#define SAY_AGGRO -1608018
+#define SAY_SLAY_1 -1608019
+#define SAY_SLAY_2 -1608020
+#define SAY_SLAY_3 -1608021
+#define SAY_DEATH -1608022
+#define SAY_SPAWN -1608023
+#define SAY_ENRAGE -1608024
+#define SAY_SHATTER -1608025
+#define SAY_BUBBLE -1608026
+
+struct TRINITY_DLL_DECL boss_ichoronAI : public ScriptedAI
+{
+ boss_ichoronAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_ichoron(Creature *_Creature)
+{
+ return new boss_ichoronAI (_Creature);
+}
+
+void AddSC_boss_ichoron()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_ichoron";
+ newscript->GetAI = GetAI_boss_ichoron;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_lavanthor.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_lavanthor.cpp
new file mode 100644
index 00000000000..2f88a6f2e30
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_lavanthor.cpp
@@ -0,0 +1,52 @@
+/* Script Data Start
+SDName: Boss lavanthor
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CAUTERIZING_FLAMES 59466
+#define SPELL_FIREBOLT 54235
+#define SPELL_FLAME_BREATH 54282
+#define SPELL_LAVA_BURN 54249
+
+struct TRINITY_DLL_DECL boss_lavanthorAI : public ScriptedAI
+{
+ boss_lavanthorAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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_lavanthor(Creature *_Creature)
+{
+ return new boss_lavanthorAI (_Creature);
+}
+
+void AddSC_boss_lavanthor()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_lavanthor";
+ newscript->GetAI = GetAI_boss_lavanthor;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_moragg.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_moragg.cpp
new file mode 100644
index 00000000000..72be8a72632
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_moragg.cpp
@@ -0,0 +1,50 @@
+/* Script Data Start
+SDName: Boss moragg
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_CORROSICE_SALIVA 54527
+#define SPELL_OPTIC_LINK 54396
+
+struct TRINITY_DLL_DECL boss_moraggAI : public ScriptedAI
+{
+ boss_moraggAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(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_moragg(Creature *_Creature)
+{
+ return new boss_moraggAI (_Creature);
+}
+
+void AddSC_boss_moragg()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_moragg";
+ newscript->GetAI = GetAI_boss_moragg;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_xevozz.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_xevozz.cpp
new file mode 100644
index 00000000000..e8653018cc9
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_xevozz.cpp
@@ -0,0 +1,82 @@
+/* Script Data Start
+SDName: Boss xevozz
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_ARCANE_BARRAGE_VOLLEY 54202
+#define SPELL_ARCANE_BUFFET 54226
+#define SPELL_SUMMON_ETHEREAL_SPHERE_1 54102
+#define SPELL_SUMMON_ETHEREAL_SPHERE_2 54137
+#define SPELL_SUMMON_ETHEREAL_SPHERE_3 54138
+
+//Yells
+#define SAY_AGGRO -1608027
+#define SAY_SLAY_1 -1608028
+#define SAY_SLAY_2 -1608029
+#define SAY_SLAY_3 -1608030
+#define SAY_DEATH -1608031
+#define SAY_SPAWN -1608032
+#define SAY_CHARGED -1608033
+#define SAY_REPEAT_SUMMON_1 -1608034
+#define SAY_REPEAT_SUMMON_2 -1608035
+#define SAY_SUMMON_ENERGY -1608036
+
+struct TRINITY_DLL_DECL boss_xevozzAI : public ScriptedAI
+{
+ boss_xevozzAI(Creature *c) : ScriptedAI(c) {}
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_xevozz(Creature *_Creature)
+{
+ return new boss_xevozzAI (_Creature);
+}
+
+void AddSC_boss_xevozz()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_xevozz";
+ newscript->GetAI = GetAI_boss_xevozz;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/boss_zuramat.cpp b/src/bindings/scripts/scripts/zone/violet_hold/boss_zuramat.cpp
new file mode 100644
index 00000000000..e14c3ba672d
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/boss_zuramat.cpp
@@ -0,0 +1,82 @@
+/* Script Data Start
+SDName: Boss zuramat
+SDAuthor: LordVanMartin
+SD%Complete:
+SDComment:
+SDCategory:
+Script Data End */
+
+/*** SQL START ***
+update creature_template set scriptname = '' where entry = '';
+*** SQL END ***/
+#include "precompiled.h"
+
+//Spells
+#define SPELL_SHROUD_OF_DARKNESS 54524
+#define SPELL_SUMMON_VOID_SENTRY 54524
+#define SPELL_VOID_SHIFT 54524
+
+#define NPC_VOID_SENTRY 29364
+
+//Yells
+#define SAY_AGGRO -1608037
+#define SAY_SLAY_1 -1608038
+#define SAY_SLAY_2 -1608039
+#define SAY_SLAY_3 -1608040
+#define SAY_DEATH -1608041
+#define SAY_SPAWN -1608042
+#define SAY_SHIELD -1608043
+#define SAY_WHISPER -1608044
+
+struct TRINITY_DLL_DECL boss_zuramatAI : public ScriptedAI
+{
+ boss_zuramatAI(Creature *c) : ScriptedAI(c) {}
+
+ uint32 void_shift;
+
+ void Reset() {}
+ void Aggro(Unit* who)
+ {
+ DoScriptText(SAY_AGGRO, m_creature);
+ }
+ 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, m_creature);
+ }
+ void KilledUnit(Unit *victim)
+ {
+ if(victim == m_creature)
+ return;
+ switch(rand()%3)
+ {
+ case 0: DoScriptText(SAY_SLAY_1, m_creature);break;
+ case 1: DoScriptText(SAY_SLAY_2, m_creature);break;
+ case 2: DoScriptText(SAY_SLAY_3, m_creature);break;
+ }
+ }
+};
+
+CreatureAI* GetAI_boss_zuramat(Creature *_Creature)
+{
+ return new boss_zuramatAI (_Creature);
+}
+
+void AddSC_boss_zuramat()
+{
+ Script *newscript;
+
+ newscript = new Script;
+ newscript->Name="boss_zuramat";
+ newscript->GetAI = GetAI_boss_zuramat;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/def_violet_hold.h b/src/bindings/scripts/scripts/zone/violet_hold/def_violet_hold.h
new file mode 100644
index 00000000000..71bc0d18d2f
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/def_violet_hold.h
@@ -0,0 +1,4 @@
+#ifndef DEF_VIOLET_HOLD_H
+#define DEF_VIOLET_HOLD_H
+
+#endif
diff --git a/src/bindings/scripts/scripts/zone/violet_hold/instance_violet_hold.cpp b/src/bindings/scripts/scripts/zone/violet_hold/instance_violet_hold.cpp
new file mode 100644
index 00000000000..5d6ba3a5be3
--- /dev/null
+++ b/src/bindings/scripts/scripts/zone/violet_hold/instance_violet_hold.cpp
@@ -0,0 +1,21 @@
+#include "precompiled.h"
+#include "def_violet_hold.h"
+
+struct TRINITY_DLL_DECL instance_violet_hold : public ScriptedInstance
+{
+ instance_violet_hold(Map *Map) : ScriptedInstance(Map) {Initialize();};
+};
+
+InstanceData* GetInstanceData_instance_violet_hold(Map* map)
+{
+ return new instance_violet_hold(map);
+}
+
+void AddSC_instance_violet_hold()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name = "instance_violet_hold";
+ newscript->GetInstanceData = GetInstanceData_instance_violet_hold;
+ newscript->RegisterSelf();
+}
diff --git a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
index fe83eb68bb9..9f981d4a35c 100644
--- a/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
+++ b/src/bindings/scripts/scripts/zone/westfall/westfall.cpp
@@ -47,7 +47,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (!player)
return;
@@ -95,8 +95,8 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI
{
if (PlayerGUID)
{
- if (Unit* player = Unit::GetUnit((*m_creature), PlayerGUID))
- ((Player*)player)->FailQuest(QUEST_DEFIAS_BROTHERHOOD);
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
+ player->FailQuest(QUEST_DEFIAS_BROTHERHOOD);
}
}
@@ -117,55 +117,11 @@ bool QuestAccept_npc_defias_traitor(Player* player, Creature* creature, Quest co
return true;
}
-CreatureAI* GetAI_npc_defias_traitor(Creature *_Creature)
+CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature)
{
- npc_defias_traitorAI* thisAI = new npc_defias_traitorAI(_Creature);
-
- thisAI->AddWaypoint(0, -10508.40, 1068.00, 55.21);
- thisAI->AddWaypoint(1, -10518.30, 1074.84, 53.96);
- thisAI->AddWaypoint(2, -10534.82, 1081.92, 49.88);
- thisAI->AddWaypoint(3, -10546.51, 1084.88, 50.13);
- thisAI->AddWaypoint(4, -10555.29, 1084.45, 45.75);
- thisAI->AddWaypoint(5, -10566.57, 1083.53, 42.10);
- thisAI->AddWaypoint(6, -10575.83, 1082.34, 39.46);
- thisAI->AddWaypoint(7, -10585.67, 1081.08, 37.77);
- thisAI->AddWaypoint(8, -10600.08, 1078.19, 36.23);
- thisAI->AddWaypoint(9, -10608.69, 1076.08, 35.88);
- thisAI->AddWaypoint(10, -10621.26, 1073.00, 35.40);
- thisAI->AddWaypoint(11, -10638.12, 1060.18, 33.61);
- thisAI->AddWaypoint(12, -10655.87, 1038.99, 33.48);
- thisAI->AddWaypoint(13, -10664.68, 1030.54, 32.70);
- thisAI->AddWaypoint(14, -10708.68, 1033.86, 33.32);
- thisAI->AddWaypoint(15, -10754.43, 1017.93, 32.79);
- thisAI->AddWaypoint(16, -10802.26, 1018.01, 32.16);
- thisAI->AddWaypoint(17, -10832.60, 1009.04, 32.71);
- thisAI->AddWaypoint(18, -10866.56, 1006.51, 31.71); // Fix waypoints from roughly this point, test first to get proper one
- thisAI->AddWaypoint(19, -10879.98, 1005.10, 32.84);
- thisAI->AddWaypoint(20, -10892.45, 1001.32, 34.46);
- thisAI->AddWaypoint(21, -10906.14, 997.11, 36.15);
- thisAI->AddWaypoint(22, -10922.26, 1002.23, 35.74);
- thisAI->AddWaypoint(23, -10936.32, 1023.38, 36.52);
- thisAI->AddWaypoint(24, -10933.35, 1052.61, 35.85);
- thisAI->AddWaypoint(25, -10940.25, 1077.66, 36.49);
- thisAI->AddWaypoint(26, -10957.09, 1099.33, 36.83);
- thisAI->AddWaypoint(27, -10956.53, 1119.90, 36.73);
- thisAI->AddWaypoint(28, -10939.30, 1150.75, 37.42);
- thisAI->AddWaypoint(29, -10915.14, 1202.09, 36.55);
- thisAI->AddWaypoint(30, -10892.59, 1257.03, 33.37);
- thisAI->AddWaypoint(31, -10891.93, 1306.66, 35.45);
- thisAI->AddWaypoint(32, -10896.17, 1327.86, 37.77);
- thisAI->AddWaypoint(33, -10906.03, 1368.05, 40.91);
- thisAI->AddWaypoint(34, -10910.18, 1389.33, 42.62);
- thisAI->AddWaypoint(35, -10915.42, 1417.72, 42.93);
- thisAI->AddWaypoint(36, -10926.37, 1421.18, 43.04); // walk here and say
- thisAI->AddWaypoint(37, -10952.31, 1421.74, 43.40);
- thisAI->AddWaypoint(38, -10980.04, 1411.38, 42.79);
- thisAI->AddWaypoint(39, -11006.06, 1420.47, 43.26);
- thisAI->AddWaypoint(40, -11021.98, 1450.59, 43.09);
- thisAI->AddWaypoint(41, -11025.36, 1491.59, 43.15);
- thisAI->AddWaypoint(42, -11036.09, 1508.32, 43.28);
- thisAI->AddWaypoint(43, -11060.68, 1526.72, 43.19);
- thisAI->AddWaypoint(44, -11072.75, 1527.77, 43.20, 5000);// say and quest credit
+ npc_defias_traitorAI* thisAI = new npc_defias_traitorAI(pCreature);
+
+ thisAI->FillPointMovementListForCreature();
return (CreatureAI*)thisAI;
}
diff --git a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
index 3d7481544e8..ebe549a0599 100644
--- a/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
+++ b/src/bindings/scripts/scripts/zone/zangarmarsh/zangarmarsh.cpp
@@ -287,7 +287,7 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
void WaypointReached(uint32 i)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
switch(i)
{
@@ -308,7 +308,7 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
case 26: DoScriptText(SAY_PROGRESS_6, m_creature, player);
Completed = true;
if(player)
- ((Player*)player)->GroupEventHappens(QUEST_EFU, m_creature);
+ player->GroupEventHappens(QUEST_EFU, m_creature);
break;
}
}
@@ -317,9 +317,9 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI
{
if (PlayerGUID && !Completed)
{
- Unit* player = Unit::GetUnit((*m_creature), PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if (player && !Completed)
- ((Player*)player)->FailQuest(QUEST_EFU);
+ player->FailQuest(QUEST_EFU);
}
}
diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp
index 3014394976e..56741452c66 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/boss_hexlord.cpp
@@ -311,7 +311,7 @@ struct TRINITY_DLL_DECL boss_hex_lord_malacrassAI : public ScriptedAI
{
for(uint8 i = 0; i < 4; ++i)
{
- Creature *pCreature = ((Creature*)Unit::GetUnit((*m_creature), AddGUID[i]));
+ Creature *pCreature = (Unit::GetCreature((*m_creature), AddGUID[i]));
if(!pCreature || !pCreature->isAlive())
{
if(pCreature) pCreature->setDeathState(DEAD);
diff --git a/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp b/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
index a7243ac125d..62130f9a863 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/zulaman.cpp
@@ -114,7 +114,7 @@ struct TRINITY_DLL_DECL npc_zulaman_hostageAI : public ScriptedAI
void Aggro(Unit *who) {}
void JustDied(Unit *)
{
- Player* player = (Player*)Unit::GetUnit(*m_creature, PlayerGUID);
+ Player* player = Unit::GetPlayer(PlayerGUID);
if(player) player->SendLoot(m_creature->GetGUID(), LOOT_CORPSE);
}
void UpdateAI(const uint32 diff)
diff --git a/src/bindings/scripts/sql/WotLK/npc_taxi.sql b/src/bindings/scripts/sql/WotLK/npc_taxi.sql
new file mode 100644
index 00000000000..b93f5dfdfca
--- /dev/null
+++ b/src/bindings/scripts/sql/WotLK/npc_taxi.sql
@@ -0,0 +1,10 @@
+#Taxi in Archerus
+UPDATE `creature_template` SET `ScriptName`='npc_acherus_taxi' WHERE `entry`='28864';
+
+#Stormwind Harbor
+UPDATE `creature_template` SET `ScriptName`='npc_stormwindharbor_taxi' WHERE `entry`='29154';
+
+#Taxis to the 3 parts of the Wyrmresttempel
+UPDATE `creature_template` SET `ScriptName`='npc_wyrmresttempelbottom_taxi' WHERE `entry`='26443';
+UPDATE `creature_template` SET `ScriptName`='npc_wyrmresttempelmiddle_taxi' WHERE `entry`='27575';
+UPDATE `creature_template` SET `ScriptName`='npc_wyrmresttempeltop_taxi' WHERE `entry`='26949';
diff --git a/src/bindings/scripts/sql/WotLK/script_texts_wotlk.sql b/src/bindings/scripts/sql/WotLK/script_texts_wotlk.sql
new file mode 100644
index 00000000000..de3de7b9464
--- /dev/null
+++ b/src/bindings/scripts/sql/WotLK/script_texts_wotlk.sql
@@ -0,0 +1,530 @@
+-- -1 574 000 UTGARDE KEEP
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Prince Keleseth
+ (-1574000, 'Your blood is mine!',13221,1,0,'keleseth SAY_AGGRO'),
+ (-1574001, 'Darkness waits',13223,1,0, 'keleseth SAY_KILL'),
+ (-1574002, 'I join... the night.',13225,1,0, 'keleseth SAY_DEATH'),
+ (-1574003, 'Not so fast.',13222,1,0, 'keleseth SAY_FROST_TOMB'),
+ (-1574004, 'Aranal, lidel! Their fate shall be yours!',13224,1,0, 'keleseth SAY_SKELETONS'),
+-- Dalronn the Controller
+ (-1574005, 'By all means, don\'t assess the situation, you halfwit! Just jump into the fray!',13199, 1,0,'dalronn SAY_AGGRO'),
+ (-1574006, 'You may serve me yet.',13202, 1,0,'dalronn SAY_KILL'),
+ (-1574007, 'See... you... soon.',13200, 1,0,'dalronn SAY_DEATH_1'),
+ (-1574008, 'There\'s no... greater... glory.',13201, 1,0,'dalronn SAY_DEATH_2'),
+ (-1574009, 'Skarvald, you incompetent slug! Return and make yourself useful!',13203,1,0, 'dalronn SAY_RAISES'),
+-- Skarvald the Constructor
+ (-1574010, 'Dalronn! See if you can muster the nerve to join my attack!',13229, 1,0,'skarvald SAY_AGGRO'),
+ (-1574011, '...',13232,1,0, 'skarvald SAY_KILL'),
+ (-1574012, 'Not... over... yet.',13230,1,0, 'skarvald SAY_DEATH_1'),
+ (-1574013, 'A warrior\'s death.',13231,1,0, 'skarvald SAY_DEATH_2'),
+ (-1574014, 'Pagh! What sort of necromancer lets death stop him? I knew you were worthless!',13233,1,0, 'skarvald SAY_RAISES'),
+-- Ingvar the Plunderer
+ (-1574015, 'I\'ll paint my face with your blood!',13207,1,0, 'ingvar SAY_AGGRO'),
+ (-1574016, 'I am a warrior born!',13214,1,0, 'ingvar SAY_KILL'),
+ (-1574017, 'My life for the... death god!',13213,1,0, 'ingvar SAY_DEATH'),
+ (-1574018, 'Fight on or face me!',13208,1,0, 'ingvar SAY_ATTACK_1'),
+ (-1574019, '...',13240, 1,0,'ingvar SAY_ATTACK_2'),
+ (-1574020, 'Slay them all, no excuses, no mercy, no rest!',13241,1,0, 'ingvar SAY_ATTACK_3'),
+ (-1574021, '... of destruction silence every ...!',13242,1,0, 'ingvar SAY_ATTACK_4'),
+ (-1574022, 'I return! A second chance to carve out your skull!',13208,1,0, 'ingvar SAY_PHASE2_AGGRO'),
+ (-1574023, 'Mjul orm agn gjor!',13212, 1,0,'ingvar SAY_PHASE2_KILL'),
+ (-1574024, 'No! I can do... better! I can...',13211,1,0, 'ingvar SAY_PHASE2_DEATH'),
+-- Said by Annhylde the Caller when resurecting Ingvar
+ (-1574025, 'Ingvar! Your pathetic failure will serve as a warning to all... you are damned! Arise and carry out the master\'s will!',13754, 1,0,'ingvar SAY_ANNHYLDE_THE_CALLER_RESURECTION');
+
+-- -1 575 000 UTGARDE PINNACLE
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Gortok Palehoof
+ (-1575000, 'What this place? I will destroy you!',13464,1,0, 'palehoof SAY_AGGRO'),
+ (-1575001, 'You die! That what master wants!',13465,1,0, 'palehoof SAY_SLAY_1'),
+ (-1575002, 'An easy task!',13466,1,0, 'palehoof SAY_SLAY_2'),
+ (-1575003, '...',13467,1,0, 'palehoof SAY_DEATH'),
+-- Skadi the Ruthless
+ (-1575004, 'What mongrels dare intrude here? Look alive, my brothers! A feast for the one that brings me their heads!',13497,1,0, 'skadi SAY_AGGRO'),
+ (-1575005, 'Mjor Na Ul Kaval!',13503,1,0, 'skadi SAY_KILL_1'),
+ (-1575006, 'Not so brash now, are you?',13504,1,0, 'skadi SAY_KILL_2'),
+ (-1575007, 'I\'ll mount your skull from the highest tower!',13505,1,0, 'skadi SAY_KILL_3'),
+ (-1575008, 'ARGH! You call that... an attack? I\'ll... show... aghhhh...',13506,1,0, 'skadi SAY_DEATH'),
+ (-1575009, 'You motherless knaves! Your corpses will make fine morsels for my new drake!',13507,1,0, 'skadi SAY_DRAKE_DEATH'),
+ (-1575010, 'I ask for ... to kill them, yet all I get is feeble whelps! By Ye.. SLAUGHTER THEM!',13501,1,0, 'skadi SAY_DRAKE_HIT_1'),
+ (-1575011, 'If one more harpoon touches my drake I\'ll flae my miserable heins.',13502,1,0, 'skadi SAY_DRAKE_HIT_2'),
+ (-1575012, 'Sear them to the bone!',13498,1,0, 'skadi SAY_DRAKE_BREATH_1'),
+ (-1575013, 'Go now! Leave nothing but ash in your wake!',13499,1,0, 'skadi SAY_DRAKE_BREATH_2'),
+ (-1575014, 'Cleanse our sacred halls with flame!',13500,1,0, 'skadi SAY_DRAKE_BREATH_3'),
+-- Svala Sorrowgrave
+ (-1575015, 'I will vanquish your soul!',13842,1,0, 'svala SAY_AGGRO'),
+ (-1575016, 'You were a fool to challenge the power of the Lich King!',13845, 1,0,'svala SAY_SLAY_1'),
+ (-1575017, 'Your will is done, my king.',13847,1,0, 'svala SAY_SLAY_2'),
+ (-1575018, 'Another soul for my master.',13848, 1,0,'svala SAY_SLAY_3'),
+ (-1575019, 'Nooo! I did not come this far... to...',13855,1,0, 'svala SAY_DEATH'),
+ (-1575020, 'Your death approaches.',13850,1,0, 'svala SAY_SACRIFICE_PLAYER_1'),
+ (-1575021, 'Go now to my master.',13851,1,0, 'svala SAY_SACRIFICE_PLAYER_2'),
+ (-1575022, 'Your end is inevitable.',13852,1,0, 'svala SAY_SACRIFICE_PLAYER_3'),
+ (-1575023, '...',13853,1,0, 'svala SAY_SACRIFICE_PLAYER_4'),
+ (-1575024, 'Any last words?',13854,1,0, 'svala SAY_SACRIFICE_PLAYER_5'),
+ (-1575025, 'My liege! I have done as you asked, and now beseech you for your blessing!',13856,1,0, 'svala SAY_SAY_DIALOG_WITH_ARTHAS_1'),
+ (-1575026, 'The sensation is... beyond my imagining. I am yours to command, my king.',13857,1,0, 'svala SAY_SAY_DIALOG_WITH_ARTHAS_2'),
+ (-1575027, 'I will be happy to slaughter them in your name! Come, enemies of the Scourge! I will show you the might of the Lich King!',13858,1,0, 'svala SAY_SAY_DIALOG_WITH_ARTHAS_3'),
+-- King Ymiron
+ (-1575028, 'You invade my home and then dare to challenge me? I will tear the hearts from your chests and offer them as gifts to the death god! Rualg nja gaborr!',13609, 1,0,'ymiron SAY_AGGRO'),
+ (-1575029, 'Your death is only the beginning!',13614,1,0, 'ymiron SAY_SLAY_1'),
+ (-1575030, 'You have failed your people!',13615, 1,0,'ymiron SAY_SLAY_2'),
+ (-1575031, 'There is a reason I am king!',13616, 1,0,'ymiron SAY_SLAY_3'),
+ (-1575032, 'Bleed no more!',13617, 1,0,'ymiron SAY_SLAY_4'),
+ (-1575033, 'What... awaits me... now?',13618,1,0, 'ymiron SAY_DEATH'),
+ (-1575034, 'Bjorn of the Black Storm! Honor me now with your presence!',13610,1,0, 'ymiron SAY_SUMMON_BJORN'),
+ (-1575035, 'Haldor of the rocky cliffs, grant me your strength!',13611, 1,0,'ymiron SAY_SUMMON_HALDOR'),
+ (-1575036, 'Ranulf of the screaming abyss, snuff these maggots with darkest night!',13612,1,0, 'ymiron SAY_SUMMON_RANULF'),
+ (-1575037, 'Tor of the Brutal Siege! Bestow your might upon me!',13613,1,0, 'ymiron SAY_SUMMON_TORGYN');
+
+-- -1 576 000 NEXUS
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Anomalus
+ (-1576000, 'Chaos beckons.',13186,1,0,'anomalus SAY_AGGRO'),
+ (-1576001, 'Expiration... is necessary...',13274,1,0,'anomalus SAY_KILL'),
+ (-1576002, 'Of course.',13187,1,0,'anomalus SAY_DEATH'),
+ (-1576003, 'Reality... unwoven.',13188,1,0,'anomalus SAY_RIFT'),
+ (-1576004, 'Indestructible.',13189,1,0,'anomalus SAY_SHIELD'),
+-- Keristrasza
+ (-1576005, 'Preserve? Why? There\'s no truth in it. No no no... only in the taking! I see that now!',13450,1,0,'keristrasza SAY_AGGRO'),
+ (-1576006, 'Now we\'ve come to the truth! ',13453,1,0,'keristrasza SAY_SLAY'),
+ (-1576007, 'Finish it! Finish it! Kill me, or I swear by the Dragonqueen you\'ll never see daylight again!',13452,1,0,'keristrasza SAY_ENRAGE'),
+ (-1576008, 'Dragonqueen... Life-Binder... preserve... me.',13454,1,0,'keristrasza SAY_DEATH'),
+ (-1576009, 'Stay. Enjoy your final moments.',13451,1,0,'keristrasza SAY_CRYSTAL_NOVA'),
+-- Grand Magus Telestra
+ (-1576010, 'You know what they say about curiosity.',13319,1,0,'magus_telestra SAY_AGGRO'),
+ (-1576011, 'Death becomes you!',13324,1,0,'magus_telestra SAY_KILL'),
+ (-1576012, 'Damn the... luck.',13320,1,0,'magus_telestra SAY_DEATH'),
+ (-1576013, 'Now to finish the job!',13323,1,0,'magus_telestra SAY_MERGE'),
+ (-1576014, 'There\'s plenty of me to go around.',13321,1,0,'magus_telestra SAY_SPLIT_1'),
+ (-1576015, 'I\'ll give you more than you can handle.',13322,1,0,'magus_telestra SAY_SPLIT_2'),
+-- Ormorok
+ (-1576016, 'Noo!',13328,1,0,'ormorok SAY_AGGRO'),
+ (-1576017, 'Aargh Kill!',13329,1,0,'ormorok SAY_KILL'),
+ (-1576018, 'Aaggh!',13330,1,0,'ormorok SAY_DEATH'),
+ (-1576019, 'Back!',13331,1,0,'ormorok SAY_REFLECT'),
+ (-1576020, 'Bleed!',13332,1,0,'ormorok SAY_ICE_SPIKES'),
+-- Commander Stoutbeard
+ (-1576021, 'What? Where in a..? Don\'t just stand around lads KILL SOMEBODY!',13193,1,0,'commander_stoutbeard SAY_AGGRO'),
+ (-1576022, 'Now we\re getting someplace!',13195,1,0,'commander_stoutbeard SAY_KILL'),
+ (-1576023, 'Is that all you\'ve... got?',13194,1,0,'commander_stoutbeard SAY_DEATH'),
+-- Commander Kolurg
+ (-1576024, 'What is this? Mag thorin Kar! Kill them!',13458,1,0,'commander_kolurg SAY_AGGRO'),
+ (-1576025, 'Our task is not yet done!',13459,1,0,'commander_kolurg SAY_KILL'),
+ (-1576026, 'GOOO!',13460,1,0,'commander_kolurg SAY_DEATH');
+
+-- -1 578 000 OCULUS
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Drakos the Interrogator
+ (-1578000, 'The prisoners shall not go free. The word of Malygos is law!',13594,1,0, 'drakos SAY_AGGRO'),
+ (-1578001, 'A fitting punishment!',13602, 1,0,'drakos SAY_KILL_1'),
+ (-1578002, 'Sentence: executed!',13603,1,0, 'drakos SAY_KILL_2'),
+ (-1578003, 'Another casualty of war!',13604, 1,0,'drakos SAY_KILL_3'),
+ (-1578004, 'The war... goes on.',13605,1,0, 'drakos SPELL_DEATH'),
+ (-1578005, 'It is too late to run!',13598, 1,0,'drakos SAY_PULL_1'),
+ (-1578006, 'Gather \'round! ',13599, 1,0,'drakos SAY_PULL_2'),
+ (-1578007, 'None shall escape!',13600, 1,0,'drakos SAY_PULL_3'),
+ (-1578008, 'I condemn you to death!',13601,1,0, 'drakos SAY_PULL_4'),
+ (-1578009, 'Tremble, worms!',13595,1,0, 'drakos SAY_STOMP_1'),
+ (-1578010, 'I will crush you!',13596, 1,0,'drakos SAY_STOMP_2'),
+ (-1578011, 'Can you fly?',13597, 1,0,'drakos SAY_STOMP_3'),
+-- Mage-Lord Urom
+ (-1578012, 'Poor blind fools!',13638,1,0, 'urom SAY_AGGRO'),
+ (-1578013, 'If only you understood!',13641,1,0, 'urom SAY_KILL_1'),
+ (-1578014, 'Now, do you see? DO YOU?!',13642,1,0, 'urom SAY_KILL_2'),
+ (-1578015, 'Unfortunate, but necessary.',13643,1,0, 'urom SAY_KILL_3'),
+ (-1578016, 'Everything I\'ve done... has been for Azeroth...',13644,1,0, 'urom SAY_DEATH'),
+ (-1578017, 'A taste... just a small taste... of the Spell-Weaver\'s power!',13639,1,0, 'urom SAY_EXPLOSION_1'),
+ (-1578018, 'So much unstable energy... but worth the risk to destroy you!',13640,1,0, 'urom SAY_EXPLOSION_2'),
+ (-1578019, 'What do we have here... those would defy the Spell-Weaver? Those without foresight or understanding. How could I make you see? Malygos is saving the world from itself! Bah! You are hardly worth my time!',13635,1,0, 'urom SAY_SUMMON_1'),
+ (-1578020, 'Clearly my pets failed. Perhaps another demonstration is in order.',13636,1,0, 'urom SAY_SUMMON_2'),
+ (-1578021, 'Still you fight. Still you cling to misguided principles. If you survive, you\'ll find me in the center ring.',13637,1,0, 'urom SAY_SUMMON_3'),
+-- Varos Cloudstrider
+ (-1578022, 'There will be no mercy!',13649,1,0, 'varos SAY_AGGRO'),
+ (-1578023, 'You were warned.',13653,1,0, 'varos SAY_KILL_1'),
+ (-1578024, 'The Oculus is ours.',13654,1,0, 'varos SAY_KILL_2'),
+ (-1578025, 'They are... too strong! Underestimated their... fortitude.',13655,1,0, 'varos SAY_DEATH'),
+ (-1578026, 'Blast them! Destroy them!',13650,1,0, 'varos SAY_STRIKE_1'),
+ (-1578027, 'Take no prisoners! Attack!',13651,1,0, 'varos SAY_STRIKE_2'),
+ (-1578028, 'Strike now! Obliterate them!',13652,1,0, 'varos SAY_STRIKE_3'),
+-- Varos says when Drakos dies
+ (-1578029, 'Intruders, your victory will be short-lived. I am Commander Varos Cloudstrider. My drakes control the skies and protest this conduit. I will see to it personally that the Oculus does not fall into your hands!',13648,1,0, 'varos SAY_SPAWN');
+
+-- -1 595 000 CULLING OF STRATHOLME
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Epoch
+ (-1595000, 'We\'ll see about that, young prince.',13409,1,0, 'epoch SAY_AGGRO'),
+ (-1595001, 'Tick tock, tick tock...',13410, 1,0,'epoch SAY_TIME_WARP_1'),
+ (-1595002, 'Not quick enough!',13411,1,0, 'epoch SAY_TIME_WARP_2'),
+ (-1595003, 'Let\'s get this over with. ',13412, 1,0,'epoch SAY_TIME_WARP_3'),
+ (-1595004, 'There is no future for you.',13413,1,0, 'epoch SAY_SLAY_1'),
+ (-1595005, 'This is the hour of our greatest triumph!',13414,1,0, 'epoch SAY_SLAY_2'),
+ (-1595006, 'You would destined to fail. ',13415,1,0, 'epoch SAY_SLAY_3'),
+ (-1595007, 'Prince Arthas Menethil, on this day, a powerful darkness has taken hold of your soul. The death you are destined to visit upon others will this day be your own.',13408,1,0, 'epoch SAY_INTRO'),
+ (-1595008, '*gurgles*',13416,1,0, 'epoch SAY_DEATH'),
+-- Mal'ganis
+ (-1595009, 'Yes...this is the beginning...I\'ve been waiting for you...young prince...I...am Mal\'Ganis..', 14410,1,0, 'mal_ganis SAY_INTRO_1'),
+ (-1595010, 'As you can see, your people...are now mine. I will now turn this city, household by household, until the flame of life has been snuffed out...forever...', 14411,1,0, 'mal_ganis SAY_INTRO_2'),
+ (-1595011, 'This will be a fine test...Prince Arthas...', 14413,1,0, 'mal_ganis SAY_AGGRO'),
+ (-1595012, 'All too easy...', 14416,1,0, 'mal_ganis SAY_KILL_1'),
+ (-1595013, 'The dark lord is displeased with your interference...', 14417, 1,0,'mal_ganis SAY_KILL_2'),
+ (-1595014, 'It is Prince Arthas I want...not you...', 14418,1,0, 'mal_ganis SAY_KILL_3'),
+ (-1595015, 'Anak\'Keri...', 14422, 1,0,'mal_ganis SAY_SLAY_1'),
+ (-1595016, 'My onslaught will wash over the Lich King\'s forces...', 14423,1,0, 'mal_ganis SAY_SLAY_2'),
+ (-1595017, 'Your death is in vain, tiny mortal...', 14424, 1,0,'mal_ganis SAY_SLAY_3'),
+ (-1595018, 'Your time has come to an end! ', 14425,1,0, 'mal_ganis SAY_SLAY_4'),
+ (-1595019, 'Time out...', 14414, 1,0,'mal_ganis SAY_SLEEP_1'),
+ (-1595020, 'You seem...tired... ', 14415,1,0, 'mal_ganis SAY_SLEEP_2'),
+ (-1595021, '*Struggling sounds* I spent too much time in that weak little shell... ', 14426,1,0, 'mal_ganis SAY_30HEALTH'),
+ (-1595022, '(Eredun) I AM MAL\'GANIS! I AM ETERNAL! ', 14427,1,0, 'mal_ganis SAY_15HEALTH'),
+ (-1595023, 'ENOUGH! I waste my time here...I must gather my strength on the home world...', 14428,1,0, 'mal_ganis SAY_ESCAPE_SPEECH_1'),
+ (-1595024, 'You\'ll never defeat the Lich King without my forces! I\'ll have my revenge...on him, AND you... ', 14429,1,0, 'mal_ganis SAY_ESCAPE_SPEECH_2'),
+ (-1595025, 'Your journey has just begun, young prince...Gather your forces, and meet me in the arctic land of Northrend...It is there we shall settle the score between us...It is there that your true destiny will unfold...', 14412,1,0, 'mal_ganis SAY_OUTRO'),
+-- Meathook
+ (-1595026, 'New toys!',13429,1,0, 'meathook SAY_AGGRO'),
+ (-1595027, 'Boring...',13430,1,0, 'meathook SAY_SLAY_1'),
+ (-1595028, 'Why you stop moving?',13431,1,0, 'meathook SAY_SLAY_2'),
+ (-1595029, 'Get up! Me not done! ',13432,1,0, 'meathook SAY_SLAY_3'),
+ (-1595030, 'Play time! ',13428,1,0, 'meathook SAY_SPAWN'),
+ (-1595031, 'This not fun...',13433,1,0, 'meathook SAY_DEATH'),
+-- Salramm the Fleshcrafter
+ (-1595032, 'Ah, the entertainment has arrived!',13472,1,0, 'salramm SAY_AGGRO'),
+ (-1595033, 'You are too late, champion of Lordaeron. The dead shall have their day. ',13471,1,0, 'salramm SAY_SPAWN'),
+ (-1595034, 'The fun is just beginning!',13473,1,0, 'salramm SAY_SLAY_1'),
+ (-1595035, 'Aah, quality materials!',13474, 1,0,'salramm SAY_SLAY_2'),
+ (-1595036, 'Don\'t worry, I\'ll make good use of you. ',137475, 1,0,'salramm SAY_SLAY_3'),
+ (-1595037, 'You only advance... the master\'s plan...',13483,1,0, 'salramm SAY_DEATH'),
+ (-1595038, 'BOOM! Hahahahah...',13478, 1,0,'salramm SAY_EXPLODE_GHOUL_1'),
+ (-1595039, 'Blood... destruction... EXHILARATING! ',13479,1,0, 'salramm SAY_EXPLODE_GHOUL_2'),
+ (-1595040, 'I want a sample...',13480,1,0, 'salramm SAY_STEAL_FLESH_1'),
+ (-1595041, 'Such strength... it must be mine!',13481,1,0, 'salramm SAY_STEAL_FLESH_2'),
+ (-1595042, 'Your flesh betrays you.',13482,1,0, 'salramm SAY_STEAL_FLESH_3'),
+ (-1595043, 'Say hello to some friends of mine.',13476,1,0, 'salramm SAY_SUMMON_GHOULS_1'),
+ (-1595044, 'Come, citizen of Stratholme! Meet your saviors.',13477,1,0, 'salramm SAY_SUMMON_GHOULS_2');
+
+-- -1 599 000 HALLS OF STONE
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Krystallus
+ (-1599000, 'Crush....', 14176, 1,0,'krystallus SAY_AGGRO'),
+ (-1599001, 'Ha...ha...ha...ha...', 14177,1,0, 'krystallus SAY_KILL'),
+ (-1599002, 'Uuuuhhhhhhhhhh......', 14179,1,0, 'krystallus SAY_DEATH'),
+ (-1599003, 'Break.... you....', 14178,1,0, 'krystallus SAY_SHATTER'),
+-- Maiden of Grief
+ (-1599004, 'You shouldn\'t have come...now you will die!',13487,1,0, 'maiden_of_grief SAY_AGGRO'),
+ (-1599005, 'Why must it be this way?',13488,1,0, 'maiden_of_grief SAY_SLAY_1'),
+ (-1599006, 'You had it coming!',13489, 1,0,'maiden_of_grief SAY_SLAY_2'),
+ (-1599007, 'My burden grows heavier.',13490,1,0, 'maiden_of_grief SAY_SLAY_3'),
+ (-1599008, 'This is your own fault!',13491,1,0, 'maiden_of_grief SAY_SLAY_4'),
+ (-1599009, 'I hope you all rot! I never...wanted...this.',13493, 1,0,'maiden_of_grief SAY_DEATH'),
+ (-1599010, 'So much lost time... that you\'ll never get back!',13492,1,0, 'maiden_of_grief SAY_STUN'),
+-- Sjonnir
+ (-1599011, 'Soft, vulnerable shells. Brief, fragile lives. You can not escape the curse of flesh!', 14180,1,0, 'sjonnir SAY_AGGRO'),
+ (-1599012, '...', 14181,1,0, 'sjonnir SAY_SLAY_1'),
+ (-1599013, 'Flesh is no match for iron!', 14182, 1,0,'sjonnir SAY_SLAY_2'),
+ (-1599014, 'Armies of iron will smother the world!', 14183, 1,0,'sjonnir SAY_SLAY_3'),
+ (-1599015, 'Loken will not rest, until the forge is retaken. You changed nothing!', 14184,1,0, 'sjonnir SAY_DEATH');
+
+-- -1 600 000 DRAK'THARON KEEP
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Novos the Summoner
+ (-1600000, 'The chill you feel is the herald of your doom.', 13173, 1,0, 'novos SAY_AGGRO'),
+ (-1600001, 'Such is the faith of all who oppose the Lich King!', 13175, 1,0, 'novos SAY_KILL'),
+ (-1600002, 'Your efforts... are in vain.', 13174, 1,0, 'novos SAY_DEATH'),
+ (-1600003, 'Surely you can see the futility of it all!', 13177, 1,0, 'novos SAY_REBUBLE_1'),
+ (-1600004, 'Just give up and die already!', 13178, 1,0, 'novos SAY_REBUBLE_2'),
+ (-1600005, 'Bolster my defenses! Hurry, curse you!', 13176, 1,0, 'novos SAY_NECRO_ADD'),
+-- Trollgore
+ (-1600006, 'Mogas moblath moghuld!', 13181, 1,0, 'trollgore SAY_AGGRO'),
+ (-1600007, '... I will eat you!', 13185, 1,0, 'trollgore SAY_KILL'),
+ (-1600008, '... .. so hungry, .. ... must\'t feed.', 13182, 1,0, 'trollgore SAY_CONSUME'),
+ (-1600009, '*laugh* Corpse go boom!', 13184, 1,0, 'trollgore SAY_EXPLODE'),
+ (-1600010, '...', 13183, 1,0, 'trollgore SAY_DEATH'),
+-- The Prophet Tharon'ja
+ (-1600011, 'Tharon\'ja sees all! The work of mortals shall not end the eternal dynasty!', 13862, 1, 0, 'tharon_ja SAY_AGGRO'),
+ (-1600012, 'As Tharon\'ja predicted.', 13863, 1, 0, 'tharon_ja SAY_KILL_1'),
+ (-1600013, 'As it was written.', 13863, 1, 0, 'tharon_ja SAY_KILL_2'),
+ (-1600014, 'Your flesh serves Tharon\'ja now!', 13865, 1, 0, 'tharon_ja SAY_FLESH_1'),
+ (-1600015, 'Tharon\'ja has a use for your mortal shell!', 13866, 1, 0, 'tharon_ja SAY_FLESH_2'),
+ (-1600016, 'No! A taste... all too brief!', 13868, 1, 0, 'tharon_ja SAY_SKELETON_1'),
+ (-1600017, 'Tharon\'ja will have more!', 13868, 1, 0, 'tharon_ja SAY_SKELETON_2'),
+ (-1600018, 'Im... impossible! Tharon\'ja is eternal! Tharon\'ja... is...', 13869, 1, 0, 'tharon_ja SAY_DEATH');
+
+-- -1 601 000 AZJOL-NERUB
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Anub'arak
+ (-1601000, 'Eternal agony awaits you!', 14054,1,0, 'anub_arak SAY_AGGRO'),
+ (-1601001, 'You shall experience my torment, first-hand!', 14055,1,0, 'anub_arak SAY_SLAY_1'),
+ (-1601002, 'You have made your choice.', 14056,1,0, 'anub_arak SAY_SLAY_2'),
+ (-1601003, 'Soon, the Master\'s voice will call to you.', 14057,1,0, 'anub_arak SAY_SLAY_3'),
+ (-1601004, 'Ahhh... RAAAAAGH! Never thought... I would be free of him...', 14069,1,0, 'anub_arak SAY_DEATH'),
+ (-1601005, 'Your armor is useless against my locusts!', 14060, 1,0,'anub_arak SAY_LOCUST_1'),
+ (-1601006, '?!!??!!!', 14067,1,0, 'anub_arak SAY_LOCUST_2'),
+ (-1601007, 'The pestilence upon you!', 14068,1,0, 'anub_arak SAY_LOCUST_3'),
+ (-1601008, '!!!???!!!', 14058,1,0, 'anub_arak SAY_SUBMERGE_1'),
+ (-1601009, 'Come forth, my brethren. Feast on their flesh!', 14059,1,0, 'anub_arak SAY_SUBMERGE_2'),
+ (-1601010, 'I was king of this empire once, long ago. In life I stood as champion. In death I returned as conqueror. Now I protect the kingdom once more. Ironic, yes?', 14053, 1,0,'anub_arak SAY_INTRO'),
+-- Krik'thir
+ (-1601011, 'This kingdom belongs to the Scourge! Only the dead may enter.', 14075,1,0, 'krik_thir SAY_AGGRO'),
+ (-1601012, 'Hash\'tak hi\'tak.', 14076,1,0, 'krik_thir SAY_SLAY_1'),
+ (-1601013, 'You were foolish to come.', 14077, 1,0,'krik_thir SAY_SLAY_2'),
+ (-1601014, 'As Anub\'Arak commands!', 14078,1,0, 'krik_thir SAY_SLAY_3'),
+ (-1601015, 'I should be grateful. But I long ago lost the capacity.', 14087,1,0, 'krik_thir SAY_DEATH'),
+ (-1601016, 'They hunger.', 14085,1,0, 'krik_thir SAY_SWARM_1'),
+ (-1601017, 'Dinner time, my pets.', 14086,1,0, 'krik_thir SAY_SWARM_2'),
+ (-1601018, 'We are besieged. Strike out and bring back their corpses!', 14079,1,0, 'krik_thir SAY_SEND_GROUP_1'),
+ (-1601019, 'We must hold the gate. Attack! Tear them limb from limb!', 14080,1,0, 'krik_thir SAY_SEND_GROUP_2'),
+ (-1601020, 'The gate must be protected at all costs. Rip them to shreds!', 14081,1,0, 'krik_thir SAY_SEND_GROUP_3'),
+ (-1601021, 'Keep an eye on the tunnel. We must not let anyone through!', 14082,1,0, 'krik_thir SAY_PREFIGHT_1'),
+ (-1601022, 'I hear footsteps. Be on your guard.', 14083,1,0, 'krik_thir SAY_PREFIGHT_2'),
+ (-1601023, 'I sense the living. Be ready.', 14084,1,0, 'krik_thir SAY_PREFIGHT_3');
+
+-- -1 602 000 HALLS OF LIGHTNING
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- General Bjarngrim
+ (-1602000, 'I am the greatest of my father\'s sons! Your end has come!', 14149,1,0,'bjarngrim SAY_AGGRO'),
+ (-1602001, 'So ends your curse!', 14153,1,0, 'bjarngrim SAY_SLAY_1'),
+ (-1602002, 'Flesh... is... weak!', 14154,1,0, 'bjarngrim SAY_SLAY_2'),
+ (-1602003, '...', 14155,1,0, 'bjarngrim SAY_SLAY_3'),
+ (-1602004, 'How can it be...? Flesh is not... stronger!', 14156,1,0, 'bjarngrim SAY_DEATH'),
+ (-1602005, 'Defend yourself, for all the good it will do!', 14151,1,0, 'bjarngrim SAY_BATTLE_STANCE'),
+ (-1602006, 'GRAAAAAH! Behold the fury of iron and steel!', 14152,1,0, 'bjarngrim SAY_BERSEKER_STANCE'),
+ (-1602007, 'Give me your worst!', 14150,1,0, 'bjarngrim SAY_DEFENSIVE_STANCE'),
+-- Ionar
+ (-1602008, 'You wish to confront the master? You must weather the storm!', 14453,1,0, 'ionar SAY_AGGRO'),
+ (-1602009, 'Shocking ... I know!', 14456,1,0, 'ionar SAY_SLAY_1'),
+ (-1602010, 'You atempt the unpossible.', 14457,1,0, 'ionar SAY_SLAY_2'),
+ (-1602011, 'Your spark of light is ... extinguish.', 14458,1,0, 'ionar SAY_SLAY_3'),
+ (-1602012, 'Master... you have guests.', 14459,1,0, 'ionar SAY_DEATH'),
+ (-1602013, 'The slightest spark shall be your undoing.', 14454,1,0, 'ionar SAY_SPLIT_1'),
+ (-1602014, 'No one is safe!', 14455,1,0, 'ionar SAY_SPLIT_2'),
+-- Loken
+ (-1602015, 'What hope is there for you? None!', 14162,1,0, 'loken SAY_AGGRO0'),
+ (-1602016, 'I have witnessed the rise and fall of empires. The birth and extinction of entire species. Over countless millennia the foolishness of mortals has remained beyond a constant. Your presence here confirms this.', 14160,1,0, 'loken SAY_INTRO_1'),
+ (-1602017, 'My master has shown me the future, and you have no place in it. Azeroth will be reborn in darkness. Yogg-Saron shall be released! The Pantheon shall fall!', 14162,1,0, 'loken SAY_INTRO_2'),
+ (-1602018, 'Only mortal...', 14166,1,0, 'loken SAY_SLAY_1'),
+ (-1602019, 'I... am... FOREVER!', 14167,1,0, 'loken SAY_SLAY_2'),
+ (-1602020, 'What little time you had, you wasted!', 14168,1,0, 'loken SAY_SLAY_3'),
+ (-1602021, 'My death... heralds the end of this world.', 14172,1,0, 'loken SAY_DEATH'),
+ (-1602022, 'You cannot hide from fate!', 14163,1,0, 'lokenSAY_NOVA_1'),
+ (-1602023, 'Come closer. I will make it quick.', 14164,1,0, 'loken SAY_NOVA_2'),
+ (-1602024, 'Your flesh cannot hold out for long.', 14165,1,0, 'loken SAY_NOVA_3'),
+ (-1602025, 'You stare blindly into the abyss!', 14169,1,0, 'loken SAY_75HEALTH'),
+ (-1602026, 'Your ignorance is profound. Can you not see where this path leads?', 14170,1,0, 'loken SAY_50HEALTH'),
+ (-1602027, 'You cross the precipice of oblivion!', 14171,1,0, 'loken SAY_25HEALTH'),
+-- Volkhan
+ (-1602028, 'It is you who have destroyed my children? You... shall... pay!',13960,1,0, 'volkhan SAY_AGGRO'),
+ (-1602029, 'The armies of iron will conquer all!',13965, 1,0,'volkhan SAY_SLAY_1'),
+ (-1602030, 'Ha, pathetic!',13966,1,0, 'volkhan SAY_SLAY_2'),
+ (-1602031, 'You have cost me too much work!',13967,1,0, 'volkhan SAY_SLAY_3'),
+ (-1602032, 'The master was right... to be concerned.',13968, 1,0,'volkhan SAY_DEATH'),
+ (-1602033, 'I will crush you beneath my boots!',13963, 1,0,'volkhan SAY_STOMP_1'),
+ (-1602034, 'All my work... undone!',13964, 1,0,'volkhan SAY_STOMP_2'),
+ (-1602035, 'Life from the lifelessness... death for you.',13961,1,0, 'volkhan SAY_FORGE_1'),
+ (-1602036, 'Nothing is wasted in the process. You will see....',13962, 1,0,'volkhan SAY_FORGE_2');
+
+-- -1 603 000 ULDUAR (RAID NIU)
+
+-- -1 604 000 GUNDRAK
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Gal'darah
+ (-1604000, 'I\'m gonna spil your guts, man!', 14430, 1,0,'gal_darah SAY_AGGRO'),
+ (-1604001, 'What a rush.', 14436,1,0, 'gal_darah SAY_SLAY_1'),
+ (-1604002, 'Who needs gods, when we ARE gods!', 14437, 1,0,'gal_darah SAY_SLAY_2'),
+ (-1604003, 'I told ya so ...', 14438,1,0, 'gal_darah SAY_SLAY_3'),
+ (-1604004, 'Even the mighty ... can .. fall.', 14439,1,0, 'gal_darah SAY_DEATH'),
+ (-1604005, 'God damn! Impale them!', 14433, 1,0,'gal_darah SAY_SUMMON_RHINO_1'),
+ (-1604006, 'Kill them ALL!', 14434, 1,0,'gal_darah SAY_SUMMON_RHINO_2'),
+ (-1604007, 'Say hello to my BIG friend.', 14435,1,0, 'gal_darah SAY_SUMMON_RHINO_3'),
+ (-1604008, 'Ain\'t gonna bee nothig left after this.', 14431,1,0, 'gal_darah SAY_TRANSFORM_1'),
+ (-1604009, 'You wanna see POWER? I\'m gonna show you POWER!', 14432,1,0, 'gal_darah SAY_TRANSFORM_2'),
+-- Moorabi
+ (-1604010, 'We fought back the Scourge. What chance you be thinking you got?', 14721,1,0, 'moorabi SAY_AGGRO'),
+ (-1604011, 'I crush you, cockroaches!', 14725,1,0, 'moorabi SAY_SLAY_1'),
+ (-1604012, 'Who gonna stop me, you?', 14726,1,0, 'moorabi SAY_SLAY_2'),
+ (-1604013, 'Not so tough now.', 14727,1,0, 'moorabi SAY_SLAY_3'),
+ (-1604014, 'If our gods can die, then so can we.', 14728,1,0, 'moorabi SAY_DEATH'),
+ (-1604015, 'Get ready for something much bigger!', 14722,1,0, 'moorabi SAY_TRANSFORM'),
+ (-1604016, 'The ground will swallow you up!', 14723,1,0, 'moorabi SAY_QUAKE'),
+-- Slad'ran
+ (-1604017, 'Drak\'thari gonna kill anybody who trespass on this lands.', 14443,1,0, 'slad_ran SAY_AGGRO'),
+ (-1604018, 'Can not breath then, good ...', 14446,1,0, 'slad_ran SAY_SLAY_1'),
+ (-1604019, 'You\'re scared now.', 14447,1,0, 'slad_ran SAY_SLAY_2'),
+ (-1604020, 'I eat you next man!', 14448,1,0, 'slad_ran SAY_SLAY_3'),
+ (-1604021, 'I ... see now. Scourge was not tha greatest enemy.', 14449,1,0, 'slad_ran SAY_DEATH'),
+ (-1604022, 'Minions of this ... heed my call.', 14444,1,0, 'slad_ran SAY_SUMMON_SNAKES'),
+ (-1604023, 'A thousand fangs gonna rim yar flesh.', 14445,1,0, 'slad_ran SAY_SUMMON_CONSTRICTORS');
+
+-- -1 608 000 VIOLET HOLD
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Cyanigosa
+ (-1608000, 'We finish this now, champions of Kirin Tor!', 13947, 1, 0, 'cyanigosa SAY_AGGRO'),
+ (-1608001, 'I will end the Kirin Tor!', 13952, 1, 0, 'cyanigosa SAY_SLAY_1'),
+ (-1608002, 'Dalaran will fall!', 13953, 1, 0, 'cyanigosa SAY_SLAY_2'),
+ (-1608003, 'So ends your defiance of the Spell-Weaver!', 13954, 1, 0, 'cyanigosa SAY_SLAY_3'),
+ (-1608004, 'Perhaps... we have... underestimated... you.', 13955, 1, 0, 'cyanigosa SAY_DEATH'),
+ (-1608005, 'A valiant defense, but this city must be razed. I will fulfill Malygos\'s wishes myself!', 13946, 1, 0, 'cyanigosa SAY_SPAWN'),
+ (-1608006, 'Am I interrupting?', 13951, 1, 0, 'cyanigosa SAY_DISRUPTION'),
+ (-1608007, 'Shiver and die!', 13948, 1, 0, 'cyanigosa SAY_BREATH_ATTACK'),
+ (-1608008, 'The world has forgotten what true magic is! Let this be a reminder!', 13949, 1, 0, 'cyanigosa SAY_SPECIAL_ATTACK_1'),
+ (-1608009, 'Who among you can withstand my power?', 13950, 1, 0, 'cyanigosa SAY_SPECIAL_ATTACK_2'),
+-- Erekem
+ (-1608010, 'Notcawwget in way ofrrak-rrakflee!', 14219, 1, 0, 'erekem SAY_AGGRO'),
+ (-1608011, '...', 14222, 1, 0, 'erekem SAY_SLAY_1'),
+ (-1608012, 'Precious life ... wasted.', 14223, 1, 0, 'erekem SAY_SLAY_2'),
+ (-1608013, 'Only strong ... survive.', 14224, 1, 0, 'erekem SAY_SLAY_3'),
+ (-1608014, 'Nokaw, kawflee...', 14225, 1, 0, 'erekem SAY_DEATH'),
+ (-1608015, 'Free tommfly onw. Ra-aak... Not find usekh-ekh! Escape!', 14218, 1, 0, 'erekem SAY_SPAWN'),
+ (-1608016, 'My-raaakfavorite! Awk awk awk! Raa-kaa!', 14220, 1, 0, 'erekem SAY_ADD_KILLED'),
+ (-1608017, 'Nasty little...A-ak, kaw! Kill! Yes, kill you!', 14221, 1, 0, 'erekem SAY_BOTH_ADDS_KILLED'),
+-- Ichoron
+ (-1608018, 'Stand aside, mortals!', 14230, 1, 0, 'ichoron SAY_AGGRO'),
+ (-1608019, 'I am a force of nature!', 14234, 1, 0, 'ichoron SAY_SLAY_1'),
+ (-1608020, 'I shall pass!', 14235, 1, 0, 'ichoron SAY_SLAY_2'),
+ (-1608021, 'You can not stop the tide!', 14236, 1, 0, 'ichoron SAY_SLAY_3'),
+ (-1608022, 'I... recede.', 14237, 1, 0, 'ichoron SAY_DEATH'),
+ (-1608023, 'I... am fury... unrestrained!', 14239, 1, 0, 'ichoron SAY_SPAWN'),
+ (-1608024, 'I shall consume, decimate, devastate, and destroy! Yield now to the wrath of the pounding sea!', 14231, 1, 0, 'ichoron SAY_ENRAGE'),
+ (-1608025, 'I will not be contained! Ngyah!!', 14233, 1, 0, 'ichoron SAY_SHATTER'),
+ (-1608026, 'Water can hold any form, take any shape... overcome any obstacle.', 14232, 1, 0, 'ichoron SAY_BUBBLE'),
+-- Xevozz
+ (-1608027, 'It seems my freedom must be bought with blood...', 14499, 1, 0, 'xevozz SAY_AGGRO'),
+ (-1608028, 'Nothing personal.', 14504, 1, 0, 'xevozz SAY_SLAY_1'),
+ (-1608029, 'Business concluded.', 14505, 1, 0, 'xevozz SAY_SLAY_2'),
+ (-1608030, 'Profit!', 14506, 1, 0, 'xevozz SAY_SLAY_3'),
+ (-1608031, 'This is an... unrecoverable... loss.', 14507, 1, 0, 'xevozz SAY_DEATH'),
+ (-1608032, 'Back in business! Now to execute an exit strategy.', 14498, 1, 0, 'xevozz SAY_SPAWNED'),
+ (-1608033, 'It would seem that a renegotiation is in order.', 14503, 1, 0, 'xevozz SAY_CHARGED'),
+ (-1608034, 'The air teems with latent energy... quite the harvest!', 14501, 1, 0, 'xevozz SAY_REPEAT_SUMMON_1'),
+ (-1608035, 'Plentiful, exploitable resources... primed for acquisition!', 14502, 1, 0, 'xevozz SAY_REPEAT_SUMMON_2'),
+ (-1608036, 'Intriguing... a high quantity of arcane energy is near. Time for some prospecting...', 14500, 1, 0, 'xevozz SAY_SUMMON_ENERGY'),
+-- Zuramat
+ (-1608037, 'Eradicate.', 13996, 1, 0, 'zuramat SAY_AGGRO'),
+ (-1608038, 'More... energy.', 13999, 1, 0, 'zuramat SAY_SLAY_1'),
+ (-1608039, 'Relinquish.', 14000, 1, 0, 'zuramat SAY_SLAY_2'),
+ (-1608040, 'Fall... to shadow.', 14001, 1, 0, 'zuramat SAY_SLAY_3'),
+ (-1608041, 'Disperse.', 14002, 1, 0, 'zuramat SAY_DEATH'),
+ (-1608042, 'I am... renewed.', 13995, 1, 0, 'zuramat SAY_SPAWN'),
+ (-1608043, 'Know... my... pain.', 13997, 1, 0, 'zuramat SAY_SHIELD'),
+ (-1608044, 'Gaze... into the void.', 13998, 1, 0, 'zuramat SAY_WHISPER');
+
+-- -1 615 000 OBSIDIAN SANCTUM
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Shadron
+ (-1615000, 'I fear nothing! Least of all you!', 14111,1,0, 'shadron SAY_SHADRON_AGGRO'),
+ (-1615001, 'You are insignificant!', 14112,1,0, 'shadron SAY_SHADRON_SLAY_1'),
+ (-1615002, 'Such mediocre resistance!', 14113,1,0, 'shadron SAY_SHADRON_SLAY_2'),
+ (-1615003, 'We...are superior! How could this...be...', 14118, 1,0,'shadron SAY_SHADRON_DEATH'),
+ (-1615004, 'You are easily bested! ', 14114,1,0, 'shadron SAY_SHADRON_BREATH'),
+ (-1615005, 'I will take pity on you Sartharion, just this once.', 14117, 1,0,'shadron SAY_SHADRON_RESPOND'),
+ (-1615006, 'Father tought me well!', 14115,1,0, 'shadron SAY_SHADRON_SPECIAL_1'),
+ (-1615007, 'On your knees!', 14116,1,0, 'shadron SAY_SHADRON_SPECIAL_2'),
+-- Tenebron
+ (-1615008, 'You have no place here. Your place is among the departed.', 14122,1,0, 'tenebron SAY_TENEBRON_AGGRO'),
+ (-1615009, 'No contest.', 14123,1,0, 'tenebron SAY_TENEBRON_SLAY_1'),
+ (-1615010, 'Typical... Just as I was having fun.', 14124,1,0, 'tenebron SAY_TENEBRON_SLAY_2'),
+ (-1615011, 'I should not... have held back...', 14129,1,0, 'tenebron SAY_TENEBRON_DEATH'),
+ (-1615012, 'To darkness I condemn you...', 14125,1,0, 'tenebron SAY_TENEBRON_BREATH'),
+ (-1615013, 'It is amusing to watch you struggle. Very well, witness how it is done.', 14128, 1,0,'tenebron SAY_TENEBRON_RESPOND'),
+ (-1615014, 'Arrogant little creatures! To challenge powers you do not yet understand...', 14126,1,0, 'tenebron SAY_TENEBRON_SPECIAL_1'),
+ (-1615015, 'I am no mere dragon! You will find I am much, much, more...', 14127, 1,0,'tenebron SAY_TENEBRON_SPECIAL_2'),
+-- Sartharion
+ (-1615016, 'It is my charge to watch over these eggs. I will see you burn before any harm comes to them!', 14093,1,0, 'sartharion SAY_SARTHARION_AGGRO'),
+ (-1615017, 'This pathetic siege ends NOW!', 14103,1,0, 'sartharion SAY_SARTHARION_BERSERK'),
+ (-1615018, 'Burn, you miserable wretches!', 14098, 1,0,'sartharion SAY_SARTHARION_BREATH'),
+ (-1615019, 'Shadron! Come to me, all is at risk!', 14105,1,0, 'sartharion SARTHARION_CALL_SHADRON'),
+ (-1615020, 'Tenebron! The eggs are yours to protect as well!', 14106,1,0, 'sartharion SAY_SARTHARION_CALL_TENEBRON'),
+ (-1615021, 'Vesperon! The clutch is in danger! Assist me!', 14104,1,0, 'sartharion SAY_SARTHARION_CALL_VESPERON'),
+ (-1615022, 'Such is the price... of failure...', 14107,1,0, 'sartharion SAY_SARTHARION_DEATH'),
+ (-1615023, 'Such flammable little insects....', 14099,1,0, 'sartharion SAY_SARTHARION_SPECIAL_1'),
+ (-1615024, 'Your charred bones will litter the floor!', 14100,1,0, 'sartharion SAY_SARTHARION_SPECIAL_2'),
+ (-1615025, 'How much heat can you take?', 14101,1,0, 'sartharion SAY_SARTHARION_SPECIAL_3'),
+ (-1615026, 'All will be reduced to ash!', 14102,1,0, 'sartharion SAY_SARTHARION_SPECIAL_4'),
+ (-1615027, 'You will make a fine meal for the hatchlings.', 14094,1,0, 'sartharion SAY_SARTHARION_SLAY_1'),
+ (-1615028, 'You are the grave disadvantage.', 14096,1,0, 'sartharion SAY_SARTHARION_SLAY_2'),
+ (-1615029, 'This is why we call you lesser beeings.', 14097,1,0, 'sartharion SAY_SARTHARION_SLAY_3'),
+-- Vesperon
+ (-1615030, 'You pose no threat, lesser beings...give me your worst!', 14133, 1,0,'vesperon SAY_VESPERON_AGGRO'),
+ (-1615031, 'The least you could do is put up a fight...', 14134,1,0, 'vesperon SAY_VESPERON_SLAY_1'),
+ (-1615032, 'Was that the best you can do?', 14135,1,0, 'vesperon SAY_VESPERON_SLAY_2'),
+ (-1615033, 'I still have some...fight..in...me...', 14140, 1,0,'vesperon SAY_VESPERON_DEATH'),
+ (-1615034, 'I will pick my teeth with your bones!', 14136,1,0, 'vesperon SAY_VESPERON_BREATH'),
+ (-1615035, 'Father was right about you, Sartharion...You are a weakling!', 14139,1,0, 'vesperon SAY_VESPERON_RESPOND'),
+ (-1615036, 'Aren\'t you tricky...I have a few tricks of my own...', 14137,1,0, 'vesperon SAY_VESPERON_SPECIAL_1'),
+ (-1615037, 'Unlike, I have many talents.', 14138,1,0, 'vesperon SAY_VESPERON_SPECIAL_2');
+
+-- -1 616 000 EYE OF ETERNITY
+INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Malygos
+ (-1616000, 'I will teach you IGNORANT children just how little you know of magic...', 14524,1,0, 'malygos SAY_ANTI_MAGIC_SHELL'),
+ (-1616001, 'YOU WILL NOT SUCCEED WHILE I DRAW BREATH!', 14518,1,0, 'malygos SAY_BREATH_ATTACK'),
+ (-1616002, 'I AM UNSTOPPABLE!', 14533,1,0, 'malygos SAY_HIGH_DAMAGE_MODE'),
+ (-1616003, 'Watch helplessly as your hopes are swept away...', 14525, 1,0,'malygos SAY_MAGIC_BLAST'),
+ (-1616004, 'Still standing? Not for long...', 14537, 1,0,'malygos SAY_GENERIC_SPELL_1'),
+ (-1616005, 'Your cause is lost!', 14538, 1,0,'malygos SAY_GENERIC_SPELL_2'),
+ (-1616006, 'Your fragile mind will be shattered! ', 14539,1,0, 'malygos SAY_GENERIC_SPELL_3'),
+ (-1616007, 'UNTHINKABLE! The mortals will destroy...e-everything...my sister...what have you-', 14540,1,0, 'malygos SAY_DEATH'),
+ (-1616008, 'Lesser beings, intruding here! A shame that your excess courage does not compensate for your stupidity!', 14512,1,0, 'malygos SAY_PREFIGHT_1'),
+ (-1616009, 'None but the blue dragonflight are welcome here! Perhaps this is the work of Alexstrasza? Well then, she has sent you to your deaths.', 14513,1,0, 'malygos SAY_PREFIGHT_2'),
+ (-1616010, 'What could you hope to accomplish, to storm brassily into my domain? To employ MAGIC? Against ME? *Laughs*', 14514,1,0, 'malygos SAY_PREFIGHT_3'),
+ (-1616011, 'I am without limits here...the rules of your cherished reality do not apply...In this realm, I am in control...', 14515, 1,0,'malygos SAY_PREFIGHT_4'),
+ (-1616012, 'I give you one chance. Pledge loyalty to me, and perhaps I won\'t slaughter you for your insolence!', 14516,1,0, 'malygos SAY_PREFIGHT_5'),
+ (-1616013, 'My patience has reached its limit, I WILL BE RID OF YOU!', 14517,1,0, 'malygos SAY_PHASE1_AGGRO'),
+ (-1616014, 'I had hoped to end your lives quickly, but you have proven more...resilient then I had anticipated. None the less, your efforts are in vain, it is you reckless, careless mortals who are to blame for this war! I do what I must...And if it means your...extinction...THEN SO BE IT!', 14522,1,0, 'malygos SAY_PHASE1_END'),
+ (-1616015, 'Your stupidity has finally caught up to you!', 14519,1,0, 'malygos SAY_PHASE1_SLAY_1'),
+ (-1616016, 'More artifacts to confiscate...', 14520, 1,0,'malygos SAY_PHASE1_SLAY_2'),
+ (-1616017, '*Laughs* How very...naive.. ', 14521,1,0, 'malygos SAY_PHASE1_SLAY_3'),
+ (-1616018, 'Few have experienced the pain I will now inflict on you!', 14523, 1,0,'malygos SAY_PHASE2_AGGRO'),
+ (-1616019, 'ENOUGH! If you intend to reclaim Azeroth\'s magic, then you shall have it... ', 14529,1,0, 'malygos SAY_PHASE2_END'),
+ (-1616020, 'Your energy will be put to good use!', 14526,1,0, 'malygos SAY_PHASE2_SLAY_1'),
+ (-1616021, 'I AM THE SPELL WEAVER! My power is INFINITE!', 14527, 1,0,'malygos SAY_PHASE2_SLAY_2'),
+ (-1616022, 'Your spirit will linger here forever!', 14528, 1,0,'malygos SAY_PHASE2_SLAY_3'),
+ (-1616023, 'Now your benefactors make their appearance...But they are too late. The powers contained here are powerful enough to destroy the world ten times over! What do you think they will do to you?', 14530,1,0, 'malygos SAY_PHASE3_INTRO'),
+ (-1616024, 'SUBMIT!', 14531,1,0, 'malygos SAY_PHASE3_AGGRO'),
+ (-1616025, 'Alexstrasza! Another of your brood falls!', 14534,1,0, 'malygos SAY_PHASE3_SLAY_1'),
+ (-1616026, 'Little more then gnats!', 14535, 1,0,'malygos SAY_PHASE3_SLAY_2'),
+ (-1616027, 'Your red allies will share your fate...', 14536, 1,0,'slad_ran SAY_PHASE3_SLAY_3'),
+ (-1616028, 'The powers at work here exceed anything you could possibly imagine!', 14532, 1,0,'malygos SAY_PHASE3_BIG_ATTACK');
+
+-- -1 619 000 AHN'KAHET
+ INSERT INTO `script_texts` (`entry`,`content_default`,`sound`,`type`,`language`,`comment`) VALUES
+-- Jedoga Shadowseeker
+ (-1619000, 'These are sacred halls, your intrusion will be met with death', 14343, 1, 0, 'jedoga SAY_AGGRO'),
+ (-1619001, 'Who among you is devoted', 14344, 1, 0, 'jedoga SAY_C_SACRIFICE_1'),
+ (-1619002, 'You there! Step foward', 14345, 1, 0, 'jedoga SAY_C_SACRIFICE_2'),
+ (-1619003, 'Yogg-Saron, grant me your power!', 14346, 1, 0, 'jedoga SAY_SACRIFICE_1'),
+ (-1619004, 'Master, a gift for you!', 14347, 1, 0, 'jedoga SAY_SACRIFICE_2'),
+ (-1619005, 'Glory to the Yogg-Saron!', 14348, 1, 0, 'jedoga SAY_SLAY_1'),
+ (-1619006, 'You are unworthy', 14349, 1, 0, 'jedoga SAY_SLAY_2'),
+ (-1619007, 'Get up! You haven\'t suffered enough', 14350, 1, 0, 'jedoga SAY_SLAY_3'),
+ (-1619008, 'Do not expect your sacrilege... to go unpunished.', 14351, 1, 0, 'jedoga SAY_DEATH'),
+ (-1619009, 'The elements themselves will rise up against the civilized world! Only the faithful will be spared!', 14352, 1, 0, 'jedoga SAY_PREACHING_1'),
+ (-1619010, 'Immortality can be yours. But only if you pledge yourself fully to Yogg-Saron!', 14353, 1, 0, 'jedoga SAY_PREACHING_2'),
+ (-1619011, 'Here on the very borders of his domain. You will expirience powers you would never have imagined!', 14354, 1, 0, 'jedoga SAY_PREACHING_3'),
+ (-1619012, 'You have traveled long and risked much to be here. Your devotion shall be rewarded.', 14355, 1, 0, 'jedoga SAY_PREACHING_4'),
+ (-1619013, 'The faithful shall be exalted! But there is more work to be done. We will press on until all of Azeroth lies beneath his shadow!', 14356, 1, 0, 'jedoga SAY_PREACHING_5'),
+-- Elder Nadox
+ (-1619014, 'The secrets of the deep shall remain hidden.', 14033, 1, 0, 'nadox SAY_AGGRO'),
+ (-1619015, 'Sleep now, in the cold dark.', 14036, 1, 0, 'nadox SAY_SLAY_1'),
+ (-1619016, 'For the Lich King!', 14307, 1, 0, 'nadox SAY_SLAY_2'),
+ (-1619017, 'Perhaps we will be allies soon.', 14038, 1, 0, 'nadox SAY_SLAY_3'),
+ (-1619018, 'Master, is my service complete?', 14039, 1, 0, 'nadox SAY_DEATH'),
+ (-1619019, 'The young must not grow hungry.', 14034, 1, 0, 'nadox SAY_EGG_SAC_1'),
+ (-1619020, 'Shad\'ak kerish\'akak', 14035, 1, 0, 'nadox SAY_EGG_SAC_2'),
+-- Prince Taldaram
+ (-1619021, 'I will feast on your remains.', 14360, 1, 0, 'taldaram SAY_AGGRO'),
+ (-1619022, '(Elfish)', 14365, 1, 0, 'taldaram SAY_SLAY_1'),
+ (-1619023, 'I will drink no blood before it is time.', 14366, 1, 0, 'taldaram SAY_SLAY_2'),
+ (-1619024, 'One final embrace.', 14367, 1, 0, 'taldaram SAY_SLAY_3'),
+ (-1619025, 'Still ... I hunger, still ... I thirst...', 14368, 1, 0, 'taldaram SAY_DEATH'),
+ (-1619026, 'Your heartbeat is music to my ears.', 14361, 1, 0, 'taldaram SAY_VANISH_1'),
+ (-1619027, 'I am nowhere. I am everywhere. I am the watcher, unseen.', 14362, 1, 0, 'taldaram SAY_VANISH_2'),
+ (-1619028, 'So appetizing.', 14363, 1, 0, 'taldaram SAY_FEED_1'),
+ (-1619029, 'Fresh, warm blood. It has been too long.', 14364, 1, 0, 'taldaram SAY_FEED_2'),
+-- Herald Volazj
+ (-1619030, '??? ??? ???', 14043, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619031, 'Ywaq ma phgwa\\\'cul hnakf. - They are the whisper on the shivering wind.', 14045, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619032, '?!? !?! ?!?', 14046, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619033, '!?! !?! !?!', 14047, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619034, 'Iilth vwah, uhn\'agth fhssh za. - Where one falls, many shall take its place.', 14048, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619035, '... ...! ...?', 14049, 1, 0, 'volazj SAY_AGGRO'),
+ (-1619036, 'Phasing', 14044, 1, 0, 'volazj SAY_AGGRO');
diff --git a/src/bindings/scripts/sql/WotLK/wotlk_bosses.sql b/src/bindings/scripts/sql/WotLK/wotlk_bosses.sql
new file mode 100644
index 00000000000..f8d10a64cf3
--- /dev/null
+++ b/src/bindings/scripts/sql/WotLK/wotlk_bosses.sql
@@ -0,0 +1,124 @@
+/* */
+/* AZJOL-NERUB */
+/* */
+
+/* AHN'KAHET */
+UPDATE `instance_template` SET `script`='instance_ahn_kahet' WHERE `map`=4494;
+UPDATE `creature_template` SET `ScriptName`='boss_jedoga' WHERE `entry`='29310';
+UPDATE `creature_template` SET `ScriptName`='boss_nadox' WHERE `entry`='29309';
+UPDATE `creature_template` SET `ScriptName`='boss_taldaram' WHERE `entry`='29308';
+UPDATE `creature_template` SET `ScriptName`='boss_volazj' WHERE `entry`='29311';
+
+/* AZJOL-NERUB */
+UPDATE `instance_template` SET `script`='instance_azjol_nerub' WHERE `map`=3477;
+UPDATE `creature_template` SET `ScriptName`='boss_anub_arak' WHERE `entry`='29120';
+UPDATE `creature_template` SET `ScriptName`='boss_hardronox' WHERE `entry`='28921';
+UPDATE `creature_template` SET `ScriptName`='boss_krik_thir' WHERE `entry`='28684';
+
+/* THE CULLING OF STRATHOLME */
+UPDATE `instance_template` SET `script`='instance_culling_of_stratholme' WHERE `map`=4100;
+UPDATE `creature_template` SET `ScriptName`='boss_epoch' WHERE `entry`='26532';
+UPDATE `creature_template` SET `ScriptName`='boss_mal_ganis' WHERE `entry`='26533';
+UPDATE `creature_template` SET `ScriptName`='boss_meathook' WHERE `entry`='26529';
+UPDATE `creature_template` SET `ScriptName`='boss_salramm' WHERE `entry`='26530';
+
+/* DRAK'THARON KEEP */
+UPDATE `instance_template` SET `script`='instance_drak_tharon' WHERE `map`=4196;
+UPDATE `creature_template` SET `ScriptName`='boss_dred' WHERE `entry`='27483';
+UPDATE `creature_template` SET `ScriptName`='boss_novos' WHERE `entry`='26631';
+UPDATE `creature_template` SET `ScriptName`='boss_tharon_ja' WHERE `entry`='26632';
+UPDATE `creature_template` SET `ScriptName`='boss_trollgore' WHERE `entry`='26630';
+
+/* GUNDRAK */
+UPDATE `instance_template` SET `script`='instance_gundrak' WHERE `map` =4375;
+UPDATE `creature_template` SET `ScriptName`='boss_eck' WHERE `entry`='29932';
+UPDATE `creature_template` SET `ScriptName`='boss_drakkari_colossus' WHERE `entry`='29307';
+UPDATE `creature_template` SET `ScriptName`='boss_gal_darah' WHERE `entry`='29306';
+UPDATE `creature_template` SET `ScriptName`='boss_moorabi' WHERE `entry`='29305';
+UPDATE `creature_template` SET `ScriptName`='boss_slad_ran' WHERE `entry`='29304';
+
+/* */
+/* THE NEXUS */
+/* */
+
+/* EYE OF ETERNITY */
+UPDATE `instance_template` SET `script`='instance_eye_of_eternity' WHERE `map`=4500;
+UPDATE `creature_template` SET `ScriptName`='boss_malygos' WHERE `entry`='28859';
+
+/* NEXUS */
+UPDATE `instance_template` SET `script`='instance_nexus' WHERE `map`=4120;
+UPDATE `creature_template` SET `ScriptName`='boss_anomalus' WHERE `entry`='26763';
+UPDATE `creature_template` SET `ScriptName`='npc_chaotic_rift' WHERE `entry`='26918';
+UPDATE `creature_template` SET `ScriptName`='mob_crazed_mana_wraith' WHERE `entry`='26746';
+UPDATE `creature_template` SET `ScriptName`='boss_keristrasza' WHERE `entry`='26723';
+UPDATE `creature_template` SET `ScriptName`='boss_magus_telestra' WHERE `entry`='26731';
+UPDATE `creature_template` SET `ScriptName`='boss_ormorok' WHERE `entry`='26794';
+UPDATE `creature_template` SET `ScriptName`='boss_commander_stoutbeard' WHERE `entry`='26796';
+UPDATE `creature_template` SET `ScriptName`='boss_commander_kolurg' WHERE `entry`='26798';
+
+/* OCULUS */
+UPDATE `instance_template` SET `script`='instance_oculus' WHERE `map`=4228;
+UPDATE `creature_template` SET `ScriptName`='boss_drakos' WHERE `entry`='27654';
+UPDATE `creature_template` SET `ScriptName`='boss_eregos' WHERE `entry`='27656';
+UPDATE `creature_template` SET `ScriptName`='boss_urom' WHERE `entry`='27655';
+UPDATE `creature_template` SET `ScriptName`='boss_varos' WHERE `entry`='27447';
+
+/* OBSIDIAN SANCTUM */
+UPDATE `instance_template` SET `script`='instance_obsidian_sanctum' WHERE `map`=4493;
+UPDATE `creature_template` SET `ScriptName`='boss_sartharion' WHERE `entry`='28860';
+UPDATE `creature_template` SET `ScriptName`='mob_vesperon' WHERE `entry`='30449';
+UPDATE `creature_template` SET `ScriptName`='mob_shadron' WHERE `entry`='30451';
+UPDATE `creature_template` SET `ScriptName`='mob_tenebron' WHERE `entry`='30452';
+UPDATE `creature_template` SET `ScriptName`='mob_whelp' WHERE `entry`='30890';
+UPDATE `creature_template` SET `ScriptName`='mob_whelp' WHERE `entry`='31214';
+
+/* */
+/* ULDUAR */
+/* */
+
+/* HALLS OF LIGHTNING */
+UPDATE `instance_template` SET `script`='instance_halls_of_lightning' WHERE `map`=4272;
+UPDATE `creature_template` SET `ScriptName`='boss_bjarngrim' WHERE `entry`='28586';
+UPDATE `creature_template` SET `ScriptName`='boss_ionar' WHERE `entry`='28546';
+UPDATE `creature_template` SET `ScriptName`='spark_of_ionar' WHERE `entry`='28962';
+UPDATE `creature_template` SET `ScriptName`='boss_volkhan' WHERE `entry`='28587';
+UPDATE `creature_template` SET `ScriptName`='mob_molten_golem' WHERE `entry`='28695';
+UPDATE `creature_template` SET `ScriptName`='boss_loken' WHERE `entry`='28923';
+/* HALLS OF STONE */
+UPDATE `instance_template` SET `script`='instance_halls_of_stone' WHERE `map`=4264;
+UPDATE `creature_template` SET `ScriptName`='boss_krystallus' WHERE `entry`='27977';
+UPDATE `creature_template` SET `ScriptName`='boss_maiden_of_grief' WHERE `entry`='27975';
+UPDATE `creature_template` SET `ScriptName`='boss_sjonnir' WHERE `entry`='27978';
+
+/* */
+/* UTGARDE KEEP */
+/* */
+
+/* UTGARDE KEEP */
+UPDATE `instance_template` SET `script`='instance_keep' WHERE `map`=206;
+UPDATE `creature_template` SET `ScriptName`='boss_dalronn' WHERE `entry`='24201';
+UPDATE `creature_template` SET `ScriptName`='boss_ingvar' WHERE `entry`='23954';
+UPDATE `creature_template` SET `ScriptName`='boss_keleseth' WHERE `entry`='23953';
+UPDATE `creature_template` SET `ScriptName`='boss_skarvald' WHERE `entry`='24200';
+
+/* UTGARDE PINNACLE */
+UPDATE `instance_template` SET `script`='instance_pinnacle' WHERE `map`=1196;
+UPDATE `creature_template` SET `ScriptName`='boss_palehoof' WHERE `entry`='26687';
+UPDATE `creature_template` SET `ScriptName`='boss_skadi' WHERE `entry`='26693';
+UPDATE `creature_template` SET `ScriptName`='boss_svala' WHERE `entry`='26668';
+UPDATE `creature_template` SET `ScriptName`='boss_ymiron' WHERE `entry`='26861';
+
+/* VAULT OF ARCHAVON */
+UPDATE `instance_template` SET `script`='instance_archavon' WHERE `map`=4603;
+UPDATE `creature_template` SET `ScriptName`='boss_archavon' WHERE `entry`='31125';
+UPDATE `creature_template` SET `ScriptName`='mob_archavon_warder' WHERE `entry`='32353';
+
+/* VIOLET HOLD */
+UPDATE `instance_template` SET `script`='instance_violet_hold' WHERE `map`=4415;
+UPDATE `creature_template` SET `ScriptName`='boss_cyanigosa' WHERE `entry`='31134';
+UPDATE `creature_template` SET `ScriptName`='boss_erekem' WHERE `entry`='29315';
+UPDATE `creature_template` SET `ScriptName`='boss_ichoron' WHERE `entry`='29313';
+UPDATE `creature_template` SET `ScriptName`='boss_lavanthor' WHERE `entry`='29312';
+UPDATE `creature_template` SET `ScriptName`='boss_moragg' WHERE `entry`='29316';
+UPDATE `creature_template` SET `ScriptName`='boss_xevozz' WHERE `entry`='29266';
+UPDATE `creature_template` SET `ScriptName`='boss_zuramat' WHERE `entry`='29314';
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index da192844a70..26df402e5aa 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -37,56 +37,6 @@
INSTANTIATE_SINGLETON_1(AchievementGlobalMgr);
-const CriteriaCastSpellRequirement AchievementGlobalMgr::m_criteriaCastSpellRequirements[CRITERIA_CAST_SPELL_REQ_COUNT] =
- {
- {5272, 3057, 0, 0},
- {5273, 2784, 0, 0},
- {5752, 9099, 0, 0},
- {5753, 8403, 0, 0},
- {5772, 0, 0, RACE_GNOME},
- {5774, 0, 0, RACE_BLOODELF},
- {5775, 0, 0, RACE_DRAENEI},
- {5776, 0, 0, RACE_DWARF},
- {5777, 0, 0, RACE_HUMAN},
- {5778, 0, 0, RACE_NIGHTELF},
- {5779, 0, 0, RACE_ORC},
- {5780, 0, 0, RACE_TAUREN},
- {5781, 0, 0, RACE_TROLL},
- {5782, 0, 0, RACE_UNDEAD_PLAYER},
- {6225, 5661, 0, 0},
- {6226, 26044, 0, 0},
- {6228, 739, 0, 0},
- {6229, 927, 0, 0},
- {6230, 1444, 0, 0},
- {6231, 8140, 0, 0},
- {6232, 5489, 0, 0},
- {6233,12336, 0, 0},
- {6234, 1351, 0, 0},
- {6235, 5484, 0, 0},
- {6236, 1182, 0, 0},
- {6237, 0, CLASS_DEATH_KNIGHT, RACE_ORC},
- {6238, 0, CLASS_WARRIOR, RACE_HUMAN},
- {6239, 0, CLASS_SHAMAN, RACE_TAUREN},
- {6240, 0, CLASS_DRUID, RACE_NIGHTELF},
- {6241, 0, CLASS_ROGUE, RACE_UNDEAD_PLAYER},
- {6242, 0, CLASS_HUNTER, RACE_TROLL},
- {6243, 0, CLASS_MAGE, RACE_GNOME},
- {6244, 0, CLASS_PALADIN, RACE_DWARF},
- {6245, 0, CLASS_WARLOCK, RACE_BLOODELF},
- {6246, 0, CLASS_PRIEST, RACE_DRAENEI},
- {6312, 0, CLASS_WARLOCK, RACE_GNOME},
- {6313, 0, CLASS_DEATH_KNIGHT, RACE_HUMAN},
- {6314, 0, CLASS_PRIEST, RACE_NIGHTELF},
- {6315, 0, CLASS_SHAMAN, RACE_ORC},
- {6316, 0, CLASS_DRUID, RACE_TAUREN},
- {6317, 0, CLASS_ROGUE, RACE_TROLL},
- {6318, 0, CLASS_WARRIOR, RACE_UNDEAD_PLAYER},
- {6319, 0, CLASS_MAGE, RACE_BLOODELF},
- {6320, 0, CLASS_PALADIN, RACE_DRAENEI},
- {6321, 0, CLASS_HUNTER, RACE_DWARF},
- {6662, 31261, 0, 0}
- };
-
namespace MaNGOS
{
class AchievementChatBuilder
@@ -117,6 +67,156 @@ namespace MaNGOS
};
} // namespace MaNGOS
+
+bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
+{
+ if(dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` for criteria (Entry: %u) have wrong data type (%u), ignore.", criteria->ID,dataType);
+ return false;
+ }
+
+ switch(criteria->requiredType)
+ {
+ case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
+ case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
+ break;
+ default:
+ sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType);
+ return false;
+ }
+
+ switch(dataType)
+ {
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
+ if(!creature.id || !objmgr.GetCreatureTemplate(creature.id))
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.",
+ criteria->ID, criteria->requiredType,dataType,creature.id);
+ return false;
+ }
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
+ if(!classRace.class_id && !classRace.race_id)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE (%u) must have not 0 in one from value fields, ignore.",
+ criteria->ID, criteria->requiredType,dataType);
+ return false;
+ }
+ if(classRace.class_id && ((1 << (classRace.class_id-1)) & CLASSMASK_ALL_PLAYABLE)==0)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed class in value1 (%u), ignore.",
+ criteria->ID, criteria->requiredType,dataType,classRace.class_id);
+ return false;
+ }
+ if(classRace.race_id && ((1 << (classRace.race_id-1)) & RACEMASK_ALL_PLAYABLE)==0)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed race in value2 (%u), ignore.",
+ criteria->ID, criteria->requiredType,dataType,classRace.race_id);
+ return false;
+ }
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
+ if(health.percent < 1 || health.percent > 100)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) have wrong percent value in value1 (%u), ignore.",
+ criteria->ID, criteria->requiredType,dataType,health.percent);
+ return false;
+ }
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
+ {
+ SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id);
+ if(!spellEntry)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell id in value1 (%u), ignore.",
+ criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id);
+ return false;
+ }
+ if(aura.effect_idx >= 3)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell effect index in value2 (%u), ignore.",
+ criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.effect_idx);
+ return false;
+ }
+ if(!spellEntry->EffectApplyAuraName[aura.effect_idx])
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have non-aura spell effect (ID: %u Effect: %u), ignore.",
+ criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id,aura.effect_idx);
+ return false;
+ }
+ return true;
+ }
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
+ if(!GetAreaEntryByAreaID(area.id))
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) have wrong area id in value1 (%u), ignore.",
+ criteria->ID, criteria->requiredType,dataType,area.id);
+ return false;
+ }
+ return true;
+ default:
+ sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType);
+ return false;
+ }
+ return false;
+}
+
+bool AchievementCriteriaData::Meets(Player const* source, Unit const* target) const
+{
+ switch(dataType)
+ {
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
+ if (!target || target->GetTypeId()!=TYPEID_UNIT)
+ return false;
+ if (target->GetEntry() != creature.id)
+ return false;
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
+ if (!target || target->GetTypeId()!=TYPEID_PLAYER)
+ return false;
+ if(classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
+ return false;
+ if(classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
+ return false;
+ return true;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
+ if (!target || target->GetTypeId()!=TYPEID_PLAYER)
+ return false;
+ return target->GetHealth()*100 <= health.percent*target->GetMaxHealth();
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
+ return target && target->GetTypeId() == TYPEID_PLAYER && !target->isAlive() && ((Player*)target)->GetDeathTimer() != 0;
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
+ return source->HasAura(aura.spell_id,aura.effect_idx);
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
+ {
+ uint32 zone_id,area_id;
+ source->GetZoneAndAreaId(zone_id,area_id);
+ return area.id==zone_id || area.id==area_id;
+ }
+ case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
+ return target && target->HasAura(aura.spell_id,aura.effect_idx);
+ }
+
+ return false;
+}
+
+bool AchievementCriteriaDataSet::Meets(Player const* source, Unit const* target) const
+{
+ for(Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
+ if(!itr->Meets(source,target))
+ return false;
+
+ return true;
+}
+
AchievementMgr::AchievementMgr(Player *player)
{
m_player = player;
@@ -542,6 +642,10 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
}
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
{
+ // speedup for non-login case
+ if(miscvalue1 && miscvalue1 != achievementCriteria->complete_quests_in_zone.zoneID)
+ continue;
+
uint32 counter =0;
for(QuestStatusMap::iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
{
@@ -573,14 +677,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if(!miscvalue1)
continue;
- // skip wrong arena achievements, if not achievIdByArenaSlot then normal totla death counter
+ // skip wrong arena achievements, if not achievIdByArenaSlot then normal total death counter
bool notfit = false;
for(int i = 0; i < MAX_ARENA_SLOT; ++i)
{
if(achievIdByArenaSlot[i] == achievement->ID)
{
BattleGround* bg = GetPlayer()->GetBattleGround();
- if(!bg || ArenaTeam::GetSlotByType(bg->GetArenaType())!=i)
+ if(!bg || !bg->isArena() || ArenaTeam::GetSlotByType(bg->GetArenaType()) != i)
notfit = true;
break;
@@ -805,22 +909,18 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
{
// miscvalue1 = emote
- // miscvalue2 = achievement->ID for special requirement
if(!miscvalue1)
continue;
if(miscvalue1 != achievementCriteria->do_emote.emoteID)
continue;
if(achievementCriteria->do_emote.count)
{
- // harcoded case
- if(achievement->ID==247)
- {
- if (!unit || unit->GetTypeId() != TYPEID_PLAYER ||
- unit->isAlive() || ((Player*)unit)->GetDeathTimer() == 0)
- continue;
- }
- // expected as scripted case
- else if(!miscvalue2 || !achievement->ID != miscvalue2)
+ // those requirements couldn't be found in the dbc
+ AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
+ if(!data)
+ continue;
+
+ if(!data->Meets(GetPlayer(),unit))
continue;
}
@@ -884,24 +984,19 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
{
+ if (!miscvalue1)
+ continue;
+
if (!miscvalue1 || miscvalue1 != achievementCriteria->cast_spell.spellID)
continue;
// those requirements couldn't be found in the dbc
- if (CriteriaCastSpellRequirement const* requirement = AchievementGlobalMgr::GetCriteriaCastSpellRequirement(achievementCriteria))
- {
- if (!unit)
- continue;
-
- if (requirement->creatureEntry && unit->GetEntry() != requirement->creatureEntry)
- continue;
-
- if (requirement->playerRace && (unit->GetTypeId() != TYPEID_PLAYER || unit->getRace()!=requirement->playerRace))
- continue;
+ AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
+ if(!data)
+ continue;
- if (requirement->playerClass && (unit->GetTypeId() != TYPEID_PLAYER || unit->getClass()!=requirement->playerClass))
- continue;
- }
+ if(!data->Meets(GetPlayer(),unit))
+ continue;
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
break;
@@ -966,6 +1061,13 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if(IsCompletedCriteria(achievementCriteria,achievement))
CompletedCriteria(achievementCriteria,achievement);
+ // check again the completeness for SUMM and REQ COUNT achievements,
+ // as they don't depend on the completed criteria but on the sum of the progress of each individual criteria
+ if (achievement->flags & ACHIEVEMENT_FLAG_SUMM)
+ {
+ if (IsCompletedAchievement(achievement))
+ CompletedAchievement(achievement);
+ }
if(AchievementEntryList const* achRefList = achievementmgr.GetAchievementByReferencedId(achievement->ID))
{
@@ -1111,9 +1213,12 @@ void AchievementMgr::CompletedCriteria(AchievementCriteriaEntry const* criteria,
CompletedAchievement(achievement);
}
-// TODO: achievement 705 requires 4 criteria to be fulfilled
bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
{
+ // counter can never complete
+ if(entry->flags & ACHIEVEMENT_FLAG_COUNTER)
+ return false;
+
// for achievement with referenced achievement criterias get from referenced and counter from self
uint32 achievmentForTestId = entry->refAchievement ? entry->refAchievement : entry->ID;
uint32 achievmentForTestCount = entry->count;
@@ -1121,10 +1226,32 @@ bool AchievementMgr::IsCompletedAchievement(AchievementEntry const* entry)
AchievementCriteriaEntryList const* cList = achievementmgr.GetAchievementCriteriaByAchievement(achievmentForTestId);
if(!cList)
return false;
-
uint32 count = 0;
- bool completed_all = true;
+ // For SUMM achievements, we have to count the progress of each criteria of the achievement.
+ // Oddly, the target count is NOT countained in the achievement, but in each individual criteria
+ if (entry->flags & ACHIEVEMENT_FLAG_SUMM)
+ {
+ for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr)
+ {
+ AchievementCriteriaEntry const* criteria = *itr;
+
+ CriteriaProgressMap::const_iterator itrProgress = m_criteriaProgress.find(criteria->ID);
+ if(itrProgress == m_criteriaProgress.end())
+ continue;
+
+ CriteriaProgress const* progress = &itrProgress->second;
+ count += progress->counter;
+
+ // for counters, field4 contains the main count requirement
+ if (count >= criteria->raw.count)
+ return true;
+ }
+ return false;
+ }
+
+ // Default case - need complete all or
+ bool completed_all = true;
for(AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr)
{
AchievementCriteriaEntry const* criteria = *itr;
@@ -1388,6 +1515,83 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
sLog.outString(">> Loaded %u achievement references.",count);
}
+void AchievementGlobalMgr::LoadAchievementCriteriaData()
+{
+ m_criteriaDataMap.clear(); // need for reload case
+
+ QueryResult *result = WorldDatabase.Query("SELECT criteria_id, type, value1, value2 FROM achievement_criteria_data");
+
+ if(!result)
+ {
+ barGoLink bar(1);
+ bar.step();
+
+ sLog.outString();
+ sLog.outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+ barGoLink bar(result->GetRowCount());
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
+ uint32 criteria_id = fields[0].GetUInt32();
+
+ AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id);
+
+ if (!criteria)
+ {
+ sLog.outErrorDb( "Table `achievement_criteria_data` have data for not existed criteria (Entry: %u), ignore.", criteria_id);
+ continue;
+ }
+
+ AchievementCriteriaData data(fields[1].GetUInt32(),fields[2].GetUInt32(),fields[3].GetUInt32());
+
+ if(!data.IsValid(criteria))
+ continue;
+
+ // this will allocate empty data set storage
+ AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id];
+
+ // add real data only for not NONE data types
+ if(data.dataType!=ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
+ dataSet.Add(data);
+
+ // counting data by and data types
+ ++count;
+ } while(result->NextRow());
+
+ delete result;
+
+ // post loading checks
+ for (uint32 entryId = 0; entryId < sAchievementCriteriaStore.GetNumRows(); ++entryId)
+ {
+ AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(entryId);
+ if(!criteria)
+ continue;
+
+ switch(criteria->requiredType)
+ {
+ case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
+ if(!GetCriteriaDataSet(criteria))
+ sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
+ break;
+ case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases
+ if(criteria->do_emote.count && !GetCriteriaDataSet(criteria))
+ sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
+ break;
+ default: // unexpected case processed in IsValid check
+ break;
+ }
+
+ }
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u additional achievement criteria data.",count);
+}
+
void AchievementGlobalMgr::LoadCompletedAchievements()
{
QueryResult *result = CharacterDatabase.Query("SELECT achievement FROM character_achievement GROUP BY achievement");
@@ -1418,7 +1622,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
void AchievementGlobalMgr::LoadRewards()
{
- m_achievementRewards.clear(); // need for reload case
+ m_achievementRewards.clear(); // need for reload case
// 0 1 2 3 4 5 6
QueryResult *result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
@@ -1434,6 +1638,7 @@ void AchievementGlobalMgr::LoadRewards()
return;
}
+ uint32 count = 0;
barGoLink bar(result->GetRowCount());
do
@@ -1517,13 +1722,14 @@ void AchievementGlobalMgr::LoadRewards()
}
m_achievementRewards[entry] = reward;
+ ++count;
} while (result->NextRow());
delete result;
sLog.outString();
- sLog.outString( ">> Loaded %lu achievement reward locale strings", (unsigned long)m_achievementRewardLocales.size() );
+ sLog.outString( ">> Loaded %u achievement rewards", count );
}
void AchievementGlobalMgr::LoadRewardLocales()
diff --git a/src/game/AchievementMgr.h b/src/game/AchievementMgr.h
index b45c63f7301..391afedbb46 100644
--- a/src/game/AchievementMgr.h
+++ b/src/game/AchievementMgr.h
@@ -27,9 +27,6 @@
#include <map>
#include <string>
-#define CRITERIA_CAST_SPELL_REQ_COUNT 46
-#define ACHIEVEMENT_REWARD_COUNT 57
-
typedef std::list<AchievementCriteriaEntry const*> AchievementCriteriaEntryList;
typedef std::list<AchievementEntry const*> AchievementEntryList;
@@ -43,14 +40,92 @@ struct CriteriaProgress
bool changed;
};
-struct CriteriaCastSpellRequirement
+enum AchievementCriteriaDataType
+{ // value1 value2 comment
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1, // creature_id 0
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH= 3, // health_percent 0
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4, // 0 0 not corpse (not released body)
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5, // spell_id effect_idx
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6, // area id 0
+ ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA = 7, // spell_id effect_idx
+};
+
+#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 8 // maximum value in AchievementCriteriaDataType enum
+
+class Player;
+class Unit;
+
+struct AchievementCriteriaData
+{
+ AchievementCriteriaDataType dataType;
+ union
+ {
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE
+ struct
+ {
+ uint32 id;
+ } creature;
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE
+ struct
+ {
+ uint32 class_id;
+ uint32 race_id;
+ } classRace;
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH
+ struct
+ {
+ uint32 percent;
+ } health;
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA
+ struct
+ {
+ uint32 spell_id;
+ uint32 effect_idx;
+ } aura;
+ // ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA
+ struct
+ {
+ uint32 id;
+ } area;
+ // ...
+ struct
+ {
+ uint32 value1;
+ uint32 value2;
+ } raw;
+ };
+
+ AchievementCriteriaData() : dataType(ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
+ {
+ raw.value1 = 0;
+ raw.value2 = 0;
+ }
+
+ AchievementCriteriaData(uint32 _dataType, uint32 _value1, uint32 _value2) : dataType(AchievementCriteriaDataType(_dataType))
+ {
+ raw.value1 = _value1;
+ raw.value2 = _value2;
+ }
+
+ bool IsValid(AchievementCriteriaEntry const* criteria);
+ bool Meets(Player const* source, Unit const* target) const;
+};
+
+struct AchievementCriteriaDataSet
{
- uint32 achievementCriteriaId;
- uint32 creatureEntry;
- uint8 playerClass;
- uint8 playerRace;
+ typedef std::vector<AchievementCriteriaData> Storage;
+ void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
+ bool Meets(Player const* source, Unit const* target) const;
+ private:
+ Storage storage;
};
+
+typedef std::map<uint32,AchievementCriteriaDataSet> AchievementCriteriaDataMap;
+
struct AchievementReward
{
uint32 titleId[2];
@@ -145,13 +220,10 @@ class AchievementGlobalMgr
return iter!=m_achievementRewardLocales.end() ? &iter->second : NULL;
}
- static CriteriaCastSpellRequirement const * GetCriteriaCastSpellRequirement(AchievementCriteriaEntry const *achievementCriteria)
+ AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria)
{
- for (uint32 i=0; i < CRITERIA_CAST_SPELL_REQ_COUNT; ++i)
- if (m_criteriaCastSpellRequirements[i].achievementCriteriaId == achievementCriteria->ID)
- return &m_criteriaCastSpellRequirements[i];
-
- return NULL;
+ AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID);
+ return iter!=m_criteriaDataMap.end() ? &iter->second : NULL;
}
bool IsRealmCompleted(AchievementEntry const* achievement) const
@@ -165,12 +237,13 @@ class AchievementGlobalMgr
}
void LoadAchievementCriteriaList();
+ void LoadAchievementCriteriaData();
void LoadAchievementReferenceList();
void LoadCompletedAchievements();
void LoadRewards();
void LoadRewardLocales();
private:
- static const CriteriaCastSpellRequirement m_criteriaCastSpellRequirements[];
+ AchievementCriteriaDataMap m_criteriaDataMap;
// store achievement criterias by type to speed up lookup
AchievementCriteriaEntryList m_AchievementCriteriasByType[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 9add7ed98da..fffedb56ad8 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -46,7 +46,7 @@ namespace MaNGOS
{
char const* text = objmgr.GetMangosString(i_textId,loc_idx);
- if(i_args)
+ if (i_args)
{
// we need copy va_list before use or original va_list will corrupted
va_list ap;
@@ -121,7 +121,7 @@ template<class Do>
void BattleGround::BroadcastWorker(Do& _do)
{
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
- if(Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
+ if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
_do(plr);
}
@@ -223,8 +223,8 @@ BattleGround::~BattleGround()
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
// unload map
- if(Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
- if(map->IsBattleGroundOrArena())
+ if (Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
+ if (map->IsBattleGroundOrArena())
((BattleGroundMap*)map)->SetUnload();
// remove from bg free slot queue
this->RemoveFromBGFreeSlotQueue();
@@ -232,17 +232,17 @@ BattleGround::~BattleGround()
void BattleGround::Update(uint32 diff)
{
- if(!GetPlayersSize() && !GetReviveQueueSize())
+ if (!GetPlayersSize() && !GetReviveQueueSize())
//BG is empty
return;
// remove offline players from bg after 5 minutes
- if( !m_OfflineQueue.empty() )
+ if (!m_OfflineQueue.empty())
{
BattleGroundPlayerMap::iterator itr = m_Players.find(*(m_OfflineQueue.begin()));
- if( itr != m_Players.end() )
+ if (itr != m_Players.end())
{
- if( itr->second.OfflineRemoveTime <= sWorld.GetGameTime() )
+ if (itr->second.OfflineRemoveTime <= sWorld.GetGameTime())
{
RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
m_OfflineQueue.pop_front(); // remove from offline queue
@@ -259,7 +259,7 @@ void BattleGround::Update(uint32 diff)
m_LastResurrectTime += diff;
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
{
- if(GetReviveQueueSize())
+ if (GetReviveQueueSize())
{
for(std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
@@ -267,7 +267,7 @@ void BattleGround::Update(uint32 diff)
for(std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
Player *plr = objmgr.GetPlayer(*itr2);
- if(!plr)
+ if (!plr)
continue;
if (!sh)
@@ -296,7 +296,7 @@ void BattleGround::Update(uint32 diff)
for(std::vector<uint64>::iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
{
Player *plr = objmgr.GetPlayer(*itr);
- if(!plr)
+ if (!plr)
continue;
plr->ResurrectPlayer(1.0f);
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
@@ -310,20 +310,20 @@ void BattleGround::Update(uint32 diff)
/*********************************************************/
// if less then minimum players are in on one side, then start premature finish timer
- if(GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
+ if (GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
{
- if(!m_PrematureCountDown)
+ if (!m_PrematureCountDown)
{
m_PrematureCountDown = true;
m_PrematureCountDownTimer = sBattleGroundMgr.GetPrematureFinishTime();
}
- else if(m_PrematureCountDownTimer < diff)
+ else if (m_PrematureCountDownTimer < diff)
{
// time's up!
uint32 winner = 0;
- if( GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam() )
+ if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam())
winner = ALLIANCE;
- else if( GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam() )
+ else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
winner = HORDE;
EndBattleGround(winner);
@@ -333,15 +333,15 @@ void BattleGround::Update(uint32 diff)
{
uint32 newtime = m_PrematureCountDownTimer - diff;
// announce every minute
- if( newtime > (MINUTE * IN_MILISECONDS) )
+ if (newtime > (MINUTE * IN_MILISECONDS))
{
- if( newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS) )
+ if (newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS)));
}
else
{
//announce every 15 seconds
- if( newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS) )
+ if (newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS))
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILISECONDS));
}
m_PrematureCountDownTimer = newtime;
@@ -363,7 +363,7 @@ void BattleGround::Update(uint32 diff)
m_Events |= BG_STARTING_EVENT_1;
// setup here, only when at least one player has ported to the map
- if(!SetupBattleGround())
+ if (!SetupBattleGround())
{
EndNow();
return;
@@ -398,12 +398,12 @@ void BattleGround::Update(uint32 diff)
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
//remove preparation
- if( isArena() )
+ if (isArena())
{
//TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if(Player *plr = objmgr.GetPlayer(itr->first))
+ if (Player *plr = objmgr.GetPlayer(itr->first))
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
CheckArenaWinConditions();
@@ -414,10 +414,10 @@ void BattleGround::Update(uint32 diff)
PlaySoundToAll(SOUND_BG_START);
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
- if(Player* plr = objmgr.GetPlayer(itr->first))
+ if (Player* plr = objmgr.GetPlayer(itr->first))
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
//Announce BG starting
- if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
+ if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
{
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
}
@@ -429,11 +429,11 @@ void BattleGround::Update(uint32 diff)
/*** BATTLEGROUND ENDING SYSTEM ***/
/*********************************************************/
- if(GetStatus() == STATUS_WAIT_LEAVE)
+ if (GetStatus() == STATUS_WAIT_LEAVE)
{
// remove all players from battleground after 2 minutes
m_EndTime -= diff;
- if( m_EndTime <= 0)
+ if (m_EndTime <= 0)
{
m_EndTime = 0;
BattleGroundPlayerMap::iterator itr, next;
@@ -466,7 +466,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet)
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(plr)
+ if (plr)
plr->GetSession()->SendPacket(packet);
else
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
@@ -479,19 +479,19 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
continue;
}
- if(!self && sender == plr)
+ if (!self && sender == plr)
continue;
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
- if(team == TeamID)
+ if (team == TeamID)
plr->GetSession()->SendPacket(packet);
}
}
@@ -511,7 +511,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
continue;
@@ -520,7 +520,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
- if(team == TeamID)
+ if (team == TeamID)
{
sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID);
plr->GetSession()->SendPacket(&data);
@@ -534,7 +534,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
continue;
@@ -543,7 +543,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
- if(team == TeamID)
+ if (team == TeamID)
plr->CastSpell(plr, SpellID, true);
}
}
@@ -571,7 +571,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
continue;
@@ -580,7 +580,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
- if(team == TeamID)
+ if (team == TeamID)
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
}
}
@@ -589,14 +589,14 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
{
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
- if(!factionEntry)
+ if (!factionEntry)
return;
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
continue;
@@ -605,7 +605,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
uint32 team = itr->second.Team;
if(!team) team = plr->GetTeam();
- if(team == TeamID)
+ if (team == TeamID)
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
}
}
@@ -635,7 +635,7 @@ void BattleGround::EndBattleGround(uint32 winner)
WorldPacket data;
int32 winmsg_id = 0;
- if(winner == ALLIANCE)
+ if (winner == ALLIANCE)
{
winmsg_id = isBattleGround() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
@@ -643,7 +643,7 @@ void BattleGround::EndBattleGround(uint32 winner)
SetWinner(WINNER_ALLIANCE);
}
- else if(winner == HORDE)
+ else if (winner == HORDE)
{
winmsg_id = isBattleGround() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
@@ -661,11 +661,11 @@ void BattleGround::EndBattleGround(uint32 winner)
m_EndTime = TIME_TO_AUTOREMOVE;
// arena rating calculation
- if(isArena() && isRated())
+ if (isArena() && isRated())
{
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner));
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
- if( winner_arena_team && loser_arena_team )
+ if (winner_arena_team && loser_arena_team)
{
loser_rating = loser_arena_team->GetStats().rating;
winner_rating = winner_arena_team->GetStats().rating;
@@ -687,12 +687,12 @@ void BattleGround::EndBattleGround(uint32 winner)
Player *plr = objmgr.GetPlayer(itr->first);
uint32 team = itr->second.Team;
- if(!plr)
+ if (!plr)
{
//if rated arena match - make member lost!
- if(isArena() && isRated() && winner_arena_team && loser_arena_team)
+ if (isArena() && isRated() && winner_arena_team && loser_arena_team)
{
- if(team == winner)
+ if (team == winner)
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
else
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
@@ -705,7 +705,7 @@ void BattleGround::EndBattleGround(uint32 winner)
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
- if(!plr->isAlive())
+ if (!plr->isAlive())
{
plr->ResurrectPlayer(1.0f);
plr->SpawnCorpseBones();
@@ -715,15 +715,15 @@ void BattleGround::EndBattleGround(uint32 winner)
//if(!team) team = plr->GetTeam();
// per player calculation
- if(isArena() && isRated() && winner_arena_team && loser_arena_team)
+ if (isArena() && isRated() && winner_arena_team && loser_arena_team)
{
- if(team == winner)
+ if (team == winner)
winner_arena_team->MemberWon(plr,loser_rating);
else
loser_arena_team->MemberLost(plr,winner_rating);
}
- if(team == winner)
+ if (team == winner)
{
RewardMark(plr,ITEM_WINNER_COUNT);
RewardQuest(plr);
@@ -746,7 +746,7 @@ void BattleGround::EndBattleGround(uint32 winner)
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
}
- if(isArena() && isRated() && winner_arena_team && loser_arena_team)
+ if (isArena() && isRated() && winner_arena_team && loser_arena_team)
{
// update arena points only after increasing the player's match count!
//obsolete: winner_arena_team->UpdateArenaPointsHelper();
@@ -760,10 +760,7 @@ void BattleGround::EndBattleGround(uint32 winner)
loser_arena_team->NotifyStatsChanged();
}
- // inform invited players about the removal
- sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
-
- if(winmsg_id)
+ if (winmsg_id)
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
@@ -789,7 +786,7 @@ uint32 BattleGround::GetBattlemasterEntry() const
void BattleGround::RewardMark(Player *plr,uint32 count)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
- if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
+ if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
return;
if(!plr || !count)
@@ -826,7 +823,7 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
if(Item* item = plr->StoreNewItem( dest, mark, true, 0))
plr->SendNewItem(item,count,false,true);
- if(no_space_count > 0)
+ if (no_space_count > 0)
SendRewardMarkByMail(plr,mark,no_space_count);
}
}
@@ -834,14 +831,14 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
{
uint32 bmEntry = GetBattlemasterEntry();
- if(!bmEntry)
+ if (!bmEntry)
return;
ItemPrototype const* markProto = objmgr.GetItemPrototype(mark);
- if(!markProto)
+ if (!markProto)
return;
- if(Item* markItem = Item::CreateItem(mark,count,plr))
+ if (Item* markItem = Item::CreateItem(mark,count,plr))
{
// save new item before send
markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
@@ -853,8 +850,8 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
// subject: item name
std::string subject = markProto->Name1;
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
- if ( loc_idx >= 0 )
- if(ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
+ if (loc_idx >= 0 )
+ if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
subject = il->Name[loc_idx];
@@ -871,7 +868,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
void BattleGround::RewardQuest(Player *plr)
{
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
- if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
+ if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
return;
uint32 quest;
@@ -907,7 +904,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
bool participant = false;
// Remove from lists/maps
BattleGroundPlayerMap::iterator itr = m_Players.find(guid);
- if(itr != m_Players.end())
+ if (itr != m_Players.end())
{
UpdatePlayersCountByTeam(team, true); // -1 player
m_Players.erase(itr);
@@ -916,7 +913,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
}
std::map<uint64, BattleGroundScore*>::iterator itr2 = m_PlayerScores.find(guid);
- if(itr2 != m_PlayerScores.end())
+ if (itr2 != m_PlayerScores.end())
{
delete itr2->second; // delete player's score
m_PlayerScores.erase(itr2);
@@ -942,38 +939,32 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
{
BattleGroundTypeId bgTypeId = GetTypeID();
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
- if(plr)
+ if (plr)
{
plr->ClearAfkReports();
if(!team) team = plr->GetTeam();
// if arena, remove the specific arena auras
- if(isArena())
+ if (isArena())
{
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
- // summon old pet if there was one and there isn't a current pet
- if(!plr->GetGuardianPet() && plr->GetTemporaryUnsummonedPetNumber())
- {
- Pet* NewPet = new Pet(plr);
- if(!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
- delete NewPet;
+ // unsummon current and summon old pet if there was one and there isn't a current pet
+ plr->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT);
+ plr->ResummonPetTemporaryUnSummonedIfAny();
- (plr)->SetTemporaryUnsummonedPetNumber(0);
- }
-
- if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
+ if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
//left a rated match while the encounter was in progress, consider as loser
ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
- if(winner_arena_team && loser_arena_team)
+ if (winner_arena_team && loser_arena_team)
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
}
}
- if(SendPacket)
+ if (SendPacket)
{
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
@@ -986,18 +977,18 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
else
// removing offline participant
{
- if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
+ if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
{
//left a rated match while the encounter was in progress, consider as loser
ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
- if( others_arena_team && players_arena_team )
+ if (others_arena_team && players_arena_team)
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
}
}
// remove from raid group if player is member
- if(Group *group = GetBgRaid(team))
+ if (Group *group = GetBgRaid(team))
{
if( !group->RemoveMember(guid, 0) ) // group was disbanded
{
@@ -1007,7 +998,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
}
DecreaseInvitedCount(team);
//we should update battleground queue, but only if bg isn't ending
- if( isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE )
+ if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE)
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
// Let others know
WorldPacket data;
@@ -1015,20 +1006,20 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
SendPacketToTeam(team, &data, plr, false);
}
- if( plr )
+ if (plr)
{
// Do next only if found in battleground
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
// reset destination bg team
plr->SetBGTeam(0);
- if(Transport)
+ if (Transport)
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
}
- if(!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
+ if (!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
{
// if no players left AND no invitees left, set this bg to delete in next update
// direct deletion could cause crashes
@@ -1095,40 +1086,28 @@ void BattleGround::AddPlayer(Player *plr)
SendPacketToTeam(team, &data, plr, false);
// add arena specific auras
- if(isArena())
+ if (isArena())
{
plr->RemoveArenaSpellCooldowns();
plr->RemoveArenaAuras();
plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT);
if(team == ALLIANCE) // gold
{
- if(plr->GetTeam() == HORDE)
+ if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
else
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true);
}
else // green
{
- if(plr->GetTeam() == HORDE)
+ if (plr->GetTeam() == HORDE)
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true);
else
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true);
}
plr->DestroyConjuredItems(true);
-
- Pet* pet = plr->GetPet();
- if(pet)
- {
- if(pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
- {
- (plr)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
- (plr)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
- }
- (plr)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT);
- }
- else
- (plr)->SetTemporaryUnsummonedPetNumber(0);
+ plr->UnsummonPetTemporaryIfAny();
if(GetStatus() == STATUS_WAIT_JOIN) // not started yet
{
@@ -1164,7 +1143,7 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
}
else // raid already exist
{
- if(group->IsMember(plr_guid))
+ if (group->IsMember(plr_guid))
{
uint8 subgroup = group->GetMemberGroup(plr_guid);
plr->SetBattleGroundRaid(group, subgroup);
@@ -1172,8 +1151,8 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
else
{
group->AddMember(plr_guid, plr->GetName());
- if( Group* originalGroup = plr->GetOriginalGroup() )
- if( originalGroup->IsLeader(plr_guid) )
+ if (Group* originalGroup = plr->GetOriginalGroup())
+ if (originalGroup->IsLeader(plr_guid))
group->ChangeLeader(plr_guid);
}
}
@@ -1185,7 +1164,7 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid)
// player is correct pointer
for(std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
{
- if( *itr == plr_guid )
+ if (*itr == plr_guid)
{
m_OfflineQueue.erase(itr);
break;
@@ -1203,14 +1182,14 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
// player is correct pointer, it is checked in WorldSession::LogoutPlayer()
m_OfflineQueue.push_back(player->GetGUID());
m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME;
- if( GetStatus() == STATUS_IN_PROGRESS )
+ if (GetStatus() == STATUS_IN_PROGRESS)
{
- if( isBattleGround() )
+ if (isBattleGround())
EventPlayerDroppedFlag(player);
else
{
//1 player is logging out, if it is the last, then end arena!
- if( GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())) )
+ if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
EndBattleGround(GetOtherTeam(player->GetTeam()));
}
}
@@ -1220,7 +1199,7 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
void BattleGround::AddToBGFreeSlotQueue()
{
// make sure to add only once
- if(!m_InBGFreeSlotQueue && isBattleGround())
+ if (!m_InBGFreeSlotQueue && isBattleGround())
{
sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].push_front(this);
m_InBGFreeSlotQueue = true;
@@ -1280,10 +1259,10 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
break;
case SCORE_BONUS_HONOR: // Honor bonus
// do not add honor in arenas
- if(isBattleGround())
+ if (isBattleGround())
{
// reward honor instantly
- if(Source->RewardHonor(NULL, 1, value))
+ if (Source->RewardHonor(NULL, 1, value))
itr->second->BonusHonor += value;
}
break;
@@ -1305,12 +1284,11 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
m_ReviveQueue[npc_guid].push_back(player_guid);
Player *plr = objmgr.GetPlayer(player_guid);
- if(!plr)
+ if (!plr)
return;
- plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT );
- if(spellInfo)
+ if (spellInfo)
{
Aura *Aur = new Aura(spellInfo, 1, NULL, plr);
plr->AddAura(Aur);
@@ -1323,12 +1301,12 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
{
for(std::vector<uint64>::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
{
- if(*itr2 == player_guid)
+ if (*itr2 == player_guid)
{
(itr->second).erase(itr2);
Player *plr = objmgr.GetPlayer(player_guid);
- if(!plr)
+ if (!plr)
return;
plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
@@ -1342,7 +1320,7 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
{
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
- if(!map)
+ if (!map)
return false;
// must be created this way, adding to godatamap would add it to the base map of the instance
@@ -1380,7 +1358,7 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
data.go_state = 1;
*/
// add to world, so it can be later looked up from HashMapHolder
- go->AddToWorld();
+ map->Add(go);
m_BgObjects[type] = go->GetGUID();
return true;
}
@@ -1390,10 +1368,10 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
void BattleGround::DoorClose(uint32 type)
{
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
- if(obj)
+ if (obj)
{
//if doors are open, close it
- if( obj->getLootState() == GO_ACTIVATED && !obj->GetGoState() )
+ if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState())
{
//change state to allow door to be closed
obj->SetLootState(GO_READY);
@@ -1409,7 +1387,7 @@ void BattleGround::DoorClose(uint32 type)
void BattleGround::DoorOpen(uint32 type)
{
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
- if(obj)
+ if (obj)
{
//change state to be sure they will be opened
obj->SetLootState(GO_READY);
@@ -1440,15 +1418,15 @@ Creature* BattleGround::GetBGCreature(uint32 type)
void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
{
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
- if(!map)
+ if (!map)
return;
- if( respawntime == 0 )
+ if (respawntime == 0)
{
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
- if(obj)
+ if (obj)
{
//we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
- if( obj->getLootState() == GO_JUST_DEACTIVATED )
+ if (obj->getLootState() == GO_JUST_DEACTIVATED)
obj->SetLootState(GO_READY);
obj->SetRespawnTime(0);
map->Add(obj);
@@ -1457,7 +1435,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
else
{
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
- if(obj)
+ if (obj)
{
map->Add(obj);
obj->SetRespawnTime(respawntime);
@@ -1469,7 +1447,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime)
{
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
- if(!map)
+ if (!map)
return NULL;
Creature* pCreature = new Creature;
@@ -1482,7 +1460,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
pCreature->Relocate(x, y, z, o);
- if(!pCreature->IsPositionValid())
+ if (!pCreature->IsPositionValid())
{
sLog.outError("Creature (guidlow %d, entry %d) not added to battleground. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
delete pCreature;
@@ -1502,13 +1480,13 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
{
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId());
- if(!map)
+ if (!map)
return false;
- if(respawntime == 0)
+ if (respawntime == 0)
{
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
- if(obj)
+ if (obj)
{
//obj->Respawn(); // bugged
obj->SetRespawnTime(0);
@@ -1519,7 +1497,7 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
else
{
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
- if(obj)
+ if (obj)
{
obj->setDeathState(DEAD);
obj->SetRespawnTime(respawntime);
@@ -1530,11 +1508,11 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
*/
bool BattleGround::DelCreature(uint32 type)
{
- if(!m_BgCreatures[type])
+ if (!m_BgCreatures[type])
return true;
Creature *cr = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
- if(!cr)
+ if (!cr)
{
sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type]));
return false;
@@ -1548,11 +1526,11 @@ bool BattleGround::DelCreature(uint32 type)
bool BattleGround::DelObject(uint32 type)
{
- if(!m_BgObjects[type])
+ if (!m_BgObjects[type])
return true;
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
- if(!obj)
+ if (!obj)
{
sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type]));
return false;
@@ -1567,13 +1545,13 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float
{
uint32 entry = 0;
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
entry = 13116;
else
entry = 13117;
Creature* pCreature = AddCreature(entry,type,team,x,y,z,o);
- if(!pCreature)
+ if (!pCreature)
{
sLog.outError("Can't create Spirit guide. BattleGround not created!");
EndNow();
@@ -1631,8 +1609,6 @@ void BattleGround::EndNow()
RemoveFromBGFreeSlotQueue();
SetStatus(STATUS_WAIT_LEAVE);
SetEndTime(0);
- // inform invited players about the removal
- sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
}
//to be removed
@@ -1650,7 +1626,7 @@ buffs are in their positions when battleground starts
void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
{
GameObject *obj = HashMapHolder<GameObject>::Find(go_guid);
- if(!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
+ if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
return;
//change buff type, when buff is used:
@@ -1666,13 +1642,13 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
//randomly select new buff
uint8 buff = urand(0, 2);
uint32 entry = obj->GetEntry();
- if( m_BuffChange && entry != Buff_Entries[buff] )
+ if (m_BuffChange && entry != Buff_Entries[buff])
{
//despawn current buff
SpawnBGObject(index, RESPAWN_ONE_DAY);
//set index for new one
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
- if( entry == Buff_Entries[currBuffTypeIndex] )
+ if (entry == Buff_Entries[currBuffTypeIndex])
{
index -= currBuffTypeIndex;
index += buff;
@@ -1690,7 +1666,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
UpdatePlayerScore(player, SCORE_DEATHS, 1);
// add +1 kills to group and +1 killing_blows to killer
- if( killer )
+ if (killer)
{
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
@@ -1699,16 +1675,16 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
{
Player *plr = objmgr.GetPlayer(itr->first);
- if(!plr || plr == killer)
+ if (!plr || plr == killer)
continue;
- if( plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player) )
+ if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
}
}
// to be able to remove insignia -- ONLY IN BattleGrounds
- if( !isArena() )
+ if (!isArena())
player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
}
@@ -1717,7 +1693,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
uint32 BattleGround::GetPlayerTeam(uint64 guid)
{
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
- if(itr!=m_Players.end())
+ if (itr!=m_Players.end())
return itr->second.Team;
return 0;
}
@@ -1730,14 +1706,14 @@ uint32 BattleGround::GetOtherTeam(uint32 teamId)
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
{
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
- if(itr != m_Players.end())
+ if (itr != m_Players.end())
return true;
return false;
}
void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
{
- if(GetStatus() != STATUS_WAIT_LEAVE)
+ if (GetStatus() != STATUS_WAIT_LEAVE)
return;
WorldPacket data;
@@ -1757,10 +1733,10 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
int count = 0;
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
- if(itr->second.Team == Team)
+ if (itr->second.Team == Team)
{
Player * pl = objmgr.GetPlayer(itr->first);
- if(pl && pl->isAlive())
+ if (pl && pl->isAlive())
++count;
}
}
@@ -1790,9 +1766,9 @@ void BattleGround::HandleKillUnit(Creature *creature, Player *killer)
void BattleGround::CheckArenaWinConditions()
{
- if( !GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE) )
+ if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
EndBattleGround(HORDE);
- else if( GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE) )
+ else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
EndBattleGround(ALLIANCE);
}
diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h
index d33eb76e02c..9788f264502 100644
--- a/src/game/BattleGround.h
+++ b/src/game/BattleGround.h
@@ -361,7 +361,7 @@ class BattleGround
void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
uint32 GetInvitedCount(uint32 team) const
{
- if( team == ALLIANCE )
+ if (team == ALLIANCE)
return m_InvitedAlliance;
else
return m_InvitedHorde;
@@ -444,7 +444,7 @@ class BattleGround
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
{
- if(remove)
+ if (remove)
--m_PlayersCount[GetTeamIndexByTeamId(Team)];
else
++m_PlayersCount[GetTeamIndexByTeamId(Team)];
diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp
index 90bbd411773..40f60960377 100644
--- a/src/game/BattleGroundAB.cpp
+++ b/src/game/BattleGroundAB.cpp
@@ -60,16 +60,16 @@ void BattleGroundAB::Update(uint32 diff)
{
BattleGround::Update(diff);
- if( GetStatus() == STATUS_IN_PROGRESS )
+ if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
- if( m_BannerTimers[node].timer )
+ if (m_BannerTimers[node].timer)
{
- if( m_BannerTimers[node].timer > diff )
+ if (m_BannerTimers[node].timer > diff)
m_BannerTimers[node].timer -= diff;
else
{
@@ -79,9 +79,9 @@ void BattleGroundAB::Update(uint32 diff)
}
// 1-minute to occupy a node from contested state
- if( m_NodeTimers[node] )
+ if (m_NodeTimers[node])
{
- if( m_NodeTimers[node] > diff )
+ if (m_NodeTimers[node] > diff)
m_NodeTimers[node] -= diff;
else
{
@@ -98,7 +98,7 @@ void BattleGroundAB::Update(uint32 diff)
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
- if(teamIndex == 0)
+ if (teamIndex == 0)
{
// FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node));
@@ -114,7 +114,7 @@ void BattleGroundAB::Update(uint32 diff)
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
- if( m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED )
+ if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
@@ -122,28 +122,28 @@ void BattleGroundAB::Update(uint32 diff)
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
- if( !points )
+ if (!points)
continue;
m_lastTick[team] += diff;
- if( m_lastTick[team] > BG_AB_TickIntervals[points] )
+ if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
- if( m_ReputationScoreTics[team] >= m_ReputationTics )
+ if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
- if( m_HonorScoreTics[team] >= m_HonorTics )
+ if (m_HonorScoreTics[team] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics;
}
- if( !m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE )
+ if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
- if( team == BG_TEAM_ALLIANCE )
+ if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
@@ -151,19 +151,19 @@ void BattleGroundAB::Update(uint32 diff)
m_IsInformedNearVictory = true;
}
- if( m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE )
+ if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
- if( team == BG_TEAM_ALLIANCE )
+ if (team == BG_TEAM_ALLIANCE)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
- if( team == BG_TEAM_HORDE )
+ if (team == BG_TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
}
}
// Test win condition
- if( m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE )
+ if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleGround(ALLIANCE);
- if( m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE )
+ if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
EndBattleGround(HORDE);
}
}
@@ -218,19 +218,19 @@ void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
- if( GetStatus() != STATUS_IN_PROGRESS )
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
switch(Trigger)
{
case 3948: // Arathi Basin Alliance Exit.
- if( Source->GetTeam() != ALLIANCE )
+ if (Source->GetTeam() != ALLIANCE)
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
else
Source->LeaveBattleground();
break;
case 3949: // Arathi Basin Horde Exit.
- if( Source->GetTeam() != HORDE )
+ if (Source->GetTeam() != HORDE)
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
else
Source->LeaveBattleground();
@@ -255,7 +255,7 @@ void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
{
// Just put it into the queue
- if( delay )
+ if (delay)
{
m_BannerTimers[node].timer = 2000;
m_BannerTimers[node].type = type;
@@ -268,7 +268,7 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
// handle aura with banner
- if( !type )
+ if (!type)
return;
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
@@ -280,7 +280,7 @@ void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
SpawnBGObject(obj, RESPAWN_ONE_DAY);
// handle aura with banner
- if( !type )
+ if (!type)
return;
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
SpawnBGObject(obj, RESPAWN_ONE_DAY);
@@ -317,9 +317,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
// How many bases each team owns
uint8 ally = 0, horde = 0;
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
- if( m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
+ if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
++ally;
- else if( m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
+ else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
++horde;
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally);
@@ -340,7 +340,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
// Send node owner state update to refresh map icons on client
const uint8 plusArray[] = {0, 2, 3, 0, 1};
- if( m_prevNodes[node] )
+ if (m_prevNodes[node])
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
else
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
@@ -350,9 +350,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
// How many bases each team owns
uint8 ally = 0, horde = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- if( m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
+ if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
++ally;
- else if( m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
+ else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
++horde;
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
@@ -361,30 +361,30 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
{
- if( !AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team) )
+ if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team);
// SpawnBGCreature(node,RESPAWN_IMMEDIATELY);
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if( m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
+ if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
}
- if(capturedNodes >= 5)
+ if (capturedNodes >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
- if(capturedNodes >= 4)
+ if (capturedNodes >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
}
void BattleGroundAB::_NodeDeOccupied(uint8 node)
{
- if( node >= BG_AB_DYNAMIC_NODES_COUNT)
+ if (node >= BG_AB_DYNAMIC_NODES_COUNT)
return;
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
- if( !ghost_list.empty() )
+ if (!ghost_list.empty())
{
WorldSafeLocsEntry const *ClosestGrave = NULL;
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
@@ -401,7 +401,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
}
}
- if( m_BgCreatures[node] )
+ if (m_BgCreatures[node])
DelCreature(node);
// buff object isn't despawned
@@ -410,7 +410,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
/* Invoked if a player used a banner as a gameobject */
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
{
- if( GetStatus() != STATUS_IN_PROGRESS )
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 node = BG_AB_NODE_STABLES;
@@ -421,7 +421,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
obj=HashMapHolder<GameObject>::Find(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
}
- if( node == BG_AB_DYNAMIC_NODES_COUNT)
+ if (node == BG_AB_DYNAMIC_NODES_COUNT)
{
// this means our player isn't close to any of banners - maybe cheater ??
return;
@@ -430,13 +430,13 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
uint8 teamIndex = GetTeamIndexByTeamId(source->GetTeam());
// Check if player really could use this banner, not cheated
- if( !(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2) )
+ if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
return;
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
uint32 sound = 0;
// If node is neutral, change to contested
- if( m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL )
+ if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
@@ -449,7 +449,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: team and node names not localized
- if(teamIndex == 0)
+ if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY);
else
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
@@ -457,10 +457,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
sound = BG_AB_SOUND_NODE_CLAIMED;
}
// If node is contested
- else if( (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED) )
+ else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
{
// If last state is NOT occupied, change node to enemy-contested
- if( m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED )
+ if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
{
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
m_prevNodes[node] = m_Nodes[node];
@@ -473,7 +473,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: node names not localized
- if(teamIndex == 0)
+ if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
@@ -493,7 +493,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
// FIXME: node names not localized
- if(teamIndex == 0)
+ if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
@@ -515,7 +515,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
// FIXME: node names not localized
- if(teamIndex == 0)
+ if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
@@ -524,10 +524,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
}
// If node is occupied again, send "X has taken the Y" msg.
- if( m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED )
+ if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
{
// FIXME: team and node names not localized
- if(teamIndex == 0)
+ if (teamIndex == 0)
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
else
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
@@ -539,7 +539,7 @@ bool BattleGroundAB::SetupBattleGround()
{
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if( !AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
@@ -553,7 +553,7 @@ bool BattleGroundAB::SetupBattleGround()
return false;
}
}
- if( !AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
+ if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
)
{
@@ -563,7 +563,7 @@ bool BattleGroundAB::SetupBattleGround()
//buffs
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
- if( !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
+ if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
)
@@ -600,16 +600,16 @@ void BattleGroundAB::Reset()
}
for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT; ++i)
- if(m_BgCreatures[i])
+ if (m_BgCreatures[i])
DelCreature(i);
}
void BattleGroundAB::EndBattleGround(uint32 winner)
{
//win reward
- if( winner == ALLIANCE )
+ if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
- if( winner == HORDE )
+ if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
//complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
@@ -625,12 +625,12 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
// Is there any occupied node for this team?
std::vector<uint8> nodes;
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
- if( m_Nodes[i] == teamIndex + 3 )
+ if (m_Nodes[i] == teamIndex + 3)
nodes.push_back(i);
WorldSafeLocsEntry const* good_entry = NULL;
// If so, select the closest node to place ghost on
- if( !nodes.empty() )
+ if (!nodes.empty())
{
float plr_x = player->GetPositionX();
float plr_y = player->GetPositionY();
@@ -639,10 +639,10 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
for (uint8 i = 0; i < nodes.size(); ++i)
{
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[nodes[i]] );
- if( !entry )
+ if (!entry)
continue;
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
- if( mindist > dist )
+ if (mindist > dist)
{
mindist = dist;
good_entry = entry;
@@ -651,7 +651,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
nodes.clear();
}
// If not, place ghost on starting location
- if( !good_entry )
+ if (!good_entry)
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] );
return good_entry;
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 6320623f453..bc0b50d21f0 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -543,7 +543,7 @@ void BattleGroundAV::RemovePlayer(Player* plr,uint64 /*guid*/)
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 SpellId = 0;
@@ -576,7 +576,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
break;
}
- if(SpellId)
+ if (SpellId)
Source->CastSpell(Source, SpellId, true);
}
diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp
index f417c353c1c..dd45b78d924 100644
--- a/src/game/BattleGroundBE.cpp
+++ b/src/game/BattleGroundBE.cpp
@@ -50,7 +50,7 @@ void BattleGroundBE::Update(uint32 diff)
{
BattleGround::Update(diff);
- /*if(GetStatus() == STATUS_IN_PROGRESS)
+ /*if (GetStatus() == STATUS_IN_PROGRESS)
{
// update something
}*/
@@ -88,7 +88,7 @@ void BattleGroundBE::AddPlayer(Player *plr)
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
- if(GetStatus() == STATUS_WAIT_LEAVE)
+ if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
@@ -99,10 +99,10 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
- if(!killer)
+ if (!killer)
{
sLog.outError("Killer player not found");
return;
@@ -125,7 +125,7 @@ bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
@@ -144,7 +144,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
break;
}
- //if(buff_guid)
+ //if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
}
@@ -164,7 +164,7 @@ void BattleGroundBE::Reset()
bool BattleGroundBE::SetupBattleGround()
{
// gates
- if( !AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
+ if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp
index f50f2d332e1..04ab25c30cc 100644
--- a/src/game/BattleGroundEY.cpp
+++ b/src/game/BattleGroundEY.cpp
@@ -59,10 +59,10 @@ void BattleGroundEY::Update(uint32 diff)
{
BattleGround::Update(diff);
- if( GetStatus() == STATUS_IN_PROGRESS )
+ if (GetStatus() == STATUS_IN_PROGRESS)
{
m_PointAddingTimer -= diff;
- if(m_PointAddingTimer <= 0)
+ if (m_PointAddingTimer <= 0)
{
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
@@ -71,11 +71,11 @@ void BattleGroundEY::Update(uint32 diff)
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
}
- if(m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
+ if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
{
m_FlagsTimer -= diff;
- if(m_FlagsTimer < 0)
+ if (m_FlagsTimer < 0)
{
m_FlagsTimer = 0;
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
@@ -86,7 +86,7 @@ void BattleGroundEY::Update(uint32 diff)
}
m_TowerCapCheckTimer -= diff;
- if(m_TowerCapCheckTimer <= 0)
+ if (m_TowerCapCheckTimer <= 0)
{
//check if player joined point
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
@@ -150,7 +150,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
{
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[EY_POINTS_MAX][j]);
++j;
@@ -184,7 +184,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
{
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]);
- if(obj)
+ if (obj)
{
uint8 j = 0;
while (j < m_PlayersNearPoint[i].size())
@@ -268,9 +268,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
{
uint32 score = GetTeamScore(Team);
//TODO there should be some sound played when one team is near victory!! - and define variables
- /*if( !m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE )
+ /*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE)
{
- if( Team == ALLIANCE )
+ if (Team == ALLIANCE)
SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
@@ -278,13 +278,13 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
m_IsInformedNearVictory = true;
}*/
- if( score >= BG_EY_MAX_TEAM_SCORE )
+ if (score >= BG_EY_MAX_TEAM_SCORE)
{
score = BG_EY_MAX_TEAM_SCORE;
EndBattleGround(Team);
}
- if(Team == ALLIANCE)
+ if (Team == ALLIANCE)
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
else
UpdateWorldState(EY_HORDE_RESOURCES, score);
@@ -293,9 +293,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
void BattleGroundEY::EndBattleGround(uint32 winner)
{
//win reward
- if( winner == ALLIANCE )
+ if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
- if( winner == HORDE )
+ if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
//complete map reward
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
@@ -306,7 +306,7 @@ void BattleGroundEY::EndBattleGround(uint32 winner)
void BattleGroundEY::UpdatePointsCount(uint32 Team)
{
- if(Team == ALLIANCE)
+ if (Team == ALLIANCE)
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
else
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
@@ -318,14 +318,14 @@ void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
{
UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 0);
- if(Team == ALLIANCE)
+ if (Team == ALLIANCE)
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1);
else
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 1);
}
else
{
- if(Team == ALLIANCE)
+ if (Team == ALLIANCE)
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0);
else
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 0);
@@ -350,15 +350,15 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
for (int j = EY_POINTS_MAX; j >= 0; --j)
{
for(int i = 0; i < m_PlayersNearPoint[j].size(); ++i)
- if(m_PlayersNearPoint[j][i] == guid)
+ if (m_PlayersNearPoint[j][i] == guid)
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
}
- if(IsFlagPickedup())
+ if (IsFlagPickedup())
{
- if(m_FlagKeeper == guid)
+ if (m_FlagKeeper == guid)
{
- if(plr)
- this->EventPlayerDroppedFlag(plr);
+ if (plr)
+ EventPlayerDroppedFlag(plr);
else
{
SetFlagPicker(0);
@@ -370,7 +370,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
if(!Source->isAlive()) //hack code, must be removed later
@@ -379,23 +379,23 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
switch(Trigger)
{
case TR_BLOOD_ELF_POINT:
- if(m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
- if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
+ if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF);
break;
case TR_FEL_REALVER_POINT:
- if(m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
- if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
+ if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REALVER);
break;
case TR_MAGE_TOWER_POINT:
- if(m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
- if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
+ if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER);
break;
case TR_DRAENEI_RUINS_POINT:
- if(m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
- if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
+ if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
+ if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
break;
case 4512:
@@ -419,7 +419,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
bool BattleGroundEY::SetupBattleGround()
{
// doors
- if( !AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
+ if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY)
// banners (alliance)
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
@@ -481,12 +481,12 @@ bool BattleGroundEY::SetupBattleGround()
for (int i = 0; i < EY_POINTS_MAX; ++i)
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
- if( !at )
+ if (!at)
{
sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
continue;
}
- if ( !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
+ if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
)
@@ -495,14 +495,14 @@ bool BattleGroundEY::SetupBattleGround()
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
- if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE) )
+ if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
- if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE) )
+ if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
return false;
@@ -552,7 +552,7 @@ void BattleGroundEY::RespawnFlag(bool send_message)
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY);
- if(send_message)
+ if (send_message)
{
SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound...
@@ -566,7 +566,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
RespawnFlag(true);
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID());
- if(obj)
+ if (obj)
obj->Delete();
else
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
@@ -576,7 +576,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
BattleGround::HandleKillPlayer(player, killer);
@@ -585,11 +585,11 @@ void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
{
// if not running, do not cast things at the dropper player, neither send unnecessary messages
// just take off the aura
- if(IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
+ if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
{
SetFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
@@ -597,10 +597,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
return;
}
- if(!IsFlagPickedup())
+ if (!IsFlagPickedup())
return;
- if(GetFlagPickerGUID() != Source->GetGUID())
+ if (GetFlagPickerGUID() != Source->GetGUID())
return;
SetFlagPicker(0);
@@ -613,7 +613,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
else
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
@@ -621,10 +621,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
- if(GetStatus() != STATUS_IN_PROGRESS || this->IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
+ if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
return;
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
@@ -645,7 +645,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
else
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
@@ -653,13 +653,13 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
//Natural point
uint32 Team = m_PointOwnedByTeam[Point];
- if(!Team)
+ if (!Team)
return;
if (Team == ALLIANCE)
@@ -697,7 +697,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 Team = Source->GetTeam();
@@ -731,12 +731,12 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
else
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
- if(m_BgCreatures[Point])
+ if (m_BgCreatures[Point])
DelCreature(Point);
WorldSafeLocsEntry const *sg = NULL;
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
- if(!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
+ if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
@@ -748,7 +748,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
{
- if(GetStatus() != STATUS_IN_PROGRESS || this->GetFlagPickerGUID() != Source->GetGUID())
+ if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
return;
SetFlagPicker(0);
@@ -757,7 +757,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
else
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
@@ -768,7 +768,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
m_FlagCapturedBgObjectType = BgObjectType;
uint8 team_id = 0;
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
team_id = BG_TEAM_ALLIANCE;
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
@@ -779,7 +779,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
}
- if(m_TeamPointsCount[team_id] > 0)
+ if (m_TeamPointsCount[team_id] > 0)
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
@@ -871,7 +871,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
entry = sWorldSafeLocsStore.LookupEntry(g_id);
nearestEntry = entry;
- if(!entry)
+ if (!entry)
{
sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!");
return NULL;
@@ -887,15 +887,15 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
{
- if(m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
+ if (m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
- if(!entry)
+ if (!entry)
sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
else
{
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
- if(distance < nearestDistance)
+ if (distance < nearestDistance)
{
nearestDistance = distance;
nearestEntry = entry;
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index f3be835e0f2..6e94a8c8a9f 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -43,7 +43,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
- if(!unit)
+ if (!unit)
return;
if(!unit->isBattleMaster()) // it's not battlemaster
@@ -54,7 +54,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
- if(!_player->GetBGAccessByLevel(bgTypeId))
+ if (!_player->GetBGAccessByLevel(bgTypeId))
{
// temp, must be gossip message...
SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
@@ -87,7 +87,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
recv_data >> instanceId; // instance id, 0 if First Available selected
recv_data >> joinAsGroup; // join as group
- if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
+ if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow());
return;
@@ -101,11 +101,11 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
// ignore if player is already in BG
- if(_player->InBattleGround())
+ if (_player->InBattleGround())
return;
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
- if(!unit)
+ if (!unit)
return;
if(!unit->isBattleMaster()) // it's not battlemaster
@@ -113,20 +113,20 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
// get bg instance or bg template if instance not found
BattleGround * bg = NULL;
- if(instanceId)
+ if (instanceId)
BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
- if(!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
+ if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
{
sLog.outError("Battleground: no available bg / template found");
return;
}
// check queueing conditions
- if(!joinAsGroup)
+ if (!joinAsGroup)
{
// check Deserter debuff
- if( !_player->CanJoinToBattleground() )
+ if (!_player->CanJoinToBattleground())
{
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
data << uint32(0xFFFFFFFE);
@@ -138,14 +138,14 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
//player is already in this queue
return;
// check if has free queue slots
- if(!_player->HasFreeBattleGroundQueueId())
+ if (!_player->HasFreeBattleGroundQueueId())
return;
}
else
{
grp = _player->GetGroup();
// no group found, error
- if(!grp)
+ if (!grp)
return;
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
@@ -160,7 +160,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
// _player->GetGroup() was already checked, grp is already initialized
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0);
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
- if(joinAsGroup /* && _player->GetGroup()*/)
+ if (joinAsGroup /* && _player->GetGroup()*/)
{
sLog.outDebug("Battleground: the following players are joining as group:");
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
@@ -200,7 +200,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
}
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
- if(!ginfo->IsInvitedToBGInstanceGUID)
+ if (!ginfo->IsInvitedToBGInstanceGUID)
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
}
@@ -213,40 +213,62 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
if(!bg) // can't be received if player not in battleground
return;
- if(bg->GetTypeID() == BATTLEGROUND_WS)
+ switch( bg->GetTypeID() )
{
- uint32 count1 = 0;
- uint32 count2 = 0;
+ case BATTLEGROUND_WS:
+ {
+ uint32 count1 = 0; //always constant zero?
+ uint32 count2 = 0; //count of next fields
- Player *ap = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
- if(ap) ++count2;
+ Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
+ if (ali_plr)
+ ++count2;
- Player *hp = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
- if(hp) ++count2;
+ Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
+ if (horde_plr)
+ ++count2;
- WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
- data << count1; // alliance flag holders count
- /*for(uint8 i = 0; i < count1; i++)
- {
- data << uint64(0); // guid
- data << (float)0; // x
- data << (float)0; // y
- }*/
- data << count2; // horde flag holders count
- if(ap)
- {
- data << (uint64)ap->GetGUID();
- data << (float)ap->GetPositionX();
- data << (float)ap->GetPositionY();
- }
- if(hp)
- {
- data << (uint64)hp->GetGUID();
- data << (float)hp->GetPositionX();
- data << (float)hp->GetPositionY();
- }
+ WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
+ data << count1; // alliance flag holders count - obsolete, now always 0
+ /*for(uint8 i = 0; i < count1; i++)
+ {
+ data << uint64(0); // guid
+ data << (float)0; // x
+ data << (float)0; // y
+ }*/
+ data << count2; // horde flag holders count - obsolete, now count of next fields
+ if (ali_plr)
+ {
+ data << (uint64)ali_plr->GetGUID();
+ data << (float)ali_plr->GetPositionX();
+ data << (float)ali_plr->GetPositionY();
+ }
+ if (horde_plr)
+ {
+ data << (uint64)horde_plr->GetGUID();
+ data << (float)horde_plr->GetPositionX();
+ data << (float)horde_plr->GetPositionY();
+ }
- SendPacket(&data);
+ SendPacket(&data);
+ }
+ break;
+ case BATTLEGROUND_EY:
+ //TODO : fix me!
+ break;
+ case BATTLEGROUND_AB:
+ case BATTLEGROUND_AV:
+ {
+ //for other BG types - send default
+ WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4));
+ data << uint32(0);
+ data << uint32(0);
+ SendPacket(&data);
+ }
+ break;
+ default:
+ //maybe it is sent also in arena - do nothing
+ break;
}
}
@@ -255,7 +277,7 @@ void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data
sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message");
BattleGround *bg = _player->GetBattleGround();
- if(!bg)
+ if (!bg)
return;
WorldPacket data;
@@ -275,7 +297,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
recv_data >> bgTypeId; // id from DBC
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
- if(!bl)
+ if (!bl)
{
sLog.outError("Battleground: invalid bgtype received.");
return;
@@ -301,25 +323,25 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
- if( !sBattlemasterListStore.LookupEntry(bgTypeId_) )
+ if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
{
sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_);
// update battleground slots for the player to fix his UI and sent data.
// this is a HACK, I don't know why the client starts sending invalid packets in the first place.
// it usually happens with extremely high latency (if debugging / stepping in the code for example)
- if( _player->InBattleGroundQueue() )
+ if (_player->InBattleGroundQueue())
{
// update all queues, send invitation info if player is invited, queue info if queued
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
{
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
- if( !bgQueueTypeId )
+ if (!bgQueueTypeId)
continue;
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
// if the player is not in queue, continue or no group information - this should never happen
- if( itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo )
+ if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo)
continue;
BattleGround * bg = NULL;
@@ -328,7 +350,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
uint8 status = 0;
- if( !itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
+ if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
{
// not invited to bg, get template
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
@@ -342,7 +364,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
}
// if bg not found, then continue, don't invite if already in the instance
- if( !bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()) )
+ if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()))
continue;
// re - invite player with proper data
@@ -359,7 +381,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
- if( itrPlayerStatus == qpMap.end() )
+ if (itrPlayerStatus == qpMap.end())
{
sLog.outError("Battleground: itrplayerstatus not found.");
return;
@@ -367,7 +389,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID;
// if action == 1, then instanceId is required
- if( !instanceId && action == 1 )
+ if (!instanceId && action == 1)
{
sLog.outError("Battleground: instance not found.");
return;
@@ -376,15 +398,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId);
// bg template might and must be used in case of leaving queue, when instance is not created yet
- if( !bg && action == 0 )
+ if (!bg && action == 0)
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
- if( !bg )
+ if (!bg)
{
sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId);
return;
}
- if( _player->InBattleGroundQueue() )
+ if (_player->InBattleGroundQueue())
{
//we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function!
uint32 team = itrPlayerStatus->second.GroupInfo->Team;
@@ -394,10 +416,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating;
//some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it
- if( action == 1 && arenaType == 0)
+ if (action == 1 && arenaType == 0)
{
//if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue
- if( !_player->CanJoinToBattleground() )
+ if (!_player->CanJoinToBattleground())
{
//send bg command result to show nice message
WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
@@ -407,7 +429,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
}
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
- if( _player->getLevel() > bg->GetMaxLevel() )
+ if (_player->getLevel() > bg->GetMaxLevel())
{
sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
action = 0;
@@ -418,16 +440,16 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
switch( action )
{
case 1: // port to battleground
- if( !_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId) )
+ if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
return; // cheating?
// resurrect the player
- if( !_player->isAlive() )
+ if (!_player->isAlive())
{
_player->ResurrectPlayer(1.0f);
_player->SpawnCorpseBones();
}
// stop taxi flight at port
- if(_player->isInFlight())
+ if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->m_taxi.ClearTaxiDestinations();
@@ -439,7 +461,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), false);
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
- if( BattleGround *currentBg = _player->GetBattleGround() )
+ if (BattleGround *currentBg = _player->GetBattleGround())
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
// set the destination instance id
@@ -454,10 +476,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
break;
case 0: // leave queue
// if player leaves rated arena match before match start, it is counted as he played but he lost
- if( isRated )
+ if (isRated)
{
ArenaTeam * at = objmgr.GetArenaTeamById(team);
- if( at )
+ if (at)
{
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating);
at->MemberLost(_player, opponentsRating);
@@ -468,7 +490,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true);
// player left queue, we should update it - do not update Arena Queue
- if( !arenaType )
+ if (!arenaType)
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenaType, isRated, rating);
SendPacket(&data);
sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
@@ -496,9 +518,9 @@ void WorldSession::HandleBattleGroundLeaveOpcode( WorldPacket & /*recv_data*/ )
// return;
// not allow leave battleground in combat
- if(_player->isInCombat())
- if(BattleGround* bg = _player->GetBattleGround())
- if(bg->GetStatus() != STATUS_WAIT_LEAVE)
+ if (_player->isInCombat())
+ if (BattleGround* bg = _player->GetBattleGround())
+ if (bg->GetStatus() != STATUS_WAIT_LEAVE)
return;
_player->LeaveBattleground();
@@ -515,16 +537,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
{
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
- if( !bgQueueTypeId )
+ if (!bgQueueTypeId)
continue;
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
- if( bgTypeId == _player->GetBattleGroundTypeId() )
+ if (bgTypeId == _player->GetBattleGroundTypeId())
{
bg = _player->GetBattleGround();
//i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
//so i must use bg pointer to get that information
- if( bg && bg->GetArenaType() == arenaType )
+ if (bg && bg->GetArenaType() == arenaType)
{
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
// send status in BattleGround
@@ -537,12 +559,12 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
//get GroupQueueInfo for queue status
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
- if( itrPlayerStatus == qpMap.end() )
+ if (itrPlayerStatus == qpMap.end())
continue;
- if( itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
+ if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
{
bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
- if( !bg )
+ if (!bg)
continue;
uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime);
// send status invited to BattleGround
@@ -552,7 +574,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
else
{
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
- if( !bg )
+ if (!bg)
continue;
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
// send status in BattleGround Queue
@@ -569,14 +591,14 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
CHECK_PACKET_SIZE(recv_data, 8);
BattleGround *bg = _player->GetBattleGround();
- if(!bg)
+ if (!bg)
return;
uint64 guid;
recv_data >> guid;
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
- if(!unit)
+ if (!unit)
return;
if(!unit->isSpiritService()) // it's not spirit service
@@ -592,14 +614,14 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
CHECK_PACKET_SIZE(recv_data, 8);
BattleGround *bg = _player->GetBattleGround();
- if(!bg)
+ if (!bg)
return;
uint64 guid;
recv_data >> guid;
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
- if(!unit)
+ if (!unit)
return;
if(!unit->isSpiritService()) // it's not spirit service
@@ -616,7 +638,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
recv_data.hexlike();
// ignore if we already in BG or BG queue
- if(_player->InBattleGround())
+ if (_player->InBattleGround())
return;
uint64 guid; // arena Battlemaster guid
@@ -628,7 +650,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
recv_data >> guid >> arenaslot >> asGroup >> isRated;
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
- if(!unit)
+ if (!unit)
return;
if(!unit->isBattleMaster()) // it's not battle master
@@ -655,7 +677,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
//check existance
BattleGround* bg = NULL;
- if( !(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)) )
+ if (!(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)))
{
sLog.outError("Battleground: template bg (all arenas) not found");
return;
@@ -665,21 +687,21 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
// check queueing conditions
- if(!asGroup)
+ if (!asGroup)
{
// check if already in queue
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
//player is already in this queue
return;
// check if has free queue slots
- if(!_player->HasFreeBattleGroundQueueId())
+ if (!_player->HasFreeBattleGroundQueueId())
return;
}
else
{
grp = _player->GetGroup();
// no group found, error
- if(!grp)
+ if (!grp)
return;
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
if (err != BG_JOIN_ERR_OK)
@@ -691,12 +713,12 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
uint32 ateamId = 0;
- if(isRated)
+ if (isRated)
{
ateamId = _player->GetArenaTeamId(arenaslot);
// check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
ArenaTeam * at = objmgr.GetArenaTeamById(ateamId);
- if(!at)
+ if (!at)
{
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
return;
@@ -714,20 +736,20 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
}
- if( arenatype )
+ if (arenatype)
avg_pers_rating /= arenatype;
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
- if(avg_pers_rating + 150 < arenaRating)
+ if (avg_pers_rating + 150 < arenaRating)
arenaRating = avg_pers_rating;
}
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId);
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
- if(asGroup)
+ if (asGroup)
{
sLog.outDebug("Battleground: arena join as group start");
- if(isRated)
+ if (isRated)
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -749,7 +771,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
}
sLog.outDebug("Battleground: arena join as group end");
- if(isRated)
+ if (isRated)
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
}
else
@@ -777,7 +799,7 @@ void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data )
recv_data >> playerGuid;
Player *reportedPlayer = objmgr.GetPlayer(playerGuid);
- if(!reportedPlayer)
+ if (!reportedPlayer)
{
sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: player not found");
return;
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index b3c21d6cb7d..6b7b3c99fe0 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -102,7 +102,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
GroupsQueueType::iterator groupToKick = SelectedGroups.begin();
for (GroupsQueueType::iterator itr = groupToKick; itr != SelectedGroups.end(); ++itr)
{
- if( abs((int32)((*itr)->Players.size() - size)) <= 1 )
+ if (abs((int32)((*itr)->Players.size() - size)) <= 1)
{
groupToKick = itr;
found = true;
@@ -111,7 +111,7 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
groupToKick = itr;
}
//if pool is empty, do nothing
- if( GetPlayerCount() )
+ if (GetPlayerCount())
{
//update player count
GroupQueueInfo* ginfo = (*groupToKick);
@@ -131,14 +131,14 @@ bool BattleGroundQueue::SelectionPool::KickGroup(uint32 size)
bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount)
{
//if group is larger than desired count - don't allow to add it to pool
- if( !ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size() )
+ if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size())
{
SelectedGroups.push_back(ginfo);
// increase selected players count
PlayerCount += ginfo->Players.size();
return true;
}
- if( PlayerCount < desiredCount )
+ if (PlayerCount < desiredCount)
return true;
return false;
}
@@ -171,9 +171,9 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId
//compute index (if group is premade or joined a rated match) to queues
uint32 index = 0;
- if(!isRated && !isPremade)
+ if (!isRated && !isPremade)
index += BG_TEAMS_COUNT;
- if(ginfo->Team == HORDE)
+ if (ginfo->Team == HORDE)
index++;
sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index);
@@ -199,14 +199,14 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
{
uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime());
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
- if( !ginfo->ArenaType )
+ if (!ginfo->ArenaType)
{
- if( ginfo->Team == HORDE )
+ if (ginfo->Team == HORDE)
team_index = BG_TEAM_HORDE;
}
else
{
- if( ginfo->IsRated )
+ if (ginfo->IsRated)
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
}
@@ -226,18 +226,18 @@ void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* g
uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id)
{
uint8 team_index = BG_TEAM_ALLIANCE; //default set to BG_TEAM_ALLIANCE - or non rated arenas!
- if( !ginfo->ArenaType )
+ if (!ginfo->ArenaType)
{
- if( ginfo->Team == HORDE )
+ if (ginfo->Team == HORDE)
team_index = BG_TEAM_HORDE;
}
else
{
- if( ginfo->IsRated )
+ if (ginfo->IsRated)
team_index = BG_TEAM_HORDE; //for rated arenas use BG_TEAM_HORDE
}
//check if there is enought values(we always add values > 0)
- if(m_WaitTimes[team_index][queue_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
+ if (m_WaitTimes[team_index][queue_id][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME - 1] )
return (m_SumOfWaitTimes[team_index][queue_id] / COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME);
else
//if there aren't enough values return 0 - not available
@@ -254,7 +254,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
//remove player from map, if he's there
itr = m_QueuedPlayers.find(guid);
- if( itr == m_QueuedPlayers.end() )
+ if (itr == m_QueuedPlayers.end())
{
sLog.outError("BattleGroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid));
return;
@@ -275,7 +275,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
{
for(group_itr_tmp = m_QueuedGroups[queue_id_tmp][j].begin(); group_itr_tmp != m_QueuedGroups[queue_id_tmp][j].end(); ++group_itr_tmp)
{
- if( (*group_itr_tmp) == group )
+ if ((*group_itr_tmp) == group)
{
queue_id = queue_id_tmp;
group_itr = group_itr_tmp;
@@ -287,7 +287,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
}
}
//player can't be in queue without group, but just in case
- if( queue_id == -1 )
+ if (queue_id == -1)
{
sLog.outError("BattleGroundQueue: ERROR Cannot find groupinfo for player GUID: %u", GUID_LOPART(guid));
return;
@@ -301,14 +301,14 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
// remove player queue info from group queue info
std::map<uint64, PlayerQueueInfo*>::iterator pitr = group->Players.find(guid);
- if( pitr != group->Players.end() )
+ if (pitr != group->Players.end())
group->Players.erase(pitr);
// if invited to bg, and should decrease invited count, then do it
- if( decreaseInvitedCount && group->IsInvitedToBGInstanceGUID )
+ if (decreaseInvitedCount && group->IsInvitedToBGInstanceGUID)
{
BattleGround* bg = sBattleGroundMgr.GetBattleGround(group->IsInvitedToBGInstanceGUID, group->BgTypeId);
- if( bg )
+ if (bg)
bg->DecreaseInvitedCount(group->Team);
}
@@ -316,18 +316,18 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
m_QueuedPlayers.erase(itr);
//if we left BG queue(not porting) OR if arena team left queue for rated match
- if( (decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()) )
+ if ((decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty()))
AnnounceWorld(group, guid, false);
//if player leaves queue and he is invited to rated arena match, then he have to loose
- if( group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount )
+ if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
{
ArenaTeam * at = objmgr.GetArenaTeamById(group->ArenaTeamId);
- if( at )
+ if (at)
{
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
Player *plr = objmgr.GetPlayer(guid);
- if( plr )
+ if (plr)
at->MemberLost(plr, group->OpponentsTeamRating);
else
at->OfflineMemberLost(guid, group->OpponentsTeamRating);
@@ -336,7 +336,7 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
}
// remove group queue info if needed
- if( group->Players.empty() )
+ if (group->Players.empty())
{
m_QueuedGroups[queue_id][index].erase(group_itr);
delete group;
@@ -344,11 +344,11 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou
// if group wasn't empty, so it wasn't deleted, and player have left a rated
// queue -> everyone from the group should leave too
// don't remove recursively if already invited to bg!
- else if( !group->IsInvitedToBGInstanceGUID && group->IsRated )
+ else if (!group->IsInvitedToBGInstanceGUID && group->IsRated)
{
// remove next player, this is recursive
// first send removal information
- if(Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
+ if (Player *plr2 = objmgr.GetPlayer(group->Players.begin()->first))
{
BattleGround * bg = sBattleGroundMgr.GetBattleGroundTemplate(group->BgTypeId);
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType);
@@ -369,14 +369,14 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
{
if(ginfo->ArenaType) //if Arena
{
- if( sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE) && ginfo->IsRated )
+ if (sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE) && ginfo->IsRated)
{
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId);
- if(!bg)
+ if (!bg)
return;
char const* bgName = bg->GetName();
- if(isAddedToQueue)
+ if (isAddedToQueue)
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
else
sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating);
@@ -384,11 +384,11 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
}
else //if BG
{
- if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
+ if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
{
Player *plr = objmgr.GetPlayer(playerGUID);
BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId);
- if(!bg || !plr)
+ if (!bg || !plr)
return;
BGQueueIdBasedOnLevel queue_id = plr->GetBattleGroundQueueIdFromLevel(bg->GetTypeID());
@@ -399,14 +399,14 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
uint32 q_min_level = (queue_id + 1) * 10;
GroupsQueueType::const_iterator itr;
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr)
- if( !(*itr)->IsInvitedToBGInstanceGUID )
+ if (!(*itr)->IsInvitedToBGInstanceGUID)
qAlliance += (*itr)->Players.size();
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].end(); ++itr)
- if( !(*itr)->IsInvitedToBGInstanceGUID )
+ if (!(*itr)->IsInvitedToBGInstanceGUID)
qHorde += (*itr)->Players.size();
// Show queue status to player only (when joining queue)
- if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY) )
+ if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY))
{
ChatHandler(plr).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF,
bgName, q_min_level, q_min_level + 10, qAlliance, MinPlayers, qHorde, MinPlayers);
@@ -424,29 +424,48 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe
bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side)
{
// set side if needed
- if( side )
+ if (side)
ginfo->Team = side;
- if( !ginfo->IsInvitedToBGInstanceGUID )
+ if (!ginfo->IsInvitedToBGInstanceGUID)
{
// not yet invited
// set invitation
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
- BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
+ BattleGroundTypeId bgTypeId = bg->GetTypeID();
+ BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, bg->GetArenaType());
BGQueueIdBasedOnLevel queue_id = bg->GetQueueId();
+
+ // set ArenaTeamId for rated matches
+ if (bg->isArena() && bg->isRated())
+ bg->SetArenaTeamIdForTeam(ginfo->Team, ginfo->ArenaTeamId);
+
+ ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
+
// loop through the players
for(std::map<uint64,PlayerQueueInfo*>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
{
// get the player
Player* plr = objmgr.GetPlayer(itr->first);
// if offline, skip him, this should not happen - player is removed from queue when he logs out
- if( !plr )
+ if (!plr)
continue;
// invite the player
PlayerInvitedToBGUpdateAverageWaitTime(ginfo, queue_id);
- ginfo->RemoveInviteTime = getMSTime() + INVITE_ACCEPT_WAIT_TIME;
- sBattleGroundMgr.InvitePlayer(plr, bg->GetInstanceID(), bg->GetTypeID(), ginfo->Team);
+ //sBattleGroundMgr.InvitePlayer(plr, bg, ginfo->Team);
+
+ // set invited player counters
+ bg->IncreaseInvitedCount(ginfo->Team);
+
+ plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID);
+
+ // create remind invite events
+ BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime);
+ plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
+ // create automatic remove events
+ BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime);
+ plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
WorldPacket data;
@@ -464,63 +483,6 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
return false;
}
-// used to remove the Enter Battle window if the battle has already ended, but someone still has it
-// (this can happen in arenas mainly, since the preparation is shorter than the timer for the bgqueueremove event
-void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg)
-{
- BGQueueIdBasedOnLevel queue_id = bg->GetQueueId();
- uint32 bgInstanceId = bg->GetInstanceID();
- BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
- GroupsQueueType::iterator itr, next;
- for(uint32 i = 0; i < BG_QUEUE_GROUP_TYPES_COUNT; i++)
- {
- itr = m_QueuedGroups[queue_id][i].begin();
- next = itr;
- while (next != m_QueuedGroups[queue_id][i].end())
- {
- // must do this way, because the groupinfo will be deleted when all playerinfos are removed
- itr = next;
- ++next;
- GroupQueueInfo * ginfo = (*itr);
- // if group was invited to this bg instance, then remove all references
- if( ginfo->IsInvitedToBGInstanceGUID == bgInstanceId )
- {
- // after removing this much playerinfos, the ginfo will be deleted, so we'll use a for loop
- uint32 to_remove = ginfo->Players.size();
- for(uint32 j = 0; j < to_remove; j++)
- {
- // always remove the first one in the group
- std::map<uint64, PlayerQueueInfo * >::iterator itr2 = ginfo->Players.begin();
- if( itr2 == ginfo->Players.end() )
- {
- sLog.outError("Empty Players in ginfo, this should never happen!");
- return;
- }
- // get the player
- Player * plr = objmgr.GetPlayer(itr2->first);
- if( !plr )
- {
- sLog.outError("Player offline when trying to remove from GroupQueueInfo, this should never happen.");
- continue;
- }
-
- // get the queueslot
- uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
- if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
- {
- plr->RemoveBattleGroundQueueId(bgQueueTypeId);
- // remove player from queue, this might delete the ginfo as well! don't use that pointer after this!
- RemovePlayer(itr2->first, true);
- WorldPacket data;
- sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
- plr->GetSession()->SendPacket(&data);
- }
- }
- }
- }
- }
-}
-
/*
This function is inviting players to already running battlegrounds
Invitation type is based on config file
@@ -564,18 +526,18 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
while( abs(diffAli - diffHorde) > 1 && (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() > 0 || m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() > 0) )
{
//each cycle execution we need to kick at least 1 group
- if( diffAli < diffHorde )
+ if (diffAli < diffHorde)
{
//kick alliance group, add to pool new group if needed
- if( m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli) )
+ if (m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffHorde - diffAli))
{
for (; aliIndex < aliCount && m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*Ali_itr), (aliFree >= diffHorde) ? aliFree - diffHorde : 0); aliIndex++)
++Ali_itr;
}
//if ali selection is already empty, then kick horde group, but if there are less horde than ali in bg - break;
- if( !m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
+ if (!m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
{
- if( aliFree <= diffHorde + 1 )
+ if (aliFree <= diffHorde + 1)
break;
m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffHorde - diffAli);
}
@@ -583,14 +545,14 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
else
{
//kick horde group, add to pool new group if needed
- if( m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde) )
+ if (m_SelectionPools[BG_TEAM_HORDE].KickGroup(diffAli - diffHorde))
{
for (; hordeIndex < hordeCount && m_SelectionPools[BG_TEAM_HORDE].AddGroup((*Horde_itr), (hordeFree >= diffAli) ? hordeFree - diffAli : 0); hordeIndex++)
++Horde_itr;
}
- if( !m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
+ if (!m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
{
- if( hordeFree <= diffAli + 1 )
+ if (hordeFree <= diffAli + 1)
break;
m_SelectionPools[BG_TEAM_ALLIANCE].KickGroup(diffAli - diffHorde);
}
@@ -607,19 +569,19 @@ void BattleGroundQueue::FillPlayersToBG(BattleGround* bg, BGQueueIdBasedOnLevel
bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam)
{
//check match
- if(!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
+ if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
{
//start premade match
//if groups aren't invited
GroupsQueueType::const_iterator ali_group, horde_group;
for( ali_group = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group)
- if( !(*ali_group)->IsInvitedToBGInstanceGUID )
+ if (!(*ali_group)->IsInvitedToBGInstanceGUID)
break;
for( horde_group = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group)
- if( !(*horde_group)->IsInvitedToBGInstanceGUID )
+ if (!(*horde_group)->IsInvitedToBGInstanceGUID)
break;
- if( ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end())
+ if (ali_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].end())
{
m_SelectionPools[BG_TEAM_ALLIANCE].AddGroup((*ali_group), MaxPlayersPerTeam);
m_SelectionPools[BG_TEAM_HORDE].AddGroup((*horde_group), MaxPlayersPerTeam);
@@ -631,7 +593,7 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++itr)
{
//if itr can join BG and player count is less that maxPlayers, then add group to selectionpool
- if( !(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers) )
+ if (!(*itr)->IsInvitedToBGInstanceGUID && !m_SelectionPools[i].AddGroup((*itr), maxPlayers))
break;
}
}
@@ -646,10 +608,10 @@ bool BattleGroundQueue::CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32
uint32 time_before = getMSTime() - sWorld.getConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
for(uint32 i = 0; i < BG_TEAMS_COUNT; i++)
{
- if(!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
+ if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
{
GroupsQueueType::iterator itr = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE + i].begin();
- if(!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam))
+ if (!(*itr)->IsInvitedToBGInstanceGUID && ((*itr)->JoinTime < time_before || (*itr)->Players.size() < MinPlayersPerTeam))
{
//we must insert group to normal queue and erase pointer from premade queue
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].push_front((*itr));
@@ -670,17 +632,17 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
itr_team[i] = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].begin();
for(; itr_team[i] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + i].end(); ++(itr_team[i]))
{
- if( !(*(itr_team[i]))->IsInvitedToBGInstanceGUID )
+ if (!(*(itr_team[i]))->IsInvitedToBGInstanceGUID)
{
m_SelectionPools[i].AddGroup(*(itr_team[i]), maxPlayers);
- if( m_SelectionPools[i].GetPlayerCount() >= minPlayers )
+ if (m_SelectionPools[i].GetPlayerCount() >= minPlayers)
break;
}
}
}
//try to invite same number of players - this cycle may cause longer wait time even if there are enough players in queue, but we want ballanced bg
uint32 j = BG_TEAM_ALLIANCE;
- if( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
+ if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
j = BG_TEAM_HORDE;
if( sWorld.getConfig(CONFIG_BATTLEGROUND_INVITATION_TYPE) != 0
&& m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers )
@@ -689,16 +651,16 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
++(itr_team[j]); //this will not cause a crash, because for cycle above reached break;
for(; itr_team[j] != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + j].end(); ++(itr_team[j]))
{
- if( !(*(itr_team[j]))->IsInvitedToBGInstanceGUID )
- if( !m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()) )
+ if (!(*(itr_team[j]))->IsInvitedToBGInstanceGUID)
+ if (!m_SelectionPools[j].AddGroup(*(itr_team[j]), m_SelectionPools[(j + 1) % BG_TEAMS_COUNT].GetPlayerCount()))
break;
}
// do not allow to start bg with more than 2 players more on 1 faction
- if( abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2 )
+ if (abs((int32)(m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() - m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())) > 2)
return false;
}
//allow 1v0 if debug bg
- if( sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()) )
+ if (sBattleGroundMgr.isTesting() && bg_template->isBattleGround() && (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount()))
return true;
//return true if there are enough players in selection pools - enable to work .debug bg command correctly
return m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() >= minPlayers && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() >= minPlayers;
@@ -707,12 +669,12 @@ bool BattleGroundQueue::CheckNormalMatch(BattleGround* bg_template, BGQueueIdBas
// this method will check if we can invite players to same faction skirmish match
bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_id, uint32 minPlayersPerTeam)
{
- if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam )
+ if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() < minPlayersPerTeam && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() < minPlayersPerTeam)
return false;
uint32 teamIndex = BG_TEAM_ALLIANCE;
uint32 otherTeam = BG_TEAM_HORDE;
uint32 otherTeamId = HORDE;
- if ( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
+ if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == minPlayersPerTeam )
{
teamIndex = BG_TEAM_HORDE;
otherTeam = BG_TEAM_ALLIANCE;
@@ -725,9 +687,9 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
//set itr_team to group that was added to selection pool latest
GroupsQueueType::iterator itr_team = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].begin();
for(; itr_team != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team)
- if( ginfo == *itr_team )
+ if (ginfo == *itr_team)
break;
- if( itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end() )
+ if (itr_team == m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end())
return false;
GroupsQueueType::iterator itr_team2 = itr_team;
++itr_team2;
@@ -735,10 +697,10 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
for(; itr_team2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr_team2)
{
//if selection pool is full then break;
- if( !(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam) )
+ if (!(*itr_team2)->IsInvitedToBGInstanceGUID && !m_SelectionPools[otherTeam].AddGroup(*itr_team2, minPlayersPerTeam))
break;
}
- if( m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam )
+ if (m_SelectionPools[otherTeam].GetPlayerCount() != minPlayersPerTeam)
return false;
//here we have correct 2 selections and we need to change one teams team and move selection pool teams to other team's queue
@@ -753,7 +715,7 @@ bool BattleGroundQueue::CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_
++itr2;
for(; itr2 != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].end(); ++itr2)
{
- if( *itr2 == *itr )
+ if (*itr2 == *itr)
{
m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE + teamIndex].erase(itr2);
break;
@@ -806,7 +768,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
for(GroupsQueueType::const_iterator itr = m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.begin(); itr != m_SelectionPools[BG_TEAM_HORDE].SelectedGroups.end(); ++itr)
InviteGroupToBG((*itr), bg, (*itr)->Team);
- if( !bg->HasFreeSlots() )
+ if (!bg->HasFreeSlots())
{
// remove BG from BGFreeSlotQueue
bg->RemoveFromBGFreeSlotQueue();
@@ -817,7 +779,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
// finished iterating through the bgs with free slots, maybe we need to create a new bg
BattleGround * bg_template = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
- if( !bg_template )
+ if (!bg_template)
{
sLog.outError("Battleground: Update: bg template not found for %u", bgTypeId);
return;
@@ -825,11 +787,11 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
// get the min. players per team, properly for larger arenas as well. (must have full teams for arena matches!)
uint32 MinPlayersPerTeam = bg_template->GetMinPlayersPerTeam();
uint32 MaxPlayersPerTeam = bg_template->GetMaxPlayersPerTeam();
- if( sBattleGroundMgr.isTesting() )
+ if (sBattleGroundMgr.isTesting())
MinPlayersPerTeam = 1;
- if( bg_template->isArena() )
+ if (bg_template->isArena())
{
- if( sBattleGroundMgr.isArenaTesting() )
+ if (sBattleGroundMgr.isArenaTesting())
{
MaxPlayersPerTeam = 1;
MinPlayersPerTeam = 1;
@@ -860,14 +822,14 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
m_SelectionPools[BG_TEAM_ALLIANCE].Init();
m_SelectionPools[BG_TEAM_HORDE].Init();
- if( bg_template->isBattleGround() )
+ if (bg_template->isBattleGround())
{
//check if there is premade against premade match
- if( CheckPremadeMatch(queue_id, MinPlayersPerTeam, MaxPlayersPerTeam) )
+ if (CheckPremadeMatch(queue_id, MinPlayersPerTeam, MaxPlayersPerTeam))
{
//create new battleground
BattleGround * bg2 = NULL;
- if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, 0, false)) )
+ if (!(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, 0, false)))
{
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
@@ -885,15 +847,15 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
}
// now check if there are in queues enough players to start new game of (normal battleground, or non-rated arena)
- if( !isRated )
+ if (!isRated)
{
// if there are enough players in pools, start new battleground or non rated arena
- if( CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam, MaxPlayersPerTeam)
+ if (CheckNormalMatch(bg_template, queue_id, MinPlayersPerTeam, MaxPlayersPerTeam)
|| (bg_template->isArena() && CheckSkirmishForSameFaction(queue_id, MinPlayersPerTeam)) )
{
// we successfully created a pool
BattleGround * bg2 = NULL;
- if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, false)) )
+ if (!(bg2 = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, false)))
{
sLog.outError("BattleGroundQueue::Update - Cannot create battleground: %u", bgTypeId);
return;
@@ -907,31 +869,31 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
bg2->StartBattleGround();
}
}
- else if( bg_template->isArena() )
+ else if (bg_template->isArena())
{
// found out the minimum and maximum ratings the newly added team should battle against
// arenaRating is the rating of the latest joined team, or 0
// 0 is on (automatic update call) and we must set it to team's with longest wait time
- if ( !arenaRating )
+ if (!arenaRating )
{
GroupQueueInfo* front1 = NULL;
GroupQueueInfo* front2 = NULL;
- if( !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() )
+ if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty())
{
front1 = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].front();
arenaRating = front1->ArenaTeamRating;
}
- if( !m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty() )
+ if (!m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty())
{
front2 = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].front();
arenaRating = front2->ArenaTeamRating;
}
- if( front1 && front2 )
+ if (front1 && front2)
{
- if( front1->JoinTime < front2->JoinTime )
+ if (front1->JoinTime < front2->JoinTime)
arenaRating = front1->ArenaTeamRating;
}
- else if( !front1 && !front2 )
+ else if (!front1 && !front2)
return; //queues are empty
}
@@ -971,7 +933,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
// if we don't have, we must try to continue search in same queue
// tmp variables are correctly set
// this code isn't much userfriendly - but it is supposed to continue search for mathing group in HORDE queue
- if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
+ if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
{
itr_team[BG_TEAM_ALLIANCE] = itr_team[BG_TEAM_HORDE];
++itr_team[BG_TEAM_ALLIANCE];
@@ -987,7 +949,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
}
}
// this code isn't much userfriendly - but it is supposed to continue search for mathing group in ALLIANCE queue
- if( m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() )
+ if (m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() == 0 && m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount())
{
itr_team[BG_TEAM_HORDE] = itr_team[BG_TEAM_ALLIANCE];
++itr_team[BG_TEAM_HORDE];
@@ -1004,10 +966,10 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
}
//if we have 2 teams, then start new arena and invite players!
- if( m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount() )
+ if (m_SelectionPools[BG_TEAM_ALLIANCE].GetPlayerCount() && m_SelectionPools[BG_TEAM_HORDE].GetPlayerCount())
{
BattleGround* arena = NULL;
- if( !(arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, true)) )
+ if (!(arena = sBattleGroundMgr.CreateNewBattleGround(bgTypeId, queue_id, arenaType, true)))
{
sLog.outError("BattlegroundQueue::Update couldn't create arena instance for rated arena match!");
return;
@@ -1018,7 +980,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
(*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating = (*(itr_team[BG_TEAM_ALLIANCE]))->ArenaTeamRating;
sLog.outDebug("setting oposite teamrating for team %u to %u", (*(itr_team[BG_TEAM_HORDE]))->ArenaTeamId, (*(itr_team[BG_TEAM_HORDE]))->OpponentsTeamRating);
// now we must move team if we changed its faction to another faction queue, because then we will spam log by errors in Queue::RemovePlayer
- if( (*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE )
+ if ((*(itr_team[BG_TEAM_ALLIANCE]))->Team != ALLIANCE)
{
// add to alliance queue
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].push_front(*(itr_team[BG_TEAM_ALLIANCE]));
@@ -1026,7 +988,7 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].erase(itr_team[BG_TEAM_ALLIANCE]);
itr_team[BG_TEAM_ALLIANCE] = m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].begin();
}
- if( (*(itr_team[BG_TEAM_HORDE]))->Team != HORDE )
+ if ((*(itr_team[BG_TEAM_HORDE]))->Team != HORDE)
{
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].push_front(*(itr_team[BG_TEAM_HORDE]));
m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].erase(itr_team[BG_TEAM_HORDE]);
@@ -1050,28 +1012,27 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLeve
bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
-
// player logged off (we should do nothing, he is correctly removed from queue in another procedure)
if (!plr)
return true;
- // Player can be in another BG queue and must be removed in normal way in any case
-
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
+ //if battleground ended and its instance deleted - do nothing
if (!bg)
return true;
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
- if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
+ if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue or in battleground
{
- // check if player is invited to this bg ... this check must be here, because when player leaves queue and joins another, it would cause a problems
+ // check if player is invited to this bg
BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid);
- if (qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
+ if( qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID
+ && qItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime )
{
WorldPacket data;
- //here must be remaining time
+ //we must send remaining time in queue
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, qItr->second.GroupInfo->ArenaType);
plr->GetSession()->SendPacket(&data);
}
@@ -1081,10 +1042,18 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
void BGQueueInviteEvent::Abort(uint64 /*e_time*/)
{
- //this should not be called
- sLog.outError("Battleground invite event ABORTED!");
+ //do nothing
}
+/*
+ this event has many possibilities when it is executed:
+ 1. player is in battleground ( he clicked enter on invitation window )
+ 2. player left battleground queue and he isn't there any more
+ 3. player left battleground queue and he joined it again and IsInvitedToBGInstanceGUID = 0
+ 4. player left queue and he joined again and he has been invited to same battleground again -> we should not remove him from queue yet
+ 5. player is invited to bg and he didn't choose what to do and timer expired - only in this condition we should call queue::RemovePlayer
+ we must remove player in the 5. case even if battleground object doesn't exist!
+*/
bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Player* plr = objmgr.GetPlayer( m_PlayerGuid );
@@ -1093,30 +1062,32 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
return true;
BattleGround* bg = sBattleGroundMgr.GetBattleGround(m_BgInstanceGUID, m_BgTypeId);
- if (!bg)
- return true;
-
- sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
+ //battleground can be deleted already when we are removing queue info
+ //bg pointer can be NULL! so use it carefully!
- BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType());
- uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId);
- if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue
+ uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId);
+ if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue, or in Battleground
{
- // check if player is invited to this bg ... this check must be here, because when player leaves queue and joins another, it would cause a problems
- BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
+ // check if player is in queue for this BG and if we are removing his invite event
+ BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].m_QueuedPlayers;
BattleGroundQueue::QueuedPlayersMap::iterator qMapItr = qpMap.find(m_PlayerGuid);
- if (qMapItr != qpMap.end() && qMapItr->second.GroupInfo && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID)
+ if( qMapItr != qpMap.end() && qMapItr->second.GroupInfo
+ && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID
+ && qMapItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime )
{
- plr->RemoveBattleGroundQueueId(bgQueueTypeId);
- sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
- sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(), bg->GetQueueId());
+ sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID);
+
+ plr->RemoveBattleGroundQueueId(m_BgQueueTypeId);
+ sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].RemovePlayer(m_PlayerGuid, true);
+ //update queues if battleground isn't ended
+ if (bg)
+ sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].Update(m_BgTypeId, bg->GetQueueId());
+
WorldPacket data;
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
plr->GetSession()->SendPacket(&data);
}
}
- else
- sLog.outDebug("Battleground: Player was already removed from queue");
//event will be deleted
return true;
@@ -1124,8 +1095,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
{
- //this should not be called
- sLog.outError("Battleground remove event ABORTED!");
+ //do nothing
}
/*********************************************************/
@@ -1153,7 +1123,7 @@ void BattleGroundMgr::DeleteAllBattleGrounds()
{
BattleGround * bg = itr->second;
m_BattleGrounds[i].erase(itr++);
- if(!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
+ if (!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
m_ClientBattleGroundIds[i][bg->GetQueueId()].erase(bg->GetClientInstanceID());
delete bg;
}
@@ -1176,7 +1146,7 @@ void BattleGroundMgr::Update(uint32 diff)
{
itr = m_BattleGrounds[i].begin();
// skip updating battleground template
- if( itr != m_BattleGrounds[i].end() )
+ if (itr != m_BattleGrounds[i].end())
++itr;
for(; itr != m_BattleGrounds[i].end(); itr = next)
{
@@ -1185,21 +1155,21 @@ void BattleGroundMgr::Update(uint32 diff)
itr->second->Update(diff);
// use the SetDeleteThis variable
// direct deletion caused crashes
- if(itr->second->m_SetDeleteThis)
+ if (itr->second->m_SetDeleteThis)
{
BattleGround * bg = itr->second;
m_BattleGrounds[i].erase(itr);
- if(!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
+ if (!m_ClientBattleGroundIds[i][bg->GetQueueId()].empty())
m_ClientBattleGroundIds[i][bg->GetQueueId()].erase(bg->GetClientInstanceID());
delete bg;
}
}
}
// if rating difference counts, maybe force-update queues
- if(sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER))
+ if (sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE) && sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER))
{
// it's time to force update
- if(m_NextRatingDiscardUpdate < diff)
+ if (m_NextRatingDiscardUpdate < diff)
{
// forced update for level 70 rated arenas
sLog.outDebug("BattleGroundMgr: UPDATING ARENA QUEUES");
@@ -1214,9 +1184,9 @@ void BattleGroundMgr::Update(uint32 diff)
else
m_NextRatingDiscardUpdate -= diff;
}
- if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
+ if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
- if(m_AutoDistributionTimeChecker < diff)
+ if (m_AutoDistributionTimeChecker < diff)
{
if(time(NULL) > m_NextAutoDistributionTime)
{
@@ -1234,7 +1204,8 @@ void BattleGroundMgr::Update(uint32 diff)
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype)
{
// we can be in 3 queues in same time...
- if(StatusID == 0)
+
+ if (StatusID == 0 || !bg)
{
data->Initialize(SMSG_BATTLEFIELD_STATUS, 4*3);
*data << uint32(QueueSlot); // queue id (0...2)
@@ -1291,7 +1262,7 @@ void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket *data, BattleGro
break;
}
- if(bg->isArena() && (StatusID == STATUS_WAIT_QUEUE))
+ if (bg->isArena() && (StatusID == STATUS_WAIT_QUEUE))
*data << uint32(BATTLEGROUND_AA); // all arenas I don't think so.
else
*data << uint32(bg->GetTypeID()); // BG id from DBC
@@ -1344,14 +1315,14 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
{
uint32 at_id = bg->m_ArenaTeamIds[i];
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
- if(at)
+ if (at)
*data << at->GetName();
else
*data << (uint8)0;
}
}
- if(bg->GetStatus() != STATUS_WAIT_LEAVE)
+ if (bg->GetStatus() != STATUS_WAIT_LEAVE)
{
*data << uint8(0); // bg not ended
}
@@ -1367,7 +1338,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
{
*data << (uint64)itr->first;
*data << (int32)itr->second->KillingBlows;
- if(type == 0)
+ if (type == 0)
{
*data << (int32)itr->second->HonorableKills;
*data << (int32)itr->second->Deaths;
@@ -1377,9 +1348,9 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg)
{
Player *plr = objmgr.GetPlayer(itr->first);
uint32 team = bg->GetPlayerTeam(itr->first);
- if(!team && plr)
+ if (!team && plr)
team = plr->GetTeam();
- if( ( bg->GetWinner()==0 && team == ALLIANCE ) || ( bg->GetWinner()==1 && team==HORDE ) )
+ if (( bg->GetWinner()==0 && team == ALLIANCE ) || ( bg->GetWinner()==1 && team==HORDE ))
*data << uint8(1);
else
*data << uint8(0);
@@ -1467,57 +1438,20 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla
*data << uint64(plr->GetGUID());
}
-void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID, BattleGroundTypeId bgTypeId, uint32 team)
-{
- // set invited player counters:
- BattleGround* bg = GetBattleGround(bgInstanceGUID, bgTypeId);
- if(!bg)
- return;
- bg->IncreaseInvitedCount(team);
-
- plr->SetInviteForBattleGroundQueueType(BGQueueTypeId(bg->GetTypeID(),bg->GetArenaType()), bgInstanceGUID);
-
- // set the arena teams for rated matches
- if(bg->isArena() && bg->isRated())
- {
- switch(bg->GetArenaType())
- {
- case ARENA_TYPE_2v2:
- bg->SetArenaTeamIdForTeam(team, plr->GetArenaTeamId(0));
- break;
- case ARENA_TYPE_3v3:
- bg->SetArenaTeamIdForTeam(team, plr->GetArenaTeamId(1));
- break;
- case ARENA_TYPE_5v5:
- bg->SetArenaTeamIdForTeam(team, plr->GetArenaTeamId(2));
- break;
- default:
- break;
- }
- }
-
- // create invite events:
- //add events to player's counters ---- this is not good way - there should be something like global event processor, where we should add those events
- BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), bgInstanceGUID, bgTypeId);
- plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME));
- BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), bgInstanceGUID, bgTypeId, team);
- plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME));
-}
-
BattleGround * BattleGroundMgr::GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id)
{
//cause at HandleBattleGroundJoinOpcode the clients sends the instanceid he gets from
//SMSG_BATTLEFIELD_LIST we need to find the battleground with this clientinstance-id
BattleGround* bg = GetBattleGroundTemplate(bgTypeId);
- if( !bg )
+ if (!bg)
return NULL;
- if(bg->isArena())
+ if (bg->isArena())
return GetBattleGround(instanceId, bgTypeId);
for(BattleGroundSet::iterator itr = m_BattleGrounds[bgTypeId].begin(); itr != m_BattleGrounds[bgTypeId].end(); ++itr)
{
- if(itr->second->GetClientInstanceID() == instanceId)
+ if (itr->second->GetClientInstanceID() == instanceId)
return itr->second;
}
return NULL;
@@ -1527,12 +1461,12 @@ BattleGround * BattleGroundMgr::GetBattleGround(uint32 InstanceID, BattleGroundT
{
//search if needed
BattleGroundSet::iterator itr;
- if( bgTypeId == BATTLEGROUND_TYPE_NONE)
+ if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
for(uint32 i = BATTLEGROUND_AV; i < MAX_BATTLEGROUND_TYPE_ID; i++)
{
itr = m_BattleGrounds[i].find(InstanceID);
- if( itr != m_BattleGrounds[i].end() )
+ if (itr != m_BattleGrounds[i].end())
return itr->second;
}
return NULL;
@@ -1549,7 +1483,7 @@ BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTyp
uint32 BattleGroundMgr::CreateClientVisibleInstanceId(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id)
{
- if( IsArenaType(bgTypeId) )
+ if (IsArenaType(bgTypeId))
return 0; //arenas don't have client-instanceids
// we create here an instanceid, which is just for
@@ -1574,20 +1508,20 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI
{
// get the template BG
BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId);
- if(!bg_template)
+ if (!bg_template)
{
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
return NULL;
}
//for arenas there is random map used
- if(bg_template->isArena())
+ if (bg_template->isArena())
{
BattleGroundTypeId arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL};
uint32 arena_num = urand(0,2);
bgTypeId = arenas[arena_num];
bg_template = GetBattleGroundTemplate(bgTypeId);
- if(!bg_template)
+ if (!bg_template)
{
sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId);
return NULL;
@@ -1713,7 +1647,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
// 0 1 2 3 4 5 6 7 8
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
- if(!result)
+ if (!result)
{
barGoLink bar(1);
@@ -1735,7 +1669,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
// can be overwrite by values from DB
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
- if(!bl)
+ if (!bl)
{
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
continue;
@@ -1749,12 +1683,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
MinLvl = fields[3].GetUInt32();
MaxLvl = fields[4].GetUInt32();
//check values from DB
- if( MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam )
+ if (MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam)
{
MaxPlayersPerTeam = bl->maxplayersperteam;
MinPlayersPerTeam = bl->maxplayersperteam / 2;
}
- if( MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl )
+ if (MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl)
{
MinLvl = bl->minlvl;
MaxLvl = bl->maxlvl;
@@ -1763,14 +1697,14 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
start1 = fields[5].GetUInt32();
start = sWorldSafeLocsStore.LookupEntry(start1);
- if(start)
+ if (start)
{
AStartLoc[0] = start->x;
AStartLoc[1] = start->y;
AStartLoc[2] = start->z;
AStartLoc[3] = fields[6].GetFloat();
}
- else if(bgTypeID == BATTLEGROUND_AA)
+ else if (bgTypeID == BATTLEGROUND_AA)
{
AStartLoc[0] = 0;
AStartLoc[1] = 0;
@@ -1786,14 +1720,14 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
start2 = fields[7].GetUInt32();
start = sWorldSafeLocsStore.LookupEntry(start2);
- if(start)
+ if (start)
{
HStartLoc[0] = start->x;
HStartLoc[1] = start->y;
HStartLoc[2] = start->z;
HStartLoc[3] = fields[8].GetFloat();
}
- else if(bgTypeID == BATTLEGROUND_AA)
+ else if (bgTypeID == BATTLEGROUND_AA)
{
HStartLoc[0] = 0;
HStartLoc[1] = 0;
@@ -1807,7 +1741,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
}
//sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl);
- if(!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
+ if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
continue;
++count;
@@ -1821,11 +1755,11 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
{
- if(sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
+ if (sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
sLog.outDebug("Initializing Automatic Arena Point Distribution");
QueryResult * result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
- if(!result)
+ if (!result)
{
sLog.outDebug("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
m_NextAutoDistributionTime = time(NULL) + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
@@ -1853,7 +1787,7 @@ void BattleGroundMgr::DistributeArenaPoints()
//at first update all points for all team members
for(ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr)
{
- if(ArenaTeam * at = team_itr->second)
+ if (ArenaTeam * at = team_itr->second)
{
at->UpdateArenaPointsHelper(PlayerPoints);
}
@@ -1877,7 +1811,7 @@ void BattleGroundMgr::DistributeArenaPoints()
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
for(ObjectMgr::ArenaTeamMap::iterator titr = objmgr.GetArenaTeamMapBegin(); titr != objmgr.GetArenaTeamMapEnd(); ++titr)
{
- if(ArenaTeam * at = titr->second)
+ if (ArenaTeam * at = titr->second)
{
at->FinishWeek(); // set played this week etc values to 0 in memory, too
at->SaveToDB(); // save changes
@@ -1894,7 +1828,7 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
{
uint32 PlayerLevel = 10;
- if(plr)
+ if (plr)
PlayerLevel = plr->getLevel();
data->Initialize(SMSG_BATTLEFIELD_LIST);
@@ -1926,12 +1860,12 @@ void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint6
void BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, BattleGroundTypeId bgTypeId)
{
BattleGround *bg = GetBattleGround(instanceId, bgTypeId);
- if(bg)
+ if (bg)
{
uint32 mapid = bg->GetMapId();
float x, y, z, O;
uint32 team = pl->GetBGTeam();
- if(team==0)
+ if (team==0)
team = pl->GetTeam();
bg->GetTeamStartLoc(team, x, y, z, O);
@@ -1948,7 +1882,7 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *
{
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
- if(time_ == uint32(-1))
+ if (time_ == uint32(-1))
time_ = 0;
data << guid << time_;
pl->GetSession()->SendPacket(&data);
@@ -2039,7 +1973,7 @@ uint8 BattleGroundMgr::BGArenaType(BattleGroundQueueTypeId bgQueueTypeId)
void BattleGroundMgr::ToggleTesting()
{
m_Testing = !m_Testing;
- if(m_Testing)
+ if (m_Testing)
sWorld.SendWorldText(LANG_DEBUG_BG_ON);
else
sWorld.SendWorldText(LANG_DEBUG_BG_OFF);
@@ -2048,7 +1982,7 @@ void BattleGroundMgr::ToggleTesting()
void BattleGroundMgr::ToggleArenaTesting()
{
m_ArenaTesting = !m_ArenaTesting;
- if(m_ArenaTesting)
+ if (m_ArenaTesting)
sWorld.SendWorldText(LANG_DEBUG_ARENA_ON);
else
sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF);
@@ -2092,7 +2026,7 @@ void BattleGroundMgr::LoadBattleMastersEntry()
uint32 count = 0;
- if( !result )
+ if (!result)
{
barGoLink bar( 1 );
bar.step();
diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h
index e43b6e0e4a1..889b8b6f4fe 100644
--- a/src/game/BattleGroundMgr.h
+++ b/src/game/BattleGroundMgr.h
@@ -86,7 +86,6 @@ class BattleGroundQueue
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id);
void DecreaseGroupLength(uint32 queueId, uint32 AsGroup);
- void BGEndedRemoveInvites(BattleGround * bg);
void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue);
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
@@ -138,8 +137,8 @@ class BattleGroundQueue
class BGQueueInviteEvent : public BasicEvent
{
public:
- BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId) :
- m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId)
+ BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 removeTime) :
+ m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_RemoveTime(removeTime)
{
};
virtual ~BGQueueInviteEvent() {};
@@ -149,17 +148,20 @@ class BGQueueInviteEvent : public BasicEvent
private:
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
+ uint32 m_RemoveTime;
BattleGroundTypeId m_BgTypeId;
};
/*
- This class is used to remove player from BG queue after 2 minutes from first invitation
+ This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation
+ We must store removeInvite time in case player left queue and joined and is invited again
+ We must store bgQueueTypeId, because battleground can be deleted already, when player entered it
*/
class BGQueueRemoveEvent : public BasicEvent
{
public:
- BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 playersTeam) :
- m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_PlayersTeam(playersTeam)
+ BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) :
+ m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId), m_RemoveTime(removeTime)
{
};
virtual ~BGQueueRemoveEvent() {};
@@ -169,8 +171,9 @@ class BGQueueRemoveEvent : public BasicEvent
private:
uint64 m_PlayerGuid;
uint32 m_BgInstanceGUID;
- uint32 m_PlayersTeam;
+ uint32 m_RemoveTime;
BattleGroundTypeId m_BgTypeId;
+ BattleGroundQueueTypeId m_BgQueueTypeId;
};
class BattleGroundMgr
@@ -192,10 +195,6 @@ class BattleGroundMgr
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid);
- /* Player invitation */
- // called from Queue update, or from Addplayer to queue
- void InvitePlayer(Player* plr, uint32 bgInstanceGUID, BattleGroundTypeId bgTypeId, uint32 team);
-
/* Battlegrounds */
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id);
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
@@ -234,7 +233,7 @@ class BattleGroundMgr
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
{
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
- if(itr != mBattleMastersMap.end())
+ if (itr != mBattleMastersMap.end())
return itr->second;
return BATTLEGROUND_WS;
}
diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp
index b4c1b22d2de..364ba972bec 100644
--- a/src/game/BattleGroundNA.cpp
+++ b/src/game/BattleGroundNA.cpp
@@ -50,7 +50,7 @@ void BattleGroundNA::Update(uint32 diff)
{
BattleGround::Update(diff);
- /*if(GetStatus() == STATUS_IN_PROGRESS)
+ /*if (GetStatus() == STATUS_IN_PROGRESS)
{
// update something
}*/
@@ -85,7 +85,7 @@ void BattleGroundNA::AddPlayer(Player *plr)
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
- if(GetStatus() == STATUS_WAIT_LEAVE)
+ if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
@@ -96,10 +96,10 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
- if(!killer)
+ if (!killer)
{
sLog.outError("BattleGroundNA: Killer player not found");
return;
@@ -121,7 +121,7 @@ bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
@@ -137,7 +137,7 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
break;
}
- //if(buff_guid)
+ //if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
}
@@ -157,7 +157,7 @@ void BattleGroundNA::Reset()
bool BattleGroundNA::SetupBattleGround()
{
// gates
- if( !AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
+ if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179, 2874.97, 12.39171, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709, 2981.777, 10.70117, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064, 2858.438, 10.23631, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp
index 0e764d3f4c7..033733aa61a 100644
--- a/src/game/BattleGroundRL.cpp
+++ b/src/game/BattleGroundRL.cpp
@@ -50,7 +50,7 @@ void BattleGroundRL::Update(uint32 diff)
{
BattleGround::Update(diff);
- /*if(GetStatus() == STATUS_IN_PROGRESS)
+ /*if (GetStatus() == STATUS_IN_PROGRESS)
{
// update something
}*/
@@ -85,7 +85,7 @@ void BattleGroundRL::AddPlayer(Player *plr)
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
{
- if(GetStatus() == STATUS_WAIT_LEAVE)
+ if (GetStatus() == STATUS_WAIT_LEAVE)
return;
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
@@ -96,10 +96,10 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
- if(!killer)
+ if (!killer)
{
sLog.outError("Killer player not found");
return;
@@ -122,7 +122,7 @@ bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
@@ -138,7 +138,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
break;
}
- //if(buff_guid)
+ //if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
}
@@ -158,7 +158,7 @@ void BattleGroundRL::Reset()
bool BattleGroundRL::SetupBattleGround()
{
// gates
- if( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
+ if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY)
// buffs
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120)
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index 68ef2af19be..5e6b02edfce 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -65,7 +65,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
void BattleGroundSA::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
}
diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp
index ecf93db7cfa..fac59229e63 100644
--- a/src/game/BattleGroundWS.cpp
+++ b/src/game/BattleGroundWS.cpp
@@ -67,43 +67,43 @@ void BattleGroundWS::Update(uint32 diff)
{
BattleGround::Update(diff);
- if(GetStatus() == STATUS_IN_PROGRESS)
+ if (GetStatus() == STATUS_IN_PROGRESS)
{
- if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
+ if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
- if(m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
+ if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
{
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlag(ALLIANCE, true);
}
}
- if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
{
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
- if(m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
+ if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
{
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
RespawnFlagAfterDrop(ALLIANCE);
}
}
- if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
+ if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
{
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
- if(m_FlagsTimer[BG_TEAM_HORDE] < 0)
+ if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
{
m_FlagsTimer[BG_TEAM_HORDE] = 0;
RespawnFlag(HORDE, true);
}
}
- if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
{
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
- if(m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
+ if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
{
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
RespawnFlagAfterDrop(HORDE);
@@ -150,7 +150,7 @@ void BattleGroundWS::AddPlayer(Player *plr)
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
{
- if(Team == ALLIANCE)
+ if (Team == ALLIANCE)
{
sLog.outDebug("Respawn Alliance flag");
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
@@ -161,7 +161,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
}
- if(captured)
+ if (captured)
{
//when map_update will be allowed for battlegrounds this code will be useless
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
@@ -173,11 +173,11 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
RespawnFlag(team,false);
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
{
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
@@ -191,7 +191,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team));
- if(obj)
+ if (obj)
obj->Delete();
else
sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));
@@ -201,13 +201,13 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 winner = 0;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
if (!this->IsHordeFlagPickedup())
return;
@@ -216,7 +216,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
- if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
@@ -230,7 +230,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
- if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
@@ -241,7 +241,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
@@ -251,13 +251,13 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
- if(GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
- if(GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
+ if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
- if(winner)
+ if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
@@ -275,15 +275,15 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
{
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
// just take off the aura
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
- if(!this->IsHordeFlagPickedup())
+ if (!this->IsHordeFlagPickedup())
return;
- if(GetHordeFlagPickerGUID() == Source->GetGUID())
+ if (GetHordeFlagPickerGUID() == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -291,9 +291,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
}
else
{
- if(!this->IsAllianceFlagPickedup())
+ if (!this->IsAllianceFlagPickedup())
return;
- if(GetAllianceFlagPickerGUID() == Source->GetGUID())
+ if (GetAllianceFlagPickerGUID() == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -304,11 +304,11 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
bool set = false;
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
- if(!this->IsHordeFlagPickedup())
+ if (!IsHordeFlagPickedup())
return;
- if(GetHordeFlagPickerGUID() == Source->GetGUID())
+ if (GetHordeFlagPickerGUID() == Source->GetGUID())
{
SetHordeFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -319,9 +319,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
}
else
{
- if(!this->IsAllianceFlagPickedup())
+ if (!IsAllianceFlagPickedup())
return;
- if(GetAllianceFlagPickerGUID() == Source->GetGUID())
+ if (GetAllianceFlagPickerGUID() == Source->GetGUID())
{
SetAllianceFlagPicker(0);
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
@@ -336,7 +336,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
UpdateFlagState(Source->GetTeam(), 1);
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
@@ -353,7 +353,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
int32 message_id = 0;
@@ -392,9 +392,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
- if(this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->id == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
+ if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{
- if(Source->GetTeam() == ALLIANCE)
+ if (Source->GetTeam() == ALLIANCE)
{
message_id = LANG_BG_WS_RETURNED_AF;
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
@@ -421,9 +421,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
}
//Horde flag on ground(not in base) (returned or picked up again)
- if(this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && target_obj->GetGOInfo()->id == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
+ if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{
- if(Source->GetTeam() == HORDE)
+ if (Source->GetTeam() == HORDE)
{
message_id = LANG_BG_WS_RETURNED_HF;
type = CHAT_MSG_BG_SYSTEM_HORDE;
@@ -459,9 +459,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
{
// sometimes flag aura not removed :(
- if(IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
+ if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
{
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0);
@@ -470,9 +470,9 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
else
this->EventPlayerDroppedFlag(plr);
}
- if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
+ if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
{
- if(!plr)
+ if (!plr)
{
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0);
@@ -485,7 +485,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
{
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
else
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
@@ -493,7 +493,7 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
void BattleGroundWS::UpdateTeamScore(uint32 team)
{
- if(team == ALLIANCE)
+ if (team == ALLIANCE)
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
else
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
@@ -502,7 +502,7 @@ void BattleGroundWS::UpdateTeamScore(uint32 team)
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
{
// this is wrong way to implement these things. On official it done by gameobject spell cast.
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
//uint32 SpellId = 0;
@@ -528,13 +528,13 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
break;
case 3646: // Alliance Flag spawn
- if(m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
- if(GetHordeFlagPickerGUID() == Source->GetGUID())
+ if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
+ if (GetHordeFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source);
break;
case 3647: // Horde Flag spawn
- if(m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
- if(GetAllianceFlagPickerGUID() == Source->GetGUID())
+ if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
+ if (GetAllianceFlagPickerGUID() == Source->GetGUID())
EventPlayerCapturedFlag(Source);
break;
case 3649: // unk1
@@ -548,14 +548,14 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
break;
}
- //if(buff_guid)
+ //if (buff_guid)
// HandleTriggerBuff(buff_guid,Source);
}
bool BattleGroundWS::SetupBattleGround()
{
// flags
- if( !AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
+ if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|| !AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, BG_WS_FLAG_RESPAWN_TIME/1000)
// buffs
|| !AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME)
@@ -583,14 +583,14 @@ bool BattleGroundWS::SetupBattleGround()
}
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
- if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
+ if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
return false;
}
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
- if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
+ if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
{
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
return false;
@@ -620,9 +620,9 @@ void BattleGroundWS::Reset()
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
- if(m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
+ if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
- if(m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
+ if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
DelCreature(WS_SPIRIT_MAIN_HORDE);
*/
}
@@ -630,9 +630,9 @@ void BattleGroundWS::Reset()
void BattleGroundWS::EndBattleGround(uint32 winner)
{
//win reward
- if( winner == ALLIANCE )
+ if (winner == ALLIANCE)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
- if( winner == HORDE )
+ if (winner == HORDE)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
//complete map_end rewards (even if no team wins)
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
@@ -643,7 +643,7 @@ void BattleGroundWS::EndBattleGround(uint32 winner)
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
{
- if(GetStatus() != STATUS_IN_PROGRESS)
+ if (GetStatus() != STATUS_IN_PROGRESS)
return;
EventPlayerDroppedFlag(player);
@@ -680,16 +680,16 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
//if a player dies in preparation phase - then the player can't cheat
//and teleport to the graveyard outside the flagroom
//and start running around, while the doors are still closed
- if(player->GetTeam() == ALLIANCE)
+ if (player->GetTeam() == ALLIANCE)
{
- if(GetStatus() == STATUS_IN_PROGRESS)
+ if (GetStatus() == STATUS_IN_PROGRESS)
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
else
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
}
else
{
- if(GetStatus() == STATUS_IN_PROGRESS)
+ if (GetStatus() == STATUS_IN_PROGRESS)
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
else
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
@@ -701,14 +701,14 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
- if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
else
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
- if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
+ if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt
index 97f6c3bde6f..081d9669696 100644
--- a/src/game/CMakeLists.txt
+++ b/src/game/CMakeLists.txt
@@ -73,6 +73,8 @@ SET(game_STAT_SRCS
CreatureAIRegistry.h
CreatureAISelector.cpp
CreatureAISelector.h
+ CreatureEventAI.cpp
+ CreatureEventAIMgr.cpp
Creature.cpp
Creature.h
CreatureGroups.cpp
@@ -293,4 +295,4 @@ SET(game_STAT_SRCS
)
add_library(game STATIC ${game_STAT_SRCS})
-ADD_DEPENDENCIES(game revision.h) \ No newline at end of file
+ADD_DEPENDENCIES(game revision.h)
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index eaf0ec5af0f..a2e189603f9 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -165,7 +165,7 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ )
"SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, "
// 9 10 11 12 13
"characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, guild_member.guildid "
- "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='0' "
+ "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='%u' "
"LEFT JOIN guild_member ON characters.guid = guild_member.guid "
"WHERE characters.account = '%u' ORDER BY characters.guid"
:
@@ -174,11 +174,11 @@ void WorldSession::HandleCharEnumOpcode( WorldPacket & /*recv_data*/ )
"SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, "
// 9 10 11 12 13 14
"characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, guild_member.guildid, genitive "
- "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='0' "
+ "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='%u' "
"LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid "
"LEFT JOIN guild_member ON characters.guid = guild_member.guid "
"WHERE characters.account = '%u' ORDER BY characters.guid",
- GetAccountId());
+ PET_SAVE_AS_CURRENT,GetAccountId());
}
void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
@@ -814,9 +814,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
SendDoFlight( MountId, path, startNode );
}
- // Load pet if any and player is alive and not in taxi flight
- if(pCurrChar->isAlive() && pCurrChar->m_taxi.GetTaxiSource()==0)
- pCurrChar->LoadPet();
+ // Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
+ pCurrChar->LoadPet();
// Set FFA PvP for non GM in non-rest mode
if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 50bb6b7832f..f63a550b7de 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -136,6 +136,8 @@ ChatCommand * ChatHandler::getCommandTable()
static ChatCommand debugCommandTable[] =
{
{ "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL },
+ { "threat", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugThreatList, "", NULL },
+ { "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostilRefList, "", NULL },
{ "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugAnimCommand, "", NULL },
{ "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL },
{ "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL },
@@ -232,7 +234,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "listbinds", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceListBindsCommand, "", NULL },
{ "unbind", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceUnbindCommand, "", NULL },
{ "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleInstanceStatsCommand, "", NULL },
- { "savedata", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL },
+ { "savedata", SEC_ADMINISTRATOR, false, &ChatHandler::HandleInstanceSaveDataCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
@@ -384,6 +386,7 @@ ChatCommand * ChatHandler::getCommandTable()
static ChatCommand reloadCommandTable[] =
{
{ "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllCommand, "", NULL },
+ { "all_achievement",SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllAchievementCommand,"", NULL },
{ "all_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllAreaCommand, "", NULL },
{ "all_loot", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllLootCommand, "", NULL },
{ "all_npc", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAllNpcCommand, "", NULL },
@@ -395,6 +398,8 @@ ChatCommand * ChatHandler::getCommandTable()
{ "config", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadConfigCommand, "", NULL },
+ { "achievement_criteria_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementCriteriaDataCommand, "", NULL },
+ { "achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAchievementRewardCommand, "", NULL },
{ "areatrigger_tavern", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTavernCommand, "", NULL },
{ "areatrigger_teleport", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAreaTriggerTeleportCommand, "", NULL },
{ "access_requirement", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAccessRequirementCommand, "", NULL },
@@ -415,7 +420,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "gameobject_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadGameObjectScriptsCommand, "", NULL },
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadItemEnchantementsCommand, "", NULL },
{ "item_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesItemCommand, "", NULL },
- { "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL },
+ { "locales_achievement_reward", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesAchievementRewardCommand,"", NULL },
{ "locales_creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesCreatureCommand, "", NULL },
{ "locales_gameobject", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesGameobjectCommand, "", NULL },
{ "locales_item", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLocalesItemCommand, "", NULL },
@@ -458,6 +463,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "spell_target_position", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellTargetPositionCommand, "", NULL },
{ "spell_threats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellThreatsCommand, "", NULL },
{ "spell_disabled", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellDisabledCommand, "", NULL },
+ { "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL },
{ "auctions", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadAuctionsCommand, "", NULL },
{ "waypoint_scripts", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadWpScriptsCommand, "", NULL },
{ "gm_tickets", SEC_ADMINISTRATOR, true, &ChatHandler::HandleGMTicketReloadCommand, "", NULL },
@@ -518,6 +524,7 @@ ChatCommand * ChatHandler::getCommandTable()
{
{ "difftime", SEC_CONSOLE, true, &ChatHandler::HandleServerSetDiffTimeCommand, "", NULL },
{ "loglevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogLevelCommand, "", NULL },
+ { "logfilelevel", SEC_CONSOLE, true, &ChatHandler::HandleServerSetLogFileLevelCommand, "", NULL },
{ "motd", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetMotdCommand, "", NULL },
{ "closed", SEC_ADMINISTRATOR, true, &ChatHandler::HandleServerSetClosedCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 05892202718..7065c6dd0ed 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -291,6 +291,7 @@ class ChatHandler
bool HandleQuestComplete(const char * args);
bool HandleReloadAllCommand(const char* args);
+ bool HandleReloadAllAchievementCommand(const char* args);
bool HandleReloadAllAreaCommand(const char* args);
bool HandleReloadAllItemCommand(const char* args);
bool HandleReloadAllLootCommand(const char* args);
@@ -302,7 +303,8 @@ class ChatHandler
bool HandleReloadConfigCommand(const char* args);
- bool HandleReloadWpScriptsCommand(const char* args);
+ bool HandleReloadAchievementCriteriaDataCommand(const char* args);
+ bool HandleReloadAchievementRewardCommand(const char* args);
bool HandleReloadAreaTriggerTavernCommand(const char* args);
bool HandleReloadAreaTriggerTeleportCommand(const char* args);
bool HandleReloadAccessRequirementCommand(const char* args);
@@ -317,6 +319,7 @@ class ChatHandler
bool HandleReloadGOQuestRelationsCommand(const char* args);
bool HandleReloadGOQuestInvRelationsCommand(const char* args);
bool HandleReloadItemEnchantementsCommand(const char* args);
+ bool HandleReloadLocalesAchievementRewardCommand(const char* args);
bool HandleReloadLocalesCreatureCommand(const char* args);
bool HandleReloadLocalesGameobjectCommand(const char* args);
bool HandleReloadLocalesItemCommand(const char* args);
@@ -367,6 +370,7 @@ class ChatHandler
bool HandleReloadSpellPetAurasCommand(const char* args);
bool HandleReloadSpellDisabledCommand(const char* args);
bool HandleReloadAuctionsCommand(const char* args);
+ bool HandleReloadWpScriptsCommand(const char* args);
bool HandleResetAchievementsCommand(const char * args);
bool HandleResetAllCommand(const char * args);
@@ -390,6 +394,7 @@ class ChatHandler
bool HandleServerRestartCommand(const char* args);
bool HandleServerSetMotdCommand(const char* args);
bool HandleServerSetLogLevelCommand(const char* args);
+ bool HandleServerSetLogFileLevelCommand(const char* args);
bool HandleServerSetDiffTimeCommand(const char* args);
bool HandleServerShutDownCommand(const char* args);
bool HandleServerShutDownCancelCommand(const char* args);
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 74ebe4406c8..7a4cac89408 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -116,7 +116,7 @@ bool AssistDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
while (!m_assistants.empty())
{
- Creature* assistant = (Creature*)Unit::GetUnit(m_owner, *m_assistants.begin());
+ Creature* assistant = Unit::GetCreature(m_owner, *m_assistants.begin());
m_assistants.pop_front();
if (assistant && assistant->CanAssistTo(&m_owner, victim))
@@ -151,6 +151,7 @@ m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL), m_summo
m_CreatureCategoryCooldowns.clear();
m_GlobalCooldown = 0;
m_unit_movement_flags = MOVEMENTFLAG_WALK_MODE;
+ DisableReputationGain = false;
}
Creature::~Creature()
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 02111ea9f70..ce890c34902 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -134,6 +134,7 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
//CREATURE_FLAG_EXTRA_CHARM_AI = 0x00008000, // use ai when charmed
CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00010000, // cannot be taunted
+ CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes
};
enum SummonMask
@@ -325,6 +326,29 @@ enum InhabitTypeValues
INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR
};
+// Enums used by StringTextData::Type (CreatureEventAI)
+enum ChatType
+{
+ CHAT_TYPE_SAY = 0,
+ CHAT_TYPE_YELL = 1,
+ CHAT_TYPE_TEXT_EMOTE = 2,
+ CHAT_TYPE_BOSS_EMOTE = 3,
+ CHAT_TYPE_WHISPER = 4,
+ CHAT_TYPE_BOSS_WHISPER = 5,
+ CHAT_TYPE_ZONE_YELL = 6
+};
+
+//Selection method used by SelectTarget (CreatureEventAI)
+enum AttackingTarget
+{
+ ATTACKING_TARGET_RANDOM = 0, //Just selects a random target
+ ATTACKING_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
+ ATTACKING_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
+ ATTACKING_TARGET_RANDOM_PLAYER, //Just selects a random target (player only)
+ ATTACKING_TARGET_TOPAGGRO_PLAYER, //Selects targes from top aggro to bottom (player only)
+ ATTACKING_TARGET_BOTTOMAGGRO_PLAYER, //Selects targets from bottom aggro to top (player only)
+};
+
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined( __GNUC__ )
#pragma pack()
@@ -658,6 +682,8 @@ class TRINITY_DLL_SPEC Creature : public Unit
Unit *SelectVictim();
void SetDeadByDefault (bool death_state) {m_isDeadByDefault = death_state;}
+ void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
+ bool IsReputationGainDisabled() { return DisableReputationGain; }
protected:
bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
@@ -706,6 +732,8 @@ class TRINITY_DLL_SPEC Creature : public Unit
float mHome_Z;
float mHome_O;
+ bool DisableReputationGain;
+
private:
//WaypointMovementGenerator vars
uint32 m_waypointID;
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 45608ef317e..e7043c6042f 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -70,6 +70,38 @@ void CreatureAI::OnCharmed(bool apply)
me->IsAIEnabled = false;
}
+void CreatureAI::DoZoneInCombat(Unit* pUnit)
+{
+ if (!pUnit)
+ pUnit = me;
+
+ Map *map = pUnit->GetMap();
+
+ if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
+ {
+ sLog.outError("DoZoneInCombat call for map that isn't an instance (pUnit entry = %d)", pUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)pUnit)->GetEntry() : 0);
+ return;
+ }
+
+ if (!pUnit->CanHaveThreatList() || pUnit->getThreatManager().isThreatListEmpty())
+ {
+ sLog.outError("DoZoneInCombat called for creature that either cannot have threat list or has empty threat list (pUnit entry = %d)", pUnit->GetTypeId() == TYPEID_UNIT ? ((Creature*)pUnit)->GetEntry() : 0);
+ return;
+ }
+
+ Map::PlayerList const &PlayerList = map->GetPlayers();
+ for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ {
+ if (Player* i_pl = i->getSource())
+ if (i_pl->isAlive())
+ {
+ pUnit->SetInCombatWith(i_pl);
+ i_pl->SetInCombatWith(pUnit);
+ pUnit->AddThreat(i_pl, 0.0f);
+ }
+ }
+}
+
void CreatureAI::MoveInLineOfSight(Unit *who)
{
if(!me->getVictim() && me->canStartAttack(who))
diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h
index 7388aab786c..11d5bd372fd 100644
--- a/src/game/CreatureAI.h
+++ b/src/game/CreatureAI.h
@@ -158,6 +158,8 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
// Called at reaching home after evade
virtual void JustReachedHome() {}
+
+ void DoZoneInCombat(Unit* pUnit = NULL);
};
struct SelectableAI : public FactoryHolder<CreatureAI>, public Permissible<Creature>
diff --git a/src/game/CreatureAIRegistry.cpp b/src/game/CreatureAIRegistry.cpp
index 3d7fe1848fb..6253c06b8bc 100644
--- a/src/game/CreatureAIRegistry.cpp
+++ b/src/game/CreatureAIRegistry.cpp
@@ -26,6 +26,7 @@
#include "PossessedAI.h"
#include "TotemAI.h"
#include "OutdoorPvPObjectiveAI.h"
+#include "CreatureEventAI.h"
#include "RandomMovementGenerator.h"
#include "CreatureAIImpl.h"
#include "MovementGeneratorImpl.h"
@@ -46,6 +47,7 @@ namespace AIRegistry
(new CreatureAIFactory<TotemAI>("TotemAI"))->RegisterSelf();
(new CreatureAIFactory<OutdoorPvPObjectiveAI>("OutdoorPvPObjectiveAI"))->RegisterSelf();
(new CreatureAIFactory<PossessedAI>("PossessedAI"))->RegisterSelf();
+ (new CreatureAIFactory<CreatureEventAI>("EventAI"))->RegisterSelf();
(new MovementGeneratorFactory<RandomMovementGenerator<Creature> >(RANDOM_MOTION_TYPE))->RegisterSelf();
(new MovementGeneratorFactory<WaypointMovementGenerator<Creature> >(WAYPOINT_MOTION_TYPE))->RegisterSelf();
diff --git a/src/game/CreatureAISelector.cpp b/src/game/CreatureAISelector.cpp
index 74275c8b173..88384fd6f21 100644
--- a/src/game/CreatureAISelector.cpp
+++ b/src/game/CreatureAISelector.cpp
@@ -35,24 +35,24 @@ namespace FactorySelector
{
CreatureAI* selectAI(Creature *creature)
{
- //if(creature->isPossessed())
- // creature->InitPossessedAI();
+ const CreatureAICreator *ai_factory = NULL;
+ CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
+
+ //player-controlled guardians with pet bar
+ if(creature->HasSummonMask(SUMMON_MASK_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
+ ai_factory = ai_registry.GetRegistryItem("PetAI");
- // Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
- if((!creature->isPet() || !((Pet*)creature)->isControlled()) && !creature->isCharmed())
+ //scriptname in db
+ if(!ai_factory)
if(CreatureAI* scriptedAI = Script->GetAI(creature))
return scriptedAI;
- CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
- assert( creature->GetCreatureInfo() != NULL );
- CreatureInfo const *cinfo=creature->GetCreatureInfo();
-
- const CreatureAICreator *ai_factory = NULL;
+ CreatureInfo const *cinfo = creature->GetCreatureInfo();
+ assert(cinfo);
+ // this seems to be useless
std::string ainame=cinfo->AIName;
-
- // select by script name
- if( !ainame.empty())
+ if(!ai_factory && !ainame.empty())
ai_factory = ai_registry.GetRegistryItem( ainame.c_str() );
// select by NPC flags
@@ -60,21 +60,12 @@ namespace FactorySelector
{
if( creature->isGuard() )
ai_factory = ai_registry.GetRegistryItem("GuardAI");
- else if(creature->isPet() || (creature->isCharmed() && !creature->isPossessed()))
+ else if(creature->HasSummonMask(SUMMON_MASK_GUARDIAN))
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
else if(creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
- else if(creature->isSummon() && ((TempSummon*)creature)->m_Properties)
- {
- if(((TempSummon*)creature)->m_Properties->Category == SUMMON_CATEGORY_PET
- || ((TempSummon*)creature)->m_Properties->Type == SUMMON_TYPE_GUARDIAN
- || ((TempSummon*)creature)->m_Properties->Type == SUMMON_TYPE_MINION)
- ai_factory = ai_registry.GetRegistryItem("PetAI");
- else if(((TempSummon*)creature)->m_Properties->Type == SUMMON_TYPE_MINIPET)
- ai_factory = ai_registry.GetRegistryItem("CritterAI");
- }
else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER)
ai_factory = ai_registry.GetRegistryItem("CritterAI");
}
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
new file mode 100644
index 00000000000..daf5c74ca72
--- /dev/null
+++ b/src/game/CreatureEventAI.cpp
@@ -0,0 +1,1661 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "Common.h"
+#include "CreatureEventAI.h"
+#include "CreatureEventAIMgr.h"
+#include "ObjectMgr.h"
+#include "Spell.h"
+#include "World.h"
+#include "Cell.h"
+#include "CellImpl.h"
+#include "GameEventMgr.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "WorldPacket.h"
+#include "InstanceData.h"
+
+int CreatureEventAI::Permissible(const Creature *creature)
+{
+ if( creature->GetCreatureInfo()->AIName == "EventAI" )
+ return PERMIT_BASE_SPECIAL;
+ return PERMIT_BASE_NO;
+}
+
+CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c), m_creature(*c), InCombat(false)
+{
+ CreatureEventAI_Event_Map::iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature.GetEntry());
+ if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end())
+ {
+ std::vector<CreatureEventAI_Event>::iterator i;
+ for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
+ {
+
+ //Debug check
+ #ifndef _DEBUG
+ if ((*i).event_flags & EFLAG_DEBUG_ONLY)
+ continue;
+ #endif
+ if(((*i).event_flags & (EFLAG_HEROIC | EFLAG_NORMAL)) && m_creature.GetMap()->IsDungeon() )
+ {
+ if( (m_creature.GetMap()->IsHeroic() && (*i).event_flags & EFLAG_HEROIC) ||
+ (!m_creature.GetMap()->IsHeroic() && (*i).event_flags & EFLAG_NORMAL))
+ {
+ //event flagged for instance mode
+ CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
+ }
+ continue;
+ }
+ CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
+ }
+ //EventMap had events but they were not added because they must be for instance
+ if (CreatureEventAIList.empty())
+ sLog.outError("CreatureEventAI: CreatureId has events but no events added to list because of instance flags.", m_creature.GetEntry());
+ }
+ else
+ sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature.GetEntry());
+
+ bEmptyList = CreatureEventAIList.empty();
+ Phase = 0;
+ CombatMovementEnabled = true;
+ MeleeEnabled = true;
+ AttackDistance = 0;
+ AttackAngle = 0.0f;
+
+ //Handle Spawned Events
+ if (!bEmptyList)
+ {
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_SPAWNED)
+ ProcessEvent(*i);
+ }
+ }
+}
+
+bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker)
+{
+ if (!pHolder.Enabled || pHolder.Time)
+ return false;
+
+ //Check the inverse phase mask (event doesn't trigger if current phase bit is set in mask)
+ if (pHolder.Event.event_inverse_phase_mask & (1 << Phase))
+ return false;
+
+ //Store random here so that all random actions match up
+ uint32 rnd = rand();
+
+ //Return if chance for event is not met
+ if (pHolder.Event.event_chance <= rnd % 100)
+ return false;
+
+ union
+ {
+ uint32 param1;
+ int32 param1_s;
+ };
+
+ union
+ {
+ uint32 param2;
+ int32 param2_s;
+ };
+
+ union
+ {
+ uint32 param3;
+ int32 param3_s;
+ };
+
+ union
+ {
+ uint32 param4;
+ int32 param4_s;
+ };
+
+ param1 = pHolder.Event.event_param1;
+ param2 = pHolder.Event.event_param2;
+ param3 = pHolder.Event.event_param3;
+ param4 = pHolder.Event.event_param4;
+
+ //Check event conditions based on the event type, also reset events
+ switch (pHolder.Event.event_type)
+ {
+ case EVENT_T_TIMER:
+ {
+ if (!InCombat)
+ return false;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_TIMER_OOC:
+ {
+ if (InCombat)
+ return false;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_HP:
+ {
+ if (!InCombat || !m_creature.GetMaxHealth())
+ return false;
+
+ uint32 perc = (m_creature.GetHealth()*100) / m_creature.GetMaxHealth();
+
+ if (perc > param1 || perc < param2)
+ return false;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_MANA:
+ {
+ if (!InCombat || !m_creature.GetMaxPower(POWER_MANA))
+ return false;
+
+ uint32 perc = (m_creature.GetPower(POWER_MANA)*100) / m_creature.GetMaxPower(POWER_MANA);
+
+ if (perc > param1 || perc < param2)
+ return false;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_AGGRO:
+ {
+ }
+ break;
+ case EVENT_T_KILL:
+ {
+ //Repeat Timers
+ if (param1 == param2)
+ {
+ pHolder.Time = param1;
+
+ }else if (param2 > param1)
+ pHolder.Time = urand(param1, param2);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ case EVENT_T_DEATH:
+ {
+ }
+ break;
+ case EVENT_T_EVADE:
+ {
+ }
+ break;
+ case EVENT_T_SPELLHIT:
+ {
+ //Spell hit is special case, param1 and param2 handled within CreatureEventAI::SpellHit
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_RANGE:
+ {
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_OOC_LOS:
+ {
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_SPAWNED:
+ {
+ }
+ break;
+ case EVENT_T_TARGET_HP:
+ {
+ if (!InCombat || !m_creature.getVictim() || !m_creature.getVictim()->GetMaxHealth())
+ return false;
+
+ uint32 perc = (m_creature.getVictim()->GetHealth()*100) / m_creature.getVictim()->GetMaxHealth();
+
+ if (perc > param1 || perc < param2)
+ return false;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_TARGET_CASTING:
+ {
+ if (!InCombat || !m_creature.getVictim() || !m_creature.getVictim()->IsNonMeleeSpellCasted(false, false, true))
+ return false;
+
+ //Repeat Timers
+ if (param1 == param2)
+ {
+ pHolder.Time = param1;
+
+ }else if (param2 > param1)
+ pHolder.Time = urand(param1, param2);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_FRIENDLY_HP:
+ {
+ if (!InCombat)
+ return false;
+
+ Unit* pUnit = DoSelectLowestHpFriendly(param2, param1);
+
+ if (!pUnit)
+ return false;
+
+ pActionInvoker = pUnit;
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_FRIENDLY_IS_CC:
+ {
+ if (!InCombat)
+ return false;
+
+ std::list<Creature*> pList;
+ DoFindFriendlyCC(pList, param2);
+
+ //List is empty
+ if (pList.empty())
+ return false;
+
+ //We don't really care about the whole list, just return first available
+ pActionInvoker = *(pList.begin());
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_FRIENDLY_MISSING_BUFF:
+ {
+ std::list<Creature*> pList;
+ DoFindFriendlyMissingBuff(pList, param2, param1);
+
+ //List is empty
+ if (pList.empty())
+ return false;
+
+ //We don't really care about the whole list, just return first available
+ pActionInvoker = *(pList.begin());
+
+ //Repeat Timers
+ if (param3 == param4)
+ {
+ pHolder.Time = param3;
+
+ }else if (param4 > param3)
+ pHolder.Time = urand(param3, param4);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_SUMMONED_UNIT:
+ {
+ //Prevent event from occuring on no unit or non creatures
+ if (!pActionInvoker || pActionInvoker->GetTypeId()!=TYPEID_UNIT)
+ return false;
+
+ //Creature id doesn't match up
+ if (param1 && ((Creature*)pActionInvoker)->GetEntry() != param1)
+ return false;
+
+ //Repeat Timers
+ if (param2 == param3)
+ {
+ pHolder.Time = param2;
+
+ }else if (param3 > param2)
+ pHolder.Time = urand(param2, param3);
+ else
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ pHolder.Enabled = false;
+ }
+ }
+ break;
+ case EVENT_T_REACHED_HOME:
+ {
+ }
+ break;
+ case EVENT_T_RECEIVE_EMOTE:
+ {
+ }
+ break;
+ default:
+
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature.GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
+ break;
+ }
+
+ //Disable non-repeatable events
+ if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE))
+ pHolder.Enabled = false;
+
+ //Process actions
+ for (uint32 j = 0; j < MAX_ACTIONS; j++)
+ ProcessAction(pHolder.Event.action[j].type, pHolder.Event.action[j].param1, pHolder.Event.action[j].param2, pHolder.Event.action[j].param3, rnd, pHolder.Event.event_id, pActionInvoker);
+
+ return true;
+}
+
+void CreatureEventAI::ProcessAction(uint16 type, uint32 param1, uint32 param2, uint32 param3, uint32 rnd, uint32 EventId, Unit* pActionInvoker)
+{
+ switch (type)
+ {
+ case ACTION_T_TEXT:
+ {
+ if (!param1)
+ return;
+
+ uint32 temp = 0;
+
+ if (param2 && param3)
+ {
+ switch( rand()%3 )
+ {
+ case 0: temp = param1; break;
+ case 2: temp = param2; break;
+ case 3: temp = param3; break;
+ }
+ }else if ( param2 && urand(0,1) )
+ {
+ temp = param2;
+ }else
+ {
+ temp = param1;
+ }
+
+ if (temp)
+ {
+ Unit* target = NULL;
+ Unit* owner = NULL;
+
+ if (pActionInvoker)
+ {
+ if (pActionInvoker->GetTypeId() == TYPEID_PLAYER)
+ target = pActionInvoker;
+ else if (owner = pActionInvoker->GetOwner())
+ {
+ if (owner->GetTypeId() == TYPEID_PLAYER)
+ target = owner;
+ }
+ }
+ else if (target = m_creature.getVictim())
+ {
+ if (target->GetTypeId() != TYPEID_PLAYER)
+ {
+ if (owner = target->GetOwner())
+ {
+ if (owner->GetTypeId() == TYPEID_PLAYER)
+ target = owner;
+ }
+ }
+ }
+
+ DoScriptText(temp, &m_creature, target);
+ }
+ }
+ break;
+ case ACTION_T_SET_FACTION:
+ {
+ if (param1)
+ m_creature.setFaction(param1);
+ else
+ {
+ if (CreatureInfo const* ci = GetCreatureTemplateStore(m_creature.GetEntry()))
+ {
+ //if no id provided, assume reset and then use default
+ if (m_creature.getFaction() != ci->faction_A)
+ m_creature.setFaction(ci->faction_A);
+ }
+ }
+ }
+ break;
+ case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
+ {
+ if (param1 || param2)
+ {
+ //set model based on entry from creature_template
+ if (param1)
+ {
+ if (CreatureInfo const* ci = GetCreatureTemplateStore(param1))
+ {
+ //use default display
+ if (ci->Modelid1)
+ m_creature.SetDisplayId(ci->Modelid1);
+ }
+ }
+ //if no param1, then use value from param2 (modelId)
+ else
+ m_creature.SetDisplayId(param2);
+ }
+ else
+ m_creature.DeMorph();
+ }
+ break;
+ case ACTION_T_SOUND:
+ m_creature.PlayDirectSound(param1);
+ break;
+ case ACTION_T_EMOTE:
+ m_creature.HandleEmoteCommand(param1);
+ break;
+ case ACTION_T_RANDOM_SOUND:
+ {
+ uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
+
+ if (temp != uint32(0xffffffff))
+ m_creature.PlayDirectSound( temp );
+ }
+ break;
+ case ACTION_T_RANDOM_EMOTE:
+ {
+ uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
+
+ if (temp != uint32(0xffffffff))
+ m_creature.HandleEmoteCommand(temp);
+ }
+ break;
+ case ACTION_T_CAST:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+ Unit* caster = &m_creature;
+
+ if (!target)
+ return;
+
+ //Cast is always triggered if target is forced to cast on self
+ if (param3 & CAST_FORCE_TARGET_SELF)
+ {
+ param3 |= CAST_TRIGGERED;
+ caster = target;
+ }
+
+ //Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
+ bool canCast = !(caster->IsNonMeleeSpellCasted(false) && (param3 & CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
+
+ // If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
+ if(param3 & CAST_AURA_NOT_PRESENT)
+ {
+ if(target->HasAura(param1))
+ return;
+ }
+
+ if (canCast)
+ {
+ const SpellEntry* tSpell = GetSpellStore()->LookupEntry(param1);
+
+ //Verify that spell exists
+ if (tSpell)
+ {
+ //Check if cannot cast spell
+ if (!(param3 & (CAST_FORCE_TARGET_SELF | CAST_FORCE_CAST)) &&
+ !CanCast(target, tSpell, (param3 & CAST_TRIGGERED)))
+ {
+ //Melee current victim if flag not set
+ if (!(param3 & CAST_NO_MELEE_IF_OOM))
+ {
+ if (m_creature.GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
+ {
+ AttackDistance = 0;
+ AttackAngle = 0;
+
+ m_creature.GetMotionMaster()->MoveChase(m_creature.getVictim(), AttackDistance, AttackAngle);
+ }
+ }
+
+ }
+ else
+ {
+ //Interrupt any previous spell
+ if (caster->IsNonMeleeSpellCasted(false) && param3 & CAST_INTURRUPT_PREVIOUS)
+ caster->InterruptNonMeleeSpells(false);
+
+ caster->CastSpell(target, param1, (param3 & CAST_TRIGGERED));
+ }
+
+ }else
+ sLog.outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", EventId, m_creature.GetEntry(), param1);
+ }
+ }
+ break;
+ case ACTION_T_SUMMON:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ Creature* pCreature = NULL;
+
+ if (param3)
+ pCreature = m_creature.SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, param3);
+ else
+ pCreature = m_creature.SummonCreature(param1, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
+
+ if (!pCreature)
+ {
+
+ sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", param1, EventId, m_creature.GetEntry());
+ }
+ else if (param2 != TARGET_T_SELF && target)
+ pCreature->AI()->AttackStart(target);
+ }
+ break;
+ case ACTION_T_THREAT_SINGLE_PCT:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ if (target)
+ m_creature.getThreatManager().modifyThreatPercent(target, param1);
+ }
+ break;
+ case ACTION_T_THREAT_ALL_PCT:
+ {
+ Unit* Temp = NULL;
+
+ std::list<HostilReference*>::iterator i = m_creature.getThreatManager().getThreatList().begin();
+ for (; i != m_creature.getThreatManager().getThreatList().end(); ++i)
+ {
+ Temp = Unit::GetUnit(m_creature,(*i)->getUnitGuid());
+ if (Temp)
+ m_creature.getThreatManager().modifyThreatPercent(Temp, param1);
+ }
+ }
+ break;
+ case ACTION_T_QUEST_EVENT:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)target)->AreaExploredOrEventHappens(param1);
+ }
+ break;
+ case ACTION_T_CASTCREATUREGO:
+ {
+ Unit* target = GetTargetByType(param3, pActionInvoker);
+
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)target)->CastedCreatureOrGO(param1, m_creature.GetGUID(), param2);
+ }
+ break;
+ case ACTION_T_SET_UNIT_FIELD:
+ {
+ Unit* target = GetTargetByType(param3, pActionInvoker);
+
+ if (param1 < OBJECT_END || param1 >= UNIT_END)
+ return;
+
+ if (target)
+ target->SetUInt32Value(param1, param2);
+ }
+ break;
+ case ACTION_T_SET_UNIT_FLAG:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ if (target)
+ target->SetFlag(UNIT_FIELD_FLAGS, param1);
+ }
+ break;
+ case ACTION_T_REMOVE_UNIT_FLAG:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ if (target)
+ target->RemoveFlag(UNIT_FIELD_FLAGS, param1);
+ }
+ break;
+ case ACTION_T_AUTO_ATTACK:
+ {
+ if (param1)
+ MeleeEnabled = true;
+ else MeleeEnabled = false;
+ }
+ break;
+ case ACTION_T_COMBAT_MOVEMENT:
+ {
+ CombatMovementEnabled = param1;
+
+ //Allow movement (create new targeted movement gen only if idle)
+ if (CombatMovementEnabled)
+ {
+ m_creature.GetMotionMaster()->MoveChase(m_creature.getVictim(), AttackDistance, AttackAngle);
+ }
+ else
+ {
+ m_creature.GetMotionMaster()->MoveIdle();
+ }
+ }
+ break;
+ case ACTION_T_SET_PHASE:
+ {
+ Phase = param1;
+ }
+ break;
+ case ACTION_T_INC_PHASE:
+ {
+ Phase += param1;
+
+ if (Phase > 31)
+
+ sLog.outErrorDb( "CreatureEventAI: Event %d incremented Phase above 31. Phase mask cannot be used with phases past 31. CreatureEntry = %d", EventId, m_creature.GetEntry());
+ }
+ break;
+ case ACTION_T_EVADE:
+ {
+ EnterEvadeMode();
+ }
+ break;
+ case ACTION_T_FLEE:
+ {
+ if(m_creature.HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
+ break;
+ TimetoFleeLeft = 8000;
+ m_creature.DoFleeToGetAssistance();
+ IsFleeing = true;
+ }
+ break;
+ case ACTION_T_QUEST_EVENT_ALL:
+ {
+ Unit* Temp = NULL;
+ if( pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER )
+ {
+ Temp = Unit::GetUnit(m_creature,pActionInvoker->GetGUID());
+ if( Temp )
+ ((Player*)Temp)->GroupEventHappens(param1,&m_creature);
+ }
+ }
+ break;
+ case ACTION_T_CASTCREATUREGO_ALL:
+ {
+ Unit* Temp = NULL;
+
+ std::list<HostilReference*>::iterator i = m_creature.getThreatManager().getThreatList().begin();
+ for (; i != m_creature.getThreatManager().getThreatList().end(); ++i)
+ {
+ Temp = Unit::GetUnit(m_creature,(*i)->getUnitGuid());
+ if (Temp && Temp->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)Temp)->CastedCreatureOrGO(param1, m_creature.GetGUID(), param2);
+ }
+ }
+ break;
+ case ACTION_T_REMOVEAURASFROMSPELL:
+ {
+ Unit* target = GetTargetByType(param1, pActionInvoker);
+
+ if (target)
+ target->RemoveAurasDueToSpell(param2);
+ }
+ break;
+ case ACTION_T_RANGED_MOVEMENT:
+ {
+ AttackDistance = param1;
+ AttackAngle = ((float)param2/180)*M_PI;
+
+ if (CombatMovementEnabled)
+ {
+ m_creature.GetMotionMaster()->MoveChase(m_creature.getVictim(), AttackDistance, AttackAngle);
+ }
+ }
+ break;
+ case ACTION_T_RANDOM_PHASE:
+ {
+ uint32 temp = GetRandActionParam(rnd, param1, param2, param3);
+
+ Phase = temp;
+ }
+ break;
+ case ACTION_T_RANDOM_PHASE_RANGE:
+ {
+ if (param2 > param1)
+ {
+ Phase = param1 + (rnd % (param2 - param1));
+ }
+ else
+ sLog.outErrorDb( "CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature.GetEntry());
+ }
+ break;
+ case ACTION_T_SUMMON_ID:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+
+ //Duration
+ Creature* pCreature = NULL;
+
+ CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(param3);
+ if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end())
+ {
+
+ sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", param1, param3, EventId, m_creature.GetEntry());
+ return;
+ }
+
+ if ((*i).second.SpawnTimeSecs)
+ pCreature = m_creature.SummonCreature(param1, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
+ else pCreature = m_creature.SummonCreature(param1, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
+
+ if (!pCreature)
+ {
+
+ sLog.outErrorDb( "CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", param1, EventId, m_creature.GetEntry());
+ }
+ else if (param2 != TARGET_T_SELF && target)
+ pCreature->AI()->AttackStart(target);
+ }
+ break;
+ case ACTION_T_KILLED_MONSTER:
+ {
+ //first attempt player who tapped creature
+ if (Player* pPlayer = m_creature.GetLootRecipient())
+ pPlayer->RewardPlayerAndGroupAtEvent(param1, &m_creature);
+ else
+ {
+ //if not available, use pActionInvoker
+ Unit* pTarget = GetTargetByType(param2, pActionInvoker);
+
+ if (Player* pPlayer = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
+ pPlayer->RewardPlayerAndGroupAtEvent(param1, &m_creature);
+ }
+ }
+ break;
+ case ACTION_T_SET_INST_DATA:
+ {
+ InstanceData* pInst = (InstanceData*)m_creature.GetInstanceData();
+ if (!pInst)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+
+ pInst->SetData(param1, param2);
+ }
+ break;
+ case ACTION_T_SET_INST_DATA64:
+ {
+ Unit* target = GetTargetByType(param2, pActionInvoker);
+ if (!target)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+
+ InstanceData* pInst = (InstanceData*)m_creature.GetInstanceData();
+ if (!pInst)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+
+ pInst->SetData64(param1, target->GetGUID());
+ }
+ break;
+ case ACTION_T_UPDATE_TEMPLATE:
+ {
+ if (m_creature.GetEntry() == param1)
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+
+ m_creature.UpdateEntry(param1, param2 ? HORDE : ALLIANCE);
+ }
+ break;
+ case ACTION_T_DIE:
+ {
+ if (m_creature.isDead())
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+ m_creature.DealDamage(&m_creature, m_creature.GetMaxHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ }
+ break;
+ case ACTION_T_ZONE_COMBAT_PULSE:
+ {
+ if (!m_creature.isInCombat() || !m_creature.GetMap()->IsDungeon())
+ {
+
+ sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_ZONE_COMBAT_PULSE on creature out of combat or in non-dungeon map. Creature %d", EventId, m_creature.GetEntry());
+ return;
+ }
+
+ DoZoneInCombat(&m_creature);
+ }
+ break;
+
+ // TRINITY ONLY
+ case ACTION_T_SET_ACTIVE:
+ me->setActive(param1 ? true : false);
+ break;
+ case ACTION_T_SET_AGGRESSIVE:
+ me->SetReactState(ReactStates(param1));
+ break;
+ case ACTION_T_ATTACK_START_PULSE:
+ AttackStart(me->SelectNearestTarget((float)param1));
+ break;
+ }
+}
+
+void CreatureEventAI::JustRespawned()
+{
+ InCombat = false;
+ IsFleeing = false;
+ Reset();
+
+ if (bEmptyList)
+ return;
+
+ //Handle Spawned Events
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_SPAWNED)
+ ProcessEvent(*i);
+ }
+}
+
+void CreatureEventAI::Reset()
+{
+ EventUpdateTime = EVENT_UPDATE_TIME;
+ EventDiff = 0;
+
+ TimetoFleeLeft = 0;
+ IsFleeing = false;
+
+ if (bEmptyList)
+ return;
+
+ //Reset all events to enabled
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ switch ((*i).Event.event_type)
+ {
+ //Reset all out of combat timers
+ case EVENT_T_TIMER_OOC:
+ {
+ if ((*i).Event.event_param2 == (*i).Event.event_param1)
+ {
+ (*i).Time = (*i).Event.event_param1;
+ (*i).Enabled = true;
+ }
+ else if ((*i).Event.event_param2 > (*i).Event.event_param1)
+ {
+ (*i).Time = urand((*i).Event.event_param1, (*i).Event.event_param2);
+ (*i).Enabled = true;
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has InitialMax < InitialMin. Event disabled.", m_creature.GetEntry(), (*i).Event.event_id, (*i).Event.event_type);
+ }
+ break;
+ //default:
+ //TODO: enable below code line / verify this is correct to enable events previously disabled (ex. aggro yell), instead of enable this in void Aggro()
+ //(*i).Enabled = true;
+ //(*i).Time = 0;
+ //break;
+ }
+ }
+}
+
+void CreatureEventAI::JustReachedHome()
+{
+ m_creature.LoadCreaturesAddon();
+
+ if (!bEmptyList)
+ {
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_REACHED_HOME)
+ ProcessEvent(*i);
+ }
+ }
+
+ Reset();
+}
+
+void CreatureEventAI::EnterEvadeMode()
+{
+ m_creature.InterruptNonMeleeSpells(true);
+ m_creature.RemoveAllAuras();
+ m_creature.DeleteThreatList();
+ m_creature.CombatStop();
+
+ if (m_creature.isAlive())
+ m_creature.GetMotionMaster()->MoveTargetedHome();
+
+ m_creature.SetLootRecipient(NULL);
+
+ InCombat = false;
+
+ if (bEmptyList)
+ return;
+
+ //Handle Evade events
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_EVADE)
+ ProcessEvent(*i);
+ }
+}
+
+void CreatureEventAI::JustDied(Unit* killer)
+{
+ InCombat = false;
+ IsFleeing = false;
+ Reset();
+
+ if (bEmptyList)
+ return;
+
+ //Handle Evade events
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_DEATH)
+ ProcessEvent(*i, killer);
+ }
+}
+
+void CreatureEventAI::KilledUnit(Unit* victim)
+{
+ if (bEmptyList || victim->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_KILL)
+ ProcessEvent(*i, victim);
+ }
+}
+
+void CreatureEventAI::JustSummoned(Creature* pUnit)
+{
+ if (bEmptyList || !pUnit)
+ return;
+
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_SUMMONED_UNIT)
+ ProcessEvent(*i, pUnit);
+ }
+}
+
+void CreatureEventAI::Aggro(Unit *who)
+{
+ //Check for on combat start events
+ if (!bEmptyList)
+ {
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ switch ((*i).Event.event_type)
+ {
+ case EVENT_T_AGGRO:
+ (*i).Enabled = true;
+ ProcessEvent(*i, who);
+ break;
+ //Reset all in combat timers
+ case EVENT_T_TIMER:
+ if ((*i).Event.event_param2 == (*i).Event.event_param1)
+ {
+ (*i).Time = (*i).Event.event_param1;
+ (*i).Enabled = true;
+ }
+ else if ((*i).Event.event_param2 > (*i).Event.event_param1)
+ {
+ (*i).Time = urand((*i).Event.event_param1, (*i).Event.event_param2);
+ (*i).Enabled = true;
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u (Type = %u) has InitialMax < InitialMin. Event disabled.", m_creature.GetEntry(), (*i).Event.event_id, (*i).Event.event_type);
+ break;
+ //All normal events need to be re-enabled and their time set to 0
+ default:
+ (*i).Enabled = true;
+ (*i).Time = 0;
+ break;
+ }
+ }
+ }
+
+ EventUpdateTime = EVENT_UPDATE_TIME;
+ EventDiff = 0;
+}
+
+void CreatureEventAI::AttackStart(Unit *who)
+{
+ if (!who)
+ return;
+
+ if (m_creature.Attack(who, MeleeEnabled))
+ {
+ if (!InCombat)
+ {
+ InCombat = true;
+ Aggro(who);
+ }
+
+ if (CombatMovementEnabled)
+ {
+ m_creature.GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
+ }
+ else
+ {
+ m_creature.GetMotionMaster()->MoveIdle();
+ }
+ }
+}
+
+void CreatureEventAI::MoveInLineOfSight(Unit *who)
+{
+ if (!who || InCombat)
+ return;
+
+ //Check for OOC LOS Event
+ if (!bEmptyList && !m_creature.getVictim())
+ {
+ for (std::list<CreatureEventAIHolder>::iterator itr = CreatureEventAIList.begin(); itr != CreatureEventAIList.end(); ++itr)
+ {
+ if ((*itr).Event.event_type == EVENT_T_OOC_LOS)
+ {
+ //can trigger if closer than fMaxAllowedRange
+ float fMaxAllowedRange = (*itr).Event.event_param2;
+
+ //if range is ok and we are actually in LOS
+ if (m_creature.IsWithinDistInMap(who, fMaxAllowedRange) && m_creature.IsWithinLOSInMap(who))
+ {
+ //if friendly event&&who is not hostile OR hostile event&&who is hostile
+ if (((*itr).Event.event_param1 && !m_creature.IsHostileTo(who)) ||
+ ((!(*itr).Event.event_param1) && m_creature.IsHostileTo(who)))
+ ProcessEvent(*itr, who);
+ }
+ }
+ }
+ }
+
+ //if (m_creature.isCivilian() && m_creature.IsNeutralToAll())
+ // return;
+
+ if(me->canStartAttack(who))
+ AttackStart(who);
+}
+
+void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
+{
+
+ if (bEmptyList)
+ return;
+
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ if ((*i).Event.event_type == EVENT_T_SPELLHIT)
+ {
+ //If spell id matches (or no spell id) & if spell school matches (or no spell school)
+ if (!(*i).Event.event_param1 || pSpell->Id == (*i).Event.event_param1)
+ {
+ if ((*i).Event.event_param2_s == -1 || pSpell->SchoolMask == (*i).Event.event_param2)
+ ProcessEvent(*i, pUnit);
+ }
+ }
+ }
+}
+
+void CreatureEventAI::UpdateAI(const uint32 diff)
+{
+ //Check if we are in combat (also updates calls threat update code)
+ bool Combat = InCombat ? UpdateVictim() : false;
+
+ //Must return if creature isn't alive. Normally select hostil target and get victim prevent this
+ if (!m_creature.isAlive())
+ return;
+
+ if (IsFleeing)
+ {
+ if(TimetoFleeLeft < diff)
+ {
+ me->SetControlled(false, UNIT_STAT_FLEEING);
+ me->SetNoCallAssistance(false);
+ me->CallAssistance();
+ if(me->getVictim())
+ me->GetMotionMaster()->MoveChase(me->getVictim());
+ IsFleeing = false;
+ }
+ else
+ TimetoFleeLeft -= diff;
+
+ return;
+ }
+
+ if (!bEmptyList)
+ {
+ //Events are only updated once every EVENT_UPDATE_TIME ms to prevent lag with large amount of events
+ if (EventUpdateTime < diff)
+ {
+ EventDiff += diff;
+
+ //Check for time based events
+ for (std::list<CreatureEventAIHolder>::iterator i = CreatureEventAIList.begin(); i != CreatureEventAIList.end(); ++i)
+ {
+ //Decrement Timers
+ if ((*i).Time)
+ {
+ if ((*i).Time > EventDiff)
+ {
+ //Do not decrement timers if event cannot trigger in this phase
+ if (!((*i).Event.event_inverse_phase_mask & (1 << Phase)))
+ (*i).Time -= EventDiff;
+
+ //Skip processing of events that have time remaining
+ continue;
+ }
+ else (*i).Time = 0;
+ }
+
+ //Events that are updated every EVENT_UPDATE_TIME
+ switch ((*i).Event.event_type)
+ {
+ case EVENT_T_TIMER_OOC:
+ ProcessEvent(*i);
+ break;
+ case EVENT_T_TIMER:
+ case EVENT_T_MANA:
+ case EVENT_T_HP:
+ case EVENT_T_TARGET_HP:
+ case EVENT_T_TARGET_CASTING:
+ case EVENT_T_FRIENDLY_HP:
+ if (Combat)
+ ProcessEvent(*i);
+ break;
+ case EVENT_T_RANGE:
+ if (Combat)
+ {
+ if (m_creature.IsWithinDistInMap(m_creature.getVictim(),(float)(*i).Event.event_param2))
+ {
+ if (m_creature.GetDistance(m_creature.getVictim()) >= (float)(*i).Event.event_param1)
+ ProcessEvent(*i);
+ }
+ }
+ break;
+ }
+ }
+
+ EventDiff = 0;
+ EventUpdateTime = EVENT_UPDATE_TIME;
+ }
+ else
+ {
+ EventDiff += diff;
+ EventUpdateTime -= diff;
+ }
+ }
+
+ //Melee Auto-Attack
+ if (Combat && MeleeEnabled)
+ DoMeleeAttackIfReady();
+}
+
+inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position)
+{
+ //ThreatList m_threatlist;
+ std::list<HostilReference*>& m_threatlist = m_creature.getThreatManager().getThreatList();
+ std::list<HostilReference*>::iterator i = m_threatlist.begin();
+ std::list<HostilReference*>::reverse_iterator r = m_threatlist.rbegin();
+
+ if (position >= m_threatlist.size() || !m_threatlist.size())
+ return NULL;
+
+ switch (target)
+ {
+ case ATTACKING_TARGET_RANDOM:
+ {
+ advance ( i , position + (rand() % (m_threatlist.size() - position ) ));
+ return Unit::GetUnit(m_creature,(*i)->getUnitGuid());
+ }
+ case ATTACKING_TARGET_TOPAGGRO:
+ {
+ advance ( i , position);
+ return Unit::GetUnit(m_creature,(*i)->getUnitGuid());
+ }
+ case ATTACKING_TARGET_BOTTOMAGGRO:
+ {
+ advance ( r , position);
+ return Unit::GetUnit(m_creature,(*r)->getUnitGuid());
+ }
+ }
+ return NULL;
+}
+
+inline uint32 CreatureEventAI::GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3)
+{
+ switch (rnd % 3)
+ {
+ case 0:
+ return param1;
+ break;
+ case 1:
+ return param2;
+ break;
+ case 2:
+ return param3;
+ break;
+ }
+ return 0;
+}
+
+inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoker)
+{
+ switch (Target)
+ {
+ case TARGET_T_SELF:
+ return &m_creature;
+ break;
+ case TARGET_T_HOSTILE:
+ return m_creature.getVictim();
+ break;
+ case TARGET_T_HOSTILE_SECOND_AGGRO:
+ return SelectUnit(ATTACKING_TARGET_TOPAGGRO,1);
+ break;
+ case TARGET_T_HOSTILE_LAST_AGGRO:
+ return SelectUnit(ATTACKING_TARGET_BOTTOMAGGRO,0);
+ break;
+ case TARGET_T_HOSTILE_RANDOM:
+ return SelectUnit(ATTACKING_TARGET_RANDOM,0);
+ break;
+ case TARGET_T_HOSTILE_RANDOM_NOT_TOP:
+ return SelectUnit(ATTACKING_TARGET_RANDOM,1);
+ break;
+ case TARGET_T_ACTION_INVOKER:
+ return pActionInvoker;
+ break;
+ default:
+ return NULL;
+ break;
+ };
+}
+
+Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
+{
+ CellPair p(MaNGOS::ComputeCellPair(m_creature.GetPositionX(), m_creature.GetPositionY()));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Unit* pUnit = NULL;
+
+ MaNGOS::MostHPMissingInRange u_check(&m_creature, range, MinHPDiff);
+ MaNGOS::UnitLastSearcher<MaNGOS::MostHPMissingInRange> searcher(&m_creature, pUnit, u_check);
+
+ /*
+ typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes;
+ This means that if we only search grid then we cannot possibly return pets or players so this is safe
+ */
+ TypeContainerVisitor<MaNGOS::UnitLastSearcher<MaNGOS::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, grid_unit_searcher, *m_creature.GetMap());
+ return pUnit;
+}
+
+void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
+{
+ CellPair p(MaNGOS::ComputeCellPair(m_creature.GetPositionX(), m_creature.GetPositionY()));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ MaNGOS::FriendlyCCedInRange u_check(&m_creature, range);
+ MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange> searcher(&m_creature, _list, u_check);
+
+ TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature.GetMap());
+}
+
+void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid)
+{
+ CellPair p(MaNGOS::ComputeCellPair(m_creature.GetPositionX(), m_creature.GetPositionY()));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ MaNGOS::FriendlyMissingBuffInRange u_check(&m_creature, range, spellid);
+ MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange> searcher(&m_creature, _list, u_check);
+
+ TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
+
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature.GetMap());
+}
+
+//*********************************
+//*** Functions used globally ***
+
+void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target)
+{
+ if (!pSource)
+ {
+ sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i, invalid Source pointer.",textEntry);
+ return;
+ }
+
+ if (textEntry >= 0)
+ {
+ sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry);
+ return;
+ }
+
+ CreatureEventAI_TextMap::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAITextMap().find(textEntry);
+
+ if (i == CreatureEAI_Mgr.GetCreatureEventAITextMap().end())
+ {
+ sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry);
+ return;
+ }
+
+ sLog.outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
+
+ if((*i).second.SoundId)
+ {
+ if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId))
+ pSource->PlayDirectSound((*i).second.SoundId);
+ else
+ sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId);
+ }
+
+ if((*i).second.Emote)
+ {
+ if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER)
+ {
+ ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote);
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId());
+ }
+
+ switch((*i).second.Type)
+ {
+ case CHAT_TYPE_SAY:
+ pSource->MonsterSay(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
+ break;
+ case CHAT_TYPE_YELL:
+ pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
+ break;
+ case CHAT_TYPE_TEXT_EMOTE:
+ pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0);
+ break;
+ case CHAT_TYPE_BOSS_EMOTE:
+ pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0, true);
+ break;
+ case CHAT_TYPE_WHISPER:
+ {
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
+ pSource->MonsterWhisper(textEntry, target->GetGUID());
+ else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ }break;
+ case CHAT_TYPE_BOSS_WHISPER:
+ {
+ if (target && target->GetTypeId() == TYPEID_PLAYER)
+ pSource->MonsterWhisper(textEntry, target->GetGUID(), true);
+ else sLog.outErrorDb("CreatureEventAI: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry);
+ }break;
+ case CHAT_TYPE_ZONE_YELL:
+ pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0);
+ break;
+ }
+}
+
+bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
+{
+ //No target so we can't cast
+ if (!Target || !Spell)
+ return false;
+
+ //Silenced so we can't cast
+ if (!Triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+ return false;
+
+ //Check for power
+ if (!Triggered && me->GetPower((Powers)Spell->powerType) < Spell->manaCost)
+ return false;
+
+ SpellRangeEntry const *TempRange = NULL;
+
+ TempRange = GetSpellRangeStore()->LookupEntry(Spell->rangeIndex);
+
+ //Spell has invalid range store so we can't use it
+ if (!TempRange)
+ return false;
+
+ //Unit is out of range of this spell
+ if (me->GetDistance(Target) > me->GetSpellMaxRangeForTarget(Target, TempRange)
+ || me->GetDistance(Target) < me->GetSpellMinRangeForTarget(Target, TempRange))
+ return false;
+
+ return true;
+}
+
+bool CreatureEventAI::ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32 uiEmote)
+{
+ if(pCreature->isCharmed())
+ return true;
+
+ CreatureEventAI* pTmpCreature = (CreatureEventAI*)(pCreature->AI());
+
+ if (pTmpCreature->bEmptyList)
+ return true;
+
+ for (std::list<CreatureEventAIHolder>::iterator itr = pTmpCreature->CreatureEventAIList.begin(); itr != pTmpCreature->CreatureEventAIList.end(); ++itr)
+ {
+ if ((*itr).Event.event_type == EVENT_T_RECEIVE_EMOTE)
+ {
+ if ((*itr).Event.event_param1 != uiEmote)
+ return true;
+
+ bool bProcess = false;
+
+ switch((*itr).Event.event_param2)
+ {
+ //enum ConditionType
+ case CONDITION_NONE: // 0 0
+ bProcess = true;
+ break;
+ case CONDITION_AURA: // spell_id effindex
+ if (pPlayer->HasAura((*itr).Event.event_param3,(*itr).Event.event_param4))
+ bProcess = true;
+ break;
+ case CONDITION_ITEM: // item_id count
+ if (pPlayer->HasItemCount((*itr).Event.event_param3,(*itr).Event.event_param4))
+ bProcess = true;
+ break;
+ case CONDITION_ITEM_EQUIPPED: // item_id count
+ if (pPlayer->HasItemOrGemWithIdEquipped((*itr).Event.event_param3,(*itr).Event.event_param4))
+ bProcess = true;
+ break;
+ case CONDITION_ZONEID: // zone_id 0
+ if (pPlayer->GetZoneId() == (*itr).Event.event_param3)
+ bProcess = true;
+ break;
+ case CONDITION_REPUTATION_RANK: // faction_id min_rank
+ if (pPlayer->GetReputationRank((*itr).Event.event_param3) >= (*itr).Event.event_param4)
+ bProcess = true;
+ break;
+ case CONDITION_TEAM: // player_team 0, (469 - Alliance 67 - Horde)
+ if (pPlayer->GetTeam() == (*itr).Event.event_param3)
+ bProcess = true;
+ break;
+ case CONDITION_SKILL: // skill_id min skill_value
+ if (pPlayer->HasSkill((*itr).Event.event_param3) && pPlayer->GetSkillValue((*itr).Event.event_param3) >= (*itr).Event.event_param4)
+ bProcess = true;
+ break;
+ case CONDITION_QUESTREWARDED: // quest_id 0
+ if (pPlayer->GetQuestRewardStatus((*itr).Event.event_param3))
+ bProcess = true;
+ break;
+ case CONDITION_QUESTTAKEN: // quest_id 0, for condition true while quest active.
+ if (pPlayer->GetQuestStatus((*itr).Event.event_param3) == QUEST_STATUS_INCOMPLETE)
+ bProcess = true;
+ break;
+ case CONDITION_ACTIVE_EVENT: // event_id 0
+ if (IsHolidayActive(HolidayIds((*itr).Event.event_param3)))
+ bProcess = true;
+ break;
+ }
+
+ if (bProcess)
+ {
+ sLog.outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
+ pTmpCreature->ProcessEvent(*itr, pPlayer);
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h
new file mode 100644
index 00000000000..74ea7a40a6a
--- /dev/null
+++ b/src/game/CreatureEventAI.h
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MANGOS_CREATURE_EAI_H
+#define MANGOS_CREATURE_EAI_H
+
+#include "Common.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "Unit.h"
+
+class Player;
+class WorldObject;
+
+#define EVENT_UPDATE_TIME 500
+#define SPELL_RUN_AWAY 8225
+#define MAX_ACTIONS 3
+#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
+
+enum Event_Types
+{
+ EVENT_T_TIMER = 0, //InitialMin, InitialMax, RepeatMin, RepeatMax
+ EVENT_T_TIMER_OOC = 1, //InitialMin, InitialMax, RepeatMin, RepeatMax
+ EVENT_T_HP = 2, //HPMax%, HPMin%, RepeatMin, RepeatMax
+ EVENT_T_MANA = 3, //ManaMax%,ManaMin% RepeatMin, RepeatMax
+ EVENT_T_AGGRO = 4, //NONE
+ EVENT_T_KILL = 5, //RepeatMin, RepeatMax
+ EVENT_T_DEATH = 6, //NONE
+ EVENT_T_EVADE = 7, //NONE
+ EVENT_T_SPELLHIT = 8, //SpellID, School, RepeatMin, RepeatMax
+ EVENT_T_RANGE = 9, //MinDist, MaxDist, RepeatMin, RepeatMax
+ EVENT_T_OOC_LOS = 10, //NoHostile, NoFriendly, RepeatMin, RepeatMax
+ EVENT_T_SPAWNED = 11, //NONE
+ EVENT_T_TARGET_HP = 12, //HPMax%, HPMin%, RepeatMin, RepeatMax
+ EVENT_T_TARGET_CASTING = 13, //RepeatMin, RepeatMax
+ EVENT_T_FRIENDLY_HP = 14, //HPDeficit, Radius, RepeatMin, RepeatMax
+ EVENT_T_FRIENDLY_IS_CC = 15, //DispelType, Radius, RepeatMin, RepeatMax
+ EVENT_T_FRIENDLY_MISSING_BUFF = 16, //SpellId, Radius, RepeatMin, RepeatMax
+ EVENT_T_SUMMONED_UNIT = 17, //CreatureId, RepeatMin, RepeatMax
+ EVENT_T_TARGET_MANA = 18, //ManaMax%, ManaMin%, RepeatMin, RepeatMax
+ EVENT_T_QUEST_ACCEPT = 19, //QuestID
+ EVENT_T_QUEST_COMPLETE = 20, //
+ EVENT_T_REACHED_HOME = 21, //NONE
+ EVENT_T_RECEIVE_EMOTE = 22, //EmoteId, Condition, CondValue1, CondValue2
+
+ EVENT_T_END,
+};
+
+enum Action_Types
+{
+ ACTION_T_NONE = 0, //No action
+ ACTION_T_TEXT = 1, //-TextId1, optionally -TextId2, optionally -TextId3(if -TextId2 exist). If more than just -TextId1 is defined, randomize. Negative values.
+ ACTION_T_SET_FACTION = 2, //FactionId (or 0 for default)
+ ACTION_T_MORPH_TO_ENTRY_OR_MODEL = 3, //Creature_template entry(param1) OR ModelId (param2) (or 0 for both to demorph)
+ ACTION_T_SOUND = 4, //SoundId
+ ACTION_T_EMOTE = 5, //EmoteId
+ ACTION_T_RANDOM_SAY = 6, //UNUSED
+ ACTION_T_RANDOM_YELL = 7, //UNUSED
+ ACTION_T_RANDOM_TEXTEMOTE = 8, //UNUSED
+ ACTION_T_RANDOM_SOUND = 9, //SoundId1, SoundId2, SoundId3 (-1 in any field means no output if randomed that field)
+ ACTION_T_RANDOM_EMOTE = 10, //EmoteId1, EmoteId2, EmoteId3 (-1 in any field means no output if randomed that field)
+ ACTION_T_CAST = 11, //SpellId, Target, CastFlags
+ ACTION_T_SUMMON = 12, //CreatureID, Target, Duration in ms
+ ACTION_T_THREAT_SINGLE_PCT = 13, //Threat%, Target
+ ACTION_T_THREAT_ALL_PCT = 14, //Threat%
+ ACTION_T_QUEST_EVENT = 15, //QuestID, Target
+ ACTION_T_CASTCREATUREGO = 16, //QuestID, SpellId, Target
+ ACTION_T_SET_UNIT_FIELD = 17, //Field_Number, Value, Target
+ ACTION_T_SET_UNIT_FLAG = 18, //Flags (may be more than one field OR'd together), Target
+ ACTION_T_REMOVE_UNIT_FLAG = 19, //Flags (may be more than one field OR'd together), Target
+ ACTION_T_AUTO_ATTACK = 20, //AllowAttackState (0 = stop attack, anything else means continue attacking)
+ ACTION_T_COMBAT_MOVEMENT = 21, //AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
+ ACTION_T_SET_PHASE = 22, //Phase
+ ACTION_T_INC_PHASE = 23, //Value (may be negative to decrement phase, should not be 0)
+ ACTION_T_EVADE = 24, //No Params
+ ACTION_T_FLEE = 25, //No Params
+ ACTION_T_QUEST_EVENT_ALL = 26, //QuestID
+ ACTION_T_CASTCREATUREGO_ALL = 27, //QuestId, SpellId
+ ACTION_T_REMOVEAURASFROMSPELL = 28, //Target, Spellid
+ ACTION_T_RANGED_MOVEMENT = 29, //Distance, Angle
+ ACTION_T_RANDOM_PHASE = 30, //PhaseId1, PhaseId2, PhaseId3
+ ACTION_T_RANDOM_PHASE_RANGE = 31, //PhaseMin, PhaseMax
+ ACTION_T_SUMMON_ID = 32, //CreatureId, Target, SpawnId
+ ACTION_T_KILLED_MONSTER = 33, //CreatureId, Target
+ ACTION_T_SET_INST_DATA = 34, //Field, Data
+ ACTION_T_SET_INST_DATA64 = 35, //Field, Target
+ ACTION_T_UPDATE_TEMPLATE = 36, //Entry, Team
+ ACTION_T_DIE = 37, //No Params
+ ACTION_T_ZONE_COMBAT_PULSE = 38, //No Params
+
+ ACTION_T_SET_ACTIVE = 101, //Apply
+ ACTION_T_SET_AGGRESSIVE = 102, //Apply
+ ACTION_T_ATTACK_START_PULSE = 103, //Distance
+
+ ACTION_T_END,
+};
+
+enum Target
+{
+ //Self (m_creature)
+ TARGET_T_SELF = 0, //Self cast
+
+ //Hostile targets (if pet then returns pet owner)
+ TARGET_T_HOSTILE, //Our current target (ie: highest aggro)
+ TARGET_T_HOSTILE_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
+ TARGET_T_HOSTILE_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
+ TARGET_T_HOSTILE_RANDOM, //Just any random target on our threat list
+ TARGET_T_HOSTILE_RANDOM_NOT_TOP, //Any random target except top threat
+
+ //Invoker targets (if pet then returns pet owner)
+ TARGET_T_ACTION_INVOKER, //Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF)
+
+ //Hostile targets (including pets)
+ TARGET_T_HOSTILE_WPET, //Current target (can be a pet)
+ TARGET_T_HOSTILE_WPET_SECOND_AGGRO, //Second highest aggro (generaly used for cleaves and some special attacks)
+ TARGET_T_HOSTILE_WPET_LAST_AGGRO, //Dead last on aggro (no idea what this could be used for)
+ TARGET_T_HOSTILE_WPET_RANDOM, //Just any random target on our threat list
+ TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, //Any random target except top threat
+
+ TARGET_T_ACTION_INVOKER_WPET,
+
+ TARGET_T_END
+};
+
+enum CastFlags
+{
+ CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
+ CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
+ CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
+ CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
+ CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
+ CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
+};
+
+enum EventFlags
+{
+ EFLAG_REPEATABLE = 0x01, //Event repeats
+ EFLAG_NORMAL = 0x02, //Event only occurs in Normal instance difficulty
+ EFLAG_HEROIC = 0x04, //Event only occurs in Heroic instance difficulty
+ EFLAG_RESERVED_3 = 0x08,
+ EFLAG_RESERVED_4 = 0x10,
+ EFLAG_RESERVED_5 = 0x20,
+ EFLAG_RESERVED_6 = 0x40,
+ EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build of SD2 only
+};
+
+// String text additional data, used in (CreatureEventAI)
+struct StringTextData
+{
+ uint32 SoundId;
+ uint8 Type;
+ uint32 Language;
+ uint32 Emote;
+};
+// Text Maps
+typedef UNORDERED_MAP<int32, StringTextData> CreatureEventAI_TextMap;
+
+struct CreatureEventAI_Event
+{
+ uint32 event_id;
+
+ uint32 creature_id;
+
+ uint16 event_type;
+ uint32 event_inverse_phase_mask;
+ uint8 event_chance;
+ uint8 event_flags;
+ union
+ {
+ uint32 event_param1;
+ int32 event_param1_s;
+ };
+ union
+ {
+ uint32 event_param2;
+ int32 event_param2_s;
+ };
+ union
+ {
+ uint32 event_param3;
+ int32 event_param3_s;
+ };
+ union
+ {
+ uint32 event_param4;
+ int32 event_param4_s;
+ };
+
+ struct _action
+ {
+ uint16 type;
+ union
+ {
+ uint32 param1;
+ int32 param1_s;
+ };
+ union
+ {
+ uint32 param2;
+ int32 param2_s;
+ };
+ union
+ {
+ uint32 param3;
+ int32 param3_s;
+ };
+ }action[MAX_ACTIONS];
+};
+//Event_Map
+typedef UNORDERED_MAP<uint32, std::vector<CreatureEventAI_Event> > CreatureEventAI_Event_Map;
+
+struct CreatureEventAI_Summon
+{
+ uint32 id;
+
+ float position_x;
+ float position_y;
+ float position_z;
+ float orientation;
+ uint32 SpawnTimeSecs;
+};
+
+//EventSummon_Map
+typedef UNORDERED_MAP<uint32, CreatureEventAI_Summon> CreatureEventAI_Summon_Map;
+
+struct CreatureEventAIHolder
+{
+ CreatureEventAIHolder(CreatureEventAI_Event p) : Event(p), Time(0), Enabled(true){}
+
+ CreatureEventAI_Event Event;
+ uint32 Time;
+ bool Enabled;
+};
+
+class TRINITY_DLL_SPEC CreatureEventAI : public CreatureAI
+{
+
+ public:
+ CreatureEventAI(Creature *c);
+ ~CreatureEventAI()
+ {
+ CreatureEventAIList.clear();
+ }
+ void JustRespawned();
+ void Reset();
+ void JustReachedHome();
+ void EnterEvadeMode();
+ void JustDied(Unit* killer);
+ void KilledUnit(Unit* victim);
+ void JustSummoned(Creature* pUnit);
+ void Aggro(Unit *who);
+ void AttackStart(Unit *who);
+ void MoveInLineOfSight(Unit *who);
+ void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
+ void UpdateAI(const uint32 diff);
+ static int Permissible(const Creature *);
+
+ bool ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pActionInvoker = NULL);
+ void ProcessAction(uint16 type, uint32 param1, uint32 param2, uint32 param3, uint32 rnd, uint32 EventId, Unit* pActionInvoker);
+ inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3);
+ inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker);
+ inline Unit* SelectUnit(AttackingTarget target, uint32 position);
+
+ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target);
+ bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered);
+ bool ReceiveEmote(Player* pPlayer, Creature* pCreature, uint32 uiEmote);
+
+ Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff);
+ void DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid);
+ void DoFindFriendlyCC(std::list<Creature*>& _list, float range);
+
+ //Pointer to creature we are manipulating
+ Creature& m_creature;
+
+ //Bool for if we are in combat or not
+ bool InCombat;
+
+ //Holder for events (stores enabled, time, and eventid)
+ std::list<CreatureEventAIHolder> CreatureEventAIList;
+ uint32 EventUpdateTime; //Time between event updates
+ uint32 EventDiff; //Time between the last event call
+ bool bEmptyList;
+
+ //Variables used by Events themselves
+ uint8 Phase; //Current phase, max 32 phases
+ bool CombatMovementEnabled; //If we allow targeted movment gen (movement twoards top threat)
+ bool MeleeEnabled; //If we allow melee auto attack
+ uint32 AttackDistance; //Distance to attack from
+ float AttackAngle; //Angle of attack
+
+ uint32 TimetoFleeLeft;
+ bool IsFleeing;
+};
+#endif
diff --git a/src/game/CreatureEventAIMgr.cpp b/src/game/CreatureEventAIMgr.cpp
new file mode 100644
index 00000000000..3e6c2822759
--- /dev/null
+++ b/src/game/CreatureEventAIMgr.cpp
@@ -0,0 +1,560 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "Common.h"
+#include "Database/DatabaseEnv.h"
+#include "Database/SQLStorage.h"
+#include "CreatureEventAI.h"
+#include "CreatureEventAIMgr.h"
+#include "ObjectMgr.h"
+#include "ProgressBar.h"
+#include "Policies/SingletonImp.h"
+#include "ObjectDefines.h"
+
+INSTANTIATE_SINGLETON_1(CreatureEventAIMgr);
+
+// -------------------
+void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
+{
+ // Drop Existing Text Map, only done once and we are ready to add data from multiple sources.
+ m_CreatureEventAI_TextMap.clear();
+
+ // Load EventAI Text
+ LoadTrinityStrings(WorldDatabase,"creature_ai_texts",-1,1+(TEXT_SOURCE_RANGE));
+
+ // Gather Additional data from EventAI Texts
+ QueryResult *result = WorldDatabase.PQuery("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
+
+ sLog.outString("Loading EventAI Texts additional data...");
+ if (result)
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 count = 0;
+
+ do
+ {
+ bar.step();
+ Field* fields = result->Fetch();
+ StringTextData temp;
+
+ int32 i = fields[0].GetInt32();
+ temp.SoundId = fields[1].GetInt32();
+ temp.Type = fields[2].GetInt32();
+ temp.Language = fields[3].GetInt32();
+ temp.Emote = fields[4].GetInt32();
+
+ if (i >= 0)
+ {
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is not a negative value.",i);
+ continue;
+ }
+
+ if (i <= TEXT_SOURCE_RANGE)
+ {
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` is out of accepted entry range for table.",i);
+ continue;
+ }
+
+ if (temp.SoundId)
+ {
+ if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has soundId %u but sound does not exist.",i,temp.SoundId);
+ }
+
+ if (!GetLanguageDescByID(temp.Language))
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` using Language %u but Language does not exist.",i,temp.Language);
+
+ if (temp.Type > CHAT_TYPE_BOSS_WHISPER)
+ sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` has Type %u but this Chat Type does not exist.",i,temp.Type);
+
+ m_CreatureEventAI_TextMap[i] = temp;
+ ++count;
+ } while (result->NextRow());
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u additional CreatureEventAI Texts data.", count);
+ }else
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString();
+ sLog.outString(">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+ }
+
+}
+
+// -------------------
+void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
+{
+
+ //Drop Existing EventSummon Map
+ m_CreatureEventAI_Summon_Map.clear();
+
+ //Gather additional data for EventAI
+ QueryResult *result = WorldDatabase.PQuery("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
+ if (result)
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 Count = 0;
+
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
+
+ CreatureEventAI_Summon temp;
+
+ uint32 i = fields[0].GetUInt32();
+ temp.position_x = fields[1].GetFloat();
+ temp.position_y = fields[2].GetFloat();
+ temp.position_z = fields[3].GetFloat();
+ temp.orientation = fields[4].GetFloat();
+ temp.SpawnTimeSecs = fields[5].GetUInt32();
+
+ //Add to map
+ m_CreatureEventAI_Summon_Map[i] = temp;
+ ++Count;
+ }while (result->NextRow());
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u CreatureEventAI summon definitions", Count);
+ }else
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString();
+ sLog.outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+ }
+
+}
+
+// -------------------
+void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
+{
+ //Drop Existing EventAI List
+ m_CreatureEventAI_Event_Map.clear();
+
+ //Gather event data
+ QueryResult *result = WorldDatabase.PQuery("SELECT id, creature_id, event_type, event_inverse_phase_mask, event_chance, event_flags, "
+ "event_param1, event_param2, event_param3, event_param4, "
+ "action1_type, action1_param1, action1_param2, action1_param3, "
+ "action2_type, action2_param1, action2_param2, action2_param3, "
+ "action3_type, action3_param1, action3_param2, action3_param3 "
+ "FROM creature_ai_scripts");
+ if (result)
+ {
+ barGoLink bar(result->GetRowCount());
+ uint32 Count = 0;
+
+ do
+ {
+ bar.step();
+ Field *fields = result->Fetch();
+
+ CreatureEventAI_Event temp;
+
+ temp.event_id = fields[0].GetUInt32();
+ uint32 i = temp.event_id;
+ temp.creature_id = fields[1].GetUInt32();
+ uint32 creature_id = temp.creature_id;
+ temp.event_type = fields[2].GetUInt16();
+ temp.event_inverse_phase_mask = fields[3].GetUInt32();
+ temp.event_chance = fields[4].GetUInt8();
+ temp.event_flags = fields[5].GetUInt8();
+ temp.event_param1 = fields[6].GetUInt32();
+ temp.event_param2 = fields[7].GetUInt32();
+ temp.event_param3 = fields[8].GetUInt32();
+ temp.event_param4 = fields[9].GetUInt32();
+
+ CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(temp.creature_id);
+ //Creature does not exist in database
+ if (!cInfo)
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u has script for non-existing creature.", i);
+ continue;
+ }
+
+ //Report any errors in event
+ if (temp.event_type >= EVENT_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u has incorrect event type. Maybe DB requires updated version of SD2.", i);
+
+ //No chance of this event occuring
+ if (temp.event_chance == 0)
+ sLog.outErrorDb("CreatureEventAI: Event %u has 0 percent chance. Event will never trigger!", i);
+
+ //Chance above 100, force it to be 100
+ if (temp.event_chance > 100)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event %u with more than 100 percent chance. Adjusting to 100 percent.", temp.creature_id, i);
+ temp.event_chance = 100;
+ }
+
+ //Individual event checks
+ switch (temp.event_type)
+ {
+ case EVENT_T_HP:
+ case EVENT_T_MANA:
+ case EVENT_T_TARGET_HP:
+ {
+ if (temp.event_param2 > 100)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param2 (MinPercent) > 100. Event will never trigger! ", temp.creature_id, i);
+
+ if (temp.event_param1 <= temp.event_param2)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using percentage event(%u) with param1 <= param2 (MaxPercent <= MinPercent). Event will never trigger! ", temp.creature_id, i);
+
+ if (temp.event_flags & EFLAG_REPEATABLE && !temp.event_param3 && !temp.event_param4)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has param3 and param4=0 (RepeatMin/RepeatMax) but cannot be repeatable without timers. Removing EFLAG_REPEATABLE for event %u.", temp.creature_id, i);
+ temp.event_flags &= ~EFLAG_REPEATABLE;
+ }
+ }
+ break;
+
+ case EVENT_T_SPELLHIT:
+ {
+ if (temp.event_param1)
+ {
+ SpellEntry const* pSpell = GetSpellStore()->LookupEntry(temp.event_param1);
+ if (!pSpell)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.event_param1, i);
+ continue;
+ }
+
+ if (temp.event_param2_s != -1 && temp.event_param2 != pSpell->SchoolMask)
+ sLog.outErrorDb("CreatureEventAI: Creature %u has param1(spellId %u) but param2 is not -1 and not equal to spell's school mask. Event %u can never trigger.", temp.creature_id, temp.event_param1, i);
+ }
+
+ //TODO: fix this system with SPELL_SCHOOL_MASK. Current complicate things, using int32(-1) instead of just 0
+ //SPELL_SCHOOL_MASK_NONE = 0 and does not exist, thus it can not ever trigger or be used in SpellHit()
+ if (temp.event_param2_s != -1 && temp.event_param2_s > SPELL_SCHOOL_MASK_ALL)
+ sLog.outErrorDb("CreatureEventAI: Creature %u is using invalid SpellSchoolMask(%u) defined in event %u.", temp.creature_id, temp.event_param2, i);
+
+ if (temp.event_param4 < temp.event_param3)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ }
+ break;
+
+ case EVENT_T_RANGE:
+ case EVENT_T_OOC_LOS:
+ case EVENT_T_FRIENDLY_HP:
+ case EVENT_T_FRIENDLY_IS_CC:
+ case EVENT_T_FRIENDLY_MISSING_BUFF:
+ {
+ if (temp.event_param4 < temp.event_param3)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ }
+ break;
+
+ case EVENT_T_TIMER:
+ case EVENT_T_TIMER_OOC:
+ {
+ if (temp.event_param2 < temp.event_param1)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using timed event(%u) with param2 < param1 (InitialMax < InitialMin). Event will never repeat.", temp.creature_id, i);
+
+ if (temp.event_param4 < temp.event_param3)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using repeatable event(%u) with param4 < param3 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ }
+ break;
+
+ case EVENT_T_KILL:
+ case EVENT_T_TARGET_CASTING:
+ {
+ if (temp.event_param2 < temp.event_param1)
+ sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with param2 < param1 (RepeatMax < RepeatMin). Event will never repeat.", temp.creature_id, i);
+ }
+ break;
+
+ case EVENT_T_AGGRO:
+ case EVENT_T_DEATH:
+ case EVENT_T_EVADE:
+ case EVENT_T_SPAWNED:
+ case EVENT_T_REACHED_HOME:
+ {
+ if (temp.event_flags & EFLAG_REPEATABLE)
+ {
+ sLog.outErrorDb("CreatureEventAI: Creature %u has EFLAG_REPEATABLE set. Event can never be repeatable. Removing flag for event %u.", temp.creature_id, i);
+ temp.event_flags &= ~EFLAG_REPEATABLE;
+ }
+ }
+ break;
+ }
+
+ for (uint32 j = 0; j < MAX_ACTIONS; j++)
+ {
+ temp.action[j].type = fields[10+(j*4)].GetUInt16();
+ temp.action[j].param1 = fields[11+(j*4)].GetUInt32();
+ temp.action[j].param2 = fields[12+(j*4)].GetUInt32();
+ temp.action[j].param3 = fields[13+(j*4)].GetUInt32();
+
+ //Report any errors in actions
+ switch (temp.action[j].type)
+ {
+ case ACTION_T_TEXT:
+ {
+ if (temp.action[j].param1_s < 0)
+ {
+ if (m_CreatureEventAI_TextMap.find(temp.action[j].param1_s) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 refrences non-existing entry in texts table.", i, j+1);
+ }
+ if (temp.action[j].param2_s < 0)
+ {
+ if (m_CreatureEventAI_TextMap.find(temp.action[j].param2_s) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 refrences non-existing entry in texts table.", i, j+1);
+
+ if (!temp.action[j].param1_s)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param2, but param1 is not set. Required for randomized text.", i, j+1);
+ }
+ if (temp.action[j].param3_s < 0)
+ {
+ if (m_CreatureEventAI_TextMap.find(temp.action[j].param3_s) == m_CreatureEventAI_TextMap.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 refrences non-existing entry in texts table.", i, j+1);
+
+ if (!temp.action[j].param1_s || !temp.action[j].param2_s)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has param3, but param1 and/or param2 is not set. Required for randomized text.", i, j+1);
+ }
+ }
+ break;
+ case ACTION_T_SET_FACTION:
+ if (temp.action[j].param1 !=0 && !GetFactionStore()->LookupEntry(temp.action[j].param1))
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant FactionId %u.", i, j+1, temp.action[j].param1);
+ temp.action[j].param1 = 0;
+ }
+ break;
+ case ACTION_T_MORPH_TO_ENTRY_OR_MODEL:
+ if (temp.action[j].param1 !=0 || temp.action[j].param2 !=0)
+ {
+ if (temp.action[j].param1 && !GetCreatureTemplateStore(temp.action[j].param1))
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Creature entry %u.", i, j+1, temp.action[j].param1);
+ temp.action[j].param1 = 0;
+ }
+
+ if (temp.action[j].param2 && !GetCreatureDisplayStore()->LookupEntry(temp.action[j].param2))
+ {
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant ModelId %u.", i, j+1, temp.action[j].param2);
+ temp.action[j].param2 = 0;
+ }
+ }
+ break;
+ case ACTION_T_SOUND:
+ if (!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SoundID %u.", i, j+1, temp.action[j].param1);
+ break;
+/*
+ case ACTION_T_RANDOM_SOUND:
+ {
+ if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 uses non-existant SoundID %u.", i, j+1, temp.action[j].param1);
+ if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param2 uses non-existant SoundID %u.", i, j+1, temp.action[j].param2);
+ if(!GetSoundEntriesStore()->LookupEntry(temp.action[j].param3))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param3 uses non-existant SoundID %u.", i, j+1, temp.action[j].param3);
+ }
+ break;
+ */
+ case ACTION_T_CAST:
+ {
+ const SpellEntry *spell = GetSpellStore()->LookupEntry(temp.action[j].param1);
+ if (!spell)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param1);
+ else
+ {
+ if (spell->RecoveryTime > 0 && temp.event_flags & EFLAG_REPEATABLE)
+ {
+ //output as debug for now, also because there's no general rule all spells have RecoveryTime
+ if (temp.event_param3 < spell->RecoveryTime)
+ debug_log("CreatureEventAI: Event %u Action %u uses SpellID %u but cooldown is longer(%u) than minumum defined in event param3(%u).", i, j+1,temp.action[j].param1, spell->RecoveryTime, temp.event_param3);
+ }
+ }
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_REMOVEAURASFROMSPELL:
+ {
+ if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
+
+ if (temp.action[j].param1 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_QUEST_EVENT:
+ {
+ if (Quest const* qid = GetQuestTemplateStore(temp.action[j].param1))
+ {
+ if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, temp.action[j].param1);
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_QUEST_EVENT_ALL:
+ {
+ if (Quest const* qid = GetQuestTemplateStore(temp.action[j].param1))
+ {
+ if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, temp.action[j].param1);
+ }
+ else
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
+ }
+ break;
+ case ACTION_T_CASTCREATUREGO:
+ {
+ if (!GetCreatureTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
+
+ if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
+
+ if (temp.action[j].param3 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_CASTCREATUREGO_ALL:
+ {
+ if (!GetQuestTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant Quest entry %u.", i, j+1, temp.action[j].param1);
+
+ if (!GetSpellStore()->LookupEntry(temp.action[j].param2))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant SpellID %u.", i, j+1, temp.action[j].param2);
+ }
+ break;
+
+ //2nd param target
+ case ACTION_T_SUMMON_ID:
+ {
+ if (!GetCreatureTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
+
+ if (m_CreatureEventAI_Summon_Map.find(temp.action[j].param3) == m_CreatureEventAI_Summon_Map.end())
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u summons missing CreatureEventAI_Summon %u", i, j+1, temp.action[j].param3);
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_KILLED_MONSTER:
+ {
+ if (!GetCreatureTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_SUMMON:
+ {
+ if (!GetCreatureTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_THREAT_SINGLE_PCT:
+ case ACTION_T_SET_UNIT_FLAG:
+ case ACTION_T_REMOVE_UNIT_FLAG:
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+
+ //3rd param target
+ case ACTION_T_SET_UNIT_FIELD:
+ if (temp.action[j].param1 < OBJECT_END || temp.action[j].param1 >= UNIT_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u param1 (UNIT_FIELD*). Index out of range for intended use.", i, j+1);
+ if (temp.action[j].param3 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ break;
+
+ case ACTION_T_SET_PHASE:
+ if (temp.action[j].param1 > 31)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set phase > 31. Phase mask cannot be used past phase 31.", i, j+1);
+ break;
+
+ case ACTION_T_INC_PHASE:
+ if (!temp.action[j].param1)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u is incrementing phase by 0. Was this intended?", i, j+1);
+ break;
+
+ case ACTION_T_SET_INST_DATA:
+ {
+ if (!(temp.event_flags & EFLAG_NORMAL) && !(temp.event_flags & EFLAG_HEROIC))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without event flags (normal/heroic).", i, j+1);
+
+ if (temp.action[j].param2 > 4/*SPECIAL*/)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u attempts to set instance data above encounter state 4. Custom case?", i, j+1);
+ }
+ break;
+ case ACTION_T_SET_INST_DATA64:
+ {
+ if (!(temp.event_flags & EFLAG_NORMAL) && !(temp.event_flags & EFLAG_HEROIC))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u. Cannot set instance data without event flags (normal/heroic).", i, j+1);
+
+ if (temp.action[j].param2 >= TARGET_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
+ }
+ break;
+ case ACTION_T_UPDATE_TEMPLATE:
+ {
+ if (!GetCreatureTemplateStore(temp.action[j].param1))
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, temp.action[j].param1);
+ }
+ break;
+ case ACTION_T_RANDOM_SAY:
+ case ACTION_T_RANDOM_YELL:
+ case ACTION_T_RANDOM_TEXTEMOTE:
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u currently unused ACTION type. Did you forget to update database?", i, j+1);
+ break;
+
+ default:
+ if (temp.action[j].type >= ACTION_T_END)
+ sLog.outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type. Maybe DB requires updated version of SD2.", i, j+1);
+ break;
+ }
+ }
+
+ //Add to list
+ m_CreatureEventAI_Event_Map[creature_id].push_back(temp);
+ ++Count;
+ } while (result->NextRow());
+
+ delete result;
+
+ sLog.outString();
+ sLog.outString(">> Loaded %u CreatureEventAI scripts", Count);
+ }else
+ {
+ barGoLink bar(1);
+ bar.step();
+ sLog.outString();
+ sLog.outString(">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+ }
+}
diff --git a/src/game/CreatureEventAIMgr.h b/src/game/CreatureEventAIMgr.h
new file mode 100644
index 00000000000..ea5989a74ed
--- /dev/null
+++ b/src/game/CreatureEventAIMgr.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef MANGOS_CREATURE_EAI_MGR_H
+#define MANGOS_CREATURE_EAI_MGR_H
+
+#include "Common.h"
+#include "CreatureEventAI.h"
+
+class CreatureEventAIMgr
+{
+ public:
+ CreatureEventAIMgr(){};
+ ~CreatureEventAIMgr(){};
+
+ void LoadCreatureEventAI_Texts();
+ void LoadCreatureEventAI_Summons();
+ void LoadCreatureEventAI_Scripts();
+
+ CreatureEventAI_Event_Map& GetCreatureEventAIMap() { return m_CreatureEventAI_Event_Map; }
+ CreatureEventAI_Summon_Map& GetCreatureEventAISummonMap() { return m_CreatureEventAI_Summon_Map; }
+ CreatureEventAI_TextMap& GetCreatureEventAITextMap() { return m_CreatureEventAI_TextMap; }
+
+ private:
+ CreatureEventAI_Event_Map m_CreatureEventAI_Event_Map;
+ CreatureEventAI_Summon_Map m_CreatureEventAI_Summon_Map;
+ CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
+};
+
+#define CreatureEAI_Mgr MaNGOS::Singleton<CreatureEventAIMgr>::Instance()
+#endif
diff --git a/src/game/CreatureGroups.cpp b/src/game/CreatureGroups.cpp
index ed0fde19eb0..3b7a27cdab5 100644
--- a/src/game/CreatureGroups.cpp
+++ b/src/game/CreatureGroups.cpp
@@ -23,62 +23,52 @@
#include "ObjectMgr.h"
#include "ProgressBar.h"
#include "Policies/SingletonImp.h"
+#include "CreatureAI.h"
#define MAX_DESYNC 5.0f
INSTANTIATE_SINGLETON_1(CreatureGroupManager);
-CreatureGroupHolderType CreatureGroupHolder;
CreatureGroupInfoType CreatureGroupMap;
-void CreatureGroupManager::AddCreatureToGroup(uint32 group_id, Creature *member)
+void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature *member)
{
- CreatureGroupHolderType::iterator cgroup_data = CreatureGroupHolder.find(group_id);
+ Map *map = member->FindMap();
+ if(!map)
+ return;
+
+ CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);
//Add member to an existing group
- if(cgroup_data != CreatureGroupHolder.end())
+ if(itr != map->CreatureGroupHolder.end())
{
- typedef std::multimap<uint32, CreatureGroup *>::iterator multiplegroup;
- std::pair<multiplegroup, multiplegroup> range = CreatureGroupHolder.equal_range(group_id);
-
- for(multiplegroup i = range.first; i != range.second; ++i)
- {
- if(i->second->getInstanceID() == member->GetInstanceId())
- {
- sLog.outDebug("Group found: %u, inserting creature GUID: %u, Group InstanceID %u", group_id, member->GetGUIDLow(), i->second->getInstanceID());
- i->second->AddMember(member);
- return;
- }
- }
+ sLog.outDebug("Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
+ itr->second->AddMember(member);
}
-
//Create new group
- sLog.outDebug("Group not found: %u. Creating new group.", group_id);
- CreatureGroup* cgroup = new CreatureGroup(group_id, member->GetInstanceId());
- CreatureGroupHolder.insert(std::make_pair(group_id, cgroup));
- cgroup->AddMember(member);
+ else
+ {
+ sLog.outDebug("Group not found: %u. Creating new group.", groupId);
+ CreatureGroup* group = new CreatureGroup(groupId);
+ map->CreatureGroupHolder[groupId] = group;
+ group->AddMember(member);
+ }
}
-void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *formation, Creature *member)
+void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup *group, Creature *member)
{
- sLog.outDebug("Deleting member pointer to GUID: %u from group %u", formation->GetId(), member->GetDBTableGUIDLow());
- formation->RemoveMember(member);
+ sLog.outDebug("Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
+ group->RemoveMember(member);
- if(formation->isEmpty())
+ if(group->isEmpty())
{
- uint32 id = formation->GetId();
- typedef std::multimap<uint32, CreatureGroup *>::iterator multiplegroup;
- std::pair<multiplegroup, multiplegroup> range = CreatureGroupHolder.equal_range(id);
+ Map *map = member->FindMap();
+ if(!map)
+ return;
- for(multiplegroup i = range.first; i != range.second; ++i)
- {
- if(i->second == formation)
- {
- sLog.outDebug("Deleting group with InstanceID %u", i->second->getInstanceID());
- CreatureGroupHolder.erase(i);
- delete formation;
- }
- }
+ sLog.outDebug("Deleting group with InstanceID %u", member->GetInstanceId());
+ map->CreatureGroupHolder.erase(group->GetId());
+ delete group;
}
}
@@ -244,7 +234,11 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
float dx = x + cos(angle + pathangle) * dist;
float dy = y + sin(angle + pathangle) * dist;
- float dz;
+ float dz = z;
+
+ Trinity::NormalizeMapCoord(dx);
+ Trinity::NormalizeMapCoord(dy);
+
member->UpdateGroundPositionZ(dx, dy, dz);
if(member->GetDistance(m_leader) < dist + MAX_DESYNC)
diff --git a/src/game/CreatureGroups.h b/src/game/CreatureGroups.h
index aba86ffcaac..8c345aadd40 100644
--- a/src/game/CreatureGroups.h
+++ b/src/game/CreatureGroups.h
@@ -41,10 +41,8 @@ class CreatureGroupManager
void LoadCreatureFormations();
};
-typedef std::multimap<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
-extern CreatureGroupHolderType CreatureGroupHolder;
extern CreatureGroupInfoType CreatureGroupMap;
class CreatureGroup
@@ -54,17 +52,16 @@ class CreatureGroup
typedef std::map<Creature*, FormationInfo*> CreatureGroupMemberType;
CreatureGroupMemberType m_members;
- uint32 m_groupID, mInstanceID;
+ uint32 m_groupID;
bool m_Formed;
public:
//Group cannot be created empty
- explicit CreatureGroup(uint32 id, uint32 InstanceID) : m_groupID(id), m_leader(NULL), mInstanceID(InstanceID), m_Formed(false) {}
- ~CreatureGroup(){sLog.outDebug("Destroying group");}
+ explicit CreatureGroup(uint32 id) : m_groupID(id), m_leader(NULL), m_Formed(false) {}
+ ~CreatureGroup() { sLog.outDebug("Destroying group"); }
Creature* getLeader() const { return m_leader; }
uint32 GetId() const { return m_groupID; }
- uint32 getInstanceID() const { return mInstanceID; }
bool isEmpty() const { return m_members.empty(); }
bool isFormed() const { return m_Formed; }
diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h
index c3139dc2a37..078804c19f4 100644
--- a/src/game/DBCEnums.h
+++ b/src/game/DBCEnums.h
@@ -45,9 +45,9 @@ enum AchievementFlags
ACHIEVEMENT_FLAG_COUNTER = 0x00000001, // Just count statistic (never stop and complete)
ACHIEVEMENT_FLAG_UNK2 = 0x00000002, // not used
ACHIEVEMENT_FLAG_STORE_MAX_VALUE = 0x00000004, // Store only max value? used only in "Reach level xx"
- ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all reqirements (and calculate max vale)
- ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max vale ??)
- ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max vale)
+ ACHIEVEMENT_FLAG_SUMM = 0x00000008, // Use summ criteria value from all reqirements (and calculate max value)
+ ACHIEVEMENT_FLAG_MAX_USED = 0x00000010, // Show max criteria (and calculate max value ??)
+ ACHIEVEMENT_FLAG_REQ_COUNT = 0x00000020, // Use not zero req count (and calculate max value)
ACHIEVEMENT_FLAG_AVERANGE = 0x00000040, // Show as averange value (value / time_in_days) depend from other flag (by def use last criteria value)
ACHIEVEMENT_FLAG_BAR = 0x00000080, // Show as progress bar (value / max vale) depend from other flag (by def use last criteria value)
ACHIEVEMENT_FLAG_REALM_FIRST_REACH = 0x00000100, //
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index c46de44bf1f..7d3dea72ccf 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -479,7 +479,7 @@ struct AchievementCriteriaEntry
struct
{
uint32 field3; // 3 main requirement
- uint32 field4; // 4 main requirement count
+ uint32 count; // 4 main requirement count
uint32 additionalRequirement1_type; // 5 additional requirement 1 type
uint32 additionalRequirement1_value; // 6 additional requirement 1 value
uint32 additionalRequirement2_type; // 7 additional requirement 2 type
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index def17130372..89a03cac016 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -610,37 +610,34 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, ArtKit) )
return false;
- switch(GetGOInfo()->type)
+ if(!GetDespawnPossibility())
{
- case GAMEOBJECT_TYPE_DOOR:
- case GAMEOBJECT_TYPE_BUTTON:
- /* this code (in comment) isn't correct because in battlegrounds we need despawnable doors and buttons, pls remove
- SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
+ SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
+ m_spawnedByDefault = true;
+ m_respawnDelayTime = 0;
+ m_respawnTime = 0;
+ }
+ else
+ {
+ if(data->spawntimesecs >= 0)
+ {
m_spawnedByDefault = true;
- m_respawnDelayTime = 0;
- m_respawnTime = 0;
- break;*/
- default:
- if(data->spawntimesecs >= 0)
- {
- m_spawnedByDefault = true;
- m_respawnDelayTime = data->spawntimesecs;
- m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
+ m_respawnDelayTime = data->spawntimesecs;
+ m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
- // ready to respawn
- if(m_respawnTime && m_respawnTime <= time(NULL))
- {
- m_respawnTime = 0;
- objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
- }
- }
- else
+ // ready to respawn
+ if(m_respawnTime && m_respawnTime <= time(NULL))
{
- m_spawnedByDefault = false;
- m_respawnDelayTime = -data->spawntimesecs;
m_respawnTime = 0;
+ objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
}
- break;
+ }
+ else
+ {
+ m_spawnedByDefault = false;
+ m_respawnDelayTime = -data->spawntimesecs;
+ m_respawnTime = 0;
+ }
}
return true;
diff --git a/src/game/GameObject.h b/src/game/GameObject.h
index 3d2d3c2de57..b0019048827 100644
--- a/src/game/GameObject.h
+++ b/src/game/GameObject.h
@@ -482,6 +482,20 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
}
}
+ bool GetDespawnPossibility() const
+ {
+ switch(GetGoType())
+ {
+ case GAMEOBJECT_TYPE_DOOR: return GetGOInfo()->door.noDamageImmune;
+ case GAMEOBJECT_TYPE_BUTTON: return GetGOInfo()->button.noDamageImmune;
+ case GAMEOBJECT_TYPE_QUESTGIVER: return GetGOInfo()->questgiver.noDamageImmune;
+ case GAMEOBJECT_TYPE_GOOBER: return GetGOInfo()->goober.noDamageImmune;
+ case GAMEOBJECT_TYPE_FLAGSTAND: return GetGOInfo()->flagstand.noDamageImmune;
+ case GAMEOBJECT_TYPE_FLAGDROP: return GetGOInfo()->flagdrop.noDamageImmune;
+ default: return true;
+ }
+ }
+
time_t GetRespawnTime() const { return m_respawnTime; }
time_t GetRespawnTimeEx() const
{
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index a7b8c753782..521a543c08c 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -628,6 +628,62 @@ namespace Trinity
// Unit checks
+ class MostHPMissingInRange
+ {
+ public:
+ MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
+ bool operator()(Unit* u)
+ {
+ if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
+ {
+ i_hp = u->GetMaxHealth() - u->GetHealth();
+ return true;
+ }
+ return false;
+ }
+ private:
+ Unit const* i_obj;
+ float i_range;
+ uint32 i_hp;
+ };
+
+ class FriendlyCCedInRange
+ {
+ public:
+ FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) {}
+ bool operator()(Unit* u)
+ {
+ if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
+ (u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED) || u->hasUnitState(UNIT_STAT_CONFUSED)))
+ {
+ return true;
+ }
+ return false;
+ }
+ private:
+ Unit const* i_obj;
+ float i_range;
+ };
+
+ class FriendlyMissingBuffInRange
+ {
+ public:
+ FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) {}
+ bool operator()(Unit* u)
+ {
+ if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
+ !(u->HasAura(i_spell, 0) || u->HasAura(i_spell, 1) || u->HasAura(i_spell, 2)))
+ {
+ return true;
+ }
+ return false;
+ }
+ private:
+ Unit const* i_obj;
+ float i_range;
+ uint32 i_spell;
+ };
+
class AnyUnfriendlyUnitInObjectRangeCheck
{
public:
@@ -915,63 +971,6 @@ namespace Trinity
float i_range;
};
- // Searchers used by ScriptedAI
- class MostHPMissingInRange
- {
- public:
- MostHPMissingInRange(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
- bool operator()(Unit* u)
- {
- if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
- {
- i_hp = u->GetMaxHealth() - u->GetHealth();
- return true;
- }
- return false;
- }
- private:
- Unit const* i_obj;
- float i_range;
- uint32 i_hp;
- };
-
- class FriendlyCCedInRange
- {
- public:
- FriendlyCCedInRange(Unit const* obj, float range) : i_obj(obj), i_range(range) {}
- bool operator()(Unit* u)
- {
- if(u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
- (u->isFeared() || u->isCharmed() || u->isFrozen() || u->hasUnitState(UNIT_STAT_STUNNED) || u->hasUnitState(UNIT_STAT_CONFUSED)))
- {
- return true;
- }
- return false;
- }
- private:
- Unit const* i_obj;
- float i_range;
- };
-
- class FriendlyMissingBuffInRange
- {
- public:
- FriendlyMissingBuffInRange(Unit const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) {}
- bool operator()(Unit* u)
- {
- if(u->isAlive() && u->isInCombat() && /*!i_obj->IsHostileTo(u)*/ i_obj->IsFriendlyTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
- !(u->HasAura(i_spell)))
- {
- return true;
- }
- return false;
- }
- private:
- Unit const* i_obj;
- float i_range;
- uint32 i_spell;
- };
-
class AllFriendlyCreaturesInGrid
{
public:
diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp
index 17174919b15..4f0ca2f8cec 100644
--- a/src/game/HomeMovementGenerator.cpp
+++ b/src/game/HomeMovementGenerator.cpp
@@ -69,7 +69,7 @@ HomeMovementGenerator<Creature>::Update(Creature &owner, const uint32& time_diff
// restore orientation of not moving creature at returning to home
if(owner.GetDefaultMovementType()==IDLE_MOTION_TYPE)
{
- sLog.outDebug("Entering HomeMovement::GetDestination(z,y,z)");
+ //sLog.outDebug("Entering HomeMovement::GetDestination(z,y,z)");
owner.SetOrientation(ori);
WorldPacket packet;
owner.BuildHeartBeatMsg(&packet);
diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h
index b2571de66bd..c33beccfffb 100644
--- a/src/game/InstanceData.h
+++ b/src/game/InstanceData.h
@@ -67,6 +67,10 @@ class TRINITY_DLL_SPEC InstanceData
//called on creature creation
virtual void OnCreatureCreate(Creature * /*creature*/, uint32 /*creature_entry*/) {}
+ //All-purpose data storage 64 bit
+ virtual uint64 GetData64(uint32 /*Data*/) { return 0; }
+ virtual void SetData64(uint32 /*Data*/, uint64 /*Value*/) { }
+
//All-purpose data storage 32 bit
virtual uint32 GetData(uint32) { return 0; }
virtual void SetData(uint32, uint32 data) {}
diff --git a/src/game/Language.h b/src/game/Language.h
index 51df64227f8..8217193ea50 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -84,7 +84,8 @@ enum TrinityStrings
LANG_MOTD_CURRENT = 56,
LANG_USING_WORLD_DB = 57,
LANG_USING_SCRIPT_LIB = 58,
- // Room for more level 0 59-99 not used
+ LANG_USING_EVENT_AI = 59,
+ // Room for more level 0 60-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index 50aa1e46538..5f8a6cf86ef 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -102,6 +102,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
//SendSysMessage(full);
//PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
//PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
+ //PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
PSendSysMessage(LANG_UPTIME, str.c_str());
PSendSysMessage("Update time diff: %u.", updateTime);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 10b0cd198a0..8122166ef31 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -529,6 +529,7 @@ bool ChatHandler::HandleReloadAllCommand(const char*)
{
HandleReloadSkillFishingBaseLevelCommand("");
+ HandleReloadAllAchievementCommand("");
HandleReloadAllAreaCommand("");
HandleReloadAllLootCommand("");
HandleReloadAllNpcCommand("");
@@ -544,6 +545,13 @@ bool ChatHandler::HandleReloadAllCommand(const char*)
return true;
}
+bool ChatHandler::HandleReloadAllAchievementCommand(const char*)
+{
+ HandleReloadAchievementCriteriaDataCommand("");
+ HandleReloadAchievementRewardCommand("");
+ return true;
+}
+
bool ChatHandler::HandleReloadAllAreaCommand(const char*)
{
//HandleReloadQuestAreaTriggersCommand(""); -- reloaded in HandleReloadAllQuestCommand
@@ -632,6 +640,7 @@ bool ChatHandler::HandleReloadAllItemCommand(const char*)
bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/)
{
+ HandleReloadLocalesAchievementRewardCommand("a");
HandleReloadLocalesCreatureCommand("a");
HandleReloadLocalesGameobjectCommand("a");
HandleReloadLocalesItemCommand("a");
@@ -650,6 +659,22 @@ bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
return true;
}
+bool ChatHandler::HandleReloadAchievementCriteriaDataCommand(const char*)
+{
+ sLog.outString( "Re-Loading Additional Achievement Criteria Data..." );
+ achievementmgr.LoadAchievementCriteriaData();
+ SendGlobalSysMessage("DB table `achievement_criteria_data` reloaded.");
+ return true;
+}
+
+bool ChatHandler::HandleReloadAchievementRewardCommand(const char*)
+{
+ sLog.outString( "Re-Loading Achievement Reward Data..." );
+ achievementmgr.LoadRewards();
+ SendGlobalSysMessage("DB table `achievement_reward` reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadAreaTriggerTavernCommand(const char*)
{
sLog.outString( "Re-Loading Tavern Area Triggers..." );
@@ -1194,6 +1219,14 @@ bool ChatHandler::HandleReloadSpellDisabledCommand(const char* /*arg*/)
return true;
}
+bool ChatHandler::HandleReloadLocalesAchievementRewardCommand(const char*)
+{
+ sLog.outString( "Re-Loading Locales Achievement Reward Data..." );
+ achievementmgr.LoadRewardLocales();
+ SendGlobalSysMessage("DB table `locales_achievement_reward` reloaded.");
+ return true;
+}
+
bool ChatHandler::HandleReloadLocalesCreatureCommand(const char* /*arg*/)
{
sLog.outString( "Re-Loading Locales Creature ...");
diff --git a/src/game/Makefile.am b/src/game/Makefile.am
index de27815594a..47c072a1188 100644
--- a/src/game/Makefile.am
+++ b/src/game/Makefile.am
@@ -31,6 +31,7 @@ noinst_LIBRARIES = libmangosgame.a
# libmangossgame library will later be reused by ...
libmangosgame_a_SOURCES = \
<<<<<<< HEAD:src/game/Makefile.am
+<<<<<<< HEAD:src/game/Makefile.am
AccountMgr.cpp \
AccountMgr.h \
AchievementMgr.h \
@@ -572,6 +573,272 @@ libmangosgame_a_SOURCES = \
GroupReference.h \
GroupRefManager.h
>>>>>>> 2429aaf2276d689e101ed88285f18449dbe4280d:src/game/Makefile.am
+=======
+ AccountMgr.cpp \
+ AccountMgr.h \
+ AchievementMgr.h \
+ AchievementMgr.cpp \
+ AggressorAI.cpp \
+ AggressorAI.h \
+ AnimalRandomMovementGenerator.h \
+ ArenaTeam.cpp \
+ ArenaTeam.h \
+ ArenaTeamHandler.cpp \
+ AuctionHouseHandler.cpp \
+ AuctionHouseMgr.cpp \
+ AuctionHouseMgr.h \
+ Bag.cpp \
+ Bag.h \
+ BattleGround.cpp \
+ BattleGroundAA.cpp \
+ BattleGroundAB.cpp \
+ BattleGroundAV.cpp \
+ BattleGroundBE.cpp \
+ BattleGroundDS.cpp \
+ BattleGroundEY.cpp \
+ BattleGroundNA.cpp \
+ BattleGroundRL.cpp \
+ BattleGroundRV.cpp \
+ BattleGroundSA.cpp \
+ BattleGroundWS.cpp \
+ BattleGround.h \
+ BattleGroundAA.h \
+ BattleGroundAB.h \
+ BattleGroundAV.h \
+ BattleGroundBE.h \
+ BattleGroundDS.h \
+ BattleGroundEY.h \
+ BattleGroundNA.h \
+ BattleGroundRL.h \
+ BattleGroundRV.h \
+ BattleGroundSA.h \
+ BattleGroundWS.h \
+ BattleGroundHandler.cpp \
+ BattleGroundMgr.cpp \
+ BattleGroundMgr.h \
+ Calendar.cpp \
+ Calendar.h \
+ CalendarHandler.cpp \
+ Cell.h \
+ CellImpl.h \
+ Channel.cpp \
+ Channel.h \
+ ChannelHandler.cpp \
+ ChannelMgr.h \
+ CharacterHandler.cpp \
+ Chat.cpp \
+ Chat.h \
+ ChatHandler.cpp \
+ CombatHandler.cpp \
+ ConfusedMovementGenerator.cpp \
+ ConfusedMovementGenerator.h \
+ Corpse.cpp \
+ Corpse.h \
+ CreatureAI.cpp \
+ CreatureAI.h \
+ CreatureAIImpl.h \
+ CreatureAIRegistry.cpp \
+ CreatureAIRegistry.h \
+ CreatureAISelector.cpp \
+ CreatureAISelector.h \
+ CreatureEventAI.cpp \
+ CreatureEventAI.h \
+ CreatureEventAIMgr.cpp \
+ CreatureEventAIMgr.h \
+ Creature.cpp \
+ Creature.h \
+ DBCEnums.h \
+ DBCfmt.h \
+ DBCStores.cpp \
+ DBCStores.h \
+ DBCStructure.h \
+ debugcmds.cpp \
+ DestinationHolder.cpp \
+ DestinationHolder.h \
+ DestinationHolderImp.h \
+ DuelHandler.cpp \
+ DynamicObject.cpp \
+ DynamicObject.h \
+ FleeingMovementGenerator.cpp \
+ FleeingMovementGenerator.h \
+ Formulas.h \
+ GameEventMgr.cpp \
+ GameEventMgr.h \
+ GameObject.cpp \
+ GameObject.h \
+ GlobalEvents.cpp \
+ GlobalEvents.h \
+ GMTicketHandler.cpp \
+ GMTicketMgr.cpp \
+ GMTicketMgr.h \
+ GossipDef.cpp \
+ GossipDef.h \
+ GridDefines.h \
+ GridNotifiers.cpp \
+ GridNotifiers.h \
+ GridNotifiersImpl.h \
+ GridStates.cpp \
+ GridStates.h \
+ Group.cpp \
+ Group.h \
+ GroupHandler.cpp \
+ GuardAI.cpp \
+ GuardAI.h \
+ Guild.cpp \
+ Guild.h \
+ GuildHandler.cpp \
+ HomeMovementGenerator.cpp \
+ HomeMovementGenerator.h \
+ HostilRefManager.cpp \
+ HostilRefManager.h \
+ IdleMovementGenerator.cpp \
+ IdleMovementGenerator.h \
+ InstanceData.cpp \
+ InstanceData.h \
+ InstanceSaveMgr.cpp \
+ InstanceSaveMgr.h \
+ Item.cpp \
+ Item.h \
+ ItemEnchantmentMgr.cpp \
+ ItemEnchantmentMgr.h \
+ ItemHandler.cpp \
+ ItemPrototype.h \
+ Language.h \
+ Level0.cpp \
+ Level1.cpp \
+ Level2.cpp \
+ Level3.cpp \
+ LFGHandler.cpp \
+ LootHandler.cpp \
+ LootMgr.cpp \
+ LootMgr.h \
+ Mail.cpp \
+ Mail.h \
+ Map.cpp \
+ Map.h \
+ MapInstanced.cpp \
+ MapInstanced.h \
+ MapManager.cpp \
+ MapManager.h \
+ MapReference.h \
+ MapRefManager.h \
+ MiscHandler.cpp \
+ MotionMaster.cpp \
+ MotionMaster.h \
+ MovementGenerator.cpp \
+ MovementGenerator.h \
+ MovementGeneratorImpl.h \
+ MovementHandler.cpp \
+ NPCHandler.cpp \
+ NPCHandler.h \
+ NullCreatureAI.cpp \
+ NullCreatureAI.h \
+ ObjectAccessor.cpp \
+ ObjectAccessor.h \
+ Object.cpp \
+ ObjectDefines.h \
+ ObjectGridLoader.cpp \
+ ObjectGridLoader.h \
+ Object.h \
+ ObjectMgr.cpp \
+ ObjectMgr.h \
+ ObjectPosSelector.cpp \
+ ObjectPosSelector.h \
+ Opcodes.cpp \
+ Opcodes.h \
+ Path.h \
+ PetAI.cpp \
+ PetAI.h \
+ Pet.cpp \
+ Pet.h \
+ PetHandler.cpp \
+ PetitionsHandler.cpp \
+ Player.cpp \
+ Player.h \
+ PlayerDump.cpp \
+ PlayerDump.h \
+ PointMovementGenerator.cpp \
+ PointMovementGenerator.h \
+ PoolHandler.cpp \
+ PoolHandler.h \
+ QueryHandler.cpp \
+ QuestDef.cpp \
+ QuestDef.h \
+ QuestHandler.cpp \
+ RandomMovementGenerator.cpp \
+ RandomMovementGenerator.h \
+ ReactorAI.cpp \
+ ReactorAI.h \
+ ReputationMgr.cpp \
+ ReputationMgr.h \
+ ScriptCalls.cpp \
+ ScriptCalls.h \
+ SharedDefines.h \
+ SkillHandler.cpp \
+ SpellAuraDefines.h \
+ SpellAuras.cpp \
+ SpellAuras.h \
+ Spell.cpp \
+ SpellEffects.cpp \
+ Spell.h \
+ SkillDiscovery.cpp \
+ SkillDiscovery.h \
+ SkillExtraItems.cpp \
+ SkillExtraItems.h \
+ SpellHandler.cpp \
+ SocialMgr.cpp \
+ SocialMgr.h \
+ SpellMgr.cpp \
+ SpellMgr.h \
+ StatSystem.cpp \
+ TargetedMovementGenerator.cpp \
+ TargetedMovementGenerator.h \
+ TaxiHandler.cpp \
+ TemporarySummon.cpp \
+ TemporarySummon.h \
+ TotemAI.cpp \
+ TotemAI.h \
+ Totem.cpp \
+ Totem.h \
+ TradeHandler.cpp \
+ Transports.cpp \
+ Transports.h \
+ ThreatManager.cpp \
+ ThreatManager.h \
+ Traveller.h \
+ Unit.cpp \
+ Unit.h \
+ UnitEvents.h \
+ UpdateData.cpp \
+ UpdateData.h \
+ UpdateFields.h \
+ UpdateMask.h \
+ Vehicle.cpp \
+ Vehicle.h \
+ VoiceChatHandler.cpp \
+ WaypointManager.cpp \
+ WaypointManager.h \
+ WaypointMovementGenerator.cpp \
+ WaypointMovementGenerator.h \
+ Weather.cpp \
+ Weather.h \
+ World.cpp \
+ World.h \
+ WorldLog.cpp \
+ WorldLog.h \
+ WorldSession.cpp \
+ WorldSession.h \
+ WorldSocket.cpp \
+ WorldSocket.h \
+ WorldSocketMgr.cpp \
+ WorldSocketMgr.h \
+ FollowerReference.cpp \
+ FollowerReference.h \
+ FollowerRefManager.h \
+ GroupReference.cpp \
+ GroupReference.h \
+ GroupRefManager.h
+>>>>>>> 5a6594330caefc0dc00a5fe792dcb0e344b457cb:src/game/Makefile.am
## Link against shared library
libmangosgame_a_LIBADD = ../shared/libmangosshared.a ../shared/Auth/libmangosauth.a ../shared/Config/libmangosconfig.a ../shared/Database/libmangosdatabase.a ../shared/vmap/libmangosvmaps.a
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index d6f06051c59..ac81b9c2a6d 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -307,9 +307,21 @@ void Map::RemoveFromGrid(DynamicObject* obj, NGridType *grid, Cell const& cell)
template<class T>
void Map::SwitchGridContainers(T* obj, bool on)
{
- CellPair pair = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
- Cell cell(pair);
+ CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
+ if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
+ {
+ sLog.outError("Map::SwitchGridContainers: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
+ return;
+ }
+
+ Cell cell(p);
+ if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) )
+ return;
+
+ DEBUG_LOG("Switch object " I64FMT " from grid[%u,%u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
+ assert( ngrid != NULL );
+
GridType &grid = (*ngrid)(cell.CellX(), cell.CellY());
if(on)
@@ -465,7 +477,7 @@ bool Map::Add(Player *player)
SendInitTransports(player);
player->m_clientGUIDs.clear();
- AddNotifier(player);
+ //AddNotifier(player);
return true;
}
@@ -505,7 +517,7 @@ Map::Add(T *obj)
//if(obj->GetTypeId() != TYPEID_UNIT)
UpdateObjectVisibility(obj,cell,p);
- AddNotifier(obj);
+ //AddNotifier(obj);
}
void Map::MessageBroadcast(Player *player, WorldPacket *msg, bool to_self, bool to_possessor)
@@ -711,7 +723,7 @@ void Map::Update(const uint32 &t_diff)
}
}
- if(plr->m_seer != plr)
+ if(plr->m_seer != plr && !plr->hasUnitState(UNIT_STAT_ONVEHICLE))
{
Trinity::PlayerVisibilityNotifier notifier(*plr);
VisitAll(plr->m_seer->GetPositionX(), plr->m_seer->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
@@ -1765,8 +1777,6 @@ float Map::GetVmapHeight(float x, float y, float z, bool useMaps) const
return vmapHeight;
}
-#include "World.h"
-
uint16 Map::GetAreaFlag(float x, float y, float z) const
{
uint16 areaflag;
@@ -1791,9 +1801,9 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
case 2456: // Death's Breach (Eastern Plaguelands)
if(z > 350.0f) areaflag = 1950; break;
// Dalaran
- case 1593:
- case 2484:
- case 2492:
+ case 1593: // Crystalsong Forest
+ case 2484: // The Twilight Rivulet (Crystalsong Forest)
+ case 2492: // Forlorn Woods (Crystalsong Forest)
if (x > 5568.0f && x < 6116.0f && y > 282.0f && y < 982.0f && z > 563.0f) areaflag = 2153; break;
// Maw of Neltharion (cave)
case 164: // Dragonblight
@@ -1801,6 +1811,27 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const
case 1827: // Wintergrasp
case 2591: // The Cauldron of Flames (Wintergrasp)
if (x > 4364.0f && x < 4632.0f && y > 1545.0f && y < 1886.0f && z < 200.0f) areaflag = 1853; break;
+ // Undercity (sewers enter and path)
+ case 179: // Tirisfal Glades
+ if (x > 1595.0f && x < 1699.0f && y > 535.0f && y < 643.5f && z < 30.5f) areaflag = 685; break;
+ // Undercity (Royal Quarter)
+ case 210: // Silverpine Forest
+ case 316: // The Shining Strand (Silverpine Forest)
+ case 438: // Lordamere Lake (Silverpine Forest)
+ if (x > 1237.0f && x < 1401.0f && y > 284.0f && y < 440.0f && z < -40.0f) areaflag = 685; break;
+ // Undercity (cave and ground zone, part of royal quarter)
+ case 607: // Ruins of Lordaeron (Tirisfal Glades)
+ // ground and near to ground (by city walls)
+ if(z > 0.0f)
+ {
+ if (x > 1510.0f && x < 1839.0f && y > 29.77f && y < 433.0f) areaflag = 685;
+ }
+ // more wide underground, part of royal quarter
+ else
+ {
+ if (x > 1299.0f && x < 1839.0f && y > 10.0f && y < 440.0f) areaflag = 685;
+ }
+ break;
}
return areaflag;
diff --git a/src/game/Map.h b/src/game/Map.h
index 4d00a287b03..3d533da1675 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -44,6 +44,7 @@ class Group;
class InstanceSave;
class WorldObject;
class TempSummon;
+class CreatureGroup;
namespace ZThread
{
@@ -248,6 +249,8 @@ typedef UNORDERED_MAP<Creature*, CreatureMover> CreatureMoveList;
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
#define MIN_UNLOAD_DELAY 1 // immediate unload
+typedef std::map<uint32/*leaderDBGUID*/, CreatureGroup*> CreatureGroupHolderType;
+
class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::ObjectLevelLockable<Map, ZThread::Mutex>
{
friend class MapReference;
@@ -416,6 +419,9 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
template<class NOTIFIER> void VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier);
TempSummon *SummonCreature(uint32 entry, float x, float y, float z, float angle, SummonPropertiesEntry const *properties = NULL, uint32 duration = 0, Unit *summoner = NULL);
+
+ CreatureGroupHolderType CreatureGroupHolder;
+
private:
void LoadMapAndVMap(int gx, int gy);
void LoadVMap(int gx, int gy);
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index ca2c5609692..0ced3a57201 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1171,22 +1171,6 @@ void WorldSession::HandleMoveRootAck(WorldPacket&/* recv_data*/)
*/
}
-void WorldSession::HandleMoveTeleportAck(WorldPacket&/* recv_data*/)
-{
- /*
- CHECK_PACKET_SIZE(recv_data,8+4);
-
- sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
- uint64 guid;
- uint32 flags, time;
-
- recv_data >> guid;
- recv_data >> flags >> time;
- DEBUG_LOG("Guid " I64FMTD,guid);
- DEBUG_LOG("Flags %u, time %u",flags, time/IN_MILISECONDS);
- */
-}
-
void WorldSession::HandleSetActionBar(WorldPacket& recv_data)
{
CHECK_PACKET_SIZE(recv_data,1);
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index 6d7a40da045..ee6cc05a5d2 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -208,7 +208,7 @@ MotionMaster::MoveTargetedHome()
DEBUG_LOG("Pet or controlled unit (Entry: %u GUID: %u) targeting home",
i_owner->GetEntry(), i_owner->GetGUIDLow() );
- MoveFollow(i_owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, MOTION_SLOT_IDLE);
+ MoveFollow(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, MOTION_SLOT_IDLE);
}
else if(i_owner->GetTypeId() == TYPEID_UNIT)
{
@@ -305,7 +305,7 @@ MotionMaster::MovePoint(uint32 id, float x, float y, float z)
}
}
-void MotionMaster::MoveJumpFrom(float srcX, float srcY, float speedXY, float speedZ)
+void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
{
//this function may make players fall below map
if(i_owner->GetTypeId()==TYPEID_PLAYER)
@@ -317,6 +317,18 @@ void MotionMaster::MoveJumpFrom(float srcX, float srcY, float speedXY, float spe
MoveJump(x, y, z, speedXY, speedZ);
}
+void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
+{
+ //this function may make players fall below map
+ if(i_owner->GetTypeId()==TYPEID_PLAYER)
+ return;
+
+ float x, y, z;
+ float dist = speedXY * speedZ * 0.1f;
+ i_owner->GetClosePoint(x, y, z, i_owner->GetObjectSize(), dist, angle);
+ MoveJump(x, y, z, speedXY, speedZ);
+}
+
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ)
{
uint32 moveFlag = MOVEFLAG_JUMP | MOVEFLAG_WALK;
diff --git a/src/game/MotionMaster.h b/src/game/MotionMaster.h
index 38a2b58825f..ea71495d216 100644
--- a/src/game/MotionMaster.h
+++ b/src/game/MotionMaster.h
@@ -141,7 +141,8 @@ class TRINITY_DLL_SPEC MotionMaster //: private std::stack<MovementGenerator *>
void MoveFleeing(Unit* enemy);
void MovePoint(uint32 id, float x,float y,float z);
void MoveCharge(float x, float y, float z, float speed = SPEED_CHARGE);
- void MoveJumpFrom(float srcX, float srcY, float speedXY, float speedZ);
+ void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ);
+ void MoveJumpTo(float angle, float speedXY, float speedZ);
void MoveJump(float x, float y, float z, float speedXY, float speedZ);
void MoveTaxiFlight(uint32 path, uint32 pathnode);
void MoveDistract(uint32 time);
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 69a8572e7a5..64c4fecdb53 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -41,6 +41,10 @@ void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
void WorldSession::HandleMoveWorldportAckOpcode()
{
+ // ignore unexpected far teleports
+ if(!GetPlayer()->IsBeingTeleportedFar())
+ return;
+
// get the teleport destination
WorldLocation &loc = GetPlayer()->GetTeleportDest();
@@ -59,7 +63,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if(GetPlayer()->m_InstanceValid == false && !mInstance)
GetPlayer()->m_InstanceValid = true;
- GetPlayer()->SetSemaphoreTeleport(false);
+ GetPlayer()->SetSemaphoreTeleportFar(false);
// relocate the player to the teleport destination
GetPlayer()->SetMapId(loc.mapid);
@@ -79,7 +83,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
{
sLog.outDebug("WORLD: teleport of player %s (%d) to location %d,%f,%f,%f,%f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.x, loc.y, loc.z, loc.o);
// teleport the player home
- GetPlayer()->SetDontMove(false);
if(!GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()))
{
// the player must always be able to teleport home
@@ -116,7 +119,6 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if(!_player->InBattleGround())
{
// short preparations to continue flight
- GetPlayer()->SetDontMove(false);
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Initialize(*GetPlayer());
return;
@@ -157,16 +159,53 @@ void WorldSession::HandleMoveWorldportAckOpcode()
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// resummon pet
- if(GetPlayer()->m_temporaryUnsummonedPetNumber)
- {
- Pet* NewPet = new Pet(GetPlayer());
- if(!NewPet->LoadPetFromDB(GetPlayer(), 0, GetPlayer()->m_temporaryUnsummonedPetNumber, true))
- delete NewPet;
+ GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
+}
+
+void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
+{
+ CHECK_PACKET_SIZE(recv_data,8+4);
+
+ sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
+ uint64 guid;
+ uint32 flags, time;
- GetPlayer()->m_temporaryUnsummonedPetNumber = 0;
+ recv_data >> guid;
+ recv_data >> flags >> time;
+ DEBUG_LOG("Guid " I64FMTD,guid);
+ DEBUG_LOG("Flags %u, time %u",flags, time/IN_MILISECONDS);
+
+ Unit *mover = _player->m_mover;
+ Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
+
+ if(!plMover || !plMover->IsBeingTeleportedNear())
+ return;
+
+ if(guid != plMover->GetGUID())
+ return;
+
+ plMover->SetSemaphoreTeleportNear(false);
+
+ uint32 old_zone = plMover->GetZoneId();
+
+ WorldLocation const& dest = plMover->GetTeleportDest();
+
+ plMover->SetPosition(dest.x, dest.y, dest.z, dest.o, true);
+
+ uint32 newzone, newarea;
+ plMover->GetZoneAndAreaId(newzone,newarea);
+ plMover->UpdateZone(newzone,newarea);
+
+ // new zone
+ if(old_zone != newzone)
+ {
+ // honorless target
+ if(plMover->pvpInfo.inHostileArea)
+ plMover->CastSpell(plMover, 2479, true);
}
- GetPlayer()->SetDontMove(false);
+ // resummon pet
+ GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
}
void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
@@ -174,7 +213,11 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
uint32 opcode = recv_data.GetOpcode();
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
- if(GetPlayer()->GetDontMove())
+ Unit *mover = _player->m_mover;
+ Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
+
+ // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
+ if(plMover && plMover->IsBeingTeleported())
return;
/* extract packet */
@@ -192,9 +235,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
return;
- Unit *mover = _player->m_mover;
- Player *plMover = mover->GetTypeId()==TYPEID_PLAYER ? (Player*)mover : NULL;
-
/* handle special cases */
if (movementInfo.flags & MOVEMENTFLAG_ONTRANSPORT)
{
@@ -258,7 +298,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
plMover->m_movementInfo = movementInfo;
plMover->SetUnitMovementFlags(movementInfo.flags);
-
plMover->UpdateFallInformationIfNeed(movementInfo,recv_data.GetOpcode());
if(plMover->isMovingOrTurning())
@@ -280,10 +319,14 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if(plMover->isAlive())
{
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
- // change the death state to CORPSE to prevent the death timer from
- // starting in the next player update
- plMover->KillPlayer();
- plMover->BuildPlayerRepop();
+ // pl can be alive if GM/etc
+ if(!plMover->isAlive())
+ {
+ // change the death state to CORPSE to prevent the death timer from
+ // starting in the next player update
+ plMover->KillPlayer();
+ plMover->BuildPlayerRepop();
+ }
}
// cancel the death timer here if started
@@ -294,7 +337,12 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
else // creature charmed
{
if(Map *map = mover->GetMap())
+ {
+ //if(GetPlayer()->m_seer != mover)
+ if(((Creature*)mover)->isVehicle())
+ map->PlayerRelocation(GetPlayer(), movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
+ }
mover->SetUnitMovementFlags(movementInfo.flags);
}
}
@@ -435,8 +483,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
{
_player->ExitVehicle(vehicle);
- if(!vehicle->GetDBTableGUIDLow())
- vehicle->Dismiss();
}
}
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp
index f3a268a3b06..8d1427c86b8 100644
--- a/src/game/NPCHandler.cpp
+++ b/src/game/NPCHandler.cpp
@@ -481,7 +481,6 @@ void WorldSession::SendBindPoint(Creature *npc)
_player->PlayerTalkClass->CloseGossip();
}
-//Need fix
void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8);
@@ -518,7 +517,9 @@ void WorldSession::SendStablePet(uint64 guid )
Pet *pet = _player->GetPet();
+ size_t wpos = data.wpos();
data << uint8(0); // place holder for slot show number
+
data << uint8(GetPlayer()->m_stableSlots);
uint8 num = 0; // counter for place holder
@@ -530,12 +531,13 @@ void WorldSession::SendStablePet(uint64 guid )
data << uint32(pet->GetEntry());
data << uint32(pet->getLevel());
data << pet->GetName(); // petname
- data << uint8(0x01); // flags?, client slot 1 == current pet (0)
+ data << uint8(1); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
++num;
}
- // 0 1 2 3 4 5
- QueryResult* result = CharacterDatabase.PQuery("SELECT owner, slot, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot > 0 AND slot < 5",_player->GetGUIDLow());
+ // 0 1 2 3 4
+ QueryResult* result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
+ _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
{
@@ -543,11 +545,11 @@ void WorldSession::SendStablePet(uint64 guid )
{
Field *fields = result->Fetch();
- data << uint32(fields[2].GetUInt32()); // petnumber
- data << uint32(fields[3].GetUInt32()); // creature entry
- data << uint32(fields[4].GetUInt32()); // level
- data << fields[5].GetString(); // name
- data << uint8(fields[1].GetUInt32()+1); // slot
+ data << uint32(fields[1].GetUInt32()); // petnumber
+ data << uint32(fields[2].GetUInt32()); // creature entry
+ data << uint32(fields[3].GetUInt32()); // level
+ data << fields[4].GetString(); // name
+ data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
++num;
}while( result->NextRow() );
@@ -555,7 +557,7 @@ void WorldSession::SendStablePet(uint64 guid )
delete result;
}
- data.put<uint8>(8, num); // set real data to placeholder
+ data.put<uint8>(wpos, num); // set real data to placeholder
SendPacket(&data);
}
@@ -596,7 +598,8 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
uint32 free_slot = 1;
- QueryResult *result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot > 0 AND slot < 5 ORDER BY slot ",_player->GetGUIDLow());
+ QueryResult *result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
+ _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
{
do
@@ -605,11 +608,16 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
uint32 slot = fields[1].GetUInt32();
- if(slot==free_slot) // this slot not free
- ++free_slot;
+ // slots ordered in query, and if not equal then free
+ if(slot!=free_slot)
+ break;
+
+ // this slot not free, skip
+ ++free_slot;
}while( result->NextRow() );
+
+ delete result;
}
- delete result;
if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
{
@@ -648,8 +656,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
Pet* pet = _player->GetPet();
if(pet && pet->isAlive())
{
- uint8 i = 0x06;
- data << uint8(i);
+ data << uint8(0x06);
SendPacket(&data);
return;
}
@@ -660,7 +667,8 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
Pet *newpet = NULL;
- QueryResult *result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot > 0 AND slot < 5",_player->GetGUIDLow(),petnumber);
+ QueryResult *result = CharacterDatabase.PQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
+ _player->GetGUIDLow(),petnumber,PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
{
Field *fields = result->Fetch();
@@ -704,7 +712,7 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
WorldPacket data(SMSG_STABLE_RESULT, 200);
- if(GetPlayer()->m_stableSlots < 4) // max slots amount = 4
+ if(GetPlayer()->m_stableSlots < MAX_PET_STABLES)
{
StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
if(_player->GetMoney() >= SlotPrice->Price)
@@ -756,7 +764,8 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
return;
// find swapped pet slot in stable
- QueryResult *result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",_player->GetGUIDLow(),pet_number);
+ QueryResult *result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
+ _player->GetGUIDLow(),pet_number);
if(!result)
return;
@@ -766,7 +775,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
uint32 petentry = fields[1].GetUInt32();
delete result;
- // move alive pet to slot or delele dead pet
+ // move alive pet to slot or delete dead pet
_player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED);
// summon unstabled pet
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index b5f25596af3..c22d00628b2 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -85,17 +85,16 @@ Object::~Object( )
//if(m_objectUpdated)
// ObjectAccessor::Instance().RemoveUpdateObject(this);
- if(m_uint32Values)
+ if(IsInWorld())
{
- if(IsInWorld())
- {
- ///- Do NOT call RemoveFromWorld here, if the object is a player it will crash
- sLog.outCrash("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId());
- assert(false);
- }
+ sLog.outCrash("Object::~Object - guid="I64FMTD", typeid=%d deleted but still in world!!", GetGUID(), GetTypeId());
+ assert(false);
+ }
- assert(!m_objectUpdated);
+ assert(!m_objectUpdated);
+ if(m_uint32Values)
+ {
//DEBUG_LOG("Object desctr 1 check (%p)",(void*)this);
delete [] m_uint32Values;
delete [] m_uint32Values_mirror;
@@ -286,7 +285,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
{
flags2 = ((Player*)this)->GetUnitMovementFlags();
- if(((Player*)this)->GetTransport())
+ if(((Player*)this)->GetTransport() || ((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
flags2 |= MOVEMENTFLAG_ONTRANSPORT;
else
flags2 &= ~MOVEMENTFLAG_ONTRANSPORT;
@@ -336,7 +335,10 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
{
if(GetTypeId() == TYPEID_PLAYER)
{
- *data << (uint64)((Player*)this)->GetTransport()->GetGUID();
+ if(((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
+ *data << (uint64)((Player*)this)->GetCharmGUID();
+ else
+ *data << (uint64)((Player*)this)->GetTransport()->GetGUID();
*data << (float)((Player*)this)->GetTransOffsetX();
*data << (float)((Player*)this)->GetTransOffsetY();
*data << (float)((Player*)this)->GetTransOffsetZ();
@@ -667,13 +669,15 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
if(GetTypeId() == TYPEID_PLAYER && target != this
&& ((Player*)this)->IsInSameRaidWith(target))
{
- /*if(index == UNIT_FIELD_BYTES_2)
+ // Allow targetting opposite faction in party when enabled in config
+ if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && index == UNIT_FIELD_BYTES_2)
{
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName());
- *data << ( m_uint32Values[ index ] & (UNIT_BYTE2_FLAG_SANCTUARY << 8) ); // this flag is at uint8 offset 1 !!
+ *data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !!
+
ch = true;
}
- else*/
+ else
{
FactionTemplateEntry const *ft1, *ft2;
ft1 = ((Player*)this)->getFactionTemplateEntry();
@@ -745,20 +749,10 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
void Object::ClearUpdateMask(bool remove)
{
- if(!m_uint32Values_mirror || !m_uint32Values)
- {
- sLog.outCrash("Object::ClearUpdateMask: Object entry %u (type %u) does not have uint32Values", GetEntry(), GetTypeId());
- return;
- }
+ uint32 *temp = m_uint32Values;
- uint32 temp = m_uint32Values[0];
- temp = m_uint32Values_mirror[0];
+ memcpy(m_uint32Values_mirror, m_uint32Values, m_valuesCount*sizeof(uint32));
- for( uint16 index = 0; index < m_valuesCount; index ++ )
- {
- if(m_uint32Values_mirror[index]!= m_uint32Values[index])
- m_uint32Values_mirror[index] = m_uint32Values[index];
- }
if(m_objectUpdated)
{
if(remove)
@@ -802,27 +796,23 @@ bool Object::LoadValues(const char* data)
void Object::_SetUpdateBits(UpdateMask *updateMask, Player* /*target*/) const
{
- if(!m_uint32Values_mirror || !m_uint32Values)
- {
- sLog.outCrash("Object::_SetUpdateBits: Object entry %u (type %u) does not have uint32Values", GetEntry(), GetTypeId());
- return;
- }
-
- uint32 temp = m_uint32Values[0];
- temp = m_uint32Values_mirror[0];
+ uint32 *value = m_uint32Values;
+ uint32 *mirror = m_uint32Values_mirror;
- for(uint16 index = 0; index < m_valuesCount; ++index)
+ for(uint16 index = 0; index < m_valuesCount; ++index, ++value, ++mirror)
{
- if(m_uint32Values_mirror[index]!= m_uint32Values[index])
+ if(*mirror != *value)
updateMask->SetBit(index);
}
}
void Object::_SetCreateBits(UpdateMask *updateMask, Player* /*target*/) const
{
- for( uint16 index = 0; index < m_valuesCount; index++ )
+ uint32 *value = m_uint32Values;
+
+ for(uint16 index = 0; index < m_valuesCount; ++index, ++value)
{
- if(GetUInt32Value(index) != 0)
+ if(*value)
updateMask->SetBit(index);
}
}
@@ -1147,8 +1137,7 @@ bool Object::PrintIndexError(uint32 index, bool set) const
WorldObject::WorldObject()
: m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL),
- m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f),
- mSemaphoreTeleport(false)
+ m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f)
{
m_positionX = 0.0f;
m_positionY = 0.0f;
@@ -1160,8 +1149,6 @@ WorldObject::WorldObject()
m_name = "";
- mSemaphoreTeleport = false;
-
m_isActive = false;
IsTempWorldObject = false;
}
@@ -1256,6 +1243,13 @@ float WorldObject::GetDistance2d(float x, float y) const
return ( dist > 0 ? dist : 0);
}
+float WorldObject::GetExactDistance2d(const float x, const float y) const
+{
+ float dx = GetPositionX() - x;
+ float dy = GetPositionY() - y;
+ return sqrt((dx*dx) + (dy*dy));
+}
+
float WorldObject::GetDistance(const float x, const float y, const float z) const
{
float dx = GetPositionX() - x;
@@ -1618,7 +1612,17 @@ void WorldObject::BuildHeartBeatMsg(WorldPacket *data) const
*data << m_positionY;
*data << m_positionZ;
*data << m_orientation;
- *data << uint32(0);
+ if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
+ {
+ *data << uint64(((Unit*)this)->GetCharmGUID());
+ *data << float(((Player*)this)->GetTransOffsetX());
+ *data << float(((Player*)this)->GetTransOffsetY());
+ *data << float(((Player*)this)->GetTransOffsetZ());
+ *data << float(((Player*)this)->GetTransOffsetO());
+ *data << uint32(((Player*)this)->GetTransTime());
+ *data << uint8(((Player*)this)->GetTransSeat());
+ }
+ *data << uint32(0); //fall time
}
void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float z, float ang) const
@@ -1637,6 +1641,16 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float
*data << y;
*data << z;
*data << ang;
+ if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
+ {
+ *data << uint64(((Unit*)this)->GetCharmGUID());
+ *data << float(((Player*)this)->GetTransOffsetX());
+ *data << float(((Player*)this)->GetTransOffsetY());
+ *data << float(((Player*)this)->GetTransOffsetZ());
+ *data << float(((Player*)this)->GetTransOffsetO());
+ *data << uint32(((Player*)this)->GetTransTime());
+ *data << uint8(((Player*)this)->GetTransSeat());
+ }
*data << uint32(0);
}
@@ -1674,7 +1688,9 @@ Map const* WorldObject::GetBaseMap() const
void WorldObject::AddObjectToRemoveList()
{
- Map* map = MapManager::Instance().FindMap(GetMapId(), GetInstanceId());
+ assert(m_uint32Values);
+
+ Map* map = FindMap();
if(!map)
{
sLog.outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId());
diff --git a/src/game/Object.h b/src/game/Object.h
index a4b7506ca30..d46abd6d263 100644
--- a/src/game/Object.h
+++ b/src/game/Object.h
@@ -28,7 +28,6 @@
#include "GameSystem/GridReference.h"
#include "ObjectDefines.h"
#include "GridDefines.h"
-#include "CreatureAI.h"
#include "Map.h"
#include <set>
@@ -106,6 +105,7 @@ class InstanceData;
class GameObject;
class TempSummon;
class Vehicle;
+class CreatureAI;
typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
@@ -127,7 +127,7 @@ class TRINITY_DLL_SPEC Object
public:
virtual ~Object ( );
- const bool& IsInWorld() const { return m_inWorld; }
+ const bool IsInWorld() const { return m_inWorld; }
virtual void AddToWorld()
{
if(m_inWorld)
@@ -455,6 +455,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object
float GetDistanceSq(const float &x, const float &y, const float &z) const;
float GetDistance2d(const WorldObject* obj) const;
float GetDistance2d(const float x, const float y) const;
+ float GetExactDistance2d(const float x, const float y) const;
float GetDistanceZ(const WorldObject* obj) const;
bool IsInMap(const WorldObject* obj) const
{
@@ -474,8 +475,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool to_possessor = true);
void BuildHeartBeatMsg( WorldPacket *data ) const;
void BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang) const;
- bool IsBeingTeleported() { return mSemaphoreTeleport; }
- void SetSemaphoreTeleport(bool semphsetting) { mSemaphoreTeleport = semphsetting; }
void MonsterSay(const char* text, uint32 language, uint64 TargetGuid);
void MonsterYell(const char* text, uint32 language, uint64 TargetGuid);
@@ -538,8 +537,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object
float m_positionY;
float m_positionZ;
float m_orientation;
-
- bool mSemaphoreTeleport;
};
#endif
diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h
index d1549712f30..1f413e2db40 100644
--- a/src/game/ObjectAccessor.h
+++ b/src/game/ObjectAccessor.h
@@ -164,22 +164,11 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor
return HashMapHolder<Creature>::GetContainer();
}
- HashMapHolder<Unit>::MapType& GetUnits()
- {
- return HashMapHolder<Unit>::GetContainer();
- }
-
HashMapHolder<GameObject>::MapType& GetGameObjects()
{
return HashMapHolder<GameObject>::GetContainer();
}
- // note: possibly very heavy
- HashMapHolder<WorldObject>::MapType& GetWorldObjects()
- {
- return HashMapHolder<WorldObject>::GetContainer();
- }
-
template<class T> void AddObject(T *object)
{
HashMapHolder<T>::Insert(object);
diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp
index 78727fc7c0a..d3e8397baaa 100644
--- a/src/game/ObjectGridLoader.cpp
+++ b/src/game/ObjectGridLoader.cpp
@@ -28,6 +28,7 @@
#include "Corpse.h"
#include "World.h"
#include "CellImpl.h"
+#include "CreatureAI.h"
class TRINITY_DLL_DECL ObjectGridRespawnMover
{
@@ -53,11 +54,10 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m)
// creature in unloading grid can have respawn point in another grid
// if it will be unloaded then it will not respawn in original grid until unload/load original grid
// move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn.
- for(CreatureMapType::iterator iter=m.begin(), next; iter != m.end(); iter = next)
+ for(CreatureMapType::iterator iter = m.begin(); iter != m.end();)
{
- next = iter; ++next;
-
Creature * c = iter->getSource();
+ ++iter;
assert(!c->isWorldCreature() && "ObjectGridRespawnMover don't must be called for pets");
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 1b0f347b8aa..efb5d0974ca 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -5585,6 +5585,61 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
}
};
+inline void CheckGOLockId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
+{
+ if (sLockStore.LookupEntry(dataN))
+ return;
+
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
+ goInfo->id,goInfo->type,N,goInfo->door.lockId,goInfo->door.lockId);
+}
+
+inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
+{
+ if (GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(dataN))
+ {
+ if (trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
+ goInfo->id,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP);
+ }
+ /* disable check for while (too many error reports baout not existed in trap templates
+ else
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
+ goInfo->id,goInfo->type,N,dataN,dataN);
+ */
+}
+
+inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
+{
+ if (sSpellStore.LookupEntry(dataN))
+ return;
+
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
+ goInfo->id,goInfo->type,N,dataN,dataN);
+}
+
+inline void CheckAndFixGOChairHeightId(GameObjectInfo const* goInfo,uint32 const& dataN,uint32 N)
+{
+ if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
+ return;
+
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
+ goInfo->id,goInfo->type,N,dataN,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
+
+ // prevent client and server unexpected work
+ const_cast<uint32&>(dataN) = 0;
+}
+
+inline void CheckGONoDamageImmuneId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
+{
+ // 0/1 correct values
+ if (dataN <= 1)
+ return;
+
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.",
+ goInfo->id,goInfo->type,N,dataN);
+}
+
void ObjectMgr::LoadGameobjectInfo()
{
SQLGameObjectLoader loader;
@@ -5594,139 +5649,104 @@ void ObjectMgr::LoadGameobjectInfo()
for(uint32 id = 1; id < sGOStorage.MaxEntry; id++)
{
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
- if(!goInfo)
+ if (!goInfo)
continue;
switch(goInfo->type)
{
case GAMEOBJECT_TYPE_DOOR: //0
{
- if(goInfo->door.lockId)
- {
- if(!sLockStore.LookupEntry(goInfo->door.lockId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but lock (Id: %u) not found.",
- id,goInfo->type,goInfo->door.lockId,goInfo->door.lockId);
- }
+ if (goInfo->door.lockId)
+ CheckGOLockId(goInfo,goInfo->door.lockId,1);
+ CheckGONoDamageImmuneId(goInfo,goInfo->door.noDamageImmune,3);
break;
}
case GAMEOBJECT_TYPE_BUTTON: //1
{
- if(goInfo->button.lockId)
- {
- if(!sLockStore.LookupEntry(goInfo->button.lockId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but lock (Id: %u) not found.",
- id,goInfo->type,goInfo->button.lockId,goInfo->button.lockId);
- }
+ if (goInfo->button.lockId)
+ CheckGOLockId(goInfo,goInfo->button.lockId,1);
+ CheckGONoDamageImmuneId(goInfo,goInfo->button.noDamageImmune,4);
+ break;
+ }
+ case GAMEOBJECT_TYPE_QUESTGIVER: //2
+ {
+ if (goInfo->questgiver.lockId)
+ CheckGOLockId(goInfo,goInfo->questgiver.lockId,0);
+ CheckGONoDamageImmuneId(goInfo,goInfo->questgiver.noDamageImmune,5);
break;
}
case GAMEOBJECT_TYPE_CHEST: //3
{
- if(goInfo->chest.lockId)
- {
- if(!sLockStore.LookupEntry(goInfo->chest.lockId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but lock (Id: %u) not found.",
- id,goInfo->type,goInfo->chest.lockId,goInfo->chest.lockId);
- }
- if(goInfo->chest.linkedTrapId) // linked trap
- {
- if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->chest.linkedTrapId))
- {
- if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
- id,goInfo->type,goInfo->chest.linkedTrapId,goInfo->chest.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
- }
- /* disable check for while
- else
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
- id,goInfo->type,goInfo->chest.linkedTrapId,goInfo->chest.linkedTrapId);
- */
- }
+ if (goInfo->chest.lockId)
+ CheckGOLockId(goInfo,goInfo->chest.lockId,0);
+
+ if (goInfo->chest.linkedTrapId) // linked trap
+ CheckGOLinkedTrapId(goInfo,goInfo->chest.linkedTrapId,7);
break;
}
case GAMEOBJECT_TYPE_TRAP: //6
{
- /* disable check for while
- if(goInfo->trap.spellId) // spell
- {
- if(!sSpellStore.LookupEntry(goInfo->trap.spellId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data3=%u but Spell (Entry %u) not exist.",
- id,goInfo->type,goInfo->trap.spellId,goInfo->trap.spellId);
- }
+ if (goInfo->trap.lockId)
+ CheckGOLockId(goInfo,goInfo->trap.lockId,0);
+ /* disable check for while, too many not existed spells
+ if (goInfo->trap.spellId) // spell
+ CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
*/
break;
}
case GAMEOBJECT_TYPE_CHAIR: //7
- if(goInfo->chair.height > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
- {
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
- id,goInfo->type,goInfo->chair.height,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
-
- // prevent client and server unexpected work
- const_cast<GameObjectInfo*>(goInfo)->chair.height = 0;
- }
+ CheckAndFixGOChairHeightId(goInfo,goInfo->chair.height,1);
break;
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
{
- if(goInfo->spellFocus.focusId)
+ if (goInfo->spellFocus.focusId)
{
- if(!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId))
+ if (!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId))
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
id,goInfo->type,goInfo->spellFocus.focusId,goInfo->spellFocus.focusId);
}
- if(goInfo->spellFocus.linkedTrapId) // linked trap
- {
- if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->spellFocus.linkedTrapId))
- {
- if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
- id,goInfo->type,goInfo->spellFocus.linkedTrapId,goInfo->spellFocus.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
- }
- /* disable check for while
- else
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
- id,goInfo->type,goInfo->spellFocus.linkedTrapId,goInfo->spellFocus.linkedTrapId);
- */
- }
+ if (goInfo->spellFocus.linkedTrapId) // linked trap
+ CheckGOLinkedTrapId(goInfo,goInfo->spellFocus.linkedTrapId,2);
break;
}
case GAMEOBJECT_TYPE_GOOBER: //10
{
- if(goInfo->goober.pageId) // pageId
+ if (goInfo->goober.lockId)
+ CheckGOLockId(goInfo,goInfo->goober.lockId,0);
+
+ if (goInfo->goober.pageId) // pageId
{
- if(!sPageTextStore.LookupEntry<PageText>(goInfo->goober.pageId))
+ if (!sPageTextStore.LookupEntry<PageText>(goInfo->goober.pageId))
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
id,goInfo->type,goInfo->goober.pageId,goInfo->goober.pageId);
}
- /* disable check for while
- if(goInfo->goober.spellId) // spell
- {
- if(!sSpellStore.LookupEntry(goInfo->goober.spellId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but Spell (Entry %u) not exist.",
- id,goInfo->type,goInfo->goober.spellId,goInfo->goober.spellId);
- }
+ /* disable check for while, too many not existed spells
+ if (goInfo->goober.spellId) // spell
+ CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
*/
- if(goInfo->goober.linkedTrapId) // linked trap
- {
- if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->goober.linkedTrapId))
- {
- if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data12=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
- id,goInfo->type,goInfo->goober.linkedTrapId,goInfo->goober.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
- }
- /* disable check for while
- else
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data12=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
- id,goInfo->type,goInfo->goober.linkedTrapId,goInfo->goober.linkedTrapId);
- */
- }
+ CheckGONoDamageImmuneId(goInfo,goInfo->goober.noDamageImmune,11);
+ if (goInfo->goober.linkedTrapId) // linked trap
+ CheckGOLinkedTrapId(goInfo,goInfo->goober.linkedTrapId,12);
+ break;
+ }
+ case GAMEOBJECT_TYPE_AREADAMAGE: //12
+ {
+ if (goInfo->areadamage.lockId)
+ CheckGOLockId(goInfo,goInfo->areadamage.lockId,0);
+ break;
+ }
+ case GAMEOBJECT_TYPE_CAMERA: //13
+ {
+ if (goInfo->camera.lockId)
+ CheckGOLockId(goInfo,goInfo->camera.lockId,0);
break;
}
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
{
- if(goInfo->moTransport.taxiPathId)
+ if (goInfo->moTransport.taxiPathId)
{
- if(goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[goInfo->moTransport.taxiPathId].empty())
+ if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[goInfo->moTransport.taxiPathId].empty())
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
id,goInfo->type,goInfo->moTransport.taxiPathId,goInfo->moTransport.taxiPathId);
}
@@ -5734,35 +5754,40 @@ void ObjectMgr::LoadGameobjectInfo()
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
{
- /* disabled
- if(goInfo->summoningRitual.spellId)
- {
- if(!sSpellStore.LookupEntry(goInfo->summoningRitual.spellId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but Spell (Entry %u) not exist.",
- id,goInfo->type,goInfo->summoningRitual.spellId,goInfo->summoningRitual.spellId);
- }
+ /* disable check for while, too many not existed spells
+ // always must have spell
+ CheckGOSpellId(goInfo,goInfo->summoningRitual.spellId,1);
*/
break;
}
case GAMEOBJECT_TYPE_SPELLCASTER: //22
{
- if(goInfo->spellcaster.spellId) // spell
- {
- if(!sSpellStore.LookupEntry(goInfo->spellcaster.spellId))
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data3=%u but Spell (Entry %u) not exist.",
- id,goInfo->type,goInfo->spellcaster.spellId,goInfo->spellcaster.spellId);
- }
+ // always must have spell
+ CheckGOSpellId(goInfo,goInfo->spellcaster.spellId,0);
+ break;
+ }
+ case GAMEOBJECT_TYPE_FLAGSTAND: //24
+ {
+ if (goInfo->flagstand.lockId)
+ CheckGOLockId(goInfo,goInfo->flagstand.lockId,0);
+ CheckGONoDamageImmuneId(goInfo,goInfo->flagstand.noDamageImmune,5);
+ break;
+ }
+ case GAMEOBJECT_TYPE_FISHINGHOLE: //25
+ {
+ if (goInfo->fishinghole.lockId)
+ CheckGOLockId(goInfo,goInfo->fishinghole.lockId,4);
+ break;
+ }
+ case GAMEOBJECT_TYPE_FLAGDROP: //26
+ {
+ if (goInfo->flagdrop.lockId)
+ CheckGOLockId(goInfo,goInfo->flagdrop.lockId,0);
+ CheckGONoDamageImmuneId(goInfo,goInfo->flagdrop.noDamageImmune,3);
break;
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
- if(goInfo->barberChair.chairheight > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
- {
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
- id,goInfo->type,goInfo->barberChair.chairheight,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
-
- // prevent client and server unexpected work
- const_cast<GameObjectInfo*>(goInfo)->barberChair.chairheight = 0;
- }
+ CheckAndFixGOChairHeightId(goInfo,goInfo->barberChair.chairheight,0);
break;
}
}
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 1d45ed3a7fd..e723298565a 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -99,20 +99,28 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
QueryResult *result;
- if(petnumber)
- // known petnumber entry 0 1 2(?) 3 4 5 6 7 8(?) 9 10 11 12 13 14 15 16 17 18 19 20
- result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType FROM character_pet WHERE owner = '%u' AND id = '%u'",ownerid, petnumber);
- else if(current)
- // current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8(?) 9 10 11 12 13 14 15 16 17 18 19 20
- result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType FROM character_pet WHERE owner = '%u' AND slot = '0'",ownerid );
- else if(petentry)
+ if (petnumber)
+ // known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
+ "FROM character_pet WHERE owner = '%u' AND id = '%u'",
+ ownerid, petnumber);
+ else if (current)
+ // current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
+ "FROM character_pet WHERE owner = '%u' AND slot = '%u'",
+ ownerid, PET_SAVE_AS_CURRENT );
+ else if (petentry)
// known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
- // 0 1 2(?) 3 4 5 6 7 8(?) 9 10 11 12 13 14 15 16 17 18 19 20
- result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '0' OR slot = '3') ",ownerid, petentry );
+ // 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
+ "FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
+ ownerid, petentry,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
else
// any current or other non-stabled pet (for hunter "call pet")
- // 0 1 2(?) 3 4 5 6 7 8(?) 9 10 11 12 13 14 15 16 17 18 19 20
- result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType FROM character_pet WHERE owner = '%u' AND (slot = '0' OR slot = '3') ",ownerid);
+ // 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+ result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
+ "FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u') ",
+ ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
if(!result)
return false;
@@ -121,7 +129,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
// update for case of current pet "slot = 0"
petentry = fields[1].GetUInt32();
- if(!petentry)
+ if (!petentry)
{
delete result;
return false;
@@ -133,16 +141,24 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
bool is_temporary_summoned = spellInfo && GetSpellDuration(spellInfo) > 0;
// check temporary summoned pets like mage water elemental
- if(current && is_temporary_summoned)
+ if (current && is_temporary_summoned)
{
delete result;
return false;
}
+ uint32 pet_number = fields[0].GetUInt32();
+
+ if (current && owner->IsPetNeedBeTemporaryUnsummoned())
+ {
+ owner->SetTemporaryUnsummonedPetNumber(pet_number);
+ delete result;
+ return false;
+ }
+
Map *map = owner->GetMap();
uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_PET);
- uint32 pet_number = fields[0].GetUInt32();
- if(!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number))
+ if (!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number))
{
delete result;
return false;
@@ -151,7 +167,8 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
float px, py, pz;
owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
Relocate(px, py, pz, owner->GetOrientation());
- if(!IsPositionValid())
+
+ if (!IsPositionValid())
{
sLog.outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY());
@@ -164,24 +181,29 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
CreatureInfo const *cinfo = GetCreatureInfo();
- if(cinfo->type == CREATURE_TYPE_CRITTER)
+ if (cinfo->type == CREATURE_TYPE_CRITTER)
{
map->Add((Creature*)this);
delete result;
return true;
}
- if(getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && cinfo->type == CREATURE_TYPE_DEMON && owner->getClass() == CLASS_WARLOCK))
+ if (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && cinfo->type == CREATURE_TYPE_DEMON && owner->getClass() == CLASS_WARLOCK))
m_charmInfo->SetPetNumber(pet_number, true);
else
m_charmInfo->SetPetNumber(pet_number, false);
// set current pet as current
+ // 0=current
+ // 1..MAX_PET_STABLES in stable slot
+ // PET_SAVE_NOT_IN_SLOT(100) = not stable slot (summoning))
if(fields[8].GetUInt32() != 0)
{
CharacterDatabase.BeginTransaction();
- CharacterDatabase.PExecute("UPDATE character_pet SET slot = '3' WHERE owner = '%u' AND slot = '0' AND id <> '%u'", ownerid, m_charmInfo->GetPetNumber());
- CharacterDatabase.PExecute("UPDATE character_pet SET slot = '0' WHERE owner = '%u' AND id = '%u'", ownerid, m_charmInfo->GetPetNumber());
+ CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u' AND id <> '%u'",
+ PET_SAVE_NOT_IN_SLOT, ownerid, PET_SAVE_AS_CURRENT, m_charmInfo->GetPetNumber());
+ CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND id = '%u'",
+ PET_SAVE_AS_CURRENT, ownerid, m_charmInfo->GetPetNumber());
CharacterDatabase.CommitTransaction();
}
@@ -191,7 +213,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
SetUInt32Value(UNIT_NPC_FLAGS, 0);
SetName(fields[9].GetString());
- switch(getPetType())
+ switch (getPetType())
{
case SUMMON_PET:
petlevel=owner->getLevel();
@@ -247,12 +269,12 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
_LoadSpells();
_LoadSpellCooldowns();
- if(!is_temporary_summoned)
+ if (!is_temporary_summoned)
{
// permanent controlled pets store state in DB
Tokens tokens = StrSplit(fields[14].GetString(), " ");
- if(tokens.size() != 20)
+ if (tokens.size() != 20)
{
delete result;
return false;
@@ -332,109 +354,112 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
void Pet::SavePetToDB(PetSaveMode mode)
{
- if(!GetEntry())
+ if (!GetEntry())
return;
// save only fully controlled creature
- if(!isControlled())
+ if (!isControlled())
return;
+ // not save not player pets
+ if(!IS_PLAYER_GUID(GetOwnerGUID()))
+ return;
+
+ Player* pOwner = (Player*)GetOwner();
+ if (!pOwner)
+ return;
+
+ // not save pet as current if another pet temporary unsummoned
+ if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() &&
+ pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber())
+ {
+ // pet will lost anyway at restore temporary unsummoned
+ if(getPetType()==HUNTER_PET)
+ return;
+
+ // for warlock case
+ mode = PET_SAVE_NOT_IN_SLOT;
+ }
+
uint32 curhealth = GetHealth();
uint32 curmana = GetPower(POWER_MANA);
- switch(mode)
+ // stable and not in slot saves
+ if(mode > PET_SAVE_AS_CURRENT)
{
- case PET_SAVE_IN_STABLE_SLOT_1:
- case PET_SAVE_IN_STABLE_SLOT_2:
- case PET_SAVE_NOT_IN_SLOT:
- {
- RemoveAllAuras();
-
- //only alive hunter pets get auras saved, the others don't
- if(!(getPetType() == HUNTER_PET && isAlive()))
- m_Auras.clear();
- }
- default:
- break;
+ RemoveAllAuras();
}
_SaveSpells();
_SaveSpellCooldowns();
_SaveAuras();
- switch(mode)
+ // current/stable/not_in_slot
+ if(mode >= PET_SAVE_AS_CURRENT)
{
- case PET_SAVE_AS_CURRENT:
- case PET_SAVE_IN_STABLE_SLOT_1:
- case PET_SAVE_IN_STABLE_SLOT_2:
- case PET_SAVE_NOT_IN_SLOT:
+ uint32 owner = GUID_LOPART(GetOwnerGUID());
+ std::string name = m_name;
+ CharacterDatabase.escape_string(name);
+ CharacterDatabase.BeginTransaction();
+ // remove current data
+ CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber() );
+
+ // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
+ if(mode <= PET_SAVE_LAST_STABLE_SLOT)
+ CharacterDatabase.PExecute("UPDATE character_pet SET slot = '%u' WHERE owner = '%u' AND slot = '%u'",
+ PET_SAVE_NOT_IN_SLOT, owner, uint32(mode) );
+
+ // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
+ if(getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode > PET_SAVE_LAST_STABLE_SLOT))
+ CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '%u' OR slot > '%u')",
+ owner,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
+ // save pet
+ std::ostringstream ss;
+ ss << "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
+ << "VALUES ("
+ << m_charmInfo->GetPetNumber() << ", "
+ << GetEntry() << ", "
+ << owner << ", "
+ << GetNativeDisplayId() << ", "
+ << getLevel() << ", "
+ << GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ", "
+ << uint32(GetReactState()) << ", "
+ << uint32(GetFreeTalentPoints()) << ", "
+ << uint32(mode) << ", '"
+ << name.c_str() << "', "
+ << uint32((GetByteValue(UNIT_FIELD_BYTES_2, 2) == UNIT_RENAME_ALLOWED)?0:1) << ", "
+ << (curhealth<1?1:curhealth) << ", "
+ << curmana << ", "
+ << GetPower(POWER_HAPPINESS) << ", '";
+
+ for(uint32 i = 0; i < 10; i++)
+ ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " " << uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " ";
+ ss << "', '";
+
+ //save spells the pet can teach to it's Master
{
- uint32 owner = GUID_LOPART(GetOwnerGUID());
- std::string name = m_name;
- CharacterDatabase.escape_string(name);
- CharacterDatabase.BeginTransaction();
- // remove current data
- CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND id = '%u'", owner,m_charmInfo->GetPetNumber() );
-
- // prevent duplicate using slot (except PET_SAVE_NOT_IN_SLOT)
- if(mode!=PET_SAVE_NOT_IN_SLOT)
- CharacterDatabase.PExecute("UPDATE character_pet SET slot = 3 WHERE owner = '%u' AND slot = '%u'", owner, uint32(mode) );
-
- // prevent existence another hunter pet in PET_SAVE_AS_CURRENT and PET_SAVE_NOT_IN_SLOT
- if(getPetType()==HUNTER_PET && (mode==PET_SAVE_AS_CURRENT||mode==PET_SAVE_NOT_IN_SLOT))
- CharacterDatabase.PExecute("DELETE FROM character_pet WHERE owner = '%u' AND (slot = '0' OR slot = '3')", owner );
- // save pet
- std::ostringstream ss;
- ss << "INSERT INTO character_pet ( id, entry, owner, modelid, level, exp, Reactstate, talentpoints, slot, name, renamed, curhealth, curmana, curhappiness, abdata, TeachSpelldata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType) "
- << "VALUES ("
- << m_charmInfo->GetPetNumber() << ", "
- << GetEntry() << ", "
- << owner << ", "
- << GetNativeDisplayId() << ", "
- << getLevel() << ", "
- << GetUInt32Value(UNIT_FIELD_PETEXPERIENCE) << ", "
- << uint32(GetReactState()) << ", "
- << uint32(GetFreeTalentPoints()) << ", "
- << uint32(mode) << ", '"
- << name.c_str() << "', "
- << uint32((GetByteValue(UNIT_FIELD_BYTES_2, 2) == UNIT_RENAME_ALLOWED)?0:1) << ", "
- << (curhealth<1?1:curhealth) << ", "
- << curmana << ", "
- << GetPower(POWER_HAPPINESS) << ", '";
-
- for(uint32 i = 0; i < 10; i++)
- ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " " << uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " ";
- ss << "', '";
-
- //save spells the pet can teach to it's Master
- {
- int i = 0;
- for(TeachSpellMap::iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr)
- ss << itr->first << " " << itr->second << " ";
- for(; i < 4; ++i)
- ss << uint32(0) << " " << uint32(0) << " ";
- }
-
- ss << "', "
- << time(NULL) << ", "
- << uint32(m_resetTalentsCost) << ", "
- << uint64(m_resetTalentsTime) << ", "
- << GetUInt32Value(UNIT_CREATED_BY_SPELL) << ", "
- << uint32(getPetType()) << ")";
+ int i = 0;
+ for(TeachSpellMap::iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr)
+ ss << itr->first << " " << itr->second << " ";
+ for(; i < 4; ++i)
+ ss << uint32(0) << " " << uint32(0) << " ";
+ }
- CharacterDatabase.Execute( ss.str().c_str() );
+ ss << "', "
+ << time(NULL) << ", "
+ << uint32(m_resetTalentsCost) << ", "
+ << uint64(m_resetTalentsTime) << ", "
+ << GetUInt32Value(UNIT_CREATED_BY_SPELL) << ", "
+ << uint32(getPetType()) << ")";
- CharacterDatabase.CommitTransaction();
- break;
- }
- case PET_SAVE_AS_DELETED:
- {
- RemoveAllAuras();
- DeleteFromDB(m_charmInfo->GetPetNumber());
- break;
- }
- default:
- sLog.outError("Unknown pet save/remove mode: %d",mode);
+ CharacterDatabase.Execute( ss.str().c_str() );
+ CharacterDatabase.CommitTransaction();
+ }
+ // delete
+ else
+ {
+ RemoveAllAuras();
+ DeleteFromDB(m_charmInfo->GetPetNumber());
}
}
@@ -1148,15 +1173,14 @@ void Pet::_SaveAuras()
{
// skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
// do not save single target auras (unless they were cast by the player)
- if (itr->second->IsPassive()
- || (itr->second->GetCasterGUID() != GetGUID() && itr->second->IsSingleTarget()))
+ if (itr->second->IsPassive() || itr->second->IsAuraType(SPELL_AURA_MOD_STEALTH))
continue;
- SpellEntry const *spellInfo = itr->second->GetSpellProto();
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
- if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET )
+ bool isCaster = itr->second->GetCasterGUID() == GetGUID();
+ if (!isCaster)
+ if (itr->second->IsSingleTarget()
+ || itr->second->IsAreaAura())
continue;
+
uint32 amounts[MAX_SPELL_EFFECTS];
for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
diff --git a/src/game/Pet.h b/src/game/Pet.h
index 5879208a6b8..de998c20aac 100644
--- a/src/game/Pet.h
+++ b/src/game/Pet.h
@@ -35,13 +35,16 @@ enum PetType
extern char const* petTypeSuffix[MAX_PET_TYPE];
+#define MAX_PET_STABLES 4
+
+// stored in character_pet.slot
enum PetSaveMode
{
- PET_SAVE_AS_DELETED =-1,
- PET_SAVE_AS_CURRENT = 0,
- PET_SAVE_IN_STABLE_SLOT_1 = 1,
- PET_SAVE_IN_STABLE_SLOT_2 = 2,
- PET_SAVE_NOT_IN_SLOT = 3
+ PET_SAVE_AS_DELETED = -1, // not saved in fact
+ PET_SAVE_AS_CURRENT = 0, // in current slot (with player)
+ PET_SAVE_FIRST_STABLE_SLOT = 1,
+ PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT
+ PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100
};
enum HappinessState
diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp
index 0ec0eee3d9e..61485c3eb04 100644
--- a/src/game/PetitionsHandler.cpp
+++ b/src/game/PetitionsHandler.cpp
@@ -254,7 +254,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data)
QueryResult *result = CharacterDatabase.PQuery("SELECT type FROM petition WHERE petitionguid = '%u'", petitionguid_low);
if(!result)
{
- sLog.outError("any petition on server...");
+ sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
}
Field *fields = result->Fetch();
@@ -462,7 +462,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data)
if(!result)
{
- sLog.outError("any petition on server...");
+ sLog.outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName());
return;
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 2eeb5d3548c..ae14d5ebc30 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -340,7 +340,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_atLoginFlags = AT_LOGIN_NONE;
- m_dontMove = false;
+ mSemaphoreTeleport_Near = false;
+ mSemaphoreTeleport_Far = false;
pTrader = 0;
ClearTrade();
@@ -467,8 +468,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_isActive = true;
- m_farsightVision = false;
-
m_runes = NULL;
m_lastFallTime = 0;
@@ -1645,9 +1644,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
m_movementInfo.t_time = 0;
}
- SetSemaphoreTeleport(true);
-
- // The player was ported to another map and looses the duel immediatly.
+ // The player was ported to another map and looses the duel immediately.
// We have to perform this check before the teleport, otherwise the
// ObjectAccessor won't find the flag.
if (duel && GetMapId()!=mapid)
@@ -1662,72 +1659,29 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if ((GetMapId() == mapid) && (!m_transport))
{
- // prepare zone change detect
- uint32 old_zone = GetZoneId();
-
- // near teleport
- if(!GetSession()->PlayerLogout())
- {
- WorldPacket data;
- BuildTeleportAckMsg(&data, x, y, z, orientation);
- GetSession()->SendPacket(&data);
- SetPosition( x, y, z, orientation, true);
- }
- else
- // this will be used instead of the current location in SaveToDB
- m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
-
- SetFallInformation(0, z);
-
- //BuildHeartBeatMsg(&data);
- //SendMessageToSet(&data, true);
if (!(options & TELE_TO_NOT_UNSUMMON_PET))
{
- //same map, only remove pet if out of range
- if(pet && !IsWithinDistInMap(pet, OWNER_MAX_DISTANCE))
- {
- if(pet->isControlled() && !pet->isTemporarySummoned() )
- m_temporaryUnsummonedPetNumber = pet->GetCharmInfo()->GetPetNumber();
- else
- m_temporaryUnsummonedPetNumber = 0;
-
- RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
- }
+ //same map, only remove pet if out of range for new position
+ if(pet && pet->GetDistance(x,y,z) >= OWNER_MAX_DISTANCE)
+ UnsummonPetTemporaryIfAny();
}
if(!(options & TELE_TO_NOT_LEAVE_COMBAT))
CombatStop();
- if (!(options & TELE_TO_NOT_UNSUMMON_PET))
- {
- // resummon pet
- if(pet && m_temporaryUnsummonedPetNumber)
- {
- Pet* NewPet = new Pet(this);
- if(!NewPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
- delete NewPet;
-
- m_temporaryUnsummonedPetNumber = 0;
- }
- }
-
- uint32 newzone, newarea;
- GetZoneAndAreaId(newzone,newarea);
+ // this will be used instead of the current location in SaveToDB
+ m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
+ SetFallInformation(0, z);
+ // code for finish transfer called in WorldSession::HandleMovementOpcodes()
+ // at client packet MSG_MOVE_TELEPORT_ACK
+ SetSemaphoreTeleportNear(true);
+ // near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
if(!GetSession()->PlayerLogout())
{
- // don't reset teleport semaphore while logging out, otherwise m_teleport_dest won't be used in Player::SaveToDB
- SetSemaphoreTeleport(false);
-
- UpdateZone(newzone,newarea);
- }
-
- // new zone
- if(old_zone != newzone)
- {
- // honorless target
- if(pvpInfo.inHostileArea)
- CastSpell(this, 2479, true);
+ WorldPacket data;
+ BuildTeleportAckMsg(&data, x, y, z, orientation);
+ GetSession()->SendPacket(&data);
}
}
else
@@ -1739,10 +1693,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// Check enter rights before map getting to avoid creating instance copy for player
// this check not dependent from map instance copy and same for all instance copies of selected map
if (!MapManager::Instance().CanPlayerEnter(mapid, this))
- {
- SetSemaphoreTeleport(false);
return false;
- }
// If the map is not created, assume it is possible to enter it.
// It will be created in the WorldPortAck.
@@ -1767,15 +1718,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// remove pet on map change
if (pet)
- {
- //leaving map -> delete pet right away (doing this later will cause problems)
- if(pet->isControlled() && !pet->isTemporarySummoned())
- m_temporaryUnsummonedPetNumber = pet->GetCharmInfo()->GetPetNumber();
- else
- m_temporaryUnsummonedPetNumber = 0;
-
- RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
- }
+ UnsummonPetTemporaryIfAny();
// remove all dyn objects
RemoveAllDynObjects();
@@ -1835,10 +1778,8 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING);
// move packet sent by client always after far teleport
- // SetPosition(final_x, final_y, final_z, final_o, true);
- SetDontMove(true);
-
// code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
+ SetSemaphoreTeleportFar(true);
}
else
return false;
@@ -2474,7 +2415,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,0);
for(int i = 0; i < MAX_SPELL_SCHOOL; ++i)
{
- SetFloatValue(UNIT_FIELD_POWER_COST_MODIFIER+i,0.0f);
+ SetUInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,0);
SetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,0.0f);
}
// Reset no reagent cost field
@@ -3299,7 +3240,6 @@ void Player::_LoadSpellCooldowns(QueryResult *result)
// some cooldowns can be already set at aura loading...
//QueryResult *result = CharacterDatabase.PQuery("SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'",GetGUIDLow());
-
if(result)
{
time_t curTime = time(NULL);
@@ -4688,24 +4628,24 @@ float Player::GetRatingBonusValue(CombatRating cr) const
uint32 Player::GetMeleeCritDamageReduction(uint32 damage) const
{
- float melee = GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*2.0f;
- if (melee>25.0f) melee = 25.0f;
+ float melee = GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*2.2f;
+ if (melee>33.0f) melee = 33.0f;
return uint32 (melee * damage /100.0f);
}
uint32 Player::GetRangedCritDamageReduction(uint32 damage) const
{
- float ranged = GetRatingBonusValue(CR_CRIT_TAKEN_RANGED)*2.0f;
- if (ranged>25.0f) ranged=25.0f;
+ float ranged = GetRatingBonusValue(CR_CRIT_TAKEN_RANGED)*2.2f;
+ if (ranged>33.0f) ranged=33.0f;
return uint32 (ranged * damage /100.0f);
}
uint32 Player::GetSpellCritDamageReduction(uint32 damage) const
{
- float spell = GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2.0f;
- // In wow script resilience limited to 25%
- if (spell>25.0f)
- spell = 25.0f;
+ float spell = GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2.2f;
+ // In wow script resilience limited to 33%
+ if (spell>33.0f)
+ spell = 33.0f;
return uint32 (spell * damage / 100.0f);
}
@@ -5489,11 +5429,6 @@ void Player::removeActionButton(uint8 button)
sLog.outDetail( "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow() );
}
-void Player::SetDontMove(bool dontMove)
-{
- m_dontMove = dontMove;
-}
-
bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
{
// prevent crash when a bad coord is sent by the client
@@ -5722,6 +5657,9 @@ void Player::RewardReputation(Unit *pVictim, float rate)
if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
return;
+ if(((Creature*)pVictim)->IsReputationGainDisabled())
+ return;
+
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry);
if(!Rep)
@@ -6273,7 +6211,7 @@ void Player::DuelComplete(DuelCompleteType type)
if(!duel)
return;
- sLog.outDebug("Dual Complete %s %s", GetName(), duel->opponent->GetName());
+ sLog.outDebug("Duel Complete %s %s", GetName(), duel->opponent->GetName());
WorldPacket data(SMSG_DUEL_COMPLETE, (1));
data << (uint8)((type != DUEL_INTERUPTED) ? 1 : 0);
@@ -10256,7 +10194,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update )
return NULL;
Item* lastItem = pItem;
-
+ uint32 entry = pItem->GetEntry();
for(ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); )
{
uint16 pos = itr->pos;
@@ -10272,7 +10210,7 @@ Item* Player::StoreItem( ItemPosCountVec const& dest, Item* pItem, bool update )
lastItem = _StoreItem(pos,pItem,count,true,update);
}
-
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, entry);
return lastItem;
}
@@ -12744,6 +12682,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
SendQuestReward( pQuest, XP, questGiver );
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
+ if (pQuest->GetZoneOrSort() > 0)
+ GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, pQuest->GetZoneOrSort());
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST);
@@ -13398,7 +13338,6 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
}
}
UpdateForQuestsGO();
- GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, entry);
}
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
@@ -14414,10 +14353,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
uint32 extraflags = fields[25].GetUInt32();
m_stableSlots = fields[26].GetUInt32();
- if(m_stableSlots > 4)
+ if(m_stableSlots > MAX_PET_STABLES)
{
- sLog.outError("Player can have not more 4 stable slots, but have in DB %u",uint32(m_stableSlots));
- m_stableSlots = 4;
+ sLog.outError("Player can have not more %u stable slots, but have in DB %u",MAX_PET_STABLES,uint32(m_stableSlots));
+ m_stableSlots = MAX_PET_STABLES;
}
m_atLoginFlags = fields[27].GetUInt32();
@@ -15841,17 +15780,20 @@ void Player::_SaveAuras()
AuraMap const& auras = GetAuras();
for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
{
- // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
- // do not save single target auras (unless they were cast by the player)
+ // skip:
+ // area auras or single cast auras casted by other unit
+ // passive auras and stances
if (itr->second->IsPassive()
- || (itr->second->GetCasterGUID() != GetGUID() && itr->second->IsSingleTarget())
+ || itr->second->IsAuraType(SPELL_AURA_MOD_SHAPESHIFT)
+ || itr->second->IsAuraType(SPELL_AURA_MOD_STEALTH)
|| itr->second->IsRemovedOnShapeLost())
continue;
- SpellEntry const *spellInfo = itr->second->GetSpellProto();
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
- if (spellInfo->Effect[i] == SPELL_AURA_MOD_SHAPESHIFT ||
- spellInfo->Effect[i] == SPELL_AURA_MOD_STEALTH )
+ bool isCaster = itr->second->GetCasterGUID() == GetGUID();
+ if (!isCaster)
+ if (itr->second->IsSingleTarget()
+ || itr->second->IsAreaAura())
continue;
+
int32 amounts[MAX_SPELL_EFFECTS];
for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
@@ -16953,7 +16895,7 @@ void Player::RemoveSpellMods(Spell const* spell)
if (mod && mod->charges == -1 && (mod->lastAffected == spell || mod->lastAffected==NULL))
{
- RemoveAurasDueToSpell(mod->spellId);
+ RemoveAurasDueToSpell(mod->spellId, 0, AURA_REMOVE_BY_EXPIRE);
if (m_spellMods[i].empty())
break;
else
@@ -18697,7 +18639,7 @@ void Player::SendAurasForTarget(Unit *target)
// level
data << aura->m_auraLevel;
// charges
- data << uint8(aura->GetStackAmount() ? aura->GetStackAmount() : aura->GetAuraCharges());
+ data << uint8(aura->GetStackAmount()>1 ? aura->GetStackAmount() : aura->GetAuraCharges());
if(!(aura->m_auraFlags & AFLAG_CASTER))
{
@@ -19534,7 +19476,7 @@ void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
}
// Allow travel in dark water on taxi or transport
- if (liquid_status.type & MAP_LIQUID_TYPE_DARK_WATER && !isInFlight() && !(GetUnitMovementFlags()&MOVEMENTFLAG_ONTRANSPORT))
+ if ((liquid_status.type & MAP_LIQUID_TYPE_DARK_WATER) && !isInFlight() && !GetTransport())
m_MirrorTimerFlags |= UNDERWARER_INDARKWATER;
else
m_MirrorTimerFlags &= ~UNDERWARER_INDARKWATER;
@@ -19645,14 +19587,17 @@ WorldObject* Player::GetViewpoint() const
bool Player::CanUseBattleGroundObject()
{
+ // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
+ // maybe gameobject code should handle that ForceReaction usage
+ // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
return ( //InBattleGround() && // in battleground - not need, check in other cases
//!IsMounted() && - not correct, player is dismounted when he clicks on flag
- //i'm not sure if these two are correct, because invisible players should get visible when they click on flag
+ //player cannot use object when he is invulnerable (immune)
!isTotalImmune() && // not totally immune
+ //i'm not sure if these two are correct, because invisible players should get visible when they click on flag
!HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // not invisible
!HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // can't pickup
- //TODO player cannot use object when he is invulnerable (immune) - (ice block, divine shield, divine protection, divine intervention ...)
isAlive() // live player
);
}
@@ -19744,37 +19689,31 @@ void Player::EnterVehicle(Vehicle *vehicle)
StopCastingCharm();
StopCastingBindSight();
+
SetCharm(vehicle, true);
SetViewpoint(vehicle, true);
SetMover(vehicle);
-
SetClientControl(vehicle, 1); // redirect controls to vehicle
+ addUnitState(UNIT_STAT_ONVEHICLE);
+ Relocate(vehicle->GetPositionX(), vehicle->GetPositionY(), vehicle->GetPositionZ(), vehicle->GetOrientation());
+ AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ m_movementInfo.t_x = veSeat->m_attachmentOffsetX;
+ m_movementInfo.t_y = veSeat->m_attachmentOffsetY;
+ m_movementInfo.t_z = veSeat->m_attachmentOffsetZ;
+ m_movementInfo.t_o = 0;
+ m_movementInfo.t_time = getMSTime();
+ m_movementInfo.t_seat = 0;
+
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
GetSession()->SendPacket(&data);
- data.Initialize(MSG_MOVE_TELEPORT_ACK, 30);
- data.append(GetPackGUID());
- data << uint32(0); // counter?
- data << uint32(MOVEMENTFLAG_ONTRANSPORT); // transport
- data << uint16(0); // special flags
- data << uint32(getMSTime()); // time
- data << vehicle->GetPositionX(); // x
- data << vehicle->GetPositionY(); // y
- data << vehicle->GetPositionZ(); // z
- data << vehicle->GetOrientation(); // o
- // transport part, TODO: load/calculate seat offsets
- data << uint64(vehicle->GetGUID()); // transport guid
- data << float(veSeat->m_attachmentOffsetX); // transport offsetX
- data << float(veSeat->m_attachmentOffsetY); // transport offsetY
- data << float(veSeat->m_attachmentOffsetZ); // transport offsetZ
- data << float(0); // transport orientation
- data << uint32(getMSTime()); // transport time
- data << uint8(0); // seat
- // end of transport part
- data << uint32(0); // fall time
+ BuildTeleportAckMsg(&data, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
GetSession()->SendPacket(&data);
+ BuildHeartBeatMsg(&data);
+ SendMessageToSet(&data, false);
+
VehicleSpellInitialize();
}
@@ -19787,29 +19726,36 @@ void Player::ExitVehicle(Vehicle *vehicle)
SetCharm(vehicle, false);
SetViewpoint(vehicle, false);
SetMover(this);
-
SetClientControl(vehicle, 0);
- WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
- data.append(GetPackGUID());
- data << uint32(0); // counter?
- data << uint32(MOVEMENTFLAG_FLY_UNK1); // fly unk
- data << uint16(0x40); // special flags
- data << uint32(getMSTime()); // time
- data << vehicle->GetPositionX(); // x
- data << vehicle->GetPositionY(); // y
- data << vehicle->GetPositionZ(); // z
- data << vehicle->GetOrientation(); // o
- data << uint32(0); // fall time
+ clearUnitState(UNIT_STAT_ONVEHICLE);
+ Relocate(vehicle->GetPositionX(), vehicle->GetPositionY(), vehicle->GetPositionZ(), vehicle->GetOrientation());
+ RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
+ m_movementInfo.t_x = 0;
+ m_movementInfo.t_y = 0;
+ m_movementInfo.t_z = 0;
+ m_movementInfo.t_o = 0;
+ m_movementInfo.t_time = 0;
+ m_movementInfo.t_seat = 0;
+
+ WorldPacket data;
+ BuildTeleportAckMsg(&data, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
GetSession()->SendPacket(&data);
+ BuildHeartBeatMsg(&data);
+ SendMessageToSet(&data, false);
+
data.Initialize(SMSG_PET_SPELLS, 8+4);
data << uint64(0);
data << uint32(0);
GetSession()->SendPacket(&data);
// only for flyable vehicles?
- CastSpell(this, 45472, true); // Parachute
+ //CastSpell(this, 45472, true); // Parachute
+
+ //if(!vehicle->GetDBTableGUIDLow())
+ if(vehicle->GetOwnerGUID() == GetGUID())
+ vehicle->Dismiss();
}
bool Player::isTotalImmune()
@@ -20162,7 +20108,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
{
// calculate total z distance of the fall
float z_diff = m_lastFallZ - movementInfo.z;
- sLog.outDebug("zDiff = %f", z_diff);
+ //sLog.outDebug("zDiff = %f", z_diff);
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
// 14.57 can be calculated by resolving damageperc formular below to 0
@@ -20475,3 +20421,37 @@ void Player::UpdateFallInformationIfNeed( MovementInfo const& minfo,uint16 opcod
if (m_lastFallTime >= minfo.fallTime || m_lastFallZ <=minfo.z || opcode == MSG_MOVE_FALL_LAND)
SetFallInformation(minfo.fallTime, minfo.z);
}
+
+void Player::UnsummonPetTemporaryIfAny()
+{
+ Pet* pet = GetPet();
+ if(!pet)
+ return;
+
+ if(!m_temporaryUnsummonedPetNumber && pet->isControlled() && !pet->isTemporarySummoned() )
+ {
+ m_temporaryUnsummonedPetNumber = pet->GetCharmInfo()->GetPetNumber();
+ m_oldpetspell = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL);
+ }
+
+ RemovePet(pet, PET_SAVE_AS_CURRENT);
+}
+
+void Player::ResummonPetTemporaryUnSummonedIfAny()
+{
+ if(!m_temporaryUnsummonedPetNumber)
+ return;
+
+ // not resummon in not appropriate state
+ if(IsPetNeedBeTemporaryUnsummoned())
+ return;
+
+ if(GetPetGUID())
+ return;
+
+ Pet* NewPet = new Pet(this);
+ if(!NewPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true))
+ delete NewPet;
+
+ m_temporaryUnsummonedPetNumber = 0;
+}
diff --git a/src/game/Player.h b/src/game/Player.h
index 4738ce603a0..60b2c7a0a1d 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1663,8 +1663,12 @@ class TRINITY_DLL_SPEC Player : public Unit
bool HasSkill(uint32 skill) const;
void learnSkillRewardedSpells(uint32 id, uint32 value);
- void SetDontMove(bool dontMove);
- bool GetDontMove() const { return m_dontMove; }
+ WorldLocation& GetTeleportDest() { return m_teleport_dest; }
+ bool IsBeingTeleported() const { return mSemaphoreTeleport_Near || mSemaphoreTeleport_Far; }
+ bool IsBeingTeleportedNear() const { return mSemaphoreTeleport_Near; }
+ bool IsBeingTeleportedFar() const { return mSemaphoreTeleport_Far; }
+ void SetSemaphoreTeleportNear(bool semphsetting) { mSemaphoreTeleport_Near = semphsetting; }
+ void SetSemaphoreTeleportFar(bool semphsetting) { mSemaphoreTeleport_Far = semphsetting; }
void CheckExploreSystem(void);
@@ -1998,8 +2002,9 @@ class TRINITY_DLL_SPEC Player : public Unit
// Temporarily removed pet cache
uint32 GetTemporaryUnsummonedPetNumber() const { return m_temporaryUnsummonedPetNumber; }
void SetTemporaryUnsummonedPetNumber(uint32 petnumber) { m_temporaryUnsummonedPetNumber = petnumber; }
- uint32 GetOldPetSpell() const { return m_oldpetspell; }
- void SetOldPetSpell(uint32 petspell) { m_oldpetspell = petspell; }
+ void UnsummonPetTemporaryIfAny();
+ void ResummonPetTemporaryUnSummonedIfAny();
+ bool IsPetNeedBeTemporaryUnsummoned() const { return !IsInWorld() || !isAlive() || IsMounted() /*+in flight*/; }
void SendCinematicStart(uint32 CinematicSequenceId);
void SendMovieStart(uint32 MovieId);
@@ -2056,8 +2061,6 @@ class TRINITY_DLL_SPEC Player : public Unit
bool isAllowedToLoot(Creature* creature);
- WorldLocation& GetTeleportDest() { return m_teleport_dest; }
-
DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
uint8 GetRunesState() const { return m_runes->runeState; }
uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
@@ -2224,8 +2227,6 @@ class TRINITY_DLL_SPEC Player : public Unit
typedef std::list<Channel*> JoinedChannelsList;
JoinedChannelsList m_channels;
- bool m_dontMove;
-
int m_cinematic;
Player *pTrader;
@@ -2290,10 +2291,6 @@ class TRINITY_DLL_SPEC Player : public Unit
uint32 m_groupUpdateMask;
uint64 m_auraRaidUpdateMask;
- // Temporarily removed pet cache
- uint32 m_temporaryUnsummonedPetNumber;
- uint32 m_oldpetspell;
-
// Player summoning
time_t m_summon_expire;
uint32 m_summon_mapid;
@@ -2301,11 +2298,6 @@ class TRINITY_DLL_SPEC Player : public Unit
float m_summon_y;
float m_summon_z;
- // Far Teleport
- WorldLocation m_teleport_dest;
-
- bool m_farsightVision;
-
DeclinedName *m_declinedname;
Runes *m_runes;
private:
@@ -2333,6 +2325,15 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 m_MirrorTimerFlagsLast;
bool m_isInWater;
+ // Current teleport data
+ WorldLocation m_teleport_dest;
+ bool mSemaphoreTeleport_Near;
+ bool mSemaphoreTeleport_Far;
+
+ // Temporary removed pet cache
+ uint32 m_temporaryUnsummonedPetNumber;
+ uint32 m_oldpetspell;
+
AchievementMgr m_achievementMgr;
ReputationMgr m_reputationMgr;
};
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 16cfe5b0e60..f14cc6b5ed3 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -307,6 +307,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_triggeringContainer = triggeringContainer;
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
+ m_needComboPoints = NeedsComboPoints(m_spellInfo);
m_delayStart = 0;
m_delayAtDamageCount = 0;
@@ -945,6 +946,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
DoSpellHitOnUnit(m_caster, mask);
}
+ // Do not take combo points on dodge
+ if (m_needComboPoints && m_targets.getUnitTargetGUID() == target->targetGUID)
+ if( missInfo != SPELL_MISS_NONE && missInfo != SPELL_MISS_MISS)
+ m_needComboPoints = false;
/*else //TODO: This is a hack. need fix
{
uint32 tempMask = 0;
@@ -1022,14 +1027,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo);
}
- // Take combo points after effects handling (combo points are used in effect handling)
- if(!m_IsTriggeredSpell && !m_CastItem
- && NeedsComboPoints(m_spellInfo)
- && m_caster->GetTypeId()==TYPEID_PLAYER
- && target->targetGUID == m_targets.getUnitTargetGUID()
- && (missInfo == SPELL_MISS_NONE || missInfo == SPELL_MISS_MISS))
- ((Player*)m_caster)->ClearComboPoints();
-
// Call scripted function for AI if this spell is casted upon a creature (except pets)
if(IS_CREATURE_GUID(target->targetGUID))
{
@@ -1103,8 +1100,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
}
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL);
- if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
- unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CC);
+ //if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
+ //unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CC);
}
else
{
@@ -2192,6 +2189,10 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
// Prepare data for triggers
prepareDataForTriggerSystem();
+ // Set combo point requirement
+ if (m_IsTriggeredSpell || m_CastItem || m_caster->GetTypeId()!=TYPEID_PLAYER)
+ m_needComboPoints = false;
+
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
m_casttime = GetSpellCastTime(m_spellInfo, this);
@@ -2208,6 +2209,9 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
if(isSpellBreakStealth(m_spellInfo) )
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST);
+ if(!m_IsTriggeredSpell)
+ m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ANY_CAST);
+
m_caster->SetCurrentCastedSpell( this );
m_selfContainer = &(m_caster->m_currentSpells[GetCurrentContainer()]);
SendSpellStart();
@@ -2224,6 +2228,10 @@ void Spell::cancel()
if(m_spellState == SPELL_STATE_FINISHED)
return;
+ SetReferencedFromCurrent(false);
+ if(m_selfContainer && *m_selfContainer == this)
+ *m_selfContainer = NULL;
+
uint32 oldState = m_spellState;
m_spellState = SPELL_STATE_FINISHED;
@@ -2541,6 +2549,10 @@ void Spell::_handle_immediate_phase()
void Spell::_handle_finish_phase()
{
+ // Take for real after all targets are processed
+ if (m_needComboPoints)
+ ((Player*)m_caster)->ClearComboPoints();
+
// spell log
if(m_needSpellLog)
SendLogExecute();
@@ -3693,7 +3705,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_TARGET_AURASTATE;
// Not allow casting on flying player
- if (target->isInFlight())
+ if (target->hasUnitState(UNIT_STAT_UNATTACKABLE))
return SPELL_FAILED_BAD_TARGETS;
if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
@@ -3997,8 +4009,18 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if(m_spellInfo->SpellIconID == 1648) // Execute
{
- if(!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2)
+ if(!m_targets.getUnitTarget())
return SPELL_FAILED_BAD_TARGETS;
+ if (m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2)
+ {
+ bool found = false;
+ Unit::AuraEffectList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
+ for(Unit::AuraEffectList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
+ if((*j)->isAffectedOnSpell(m_spellInfo))
+ found=true;
+ if (!found)
+ return SPELL_FAILED_BAD_TARGETS;
+ }
}
else if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
{
@@ -4527,7 +4549,7 @@ SpellCastResult Spell::CheckCasterAuras() const
dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i]));
}
//immune movement impairment and loss of control
- if(m_spellInfo->Id==(uint32)42292)
+ if(m_spellInfo->Id==42292 || m_spellInfo->Id==59752)
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
@@ -4559,7 +4581,7 @@ SpellCastResult Spell::CheckCasterAuras() const
{
if( GetAllSpellMechanicMask(itr->second->GetSpellProto()) & mechanic_immune )
continue;
- if( GetAllSpellMechanicMask(itr->second->GetSpellProto()) & school_immune )
+ if( GetSpellSchoolMask(itr->second->GetSpellProto()) & school_immune )
continue;
if( (1<<(itr->second->GetSpellProto()->Dispel)) & dispel_immune)
continue;
@@ -4620,8 +4642,9 @@ bool Spell::CanAutoCast(Unit* target)
}
else
{
- if( (target->GetAuraEffect(m_spellInfo->Id, j))->GetParentAura()->GetStackAmount() >= m_spellInfo->StackAmount)
- return false;
+ if( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j))
+ if (aureff->GetParentAura()->GetStackAmount() >= m_spellInfo->StackAmount)
+ return false;
}
}
else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] ))
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 7c52a4e8bb3..45a3a123bae 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -278,6 +278,7 @@ class Spell
void EffectSummonWild(uint32 i);
void EffectHealMechanical(uint32 i);
void EffectJump(uint32 i);
+ void EffectJump2(uint32 i);
void EffectTeleUnitsFaceCaster(uint32 i);
void EffectLearnSkill(uint32 i);
void EffectAddHonor(uint32 i);
@@ -507,6 +508,7 @@ class Spell
bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
bool m_needSpellLog; // need to send spell log?
+ bool m_needComboPoints;
uint8 m_applyMultiplierMask; // by effect: damage multiplier needed?
float m_damageMultipliers[3]; // by effect: damage multiplier
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 89d5a5578d5..008ba1278a5 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -198,7 +198,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
&AuraEffect::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
&AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
- &AuraEffect::HandleModMechanicImmunity, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
+ &AuraEffect::HandleModStateImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
&AuraEffect::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
&AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
&AuraEffect::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
@@ -344,8 +344,8 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target),
-m_timeCla(1000), m_removeMode(AURA_NO_REMOVE_MODE), m_AuraDRGroup(DIMINISHING_NONE),
-m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_in_use(false)
+m_timeCla(1000), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE),
+m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_isRemoved(false)
{
assert(target);
@@ -415,7 +415,7 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura
m_partAuras[i]=CreateAuraEffect(this, i, NULL , caster);
// correct flags if aura couldn't be created
if (!m_partAuras[i])
- m_auraFlags &= uint8(~(uint8(1) << i));
+ m_auraFlags &= uint8(~(1<< i));
}
else
{
@@ -462,19 +462,6 @@ m_target(parentAura->GetTarget())
m_effIndex = effIndex;
m_auraName = AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]);
- /*if(currentBasePoints)
- {
- m_amount = *currentBasePoints;
- m_currentBasePoints = m_amount - 1;
- }
- else
- {
- m_currentBasePoints = m_spellProto->EffectBasePoints[m_effIndex];
- if(caster)
- m_amount = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, m_target);
- else
- m_amount = m_currentBasePoints + 1;
- }*/
if(currentBasePoints)
m_currentBasePoints = *currentBasePoints;
else
@@ -637,12 +624,12 @@ void Aura::Update(uint32 diff)
if (caster->GetHealth()>manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
else
- RemoveAura();
+ m_target->RemoveAura(this);
}
else if (caster->GetPower(powertype)>=manaPerSecond)
caster->ModifyPower(powertype,-manaPerSecond);
else
- RemoveAura();
+ m_target->RemoveAura(this);
}
}
}
@@ -654,7 +641,7 @@ void Aura::Update(uint32 diff)
Unit* caster = GetCaster();
if(!caster)
{
- RemoveAura();
+ m_target->RemoveAura(this);
return;
}
// Get spell range
@@ -680,7 +667,7 @@ void Aura::Update(uint32 diff)
if(!caster->IsWithinDistInMap(m_target,radius))
{
- RemoveAura();
+ m_target->RemoveAura(this);
return;
}
}
@@ -777,37 +764,41 @@ void AreaAuraEffect::Update(uint32 diff)
}
else // aura at non-caster
{
- Unit * tmp_target = m_target;
+ // WARNING: the aura may get deleted during the update
+ // DO NOT access its members after update!
+ AuraEffect::Update(diff);
+
+ // Speedup - no need to do more checks
+ if (GetParentAura()->IsRemoved())
+ return;
+
+ // Caster may be deleted due to update
Unit* caster = GetCaster();
uint32 tmp_spellId = GetId();
uint32 tmp_effIndex = GetEffIndex();
uint64 tmp_guid = GetCasterGUID();
- // WARNING: the aura may get deleted during the update
- // DO NOT access its members after update!
- AuraEffect::Update(diff);
-
// remove aura if out-of-range from caster (after teleport for example)
// or caster is isolated or caster no longer has the aura
// or caster is (no longer) friendly
bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true);
if( !caster || caster->hasUnitState(UNIT_STAT_ISOLATED) ||
!caster->HasAuraEffect(tmp_spellId, tmp_effIndex) ||
- caster->IsFriendlyTo(tmp_target) != needFriendly
+ caster->IsFriendlyTo(m_target) != needFriendly
)
{
- GetParentAura()->RemoveAura();
+ m_target->RemoveAura(GetParentAura());
}
- else if (!caster->IsWithinDistInMap(tmp_target, m_radius))
+ else if (!caster->IsWithinDistInMap(m_target, m_radius))
{
if (needFriendly)
{
m_removeTime -= diff;
if (m_removeTime < 0)
- GetParentAura()->RemoveAura();
+ m_target->RemoveAura(GetParentAura());
}
else
- GetParentAura()->RemoveAura();
+ m_target->RemoveAura(GetParentAura());
}
else
{
@@ -815,18 +806,18 @@ void AreaAuraEffect::Update(uint32 diff)
m_removeTime = FRIENDLY_AA_REMOVE_TIME;
if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
{
- if(!tmp_target->IsInPartyWith(caster))
- GetParentAura()->RemoveAura();
+ if(!m_target->IsInPartyWith(caster))
+ m_target->RemoveAura(GetParentAura());
}
else if( m_areaAuraType == AREA_AURA_RAID)
{
- if(!tmp_target->IsInRaidWith(caster))
- GetParentAura()->RemoveAura();
+ if(!m_target->IsInRaidWith(caster))
+ m_target->RemoveAura(GetParentAura());
}
else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
{
- if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
- GetParentAura()->RemoveAura();
+ if( m_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
+ m_target->RemoveAura(GetParentAura());
}
}
}
@@ -854,22 +845,21 @@ void PersistentAreaAuraEffect::Update(uint32 diff)
remove = true;
if(remove)
- GetParentAura()->RemoveAura();
+ {
+ m_target->RemoveAura(GetParentAura());
+ return;
+ }
AuraEffect::Update(diff);
}
void AuraEffect::ApplyModifier(bool apply, bool Real)
{
- AuraType aura = m_auraName;
+ if (GetParentAura()->IsRemoved())
+ return;
- bool inuse = GetParentAura()->IsInUse();
- if (!inuse)
- GetParentAura()->SetInUse(true);
- if(aura<TOTAL_AURAS)
- (*this.*AuraHandler [aura])(apply,Real);
- if (!inuse)
- GetParentAura()->SetInUse(false);
+ if(m_auraName<TOTAL_AURAS)
+ (*this.*AuraHandler [m_auraName])(apply,Real);
}
void AuraEffect::CleanupTriggeredSpells()
@@ -921,7 +911,7 @@ void Aura::SendAuraUpdate()
data << uint32(GetId());
data << uint8(m_auraFlags);
data << uint8(m_auraLevel);
- data << uint8(m_stackAmount ? m_stackAmount : m_procCharges);
+ data << uint8(m_stackAmount>1 ? m_stackAmount : m_procCharges);
if(!(m_auraFlags & AFLAG_CASTER))
{
@@ -952,7 +942,8 @@ void Aura::_AddAura()
// set infinity cooldown state for spells
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
- if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
+ // Do not apply cooldown for caster passive spells (needed by Reincarnation)
+ if (!(caster->HasSpell(GetId()) && IsPassive()) && m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
{
Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
@@ -961,12 +952,15 @@ void Aura::_AddAura()
// passive auras (except totem auras) do not get placed in the slots
// area auras with SPELL_AURA_NONE are not shown on target
- if((m_spellProto->Attributes & 0x80 && GetTalentSpellPos(GetId())) || !m_isPassive || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())
- && (!IsAreaAura()
- || m_target!=caster ||
- (m_spellProto->Effect[0]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
- && m_spellProto->Effect[1]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
- && m_spellProto->Effect[2]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)))
+ if((m_spellProto->Attributes & 0x80 && GetTalentSpellPos(GetId()))
+ || !m_isPassive
+ || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())
+ || (IsAuraType(SPELL_AURA_ABILITY_IGNORE_AURASTATE))
+ && (!IsAreaAura()
+ || m_target!=caster ||
+ (m_spellProto->Effect[0]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
+ && m_spellProto->Effect[1]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
+ && m_spellProto->Effect[2]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)))
{
// Try find slot for aura
uint8 slot = MAX_AURAS;
@@ -1022,10 +1016,12 @@ void Aura::_AddAura()
{
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+ {
if(*itr < 0)
m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), m_target);
else if(Unit* caster = GetCaster())
m_target->AddAura(*itr, m_target);
+ }
}
//*****************************************************
@@ -1078,6 +1074,8 @@ void Aura::_AddAura()
bool Aura::SetPartAura(AuraEffect* aurEff, uint8 effIndex)
{
+ if (IsRemoved())
+ return false;
if (m_auraFlags & (1<<effIndex))
return false;
m_auraFlags |= 1<<effIndex;
@@ -1138,6 +1136,11 @@ void Aura::_RemoveAura()
m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, foundMask, false);
}
+ // since now aura cannot apply/remove it's modifiers
+ m_isRemoved = true;
+ // disable client server communication for removed aura
+ SetAuraSlot(MAX_AURAS);
+
// reset cooldown state for spells
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -1145,29 +1148,32 @@ void Aura::_RemoveAura()
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
((Player*)caster)->SendCooldownEvent(GetSpellProto());
}
- if (m_removeMode==AURA_REMOVE_BY_EXPIRE)
+ uint32 id = GetId();
+ // Remove Linked Auras
+ if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
{
- // Remove Linked Auras (on last aura remove)
- uint32 id = GetId();
- if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
- {
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id))
- for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
- if(*itr < 0)
- m_target->RemoveAurasDueToSpell(-(*itr));
- else if(Unit* caster = GetCaster())
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id))
+ for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+ {
+ if(*itr < 0)
+ m_target->RemoveAurasDueToSpell(-(*itr));
+ else if(Unit* caster = GetCaster())
+ if (m_removeMode==AURA_REMOVE_BY_EXPIRE)
m_target->CastSpell(m_target, *itr, true, 0, 0, caster->GetGUID());
- }
- if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
- {
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
- for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
- if(*itr < 0)
- m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false);
- else
- m_target->RemoveAurasDueToSpell(*itr);
- }
+ }
+ }
+ if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
+ {
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
+ for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+ {
+ if(*itr < 0)
+ m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false);
+ else
+ m_target->RemoveAurasDueToSpell(*itr);
+ }
}
+
// Proc on aura remove (only spell flags for now)
if (caster)
{
@@ -1199,22 +1205,23 @@ void Aura::SetStackAmount(uint8 stackAmount)
{
Unit *target = GetTarget();
Unit *caster = GetCaster();
- if (!target || !caster)
- return;
- m_stackAmount = stackAmount;
- for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ if (target && caster)
{
- if (AuraEffect * part = GetPartAura(i))
+ m_stackAmount = stackAmount;
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
- int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, part->GetEffIndex(), part->GetBasePoints(), target);
- // Reapply if amount change
- if (amount!=part->GetAmount())
+ if (AuraEffect * part = GetPartAura(i))
{
- bool Real = bool (part->m_spellmod);
- // Auras which are applying spellmod should have removed spellmods for real
- part->ApplyModifier(false,Real);
- part->SetAmount(amount);
- part->ApplyModifier(true, Real);
+ int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, part->GetEffIndex(), part->GetBasePoints(), target);
+ // Reapply if amount change
+ if (amount!=part->GetAmount())
+ {
+ bool Real = bool (part->m_spellmod);
+ // Auras which are applying spellmod should have removed spellmods for real
+ part->ApplyModifier(false,Real);
+ part->SetAmount(amount);
+ part->ApplyModifier(true, Real);
+ }
}
}
}
@@ -1486,23 +1493,6 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real)
if (apply)
{
- // Add custom charges for some mod aura
- switch (m_spellProto->Id)
- {
- case 17941: // Shadow Trance
- case 22008: // Netherwind Focus
- case 31834: // Light's Grace
- case 34754: // Clearcasting
- case 34936: // Backlash
- case 48108: // Hot Streak
- case 51124: // Killing Machine
- case 54741: // Firestarter
- case 57761: // Fireball!
- case 39805: // Lightning Overload
- GetParentAura()->SetAuraCharges(1);
- break;
-
- }
SpellModifier *mod = new SpellModifier;
mod->op = SpellModOp(GetMiscValue());
@@ -2456,14 +2446,6 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real)
caster->CastSpell(m_target, GetAmount(), true);
return;
}
- // Focused Magic
- if(m_spellProto->Id == 54646)
- {
- // only on remove by crit
- if(caster && GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
- caster->CastSpell(caster,54648, true);
- return;
- }
break;
}
}
@@ -3848,8 +3830,6 @@ void AuraEffect::HandleAuraModSilence(bool apply, bool Real)
if ( state == SPELL_STATE_PREPARING || state == SPELL_STATE_CASTING )
{
currentSpell->cancel();
- currentSpell->SetReferencedFromCurrent(false);
- m_target->m_currentSpells[i] = NULL;
}
}
}
@@ -4013,7 +3993,7 @@ void AuraEffect::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real)
//Players on flying mounts must be immune to polymorph
if (m_target->GetTypeId()==TYPEID_PLAYER)
- m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,1<<MECHANIC_POLYMORPH,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,MECHANIC_POLYMORPH,apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
if( apply && m_target->HasAuraEffect(42016,0) && m_target->GetMountID())
@@ -4058,16 +4038,57 @@ void AuraEffect::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real)
/*** IMMUNITY ***/
/*********************************************************/
+void AuraEffect::HandleModStateImmunityMask(bool apply, bool Real)
+{
+ std::list <AuraType> immunity_list;
+ if (GetMiscValue() & (1<<10))
+ immunity_list.push_back(SPELL_AURA_MOD_STUN);
+ if (GetMiscValue() & (1<<7))
+ immunity_list.push_back(SPELL_AURA_MOD_DISARM);
+ if (GetMiscValue() & (1<<1))
+ immunity_list.push_back(SPELL_AURA_MOD_TAUNT);
+
+ // These flag can be recognized wrong:
+ if (GetMiscValue() & (1<<6))
+ immunity_list.push_back(SPELL_AURA_MOD_DECREASE_SPEED);
+ if (GetMiscValue() & (1<<0))
+ immunity_list.push_back(SPELL_AURA_MOD_ROOT);
+ if (GetMiscValue() & (1<<3))
+ immunity_list.push_back(SPELL_AURA_MOD_CONFUSE);
+ if (GetMiscValue() & (1<<9))
+ immunity_list.push_back(SPELL_AURA_MOD_FEAR);
+
+ // Patch 3.0.3 Bladestorm now breaks all snares and roots on the warrior when activated.
+ // however not all mechanic specified in immunity
+ if (apply && GetId()==46924)
+ {
+ m_target->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
+ m_target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
+ }
+
+ if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
+ {
+ for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end();++iter)
+ {
+ m_target->RemoveAurasByType(*iter);
+ }
+ }
+ for (std::list <AuraType>::iterator iter = immunity_list.begin(); iter != immunity_list.end();++iter)
+ {
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,*iter,apply);
+ }
+}
+
void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real)
{
uint32 mechanic;
- if (GetSpellProto()->EffectApplyAuraName[GetEffIndex()]==SPELL_AURA_MECHANIC_IMMUNITY)
- mechanic = 1 << GetMiscValue();
- else //SPELL_AURA_MECHANIC_IMMUNITY_MASK
- mechanic = GetMiscValue();
+ mechanic = 1 << GetMiscValue();
+
//immune movement impairment and loss of control
if(GetId()==42292 || GetId()==59752)
mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
+ if (!mechanic)
+ return;
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
@@ -4091,7 +4112,7 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real)
}
}
- m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,mechanic,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,GetMiscValue(),apply);
// Bestial Wrath
if ( GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->Id == 19574)
@@ -4238,18 +4259,6 @@ void AuraEffect::HandleAuraProcTriggerSpell(bool apply, bool Real)
{
if(!Real)
return;
-
- if(apply)
- {
- // some spell have charges by functionality not have its in spell data
- switch (GetId())
- {
- case 28200: // Ascendance (Talisman of Ascendance trinket)
- GetParentAura()->SetAuraCharges(6);
- break;
- default: break;
- }
- }
}
void AuraEffect::HandleAuraModStalked(bool apply, bool Real)
@@ -4270,7 +4279,7 @@ void AuraEffect::HandlePeriodicTriggerSpell(bool apply, bool Real)
m_isPeriodic = apply;
if (m_spellProto->Id == 66 && !apply)
{
- if (GetParentAura()->GetRemoveMode() && GetParentAura()->GetAuraDuration()<=0)
+ if (GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
m_target->CastSpell(m_target, 32612, true, NULL, this);
}
}
@@ -5650,7 +5659,7 @@ void AuraEffect::PeriodicTick()
100;
if(m_target->GetHealth()*100 >= m_target->GetMaxHealth()*percent )
{
- GetParentAura()->RemoveAura();
+ m_target->RemoveAurasDueToSpell(GetId());
return;
}
break;
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 3632c7b2121..fb8120a01e6 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -92,17 +92,14 @@ class TRINITY_DLL_SPEC Aura
void SetNegative() { m_positive = false; }
void SetPositive() { m_positive = true; }
bool IsPermanent() const { return m_permanent; }
- void RemoveAura(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT) { m_permanent = false; m_duration=0; m_removeMode = mode; }
bool IsPassive() const { return m_isPassive; }
bool IsDeathPersistent() const { return m_isDeathPersist; }
bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
bool IsUpdated() const { return m_updated; }
+ bool IsRemoved() const { return m_isRemoved; }
void SetUpdated(bool val) { m_updated = val; }
- bool IsInUse() const { return m_in_use; }
- void SetInUse(bool val) { m_in_use = val; }
-
bool IsPersistent() const;
bool IsAreaAura() const;
bool IsAuraType(AuraType type) const;
@@ -158,8 +155,8 @@ class TRINITY_DLL_SPEC Aura
bool m_isPassive:1;
bool m_positive:1;
bool m_permanent:1;
+ bool m_isRemoved:1;
bool m_updated:1; // Prevent remove aura by stack if set
- bool m_in_use:1;
bool m_isSingleTargetAura:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
};
class TRINITY_DLL_SPEC AuraEffect
@@ -270,6 +267,7 @@ class TRINITY_DLL_SPEC AuraEffect
void HandleFarSight(bool Apply, bool Real);
void HandleModPossessPet(bool Apply, bool Real);
void HandleModMechanicImmunity(bool Apply, bool Real);
+ void HandleModStateImmunityMask(bool apply, bool Real);
void HandleAuraModSkill(bool Apply, bool Real);
void HandleModDamagePercentDone(bool Apply, bool Real);
void HandleModPercentStat(bool Apply, bool Real);
@@ -334,6 +332,7 @@ class TRINITY_DLL_SPEC AuraEffect
uint32 GetId() const { return m_spellProto->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBasePoints() const { return m_currentBasePoints; }
+ int32 GetAuraAmplitude(){return m_amplitude;}
void Update(uint32 diff);
bool IsAreaAura() const { return m_isAreaAura; }
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 5dac4ca1a7e..d01e992ed90 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -105,7 +105,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectDispel, // 38 SPELL_EFFECT_DISPEL
&Spell::EffectUnused, // 39 SPELL_EFFECT_LANGUAGE
&Spell::EffectDualWield, // 40 SPELL_EFFECT_DUAL_WIELD
- &Spell::EffectUnused, // 41 SPELL_EFFECT_JUMP
+ &Spell::EffectJump, // 41 SPELL_EFFECT_JUMP
&Spell::EffectJump, // 42 SPELL_EFFECT_JUMP2
&Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
&Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP
@@ -202,14 +202,14 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectNULL, //135 SPELL_EFFECT_CALL_PET
&Spell::EffectHealPct, //136 SPELL_EFFECT_HEAL_PCT
&Spell::EffectEnergisePct, //137 SPELL_EFFECT_ENERGIZE_PCT
- &Spell::EffectNULL, //138 SPELL_EFFECT_138 Leap
+ &Spell::EffectJump2, //138 SPELL_EFFECT_138 Leap
&Spell::EffectUnused, //139 SPELL_EFFECT_CLEAR_QUEST (misc - is quest ID)
&Spell::EffectForceCast, //140 SPELL_EFFECT_FORCE_CAST
&Spell::EffectNULL, //141 SPELL_EFFECT_141 damage and reduce speed?
&Spell::EffectTriggerSpellWithValue, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
&Spell::EffectApplyAreaAura, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
&Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_2 Spectral Blast
- &Spell::EffectNULL, //145 SPELL_EFFECT_145 Black Hole Effect
+ &Spell::EffectPlayerPull, //145 SPELL_EFFECT_145 Black Hole Effect
&Spell::EffectActivateRune, //146 SPELL_EFFECT_ACTIVATE_RUNE
&Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
&Spell::EffectUnused, //148 SPELL_EFFECT_148 unused
@@ -402,7 +402,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage = uint32(damage * (m_caster->GetTotalAttackPowerValue(BASE_ATTACK)) / 100);
}
// Shield Slam
- else if(m_spellInfo->SpellFamilyFlags[1] & 0x200)
+ else if(m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category==1209)
damage += int32(m_caster->GetShieldBlockValue());
// Victory Rush
else if(m_spellInfo->SpellFamilyFlags[1] & 0x100)
@@ -430,6 +430,13 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 12 / 100);
break;
}
+ // Concussion Blow
+ else if(m_spellInfo->SpellFamilyFlags[0] & 0x4000000)
+ {
+ int32 pct = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget);
+ damage += int32(m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * pct / 100);
+ break;
+ }
break;
}
case SPELLFAMILY_WARLOCK:
@@ -1361,7 +1368,16 @@ void Spell::EffectDummy(uint32 i)
spell_id = 20647;
bp = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
m_caster->GetTotalAttackPowerValue(BASE_ATTACK)*0.2f);
- m_caster->SetPower(POWER_RAGE,0);
+ // Sudden death cost modifier
+ if (Aura * aur = m_caster->GetAura(52437))
+ {
+ m_caster->ModifyPower(POWER_RAGE,- m_powerCost);
+ if (m_caster->GetPower(POWER_RAGE)<100)
+ m_caster->SetPower(POWER_RAGE,100);
+ m_caster->RemoveAura(aur);
+ }
+ else
+ m_caster->SetPower(POWER_RAGE,0);
break;
}
// Slam
@@ -1648,29 +1664,31 @@ void Spell::EffectDummy(uint32 i)
return;
}
- case 561: // Judgement of command
+ }
+
+ switch(m_spellInfo->Id)
+ {
+ case 20425: // Judgement of command
{
if(!unitTarget)
return;
- uint32 spell_id = m_spellInfo->EffectBasePoints[i]+1;//m_currentBasePoints[i]+1;
- SpellEntry const* spell_proto = sSpellStore.LookupEntry(spell_id);
+ SpellEntry const* spell_proto = sSpellStore.LookupEntry(damage);
if(!spell_proto)
return;
- if( !unitTarget->hasUnitState(UNIT_STAT_STUNNED) && m_caster->GetTypeId()==TYPEID_PLAYER)
+ if(unitTarget->hasUnitState(UNIT_STAT_STUNNED) && m_caster->GetTypeId()==TYPEID_PLAYER)
{
- // decreased damage (/2) for non-stunned target.
+ // always critical for stunned target
SpellModifier *mod = new SpellModifier;
- mod->op = SPELLMOD_DAMAGE;
- mod->value = -50;
- mod->type = SPELLMOD_PCT;
+ mod->op = SPELLMOD_CRITICAL_CHANCE;
+ mod->value = 100;
+ mod->type = SPELLMOD_FLAT;
mod->spellId = m_spellInfo->Id;
mod->mask[1] = 0x00000200;
((Player*)m_caster)->AddSpellMod(mod, true);
m_caster->CastSpell(unitTarget,spell_proto,true,NULL);
- // mod deleted
((Player*)m_caster)->AddSpellMod(mod, false);
}
else
@@ -1678,10 +1696,6 @@ void Spell::EffectDummy(uint32 i)
return;
}
- }
-
- switch(m_spellInfo->Id)
- {
case 31789: // Righteous Defense (step 1)
{
// 31989 -> dummy effect (step 1) + dummy effect (step 2) -> 31709 (taunt like spell for each target)
@@ -1850,7 +1864,7 @@ void Spell::EffectDummy(uint32 i)
return;
}
// Death Coil
- if(m_spellInfo->SpellFamilyFlags[0] & 0x002000)
+ else if(m_spellInfo->SpellFamilyFlags[0] & 0x002000)
{
if(m_caster->IsFriendlyTo(unitTarget))
{
@@ -1867,6 +1881,12 @@ void Spell::EffectDummy(uint32 i)
}
return;
}
+ // Death Grip
+ else if(m_spellInfo->Id == 49560)
+ {
+ unitTarget->CastSpell(m_caster, damage, true);
+ return;
+ }
break;
}
@@ -1984,6 +2004,7 @@ void Spell::EffectTriggerSpell(uint32 i)
// get highest rank of the Stealth spell
uint32 spellId = 0;
+ SpellEntry const *spellInfo;
const PlayerSpellMap& sp_list = ((Player*)m_caster)->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{
@@ -1991,7 +2012,7 @@ void Spell::EffectTriggerSpell(uint32 i)
if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+ spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo)
continue;
@@ -2010,7 +2031,8 @@ void Spell::EffectTriggerSpell(uint32 i)
if(((Player*)m_caster)->HasSpellCooldown(spellId))
((Player*)m_caster)->RemoveSpellCooldown(spellId);
- m_caster->CastSpell(m_caster, spellId, true);
+ // Push stealth to list because it must be handled after combat remove
+ m_TriggerSpells.push_back(spellInfo);
return;
}
// just skip
@@ -2202,7 +2224,16 @@ void Spell::EffectJump(uint32 i)
return;
}
- m_caster->NearTeleportTo(x,y,z,o,true);
+ //m_caster->NearTeleportTo(x,y,z,o,true);
+ float speedZ;
+ if(m_spellInfo->EffectMiscValue[i])
+ speedZ = float(m_spellInfo->EffectMiscValue[i])/10;
+ else if(m_spellInfo->EffectMiscValueB[i])
+ speedZ = float(m_spellInfo->EffectMiscValueB[i])/10;
+ else
+ speedZ = 10.0f;
+ float speedXY = m_caster->GetExactDistance2d(x, y) * 10.0f / speedZ;
+ m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
void Spell::EffectTeleportUnits(uint32 i)
@@ -2527,12 +2558,23 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
addhealth += tickheal * tickcount;
// Glyph of Swiftmend
- if(!caster->GetAura(54824))
+ if(!caster->GetDummyAura(54824))
unitTarget->RemoveAura(targetAura->GetId(), targetAura->GetCasterGUID());
//addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth,HEAL, unitTarget);
}
+ // Riptide - increase healing done by Chain Heal
+ else if (m_spellInfo->SpellFamilyName==SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x100)
+ {
+ if (AuraEffect * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID))
+ {
+ addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
+ addhealth *= 1.25f;
+ // consume aura
+ unitTarget->RemoveAura(aurEff->GetParentAura());
+ }
+ }
else
addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
@@ -2552,6 +2594,9 @@ void Spell::EffectHealPct( uint32 /*i*/ )
return;
uint32 addhealth = unitTarget->GetMaxHealth() * damage / 100;
+ if(Player* modOwner = m_caster->GetSpellModOwner())
+ modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this);
+
caster->SendHealSpellLog(unitTarget, m_spellInfo->Id, addhealth, false);
int32 gain = unitTarget->ModifyHealth( int32(addhealth) );
@@ -4029,14 +4074,14 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
{
if (m_caster->GetTypeId()!=TYPEID_PLAYER)
return;
+ SpellEntry const *spellInfo = NULL;
uint32 stack = 0;
- int32 maxStack = 0;
+
if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_MOD_RESISTANCE,SPELLFAMILY_WARRIOR,SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR, 0, 0, m_caster->GetGUID()))
{
aur->GetParentAura()->RefreshAura();
+ spellInfo = aur->GetSpellProto();
stack = aur->GetParentAura()->GetStackAmount();
- maxStack = aur->GetSpellProto()->StackAmount;
- break;
}
for(int j = 0; j < 3; j++)
@@ -4048,7 +4093,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
}
}
- if(stack < maxStack)
+ if(!spellInfo)
{
// get highest rank of the Sunder Armor spell
const PlayerSpellMap& sp_list = ((Player*)m_caster)->GetSpellMap();
@@ -4058,19 +4103,22 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
- if (!spellInfo)
+ SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first);
+ if (!spellProto)
continue;
- if (spellInfo->SpellFamilyFlags.IsEqual(SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR)
- && spellInfo->Id != m_spellInfo->Id
- && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR)
+ if (spellProto->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR
+ && spellProto->Id != m_spellInfo->Id
+ && spellProto->SpellFamilyName == SPELLFAMILY_WARRIOR)
{
- m_caster->CastSpell(unitTarget, spellInfo, true);
+ spellInfo = spellProto;
break;
}
}
}
+ if (!spellInfo)
+ break;
+ m_caster->CastSpell(unitTarget, spellInfo, true);
if (stack)
spell_bonus += stack * CalculateDamage(2, unitTarget);
}
@@ -4118,6 +4166,13 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
spell_bonus += int32(0.23f*m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)));
spell_bonus += int32(0.29f*m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget));
}
+
+ // Seal of Command Unleashed
+ else if(m_spellInfo->Id==20467)
+ {
+ spell_bonus += int32(0.16f*m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
+ spell_bonus += int32(0.25f*m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)));
+ }
break;
}
case SPELLFAMILY_SHAMAN:
@@ -4871,8 +4926,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
if (familyFlag[1] & 0x00000080)
{
+ int32 tickCount = (aura->GetAuraMaxDuration() - aura->GetAuraDuration()) / aura->GetPartAura(0)->GetAuraAmplitude();
spellId = 53358; // 53358 Chimera Shot - Viper
- basePoint = aura->GetPartAura(0)->GetAmount() * 4 * 60 / 100;
+ // Amount of one aura tick
+ basePoint = aura->GetPartAura(0)->GetAmount() * aura->GetTarget()->GetMaxPower(POWER_MANA) / 100 ;
+ int32 casterBasePoint = aura->GetPartAura(0)->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ;
+ if (basePoint > casterBasePoint)
+ basePoint = casterBasePoint;
+ basePoint = basePoint * tickCount * 60 / 100;
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
if (familyFlag[0] & 0x00008000)
@@ -4915,18 +4976,33 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
}
// all seals have aura dummy in 2 effect
- Unit::AuraEffectList const& m_dummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraEffectList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr)
- {
- SpellEntry const *spellInfo = (*itr)->GetSpellProto();
- // search seal (all seals have judgement's aura dummy spell id in 2 effect
- if ((*itr)->GetEffIndex() != 2 || !spellInfo || !IsSealSpell(spellInfo))
- continue;
- spellId2 = (*itr)->GetAmount();
- SpellEntry const *judge = sSpellStore.LookupEntry(spellId2);
- if (!judge)
- continue;
- break;
+ Unit::AuraMap & sealAuras = m_caster->GetAuras();
+ for(Unit::AuraMap::iterator iter = sealAuras.begin(); iter != sealAuras.end();)
+ {
+ if (IsSealSpell(iter->second->GetSpellProto()))
+ {
+ if (AuraEffect * aureff = iter->second->GetPartAura(2))
+ if (aureff->GetAuraName()==SPELL_AURA_DUMMY)
+ {
+ if (sSpellStore.LookupEntry(aureff->GetAmount()))
+ spellId2 = aureff->GetAmount();
+ break;
+ }
+ if (!spellId2)
+ {
+ switch (iter->first)
+ {
+ // Seal of light, wisdom, justice
+ case 20165:
+ case 20166:
+ case 20164:
+ spellId2 = 54158;
+ }
+ }
+ break;
+ }
+ else
+ ++iter;
}
if (spellId1)
m_caster->CastSpell(unitTarget, spellId1, true);
@@ -5668,6 +5744,8 @@ void Spell::EffectSummonCritter(uint32 i)
critter->SetReactState(REACT_PASSIVE);
critter->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ critter->GetMotionMaster()->MoveTargetedHome();
+
std::string name = player->GetName();
name.append(petTypeSuffix[3]);
critter->SetName( name );
@@ -5691,26 +5769,28 @@ void Spell::EffectKnockBack(uint32 i)
}
float speedxy = float(m_spellInfo->EffectMiscValue[i])/10;
- float speedz = float(damage/-10);
+ float speedz = float(damage/10);
- if(unitTarget->GetTypeId() == TYPEID_UNIT)
- {
- unitTarget->GetMotionMaster()->MoveJumpFrom(x, y, speedxy, -speedz);
- return;
- }
-
- float vcos, vsin;
- unitTarget->GetSinCos(x, y, vsin, vcos);
+ unitTarget->KnockbackFrom(x, y, speedxy, speedz);
+}
- WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
- data.append(unitTarget->GetPackGUID());
- data << uint32(0); // Sequence
- data << float(vcos); // x direction
- data << float(vsin); // y direction
- data << float(speedxy); // Horizontal speed
- data << float(speedz); // Z Movement speed (vertical)
+void Spell::EffectJump2(uint32 i)
+{
+ if(!unitTarget)
+ return;
- ((Player*)unitTarget)->GetSession()->SendPacket(&data);
+ float speedxy = float(m_spellInfo->EffectMiscValue[i])/10;
+ float speedz = float(damage/10);
+ if(!speedxy)
+ {
+ if(m_targets.getUnitTarget())
+ unitTarget->JumpTo(m_targets.getUnitTarget(), speedz);
+ }
+ else
+ {
+ //1891: Disengage
+ unitTarget->JumpTo(speedxy, speedz, m_spellInfo->SpellIconID != 1891);
+ }
}
void Spell::EffectSendTaxi(uint32 i)
@@ -5796,7 +5876,7 @@ void Spell::EffectDispelMechanic(uint32 i)
Unit::AuraMap& Auras = unitTarget->GetAuras();
for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); iter++)
- if(GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic-1)))
+ if(GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic)))
dispel_list.push(iter->second);
for(;dispel_list.size();dispel_list.pop())
@@ -5844,10 +5924,14 @@ void Spell::EffectDestroyAllTotems(uint32 /*i*/)
uint32 spell_id = totem->GetUInt32Value(UNIT_CREATED_BY_SPELL);
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
if(spellInfo)
- mana += spellInfo->manaCost * damage / 100;
+ {
+ mana += spellInfo->manaCost;
+ mana += spellInfo->ManaCostPercentage * m_caster->GetCreateMana() / 100;
+ }
((Totem*)totem)->UnSummon();
}
}
+ mana = mana * damage / 100;
int32 gain = m_caster->ModifyPower(POWER_MANA,int32(mana));
m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id, gain, POWER_MANA);
@@ -6417,6 +6501,7 @@ void Spell::SummonVehicle(uint32 entry, SummonPropertiesEntry const *properties)
if(!vehicle)
return;
+ vehicle->SetOwnerGUID(m_caster->GetGUID());
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
if(damage)
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index daa1b2d9add..0efc4cb0ee4 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -387,8 +387,6 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
if(spell->m_spellInfo->Id==spellId)
{
spell->cancel();
- spell->SetReferencedFromCurrent(false);
- _player->m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
}
}
return;
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 57b68ae55d9..f3f8907cfc4 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -39,18 +39,10 @@ SpellMgr::SpellMgr()
case SPELL_EFFECT_PERSISTENT_AREA_AURA: //27
case SPELL_EFFECT_SUMMON: //28
case SPELL_EFFECT_TRIGGER_MISSILE: //32
- //case SPELL_EFFECT_SUMMON_WILD: //41 not 303
- //case SPELL_EFFECT_SUMMON_GUARDIAN: //42 not 303
case SPELL_EFFECT_TRANS_DOOR: //50 summon object
case SPELL_EFFECT_SUMMON_PET: //56
case SPELL_EFFECT_ADD_FARSIGHT: //72
- //case SPELL_EFFECT_SUMMON_POSSESSED: //73
- //case SPELL_EFFECT_SUMMON_TOTEM: //74
case SPELL_EFFECT_SUMMON_OBJECT_WILD: //76
- //case SPELL_EFFECT_SUMMON_TOTEM_SLOT1: //87
- //case SPELL_EFFECT_SUMMON_TOTEM_SLOT2: //88
- //case SPELL_EFFECT_SUMMON_TOTEM_SLOT3: //89
- //case SPELL_EFFECT_SUMMON_TOTEM_SLOT4: //90
//case SPELL_EFFECT_SUMMON_CRITTER: //97 not 303
case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: //104
case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: //105
@@ -75,6 +67,7 @@ SpellMgr::SpellMgr()
case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_PROSPECTING:
case SPELL_EFFECT_MILLING:
+ case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC:
EffectTargetType[i] = SPELL_REQUIRE_ITEM;
break;
//caster must be pushed otherwise no sound
@@ -83,6 +76,7 @@ SpellMgr::SpellMgr()
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
+ case SPELL_EFFECT_JUMP2: //42
EffectTargetType[i] = SPELL_REQUIRE_CASTER;
break;
default:
@@ -533,6 +527,8 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
case 34700: // Allergic Reaction
case 31719: // Suspension
return false;
+ case 12042: // Arcane Power
+ return true;
}
switch(spellproto->Mechanic)
@@ -597,6 +593,8 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
// non-positive targets of main spell return early
for(int i = 0; i < 3; ++i)
{
+ if (!spellTriggeredProto->Effect[i])
+ continue;
// if non-positive trigger cast targeted to positive target this main cast is non-positive
// this will place this spell auras as debuffs
if(IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !IsPositiveEffect(spellTriggeredId,i, true))
@@ -604,7 +602,6 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
}
}
}
- break;
case SPELL_AURA_PROC_TRIGGER_SPELL:
// many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example)
break;
@@ -715,7 +712,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
return false;
if (!deep && spellproto->EffectTriggerSpell[effIndex]
- && !spellproto->procFlags
+ && !spellproto->EffectApplyAuraName[effIndex]
&& IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex])
&& !IsPositiveSpell(spellproto->EffectTriggerSpell[effIndex], true))
return false;
@@ -1198,7 +1195,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellP
// spellFamilyName is Ok need check for spellFamilyMask if present
if(spellProcEvent->spellFamilyMask)
{
- if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags ) == 0)
+ if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags ) == 0)
return false;
active = true; // Spell added manualy -> so its active spell
}
@@ -2368,6 +2365,25 @@ void SpellMgr::LoadSpellCustomAttr()
case 18662: // Curse of Doom
spellInfo->EffectBasePoints[0] = 0; //prevent summon too many of them
break;
+ case 17941: // Shadow Trance
+ case 22008: // Netherwind Focus
+ case 31834: // Light's Grace
+ case 34754: // Clearcasting
+ case 34936: // Backlash
+ case 48108: // Hot Streak
+ case 51124: // Killing Machine
+ case 54741: // Firestarter
+ case 57761: // Fireball!
+ case 39805: // Lightning Overload
+ case 52437: // Sudden Death
+ spellInfo->procCharges=1;
+ break;
+ case 44544: // Fingers of Frost
+ spellInfo->procCharges=2;
+ break;
+ case 28200: // Ascendance (Talisman of Ascendance trinket)
+ spellInfo->procCharges=6;
+ break;
default:
break;
}
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index acf0dbc78ba..c87ad91ff90 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -176,10 +176,22 @@ void TempSummon::InitSummon(uint32 duration)
if(m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
+ Unit* owner = GetSummoner();
+ if(owner)
+ {
+ if(owner->GetTypeId()==TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
+ ((Creature*)owner)->AI()->JustSummoned(this);
+
+ if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && m_spells[0])
+ {
+ setFaction(owner->getFaction());
+ CastSpell(this, m_spells[0], false, 0, 0, m_summonerGUID);
+ }
+ }
+
if(!m_Properties)
return;
- Unit* owner = GetSummoner();
if(uint32 slot = m_Properties->Slot)
{
if(owner)
@@ -194,18 +206,6 @@ void TempSummon::InitSummon(uint32 duration)
}
}
- if(owner)
- {
- if(owner->GetTypeId()==TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
- ((Creature*)owner)->AI()->JustSummoned(this);
-
- if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && m_spells[0])
- {
- setFaction(owner->getFaction());
- CastSpell(this, m_spells[0], false, 0, 0, m_summonerGUID);
- }
- }
-
if(m_Properties->Faction)
setFaction(m_Properties->Faction);
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e08d4c2d43e..f41637b6c75 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -159,7 +159,6 @@ Unit::Unit()
for (int i = 0; i < MAX_MOVE_TYPE; ++i)
m_speed_rate[i] = 1.0f;
- m_removedAuras = 0;
m_charmInfo = NULL;
m_unit_movement_flags = 0;
m_reducedThreatPercent = 0;
@@ -344,38 +343,32 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 M
WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );
data.append(GetPackGUID());
- // Point A, starting location
data << GetPositionX() << GetPositionY() << GetPositionZ();
- // unknown field - unrelated to orientation
- // seems to increment about 1000 for every 1.7 seconds
- // for now, we'll just use mstime
- data << getMSTime();
+ data << uint32(getMSTime());
data << uint8(type); // unknown
switch(type)
{
case 0: // normal packet
break;
- case 1: // stop packet
+ case 1: // stop packet (raw pos?)
SendMessageToSet( &data, true );
return;
- case 2: // not used currently
- data << float(0); // orientation
+ case 2: // facing spot, not used currently
+ data << float(0);
data << float(0);
data << float(0);
break;
case 3: // not used currently
- data << uint64(0); // probably target guid
+ data << uint64(0); // probably target guid (facing target?)
break;
case 4: // not used currently
- data << float(0); // probably orientation
+ data << float(0); // facing angle
break;
}
- //Movement Flags (0x0 = walk, 0x100 = run, 0x200 = fly/swim)
- data << uint32((MovementFlags & MOVEMENTFLAG_LEVITATING) ? MOVEFLAG_FLY : MOVEFLAG_WALK);
-
- data << Time; // Time in between points
+ data << uint32(MovementFlags);
+ data << uint32(Time); // Time in between points
data << uint32(1); // 1 single waypoint
data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
@@ -396,16 +389,12 @@ void Unit::SendMonsterMoveByPath(Path const& path, uint32 start, uint32 end)
data << GetPositionX();
data << GetPositionY();
data << GetPositionZ();
-
data << getMSTime();
-
data << uint8( 0 );
data << uint32(((GetUnitMovementFlags() & MOVEMENTFLAG_LEVITATING) || isInFlight())? (MOVEFLAG_FLY|MOVEFLAG_WALK) : MOVEFLAG_WALK);
data << uint32( traveltime );
data << uint32( pathSize );
data.append( (char*)path.GetNodes(start), pathSize * 4 * 3 );
-
- //WPAssert( data.size() == 37 + pathnodes.Size( ) * 4 * 3 );
SendMessageToSet(&data, true);
}
@@ -472,7 +461,10 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
++iter;
if ((aur->GetSpellProto()->AuraInterruptFlags & flag) && (!except || aur->GetId() != except))
{
+ uint32 removedAuras = m_removedAuras.size();
RemoveAura(aur);
+ if (removedAuras+1<m_removedAuras.size())
+ iter=m_interruptableAuras.begin();
}
}
@@ -513,14 +505,17 @@ void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
++iter;
if ((!spell || aur->GetId() != spell) && roll_chance_f(chance))
{
+ uint32 removedAuras = m_removedAuras.size();
RemoveAura(aur);
+ if (removedAuras+1<m_removedAuras.size())
+ iter=m_ccAuras.begin();
}
}
}
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
{
- if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
+ if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
return 0;
//You don't lose health from damage taken from another player while in a sanctuary
@@ -1323,7 +1318,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
if(!this || !pVictim)
return;
- if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
+ if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
return;
SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
@@ -1566,7 +1561,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
if(!this || !pVictim)
return;
- if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
+ if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
return;
//You don't lose health from damage taken from another player while in a sanctuary
@@ -1626,7 +1621,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
// If this is a creature and it attacks from behind it has a probability to daze it's victim
if( (damageInfo->hitOutCome==MELEE_HIT_CRIT || damageInfo->hitOutCome==MELEE_HIT_CRUSHING || damageInfo->hitOutCome==MELEE_HIT_NORMAL || damageInfo->hitOutCome==MELEE_HIT_GLANCING) &&
- GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI, this) )
+ GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->GetCharmerOrOwnerGUID() && !pVictim->HasInArc(M_PI, this)
+ && (pVictim->GetTypeId() == TYPEID_PLAYER || !((Creature*)pVictim)->isWorldBoss()))
{
// -probability is between 0% and 40%
// 20% base chance
@@ -1659,7 +1655,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
// victim's damage shield
std::set<AuraEffect*> alreadyDone;
- uint32 removedAuras = pVictim->m_removedAuras;
+ uint32 removedAuras = pVictim->m_removedAuras.size();
AuraEffectList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD);
for(AuraEffectList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next)
{
@@ -1688,9 +1684,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
pVictim->DealDamage(this, damage, 0, SPELL_DIRECT_DAMAGE, GetSpellSchoolMask(spellProto), spellProto, true);
- if (pVictim->m_removedAuras > removedAuras)
+ if (pVictim->m_removedAuras.size() > removedAuras)
{
- removedAuras = pVictim->m_removedAuras;
+ removedAuras = pVictim->m_removedAuras.size();
next = vDamageShields.begin();
}
}
@@ -2083,7 +2079,10 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
++i;
if (auraeff->GetAmount()<=0)
{
- pVictim->RemoveAura(aura);
+ uint32 removedAuras = pVictim->m_removedAuras.size();
+ pVictim->RemoveAura(aura, AURA_REMOVE_BY_ENEMY_SPELL);
+ if (removedAuras+1<pVictim->m_removedAuras.size())
+ i=vSchoolAbsorb.begin();
}
}
}
@@ -2118,7 +2117,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
(*i)->SetAmount((*i)->GetAmount()-currentAbsorb);
if((*i)->GetAmount() <= 0)
{
- pVictim->RemoveAurasDueToSpell((*i)->GetId());
+ pVictim->RemoveAura((*i)->GetParentAura(), AURA_REMOVE_BY_ENEMY_SPELL);
next = vManaShield.begin();
}
@@ -2426,7 +2425,10 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
if (tmp > 0 && roll < (sum += tmp))
{
DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
- return MELEE_HIT_CRIT;
+ if(GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
+ DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
+ else
+ return MELEE_HIT_CRIT;
}
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
@@ -2832,7 +2834,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
HitChance -= int32(((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_SPELL)*100.0f);
if (HitChance < 100) HitChance = 100;
- if (HitChance > 9900) HitChance = 9900;
+ if (HitChance > 10000) HitChance = 10000;
int32 tmp = 10000 - HitChance;
@@ -3183,6 +3185,67 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target)
return value;
}
+void Unit::_DeleteAuras()
+{
+ for (AuraList::iterator i = m_removedAuras.begin(); i != m_removedAuras.end();i = m_removedAuras.begin())
+ {
+ Aura * Aur = *i;
+ SpellEntry const* AurSpellInfo = Aur->GetSpellProto();
+ // Statue unsummoned at aura delete
+ Totem* statue = NULL;
+ if(Aur->GetAuraDuration() && !Aur->IsPersistent() && IsChanneledSpell(Aur->GetSpellProto()))
+ {
+ Unit* caster = Aur->GetCaster();
+ if(caster && caster->isAlive())
+ {
+ // stop caster chanelling state
+ if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
+ {
+ // same spell
+ if (AurSpellInfo == caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo
+ //prevent recurential call
+ && caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
+ {
+ if (caster==this || !IsAreaOfEffectSpell(AurSpellInfo))
+ {
+ // remove auras only for non-aoe spells or when chanelled aura is removed
+ // because aoe spells don't require aura on target to continue
+ caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
+ }
+
+ if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
+ statue = ((Totem*)caster);
+ }
+ }
+
+ // Unsummon summon as possessed creatures on spell cancel
+ if(caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ for(int i = 0; i < 3; ++i)
+ {
+ if(AurSpellInfo->Effect[i] == SPELL_EFFECT_SUMMON)
+ if(SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(AurSpellInfo->EffectMiscValueB[i]))
+ if(SummonProperties->Category == SUMMON_CATEGORY_POSSESSED)
+ {
+ ((Player*)caster)->StopCastingCharm();
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(statue)
+ {
+ sLog.outDebug("Statue %d is unsummoned by aura %d delete from unit %d", statue->GetGUIDLow(), Aur->GetId(),GetGUIDLow());
+ statue->UnSummon();
+ }
+
+ sLog.outDebug("Aura %d is deleted from unit %d", Aur->GetId(), GetGUIDLow());
+ m_removedAuras.pop_front();
+ delete (Aur);
+ }
+}
+
void Unit::_UpdateSpells( uint32 time )
{
if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
@@ -3199,7 +3262,6 @@ void Unit::_UpdateSpells( uint32 time )
}
// TODO: Find a better way to prevent crash when multiple auras are removed.
- m_removedAuras = 0;
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
i->second->SetUpdated(false);
@@ -3208,20 +3270,20 @@ void Unit::_UpdateSpells( uint32 time )
Aura *aur = i->second;
// prevent double update
- if (aur->IsUpdated())
+ if(aur->IsUpdated())
+ {
+ ++i;
continue;
+ }
+
aur->SetUpdated(true);
- aur->SetInUse(true);
+ uint32 removedAuras = m_removedAuras.size();
aur->Update( time );
- aur->SetInUse(false);
// several auras can be deleted due to update
- if(m_removedAuras)
- {
- m_removedAuras = 0;
+ if(removedAuras < m_removedAuras.size())
i = m_Auras.begin();
- }
else
++i;
}
@@ -3234,6 +3296,8 @@ void Unit::_UpdateSpells( uint32 time )
++i;
}
+ _DeleteAuras();
+
if(!m_gameObj.empty())
{
std::list<GameObject*>::iterator ite1, dnext1;
@@ -3696,6 +3760,8 @@ bool Unit::AddAura(Aura *Aur)
{
if(foundAura->GetStackAmount() < aurSpellInfo->StackAmount)
foundAura->SetStackAmount(foundAura->GetStackAmount()+1);
+ else
+ foundAura->RefreshAura();
delete Aur;
return true;
}
@@ -3751,7 +3817,7 @@ bool Unit::AddAura(Aura *Aur)
}
if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
&& !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
- || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
+ || ((GetAllSpellMechanicMask(Aur->GetSpellProto()) & 1<<MECHANIC_KNOCKOUT) && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
{
m_ccAuras.push_back(Aur);
}
@@ -3787,7 +3853,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
{
next = i;
++next;
- if ((*i).second->IsInUse()) continue;
SpellEntry const* i_spellProto = (*i).second->GetSpellProto();
@@ -3863,12 +3928,9 @@ void Unit::RemoveAura(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
void Unit::RemoveAura(Aura * aur ,AuraRemoveMode mode)
{
- if (aur->IsInUse())
- {
- if (!aur->GetRemoveMode())
- aur->RemoveAura(mode);
+ // no need to remove
+ if (!aur || aur->IsRemoved())
return;
- }
for(AuraMap::iterator iter = m_Auras.lower_bound(aur->GetId()); iter != m_Auras.upper_bound(aur->GetId());)
{
if (aur == iter->second)
@@ -3885,7 +3947,7 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster ,AuraRemoveMode r
{
for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- if ((!caster || iter->second->GetCasterGUID()==caster) && (!iter->second->IsInUse() || !iter->second->GetRemoveMode()))
+ if (!caster || iter->second->GetCasterGUID()==caster)
{
RemoveAura(iter, removeMode);
iter = m_Auras.lower_bound(spellId);
@@ -3958,15 +4020,15 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
else
damage[i]=NULL;
}
- int32 dur = 2*MINUTE*IN_MILISECONDS > aur->GetAuraDuration() ? 2*MINUTE*IN_MILISECONDS : aur->GetAuraDuration();
+ int32 dur = 2*MINUTE*IN_MILISECONDS < aur->GetAuraDuration() ? 2*MINUTE*IN_MILISECONDS : aur->GetAuraDuration();
Aura * new_aur = new Aura(aur->GetSpellProto(),aur->GetEffectMask(), NULL, stealer, stealer, NULL);
new_aur->SetLoadedState(aur->GetCasterGUID(), dur, dur, aur->GetAuraCharges(), aur->GetStackAmount(), &damage[0]);
// Unregister _before_ adding to stealer
aur->UnregisterSingleCastAura();
-
// strange but intended behaviour: Stolen single target auras won't be treated as single targeted
new_aur->SetIsSingleTarget(false);
+ stealer->AddAura(new_aur);
RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
return;
}
@@ -3979,7 +4041,7 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
{
for (AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- if ((!castItem || iter->second->GetCastItemGUID()==castItem->GetGUID()) && (!iter->second->IsInUse() || !iter->second->GetRemoveMode()))
+ if (!castItem || iter->second->GetCastItemGUID()==castItem->GetGUID())
{
RemoveAura(iter);
iter = m_Auras.upper_bound(spellId); // overwrite by more appropriate
@@ -3998,7 +4060,10 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except
++iter;
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
{
+ uint32 removedAuras = m_removedAuras.size();
RemoveAura(aur);
+ if (removedAuras+1<m_removedAuras.size())
+ iter=m_modAuras[auraType].begin();
}
}
}
@@ -4012,7 +4077,10 @@ void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
++iter;
if (GetDispelChance(spell, aur->GetCaster(), aur->GetId()))
{
+ uint32 removedAuras = m_removedAuras.size();
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
+ if (removedAuras+1<m_removedAuras.size())
+ iter=m_modAuras[auraType].begin();
}
}
}
@@ -4032,35 +4100,25 @@ void Unit::RemoveNotOwnSingleTargetAuras()
AuraList& scAuras = GetSingleCastAuras();
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
{
- if ((*iter)->GetTarget()!=this)
+ Aura * aur=*iter;
+ ++iter;
+ if (aur->GetTarget()!=this)
{
- Aura * aur=*iter;
- ++iter;
+ uint32 removedAuras = m_removedAuras.size();
aur->GetTarget()->RemoveAura(aur->GetId(),aur->GetCasterGUID());
+ if (removedAuras+1<m_removedAuras.size())
+ iter=scAuras.begin();
}
- else
- ++iter;
}
}
void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
{
Aura* Aur = i->second;
- //aura can be during update when removing, set it to remove at next update
- if (Aur->IsInUse())
- {
- if (!Aur->GetRemoveMode())
- Aur->RemoveAura(mode);
- i++;
- return;
- }
-
- SpellEntry const* AurSpellInfo = Aur->GetSpellProto();
// some ShapeshiftBoosts at remove trigger removing other auras including parent Shapeshift aura
// remove aura from list before to prevent deleting it before
m_Auras.erase(i);
- ++m_removedAuras; // internal count used by unit update
Aur->UnregisterSingleCastAura();
@@ -4072,71 +4130,20 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
&& !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
- || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
+ || ((GetAllSpellMechanicMask(Aur->GetSpellProto()) & 1<<MECHANIC_KNOCKOUT) && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
{
m_ccAuras.remove(Aur);
}
- // Set remove mode if mode already not set
- if (!Aur->GetRemoveMode())
- Aur->SetRemoveMode(mode);
-
- // Statue unsummoned at aura remove
- Totem* statue = NULL;
- bool channeled = false;
- if(Aur->GetAuraDuration() && !Aur->IsPersistent() && IsChanneledSpell(AurSpellInfo))
- {
- Unit* caster = Aur->GetCaster();
- if(caster && caster->isAlive())
- {
- // stop caster chanelling state
- if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
- {
- // same spell
- if (AurSpellInfo == caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo
- //prevent recurential call
- && caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
- {
- if (caster==this || !IsAreaOfEffectSpell(AurSpellInfo))
- {
- // remove auras only for non-aoe spells or when chanelled aura is removed
- // because aoe spells don't require aura on target to continue
- {
- caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
- caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
- }
- }
-
- if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
- statue = ((Totem*)caster);
- }
- }
-
- // Unsummon summon as possessed creatures on spell cancel
- if(caster->GetTypeId() == TYPEID_PLAYER)
- {
- for(int i = 0; i < 3; ++i)
- {
- if(AurSpellInfo->Effect[i] == SPELL_EFFECT_SUMMON)
- if(SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(AurSpellInfo->EffectMiscValueB[i]))
- if(SummonProperties->Category == SUMMON_CATEGORY_POSSESSED)
- {
- ((Player*)caster)->StopCastingCharm();
- break;
- }
- }
- }
- }
- }
+ Aur->SetRemoveMode(mode);
sLog.outDebug("Aura %u now is remove mode %d", Aur->GetId(), mode);
Aur->HandleEffects(false);
- Aur->_RemoveAura();
- delete Aur;
+ // set aura to be removed during unit::_updatespells
+ m_removedAuras.push_back(Aur);
- if(statue)
- statue->UnSummon();
+ Aur->_RemoveAura();
// only way correctly remove all auras from list
i = m_Auras.begin();
@@ -4233,6 +4240,21 @@ bool Unit::HasAura(uint32 spellId, uint64 caster) const
return false;
}
+bool Unit::HasAura(Aura * aur) const
+{
+ // no need to find aura
+ if (!aur || aur->IsRemoved())
+ return false;
+ for(AuraMap::const_iterator iter = m_Auras.lower_bound(aur->GetId()); iter != m_Auras.upper_bound(aur->GetId());)
+ {
+ if (aur == iter->second)
+ return true;
+ else
+ ++iter;
+ }
+ return false;
+}
+
bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
{
if (Aura * aur = GetAura(spellId, caster))
@@ -4745,10 +4767,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 9799:
case 25988:
{
- // prevent damage back from weapon special attacks
- if (!procSpell || procSpell->DmgClass != SPELL_DAMAGE_CLASS_MAGIC )
- return false;
-
// return damage % to attacker but < 50% own total health
basepoints0 = triggerAmount*int32(damage)/100;
if(basepoints0 > GetMaxHealth()/2)
@@ -5124,7 +5142,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetSpellProto();
- if( GetAllSpellMechanicMask(spell) & 1<<(MECHANIC_STUN-1))
+ if( GetAllSpellMechanicMask(spell) & 1<<(MECHANIC_STUN))
{
pVictim->RemoveAura(iter);
}
@@ -5388,7 +5406,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (!target)
return false;
triggered_spell_id = 54181;
- basepoints0 = damage * triggerAmount / 100;
+ basepoints0 = damage * 15 / 100;
break;
}
switch(dummySpell->Id)
@@ -5599,14 +5617,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Leader of the Pack
case 24932:
{
- if (triggerAmount <= 0)
+ if (triggerAmount <= 0)
return false;
basepoints0 = triggerAmount * GetMaxHealth() / 100;
target = this;
triggered_spell_id = 34299;
if (triggeredByAura->GetCaster() != this)
break;
- int32 basepoints1 = triggerAmount * 2 *GetMaxPower(POWER_MANA)/100;
+ int32 basepoints1 = triggerAmount * 2;
CastCustomSpell(this,60889,&basepoints1,0,0,true,0,triggeredByAura);
break;
}
@@ -5818,6 +5836,34 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
basepoints0 = GetAttackTime(BASE_ATTACK) * int32(ap*0.022f + 0.044f * holy) / 1000;
break;
}
+ // Light's Beacon - Beacon of Light
+ if ( dummySpell->Id == 53651 )
+ {
+ if (Unit * caster = triggeredByAura->GetCaster())
+ {
+ // do not proc when target of beacon of light is healed
+ if (caster == pVictim)
+ return false;
+ if (Aura * aur = caster->GetAura(53563))
+ {
+ if (Unit * paladin = aur->GetCaster())
+ {
+ if (paladin != this)
+ return false;
+ basepoints0 = damage;
+ triggered_spell_id = 53654;
+ target = caster;
+ break;
+ }
+ else
+ {
+ pVictim->RemoveAura(triggeredByAura->GetParentAura());
+ return false;
+ }
+ }
+ }
+ else return false;
+ }
// Judgements of the Wise
if (dummySpell->SpellIconID == 3017)
{
@@ -6595,7 +6641,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
- // Try handle uncnown trigger spells
+ // Try handle unknown trigger spells
if (sSpellStore.LookupEntry(trigger_spell_id)==NULL)
{
switch (auraSpellInfo->SpellFamilyName)
@@ -8000,7 +8046,7 @@ void Unit::SetGuardian(Guardian* guardian, bool apply)
if(AddUInt64Value(UNIT_FIELD_SUMMON, guardian->GetGUID()))
{
- if(GetTypeId() == TYPEID_PLAYER)
+ if(GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
{
if(guardian->isPet())
((Player*)this)->PetSpellInitialize();
@@ -8035,12 +8081,17 @@ void Unit::SetGuardian(Guardian* guardian, bool apply)
//Check if there is another guardian
for(ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
{
+ if(GetCharmGUID() == (*itr)->GetGUID())
+ continue;
+
assert((*itr)->GetOwnerGUID() == GetGUID());
+ assert((*itr)->GetTypeId() == TYPEID_UNIT);
if(AddUInt64Value(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
{
- if(GetTypeId() == TYPEID_PLAYER)
+ //show another pet bar if there is no charm bar
+ if(GetTypeId() == TYPEID_PLAYER && !GetCharmGUID())
{
- if(guardian->isPet())
+ if(((Creature*)(*itr))->isPet())
((Player*)this)->PetSpellInitialize();
else
((Player*)this)->CharmSpellInitialize();
@@ -8665,18 +8716,28 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
if (pVictim->GetTypeId() == TYPEID_PLAYER)
crit_chance -= ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL);
}
-
// scripted (increase crit chance ... against ... target by x%
AuraEffectList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for(AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!((*i)->isAffectedOnSpell(spellProto)))
continue;
+ int32 modChance=0;
switch((*i)->GetMiscValue())
{
- case 849: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 17.0f; break; //Shatter Rank 1
- case 910: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 34.0f; break; //Shatter Rank 2
- case 911: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 50.0f; break; //Shatter Rank 3
+ // Shatter
+ case 911: modChance+= 16.0f;
+ case 910: modChance+= 17.0f;
+ case 849: modChance+= 17.0f;
+ if (!pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
+ break;
+ crit_chance+=modChance;
+ // Fingers of Frost
+ // TODO: Change this code to less hacky
+ if (Aura * aur = GetAura(44544))
+ if (aur->DropAuraCharge())
+ RemoveAura(aur);
+ break;
case 7917: // Glyph of Shadowburn
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
crit_chance+=(*i)->GetAmount();
@@ -8906,6 +8967,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
// Check for table values
SpellBonusEntry const* bonus = spellmgr.GetSpellBonusData(spellProto->Id);
float coeff;
+ bool scripted = false;
if (bonus)
{
if (damagetype == DOT)
@@ -8915,57 +8977,74 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
if (bonus->ap_bonus)
DoneTotal+=bonus->ap_bonus * GetTotalAttackPowerValue(BASE_ATTACK) * stack;
}
+ else // scripted bonus
+ {
+ // Gift of the Naaru
+ if (spellProto->Id==59547)
+ {
+ scripted = true;
+ uint32 apBonus = GetTotalAttackPowerValue(BASE_ATTACK);
+ if (apBonus > DoneAdvertisedBenefit)
+ {
+ DoneTotal+=apBonus * stack;
+ coeff = 0.0f;
+ }
+ else
+ coeff = 1.0f;
+ }
+ }
+
// Default calculation
if (DoneAdvertisedBenefit || TakenAdvertisedBenefit)
{
- if(!bonus)
- {
- // Damage Done from spell damage bonus
- int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
- // Damage over Time spells bonus calculation
- float DotFactor = 1.0f;
- if(damagetype == DOT)
+ if(!bonus && !scripted)
{
- int32 DotDuration = GetSpellDuration(spellProto);
- // 200% limit
- if(DotDuration > 0)
+ // Damage Done from spell damage bonus
+ int32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto);
+ // Damage over Time spells bonus calculation
+ float DotFactor = 1.0f;
+ if(damagetype == DOT)
{
- if(DotDuration > 30000) DotDuration = 30000;
- if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f;
- int x = 0;
- for(int j = 0; j < 3; j++)
+ int32 DotDuration = GetSpellDuration(spellProto);
+ // 200% limit
+ if(DotDuration > 0)
{
- if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
- spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) )
+ if(DotDuration > 30000) DotDuration = 30000;
+ if(!IsChanneledSpell(spellProto)) DotFactor = DotDuration / 15000.0f;
+ int x = 0;
+ for(int j = 0; j < 3; j++)
{
- x = j;
- break;
+ if( spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && (
+ spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE ||
+ spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) )
+ {
+ x = j;
+ break;
+ }
+ }
+ int32 DotTicks = 6;
+ if(spellProto->EffectAmplitude[x] != 0)
+ DotTicks = DotDuration / spellProto->EffectAmplitude[x];
+ if(DotTicks)
+ {
+ DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks;
+ TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks;
}
- }
- int32 DotTicks = 6;
- if(spellProto->EffectAmplitude[x] != 0)
- DotTicks = DotDuration / spellProto->EffectAmplitude[x];
- if(DotTicks)
- {
- DoneAdvertisedBenefit = DoneAdvertisedBenefit * int32(stack) / DotTicks;
- TakenAdvertisedBenefit = TakenAdvertisedBenefit * int32(stack) / DotTicks;
}
}
- }
- // Distribute Damage over multiple effects, reduce by AoE
- CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
- // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
- for(int j = 0; j < 3; ++j)
- {
- if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
- spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH )
+ // Distribute Damage over multiple effects, reduce by AoE
+ CastingTime = GetCastingTimeForBonus( spellProto, damagetype, CastingTime );
+ // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
+ for(int j = 0; j < 3; ++j)
{
- CastingTime /= 2;
- break;
+ if( spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ||
+ spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH )
+ {
+ CastingTime /= 2;
+ break;
+ }
}
- }
- coeff = (CastingTime / 3500.0f) * DotFactor;
+ coeff = (CastingTime / 3500.0f) * DotFactor;
}
float coeff2 = CalculateLevelPenalty(spellProto) * 1.88f * stack;
@@ -9117,12 +9196,15 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
return true;
}
- SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
- for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
+ if (spellInfo->Mechanic)
{
- if(itr->type & (1<<spellInfo->Mechanic))
+ SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
+ for(SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
{
- return true;
+ if(itr->type == spellInfo->Mechanic)
+ {
+ return true;
+ }
}
}
@@ -9153,7 +9235,7 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
{
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
- if(itr->type & 1<<(spellInfo->EffectMechanic[index]))
+ if(itr->type == spellInfo->EffectMechanic[index])
return true;
}
@@ -9457,21 +9539,7 @@ void Unit::Mount(uint32 mount)
// unsummon pet
if(GetTypeId() == TYPEID_PLAYER)
- {
- Pet* pet = ((Player*)this)->GetPet();
- if(pet)
- {
- if(pet->isControlled())
- {
- ((Player*)this)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
- ((Player*)this)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
- }
-
- ((Player*)this)->RemovePet(NULL,PET_SAVE_NOT_IN_SLOT);
- }
- else
- ((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
- }
+ ((Player*)this)->UnsummonPetTemporaryIfAny();
}
void Unit::Unmount()
@@ -9487,14 +9555,8 @@ void Unit::Unmount()
// only resummon old pet if the player is already added to a map
// this prevents adding a pet to a not created map which would otherwise cause a crash
// (it could probably happen when logging in after a previous crash)
- if(GetTypeId() == TYPEID_PLAYER && IsInWorld() && ((Player*)this)->GetTemporaryUnsummonedPetNumber() && isAlive())
- {
- Pet* NewPet = new Pet((Player*)this);
- if(!NewPet->LoadPetFromDB((Player*)this, 0, ((Player*)this)->GetTemporaryUnsummonedPetNumber(), true))
- delete NewPet;
-
- ((Player*)this)->SetTemporaryUnsummonedPetNumber(0);
- }
+ if(GetTypeId() == TYPEID_PLAYER)
+ ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
}
void Unit::SetInCombatWith(Unit* enemy)
@@ -9648,7 +9710,7 @@ bool Unit::isAttackableByAOE() const
if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
return false;
- return !isInFlight();
+ return !hasUnitState(UNIT_STAT_UNATTACKABLE);
}
int32 Unit::ModifyHealth(int32 dVal)
@@ -10429,7 +10491,7 @@ void Unit::ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spel
if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CASTING_TIME, castTime, spell);
- if( !(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_UNK5)) )
+ if( !(spellProto->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_UNK5)) && spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && spellProto->SpellFamilyName)
castTime = int32( float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
else
{
@@ -10575,6 +10637,16 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
return ObjectAccessor::GetUnit(object,guid);
}
+Player* Unit::GetPlayer(uint64 guid)
+{
+ return ObjectAccessor::FindPlayer(guid);
+}
+
+Creature* Unit::GetCreature(WorldObject& object, uint64 guid)
+{
+ return ObjectAccessor::GetCreature(object, guid);
+}
+
bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const
{
return u->canSeeOrDetect(this, false, inVisibleList, false);
@@ -10995,9 +11067,22 @@ uint32 Unit::GetCreatePowers( Powers power ) const
return 0;
}
+void Unit::AddToWorld()
+{
+ if(!IsInWorld())
+ {
+ WorldObject::AddToWorld();
+ m_Notified = false;
+ m_IsInNotifyList = false;
+ SetToNotify();
+ }
+}
+
void Unit::RemoveFromWorld()
{
// cleanup
+ assert(GetGUID());
+
if(IsInWorld())
{
UnsummonAllTotems();
@@ -11015,11 +11100,12 @@ void Unit::RemoveFromWorld()
void Unit::CleanupsBeforeDelete()
{
- assert(m_uint32Values);
+ assert(GetGUID());
//A unit may be in removelist and not in world, but it is still in grid
//and may have some references during delete
RemoveAllAuras();
+ _DeleteAuras();
InterruptNonMeleeSpells(true);
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop();
@@ -11254,34 +11340,18 @@ bool Unit::isFrozen() const
struct ProcTriggeredData
{
- ProcTriggeredData(SpellProcEventEntry const * _spellProcEvent, AuraEffect* _triggeredByAura)
- : spellProcEvent(_spellProcEvent), triggeredByAura(_triggeredByAura)
- {}
- SpellProcEventEntry const *spellProcEvent;
- AuraEffect* triggeredByAura;
-};
-struct ProcTriggerringAura
-{
- ProcTriggerringAura(uint32 _spellId, uint64 _casterGUID) : spellId(_spellId), casterGUID(_casterGUID)
+ ProcTriggeredData(Aura* _aura)
+ : aura(_aura)
{
- triggeringAura[0]=NULL;
- triggeringAura[1]=NULL;
- triggeringAura[2]=NULL;
- }
- ProcTriggeredData * triggeringAura[3];
- uint32 spellId;
- uint64 casterGUID;
- ~ProcTriggerringAura()
- {
- for (uint8 i = 0;i<3;++i)
- if (triggeringAura[i])
- delete triggeringAura[i];
+ effMask = 0;
+ spellProcEvent = NULL;
}
+ SpellProcEventEntry const *spellProcEvent;
+ Aura * aura;
+ uint32 effMask;
};
-//typedef std::list< ProcTriggeredData > ProcTriggeredList;
-typedef std::list< ProcTriggerringAura > ProcTriggeredList;
-typedef std::list< uint32> RemoveSpellList;
+typedef std::list< ProcTriggeredData > ProcTriggeredList;
// List of auras that CAN be trigger but may not exist in spell_proc_event
// in most case need for drop charges
@@ -11324,6 +11394,7 @@ bool InitTriggerAuraData()
isTriggerAura[SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE] = true;
isTriggerAura[SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE] = true;
isTriggerAura[SPELL_AURA_MOD_DAMAGE_FROM_CASTER] = true;
+ isTriggerAura[SPELL_AURA_ABILITY_IGNORE_AURASTATE] = true;
isNonTriggerAura[SPELL_AURA_MOD_POWER_REGEN]=true;
isNonTriggerAura[SPELL_AURA_REDUCE_PUSHBACK]=true;
@@ -11437,69 +11508,60 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
}
}
- RemoveSpellList removedSpells;
ProcTriggeredList procTriggered;
// Fill procTriggered list
for(AuraMap::const_iterator itr = GetAuras().begin(); itr!= GetAuras().end(); ++itr)
{
- bool first = true;
- ProcTriggeredList::iterator aurItr;
+ ProcTriggeredData triggerData(itr->second);
+
+ if(!IsTriggeredAtSpellProcEvent(pTarget, triggerData.aura, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), triggerData.spellProcEvent))
+ continue;
+
for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
{
if (AuraEffect * aurEff = itr->second->GetPartAura(i))
{
- SpellProcEventEntry const* spellProcEvent = NULL;
- if(!IsTriggeredAtSpellProcEvent(pTarget, aurEff, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent))
+ // Skip this auras
+ if (isNonTriggerAura[aurEff->GetAuraName()])
continue;
- if (first)
- {
- first = false;
- ProcTriggerringAura procAur(itr->second->GetId(), itr->second->GetCasterGUID());
- procTriggered.push_front(procAur);
- aurItr = procTriggered.begin();
- }
- aurItr->triggeringAura[i] = new ProcTriggeredData(spellProcEvent, aurEff);
+ // If not trigger by default and spellProcEvent==NULL - skip
+ if (!isTriggerAura[aurEff->GetAuraName()] && triggerData.spellProcEvent==NULL)
+ continue;
+
+ triggerData.effMask |= 1<<i;
}
}
+ if (triggerData.effMask)
+ procTriggered.push_front(triggerData);
}
// Nothing found
if (procTriggered.empty())
return;
- Aura * parentAura = NULL;
// Handle effects proceed this time
for(ProcTriggeredList::iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
{
- // look for parent aura in auras list, it may be removed while proc even processing
- parentAura = GetAura(i->spellId, i->casterGUID);
- if (!parentAura)
+ // look for aura in auras list, it may be removed while proc event processing
+ if (!HasAura(i->aura))
continue;
- bool inuse = parentAura->IsInUse();
- if (!inuse)
- parentAura->SetInUse(true);
-
- bool useCharges= parentAura->GetAuraCharges()>0;
+ bool useCharges= i->aura->GetAuraCharges()>0;
bool takeCharges = false;
+ SpellEntry const *spellInfo = i->aura->GetSpellProto();
+ uint32 Id=i->aura->GetId();
- for (uint8 j = 0; j<MAX_SPELL_EFFECTS;++j)
- {
- if (!i->triggeringAura[j])
- continue;
+ // For players set spell cooldown if need
+ uint32 cooldown = 0;
+ if (GetTypeId() == TYPEID_PLAYER && i->spellProcEvent && i->spellProcEvent->cooldown)
+ cooldown = i->spellProcEvent->cooldown;
- // possible for stacked auras from same caster, skip then
- if (parentAura->GetPartAura(j)!=i->triggeringAura[j]->triggeredByAura)
+ for (uint8 effIndex = 0; effIndex<MAX_SPELL_EFFECTS;++effIndex)
+ {
+ if (!(i->effMask & (1<<effIndex)))
continue;
- SpellProcEventEntry const *spellProcEvent = i->triggeringAura[j]->spellProcEvent;
- AuraEffect *triggeredByAura =triggeredByAura = i->triggeringAura[j]->triggeredByAura;
-
- SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
- uint32 effIndex = triggeredByAura->GetEffIndex();
- // For players set spell cooldown if need
- uint32 cooldown = 0;
- if (GetTypeId() == TYPEID_PLAYER && spellProcEvent && spellProcEvent->cooldown)
- cooldown = spellProcEvent->cooldown;
+ AuraEffect *triggeredByAura = i->aura->GetPartAura(effIndex);
+ assert(triggeredByAura);
switch(triggeredByAura->GetAuraName())
{
@@ -11611,19 +11673,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
}
takeCharges=true;
}
- if (!inuse)
- parentAura->SetInUse(false);
-
- if ( !parentAura->GetAuraDuration() && !(parentAura->IsPermanent() || (parentAura->IsPassive())) )
- RemoveAura(parentAura);
- else
+ // Remove charge (aura can be removed by triggers)
+ if(useCharges && takeCharges)
{
- // Remove charge (aura can be removed by triggers)
- if(useCharges && takeCharges)
- {
- if (parentAura->DropAuraCharge())
- RemoveAura(parentAura->GetId(),parentAura->GetCasterGUID());
- }
+ if (i->aura->DropAuraCharge())
+ RemoveAura(i->aura);
}
}
}
@@ -12243,20 +12297,13 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
return pet;
}
-bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, AuraEffect * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent )
+bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent )
{
SpellEntry const* spellProto = aura->GetSpellProto ();
// Get proc Event Entry
spellProcEvent = spellmgr.GetSpellProcEvent(spellProto->Id);
- // Skip this auras
- if (isNonTriggerAura[aura->GetAuraName()])
- return false;
- // If not trigger by default and spellProcEvent==NULL - skip
- if (!isTriggerAura[aura->GetAuraName()] && spellProcEvent==NULL)
- return false;
-
// Get EventProcFlag
uint32 EventProcFlag;
if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
@@ -12362,8 +12409,6 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
else
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
- //Get max possible jumps for aura to get proper charges amount for target
-
if(Player* caster = ((Player*)triggeredByAura->GetCaster()))
{
caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL);
@@ -12371,7 +12416,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
if (Unit* target= GetNextRandomRaidMemberOrPet(radius))
{
CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID());
- if (Aura * aur = GetAura(spellProto->Id, caster->GetGUID()))
+ if (Aura * aur = target->GetAura(spellProto->Id, caster->GetGUID()))
aur->SetAuraCharges(jumps);
//bonus must be applied after aura cast on target
@@ -12425,19 +12470,14 @@ bool Unit::HandleAuraRaidProcFromCharge( AuraEffect* triggeredByAura )
else
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
- //Get max possible jumps for aura to get proper charges amount for target
- int32 maxJumps = spellProto->procCharges;
-
if(Player* caster = ((Player*)triggeredByAura->GetCaster()))
{
caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL);
- caster->ApplySpellMod(spellProto->Id, SPELLMOD_CHARGES, maxJumps, NULL);
-
if (Unit* target= GetNextRandomRaidMemberOrPet(radius))
{
- CastSpell(this, spellProto, true,NULL,triggeredByAura,caster_guid);
- if (Aura * aur = GetAura(spellProto->Id, caster->GetGUID()))
+ CastSpell(target, spellProto, true,NULL,triggeredByAura,caster_guid);
+ if (Aura * aur = target->GetAura(spellProto->Id, caster->GetGUID()))
aur->SetAuraCharges(jumps);
}
}
@@ -12796,7 +12836,7 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
if(this == charmer)
return;
- if(isInFlight())
+ if(hasUnitState(UNIT_STAT_UNATTACKABLE))
return;
if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetTransport())
@@ -13107,6 +13147,8 @@ void Unit::GetPartyMember(std::list<Unit*> &TagUnitMap, float radius)
void Unit::HandleAuraEffect(AuraEffect * aureff, bool apply)
{
+ if (aureff->GetParentAura()->IsRemoved())
+ return;
if (apply)
{
m_modAuras[aureff->GetAuraName()].push_back(aureff);
@@ -13145,7 +13187,7 @@ void Unit::AddAura(uint32 spellId, Unit* target)
for(uint32 i = 0; i < 3; ++i)
{
- if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
+ if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || IsAreaAuraEffect(spellInfo->Effect[i]))
{
if(target->IsImmunedToSpellEffect(spellInfo, i))
continue;
@@ -13174,6 +13216,8 @@ Aura * Unit::AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster)
if (aur)
{
AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, NULL, caster);
+ if (!aurEffect)
+ return aur;
if (!aur->SetPartAura(aurEffect, effIndex))
delete aurEffect;
}
@@ -13259,6 +13303,61 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
summon->SetPhaseMask(newPhaseMask,true);
}
+void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
+{
+ if(GetTypeId() == TYPEID_UNIT)
+ {
+ GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
+ }
+ else
+ {
+ float vcos, vsin;
+ GetSinCos(x, y, vsin, vcos);
+
+ WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
+ data.append(GetPackGUID());
+ data << uint32(0); // Sequence
+ data << float(vcos); // x direction
+ data << float(vsin); // y direction
+ data << float(speedXY); // Horizontal speed
+ data << float(-speedZ); // Z Movement speed (vertical)
+
+ ((Player*)this)->GetSession()->SendPacket(&data);
+ }
+}
+
+void Unit::JumpTo(float speedXY, float speedZ, bool forward)
+{
+ float angle = forward ? 0 : M_PI;
+ if(GetTypeId() == TYPEID_UNIT)
+ {
+ GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
+ }
+ else
+ {
+ float vcos = cos(angle+GetOrientation());
+ float vsin = sin(angle+GetOrientation());
+
+ WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8+4+4+4+4+4));
+ data.append(GetPackGUID());
+ data << uint32(0); // Sequence
+ data << float(vcos); // x direction
+ data << float(vsin); // y direction
+ data << float(speedXY); // Horizontal speed
+ data << float(-speedZ); // Z Movement speed (vertical)
+
+ ((Player*)this)->GetSession()->SendPacket(&data);
+ }
+}
+
+void Unit::JumpTo(WorldObject *obj, float speedZ)
+{
+ float x, y, z;
+ obj->GetContactPoint(this, x, y, z);
+ float speedXY = GetExactDistance2d(x, y) * 10.0f / speedZ;
+ GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
+}
+
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
{
if(GetTypeId() == TYPEID_PLAYER)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 2ab00f23407..17e5abb10a0 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -59,9 +59,9 @@ enum SpellChannelInterruptFlags
enum SpellAuraInterruptFlags
{
- AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000001, // 0 removed when getting hit by a negative spell?
+ AURA_INTERRUPT_FLAG_ANY_CAST = 0x00000001, // 0 removed by any cast
AURA_INTERRUPT_FLAG_DAMAGE = 0x00000002, // 1 removed by any damage
- AURA_INTERRUPT_FLAG_CC = 0x00000004, // 2 crowd control
+ AURA_INTERRUPT_FLAG_HITBYSPELL = 0x00000004, // 2 removed when getting hit by a negative spell? aoe damage?
AURA_INTERRUPT_FLAG_MOVE = 0x00000008, // 3 removed by any movement
AURA_INTERRUPT_FLAG_TURNING = 0x00000010, // 4 removed by any turning
AURA_INTERRUPT_FLAG_JUMP = 0x00000020, // 5 removed by entering combat
@@ -71,8 +71,8 @@ enum SpellAuraInterruptFlags
AURA_INTERRUPT_FLAG_NOT_SHEATHED = 0x00000200, // 9 removed by unsheathing
AURA_INTERRUPT_FLAG_TALK = 0x00000400, // 10 talk to npc / loot? action on creature
AURA_INTERRUPT_FLAG_USE = 0x00000800, // 11 mine/use/open action on gameobject
- AURA_INTERRUPT_FLAG_ATTACK = 0x00001000, // 12 removed by attacking
- AURA_INTERRUPT_FLAG_CAST = 0x00002000, // 13 ???
+ AURA_INTERRUPT_FLAG_ATTACK = 0x00001000, // 12 removed by attacking (negative spell cast?)
+ AURA_INTERRUPT_FLAG_CAST = 0x00002000, // 13 cast stealth breaking spell
AURA_INTERRUPT_FLAG_UNK14 = 0x00004000, // 14
AURA_INTERRUPT_FLAG_TRANSFORM = 0x00008000, // 15 removed by transform?
AURA_INTERRUPT_FLAG_UNK16 = 0x00010000, // 16
@@ -295,6 +295,7 @@ class Pet;
class Path;
class PetAura;
class Guardian;
+class UnitAI;
struct SpellImmune
{
@@ -328,7 +329,6 @@ enum DamageTypeToSchool
enum AuraRemoveMode
{
- AURA_NO_REMOVE_MODE = 0,
AURA_REMOVE_BY_DEFAULT,
AURA_REMOVE_BY_STACK, // change stack, single aura remove,
AURA_REMOVE_BY_CANCEL,
@@ -422,6 +422,8 @@ enum UnitState
UNIT_STAT_POSSESSED = 0x00010000,
UNIT_STAT_CHARGING = 0x00020000,
UNIT_STAT_JUMPING = 0x00040000,
+ UNIT_STAT_ONVEHICLE = 0x00080000,
+ UNIT_STAT_UNATTACKABLE = (UNIT_STAT_IN_FLIGHT | UNIT_STAT_ONVEHICLE),
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE),
UNIT_STAT_CONTROLLED = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONTROLLED | UNIT_STAT_JUMPING | UNIT_STAT_CHARGING),
@@ -857,6 +859,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
virtual ~Unit ( );
+ void AddToWorld();
void RemoveFromWorld();
void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
@@ -1142,6 +1145,10 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void NearTeleportTo(float x, float y, float z, float orientation, bool casting = false);
+ void KnockbackFrom(float x, float y, float speedXY, float speedZ);
+ void JumpTo(float speedXY, float speedZ, bool forward = true);
+ void JumpTo(WorldObject *obj, float speedZ);
+
void SendMonsterStop();
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
@@ -1150,8 +1157,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL);
void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL);
- virtual void MoveOutOfRange(Player &) { };
-
bool isAlive() const { return (m_deathState == ALIVE); };
bool isDead() const { return ( m_deathState == DEAD || m_deathState == CORPSE ); };
DeathState getDeathState() { return m_deathState; };
@@ -1395,6 +1400,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
AuraEffect* GetAura(AuraType type, uint32 family, uint32 familyFlag1 , uint32 familyFlag2=0, uint32 familyFlag3=0, uint64 casterGUID=0);
bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
bool HasAura(uint32 spellId, uint64 caster = 0) const;
+ bool HasAura(Aura * aur) const;
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const;
@@ -1491,6 +1497,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/ ) { /* nothing to do yet */ }
static Unit* GetUnit(WorldObject& object, uint64 guid);
+ static Player* GetPlayer(uint64 guid);
+ static Creature* GetCreature(WorldObject& object, uint64 guid);
MotionMaster* GetMotionMaster() { return &i_motionMaster; }
@@ -1555,6 +1563,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
UnitAI *i_AI, *i_disabledAI;
void _UpdateSpells(uint32 time);
+ void _DeleteAuras();
void _UpdateAutoRepeatSpell();
bool m_AutoRepeatFirstCast;
@@ -1576,12 +1585,12 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
std::list<GameObject*> m_gameObj;
bool m_isSorted;
uint32 m_transform;
- uint32 m_removedAuras;
AuraEffectList m_modAuras[TOTAL_AURAS];
AuraList m_scAuras; // casted singlecast auras
AuraList m_interruptableAuras;
AuraList m_ccAuras;
+ AuraList m_removedAuras;
uint32 m_interruptMask;
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END];
@@ -1609,7 +1618,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendAttackStop(Unit* victim); // only from AttackStop(Unit*)
//void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
- bool IsTriggeredAtSpellProcEvent(Unit *pVictim, AuraEffect* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
+ bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
@@ -1642,5 +1651,20 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 m_reducedThreatPercent;
uint64 m_misdirectionTargetGUID;
};
+
+namespace Trinity
+{
+ template<class T>
+ void RandomResizeList(std::list<T> &_list, uint32 _size)
+ {
+ while(_list.size() > _size)
+ {
+ typename std::list<T>::iterator itr = _list.begin();
+ advance(itr, urand(0, _list.size() - 1));
+ _list.erase(itr);
+ }
+ }
+}
+
#endif
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 9105e6a8eb8..d9a22a4a4a2 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -40,6 +40,7 @@
#include "AchievementMgr.h"
#include "AuctionHouseMgr.h"
#include "ObjectMgr.h"
+#include "CreatureEventAIMgr.h"
#include "SpellMgr.h"
#include "Chat.h"
#include "DBCStores.h"
@@ -736,7 +737,7 @@ void World::LoadConfigSettings(bool reload)
{
sLog.outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_configs[CONFIG_START_HONOR_POINTS],m_configs[CONFIG_MAX_HONOR_POINTS],0);
- m_configs[CONFIG_MAX_HONOR_POINTS] = 0;
+ m_configs[CONFIG_START_HONOR_POINTS] = 0;
}
else if(m_configs[CONFIG_START_HONOR_POINTS] > m_configs[CONFIG_MAX_HONOR_POINTS])
{
@@ -1371,6 +1372,7 @@ void World::SetInitialWorldSettings()
sLog.outString();
achievementmgr.LoadAchievementReferenceList();
achievementmgr.LoadAchievementCriteriaList();
+ achievementmgr.LoadAchievementCriteriaData();
achievementmgr.LoadRewards();
achievementmgr.LoadRewardLocales();
achievementmgr.LoadCompletedAchievements();
@@ -1447,6 +1449,15 @@ void World::SetInitialWorldSettings()
sLog.outString( "Loading Scripts text locales..." ); // must be after Load*Scripts calls
objmgr.LoadDbScriptStrings();
+ sLog.outString( "Loading CreatureEventAI Texts...");
+ CreatureEAI_Mgr.LoadCreatureEventAI_Texts();
+
+ sLog.outString( "Loading CreatureEventAI Summons...");
+ CreatureEAI_Mgr.LoadCreatureEventAI_Summons();
+
+ sLog.outString( "Loading CreatureEventAI Scripts...");
+ CreatureEAI_Mgr.LoadCreatureEventAI_Scripts();
+
sLog.outString( "Initializing Scripts..." );
if(!LoadScriptingModule())
exit(1);
@@ -3190,14 +3201,20 @@ void World::UpdateMaxSessionCounters()
void World::LoadDBVersion()
{
QueryResult* result = WorldDatabase.Query("SELECT db_version FROM version LIMIT 1");
+ //QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version FROM db_version LIMIT 1");
if(result)
{
Field* fields = result->Fetch();
- m_DBVersion = fields[0].GetString();
+ m_DBVersion = fields[0].GetCppString();
+ //m_CreatureEventAIVersion = fields[1].GetCppString();
delete result;
}
- else
- m_DBVersion = "unknown world database";
+
+ if(m_DBVersion.empty())
+ m_DBVersion = "Unknown world database.";
+
+ if(m_CreatureEventAIVersion.empty())
+ m_CreatureEventAIVersion = "Unknown creature EventAI.";
}
diff --git a/src/game/World.h b/src/game/World.h
index 2f261467a6c..27075885368 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -560,6 +560,7 @@ class World
//used World DB version
void LoadDBVersion();
char const* GetDBVersion() { return m_DBVersion.c_str(); }
+ char const* GetCreatureEventAIVersion() { return m_CreatureEventAIVersion.c_str(); }
//used Script version
void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }
@@ -640,6 +641,7 @@ class World
//used versions
std::string m_DBVersion;
+ std::string m_CreatureEventAIVersion;
std::string m_ScriptsVersion;
};
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 01bda647fa4..da6837b1662 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -240,7 +240,7 @@ bool WorldSession::Update(uint32 /*diff*/)
void WorldSession::LogoutPlayer(bool Save)
{
// finish pending transfers before starting the logout
- while(_player && _player->IsBeingTeleported())
+ while(_player && _player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
m_playerLogout = true;
diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp
index 5480dfbbc7c..152110012eb 100644
--- a/src/shared/Log.cpp
+++ b/src/shared/Log.cpp
@@ -837,7 +837,7 @@ void Log::outChat( const char * str, ... )
outTimestamp(chatLogfile);
va_list ap;
va_start(ap, str);
- fprintf(chatLogfile, str, ap);
+ vfprintf(chatLogfile, str, ap);
fprintf(chatLogfile, "\n" );
fflush(chatLogfile);
va_end(ap);
diff --git a/src/trinitycore/CliRunnable.cpp b/src/trinitycore/CliRunnable.cpp
index 0f37535c8f4..91f37cd1b48 100644
--- a/src/trinitycore/CliRunnable.cpp
+++ b/src/trinitycore/CliRunnable.cpp
@@ -253,6 +253,20 @@ bool ChatHandler::HandleAccountCreateCommand(const char* args)
}
/// Set the level of logging
+bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args)
+{
+ if(!*args)
+ return false;
+
+ char *NewLevel = strtok((char*)args, " ");
+ if (!NewLevel)
+ return false;
+
+ sLog.SetLogFileLevel(NewLevel);
+ return true;
+}
+
+/// Set the level of logging
bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
{
if(!*args)
diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp
index 339ca2d1662..a478f18daa9 100644
--- a/src/trinitycore/Master.cpp
+++ b/src/trinitycore/Master.cpp
@@ -481,7 +481,8 @@ bool Master::_StartDB()
sWorld.LoadDBVersion();
- sLog.outString("Using %s", sWorld.GetDBVersion());
+ sLog.outString("Using World DB: %s", sWorld.GetDBVersion());
+ sLog.outString("Using creature EventAI: %s", sWorld.GetCreatureEventAIVersion());
return true;
}